.net - NHibernate Component not-null property when being inserted -
Any component assigned to any child's property will be set to zero when recovering from the database.
I do not think this is just an additional test to see if the component is null or not. But when I try to update that object with that null component or to include that data, I get an error:
"How to make a blank or transient [full property name] how to make NHibernate I pass through a null, but it will not accept myself.
Is there a mapping option, I am missing to override it or do I set a value to the component before updating Tax Do not enter or enter in the database?
Thanks
If all the properties are zero The component is when you type it is a common practice.
When you use an auto-property with a public setter, you may have a problem like this
If you have this:
public virtual MyComponent MyComponentObject {get; set;}
You have to do this instead:
< Pre> private MyComponent _myComponent; public virtual MyCompo Nent MyComponentObject {get {if (referenced (empty, _myComponent)) {_myComponent = new MyComponent (); } Return _myComponent; } Set {_myComponent = value; }}
hh,
Crish-I,
Comments
Post a Comment