Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help for a use case #43

Open
Loppone opened this issue Apr 5, 2018 · 0 comments
Open

Help for a use case #43

Loppone opened this issue Apr 5, 2018 · 0 comments

Comments

@Loppone
Copy link

Loppone commented Apr 5, 2018

Hello,
i have a similar situation.
I was forced to create a IPerformer interface with parametrized methods because MyClass works with Ninject and i can't add more parameters other than bound interface to kernel.
My goal is to remove parameters to IPerformer methods and pass in some way to Myclass.
Factory could be the solution, but i can't figure how to do it.
Can someone drop me some lines of code, please?

public Interface IPerformer
{
	void Perform_A(int id, string name);
	void Perform_B(int id, string name);
	void Perform_C(int id, string name);
}


public MyClass : IPerformer
{
	private readonly IMapper _mapper;
	private readonly IManager _manager;

	public MyClass(IMapper mapper, IManager manager)
	{
		_mapper = mapper;
		_manager = manager;
	}

	public void Perform_A(int id, string name)
	{ 
		_manager.DoSomething_A(id, name);
	}

	public void Perform_B(int id, string name)
	{
		_manager.DoSomething_B(id, name);
	}

	public void Perform_C(int id, string name)
	{
		_manager.DoSomething_C(id, name);
	}
}

StackOverflow reference: My StackOverflow post

Thanks
Max

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant