我在EmployeeEntity
和MyCompany.Entities.Employee.dll
EmployeeMap: ClassMapping<SPListItem>
存储了MyCompany.Mapping.dll
,两者都存储在GAC中。
我使用map-by-code创建ISessionFactory实现,如下所示:
var config = new Configuration();
// Initialize config code omitted...
var mapper = new ModelMapper();
mapper.AddMapping(typeof(EmployeeMap));
config.AddDeserializedMapping(mapping, "ExampleMapping");
// Exception thrown here:Could not compile the mapping document: ExampleMapping
// InnerException:persistent class KT.NHibernate.Mapping.Entities.Employee, KT.Nhibernate.Mapping.Entities not found
return config.BuildSessionFactory();
如何正确配置Configuration实例以在映射中使用GAC程序集?
答案 0 :(得分:0)
这与GAC无关。您需要捕获异常并查看内部异常以找出错误 - 可能是映射中的内容。
答案 1 :(得分:0)
mapping.assembly =“MyCompany.Entities.Employee程序集强名称”;