Further to my last post I have noticed that in the NH source, file
Nullability.cs in the CheckNullability method, if I comment out the
line 'throw new PropertyValueException("not-null property references a
null or transient value", persister.EntityName,
persister.PropertyNames[i]);' then the code I have used (mentioned
above) works fine. However I dont really want to do that as Im sure
that code is there for a reason, Im wondering if there should be an
extra check here before the error is thrown to stop my code reaching
that error?
public void CheckNullability(object[] values, IEntityPersister
persister, bool isUpdate)
{
...
bool[] nullability = persister.PropertyNullability;
bool[] checkability = isUpdate ?
persister.PropertyUpdateability : persister.PropertyInsertability;
IType[] propertyTypes = persister.PropertyTypes;
for (int i = 0; i < values.Length; i++)
{
if (checkability[i])
{
object value = values[i];
if (!nullability[i] && value == null)
{
//check basic level one nullablilty
throw new PropertyValueException("not-null
property references a null or transient value", persister.EntityName,
persister.PropertyNames[i]); // Commenting out this line fixes my
problem
}
else if (value != null)
{
//values is not null and is checkable, we'll look
deeper
string breakProperties =
CheckSubElementsNullability(propertyTypes[i], value);
if (breakProperties != null)
{
throw new PropertyValueException("not-null
property references a null or transient value", persister.EntityName,
BuildPropertyPath(persister.PropertyNames[i], breakProperties));
}
}
}
}
}
--
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.