c# - Looking for pattern to combine partial classes from different assembly's -
c# - Looking for pattern to combine partial classes from different assembly's -
i having next problem. have main project, , projects have similar functionality.
for example: have mvc website, class library project "a" "settingshelper". defines static wrappers configuration settings can used propertys.
then have class library project "b", also contains "settingshelper class".
how can merge these settingshelpers in main project, can use: settingshelper.property both modular projects.
i able plug class libraries 1 project.
sounds pretty much dependency injection. expose settingshelper interface (your contract), , programme against that. di container, such ninject, structuremap, or windsor plug implementation of interface relevant parts of code based on configuration.
this allow code against known contract , provide different libraries depending on circumstances, di framework utilize library concrete implementation of interface.
would need both instances @ same time?
note cannot utilise partial keyword across different assemblies, within assembly.
update: based on comment sounds want composition. have class takes both classes either library , combines them 1 class can used application. whether configure special or load types when libraries present, can encapsulated in new class.
update 2: alternatively, mef:
http://msdn.microsoft.com/en-us/library/dd460648.aspx
c# .net design-patterns
Comments
Post a Comment