关于 c#:Automapping 和 Fluent NHibernate
Automapping and Fluent NHibernate
我从 Fluent NHibernate GitHub 文档中复制了用于自动映射的示例,但它在我的 ASP.NET MVC 4 应用程序中不起作用。
|
public class Product
{ public virtual int Id { get; set; } public virtual string Name { get; set; } public virtual decimal Price { get; set; } } public class Shelf public Shelf() |
是模型。当我添加
|
.Mappings(m => m.AutoMappings
.Add(AutoMap.AssemblyOf<Product>())) |
对于我的配置,我得到错误
问题在于,在包含
|
.Mappings(m =>
m.AutoMappings .Add(AutoMap.AssemblyOf<Product>() .Where(t => t.Namespace ==... |
...或类似的东西。准确地说应该自动映射的内容。
相关讨论
- 它有效...非常感谢。我需要等待接受答案:)
- 伟大的。享受 NHibernate 😉
THE END
二维码