The way is not IUserCollectionType but ICollectionTypeFactory

2009/10/22 Matt Mangold <[email protected]>

>
> My domain objects support custom fields that are stored in such a way
> that requires metadata and logic to be applied before their values can
> be stored and retrieved.
>
> I already have a Custom Field Repository that handles the persistence
> of custom fields, and I don't want to try to recreate that logic in
> NHibernate mappings.
>
> I would however like to support lazy loading of my custom fields. It
> would be nice if I could somehow trick the proxy into calling my
> dedicated repository for loading and saving rather than going through
> the NHibernate engine.
>
> One way I solved this problem was to implement an interceptor which
> worked, but I took a performance hit when loading large amounts of
> data, because the dedicated repository was called each time an entity
> was loaded. It would be nice instead, if those calls to load custom
> fields were done lazily! From what I understand lazy loading cannot be
> done in an interceptor.
>
> I have looked into implementing a custom user type (IUserType and
> IUserCollectionType), but the documentation is very limited, and I
> want to learn if it is even possible to do what I want before I go
> down the path of trying.
>
> Here is an example of one of my domain objects:
>
> public class ContactEntity : ICustomFieldContainer
> {
>     public long ContactId { get; set; }
>     public String FirstName { get; set; }
>     public String LastName { get; set; }
>
>     #region ICustomFieldContainer Members
>     public List<CustomFieldEntity> CustomFields { get; set; }
>     #endregion
> }
>
> >
>


-- 
Fabio Maulo

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

Reply via email to