You need to specify it as a map, with an index of whatever the string represents. HasMany(x => x.Properties) .AsMap(x => x.Name);
Where Name is whatever the string key is. On Wed, Mar 25, 2009 at 11:31 AM, Peter <[email protected]> wrote: > > I had read any discussion regarding dictionary mapping with Fluent > NHibernate, either standard or automatic mapping, within this group. > But till now it is not clear to me if this is supported like it is in > NHibernate or it is not supported with Fluent NHibernate. I am using > the trunk version of Fluent NHibernate Revision 430. > > When I try to automap: > > public IDictionary<string, QuoteProperty> Properties { get; set; } > > > I get the following exception: > System.Reflection.TargetInvocationException: Exception has been thrown > by the target of an invocation > The type or method has 2 generic parameter(s), but 1 generic argument > (s) were provided. A generic argument must be provided for each > generic parameter.. > > when I try to do it the standard mapping way: > > HasMany<QuoteProperty>(x => x.Properties); > > I get the following exception: > System.ApplicationException : Error while trying to build the Mapping > Document for ... > ----> NHibernate.MappingException : Could not compile the mapping > document: (XmlDocument) > ----> NHibernate.MappingException : Error mapping generic > collection > Domain.Persistent.Quote.Properties: expected 1 generic parameters, but > the property type has 2 > > If I just use a IList everything is fine for both mapping types. > public IList<QuoteProperty> Properties { get; set; } > > Can you please let me know if it is not supported, or do I need some > special/different setup ? > > Thanks in adavnce, > Peter > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en -~----------~----~----~----~------~----~------~--~---
