采用全新的数据库架构

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

@ -0,0 +1,27 @@
// ***********************************************************************
// Assembly : FairUtility
// Author : Yubao Li
// Created : 08-27-2015
//
// Last Modified By : Yubao Li
// Last Modified On : 08-27-2015
// ***********************************************************************
// <copyright file="AutoMapperExt.cs" company="">
// Copyright (c) . All rights reserved.
// </copyright>
// <summary></summary>
// ***********************************************************************
using AutoMapper;
namespace Infrastructure
{
public class AutoMapperExt
{
public static TResult ConvertTo<T, TResult>(T source)
{
var mapper = Mapper.CreateMap<T, TResult>();
return Mapper.Map<TResult>(source);
}
}
}

View File

@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
namespace Infrastructure
{
public class ControlHelper
{
/// <summary>
/// 根据集合得到下拉框
/// </summary>
/// <typeparam name="T">实体对象</typeparam>
/// <param name="rList">实体集合</param>
/// <param name="id">下拉框的id</param>
/// <param name="valFiled">值 字段名</param>
/// <param name="nameFiled">文本 字段名</param>
/// <param name="selected">需要选中的值</param>
/// <param name="css">样式名称</param>
/// <returns></returns>
public static string GetDropDownByList<T>(List<T> rList, string id, string valFiled, string nameFiled, string selected = "0", string css = "")
{
string str = " <select id='" + id + "' name='" + id + "' class='" + css + "'>";
foreach (var item in rList)
{
string value = item.GetType().GetProperty(valFiled).GetValue(item, null).ToString();
string text = item.GetType().GetProperty(nameFiled).GetValue(item, null).ToString();
str += "<option ";
if (value.Equals(selected)) str += " selected='selected' ";
str += " value='" + value + "'>" + text + "</option>";
}
if (rList.Count == 0) str += "<option value='没有数据'>没有数据</option>";
str += " </select>";
return str;
}
/// <summary>
/// 根据枚举得到下拉框
/// </summary>
/// <typeparam name="type">枚举对象</typeparam>
/// <param name="id">下拉框的id</param>
/// <param name="selected">需要选中的值</param>
/// <param name="css">样式名称</param>
/// <returns></returns>
public static string GetDropDownByEnum(Type type, string id, string selected = "", string css = "")
{
string str = " <select id='" + id + "' name='" + id + "' class='" + css + "'>";
str += "<option value=''>全部</option>";
foreach (int item in System.Enum.GetValues(type))
{
string value = item.ToString();
string text = System.Enum.GetName(type, item);
str += "<option ";
if (value.Equals(selected)) str += " selected='selected' ";
str += " value='" + value + "'>" + text + "</option>";
}
str += " </select>";
return str;
}
}
}

View File

@ -0,0 +1,162 @@
// ***********************************************************************
// Assembly : FairUtility
// Author : Yubao Li
// Created : 08-18-2015
//
// Last Modified By : Yubao Li
// Last Modified On : 08-18-2015
// ***********************************************************************
// <copyright file="DynamicLinq.cs" company="">
// Copyright (c) . All rights reserved.
// </copyright>
// <summary>动态linq</summary>
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
namespace Infrastructure
{
public static class DynamicLinq
{
public static ParameterExpression CreateLambdaParam<T>(string name)
{
return Expression.Parameter(typeof(T), name);
}
/// <summary>
/// 创建linq表达示的body部分
/// </summary>
public static Expression GenerateBody<T>(this ParameterExpression param, Filter filterObj)
{
PropertyInfo property = typeof(T).GetProperty(filterObj.Key);
//组装左边
Expression left = Expression.Property(param, property);
//组装右边
Expression right = null;
if (property.PropertyType == typeof(int))
{
right = Expression.Constant(int.Parse(filterObj.Value));
}
else if (property.PropertyType == typeof(DateTime))
{
right = Expression.Constant(DateTime.Parse(filterObj.Value));
}
else if (property.PropertyType == typeof(string))
{
right = Expression.Constant((filterObj.Value));
}
else if (property.PropertyType == typeof(decimal))
{
right = Expression.Constant(decimal.Parse(filterObj.Value));
}
else if (property.PropertyType == typeof(Guid))
{
right = Expression.Constant(Guid.Parse(filterObj.Value));
}
else if (property.PropertyType == typeof(bool))
{
right = Expression.Constant(filterObj.Value.Equals("1"));
}
else
{
throw new Exception("暂不能解析该Key的类型");
}
//c.XXX=="XXX"
Expression filter = Expression.Equal(left, right);
switch (filterObj.Contrast)
{
case "<=":
filter = Expression.LessThanOrEqual(left, right);
break;
case "<":
filter = Expression.LessThan(left, right);
break;
case ">":
filter = Expression.GreaterThan(left, right);
break;
case ">=":
filter = Expression.GreaterThanOrEqual(left, right);
break;
case "like":
filter = Expression.Call(left, typeof(string).GetMethod("Contains", new Type[] { typeof(string) }),
Expression.Constant(filterObj.Value));
break;
}
return filter;
}
public static Expression<Func<T, bool>> GenerateTypeBody<T>(this ParameterExpression param, Filter filterObj)
{
return (Expression<Func<T, bool>>)(param.GenerateBody<T>(filterObj));
}
/// <summary>
/// 创建完整的lambda
/// </summary>
public static LambdaExpression GenerateLambda(this ParameterExpression param, Expression body)
{
//c=>c.XXX=="XXX"
return Expression.Lambda(body, param);
}
public static Expression<Func<T, bool>> GenerateTypeLambda<T>(this ParameterExpression param, Expression body)
{
return (Expression<Func<T, bool>>)(param.GenerateLambda(body));
}
public static Expression AndAlso(this Expression expression, Expression expressionRight)
{
return Expression.AndAlso(expression, expressionRight);
}
public static Expression Or(this Expression expression, Expression expressionRight)
{
return Expression.Or(expression, expressionRight);
}
public static Expression And(this Expression expression, Expression expressionRight)
{
return Expression.And(expression, expressionRight);
}
//系统已经有该函数的实现
//public static IQueryable<T> Where<T>(this IQueryable<T> query, Expression expression)
//{
// Expression expr = Expression.Call(typeof(Queryable), "Where", new[] { typeof(T) },
// Expression.Constant(query), expression);
// //生成动态查询
// IQueryable<T> result = query.Provider.CreateQuery<T>(expr);
// return result;
//}
public static IQueryable<T> GenerateFilter<T>(this IQueryable<T> query, string filterjson)
{
if (!string.IsNullOrEmpty(filterjson))
{
var filters = JsonHelper.Instance.Deserialize<IEnumerable<Filter>>(filterjson);
var param = CreateLambdaParam<T>("c");
Expression result = Expression.Constant(true);
foreach (var filter in filters)
{
result = result.AndAlso(param.GenerateBody<T>(filter));
}
query = query.Where(param.GenerateTypeLambda<T>(result));
}
return query;
}
}
}

File diff suppressed because it is too large Load Diff

9
Infrastructure/Filter.cs Normal file
View File

@ -0,0 +1,9 @@
namespace Infrastructure
{
public class Filter
{
public string Key { get; set; }
public string Value { get; set; }
public string Contrast { get; set; }
}
}

View File

@ -0,0 +1,111 @@
// ***********************************************************************
// Assembly : FairUtility
// Author : Yubao Li
// Created : 10-13-2015
//
// Last Modified By : Yubao Li
// Last Modified On : 10-13-2015
// ***********************************************************************
// <copyright file="GenerateId.cs" company="">
// Copyright (c) . All rights reserved.
// </copyright>
// <summary>创建唯一ID</summary>
// ***********************************************************************
using System;
namespace Infrastructure
{
public class GenerateId
{
/// <summary>
/// 生成一个长整型可以转成19字节长的字符串
/// </summary>
/// <returns>System.Int64.</returns>
public static long GenerateLong()
{
byte[] buffer = Guid.NewGuid().ToByteArray();
return BitConverter.ToInt64(buffer, 0);
}
/// <summary>
/// 生成16个字节长度的数据与英文组合串
/// </summary>
public static string GenerateStr()
{
long i = 1;
foreach (byte b in Guid.NewGuid().ToByteArray())
{
i *= ((int)b + 1);
}
return string.Format("{0:x}", i - DateTime.Now.Ticks);
}
/// <summary>
/// 唯一订单号生成
/// </summary>
/// <returns></returns>
public static string GenerateOrderNumber()
{
string strDateTimeNumber = DateTime.Now.ToString("yyyyMMddHHmmssffff");
string strRandomResult = NextRandom(1000, 1).ToString("0000");
return strDateTimeNumber + strRandomResult;
}
/// <summary>
/// 参考msdn上的RNGCryptoServiceProvider例子
/// </summary>
/// <param name="numSeeds"></param>
/// <param name="length"></param>
/// <returns></returns>
private static int NextRandom(int numSeeds, int length)
{
// Create a byte array to hold the random value.
byte[] randomNumber = new byte[length];
// Create a new instance of the RNGCryptoServiceProvider.
System.Security.Cryptography.RNGCryptoServiceProvider rng = new System.Security.Cryptography.RNGCryptoServiceProvider();
// Fill the array with a random value.
rng.GetBytes(randomNumber);
// Convert the byte to an uint value to make the modulus operation easier.
uint randomResult = 0x0;
for (int i = 0; i < length; i++)
{
randomResult |= ((uint)randomNumber[i] << ((length - 1 - i) * 8));
}
return (int)(randomResult % numSeeds) + 1;
}
/// <summary>
/// 创建11位的英文与数字组合
/// </summary>
/// <returns>System.String.</returns>
public static string ShortStr()
{
return Convert(GenerateLong());
}
static string Seq = "s9LFkgy5RovixI1aOf8UhdY3r4DMplQZJXPqebE0WSjBn7wVzmN2Gc6THCAKut";
/// <summary>
/// 10进制转换为62进制
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
private static string Convert(long id)
{
if (id < 62)
{
return Seq[(int)id].ToString();
}
int y = (int)(id % 62);
long x = (long)(id / 62);
return Convert(x) + Seq[y];
}
}
}

View File

@ -30,6 +30,16 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="AutoMapper">
<HintPath>..\packages\AutoMapper.4.1.0\lib\net45\AutoMapper.dll</HintPath>
</Reference>
<Reference Include="log4net">
<HintPath>..\packages\log4net.2.0.3\lib\net40-full\log4net.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=7.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\Newtonsoft.Json.7.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Web" />
@ -40,9 +50,22 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Helper\CookieHelper.cs" />
<Compile Include="Helper\SessionHelper.cs" />
<Compile Include="AutoMapperExt.cs" />
<Compile Include="ControlHelper.cs" />
<Compile Include="CookieHelper.cs" />
<Compile Include="DynamicLinq.cs" />
<Compile Include="DynamicQueryable.cs" />
<Compile Include="Filter.cs" />
<Compile Include="GenerateId.cs" />
<Compile Include="JsonConverter.cs" />
<Compile Include="JsonHelper.cs" />
<Compile Include="LogHelper.cs" />
<Compile Include="PredicateBuilder.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SessionHelper.cs" />
</ItemGroup>
<ItemGroup>
<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.

View File

@ -0,0 +1,61 @@
// ***********************************************************************
// Assembly : Infrastructure
// Author : Yubao Li
// Created : 09-07-2015
//
// Last Modified By : Yubao Li
// Last Modified On : 09-07-2015
// ***********************************************************************
// <copyright file="GuidConverter.cs" company="">
// Copyright (c) . All rights reserved.
// </copyright>
// <summary>解决JSON转换空GUID问题</summary>
// ***********************************************************************
using System;
using Newtonsoft.Json;
namespace Infrastructure
{
public class GuidConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return objectType.IsAssignableFrom(typeof(Guid));
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
Guid result = Guid.Empty;
if (reader.Value == null) return result;
Guid.TryParse(reader.Value.ToString(), out result);
return result;
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
serializer.Serialize(writer, value);
}
}
public class DecimalConverter : JsonConverter
{
public override bool CanConvert(Type objectType)
{
return objectType.IsAssignableFrom(typeof(decimal));
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
decimal result = 0;
if (reader.Value == null) return result;
decimal.TryParse(reader.Value.ToString(), out result);
return result;
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
serializer.Serialize(writer, value);
}
}
}

View File

@ -0,0 +1,55 @@
// ***********************************************************************
// Assembly : FairUtility
// Author : Yubao Li
// Created : 08-12-2015
//
// Last Modified By : Yubao Li
// Last Modified On : 08-12-2015
// ***********************************************************************
// <copyright file="JsonHelper.cs" company="">
// Copyright (c) . All rights reserved.
// </copyright>
// <summary>json序列化帮助类</summary>
// ***********************************************************************
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Infrastructure
{
public class JsonHelper
{
private static JsonHelper _jsonHelper = new JsonHelper();
public static JsonHelper Instance { get { return _jsonHelper; } }
public string Serialize(object obj)
{
return JsonConvert.SerializeObject(obj, new IsoDateTimeConverter { DateTimeFormat = "yyyy-MM-dd HH:mm:ss" });
}
public string SerializeByConverter(object obj, params JsonConverter[] converters)
{
return JsonConvert.SerializeObject(obj, converters);
}
public T Deserialize<T>(string input)
{
return JsonConvert.DeserializeObject<T>(input);
}
public T DeserializeByConverter<T>(string input,params JsonConverter[] converter)
{
return JsonConvert.DeserializeObject<T>(input, converter);
}
public T DeserializeBySetting<T>(string input, JsonSerializerSettings settings)
{
return JsonConvert.DeserializeObject<T>(input, settings);
}
private object NullToEmpty(object obj)
{
return null;
}
}
}

View File

@ -0,0 +1,30 @@
using log4net;
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
namespace Infrastructure
{
public class LogHelper
{
public static readonly ILog _log = LogManager.GetLogger("log4net");
public static void Log(string message)
{
_log.Info(message);
}
public static void Debug(string message)
{
_log.Debug(message);
}
public static void Fatal(string message)
{
_log.Fatal(message);
}
public static void Warn(string message)
{
_log.Warn(message);
}
}
}

View File

@ -0,0 +1,28 @@
using System;
using System.Linq;
using System.Linq.Expressions;
namespace Infrastructure
{
public static class PredicateBuilder
{
public static Expression<Func<T, bool>> True<T>() { return f => true; }
public static Expression<Func<T, bool>> False<T>() { return f => false; }
public static Expression<Func<T, bool>> Or<T>(this Expression<Func<T, bool>> expr1,
Expression<Func<T, bool>> expr2)
{
var invokedExpr = Expression.Invoke(expr2, expr1.Parameters.Cast<Expression>());
return Expression.Lambda<Func<T, bool>>
(Expression.OrElse(expr1.Body, invokedExpr), expr1.Parameters);
}
public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> expr1,
Expression<Func<T, bool>> expr2)
{
var invokedExpr = Expression.Invoke(expr2, expr1.Parameters.Cast<Expression>());
return Expression.Lambda<Func<T, bool>>
(Expression.AndAlso(expr1.Body, invokedExpr), expr1.Parameters);
}
}
}

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="AutoMapper" version="4.1.0" targetFramework="net45" />
<package id="log4net" version="2.0.3" targetFramework="net45" />
<package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" />
</packages>

View File

@ -22,7 +22,7 @@ namespace OpenAuth.App
throw new Exception("用户帐号不存在");
}
user.CheckLogin(password);
// user.CheckLogin(password);
}

View File

@ -9,8 +9,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenAuth.App</RootNamespace>
<AssemblyName>OpenAuth.App</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -20,6 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -28,6 +30,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@ -42,6 +45,7 @@
<ItemGroup>
<Compile Include="LoginApp.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="OrgManagerApp.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\OpenAuth.Domain\OpenAuth.Domain.csproj">

View File

@ -0,0 +1,22 @@
using System.Collections.Generic;
using OpenAuth.Domain;
using OpenAuth.Domain.Interface;
namespace OpenAuth.App
{
public class OrgManagerApp
{
private IOrgRepository _repository;
public OrgManagerApp(IOrgRepository repository)
{
_repository = repository;
}
public IEnumerable<Org> GetAll()
{
return _repository.LoadOrgs();
}
}
}

View File

@ -1,15 +0,0 @@
namespace OpenAuth.Domain
{
public partial class Button
{
public string ButtonId { get; set; }
public string FullName { get; set; }
public string Img { get; set; }
public string Event { get; set; }
public string Control_ID { get; set; }
public string Category { get; set; }
public string Description { get; set; }
public bool Enabled { get; set; }
public int SortCode { get; set; }
}
}

View File

@ -1,10 +0,0 @@
namespace OpenAuth.Domain
{
public partial class DataPermission
{
public string Id { get; set; }
public string RoleId { get; set; }
public string ResourceId { get; set; }
public string ObjectId { get; set; }
}
}

View File

@ -1,13 +0,0 @@
namespace OpenAuth.Domain
{
public partial class Department
{
public string DepartmentId { get; set; }
public string ParentId { get; set; }
public string FullName { get; set; }
public string Description { get; set; }
public bool Enabled { get; set; }
public int SortCode { get; set; }
public bool DeleteMark { get; set; }
}
}

View File

@ -1,6 +0,0 @@
namespace OpenAuth.Domain.Interface
{
public interface IMenuRepository
{
}
}

View File

@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OpenAuth.Domain.Interface
{
public interface IOrgRepository
{
IEnumerable<Org> LoadOrgs();
}
}

View File

@ -0,0 +1,40 @@
// ***********************************************************************
// Assembly : OpenAuth.Domain
// Author : yubaolee
// Created : 10-25-2015
//
// Last Modified By : yubaolee
// Last Modified On : 10-25-2015
// ***********************************************************************
// <copyright file="IRepository.cs" company="www.cnblogs.com/yubaolee">
// Copyright (c) www.cnblogs.com/yubaolee. All rights reserved.
// </copyright>
// <summary>仓储接口</summary>
// ***********************************************************************
using System;
using System.Linq;
using System.Linq.Expressions;
namespace OpenAuth.Domain.Interface
{
public interface IRepository<T> where T : class
{
T FindSingle(Expression<Func<T, bool>> exp = null);
IQueryable<T> Find(Expression<Func<T, bool>> exp = null);
IQueryable<T> Find(int pageindex = 1, int pagesize = 10, string orderby = "",
Expression<Func<T, bool>> exp = null);
int GetCount(Expression<Func<T, bool>> exp = null);
void Add(T entity);
void Update(T entity);
void Delete(T entity);
void Save();
}
}

View File

@ -1,18 +0,0 @@
namespace OpenAuth.Domain
{
public partial class Menu
{
public string MenuId { get; set; }
public string ParentId { get; set; }
public string FullName { get; set; }
public string Description { get; set; }
public string Img { get; set; }
public int Category { get; set; }
public string NavigateUrl { get; set; }
public string FormName { get; set; }
public string Target { get; set; }
public bool IsUnfold { get; set; }
public bool Enabled { get; set; }
public int SortCode { get; set; }
}
}

View File

@ -1,9 +0,0 @@
namespace OpenAuth.Domain
{
public partial class MenuButton
{
public string MenuButtonId { get; set; }
public string MenuId { get; set; }
public string ButtonId { get; set; }
}
}

22
OpenAuth.Domain/Module.cs Normal file
View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
namespace OpenAuth.Domain
{
public partial class Module
{
public int Id { get; set; }
public string CascadeId { get; set; }
public string Name { get; set; }
public string Url { get; set; }
public string HotKey { get; set; }
public int ParentId { get; set; }
public bool IsLeaf { get; set; }
public bool IsAutoExpand { get; set; }
public string IconName { get; set; }
public int Status { get; set; }
public string ParentName { get; set; }
public string Vector { get; set; }
public int SortNo { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
namespace OpenAuth.Domain
{
public partial class ModuleRole
{
public int Id { get; set; }
public int RoleId { get; set; }
public int ModuleId { get; set; }
public int Type { get; set; }
public System.DateTime OperateTime { get; set; }
public int OperatorId { get; set; }
}
}

View File

@ -9,8 +9,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenAuth.Domain</RootNamespace>
<AssemblyName>OpenAuth.Domain</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -20,6 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -28,6 +30,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@ -39,20 +42,22 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Button.cs" />
<Compile Include="DataPermission.cs" />
<Compile Include="Department.cs" />
<Compile Include="Interface\IMenuRepository.cs" />
<Compile Include="Interface\IOrgRepository.cs" />
<Compile Include="Interface\IRepository.cs" />
<Compile Include="Interface\IUserRepository.cs" />
<Compile Include="Menu.cs" />
<Compile Include="MenuButton.cs" />
<Compile Include="Module.cs" />
<Compile Include="ModuleRole.cs" />
<Compile Include="Org.cs" />
<Compile Include="Page.cs" />
<Compile Include="PageElement.cs" />
<Compile Include="PageElementGrant.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Role.cs" />
<Compile Include="RoleMenu.cs" />
<Compile Include="RoleMenuButton.cs" />
<Compile Include="sysdiagram.cs" />
<Compile Include="User.cs" />
<Compile Include="UserDepartment.cs" />
<Compile Include="UserCfg.cs" />
<Compile Include="UserExt.cs" />
<Compile Include="UserModule.cs" />
<Compile Include="UserOrg.cs" />
<Compile Include="UserRole.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

25
OpenAuth.Domain/Org.cs Normal file
View File

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
namespace OpenAuth.Domain
{
public partial class Org
{
public int Id { get; set; }
public string CascadeId { get; set; }
public string Name { get; set; }
public string HotKey { get; set; }
public int ParentId { get; set; }
public string ParentName { get; set; }
public bool IsLeaf { get; set; }
public bool IsAutoExpand { get; set; }
public string IconName { get; set; }
public int Status { get; set; }
public int Type { get; set; }
public string BizCode { get; set; }
public string CustomCode { get; set; }
public System.DateTime CreateTime { get; set; }
public int CreateId { get; set; }
public int SortNo { get; set; }
}
}

20
OpenAuth.Domain/Page.cs Normal file
View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
namespace OpenAuth.Domain
{
public partial class Page
{
public int Id { get; set; }
public int ModuleId { get; set; }
public string Name { get; set; }
public string Url { get; set; }
public int Type { get; set; }
public bool Enabled { get; set; }
public bool IsDefault { get; set; }
public string Icon { get; set; }
public string IconBig { get; set; }
public string Vector { get; set; }
public int SortNo { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
namespace OpenAuth.Domain
{
public partial class PageElement
{
public int Id { get; set; }
public string DomId { get; set; }
public string Name { get; set; }
public int Type { get; set; }
public int ModuleId { get; set; }
public string Remark { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
namespace OpenAuth.Domain
{
public partial class PageElementGrant
{
public int Id { get; set; }
public int ElementId { get; set; }
public int UserId { get; set; }
public int RoleId { get; set; }
public int PostId { get; set; }
public int GrantType { get; set; }
}
}

View File

@ -1,15 +1,17 @@
using System;
using System.Collections.Generic;
namespace OpenAuth.Domain
{
public partial class Role
{
public string RoleId { get; set; }
public string ParentId { get; set; }
public string FullName { get; set; }
public string Category { get; set; }
public string Description { get; set; }
public bool Enabled { get; set; }
public int SortCode { get; set; }
public bool DeleteMark { get; set; }
public string DepartmentId { get; set; }
public int Id { get; set; }
public string Name { get; set; }
public int Status { get; set; }
public int Type { get; set; }
public System.DateTime CreateTime { get; set; }
public string CreateId { get; set; }
public int CreateOrgId { get; set; }
public string CreateOrgCascadeId { get; set; }
}
}

View File

@ -1,9 +0,0 @@
namespace OpenAuth.Domain
{
public partial class RoleMenu
{
public string RoleMenuId { get; set; }
public string RoleId { get; set; }
public string MenuId { get; set; }
}
}

View File

@ -1,10 +0,0 @@
namespace OpenAuth.Domain
{
public partial class RoleMenuButton
{
public string RoleMenuButtonId { get; set; }
public string RoleId { get; set; }
public string MenuId { get; set; }
public string ButtonId { get; set; }
}
}

View File

@ -1,25 +1,19 @@
using System;
using System.Collections.Generic;
namespace OpenAuth.Domain
{
public partial class User
{
public string UserId { get; set; }
public int Id { get; set; }
public string Account { get; set; }
public string Password { get; set; }
public string RealName { get; set; }
public string RoleId { get; set; }
public bool Enabled { get; set; }
public bool DeleteMark { get; set; }
public void CheckLogin(string password)
{
if(this.Password != password)
throw new Exception("密码错误");
if(!this.Enabled)
throw new Exception("用户已经被停用");
if (DeleteMark)
throw new Exception("该账号已经被删除");
}
public string Name { get; set; }
public int Sex { get; set; }
public int Status { get; set; }
public int Type { get; set; }
public string BizCode { get; set; }
public System.DateTime CreateTime { get; set; }
public int CreateId { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
namespace OpenAuth.Domain
{
public partial class UserCfg
{
public int Id { get; set; }
public string Theme { get; set; }
public string Skin { get; set; }
public string NavBarStyle { get; set; }
public string TabFocusColor { get; set; }
public int NavTabIndex { get; set; }
}
}

View File

@ -1,9 +0,0 @@
namespace OpenAuth.Domain
{
public partial class UserDepartment
{
public string UserDepartmentId { get; set; }
public string DepartmentId { get; set; }
public string UserId { get; set; }
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
namespace OpenAuth.Domain
{
public partial class UserExt
{
public int Id { get; set; }
public string Email { get; set; }
public string Phone_ { get; set; }
public string Mobile { get; set; }
public string Address { get; set; }
public string Zip { get; set; }
public string Birthday { get; set; }
public string IdCard { get; set; }
public string QQ { get; set; }
public string DynamicField { get; set; }
public int ByteArrayId { get; set; }
public string Remark { get; set; }
public string Field1 { get; set; }
public string Field2 { get; set; }
public string Field3 { get; set; }
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
namespace OpenAuth.Domain
{
public partial class UserModule
{
public int Id { get; set; }
public int UserId { get; set; }
public int ModuleId { get; set; }
public int Type { get; set; }
public System.DateTime OperateTime { get; set; }
public int OperatorId { get; set; }
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
namespace OpenAuth.Domain
{
public partial class UserOrg
{
public int Id { get; set; }
public int OrgId { get; set; }
public int UserId { get; set; }
public System.DateTime OperateTime { get; set; }
public int OperatorId { get; set; }
}
}

View File

@ -1,9 +1,14 @@
using System;
using System.Collections.Generic;
namespace OpenAuth.Domain
{
public partial class UserRole
{
public string UserRoleId { get; set; }
public string UserId { get; set; }
public string RoleId { get; set; }
public int Id { get; set; }
public int RoleId { get; set; }
public int UserId { get; set; }
public System.DateTime OperateTime { get; set; }
public int OperatorId { get; set; }
}
}

View File

@ -1,13 +0,0 @@
using System;
namespace OpenAuth.Domain
{
public partial class sysdiagram
{
public string name { get; set; }
public int principal_id { get; set; }
public int diagram_id { get; set; }
public Nullable<int> version { get; set; }
public byte[] definition { get; set; }
}
}

View File

@ -0,0 +1,57 @@
// ***********************************************************************
// Assembly : OpenAuth.Mvc
// Author : yubaolee
// Created : 10-26-2015
//
// Last Modified By : yubaolee
// Last Modified On : 10-26-2015
// ***********************************************************************
// <copyright file="AutofacExt.cs" company="www.cnblogs.com/yubaolee">
// Copyright (c) www.cnblogs.com/yubaolee. All rights reserved.
// </copyright>
// <summary>IOC³õʼ»¯</summary>
// ***********************************************************************
using System.Reflection;
using System.Web.Mvc;
using Autofac;
using Autofac.Integration.Mvc;
using OpenAuth.App;
using OpenAuth.Domain.Interface;
using OpenAuth.Repository;
namespace OpenAuth.Mvc
{
static internal class AutofacExt
{
public static void InitAutofac()
{
var builder = new ContainerBuilder();
builder.RegisterType<UserRepository>().As<IUserRepository>();
builder.RegisterType<OrgRepository>().As<IOrgRepository>();
builder.RegisterType<LoginApp>();
builder.RegisterType<OrgManagerApp>();
// Register your MVC controllers.
builder.RegisterControllers(typeof (MvcApplication).Assembly);
// OPTIONAL: Register model binders that require DI.
builder.RegisterModelBinders(Assembly.GetExecutingAssembly());
builder.RegisterModelBinderProvider();
// OPTIONAL: Register web abstractions like HttpContextBase.
builder.RegisterModule<AutofacWebTypesModule>();
// OPTIONAL: Enable property injection in view pages.
builder.RegisterSource(new ViewRegistrationSource());
// OPTIONAL: Enable property injection into action filters.
builder.RegisterFilterProvider();
// Set the dependency resolver to be Autofac.
var container = builder.Build();
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
}
}
}

View File

@ -21,9 +21,9 @@ namespace OpenAuth.Mvc.Controllers
return View();
}
public ContentResult Main()
public ActionResult Main()
{
return Content("欢迎使用基于DDD的权限管理系统");
return View();
}
public ActionResult Login()

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace OpenAuth.Mvc.Controllers
{
public class ModuleManagerController : BaseController
{
//
// GET: /Modu/
public ActionResult Index()
{
return View();
}
}
}

View File

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Infrastructure;
using OpenAuth.App;
namespace OpenAuth.Mvc.Controllers
{
public class OrgManagerController : BaseController
{
private OrgManagerApp _orgApp;
public OrgManagerController()
{
_orgApp = (OrgManagerApp) DependencyResolver.Current.GetService(typeof (OrgManagerApp));
}
//
// GET: /OrgManager/
public ActionResult Index()
{
return View();
}
public string LoadOrg()
{
var orgs = _orgApp.GetAll();
return JsonHelper.Instance.Serialize(orgs);
}
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace OpenAuth.Mvc.Controllers
{
public class UserManagerController : Controller
{
//
// GET: /UserManager/
public ActionResult Index()
{
return View();
}
}
}

View File

@ -8,6 +8,7 @@ using System.Web.Optimization;
using System.Web.Routing;
using Autofac;
using Autofac.Integration.Mvc;
using Infrastructure;
using OpenAuth.App;
using OpenAuth.Domain.Interface;
using OpenAuth.Repository;
@ -18,41 +19,15 @@ namespace OpenAuth.Mvc
{
protected void Application_Start()
{
InitAutofac();
AutofacExt.InitAutofac();
AreaRegistration.RegisterAllAreas();
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
BundleConfig.RegisterBundles(BundleTable.Bundles);
}
private static void InitAutofac()
{
var builder = new ContainerBuilder();
builder.RegisterType<UserRepository>().As<IUserRepository>();
builder.RegisterType<LoginApp>();
// Register your MVC controllers.
builder.RegisterControllers(typeof (MvcApplication).Assembly);
// OPTIONAL: Register model binders that require DI.
builder.RegisterModelBinders(Assembly.GetExecutingAssembly());
builder.RegisterModelBinderProvider();
// OPTIONAL: Register web abstractions like HttpContextBase.
builder.RegisterModule<AutofacWebTypesModule>();
// OPTIONAL: Enable property injection in view pages.
builder.RegisterSource(new ViewRegistrationSource());
// OPTIONAL: Enable property injection into action filters.
builder.RegisterFilterProvider();
// Set the dependency resolver to be Autofac.
var container = builder.Build();
DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
LogHelper.Log("启动Web");
}
}
}

View File

@ -120,8 +120,12 @@
<Compile Include="App_Start\BundleConfig.cs" />
<Compile Include="App_Start\FilterConfig.cs" />
<Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="AutofacExt.cs" />
<Compile Include="Controllers\BaseController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\ModuleManagerController.cs" />
<Compile Include="Controllers\OrgManagerController.cs" />
<Compile Include="Controllers\UserManagerController.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
@ -129,6 +133,7 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="BJUI\images\captcha.jpeg" />
<Content Include="BJUI\images\datagrid\AU.gif" />
<Content Include="BJUI\images\datagrid\BR.gif" />
<Content Include="BJUI\images\datagrid\CN.gif" />
@ -142,14 +147,7 @@
<Content Include="BJUI\images\loginbg_02.jpg" />
<Content Include="BJUI\images\loginbg_03.jpg" />
<Content Include="BJUI\images\loginbg_04.jpg" />
<Content Include="BJUI\images\loginbg_05.jpg" />
<Content Include="BJUI\images\loginbg_06.jpg" />
<Content Include="BJUI\images\loginbg_07.jpg" />
<Content Include="BJUI\images\loginbg_08.jpg" />
<Content Include="BJUI\images\loginbg_09.jpg" />
<Content Include="BJUI\images\logo.jpg" />
<Content Include="BJUI\images\logo.png" />
<Content Include="BJUI\images\logo_bootstrap.png" />
<Content Include="BJUI\js\bjui-ajax.js" />
<Content Include="BJUI\js\bjui-ajaxtab.js" />
<Content Include="BJUI\js\bjui-alertmsg.js" />
@ -563,6 +561,7 @@
<ItemGroup>
<Folder Include="App_Data\" />
<Folder Include="Views\Base\" />
<Folder Include="Views\UserManager\" />
</ItemGroup>
<ItemGroup>
<Content Include="packages.config" />
@ -604,6 +603,12 @@
<ItemGroup>
<Content Include="Views\Home\Login.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\OrgManager\Index.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Home\Main.cshtml" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>

View File

@ -206,7 +206,7 @@
<ul id="bjui-doc-tree-base" class="ztree ztree_main" data-toggle="ztree" data-on-click="MainMenuClick"
data-expand-all="true" data-faicon="star-o" data-tit="基本设置">
<li data-id="99" data-pid="0" data-faicon="folder-open-o" data-faicon-close="folder-o">文件列表</li>
<li data-id="100" data-pid="99" data-url="doc/base/filelist.html" data-tabid="doc-file" data-faicon="caret-right">文件详解</li>
<li data-id="100" data-pid="99" data-url="OrgManager/Index" data-tabid="doc-file" data-faicon="caret-right">机构管理</li>
<li data-id="1" data-pid="0" data-faicon="folder-open-o" data-faicon-close="folder-o" data-faicon="caret-right">框架介绍</li>
<li data-id="10" data-pid="1" data-url="doc/base/structure.html" data-tabid="doc-base" data-faicon="caret-right">页面结构</li>
<li data-id="11" data-pid="1" data-url="doc/base/init.html" data-tabid="doc-base" data-faicon="caret-right">框架初始化</li>
@ -221,59 +221,6 @@
<li data-id="9" data-pid="0" data-faicon="folder-open-o" data-faicon-close="folder-o" data-faicon="caret-right">框架皮肤</li>
<li data-id="90" data-pid="9" data-url="doc/theme/color.html" data-tabid="doc-theme" data-faicon="caret-right">颜色值</li>
</ul>
<ul id="bjui-doc-tree-module" class="ztree ztree_main" data-toggle="ztree" data-on-click="MainMenuClick" data-expand-all="true" data-faicon="th" data-tit="框架组件">
<li data-id="2" data-pid="0" data-faicon="folder-open-o" data-faicon-close="folder-o">标签navtab</li>
<li data-id="20" data-pid="2" data-url="doc/navtab/navtab.html" data-tabid="doc-navtab" data-faicon="caret-right">创建navtab</li>
<li data-id="21" data-pid="2" data-url="doc/navtab/navtab-op.html" data-tabid="doc-navtab" data-faicon="caret-right">参数及方法</li>
<li data-id="3" data-pid="0" data-faicon="folder-open-o" data-faicon-close="folder-o" data-faicon="caret-right">弹窗dialog</li>
<li data-id="30" data-pid="3" data-url="doc/dialog/dialog.html" data-tabid="doc-dialog" data-faicon="caret-right">创建dialog</li>
<li data-id="31" data-pid="3" data-url="doc/dialog/dialog-op.html" data-tabid="doc-dialog" data-faicon="caret-right">参数及方法</li>
<li data-id="alertmsg" data-pid="0" data-faicon="folder-open-o" data-faicon-close="folder-o" data-faicon="caret-right">信息提示alertmsg</li>
<li data-id="alertmsg-op" data-pid="alertmsg" data-url="doc/alertmsg/alertmsg.html" data-tabid="doc-alertmsg" data-faicon="caret-right">提示框alertmsg</li>
<li data-id="6" data-pid="0" data-faicon="folder-open-o" data-faicon-close="folder-o">表单相关</li>
<li data-id="60" data-pid="6" data-url="doc/form/datepicker.html" data-tabid="doc-form" data-faicon="caret-right">日期选择器</li>
<li data-id="61" data-pid="6" data-url="doc/form/spinner.html" data-tabid="doc-form" data-faicon="caret-right">微调器</li>
<li data-id="62" data-pid="6" data-url="doc/form/lookup.html" data-tabid="doc-form" data-faicon="caret-right">查找带回</li>
<li data-id="63" data-pid="6" data-url="doc/form/tags.html" data-tabid="doc-form" data-faicon="caret-right">自动完成标签</li>
<li data-id="64" data-pid="6" data-url="doc/form/upload.html" data-tabid="doc-form" data-faicon="caret-right">上传组件</li>
<li data-id="8" data-pid="0" data-faicon="folder-open-o" data-faicon-close="folder-o">右键菜单</li>
<li data-id="80" data-pid="8" data-url="doc/other/contextmenu.html" data-tabid="doc-other" data-faicon="caret-right">右键菜单</li>
</ul>
<ul id="bjui-doc-tree-ajax" class="ztree ztree_main" data-toggle="ztree" data-on-click="MainMenuClick" data-expand-all="true" data-faicon="spinner" data-tit="Ajax">
<li data-id="4" data-pid="0" data-faicon="folder-open-o" data-faicon-close="folder-o">Ajax</li>
<li data-id="40" data-pid="4" data-url="doc/ajax/callback.html" data-tabid="doc-ajax" data-faicon="caret-right">回调函数</li>
<li data-id="41" data-pid="4" data-url="doc/ajax/form.html" data-tabid="doc-ajax" data-faicon="caret-right">提交表单</li>
<li data-id="42" data-pid="4" data-url="doc/ajax/search.html" data-tabid="doc-ajax" data-faicon="caret-right">搜索表单</li>
<li data-id="43" data-pid="4" data-url="doc/ajax/load.html" data-tabid="doc-ajax" data-faicon="caret-right">加载(局部刷新)</li>
<li data-id="44" data-pid="4" data-url="doc/ajax/action.html" data-tabid="doc-ajax" data-faicon="caret-right">执行动作</li>
</ul>
<ul id="bjui-doc-tree-table" class="ztree ztree_main" data-toggle="ztree" data-on-click="MainMenuClick" data-expand-all="true" data-faicon="table" data-tit="表格相关">
<li data-id="7" data-pid="0" data-faicon="folder-open-o" data-faicon-close="folder-o">普通表格</li>
<li data-id="70" data-pid="7" data-url="doc/table/style.html" data-tabid="doc-table" data-faicon="caret-right">表格样式</li>
<li data-id="71" data-pid="7" data-url="doc/table/order.html" data-tabid="doc-table" data-faicon="caret-right">字段排序</li>
<li data-id="72" data-pid="7" data-url="doc/table/paging.html" data-tabid="doc-table" data-faicon="caret-right">分页组件</li>
<li data-id="73" data-pid="7" data-url="doc/table/selected.html" data-tabid="doc-table" data-faicon="caret-right">行选中操作</li>
<li data-id="74" data-pid="7" data-url="doc/table/fixed.html" data-tabid="doc-table" data-faicon="caret-right">固定表头</li>
<li data-id="75" data-pid="7" data-url="doc/table/edit.html" data-tabid="doc-table" data-faicon="caret-right">可编辑表格</li>
<li data-id="datagrid" data-pid="0" data-faicon="folder-open-o" data-faicon-close="folder-o">Datagrid</li>
<li data-id="datagrid-demo" data-pid="datagrid" data-url="doc/datagrid/datagrid-demo.html" data-tabid="doc-datagrid-demo" data-faicon="caret-right">datagrid示例</li>
<li data-id="datagrid-op" data-pid="datagrid" data-url="doc/datagrid/datagrid-op.html" data-tabid="doc-datagrid-op" data-faicon="caret-right">datagrid参数</li>
<li data-id="datagrid-columns" data-pid="datagrid" data-url="doc/datagrid/datagrid-columns.html" data-tabid="doc-datagrid-columns" data-faicon="caret-right">columns参数</li>
</ul>
<ul id="bjui-doc-tree-chart" class="ztree ztree_main" data-toggle="ztree" data-on-click="MainMenuClick" data-expand-all="true" data-faicon="image" data-tit="图形报表(插件)">
<li data-id="5" data-pid="0" data-faicon="folder-open-o" data-faicon-close="folder-o">图形报表(插件)</li>
<li data-id="50" data-pid="5" data-url="doc/chart/highcharts.html" data-tabid="doc-highcharts" data-faicon="caret-right">Highcharts图表</li>
<li data-id="50" data-pid="5" data-url="doc/chart/echarts.html" data-tabid="doc-echarts" data-faicon="caret-right">ECharts图表</li>
</ul>
<ul id="bjui-doc-tree-other" class="ztree ztree_main" data-toggle="ztree" data-on-click="MainMenuClick" data-expand-all="true" data-faicon="bug" data-tit="其他插件">
<li data-id="other" data-pid="0" data-faicon="folder-open-o" data-faicon-close="folder-o">其他插件</li>
<li data-id="ztree" data-pid="other" data-url="doc/plugin/ztree.html" data-tabid="doc-ztree" data-faicon="caret-right">zTree</li>
<li data-id="icheck" data-pid="other" data-url="doc/plugin/checkbox.html" data-tabid="doc-icheck" data-faicon="caret-right">复选/单选</li>
<li data-id="selectpicker" data-pid="other" data-url="doc/plugin/select.html" data-tabid="doc-selectpicker" data-faicon="caret-right">下拉选择框</li>
<li data-id="nicevalidator" data-pid="other" data-url="doc/plugin/validate.html" data-tabid="doc-nicevalidator" data-faicon="caret-right">表单验证</li>
<li data-id="kindeditor" data-pid="other" data-url="doc/plugin/kindeditor.html" data-tabid="doc-kindeditor" data-faicon="caret-right">KindEditor</li>
<li data-id="ajaxdownload" data-pid="other" data-url="doc/plugin/ajaxdownload.html" data-tabid="doc-ajaxdownload" data-faicon="caret-right">Ajax Download</li>
</ul>
</div>
</li>
<li class="dropdown">
@ -307,7 +254,7 @@
<div class="tabsPageHeader">
<div class="tabsPageHeaderContent">
<ul class="navtab-tab nav nav-tabs">
<li data-url="Main"><a href="javascript:;"><span><i class="fa fa-home"></i> #maintab#</span></a></li>
<li data-url="Home/Main"><a href="javascript:;"><span><i class="fa fa-home"></i> #maintab#</span></a></li>
</ul>
</div>
<div class="tabsLeft"><i class="fa fa-angle-double-left"></i></div>

View File

@ -0,0 +1,30 @@

@{
Layout = null;
}
<script type="text/javascript">
</script>
<div class="bjui-pageHeader" style="background:#FFF;">
<div style="padding: 0 15px;">
<h4 style="margin-bottom:20px;">
基于经典DDD架构的权限管理系统 <small>轻松开发,专注您的业务!</small>
</h4>
<div style=" margin-top:22px; padding-left:6px;">
<span style="padding-left:30px;">官方博客:</span><a href="http://www.cnblogs.com/yubaolee/" target="_blank">http://www.cnblogs.com/yubaolee/</a>
</div>
<div class="row" style=" margin-top:10px;">
<div class="col-md-6" style="padding:5px;">
<div class="alert alert-info" role="alert" style="margin:0 0 5px; padding:5px 15px;">
</div>
</div>
</div>
</div>
</div>
<div class="bjui-pageContent">
</div>

View File

@ -0,0 +1,58 @@
<script type="text/javascript">
$('#test-datagrid-array').datagrid({
gridTitle: '机构列表显示',
showToolbar: true,
toolbarItem: 'all',
addLocation: 'first',
local: 'local',
dataUrl: 'OrgManager/LoadOrg',
dataType: 'json',
columns: [
{
name: 'Type',
label: '类型',
type: 'select',
items: [ { '0': '默认' }],
align: 'center',
width: 80,
render: $.datagrid.renderItem
},
{
name: 'Name',
label: '机构名称',
align: 'center',
width: 100,
rule: 'required'
},
{
name: 'CreateTime',
label: '登记日期',
type: 'date',
pattern: 'yyyy-MM-dd HH:mm'
}
],
hiddenFields: ['Id'],
editUrl: 'ajaxDone1.html',
delUrl: 'ajaxDone1.html',
paging: { total: 30, pageSize: 5 },
showTfoot: true,
editMode: 'dialog',
fullGrid: true,
showLinenumber: true,
showCheckboxcol: true
})
</script>
<div class="bjui-pageContent">
<div style="padding:15px; height:100%; width:100%;">
<table id="test-datagrid-array" data-width="100%" data-height="280" class="table table-bordered"></table>
</div>
</div>

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问
http://go.microsoft.com/fwlink/?LinkId=301880
@ -6,62 +6,84 @@
<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"/>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<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"/>
<add name="OpenAuthDBContext" connectionString="Data Source=.;Initial Catalog=OpenAuthDB;Persist Security Info=True;User ID=sa;Password=000000;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<!--定义文件存放位置-->
<file value="log\\"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyyMMdd'.txt'"/>
<staticLogFileName value="false"/>
<param name="MaxSizeRollBackups" value="100"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
<root>
<level value="INFO"/>
<!--文件形式记录日志-->
<appender-ref ref="RollingLogFileAppender"/>
</root>
</log4net>
<appSettings>
<add key="webpages:Version" value="3.0.0.0"/>
<add key="webpages:Enabled" value="false"/>
<add key="ClientValidationEnabled" value="true"/>
<add key="UnobtrusiveJavaScriptEnabled" value="true"/>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<authentication mode="None"/>
<compilation debug="true" targetFramework="4.5"/>
<httpRuntime targetFramework="4.5"/>
<authentication mode="None" />
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.webServer>
<modules>
<remove name="FormsAuthenticationModule"/>
<remove name="FormsAuthenticationModule" />
</modules>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30AD4FE6B2A6AEED" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0"/>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30AD4FE6B2A6AEED" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234"/>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-5.1.0.0" newVersion="5.1.0.0"/>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral"/>
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0"/>
<assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>

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;
using System.Data.Entity.Migrations;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using OpenAuth.Domain.Interface;
using OpenAuth.Repository.Models;
using Infrastructure;
namespace OpenAuth.Repository
{
public class BaseRepository
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,3 +1,4 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
@ -8,39 +9,31 @@ namespace OpenAuth.Repository.Models.Mapping
public RoleMap()
{
// Primary Key
this.HasKey(t => t.RoleId);
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.RoleId)
this.Property(t => t.Name)
.IsRequired()
.HasMaxLength(50);
.HasMaxLength(255);
this.Property(t => t.ParentId)
.HasMaxLength(50);
this.Property(t => t.CreateId)
.IsRequired()
.HasMaxLength(64);
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);
this.Property(t => t.CreateOrgCascadeId)
.IsRequired()
.HasMaxLength(255);
// 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");
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,3 +1,4 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
@ -8,34 +9,40 @@ namespace OpenAuth.Repository.Models.Mapping
public UserMap()
{
// Primary Key
this.HasKey(t => t.UserId);
this.HasKey(t => t.Id);
// Properties
this.Property(t => t.UserId)
.IsRequired()
.HasMaxLength(50);
this.Property(t => t.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
this.Property(t => t.Account)
.HasMaxLength(50);
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.Password)
.HasMaxLength(50);
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.RealName)
.HasMaxLength(50);
this.Property(t => t.Name)
.IsRequired()
.HasMaxLength(255);
this.Property(t => t.RoleId)
.HasMaxLength(50);
this.Property(t => t.BizCode)
.IsRequired()
.HasMaxLength(255);
// Table & Column Mappings
this.ToTable("User");
this.Property(t => t.UserId).HasColumnName("UserId");
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.RealName).HasColumnName("RealName");
this.Property(t => t.RoleId).HasColumnName("RoleId");
this.Property(t => t.Enabled).HasColumnName("Enabled");
this.Property(t => t.DeleteMark).HasColumnName("DeleteMark");
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,3 +1,4 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using OpenAuth.Domain;
@ -8,26 +9,19 @@ namespace OpenAuth.Repository.Models.Mapping
public UserRoleMap()
{
// Primary Key
this.HasKey(t => t.UserRoleId);
this.HasKey(t => t.Id);
// 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);
this.Property(t => t.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
// Table & Column Mappings
this.ToTable("UserRole");
this.Property(t => t.UserRoleId).HasColumnName("UserRoleId");
this.Property(t => t.UserId).HasColumnName("UserId");
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,4 +1,5 @@
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using OpenAuth.Domain;
using OpenAuth.Repository.Models.Mapping;
@ -16,32 +17,34 @@ namespace OpenAuth.Repository.Models
{
}
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<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<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<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 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 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 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 UserCfgMap());
modelBuilder.Configurations.Add(new UserExtMap());
modelBuilder.Configurations.Add(new UserModuleMap());
modelBuilder.Configurations.Add(new UserOrgMap());
modelBuilder.Configurations.Add(new UserRoleMap());
}
}

View File

@ -9,8 +9,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenAuth.Repository</RootNamespace>
<AssemblyName>OpenAuth.Repository</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -20,6 +21,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -28,13 +30,14 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="EntityFramework">
<HintPath>..\packages\EntityFramework.6.1.3\lib\net40\EntityFramework.dll</HintPath>
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer">
<HintPath>..\packages\EntityFramework.6.1.3\lib\net40\EntityFramework.SqlServer.dll</HintPath>
<HintPath>..\packages\EntityFramework.6.1.3\lib\net45\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.DataAnnotations" />
@ -47,41 +50,45 @@
</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\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\RoleMenuButtonMap.cs" />
<Compile Include="Models\Mapping\RoleMenuMap.cs" />
<Compile Include="Models\Mapping\sysdiagramMap.cs" />
<Compile Include="Models\Mapping\UserDepartmentMap.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="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>
<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.

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

@ -7,7 +7,7 @@ using OpenAuth.Domain;
namespace OpenAuth.Repository
{
public class UserRepository :BaseRepository, IUserRepository
public class UserRepository :BaseRepository<User>, IUserRepository
{
public User FindByAccount(string account)
{
@ -16,7 +16,7 @@ namespace OpenAuth.Repository
public User FindById(string id)
{
return Context.Users.SingleOrDefault(u => u.UserId == id);
return FindSingle(u => u.Account == id);
}
public IEnumerable<User> LoadUsers()

View File

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

View File

@ -1,18 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<?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" />
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<connectionStrings configSource="DB.config"></connectionStrings>
<connectionStrings>
<add name="OpenAuthDBContext" connectionString="Data Source=.;Initial Catalog=OpenAuthDB;Persist Security Info=True;User ID=sa;Password=000000;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />
</connectionStrings>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<!--定义文件存放位置-->
<file value="log\\"/>
<appendToFile value="true"/>
<rollingStyle value="Date"/>
<datePattern value="yyyyMMdd'.txt'"/>
<staticLogFileName value="false"/>
<param name="MaxSizeRollBackups" value="100"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
<root>
<level value="INFO"/>
<!--文件形式记录日志-->
<appender-ref ref="RollingLogFileAppender"/>
</root>
</log4net>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="mssqllocaldb" />
<parameter value="mssqllocaldb"/>
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
</providers>
</entityFramework>
</configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>

View File

@ -8,7 +8,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>OpenAuth.UnitTest</RootNamespace>
<AssemblyName>OpenAuth.UnitTest</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
@ -16,6 +16,7 @@
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -25,6 +26,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -33,6 +35,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
@ -62,12 +65,17 @@
</Choose>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TestFunction.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj">
<Project>{5FEAEC9A-4F1E-4EE7-B377-9DB1B0870DAC}</Project>
<Name>Infrastructure</Name>
</ProjectReference>
<ProjectReference Include="..\OpenAuth.App\OpenAuth.App.csproj">
<Project>{0BBF2D65-FFFD-4272-B138-8EA4FB6FEC48}</Project>
<Name>OpenAuth.App</Name>

View File

@ -0,0 +1,68 @@
using System;
using System.Text;
using System.Collections.Generic;
using Infrastructure;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace OpenAuth.UnitTest
{
/// <summary>
/// TestFunction 的摘要说明
/// </summary>
[TestClass]
public class TestFunction
{
public TestFunction()
{
//
//TODO: 在此处添加构造函数逻辑
//
}
private TestContext testContextInstance;
/// <summary>
///获取或设置测试上下文,该上下文提供
///有关当前测试运行及其功能的信息。
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region
//
// 编写测试时,可以使用以下附加特性:
//
// 在运行类中的第一个测试之前使用 ClassInitialize 运行代码
// [ClassInitialize()]
// public static void MyClassInitialize(TestContext testContext) { }
//
// 在类中的所有测试都已运行之后使用 ClassCleanup 运行代码
// [ClassCleanup()]
// public static void MyClassCleanup() { }
//
// 在运行每个测试之前,使用 TestInitialize 来运行代码
// [TestInitialize()]
// public void MyTestInitialize() { }
//
// 在每个测试运行完之后,使用 TestCleanup 来运行代码
// [TestCleanup()]
// public void MyTestCleanup() { }
//
#endregion
[TestMethod]
public void TestMethod1()
{
LogHelper.Log("UnitTest" + DateTime.Now.ToLongTimeString());
}
}
}

View File

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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff