mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-11-09 02:44:44 +08:00
initial
This commit is contained in:
49
OpenAuth.Infrastructure/Mapping/ButtonMap.cs
Normal file
49
OpenAuth.Infrastructure/Mapping/ButtonMap.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System.Data.Entity.ModelConfiguration;
|
||||
using OpenAuth.Domain;
|
||||
|
||||
namespace OpenAuth.Infrastructure.Mapping
|
||||
{
|
||||
public class ButtonMap : EntityTypeConfiguration<Button>
|
||||
{
|
||||
public ButtonMap()
|
||||
{
|
||||
// Primary Key
|
||||
this.HasKey(t => t.ButtonId);
|
||||
|
||||
// Properties
|
||||
this.Property(t => t.ButtonId)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.FullName)
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.Img)
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.Event)
|
||||
.HasMaxLength(200);
|
||||
|
||||
this.Property(t => t.Control_ID)
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.Category)
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.Description)
|
||||
.HasMaxLength(200);
|
||||
|
||||
// Table & Column Mappings
|
||||
this.ToTable("Button");
|
||||
this.Property(t => t.ButtonId).HasColumnName("ButtonId");
|
||||
this.Property(t => t.FullName).HasColumnName("FullName");
|
||||
this.Property(t => t.Img).HasColumnName("Img");
|
||||
this.Property(t => t.Event).HasColumnName("Event");
|
||||
this.Property(t => t.Control_ID).HasColumnName("Control_ID");
|
||||
this.Property(t => t.Category).HasColumnName("Category");
|
||||
this.Property(t => t.Description).HasColumnName("Description");
|
||||
this.Property(t => t.Enabled).HasColumnName("Enabled");
|
||||
this.Property(t => t.SortCode).HasColumnName("SortCode");
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
51
OpenAuth.Infrastructure/Mapping/DepartmentMap.cs
Normal file
51
OpenAuth.Infrastructure/Mapping/DepartmentMap.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
using System.Data.Entity.ModelConfiguration;
|
||||
using OpenAuth.Domain;
|
||||
|
||||
namespace OpenAuth.Infrastructure.Mapping
|
||||
{
|
||||
public class DepartmentMap : EntityTypeConfiguration<Department>
|
||||
{
|
||||
public DepartmentMap()
|
||||
{
|
||||
// Primary Key
|
||||
this.HasKey(t => t.DepartmentId);
|
||||
|
||||
// Properties
|
||||
this.Property(t => t.DepartmentId)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.HasMany(d => d.Users)
|
||||
.WithMany(u => u.Departments)
|
||||
.Map(
|
||||
m =>
|
||||
{
|
||||
m.MapLeftKey("DepartmentId");
|
||||
m.MapRightKey("UserId");
|
||||
m.ToTable("UserDepartment");
|
||||
});
|
||||
|
||||
this.HasMany(d => d.Roles)
|
||||
.WithRequired(r => r.Department);
|
||||
|
||||
this.Property(t => t.ParentId)
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.FullName)
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.Description)
|
||||
.HasMaxLength(50);
|
||||
|
||||
// Table & Column Mappings
|
||||
this.ToTable("Department");
|
||||
this.Property(t => t.DepartmentId).HasColumnName("DepartmentId");
|
||||
this.Property(t => t.ParentId).HasColumnName("ParentId");
|
||||
this.Property(t => t.FullName).HasColumnName("FullName");
|
||||
this.Property(t => t.Description).HasColumnName("Description");
|
||||
this.Property(t => t.Enabled).HasColumnName("Enabled");
|
||||
this.Property(t => t.SortCode).HasColumnName("SortCode");
|
||||
this.Property(t => t.DeleteMark).HasColumnName("DeleteMark");
|
||||
}
|
||||
}
|
||||
}
|
||||
55
OpenAuth.Infrastructure/Mapping/MenuMap.cs
Normal file
55
OpenAuth.Infrastructure/Mapping/MenuMap.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using System.Data.Entity.ModelConfiguration;
|
||||
using OpenAuth.Domain;
|
||||
|
||||
namespace OpenAuth.Infrastructure.Mapping
|
||||
{
|
||||
public class MenuMap : EntityTypeConfiguration<Menu>
|
||||
{
|
||||
public MenuMap()
|
||||
{
|
||||
// Primary Key
|
||||
this.HasKey(t => t.MenuId);
|
||||
|
||||
// Properties
|
||||
this.Property(t => t.MenuId)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.ParentId)
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.FullName)
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.Description)
|
||||
.HasMaxLength(200);
|
||||
|
||||
this.Property(t => t.Img)
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.NavigateUrl)
|
||||
.HasMaxLength(200);
|
||||
|
||||
this.Property(t => t.FormName)
|
||||
.HasMaxLength(200);
|
||||
|
||||
this.Property(t => t.Target)
|
||||
.HasMaxLength(50);
|
||||
|
||||
// Table & Column Mappings
|
||||
this.ToTable("Menu");
|
||||
this.Property(t => t.MenuId).HasColumnName("MenuId");
|
||||
this.Property(t => t.ParentId).HasColumnName("ParentId");
|
||||
this.Property(t => t.FullName).HasColumnName("FullName");
|
||||
this.Property(t => t.Description).HasColumnName("Description");
|
||||
this.Property(t => t.Img).HasColumnName("Img");
|
||||
this.Property(t => t.Category).HasColumnName("Category");
|
||||
this.Property(t => t.NavigateUrl).HasColumnName("NavigateUrl");
|
||||
this.Property(t => t.FormName).HasColumnName("FormName");
|
||||
this.Property(t => t.Target).HasColumnName("Target");
|
||||
this.Property(t => t.IsUnfold).HasColumnName("IsUnfold");
|
||||
this.Property(t => t.Enabled).HasColumnName("Enabled");
|
||||
this.Property(t => t.SortCode).HasColumnName("SortCode");
|
||||
}
|
||||
}
|
||||
}
|
||||
48
OpenAuth.Infrastructure/Mapping/RoleMap.cs
Normal file
48
OpenAuth.Infrastructure/Mapping/RoleMap.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System.Data.Entity.ModelConfiguration;
|
||||
using OpenAuth.Domain;
|
||||
|
||||
namespace OpenAuth.Infrastructure.Mapping
|
||||
{
|
||||
public class RoleMap : EntityTypeConfiguration<Role>
|
||||
{
|
||||
public RoleMap()
|
||||
{
|
||||
// Primary Key
|
||||
this.HasKey(t => t.RoleId);
|
||||
|
||||
// Properties
|
||||
this.Property(t => t.RoleId)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.ParentId)
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.FullName)
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.Category)
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.Description)
|
||||
.HasMaxLength(200);
|
||||
|
||||
this.Property(t => t.DepartmentId)
|
||||
.HasMaxLength(50);
|
||||
|
||||
|
||||
// Table & Column Mappings
|
||||
this.ToTable("Role");
|
||||
this.Property(t => t.RoleId).HasColumnName("RoleId");
|
||||
this.Property(t => t.ParentId).HasColumnName("ParentId");
|
||||
this.Property(t => t.FullName).HasColumnName("FullName");
|
||||
this.Property(t => t.Category).HasColumnName("Category");
|
||||
this.Property(t => t.Description).HasColumnName("Description");
|
||||
this.Property(t => t.Enabled).HasColumnName("Enabled");
|
||||
this.Property(t => t.SortCode).HasColumnName("SortCode");
|
||||
this.Property(t => t.DeleteMark).HasColumnName("DeleteMark");
|
||||
this.Property(t => t.DepartmentId).HasColumnName("DepartmentId");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
50
OpenAuth.Infrastructure/Mapping/RoleMenuButtonMap.cs
Normal file
50
OpenAuth.Infrastructure/Mapping/RoleMenuButtonMap.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System.Data.Entity.ModelConfiguration;
|
||||
using OpenAuth.Domain;
|
||||
|
||||
namespace OpenAuth.Infrastructure.Mapping
|
||||
{
|
||||
public class RoleMenuButtonMap : EntityTypeConfiguration<RoleMenuButton>
|
||||
{
|
||||
public RoleMenuButtonMap()
|
||||
{
|
||||
// Primary Key
|
||||
this.HasKey(t => t.RoleMenuButtonId);
|
||||
|
||||
// Properties
|
||||
this.Property(t => t.RoleMenuButtonId)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.RoleId)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.MenuId)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.ButtonId)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
|
||||
// Table & Column Mappings
|
||||
this.ToTable("RoleMenuButton");
|
||||
this.Property(t => t.RoleMenuButtonId).HasColumnName("RoleMenuButtonId");
|
||||
this.Property(t => t.RoleId).HasColumnName("RoleId");
|
||||
this.Property(t => t.MenuId).HasColumnName("MenuId");
|
||||
this.Property(t => t.ButtonId).HasColumnName("ButtonId");
|
||||
|
||||
// Relationships
|
||||
this.HasRequired(t => t.Button)
|
||||
.WithMany(t => t.RoleMenuButtons)
|
||||
.HasForeignKey(d => d.ButtonId);
|
||||
this.HasRequired(t => t.Menu)
|
||||
.WithMany(t => t.RoleMenuButtons)
|
||||
.HasForeignKey(d => d.MenuId);
|
||||
this.HasRequired(t => t.Role)
|
||||
.WithMany(t => t.RoleMenuButtons)
|
||||
.HasForeignKey(d => d.RoleId);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
52
OpenAuth.Infrastructure/Mapping/UserMap.cs
Normal file
52
OpenAuth.Infrastructure/Mapping/UserMap.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
using System.Data.Entity.ModelConfiguration;
|
||||
using OpenAuth.Domain;
|
||||
|
||||
namespace OpenAuth.Infrastructure.Mapping
|
||||
{
|
||||
public class UserMap : EntityTypeConfiguration<User>
|
||||
{
|
||||
public UserMap()
|
||||
{
|
||||
// Primary Key
|
||||
this.HasKey(t => t.UserId);
|
||||
|
||||
// Properties
|
||||
this.Property(t => t.UserId)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.Account)
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.Password)
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.RealName)
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.Property(t => t.RoleId)
|
||||
.HasMaxLength(50);
|
||||
|
||||
this.HasMany(u => u.Departments)
|
||||
.WithMany(d => d.Users)
|
||||
.Map(m =>
|
||||
{
|
||||
m.MapLeftKey("UserId");
|
||||
m.MapRightKey("DepartmentId");
|
||||
m.ToTable("UserDepartment");
|
||||
});
|
||||
|
||||
// Table & Column Mappings
|
||||
this.ToTable("User");
|
||||
this.Property(t => t.UserId).HasColumnName("UserId");
|
||||
this.Property(t => t.Account).HasColumnName("Account");
|
||||
this.Property(t => t.Password).HasColumnName("Password");
|
||||
this.Property(t => t.RealName).HasColumnName("RealName");
|
||||
this.Property(t => t.RoleId).HasColumnName("RoleId");
|
||||
this.Property(t => t.Enabled).HasColumnName("Enabled");
|
||||
this.Property(t => t.DeleteMark).HasColumnName("DeleteMark");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user