Yes I want to load a collection property. So I use a IPropertyAccessor
implementation to load and persist custom collections. It worked like
a charm until now. I've fixed this bug by creating a new collection:
public override void Set(object target, object value)
{
var val = new List<T>((IEnumerable<T>)value);
var initializedField = typeof(AbstractPersistentCollection).GetField
("initialized", BindingFlags.NonPublic | BindingFlags.Instance);
bool savedInitializedFieldValue = (bool) initializedField.GetValue
(value);
initializedField.SetValue(value, true);
propertyInfo.SetValue(target, Activator.CreateInstance
(fieldInfo.FieldType, val), null);
initializedField.SetValue(value, savedInitializedFieldValue);
}
It works but it's a little less efficient and frustrating because I
don't understand the bug...
I'll have a look at ICollectionTypeFactory, thanks.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---