c# - Using DI with a shared library across applications -


i'm facing design challenge can't seem solve in satisfactory way. i've got class library assembly contains of shared orm objects (using entityspaces framework). these objects used in 2 or more different applications why in own assembly. setup has worked fine 4+ years me.

i have couple of applications built on composite application block (cab) microsoft's patterns & practices group (p&p). yes, know old i'm part time developer, one-man-shop , can't afford update whatever current framework is.

here problem comes in: have been exercising oo design skills , whenever doing substantial refactoring try shift procedural approach more oo approach. of course major aspect of oo design placing operations close data work with, means orm objects need have functionality added them appropriate. proving real head scratcher when consider i'm using p&p's object builder di container within cab , of functionality move orm objects need access services exposed applications.

in other words, let's have shared business object called "person" (original, know) , have 2 applications entirely different things person. application provides set of services person object need have di'ed in order take on of methods littered throughout services layers. application b has different set of services needs have di'ed person object.

considering how p&p object builder resolves dependencies using attribute decoration , type reflection don't see how can accomplish this. in nutshell, have shared object when used in various applications need inject dependencies can perform operations specific application.

the approach can come inherit new type in application & b person object. add non-shared functionality , di code application-specific specialized person object. write seems obvious, it's still solution can come , wanted ask here see if else had different solution propose?

one problem have solution can see myself getting caught on naming inherited type - mean... it's person, else call it? anyways, have ideas me.

also, i'm not hip on current technologies out there , really, honest barely grasp ones i'm using. if i've said contradictory or confusing hope can understand enough rest of post i'm asking.

it sounds you're breaking single responsibility principle.

a person object should holding data person record. services take in person object , manipulate rather having methods on person object did manipulation.

a classic example of populating person object. lets app grabs data webservice, , app b grabs database. in these cases i'd have sort of storage service call person object. implementation of storage can specific each application, , put ioc app, rather trying have common interface in shared assembly.


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -