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; }
    }

2 Answer(s)