100% of people found this useful
For anyone using José's Net4CollectionTypeFactory to enable native ISet<> usage, here's how to get the convention mapper to recognize your ISet<> properties as type Set rather than Bag (code courtesy JFR):
In your mapping
mapper.IsSet(IsSetFieldType);
Function implementation
private static bool IsSetFieldType(MemberInfo mi, bool declared)
{
var propertyTypeIsSet = mi.GetPropertyOrFieldType()
.GetGenericInterfaceTypeDefinitions()
.Contains(typeof(ISet<>));
if (propertyTypeIsSet) return true;
var backFieldInfo = PropertyToField.GetBackFieldInfo((PropertyInfo)mi);
return backFieldInfo != null
&& backFieldInfo
.FieldType.GetGenericInterfaceTypeDefinitions().Contains(typeof(ISet<>));
}
Remember to add the collection type factory to your config..
configuration.CollectionTypeFactory<Net4CollectionTypeFactory>();