mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-20 10:37:55 +08:00
initial
This commit is contained in:
39
OpenAuth.Infrastructure/Mapping/DataPermissionMap.cs
Normal file
39
OpenAuth.Infrastructure/Mapping/DataPermissionMap.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System.Data.Entity.ModelConfiguration;
|
||||
using OpenAuth.Domain;
|
||||
|
||||
namespace OpenAuth.Infrastructure.Mapping
|
||||
{
|
||||
public class DataPermissionMap : EntityTypeConfiguration<DataPermission>
|
||||
{
|
||||
public DataPermissionMap()
|
||||
{
|
||||
// Primary Key
|
||||
this.HasKey(t => t.Id);
|
||||
|
||||
// Properties
|
||||
this.Property(t => t.Id)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.RoleId)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.ResourceId)
|
||||
.HasMaxLength(50);
|
||||
|
||||
// Table & Column Mappings
|
||||
this.ToTable("DataPermission");
|
||||
this.Property(t => t.Id).HasColumnName("Id");
|
||||
this.Property(t => t.RoleId).HasColumnName("RoleId");
|
||||
this.Property(t => t.ResourceId).HasColumnName("ResourceId");
|
||||
this.Property(t => t.ObjectId).HasColumnName("ObjectId");
|
||||
|
||||
// Relationships
|
||||
this.HasRequired(t => t.Role)
|
||||
.WithMany(t => t.DataPermissions)
|
||||
.HasForeignKey(d => d.RoleId);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user