I am a complete beginner with Fluent and I am running into an issue which is probably my own fault.
I have a namespace containing 3 classes. Entity, EntityVersion and Property. No inheritance involved between the classes.
I try to only map the Entity class but what happens is that all classes in the namespace are being mapped. What am I doing wrong here?
private static ISessionFactory CreateSessionFactory() {
return Fluently.Configure()
.Database(
MsSqlConfiguration.MsSql2005
.ConnectionString("Data Source=MSCHOPMAN\\SQLEXPRESS;Initial Catalog=framework;Integrated Security=SSPI"))
.Mappings(m =>
{
m.AutoMappings.Add(
AutoMap.AssemblyOf<Entity>()
//.IgnoreBase<Entity>()
.Where(t => t.Namespace == "Modules.Business.Entities")
)
.ExportTo("c:\\temp");
}
)
.ExposeConfiguration(BuildSchema)
.BuildSessionFactory();
}
And the Entity class:
using System; using System.Collections; using System.Collections.Generic; using System.Data;
using Modules.Data;
namespace Modules.Business.Entities { public class Entity { public virtual int Id { get; set; } public virtual int ParentId { get; set; } public virtual int TypeId { get; set; } //public virtual IList Versions { get; set; }
public Entity()
{
//Versions = new List<EntityVersion>();
}
} }