{"action":"closed","issue":{"url":"https://api.github.com/repos/aspnet/EntityFramework/issues/4046","labels_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/4046/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/4046/comments","events_url":"https://api.github.com/repos/aspnet/EntityFramework/issues/4046/events","html_url":"https://github.com/aspnet/EntityFramework/issues/4046","id":121660142,"number":4046,"title":"Issue about One-to-One by Single Navigation Property","user":{"login":"vincedan","id":16057386,"avatar_url":"https://avatars.githubusercontent.com/u/16057386?v=3","gravatar_id":"","url":"https://api.github.com/users/vincedan","html_url":"https://github.com/vincedan","followers_url":"https://api.github.com/users/vincedan/followers","following_url":"https://api.github.com/users/vincedan/following{/other_user}","gists_url":"https://api.github.com/users/vincedan/gists{/gist_id}","starred_url":"https://api.github.com/users/vincedan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vincedan/subscriptions","organizations_url":"https://api.github.com/users/vincedan/orgs","repos_url":"https://api.github.com/users/vincedan/repos","events_url":"https://api.github.com/users/vincedan/events{/privacy}","received_events_url":"https://api.github.com/users/vincedan/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-12-11T08:16:32Z","updated_at":"2015-12-11T22:53:30Z","closed_at":"2015-12-11T22:53:30Z","body":"Hi,\r\nright now my sourcecode is based on EF6 and can implement one to one with single navigation property. but I could not achieve the same result on EF7. below is the details:\r\n1) requirements:\r\n table Object1 has one to one relationship with Table DisplayNames(no foreignkey constrant)\r\ntable Object2 also has one to one with Table DisplayNames.  Id(Guid) is PK for Object1,Ojbect2 and DisplayNames.  the Id of DisplayNames also should be logically  foreignkey..\r\n\r\n2) Based on EF6 everything is perfect.\r\n\r\n```c#\r\n   public partial class Object1\r\n    {\r\n        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]\r\n        public Guid Id { get; set; }\r\n\r\n        [Required]\r\n        public string Name { get; set; }\r\n\r\n        [Required]\r\n        public DisplayName DisplayName { get; set; }\r\n    }\r\n\r\n    public partial class Object2\r\n    {\r\n        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]\r\n        public Guid Id { get; set; }\r\n\r\n        [Required]\r\n        public string Name { get; set; }\r\n\r\n        [Required]\r\n        public DisplayName DisplayName { get; set; }\r\n    }\r\n\r\n    [Table(\"DisplayNames\")]\r\n    public partial class DisplayName\r\n    {\r\n        [DatabaseGenerated(DatabaseGeneratedOption.None)]\r\n        public Guid Id { get; set; }\r\n\r\n        [Required]\r\n        public string ChineseName { get; set; }\r\n    }\r\n\r\n    public partial class Model1 : DbContext\r\n    {\r\n        public Model1()\r\n            : base(\"name=Model1\")\r\n        {\r\n        }\r\n\r\n        //public virtual DbSet<DisplayName> DisplayName { get; set; }\r\n        public virtual DbSet<Object1> Object1 { get; set; }\r\n        public virtual DbSet<Object2> Object2 { get; set; }\r\n\r\n        protected override void OnModelCreating(DbModelBuilder modelBuilder)\r\n        {\r\n            Database.SetInitializer<Model1>(null);\r\n            modelBuilder.Entity<Object1>().HasOptional(e => e.DisplayName).WithRequired();\r\n            modelBuilder.Entity<Object2>().HasOptional(e => e.DisplayName).WithRequired();\r\n\r\n        }\r\n    }\r\n           using (var db = new Model1())\r\n            {\r\n                Object1 o1 = new Object1\r\n                {\r\n                    Name = \"Object1\",\r\n                    DisplayName = new DisplayName\r\n                    {\r\n                        ChineseName = \"ChineseName Object1\"\r\n                    }\r\n                };\r\n                // add one record  in Object1, add onre record in DisplayNames\r\n                db.Object1.Add(o1); db.SaveChanges();\r\n\r\n                Object2 o2 = new Object2\r\n                {\r\n                    Name = \"Object1\",\r\n                    DisplayName = new DisplayName\r\n                    {\r\n                        ChineseName = \"ChineseName Object2\"\r\n                    }\r\n                };\r\n                // add one record  in Object2, add onre record in DisplayNames\r\n                db.Object2.Add(o2); db.SaveChanges();\r\n\r\n            }\r\n```\r\n\r\n3) on EF7, issue ourred.... although I replace the above code with new API like the following sample\r\n`modelBuilder.Entity<Object1>().HasOne<DisplayName>(b => b.DisplayName).WithOne();`  \r\n\r\nmy problem is: I can not add navigation property on DisplayName side because it is used by many tables such as Object1 Object2~ ObjectN. When I add [foreignkey] on DisplayName property of  Object1, only one record add in Object1 and no  related record can be inserted in DisplayName.\r\nHow to implement these One-to-One by Single Navigation Property on EF7?\r\n\r\n"}}