NHibernate mapping Dictionary by code -
how map dictionary using mapping-by-code:
public class user { public virtual dictionary<option, bool> options { get; set; } } }
database looks this:
user useroptions alternative --- --- --- id id id userid optionid bool_column
i tried mapping (looking here):
map(x => x.dictionary, m => { m.key(k => k.column("userid")); m.table("useroptions"); }, k => k.manytomany(m => { m.column("optionid"); }), v => v.element(m => { m.column("bool_column"); }) );
but there error: an association table useroptions refers unmapped class: system.boolean
ok, bug.
solved using xml-mapping user
, , adding configuration.addxmlfile("mappings/user.hbm.xml");
nhibernate mapping-by-code
No comments:
Post a Comment