FluentNHibernate: What is the effect of AsSet ()?

In Fluent Nhibernate, what is the effect of specifying AsSet () in relation to HasMany or HasManyToMany?

Assuming the type of property being displayed is an Iesi Set, is there a difference between:

HasMany(x => x.MySetProperty) .AsSet(); 

and

 HasMany(x => x.MySetProperty); 
+7
fluent-nhibernate
source share
1 answer

Assuming your type is an Iesi set, then there is no difference; HasMany call is discretionary enough to understand what you want to install. AsSet is a way to explicitly change your HasMany to Set in situations where FNH may not determine it by type, for example, if you show your collection as IEnumerable , by default it will contain a bag and calling AsSet will cancel it.

+12
source share

All Articles