Skip to content

Help for a use case #43

@Loppone

Description

@Loppone

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions