Steves
Steves

Reputation: 3234

FluentNHibernate Auto Mappings and ISet in .NET 4.0

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(?)

Upvotes: 2

Views: 1019

Answers (2)

Mauricio Scheffer
Mauricio Scheffer

Reputation: 99750

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.

Upvotes: 2

Tom Bushell
Tom Bushell

Reputation: 5875

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!

Upvotes: 0

Related Questions