我的包装器类具有以下映射代码:
public class ActiveModuleMapping : ClassMap<ActiveModule>
{
public ActiveModuleMapping()
{
CompositeId().KeyProperty(x => x.ModuleID, "suite_activeModuleModuleID").KeyProperty(x => x.CityID, "suite_activeModuleCityID").Mapped();
Id(x => x.ActiveModuleID).Column("suite_activeModuleID");
HasOne(x => x.Module);
HasMany(x => x.ModifierList).Table("suite_activemodifier").KeyColumns.Add("suite_modifiersModuleID", "suite_modifiersCityID").Cascade.All().Not.LazyLoad();
Table("suite_activemodule");
}
}
这是我的基于模块的类:
public class ModuleMapping : ClassMap<Module>
{
public ModuleMapping()
{
Id(x => x.ModuleID).Column("suite_availableModulesID");
Map(x => x.ModuleName).Column("suite_availableModulesName").Not.LazyLoad();
Map(x => x.CanOpen).Column("suite_availableModulesCanOpen").Not.LazyLoad();
Map(x => x.CanConfigure).Column("suite_availableModulesCanConfigure").Not.LazyLoad();
Table("suite_modules");
}
}
这是我的修改器映射:
public class ActiveModifierMapping : ClassMap<ActiveModifier>
{
public ActiveModifierMapping()
{
CompositeId().KeyProperty(x => x.ModuleID, "suite_modifiersModuleID").KeyProperty(x => x.CityID, "suite_modifiersCityID");
Table("suite_activemodifier");
}
}
现在我遇到两个问题:
type Int64 expects 1 columns, but 2 were mapped
的{{1}} 说明:
如何将HasOne与具有不同ID星座的映射一起使用?为什么即使存在现有组合,映射也不会加载ModifierList?