mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2026-04-09 10:31:28 +08:00
调整程序框架
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
</configSections>
|
||||
<connectionStrings configSource="DB.config"></connectionStrings>
|
||||
|
||||
<entityFramework>
|
||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
||||
<parameters>
|
||||
<parameter value="mssqllocaldb" />
|
||||
</parameters>
|
||||
</defaultConnectionFactory>
|
||||
<providers>
|
||||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
|
||||
</providers>
|
||||
</entityFramework>
|
||||
</configuration>
|
||||
@@ -1,4 +0,0 @@
|
||||
<connectionStrings>
|
||||
<add name="OpenAuthDBContext" connectionString="Data Source=.;Initial Catalog=OpenAuthDB;Persist Security Info=True;User ID=sa;Password=516688;MultipleActiveResultSets=True"
|
||||
providerName="System.Data.SqlClient" />
|
||||
</connectionStrings>
|
||||
27
OpenAuth.Infrastructure/ListExtention.cs
Normal file
27
OpenAuth.Infrastructure/ListExtention.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : OpenAuth.Infrastructure
|
||||
// Author : yubaolee
|
||||
// Created : 05-23-2015
|
||||
//
|
||||
// Last Modified By : yubaolee
|
||||
// Last Modified On : 05-23-2015
|
||||
// ***********************************************************************
|
||||
// <copyright file="ListExtention.cs" company="Microsoft">
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// </copyright>
|
||||
// <summary>两个相同结构List之间的复制</summary>
|
||||
// ***********************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace OpenAuth.Infrastructure
|
||||
{
|
||||
static class ListExtension
|
||||
{
|
||||
public static IList<T> Clone<T>(this IList<T> listToClone) where T : ICloneable
|
||||
{
|
||||
return listToClone.Select(item => (T)item.Clone()).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
using System.Data.Entity.ModelConfiguration;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Domain.Model;
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
using System.Data.Entity.ModelConfiguration;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Domain.Model;
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
using System.Data.Entity.ModelConfiguration;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Domain.Model;
|
||||
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
using System.Data.Entity.ModelConfiguration;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Domain.Model;
|
||||
|
||||
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);
|
||||
|
||||
//<2F>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>İ<EFBFBD>ť
|
||||
this.HasMany(t => t.Buttons)
|
||||
.WithMany(b => b.Menus)
|
||||
.Map(m =>
|
||||
{
|
||||
m.MapLeftKey("MenuId");
|
||||
m.MapRightKey("ButtonId");
|
||||
m.ToTable("MenuButton");
|
||||
});
|
||||
//TODO:<3A>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>䣬EF<45><46>ѯʱ<D1AF><CAB1><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>Role_RoleId<49><64>
|
||||
this.HasMany(t => t.Roles)
|
||||
.WithMany(b => b.RoleMenus)
|
||||
.Map(m =>
|
||||
{
|
||||
m.MapLeftKey("MenuId");
|
||||
m.MapRightKey("RoleId");
|
||||
m.ToTable("RoleMenu");
|
||||
});
|
||||
|
||||
// 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");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
using System.Data.Entity.ModelConfiguration;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Domain.Model;
|
||||
|
||||
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);
|
||||
|
||||
//<2F><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>
|
||||
this.HasMany(d => d.Users)
|
||||
.WithMany(u => u.Roles)
|
||||
.Map(
|
||||
m =>
|
||||
{
|
||||
m.MapLeftKey("RoleId");
|
||||
m.MapRightKey("UserId");
|
||||
m.ToTable("UserRole");
|
||||
});
|
||||
|
||||
//<2F><>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD>IJ˵<C4B2>
|
||||
this.HasMany(m => m.RoleMenus)
|
||||
.WithMany(r => r.Roles)
|
||||
.Map(m =>
|
||||
{
|
||||
m.MapLeftKey("RoleId");
|
||||
m.MapRightKey("MenuId");
|
||||
m.ToTable("RoleMenu");
|
||||
});
|
||||
|
||||
|
||||
// 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");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
using System.Data.Entity.ModelConfiguration;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Domain.Model;
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
using System.Data.Entity.ModelConfiguration;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Domain.Model;
|
||||
|
||||
namespace OpenAuth.Infrastructure.Mapping
|
||||
{
|
||||
public class UserMap : EntityTypeConfiguration<User>
|
||||
{
|
||||
public UserMap()
|
||||
{
|
||||
// Primary Key
|
||||
this.HasKey(t => t.Id);
|
||||
|
||||
// Properties
|
||||
this.Property(t => t.Id)
|
||||
.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");
|
||||
});
|
||||
|
||||
this.HasMany(u => u.Roles)
|
||||
.WithMany(r => r.Users)
|
||||
.Map(m =>
|
||||
{
|
||||
m.MapLeftKey("UserId");
|
||||
m.MapRightKey("RoleId");
|
||||
m.ToTable("UserRole");
|
||||
});
|
||||
|
||||
//Ĭ<>Ͻ<EFBFBD>ɫ
|
||||
this.HasOptional(u => u.DefaultRole)
|
||||
.WithMany()
|
||||
.HasForeignKey(u =>u.RoleId);
|
||||
|
||||
// Table & Column Mappings
|
||||
this.ToTable("User");
|
||||
this.Property(t => t.Id).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");
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,52 +30,15 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EntityFramework">
|
||||
<HintPath>..\packages\EntityFramework.6.1.3\lib\net40\EntityFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework.SqlServer">
|
||||
<HintPath>..\packages\EntityFramework.6.1.3\lib\net40\EntityFramework.SqlServer.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Activities" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Mapping\ButtonMap.cs" />
|
||||
<Compile Include="Mapping\DataPermissionMap.cs" />
|
||||
<Compile Include="Mapping\DepartmentMap.cs" />
|
||||
<Compile Include="Mapping\MenuMap.cs" />
|
||||
<Compile Include="Mapping\RoleMap.cs" />
|
||||
<Compile Include="Mapping\RoleMenuButtonMap.cs" />
|
||||
<Compile Include="Mapping\UserMap.cs" />
|
||||
<Compile Include="OpenAuthDBContext.cs" />
|
||||
<Compile Include="ListExtention.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Repository\BaseRepository.cs" />
|
||||
<Compile Include="Repository\UserRepository.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\OpenAuth.App\OpenAuth.App.csproj">
|
||||
<Project>{0bbf2d65-fffd-4272-b138-8ea4fb6fec48}</Project>
|
||||
<Name>OpenAuth.App</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\OpenAuth.Domain\OpenAuth.Domain.csproj">
|
||||
<Project>{6108da8e-92a1-4abe-b9f5-26d64d55ca2c}</Project>
|
||||
<Name>OpenAuth.Domain</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="DB.config">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
using System.Data.Entity;
|
||||
using OpenAuth.Domain;
|
||||
using OpenAuth.Domain.Model;
|
||||
using OpenAuth.Infrastructure.Mapping;
|
||||
|
||||
namespace OpenAuth.Infrastructure
|
||||
{
|
||||
public partial class OpenAuthDBContext : DbContext
|
||||
{
|
||||
static OpenAuthDBContext()
|
||||
{
|
||||
Database.SetInitializer<OpenAuthDBContext>(null);
|
||||
}
|
||||
|
||||
public OpenAuthDBContext()
|
||||
: base("Name=OpenAuthDBContext")
|
||||
{
|
||||
}
|
||||
|
||||
public DbSet<Button> Buttons { get; set; }
|
||||
public DbSet<DataPermission> DataPermissions { get; set; }
|
||||
public DbSet<Department> Departments { get; set; }
|
||||
public DbSet<Menu> Menus { get; set; }
|
||||
public DbSet<Role> Roles { get; set; }
|
||||
// public DbSet<RoleMenuButton> RoleMenuButtons { get; set; }
|
||||
public DbSet<User> Users { get; set; }
|
||||
|
||||
protected override void OnModelCreating(DbModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Configurations.Add(new ButtonMap());
|
||||
modelBuilder.Configurations.Add(new DataPermissionMap());
|
||||
modelBuilder.Configurations.Add(new DepartmentMap());
|
||||
modelBuilder.Configurations.Add(new MenuMap());
|
||||
modelBuilder.Configurations.Add(new RoleMap());
|
||||
// modelBuilder.Configurations.Add(new RoleMenuButtonMap());
|
||||
modelBuilder.Configurations.Add(new UserMap());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenAuth.Infrastructure.Repository
|
||||
{
|
||||
public class BaseRepository
|
||||
{
|
||||
protected OpenAuthDBContext _Context = new OpenAuthDBContext();
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using OpenAuth.Domain.Interface;
|
||||
using OpenAuth.Domain.Model;
|
||||
|
||||
namespace OpenAuth.Infrastructure.Repository
|
||||
{
|
||||
public class UserRepository :BaseRepository, IUserRepository
|
||||
{
|
||||
public User FindByAccount(string username)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _Context.Users.First(e => e.Account == username);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public User FindById(string id)
|
||||
{
|
||||
try
|
||||
{
|
||||
return _Context.Users.First(e => e.Id == id);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="EntityFramework" version="6.1.3" targetFramework="net40" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user