Basic quetion about domain model and design pattern

  • Thread starter Thread starter Julia
  • Start date Start date
J

Julia

Hi,

I have asked this before,and I didn't get answer, I guess I didn't properly
explain self

I have a domain model in which the lower component-Channel- in the hierarchy
can be replaced
at run time,using reflection

Application[m_ApplicationContext]
-->Manager
------>MessagingService
---------->Channel

The problem which I faced is that different type of Channel expect different
set of properties
and I would like not to us a HASH table or a collection,
The properties are being loaded by the application into the application
context

I am looking for a way to easily replace the channel,and the application
context
and to notify the channel when one of its properties was changed.


Thanks in advance
 
Well basicly you could use reflection to find the properties when your
loading the channel object into the application context. Theres a method
on the Type object called GetProperties

Additionally you could create a custom attribute and mark the properties
you wan't to work with.

One note on this technique tough, reflection is slow. I would implement
some kind of identitymap and store properties for specific channels there.
 
I am looking for a way to easily replace the channel,and the application
context
and to notify the channel when one of its properties was changed.

I suggest that you take a look at the Spring Framework at
http://www.springframework.net at the core this framework has an Inversion
of Control container enabling you to configure relationships between
different objects in XML instead of in code.

Anders Norås
blog: http://dotnetjunkies.com/weblog/anoras/
 
Back
Top