i have dictionary i'm mapping using fluent nhibernate. dictionary has complex key type cultureinfo
. database can't store type want use string representation of it.
in mappings other dictionary mappings, can map cultureinfo
-properties using user type convention. wonder how dicationary mappings.
here's entity contains dictionary:
public class multilingualphrase : entity { private idictionary<cultureinfo, string> languagevalues; public virtual idictionary<cultureinfo, string> languagevalues { { return languagevalues; } } }
and here's auto mapping override entity:
public void override(automapping<multilingualphrase> mapping) { mapping .hasmany(n => n.languagevalues) .access.readonlypropertythroughcamelcasefield() .asmap<string>("culturename") .element("phrase") .table("multilingualphrasevalues"); }
this mapping (obviously) causes following error:
failed convert parameter value cultureinfo string.
i know nhibernate has type custom type implementation cultureinfo
(i'm using mapping properties) how specify in mapping override?
this works fine fnh classmap (not sure automapping) in nh 3.1 , fnh 1.2:
hasmany(n => n.languagevalues) .access.readonlypropertythroughcamelcasefield() .asmap<cultureinfo>("culturename") .element("phrase") .table("multilingualphrasevalues");
Comments
Post a Comment