IAutoMappingOverride not calling
I have AutoMapping Setup. But my IAutoMappingOverride method not firing. But if call .Override it work fine. It is a many to many relationship.
Tables (Resource, Role, Permission)
Classes (Resource and Role)
return Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2008
.ConnectionString("server=.\\SQLEXPRESS;database=Fasttrak3;Integrated Security=SSPI"))
.Mappings(m => m.AutoMappings
.Add(
AutoMap.AssemblyOf<Program>()
.Setup(s => s.FindIdentity =
property => property.Name == property.DeclaringType.Name + "Id")
.Conventions.Setup(i =>
{
i.Add<PrimaryKeyConvention>();
i.Add<CustomForeignKeyConvention>();
}
)
.UseOverridesFromAssemblyOf<RoleMappingOverride>()
))
.BuildSessionFactory();
// Override code
public class RoleMappingOverride : IAutoMappingOverride<Resource>
{
public void Override(AutoMapping<Resource> mapping)
{
mapping.HasManyToMany(x => x.Roles).Cascade.All().Table("Permission");
}
}
I don't have ResourceMap mapping information anywhere. Is it really necessary before calling override?
2 Posted by Ashraf on 29 Mar, 2010 07:56 PM
I figure it out. It was not loading the currect assembly.
Thanks.