2
我有一個問題映射到IDictionary使用新的Loquacious配置。NHibernate 3.2映射IDictionary代碼
這裏的類:
public class Person
{
public Person()
{
Description = new Dictionary<int, string>();
}
public virtual int Id { get; set; }
// can be in various languages
public virtual IDictionary<int, string> Resources { get; set; }
}
public class PersonResource
{
public virtual string Description { get; set; }
}
這裏的映射:
TestPersons
-----------
Id
TestPersonResources
-------------------
Id
Description
idx
的問題是,我該怎麼辦:
public class TestPersonMap : ClassMapping<TestPerson>
{
Table("TestPersons");
Id(c => c.Id, m => m.Generator(Generators.HighLow, gm => gm.Params(new { max_low = 1000 })));
Map(c => c.Resources, mpm =>
{
mpm.Table("TestPersonResources");
mpm.Key(km => km.Column("Id"));
},
mkr => mkr.Component(cem => cem.Property(p => p.Description)));
這在這樣的數據庫生成一個表將TestPersonResources表中'idx'列的名稱更改爲Lcid?
但我似乎無法將它應用到我的問題。
在此先感謝!
感謝分享,這正是我所需要的。至少保存了一個小時的生命:-) – Dav