我有以下课程:
public class PhoneModel
{
public virtual ModelIdentifier SupportModels
}
public class ModelIdentifier
{
public virtual string Name
public virtual IList<string> Values
}
这就是我映射它的方式:
mapping.Component(x => x.SuppoertedModel, y =>
{
y.Map(x => x.Name, "FAMILY_ID");
y.HasMany(x => x.Values).Element("VALUE").Table("SUPPORTEDMODULS")
}
创建了 2 个表:
- PhoneModel 列“FAMILY_ID”
- SUPPORTEDMODELS 列“VALUE”、“PHONE_MODEL_ID”
问题是当我添加值时,它不会将其保存到 SUPPORTEDMODELS 表中:
var pm = new PhoneModel();
pm.SupportedModels.Name = "11"
pm.SupportedModels.Values.Add("34");