|
Ok, I've given in and have decided to allow my entities to know about my DAL, and I'm using dependency injection to provide my entity with an instance of the DAOFactory in the OnLoad of the IInterceptor, if the entity implements an IUsesDAOFactory interface.
I was also planning on having an "ILoadExternalData" interface, implementing a "Load" kind of method so that after I've injected the DAOFactory into the entity I can call the LoadExternalData() method on it, and the method can implement it's own calls to the relevant DAOs to populate related entities that come from elsewhere (i.e. another database/session). However to populate related entities, it will need to use values of attributes on itself, which I assume can only be provided using the object[] state and string[] propertyNames collections made available in the OnLoad method of the IInterceptor. Therefore I assume that my Load method on the interface will have to be LoadExternalData(object[] state, string[] propertyNames).
this is starting to look messy. Is there an easier way to do this, or am I being too pedantic in saying it's messy, and it's actually alright??
|