{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/8206","repository_url":"https://api.github.com/repos/aspnet/EntityFramework","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/8206/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/8206/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/8206/events","html_url":"https://github.com/aspnet/EntityFramework/issues/8206","id":222438041,"number":8206,"title":"Composite Foreign Key","user":{"login":"gsGabriel","id":8701768,"avatar_url":"https://avatars0.githubusercontent.com/u/8701768?v=3","gravatar_id":"","url":"https://api.github.com/users/gsGabriel","html_url":"https://github.com/gsGabriel","followers_url":"https://api.github.com/users/gsGabriel/followers","following_url":"https://api.github.com/users/gsGabriel/following{/other_user}","gists_url":"https://api.github.com/users/gsGabriel/gists{/gist_id}","starred_url":"https://api.github.com/users/gsGabriel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gsGabriel/subscriptions","organizations_url":"https://api.github.com/users/gsGabriel/orgs","repos_url":"https://api.github.com/users/gsGabriel/repos","events_url":"https://api.github.com/users/gsGabriel/events{/privacy}","received_events_url":"https://api.github.com/users/gsGabriel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-04-18T14:36:14Z","updated_at":"2017-04-18T17:47:58Z","closed_at":null,"body":"Houston, we have a problem hahahahaha\r\n\r\nI have an issue with mapping a composite foreign key, i have two keys for the one constraint foreign key in my database.\r\n\r\nI have one table with actions and i used this table to get a actions of anything, for the example: actions of applications or actions of the users. In this table i have a collumn type and IdEntity. In my case I can have a situation where IdEntity will repeat itself, because I'm using this column in other entities, so I created the type column, where the type will be an enum with entities. I then created a compound Foreign Key, where it corresponds to the Type and Entity Id. Currently Ef Core is not recognizing this foreing key which makes it impossible for my application to work properly. Anyone have any suggestions?\r\n\r\n### Steps to reproduce\r\nGenerate code-first of my model\r\n\r\n\r\n### Further technical details\r\nEF Core version: 1.1.1\r\nDatabase Provider: Npgsql.EntityFrameworkCore.PostgreSQL\r\nIDE: Visual Studio 2017\r\n"},"comment":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/comments/294925881","html_url":"https://github.com/aspnet/EntityFramework/issues/8206#issuecomment-294925881","issue_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/8206","id":294925881,"user":{"login":"gsGabriel","id":8701768,"avatar_url":"https://avatars0.githubusercontent.com/u/8701768?v=3","gravatar_id":"","url":"https://api.github.com/users/gsGabriel","html_url":"https://github.com/gsGabriel","followers_url":"https://api.github.com/users/gsGabriel/followers","following_url":"https://api.github.com/users/gsGabriel/following{/other_user}","gists_url":"https://api.github.com/users/gsGabriel/gists{/gist_id}","starred_url":"https://api.github.com/users/gsGabriel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gsGabriel/subscriptions","organizations_url":"https://api.github.com/users/gsGabriel/orgs","repos_url":"https://api.github.com/users/gsGabriel/repos","events_url":"https://api.github.com/users/gsGabriel/events{/privacy}","received_events_url":"https://api.github.com/users/gsGabriel/received_events","type":"User","site_admin":false},"created_at":"2017-04-18T17:47:58Z","updated_at":"2017-04-18T17:47:58Z","body":"Ok @ajcvickers , but the code-first don't generate the relationship\r\n\r\n`protected override void OnModelCreating(ModelBuilder modelBuilder)\r\n{\r\n    modelBuilder.Entity<TbAction>(entity =>\r\n    {\r\n        entity.HasKey(e => e.Id)\r\n            .HasName(\"PK_tbActions\");\r\n\r\n        entity.ToTable(\"tbActions\");\r\n\r\n        entity.Property(e => e.IdType)\r\n            .HasColumnName(\"IdType\")\r\n\r\n        entity.Property(e => e.IdEntity)\r\n            .HasColumnName(\"IdEntity\")\r\n    });\r\n\r\n    modelBuilder.Entity<TbUser>(entity =>\r\n    {\r\n        entity.HasKey(e => e.Id)\r\n            .HasName(\"PK_tbUsers\");\r\n\r\n        entity.ToTable(\"tbUsers\");\r\n\r\n        entity.Property(e => e.IdType)\r\n            .HasColumnName(\"IdType\")\r\n    });\r\n\r\n    modelBuilder.Entity<TbSystem>(entity =>\r\n    {\r\n        entity.HasKey(e => e.Id)\r\n            .HasName(\"PK_tbSystems\");\r\n\r\n        entity.ToTable(\"tbSystems\");\r\n\r\n        entity.Property(e => e.IdType)\r\n            .HasColumnName(\"IdType\")\r\n    });\r\n}`"}}
{"actor":{"display_login":"gsGabriel"}}