采用全新的数据库架构

This commit is contained in:
yubaolee
2015-10-26 21:58:12 +08:00
parent 366d3a5351
commit 13d44f28b6
91 changed files with 21208 additions and 9430 deletions

View File

@@ -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" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --></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>

View File

@@ -1,13 +1,86 @@
using OpenAuth.Repository.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace OpenAuth.Repository
{
public class BaseRepository
{
protected OpenAuthDBContext Context = new OpenAuthDBContext();
}
}
using System;
using System.Data.Entity.Migrations;
using System.Linq;
using System.Linq.Expressions;
using OpenAuth.Domain.Interface;
using OpenAuth.Repository.Models;
using Infrastructure;
namespace OpenAuth.Repository
{
public class BaseRepository<T> :IRepository<T> where T :class
{
protected OpenAuthDBContext Context = new OpenAuthDBContext();
/// <summary>
/// 根据过滤条件,获取记录
/// </summary>
/// <param name="exp">The exp.</param>
public IQueryable<T> Find(Expression<Func<T, bool>> exp = null)
{
return Filter(exp);
}
/// <summary>
/// 查找单个
/// </summary>
public T FindSingle(Expression<Func<T, bool>> exp)
{
return Context.Set<T>().FirstOrDefault(exp);
}
/// <summary>
/// 得到分页记录
/// </summary>
/// <param name="pageindex">The pageindex.</param>
/// <param name="pagesize">The pagesize.</param>
/// <param name="orderby">排序,格式如:"Id"/"Id descending"</param>
public IQueryable<T> Find(int pageindex, int pagesize, string orderby = "", Expression<Func<T, bool>> exp = null)
{
if (pageindex < 1) pageindex = 1;
if (string.IsNullOrEmpty(orderby))
orderby = "Id descending";
return Filter(exp).OrderBy(orderby).Skip(pagesize * (pageindex - 1)).Take(pagesize);
}
/// <summary>
/// 根据过滤条件获取记录数
/// </summary>
public int GetCount(Expression<Func<T, bool>> exp = null)
{
return Filter(exp).Count();
}
public void Add(T entity)
{
Context.Set<T>().Add(entity);
Save();
}
public void Update(T entity)
{
Context.Set<T>().AddOrUpdate(entity);
Save();
}
public void Delete(T entity)
{
Context.Set<T>().Remove(entity);
Save();
}
public void Save()
{
Context.SaveChanges();
}
private IQueryable<T> Filter(Expression<Func<T, bool>> exp)
{
var dbSet = Context.Set<T>().AsQueryable();
if (exp != null)
dbSet = dbSet.Where(exp);
return dbSet;
}
}
}

View File

@@ -48,8 +48,6 @@ namespace OpenAuth.Domain
"System.Data.Spatial.",
"System.Data.Entity.Spatial.");
}
#>
<#= Accessibility.ForProperty(property) #> <#= typeUsage #> <#= code.Escape(property) #> { get; set; }
<#

View File

@@ -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>

View File

@@ -1,49 +0,0 @@
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.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(50);
this.Property(t => t.Control_ID)
.HasMaxLength(50);
this.Property(t => t.Category)
.HasMaxLength(50);
this.Property(t => t.Description)
.HasMaxLength(50);
// 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");
}
}
}

View File

@@ -1,33 +0,0 @@
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.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");
}
}
}

View File

@@ -1,38 +0,0 @@
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.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.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");
}
}
}

View File

@@ -1,33 +0,0 @@
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class MenuButtonMap : EntityTypeConfiguration<MenuButton>
{
public MenuButtonMap()
{
// Primary Key
this.HasKey(t => t.MenuButtonId);
// Properties
this.Property(t => t.MenuButtonId)
.IsRequired()
.HasMaxLength(50);
this.Property(t => t.MenuId)
.IsRequired()
.HasMaxLength(50);
this.Property(t => t.ButtonId)
.IsRequired()
.HasMaxLength(50);
// Table & Column Mappings
this.ToTable("MenuButton");
this.Property(t => t.MenuButtonId).HasColumnName("MenuButtonId");
this.Property(t => t.MenuId).HasColumnName("MenuId");
this.Property(t => t.ButtonId).HasColumnName("ButtonId");
}
}
}

View File

@@ -1,55 +0,0 @@
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.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(50);
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");
}
}
}

View File

@@ -0,0 +1,60 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class ModuleMap : EntityTypeConfiguration<Module>
{
public ModuleMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.CascadeId)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Name)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Url)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.HotKey)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.IconName)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.ParentName)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Vector)
.IsRequired()
.HasMaxLength(255);
// Table & Column Mappings
this.ToTable("Module");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.CascadeId).HasColumnName("CascadeId");
this.Property(t => t.Name).HasColumnName("Name");
this.Property(t => t.Url).HasColumnName("Url");
this.Property(t => t.HotKey).HasColumnName("HotKey");
this.Property(t => t.ParentId).HasColumnName("ParentId");
this.Property(t => t.IsLeaf).HasColumnName("IsLeaf");
this.Property(t => t.IsAutoExpand).HasColumnName("IsAutoExpand");
this.Property(t => t.IconName).HasColumnName("IconName");
this.Property(t => t.Status).HasColumnName("Status");
this.Property(t => t.ParentName).HasColumnName("ParentName");
this.Property(t => t.Vector).HasColumnName("Vector");
this.Property(t => t.SortNo).HasColumnName("SortNo");
}
}
}

View File

@@ -0,0 +1,28 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class ModuleRoleMap : EntityTypeConfiguration<ModuleRole>
{
public ModuleRoleMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
// Table & Column Mappings
this.ToTable("ModuleRole");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.RoleId).HasColumnName("RoleId");
this.Property(t => t.ModuleId).HasColumnName("ModuleId");
this.Property(t => t.Type).HasColumnName("Type");
this.Property(t => t.OperateTime).HasColumnName("OperateTime");
this.Property(t => t.OperatorId).HasColumnName("OperatorId");
}
}
}

View File

@@ -0,0 +1,63 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class OrgMap : EntityTypeConfiguration<Org>
{
public OrgMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.CascadeId)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Name)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.HotKey)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.ParentName)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.IconName)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.BizCode)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.CustomCode)
.IsRequired()
.HasMaxLength(4000);
// Table & Column Mappings
this.ToTable("Org");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.CascadeId).HasColumnName("CascadeId");
this.Property(t => t.Name).HasColumnName("Name");
this.Property(t => t.HotKey).HasColumnName("HotKey");
this.Property(t => t.ParentId).HasColumnName("ParentId");
this.Property(t => t.ParentName).HasColumnName("ParentName");
this.Property(t => t.IsLeaf).HasColumnName("IsLeaf");
this.Property(t => t.IsAutoExpand).HasColumnName("IsAutoExpand");
this.Property(t => t.IconName).HasColumnName("IconName");
this.Property(t => t.Status).HasColumnName("Status");
this.Property(t => t.Type).HasColumnName("Type");
this.Property(t => t.BizCode).HasColumnName("BizCode");
this.Property(t => t.CustomCode).HasColumnName("CustomCode");
this.Property(t => t.CreateTime).HasColumnName("CreateTime");
this.Property(t => t.CreateId).HasColumnName("CreateId");
this.Property(t => t.SortNo).HasColumnName("SortNo");
}
}
}

View File

@@ -0,0 +1,28 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class PageElementGrantMap : EntityTypeConfiguration<PageElementGrant>
{
public PageElementGrantMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
// Table & Column Mappings
this.ToTable("PageElementGrant");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.ElementId).HasColumnName("ElementId");
this.Property(t => t.UserId).HasColumnName("UserId");
this.Property(t => t.RoleId).HasColumnName("RoleId");
this.Property(t => t.PostId).HasColumnName("PostId");
this.Property(t => t.GrantType).HasColumnName("GrantType");
}
}
}

View File

@@ -0,0 +1,40 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class PageElementMap : EntityTypeConfiguration<PageElement>
{
public PageElementMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
this.Property(t => t.DomId)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Name)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Remark)
.IsRequired()
.HasMaxLength(4000);
// Table & Column Mappings
this.ToTable("PageElement");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.DomId).HasColumnName("DomId");
this.Property(t => t.Name).HasColumnName("Name");
this.Property(t => t.Type).HasColumnName("Type");
this.Property(t => t.ModuleId).HasColumnName("ModuleId");
this.Property(t => t.Remark).HasColumnName("Remark");
}
}
}

View File

@@ -0,0 +1,50 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class PageMap : EntityTypeConfiguration<Page>
{
public PageMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Name)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Url)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Icon)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.IconBig)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Vector)
.IsRequired()
.HasMaxLength(255);
// Table & Column Mappings
this.ToTable("Page");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.ModuleId).HasColumnName("ModuleId");
this.Property(t => t.Name).HasColumnName("Name");
this.Property(t => t.Url).HasColumnName("Url");
this.Property(t => t.Type).HasColumnName("Type");
this.Property(t => t.Enabled).HasColumnName("Enabled");
this.Property(t => t.IsDefault).HasColumnName("IsDefault");
this.Property(t => t.Icon).HasColumnName("Icon");
this.Property(t => t.IconBig).HasColumnName("IconBig");
this.Property(t => t.Vector).HasColumnName("Vector");
this.Property(t => t.SortNo).HasColumnName("SortNo");
}
}
}

View File

@@ -1,46 +1,39 @@
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.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(50);
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");
}
}
}
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class RoleMap : EntityTypeConfiguration<Role>
{
public RoleMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Name)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.CreateId)
.IsRequired()
.HasMaxLength(64);
this.Property(t => t.CreateOrgCascadeId)
.IsRequired()
.HasMaxLength(255);
// Table & Column Mappings
this.ToTable("Role");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.Name).HasColumnName("Name");
this.Property(t => t.Status).HasColumnName("Status");
this.Property(t => t.Type).HasColumnName("Type");
this.Property(t => t.CreateTime).HasColumnName("CreateTime");
this.Property(t => t.CreateId).HasColumnName("CreateId");
this.Property(t => t.CreateOrgId).HasColumnName("CreateOrgId");
this.Property(t => t.CreateOrgCascadeId).HasColumnName("CreateOrgCascadeId");
}
}
}

View File

@@ -1,38 +0,0 @@
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.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");
}
}
}

View File

@@ -1,33 +0,0 @@
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class RoleMenuMap : EntityTypeConfiguration<RoleMenu>
{
public RoleMenuMap()
{
// Primary Key
this.HasKey(t => t.RoleMenuId);
// Properties
this.Property(t => t.RoleMenuId)
.IsRequired()
.HasMaxLength(50);
this.Property(t => t.RoleId)
.IsRequired()
.HasMaxLength(50);
this.Property(t => t.MenuId)
.IsRequired()
.HasMaxLength(50);
// Table & Column Mappings
this.ToTable("RoleMenu");
this.Property(t => t.RoleMenuId).HasColumnName("RoleMenuId");
this.Property(t => t.RoleId).HasColumnName("RoleId");
this.Property(t => t.MenuId).HasColumnName("MenuId");
}
}
}

View File

@@ -0,0 +1,44 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class UserCfgMap : EntityTypeConfiguration<UserCfg>
{
public UserCfgMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
this.Property(t => t.Theme)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Skin)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.NavBarStyle)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.TabFocusColor)
.IsRequired()
.HasMaxLength(255);
// Table & Column Mappings
this.ToTable("UserCfg");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.Theme).HasColumnName("Theme");
this.Property(t => t.Skin).HasColumnName("Skin");
this.Property(t => t.NavBarStyle).HasColumnName("NavBarStyle");
this.Property(t => t.TabFocusColor).HasColumnName("TabFocusColor");
this.Property(t => t.NavTabIndex).HasColumnName("NavTabIndex");
}
}
}

View File

@@ -1,33 +0,0 @@
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class UserDepartmentMap : EntityTypeConfiguration<UserDepartment>
{
public UserDepartmentMap()
{
// Primary Key
this.HasKey(t => t.UserDepartmentId);
// Properties
this.Property(t => t.UserDepartmentId)
.IsRequired()
.HasMaxLength(50);
this.Property(t => t.DepartmentId)
.IsRequired()
.HasMaxLength(50);
this.Property(t => t.UserId)
.IsRequired()
.HasMaxLength(50);
// Table & Column Mappings
this.ToTable("UserDepartment");
this.Property(t => t.UserDepartmentId).HasColumnName("UserDepartmentId");
this.Property(t => t.DepartmentId).HasColumnName("DepartmentId");
this.Property(t => t.UserId).HasColumnName("UserId");
}
}
}

View File

@@ -0,0 +1,89 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class UserExtMap : EntityTypeConfiguration<UserExt>
{
public UserExtMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
this.Property(t => t.Email)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Phone_)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Mobile)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Address)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Zip)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Birthday)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.IdCard)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.QQ)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.DynamicField)
.IsRequired()
.HasMaxLength(4000);
this.Property(t => t.Remark)
.IsRequired()
.HasMaxLength(4000);
this.Property(t => t.Field1)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Field2)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Field3)
.IsRequired()
.HasMaxLength(255);
// Table & Column Mappings
this.ToTable("UserExt");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.Email).HasColumnName("Email");
this.Property(t => t.Phone_).HasColumnName("Phone_");
this.Property(t => t.Mobile).HasColumnName("Mobile");
this.Property(t => t.Address).HasColumnName("Address");
this.Property(t => t.Zip).HasColumnName("Zip");
this.Property(t => t.Birthday).HasColumnName("Birthday");
this.Property(t => t.IdCard).HasColumnName("IdCard");
this.Property(t => t.QQ).HasColumnName("QQ");
this.Property(t => t.DynamicField).HasColumnName("DynamicField");
this.Property(t => t.ByteArrayId).HasColumnName("ByteArrayId");
this.Property(t => t.Remark).HasColumnName("Remark");
this.Property(t => t.Field1).HasColumnName("Field1");
this.Property(t => t.Field2).HasColumnName("Field2");
this.Property(t => t.Field3).HasColumnName("Field3");
}
}
}

View File

@@ -1,41 +1,48 @@
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.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);
// 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");
}
}
}
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class UserMap : EntityTypeConfiguration<User>
{
public UserMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
this.Property(t => t.Account)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Password)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Name)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.BizCode)
.IsRequired()
.HasMaxLength(255);
// Table & Column Mappings
this.ToTable("User");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.Account).HasColumnName("Account");
this.Property(t => t.Password).HasColumnName("Password");
this.Property(t => t.Name).HasColumnName("Name");
this.Property(t => t.Sex).HasColumnName("Sex");
this.Property(t => t.Status).HasColumnName("Status");
this.Property(t => t.Type).HasColumnName("Type");
this.Property(t => t.BizCode).HasColumnName("BizCode");
this.Property(t => t.CreateTime).HasColumnName("CreateTime");
this.Property(t => t.CreateId).HasColumnName("CreateId");
}
}
}

View File

@@ -0,0 +1,28 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class UserModuleMap : EntityTypeConfiguration<UserModule>
{
public UserModuleMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
// Table & Column Mappings
this.ToTable("UserModule");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.UserId).HasColumnName("UserId");
this.Property(t => t.ModuleId).HasColumnName("ModuleId");
this.Property(t => t.Type).HasColumnName("Type");
this.Property(t => t.OperateTime).HasColumnName("OperateTime");
this.Property(t => t.OperatorId).HasColumnName("OperatorId");
}
}
}

View File

@@ -0,0 +1,27 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class UserOrgMap : EntityTypeConfiguration<UserOrg>
{
public UserOrgMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
// Table & Column Mappings
this.ToTable("UserOrg");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.OrgId).HasColumnName("OrgId");
this.Property(t => t.UserId).HasColumnName("UserId");
this.Property(t => t.OperateTime).HasColumnName("OperateTime");
this.Property(t => t.OperatorId).HasColumnName("OperatorId");
}
}
}

View File

@@ -1,33 +1,27 @@
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class UserRoleMap : EntityTypeConfiguration<UserRole>
{
public UserRoleMap()
{
// Primary Key
this.HasKey(t => t.UserRoleId);
// Properties
this.Property(t => t.UserRoleId)
.IsRequired()
.HasMaxLength(50);
this.Property(t => t.UserId)
.IsRequired()
.HasMaxLength(50);
this.Property(t => t.RoleId)
.IsRequired()
.HasMaxLength(50);
// Table & Column Mappings
this.ToTable("UserRole");
this.Property(t => t.UserRoleId).HasColumnName("UserRoleId");
this.Property(t => t.UserId).HasColumnName("UserId");
this.Property(t => t.RoleId).HasColumnName("RoleId");
}
}
}
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class UserRoleMap : EntityTypeConfiguration<UserRole>
{
public UserRoleMap()
{
// Primary Key
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
// Table & Column Mappings
this.ToTable("UserRole");
this.Property(t => t.Id).HasColumnName("Id");
this.Property(t => t.RoleId).HasColumnName("RoleId");
this.Property(t => t.UserId).HasColumnName("UserId");
this.Property(t => t.OperateTime).HasColumnName("OperateTime");
this.Property(t => t.OperatorId).HasColumnName("OperatorId");
}
}
}

View File

@@ -1,27 +0,0 @@
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
namespace OpenAuth.Repository.Models.Mapping
{
public class sysdiagramMap : EntityTypeConfiguration<sysdiagram>
{
public sysdiagramMap()
{
// Primary Key
this.HasKey(t => t.diagram_id);
// Properties
this.Property(t => t.name)
.IsRequired()
.HasMaxLength(128);
// Table & Column Mappings
this.ToTable("sysdiagrams");
this.Property(t => t.name).HasColumnName("name");
this.Property(t => t.principal_id).HasColumnName("principal_id");
this.Property(t => t.diagram_id).HasColumnName("diagram_id");
this.Property(t => t.version).HasColumnName("version");
this.Property(t => t.definition).HasColumnName("definition");
}
}
}

View File

@@ -1,48 +1,51 @@
using System.Data.Entity;
using OpenAuth.Domain;
using OpenAuth.Repository.Models.Mapping;
namespace OpenAuth.Repository.Models
{
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<MenuButton> MenuButtons { get; set; }
public DbSet<Role> Roles { get; set; }
public DbSet<RoleMenu> RoleMenus { get; set; }
public DbSet<RoleMenuButton> RoleMenuButtons { get; set; }
public DbSet<sysdiagram> sysdiagrams { get; set; }
public DbSet<User> Users { get; set; }
public DbSet<UserDepartment> UserDepartments { get; set; }
public DbSet<UserRole> UserRoles { 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 MenuButtonMap());
modelBuilder.Configurations.Add(new RoleMap());
modelBuilder.Configurations.Add(new RoleMenuMap());
modelBuilder.Configurations.Add(new RoleMenuButtonMap());
modelBuilder.Configurations.Add(new sysdiagramMap());
modelBuilder.Configurations.Add(new UserMap());
modelBuilder.Configurations.Add(new UserDepartmentMap());
modelBuilder.Configurations.Add(new UserRoleMap());
}
}
}
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using OpenAuth.Domain;
using OpenAuth.Repository.Models.Mapping;
namespace OpenAuth.Repository.Models
{
public partial class OpenAuthDBContext : DbContext
{
static OpenAuthDBContext()
{
Database.SetInitializer<OpenAuthDBContext>(null);
}
public OpenAuthDBContext()
: base("Name=OpenAuthDBContext")
{
}
public DbSet<Module> Modules { get; set; }
public DbSet<ModuleRole> ModuleRoles { get; set; }
public DbSet<Org> Orgs { get; set; }
public DbSet<Page> Pages { get; set; }
public DbSet<PageElement> PageElements { get; set; }
public DbSet<PageElementGrant> PageElementGrants { get; set; }
public DbSet<Role> Roles { get; set; }
public DbSet<User> Users { get; set; }
public DbSet<UserCfg> UserCfgs { get; set; }
public DbSet<UserExt> UserExts { get; set; }
public DbSet<UserModule> UserModules { get; set; }
public DbSet<UserOrg> UserOrgs { get; set; }
public DbSet<UserRole> UserRoles { get; set; }
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Configurations.Add(new ModuleMap());
modelBuilder.Configurations.Add(new ModuleRoleMap());
modelBuilder.Configurations.Add(new OrgMap());
modelBuilder.Configurations.Add(new PageMap());
modelBuilder.Configurations.Add(new PageElementMap());
modelBuilder.Configurations.Add(new PageElementGrantMap());
modelBuilder.Configurations.Add(new RoleMap());
modelBuilder.Configurations.Add(new UserMap());
modelBuilder.Configurations.Add(new UserCfgMap());
modelBuilder.Configurations.Add(new UserExtMap());
modelBuilder.Configurations.Add(new UserModuleMap());
modelBuilder.Configurations.Add(new UserOrgMap());
modelBuilder.Configurations.Add(new UserRoleMap());
}
}
}

View File

@@ -1,93 +1,100 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E8DF8DEA-E2CF-4BDB-8F4F-3F8205B0E03A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenAuth.Repository</RootNamespace>
<AssemblyName>OpenAuth.Repository</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<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.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<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="BaseRepository.cs" />
<Compile Include="Models\Mapping\ButtonMap.cs" />
<Compile Include="Models\Mapping\DataPermissionMap.cs" />
<Compile Include="Models\Mapping\DepartmentMap.cs" />
<Compile Include="Models\Mapping\MenuButtonMap.cs" />
<Compile Include="Models\Mapping\MenuMap.cs" />
<Compile Include="Models\Mapping\RoleMap.cs" />
<Compile Include="Models\Mapping\RoleMenuButtonMap.cs" />
<Compile Include="Models\Mapping\RoleMenuMap.cs" />
<Compile Include="Models\Mapping\sysdiagramMap.cs" />
<Compile Include="Models\Mapping\UserDepartmentMap.cs" />
<Compile Include="Models\Mapping\UserMap.cs" />
<Compile Include="Models\Mapping\UserRoleMap.cs" />
<Compile Include="Models\OpenAuthDBContext.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UserRepository.cs" />
</ItemGroup>
<ItemGroup>
<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="CodeTemplates\ReverseEngineerCodeFirst\Context.tt" />
<None Include="CodeTemplates\ReverseEngineerCodeFirst\Entity.tt" />
<None Include="CodeTemplates\ReverseEngineerCodeFirst\Mapping.tt" />
<None Include="DB.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{E8DF8DEA-E2CF-4BDB-8F4F-3F8205B0E03A}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenAuth.Repository</RootNamespace>
<AssemblyName>OpenAuth.Repository</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="EntityFramework">
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer">
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<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="BaseRepository.cs" />
<Compile Include="Models\Mapping\ModuleMap.cs" />
<Compile Include="Models\Mapping\ModuleRoleMap.cs" />
<Compile Include="Models\Mapping\OrgMap.cs" />
<Compile Include="Models\Mapping\PageElementGrantMap.cs" />
<Compile Include="Models\Mapping\PageElementMap.cs" />
<Compile Include="Models\Mapping\PageMap.cs" />
<Compile Include="Models\Mapping\RoleMap.cs" />
<Compile Include="Models\Mapping\UserCfgMap.cs" />
<Compile Include="Models\Mapping\UserExtMap.cs" />
<Compile Include="Models\Mapping\UserMap.cs" />
<Compile Include="Models\Mapping\UserModuleMap.cs" />
<Compile Include="Models\Mapping\UserOrgMap.cs" />
<Compile Include="Models\Mapping\UserRoleMap.cs" />
<Compile Include="Models\OpenAuthDBContext.cs" />
<Compile Include="OrgRepository.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="UserRepository.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj">
<Project>{5feaec9a-4f1e-4ee7-b377-9db1b0870dac}</Project>
<Name>Infrastructure</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="packages.config" />
</ItemGroup>
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
</ItemGroup>
<ItemGroup>
<Content Include="CodeTemplates\ReverseEngineerCodeFirst\Context.tt" />
<Content Include="CodeTemplates\ReverseEngineerCodeFirst\Entity.tt" />
<Content Include="CodeTemplates\ReverseEngineerCodeFirst\Mapping.tt" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenAuth.Domain;
using OpenAuth.Domain.Interface;
namespace OpenAuth.Repository
{
public class OrgRepository : BaseRepository<Org>, IOrgRepository
{
public IEnumerable<Org> LoadOrgs()
{
return Find();
}
}
}

View File

@@ -1,27 +1,27 @@
using OpenAuth.Domain.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenAuth.Domain;
namespace OpenAuth.Repository
{
public class UserRepository :BaseRepository, IUserRepository
{
public User FindByAccount(string account)
{
return Context.Users.SingleOrDefault(u => u.Account == account);
}
public User FindById(string id)
{
return Context.Users.SingleOrDefault(u => u.UserId == id);
}
public IEnumerable<User> LoadUsers()
{
return Context.Users.ToList();
}
}
}
using OpenAuth.Domain.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using OpenAuth.Domain;
namespace OpenAuth.Repository
{
public class UserRepository :BaseRepository<User>, IUserRepository
{
public User FindByAccount(string account)
{
return Context.Users.SingleOrDefault(u => u.Account == account);
}
public User FindById(string id)
{
return FindSingle(u => u.Account == id);
}
public IEnumerable<User> LoadUsers()
{
return Context.Users.ToList();
}
}
}

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.1.3" targetFramework="net40" />
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="6.1.3" targetFramework="net45" />
</packages>