Thank you Brendan, you help me a lot in clarifying my mind.
There are 2 options here: 1. These library already has backing DB and you can/must live with that pair. Then you can use ConfORM (or probably that capabilities already in NH core) to marry them with your app. See http://fabiomaulo.blogspot.com/2010/03/conform-mapping-aspnet-membership.html 2. Their library have no notion of DB (my case). Then all options that you already described may apply. What stuck me for a while is that all collections in whatever form they exist in that library and which I want to persist as tables with relationships need to be (lifted to || wrapped by) my classes that knows what is DB and how to deal with it. Shame on me;) No, you actually may not lift them and dear NH will still persist them as varbinary. Or you can persist them as delimited strings. My choice will be to wrap them: public class MyTheirClass: TheirType, IEntity { } Thank you again, Brandon. Alex. On Dec 19, 5:06 am, brendan richards <[email protected]> wrote: > Sorry to keep spamming this question (also my second post got sent > accidentally) > > I believe it may be possible to map directly to arrays via the <array> > mapping. > This option requires that your DB has an index column which would be > possible with your "DB from scratch" use case. > > I couldn't find any direct NHibernate examples but found this for java > Hibernate:http://helpdesk.objects.com.au/java/how-to-map-an-array-using-hibernate > > One thing to remember: if it's not a NHibernate collection > implementation then the session can't keep track of changes so it may > have to delete / recreate every time you save - which may not perform > well.http://nhforge.org/doc/nh/en/index.html#performance-collections > > On Dec 19, 11:09 am, brendan richards <[email protected]> wrote: > > > > > > > > > Other options are: > > > - Write a wrapper class for each external type that manually converts > > arrays to NHibernate persistent collections on demand - there may be > > issues keeping NHibernate and external collections in sync. > > > - skip NHibernate collections and load child collections manually via > > NHibernate queries. So an object returned from Session.load would have > > empty collections and you neeed to manually perform an extra step to > > hydrate them yourself. You could use an interceptor to manually > > hydrate these collections. > > > Just remember if you're using array collections, the NHibernate > > session will not be able to track changes to the collection so you'll > > need to manage this yourself. > > > On Dec 18, 4:10 am, Al Su <[email protected]> wrote: > > > > Hi all, > > > > As per subject: > > > - we have 3rd party library that we can't change; > > > - this library uses arrays for children collections (it can be arrays > > > of system types(System.Uri) or library's custom types (2-3 levels > > > deep) - all public); > > > - NO ConventionalModelMapper - we want explicitly map all that we need > > > (to much to exclude); > > > - we don't want anything from these library but data to persist; > > > - DB from scratch. > > > > What will be the best practice solution in this case? > > > > public class MyType : Entity > > > { > > > public virtual TheirType theirtype { get; set; } > > > ........ > > > > } > > > > I have no problem to map simple properties from theirtype, but how can > > > I map (array) collections here? > > > > Thank you, > > > Alex. -- 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.
