28 lines
795 B
C#
28 lines
795 B
C#
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Data.Entity.ModelConfiguration;
|
|
|
|
namespace IntegrationTests.Models.Mapping
|
|
{
|
|
public class User2ViewMap : EntityTypeConfiguration<User2View>
|
|
{
|
|
public User2ViewMap()
|
|
{
|
|
// Primary Key
|
|
this.HasKey(t => t.Id);
|
|
|
|
// Properties
|
|
// Table & Column Mappings
|
|
this.ToTable("User2View");
|
|
this.Property(t => t.Id).HasColumnName("Id");
|
|
this.Property(t => t.UserId).HasColumnName("UserId");
|
|
this.Property(t => t.ViewId).HasColumnName("ViewId");
|
|
|
|
// Relationships
|
|
this.HasOptional(t => t.View)
|
|
.WithMany(t => t.User2View)
|
|
.HasForeignKey(d => d.ViewId);
|
|
|
|
}
|
|
}
|
|
}
|