gpt4 book ai didi

nhibernate - 流畅的 NHibernate : Prevent class from being mapped

转载 作者:行者123 更新时间:2023-12-05 00:08:54 26 4
gpt4 key购买 nike

我确定这是小菜一碟,但我无法使用谷歌找到它。
我需要从映射中排除一个类。我目前的配置是:

return Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2005.ConnectionString(c =>
c.Is(@"Data Source=PC\SQLEXPRESS;......")))
.Mappings(m =>
m.AutoMappings.Add(
AutoPersistenceModel.MapEntitiesFromAssemblyOf<Person2>()
.Where(t => t.Namespace == "ExampleData.HumansTest")
.UseOverridesFromAssemblyOf<PersonMappingOverrides>()
.ConventionDiscovery.AddFromAssemblyOf<PersonMappingOverrides>()
)
).BuildConfiguration();

效果很好,到目前为止...
但是我有一些不想映射的类。有没有类似的东西:

伪代码:
return Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2005.ConnectionString(c =>
c.Is(@".......")))
.Mappings(m =>
m.AutoMappings.Add(
AutoPersistenceModel.MapEntitiesFromAssemblyOf<Person2>()
.Where(t => t.Namespace == "ExampleData.HumansTest")
.DO_NOT_MAP_CLASS<UnfinishedClass>
.UseOverridesFromAssemblyOf<PersonMappingOverrides>()
.ConventionDiscovery.AddFromAssemblyOf<PersonMappingOverrides>()
)
).BuildConfiguration();

最佳答案

我会尝试

...
.Where(t => t.Namespace == "ExampleData.HumansTest"
&& t != typeof(UnfinishedClass))
...

关于nhibernate - 流畅的 NHibernate : Prevent class from being mapped,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1046237/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com