Trying to use FNH to map a view - FNH insists on having a Id property mapped. However not all of my vie开发者_如何学运维ws have a unique identifing column.
I can get around this with XML mappings as I can just specify a
<id type="int">
<generator class="increment"/>
</id>
at the top of the mapping.
Is there any way to duplicate this in FNH...?
Pretty sure the view has to be indexable which I haven't done in some time, but I recall it involves setting up composite keys and ensuring the view can be SchemaBound. Then in the FNH mapping you would specify the table name (which you probably already are) and the UseCompositeId method.
mapping.Id(x => x.ID).GeneratedBy.Increment()
But probably, my understanding of the question is incorrect.
At the time I asked the question, this wasn't supported in Fluent NHibernate
. One of the developers added it as feature, and we are evaluating it at the moment.
精彩评论