I've done some research on this and had some follow up questions.
1. this only works for properties, not many-to-one, correct?
2. How does this effect generating db foreign keys (schema export, at
least for testing)?
3. How is criteria/hql affected by an IUserType instead of a many-to-
one?
On Oct 6, 5:11 pm, "Ayende Rahien" <[EMAIL PROTECTED]> wrote:
> IUserType is the way to go.
>
> On Tue, Oct 7, 2008 at 12:02 AM, Jason Meckley <[EMAIL PROTECTED]>wrote:
>
>
>
> > I would like to use null objects for optional behavior in my
> > entities. currently I have this
> > class Child
> > {
> > private IParent parent = null;
> > public IParent { get {return parent;} set{parent = value;} }
> > }
>
> > interface IParent { //readonly members }
>
> > public class Parent : IParent
> > {
> > //poco members
> > }
>
> > where parent is optional for child. Both child and parent have
> > associated mapping files.
>
> > I would like to also have a NullParent object which inherits IParent.
> > This way I'm not always checking for null values.
>
> > class NullParent : IParent
> > {
> > protected NullParent() {}
> > public static readonly IParent Instance = new NullParent();
> > //readonly members
> > }
>
> > class Child
> > {
> > private IParent parent = NullParent.Instance;
> > public IParent { get; set; }
> > }
>
> > but NH throws a PropertyAccessException. Object does not match target
> > type. is there a way to use NullObjects with NH, or do I need to
> > provide a service to do this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---