FluentNHibernate Auto Mappings and ISet in .NET 4.0

好久不见. 提交于 2019-12-23 01:05:32

问题


How to set up auto mapping to map System.Collections.Generics.ISet<T> correctly?

I tried implementing IHasManyConvention, but in intellisense it seems that IOneToManyCollectionInstance does not have anything for that(?)


回答1:


This is not up to Fluent NHibernate, because NHibernate just doesn't have any built-in implementation for System.Collections.Generics.ISet<T>.

If you really want to use .NET's ISet instead of Iesi.Collections, for now you'll have to write it yourself. Use PersistentGenericSet for reference.




回答2:


As far as I know, the only generic you can automap right out of the box (i.e. without Conventions, Overrides, or Mapping Classes) is IList.

I've seen a lot of people ask how to map IDictionary, and believe it is possible, but have not needed to do this myself.

But maybe if you do some searching on mapping IDictionaries, you'll learn enough to map an ISet. And if you succeed, please post the code here as an answer to your question!



来源:https://stackoverflow.com/questions/2702077/fluentnhibernate-auto-mappings-and-iset-in-net-4-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!