IAutoMappingOverride not calling

Original Post Ashraf's Avatar

Ashraf

29 Mar, 2010 06:50 PM via web

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?

  1. 2 Posted by Ashraf on 29 Mar, 2010 07:56 PM

    Ashraf's Avatar

    I figure it out. It was not loading the currect assembly.

    Thanks.

Reply to this discussion

Preview Comments are parsed with Markdown. Help with syntax

Attached Files

    You can attach files up to 10MB

    What is 4 times four?

    Recent Discussions

    05 Jul, 2010 10:29 PM
    05 Jul, 2010 12:45 PM
    05 Jul, 2010 12:42 PM
    05 Jul, 2010 12:17 PM
    05 Jul, 2010 12:12 PM

     

    03 Jul, 2010 12:26 AM
    02 Jul, 2010 02:17 PM
    02 Jul, 2010 08:18 AM
    02 Jul, 2010 12:20 AM
    01 Jul, 2010 10:14 PM