Whats happening right now : i have class service and i have 5 propertys on it:
public class Service
{
public string prop1 { get; set; }
public string prop2 { get; set; }
public string prop3 { get; set; }
public string prop4 { get; set; }
public string prop5 { get; set; }
}
the sme class contains 100 methods where all of them want to change this properties, how can i decouple those methods in separate classes/services, so they still can change propertys?
Are there any other ways than usign reference of those propertys as parameters in methods?
UPDATE
So here is a service class:
public class Service
{
public string prop1 { get; set; }
public string prop2 { get; set; }
public string prop3 { get; set; }
public void ChangePropertyInOtherWay()
{
prop3 = "some random string";
}
public void ChangeProperty()
{
prop1 = "12";
}
public void ChangePropertyInSpecialWay()
{
prop2 = "monkey";
}
}
and the executer which handles execution of the functions.
public class Executer
{
private readonly Service _serv;
private readonly Dictionary<string, Action> functionlist;
public Executer(Service serv)
{
_serv = serv;
functionlist = new Dictionary<string, Action>();
functionlist.Add("ChangePropertyInOtherWay", () => serv.ChangePropertyInOtherWay());
functionlist.Add("ChangePropertyInOtherWay", () => serv.ChangePropertyInOtherWay());
functionlist.Add("ChangePropertyInSpecialWay", () => serv.ChangePropertyInSpecialWay());
}
public void ExecuteFunction(string functionName)
{
//INVOKE ONE of the function from the list
}
}
What i want to achieve is to decouple Service from Executer, so in executer i wouldnt need a reference to Service.