Fluent NHibernate: Disable Class Mapping

I am sure this is a piece of cake, but I can not find it using Google. I need to exclude one class from the mapping. My current configuration:

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(); 

Works well so far ... But I have some classes that I don't want to display. There is something like:

PSEUDO CODE:

 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(); 
+4
source share
1 answer

I would try

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

Source: https://habr.com/ru/post/1286776/


All Articles