Entity Framework The paragraph linking the <property> property was not found in the modification function

I am trying to map an entity insert to a stored procedure. Here is the header of the stored procedure. Pay attention to the last parameter:

ALTER PROCEDURE sp_ins_ErpAndType
    @idSite INT,
    @Description NVARCHAR(MAX), 
    ...
    @TypeConstant int

here is my mapping:

public DbSet<BasicTaxGroup> TaxGroups { get; set; }
public DbSet<AbstractErpSettings> ErpSettings { get; set; }

protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
    modelBuilder.Entity<BasicTaxGroup>()
            .ToTable("tbl_TaxGroup")
            .HasKey(t => t.PrimaryKey);
            .Property(b => b.PrimaryKey).HasColumnName("idTaxGroup");

    modelBuilder.Entity<AbstractErpSettings>()
            .ToTable("vw_ErpAndType")
            .HasKey(m => m.PrimaryKey)
            .Map<AcombaErpSettings>(m => m.Requires("TypeConstant").HasValue("1000"))
            .Map<SemErpSettings>(m => m.Requires("TypeConstant").HasValue("1011"))
            .Property(m => m.PrimaryKey).HasColumnName("idERP");

    modelBuilder.Entity<SemErpSettings>()
    .MapToStoredProcedures(s =>
        s.Insert(i => i.HasName("sp_ins_ErpAndType")
                .Parameter(m => m.TypeConstant, "TypeConstant"))
            );
}

SemErpSettingsand AcombaErpSettingsboth are inherited from AbstractErpSettings.

Now, when I try to add BasicTaxGroup to my highlighted DbSet, I get this error:

The parameter binding the 'TypeConstant' property was not found in the modification function 'sp_ins_ErpAndType'. Ensure that the parameter is valid for this modification operation and that it is not a created database.

I also have several other db sets, and they all make the same mistake.

It looks like the stored procedure maps to all types of entities ... What am I doing wrong?

+4

All Articles