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
-~----------~----~----~----~------~----~------~--~---