|
using Application.Core.ProfileModule.ProfileAddressAggregate;
using System.Data.Entity.ModelConfiguration;
namespace Application.DAL.EntityConfiguration
{
class ProfileAddressConfiguration : EntityTypeConfiguration<ProfileAddress>
{
public ProfileAddressConfiguration()
{
this.HasKey(pa => pa.ProfileAddressId);
// 1..*
this.HasRequired(pa => pa.Address)
.WithMany(pa => pa.ProfileAddresses)
.HasForeignKey(pa => pa.AddressId)
.WillCascadeOnDelete(false);
// 1..*
this.HasRequired(pa => pa.AddressType)
.WithMany(pa => pa.ProfileAddresses)
.HasForeignKey(pa => pa.AddressTypeId)
.WillCascadeOnDelete(false);
// 1..*
this.HasRequired(pa => pa.Profile)
.WithMany(pa => pa.ProfileAddresses)
.HasForeignKey(pa => pa.ProfileId)
.WillCascadeOnDelete(true);
//configure table map
this.ToTable("ProfileAddress");
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.