Create ASP.NET Identity tables using SQL script

前端 未结 4 1456
借酒劲吻你
借酒劲吻你 2020-12-05 19:38

I am attempting to incorporate ASP.NET Identity into a new application that currently uses a SQL script to create the database schema. As we will need to create Foreign Key

4条回答
  •  执笔经年
    2020-12-05 20:36

    Not sure exactly what you are trying to achieve. It should be possible if you use the following as required:

    • modelBuilder.ComplexType // tell ef this a complex property, Just embed in table,
    • modelBuilder.Ignore // no table required.

    Then when mapping foreign key fields , if you have a property that hold the Foreign key, tell ef

    modelBuilder.Entity().HasRequired(t => t.NAVPROP)
                  .WithMany()
                  .HasForeignKey(t => t.PropertyinTThatholdsFKID);   
    

    field_id is generated by EF when it sees a need to cater for a defined relationship and there was no defined foreignkey field. So either you have the an extra relationship you dont expect or want. Or the the relationhip was not specified with the foreignkey field.

提交回复
热议问题