boujnah5207 / sharp-architecture

Automatically exported from code.google.com/p/sharp-architecture
Other
0 stars 0 forks source link

IoC-powered entity classes #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be great to be able to force NHibernate to instantiate entity
classes without a default constructor by using Injection of Control. For 

EXAMPLE:

public User : PersistentObject
{
    protected User(IPasswordPolicy passwordPolicy)
    {
    }
}

I don't see any way to let my User check the newly set password for
compliance with a given policy.

Maybe it is possible to use NHibernate with NInject for this?

Greets

J. Fritsch

Original issue reported on code.google.com by j...@jfritsch.de on 19 Nov 2008 at 10:05

GoogleCodeExporter commented 9 years ago
I don't know if NHibernate has this kind of thing but it would be cool if it 
would
provide something like an IInstanceProvider property somewhere. That way you 
could
provide an NInjectInstanceProvider which would allow to inject the dependencies 
of
entities.

Does NHibernate have such a facility? I currently don't have enough time to 
dive into
the NHibernate code, but i would really love to do when i finished my current 
project.

Original comment by j...@jfritsch.de on 22 Nov 2008 at 12:17

GoogleCodeExporter commented 9 years ago
An IIntercepter could be used to provide setter injection to domain objects.  
Another
issue is open to support the IInterceptor - working on that now.

Original comment by wmccaffe...@gmail.com on 12 Jan 2009 at 4:51

GoogleCodeExporter commented 9 years ago
This is part of unhaddins.

http://fabiomaulo.blogspot.com/2008/11/entities-behavior-injection.html

Original comment by jfromani...@gmail.com on 19 Nov 2009 at 1:33