Answering myself here since I figured the first part out right after
posting here... :)
mapper.IsSet((mi, result) => {
var memberType =
NHibernate.Mapping.ByCode.TypeExtensions.GetPropertyOrFieldType(mi);
if(memberType.IsGenericType && memberType.GetGenericTypeDefinition()
== typeof(ICollection<>)) return true;
return result;
});
Still curious to find out how to exclude a property from beeing mapped
though.
On 15 Maj, 00:56, Neo <[email protected]> wrote:
> Hi,
>
> Testing the new Mapping.ByCode in the upcoming NHibernate 3.2 and
> could not find out how to get it to produce my one-to-many collections
> as sets...
>
> If I have an entity like:
> public class Survey : Entity
> {
> public virtual string Name { get; set; }
> public virtual ICollection<Question> Questions { get; set; }
>
> public Survey() {
> this.Questions = new HashedSet<Question>();
> }
>
> }
>
> How would I use the ConventionalModelMapper to create "set"s in the
> mappings for any ICollection<> ?
> (i.e the same thing as in ConfOrm would be: orm.Patterns.Sets.Add(new
> UseSetWhenGenericCollectionPattern());)
>
> And also, how do I exclude a property from beeing mapped?
>
> Cheers!
--
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.