我似乎无法运行 FluentNHibernate 覆盖。这是我的配置方法
private static void Configure()
{
if (_configuration != null) return;
_configuration = new Configuration();
_configuration.Configure();
_configuration
.AddAssembly(typeof(IFoo).Assembly)
.AddAssembly(OtherDataAssembly);
var autoPersistenceModel = AutoMap
.AssemblyOf<IFoo>()
.AddEntityAssembly(OtherDataAssembly)
.Conventions.AddAssembly(OtherDataAssembly)
.Conventions.Add(DefaultCascade.None())
.UseOverridesFromAssemblyOf<IFoo>()
.UseOverridesFromAssembly(OtherDataAssembly)
.OverrideAll(map => map.IgnoreProperty("IsIgnored"))
.Where(IsTypeMatch);
_sessionFactory = Fluently
.Configure(Configuration)
.Mappings(m => m.AutoMappings
.Add(autoPersistenceModel))
.BuildSessionFactory();
}
这是我的覆盖类
public class FooOverride : IAutoMappingOverride<IFoo>
{
public void Override(AutoMapping<IFoo> mapping)
{
mapping.Not.LazyLoad();
mapping.HasManyToMany(x => x.Bar).Table("FooBar");
}
}
我在Override()
方法中放置的断点在调试时永远不会被命中,即使在重新启动 IIS 时也是如此。我如何让它运行?