【发布时间】:2012-03-23 03:58:17
【问题描述】:
我在使用新的 Loquacious 配置映射到 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; }
}
这是映射:
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)));
这会在数据库中生成一个表,如下所示:
TestPersons
-----------
Id
TestPersonResources
-------------------
Id
Description
idx
问题是,如何将TestPersonResources表中'idx'列的名称改为Lcid?
但我似乎无法将其应用于我的问题。
提前致谢!
【问题讨论】:
标签: nhibernate nhibernate-mapping nhibernate-mapping-by-code