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.
