i have following problem on need advice.
i have configuration has large number of plugin defined standard iplugin interface struture. each of these interfaces needs access large number of external classes define properties of many custom types.further these classes inhereted many base clases.
the issue here 1 of design on how present these property classes each of plugins in order access these structures.
to expand little classes have multiple lists, sake of discussion 50 lists each having sub items of 30 60 various propeties.
now can of course move property clases interface class dependents, of these clases inherted becomes horible solution. passing ref object not appear workable solution.
i have not included speific code dont think here little psudo version of need achieve.
public interface iplugin { resultslist pluginprocess(class1 l1, class2 l2, ...); }
class(n) may
public class class1 : someotherclass { public object1 obj1 {get; set; } ... public object50 obj50 { get; set;} }
and consists of other derived objects.
within plugins need able use code such
l1.classes.data[0].codec[2].enabled = true; , l2 newclass2 = new l2(); newclass2.nnnn ... resultslist.classes.add(newclass2);
finaly need use plugin architecture in order third partys supply custom processing of data.
any constructive suggestions welcome.
i consider interface based around dictionary<string, object>
.
into dictionary
add of classes useful identifiers.
dictionary["class1"] = new class1(...); dictionary["class2"] = new class2(...);
then pass dictionary
interface.
resultslist pluginprocess(dictionary<string, object> context);
this allow provide arbitrary data consumers. can use api documentation describe key
use each class. allows flexibility grow interface input on time.
its worth taking step further , having special class plugin context.
class context { public dictionary<string, object> values; ... }
you can pass context
object interface.
resultslist pluginprocess(context context);
this gives lot of flexibility grow interface inputs on time. can provide additional functions , data on context
assist consumers.
Comments
Post a Comment