How to set 1:1 relationship with the below-mentioned models when we use ASP.NET Boilerplate? Thanks in advance.
Note 1: I have seen this nice answer about the EF 1-to-1 relationship. But unfortunately, I don't know how to set it with ASP.NET Boilerplate because PK is automatically set by ABP. In my scenario, both tables have int
PK.
Note 2: Here, the Property
and Address
models have 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; }
}