Base solution for your next web application
Open Closed

Entity Framework 1 to 1 relationship with the Asp.net Boiler #464


User avatar
0
sampath created

Could you tell me how to set the 1 : 1 relationship with the below mentioned models when we use the Asp.net Boiler plait ? Thanks in advance.

Note : I have seen this nice answer about the EF 1 to 1 relationship.But unfortunately I don't know how to set it with the Boiler plate.B'cos PK is automatically taken from the ABP.On my scenario where both tables having int PK.

SO : [url]http://stackoverflow.com/questions/6531671/what-does-principal-end-of-an-association-means-in-11-relationship-in-entity-fr

Note 2 : Here Property and Address models having 1 : 1 Relationship.

Property Model

[Table("IpProperties")]
    public class Property : FullAuditedEntity
    {

        public virtual bool Vacant { get; set; }

        public virtual Address Address { get; set; }

}

Address Model

[Table("IpAddresses")]
    public class Address : FullAuditedEntity
    {

        [Required]
        [MaxLength(MaxLength)]
        public virtual string StreetNumber { get; set; }

        public virtual Property Property { get; set; }
    }
Markdown is supported
Copy & paste or drag & drop images (max 30 MB per image)

2 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Have you seen my this answer to same question: #466@7b81740d-0732-4192-9225-78c030a6aa6e

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)
  • User Avatar
    0
    sampath created

    Yes.I saw that.Thanks a lot Halil :)

    Markdown is supported
    Copy & paste or drag & drop images (max 30 MB per image)