Good day! C # project using Entity Framework. I try to describe data model through Fluent API Entity FrameWork.

In the model configuration, I add a one-to-many relationship:

HasRequired(t => t.MemberProcess).WithMany().HasForeignKey(f => f.ProcessId); 

To add / delete / update records I use stored procedures: MapToStoredProcedures ().

Before adding a link, everything works fine. I am adding normally to the table entries. After the connection appears, @MemberProcess_ProcessId=NULL added to the parameter list. Which leads to the error "Too many arguments", which is understandable because I do not have such a parameter in the table.

At the same time, I add a link to another table in the same table: HasRequired(t => t.TaskTypes).WithMany().HasForeignKey(f => f.TaskTypeId); And everything works well, no new parameters are added.

I can not understand why this is happening.

    1 answer 1

    Day tormented with this problem. But once I asked a question, calmly and thoughtfully read the manual on the Fluent API, how the solution came. Replaced:

     HasRequired(t => t.MemberProcess).WithMany().HasForeignKey(f => f.ProcessId); 

    on

      HasRequired(t => t.MemberProcess).WithMany(t => t.Tasks).HasForeignKey(f => f.ProcessId); 

    And it all worked. Thank you all!