c# - Error -"Could not drop constraint" when execute .AsQueryable(); -
I am using EF codes first to generate many for many relationships. As the following:
Public class user {public user} (categories = new archive & lt; grade & gt; ();} public int UserId {get; set;} public string LastName {Get; set;} Public iconging & lt; Categories & gt; Categories {get; set;}}
and
public seal category category {Public category} (user = new archive & lt; user & gt; ();} public string name {get} set;} public entry Public Receipt & lt; User & gt; Users {Received; Set;}}
My DB Reference Looks:
Public DBSet & lt; User & gt; Users {Received; Set;} Public DbSet & lt; Category & gt; Categories {Get; Set;} Safe Override Zero OnModelCreating {DbModelBuilder Modlbilder} {modelBuilder.Entity & lt; User (H)> HasMany (b = & gt; b categories). Many (a => a.Users) .map (m = & gt; m.MapLeftKey ("user id") MapRightKey ("id "). Base.OnModelCreating (modelBuilder); }
The strange issue is that when I want to do simple tasks:
_ctx.Categories.AsQueryable ();
I get the following error:
Interrupted 'PK_Dibo. Categories' reference table 'UserConces', foreign key constraints' FK_dbo.CategoryUsers_dbo .Categories_id'. Obstacles can not be left over. See previous errors.
Comments
Post a Comment