I was suggesting the set collection so you could take advantage of the
immutable set. None of the .net collections offer immutability and trying to
enforce immutability on regular collections in my opinion is bad practice. It's
also a really hard pattern to implement correctly which is why I recommend the
Iesi collections since they're already included with NHibernate and offer the
majority of the usages you can need if it's other than a basic List<>
There are quite a few options of set types included in the collection, normally
I just use IList's but I haven't found a need for immutability yet otherwise
I'd use the Iesi collections. For putting all 3 collections on the same object
I think it's perfectly fine if that's what makes sense business wise. For
having them all on the object I'd definitely recommend getting the lazyloading
pattern working with your objects since if you don't every single time you get
one of your objects you will get your entire collection sets which could be
really heavy on the database if you don't need them everytime you get the
object.
I do believe HashSet is recommended for large collections like 1000+ objects.
-----Original Message-----
From: x97mdr <[email protected]>
To: Fluent NHibernate <[email protected]>
Sent: Mon, 9 Feb 2009 6:02 pm
Subject: [fluent-nhib] Re: Mapping Heterogeneous Types
Thanks Chris,
I was more curious about my decision to put all of the Codes,
Intervals and Patterns into the same Class object. Does that seem ok
to you?
Aside: I'm curious why you would suggest to use the ISet from Iesi
over the IList
A follow on to that would be ... my project is .NET 3.5, would it be
better to use HashSet instead of ISet<T>? I remember reading
somewhere that HashSet is geared for performance with Linq
Thanks
On Feb 8, 4:10?pm, Chris Marisic <[email protected]> wrote:
> I would look at the Iesi Collections that are included with NHibernate
> and instead of IList<Interval> use ISet<Interval> so you can take
> advantage of the ImmutableSet and then in your mapping you'd have
> something like
>
> Map.HasMany(x => x.NumericResponses)
> ? ? .AsSet()
> ? ? .Inverse()
> ? ? .Cascade.All()
> ? ? .CollectionType(typeof(ImmutableSet<Interval>));
>
> I just coded this all free style so I'm not sure if it's 100% perfect
> but it should be some what similar to this.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" 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/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---