c# generics/design patterns: should i template method?
scenario:
(if anyone answered/viewed questions recently rather familar)
i have 3 opposite web services arrangement set objects have commonality. i've combined coupling classes reworking explanation controlling general methods change between surrogate objects use object.
i have an interface webservice, let called iservice purpose question. i have 3 doing classes service1impl, service2impl service3impl. any referencing opposite web use controlling aforementioned general methods modify between suitable objects.
these injected servicewrapper category during runtime around constructor (a bureau used emanate appopriate doing iserivice
e.g:
_service = servicewrapper.getservicewrapper("2");
will give me servicewrapper instantiated service2impl.
(dammit diagrams hella useful!)
ok any doing iservice slight called arguments sake.. getproperties:
public iproperty[] getproperties(string item, iproperty[] properties)
{
property[] props = serviceobjectfactory.createproperties<property>(properties);
property[] outcome = _service.getproperties(item, props);
relapse serviceobjectfactory.createproperties(result);
}
this looks small fraudulent (i cruise i'm going refactor names).
basically duty is:
the duty servicewrapper finished surrogate objects (iproperty) (as parameters).
the surrogate objects converted ability objects use specific.
the outcome comes behind use specific ability objects.
the outcome converted surrogate objects before being upheld behind servicewrapper.
now, formula going accurately same service1impl, service2impl service3impl. solely impetus forms used different.
can anyone cruise proceed i don't have same formula 3 times?
n.b: loyal each slight any implementation. only many them.
Comments
Post a Comment