mirror of
http://git.coreshop.cn/jianweie/coreshoppro.git
synced 2025-12-06 16:23:26 +08:00
添加项目文件。
This commit is contained in:
237
CoreCms.Net.Core/AOP/CacheAopBase.cs
Normal file
237
CoreCms.Net.Core/AOP/CacheAopBase.cs
Normal file
@@ -0,0 +1,237 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms.Net *
|
||||
* Web: https://CoreCms.Net *
|
||||
* ProjectName: 核心内容管理系统 *
|
||||
* Author: 大灰灰 *
|
||||
* Email: JianWeie@163.com *
|
||||
* CreateTime: 2020-05-08 23:28:44
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
using Castle.DynamicProxy;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using CoreCms.Net.Utility.Helper;
|
||||
|
||||
namespace CoreCms.Net.Core.AOP
|
||||
{
|
||||
public abstract class CacheAopBase : IInterceptor
|
||||
{
|
||||
/// <summary>
|
||||
/// AOP的拦截方法
|
||||
/// </summary>
|
||||
/// <param name="invocation"></param>
|
||||
public abstract void Intercept(IInvocation invocation);
|
||||
|
||||
/// <summary>
|
||||
/// 自定义缓存的key
|
||||
/// </summary>
|
||||
/// <param name="invocation"></param>
|
||||
/// <returns></returns>
|
||||
protected string CustomCacheKey(IInvocation invocation)
|
||||
{
|
||||
var typeName = invocation.TargetType.Name;
|
||||
var methodName = invocation.Method.Name;
|
||||
var methodArguments = invocation.Arguments.Select(GetArgumentValue).Take(3).ToList();//获取参数列表,最多三个
|
||||
|
||||
string key = $"{typeName}:{methodName}:";
|
||||
foreach (var param in methodArguments)
|
||||
{
|
||||
key = $"{key}{param}:";
|
||||
}
|
||||
|
||||
return key.TrimEnd(':');
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// object 转 string
|
||||
/// </summary>
|
||||
/// <param name="arg"></param>
|
||||
/// <returns></returns>
|
||||
protected static string GetArgumentValue(object arg)
|
||||
{
|
||||
if (arg is DateTime)
|
||||
return ((DateTime)arg).ToString("yyyyMMddHHmmss");
|
||||
|
||||
if (arg is string || arg is ValueType)
|
||||
return arg.ToString();
|
||||
|
||||
if (arg != null)
|
||||
{
|
||||
if (arg is Expression)
|
||||
{
|
||||
var obj = arg as Expression;
|
||||
var result = Resolve(obj);
|
||||
return CommonHelper.Md5For16(result);
|
||||
}
|
||||
else if (arg.GetType().IsClass)
|
||||
{
|
||||
return CommonHelper.Md5For16(Newtonsoft.Json.JsonConvert.SerializeObject(arg));
|
||||
}
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
private static string Resolve(Expression expression)
|
||||
{
|
||||
if (expression is LambdaExpression)
|
||||
{
|
||||
LambdaExpression lambda = expression as LambdaExpression;
|
||||
expression = lambda.Body;
|
||||
return Resolve(expression);
|
||||
}
|
||||
if (expression is BinaryExpression)
|
||||
{
|
||||
BinaryExpression binary = expression as BinaryExpression;
|
||||
if (binary.Left is MemberExpression && binary.Right is ConstantExpression)//解析x=>x.Name=="123" x.Age==123这类
|
||||
return ResolveFunc(binary.Left, binary.Right, binary.NodeType);
|
||||
if (binary.Left is MethodCallExpression && binary.Right is ConstantExpression)//解析x=>x.Name.Contains("xxx")==false这类的
|
||||
{
|
||||
object value = (binary.Right as ConstantExpression).Value;
|
||||
return ResolveLinqToObject(binary.Left, value, binary.NodeType);
|
||||
}
|
||||
if ((binary.Left is MemberExpression && binary.Right is MemberExpression)
|
||||
|| (binary.Left is MemberExpression && binary.Right is UnaryExpression))//解析x=>x.Date==DateTime.Now这种
|
||||
{
|
||||
LambdaExpression lambda = Expression.Lambda(binary.Right);
|
||||
Delegate fn = lambda.Compile();
|
||||
ConstantExpression value = Expression.Constant(fn.DynamicInvoke(null), binary.Right.Type);
|
||||
return ResolveFunc(binary.Left, value, binary.NodeType);
|
||||
}
|
||||
}
|
||||
if (expression is UnaryExpression)
|
||||
{
|
||||
UnaryExpression unary = expression as UnaryExpression;
|
||||
if (unary.Operand is MethodCallExpression)//解析!x=>x.Name.Contains("xxx")或!array.Contains(x.Name)这类
|
||||
return ResolveLinqToObject(unary.Operand, false);
|
||||
if (unary.Operand is MemberExpression && unary.NodeType == ExpressionType.Not)//解析x=>!x.isDeletion这样的
|
||||
{
|
||||
ConstantExpression constant = Expression.Constant(false);
|
||||
return ResolveFunc(unary.Operand, constant, ExpressionType.Equal);
|
||||
}
|
||||
}
|
||||
if (expression is MemberExpression && expression.NodeType == ExpressionType.MemberAccess)//解析x=>x.isDeletion这样的
|
||||
{
|
||||
MemberExpression member = expression as MemberExpression;
|
||||
ConstantExpression constant = Expression.Constant(true);
|
||||
return ResolveFunc(member, constant, ExpressionType.Equal);
|
||||
}
|
||||
if (expression is MethodCallExpression)//x=>x.Name.Contains("xxx")或array.Contains(x.Name)这类
|
||||
{
|
||||
MethodCallExpression methodcall = expression as MethodCallExpression;
|
||||
return ResolveLinqToObject(methodcall, true);
|
||||
}
|
||||
var body = expression as BinaryExpression;
|
||||
//已经修改过代码body应该不会是null值了
|
||||
if (body == null)
|
||||
return string.Empty;
|
||||
var Operator = GetOperator(body.NodeType);
|
||||
var Left = Resolve(body.Left);
|
||||
var Right = Resolve(body.Right);
|
||||
string Result = string.Format("({0} {1} {2})", Left, Operator, Right);
|
||||
return Result;
|
||||
}
|
||||
|
||||
private static string GetOperator(ExpressionType expressiontype)
|
||||
{
|
||||
switch (expressiontype)
|
||||
{
|
||||
case ExpressionType.And:
|
||||
return "and";
|
||||
case ExpressionType.AndAlso:
|
||||
return "and";
|
||||
case ExpressionType.Or:
|
||||
return "or";
|
||||
case ExpressionType.OrElse:
|
||||
return "or";
|
||||
case ExpressionType.Equal:
|
||||
return "=";
|
||||
case ExpressionType.NotEqual:
|
||||
return "<>";
|
||||
case ExpressionType.LessThan:
|
||||
return "<";
|
||||
case ExpressionType.LessThanOrEqual:
|
||||
return "<=";
|
||||
case ExpressionType.GreaterThan:
|
||||
return ">";
|
||||
case ExpressionType.GreaterThanOrEqual:
|
||||
return ">=";
|
||||
default:
|
||||
throw new Exception(string.Format("不支持{0}此种运算符查找!" + expressiontype));
|
||||
}
|
||||
}
|
||||
|
||||
private static string ResolveFunc(Expression left, Expression right, ExpressionType expressiontype)
|
||||
{
|
||||
var Name = (left as MemberExpression).Member.Name;
|
||||
var Value = (right as ConstantExpression).Value;
|
||||
var Operator = GetOperator(expressiontype);
|
||||
return Name + Operator + Value ?? "null";
|
||||
}
|
||||
|
||||
private static string ResolveLinqToObject(Expression expression, object value, ExpressionType? expressiontype = null)
|
||||
{
|
||||
var MethodCall = expression as MethodCallExpression;
|
||||
var MethodName = MethodCall.Method.Name;
|
||||
switch (MethodName)
|
||||
{
|
||||
case "Contains":
|
||||
if (MethodCall.Object != null)
|
||||
return Like(MethodCall);
|
||||
return In(MethodCall, value);
|
||||
case "Count":
|
||||
return Len(MethodCall, value, expressiontype.Value);
|
||||
case "LongCount":
|
||||
return Len(MethodCall, value, expressiontype.Value);
|
||||
default:
|
||||
throw new Exception(string.Format("不支持{0}方法的查找!", MethodName));
|
||||
}
|
||||
}
|
||||
|
||||
private static string In(MethodCallExpression expression, object isTrue)
|
||||
{
|
||||
var Argument1 = (expression.Arguments[0] as MemberExpression).Expression as ConstantExpression;
|
||||
var Argument2 = expression.Arguments[1] as MemberExpression;
|
||||
var Field_Array = Argument1.Value.GetType().GetFields().First();
|
||||
object[] Array = Field_Array.GetValue(Argument1.Value) as object[];
|
||||
List<string> SetInPara = new List<string>();
|
||||
for (int i = 0; i < Array.Length; i++)
|
||||
{
|
||||
string Name_para = "InParameter" + i;
|
||||
string Value = Array[i].ToString();
|
||||
SetInPara.Add(Value);
|
||||
}
|
||||
string Name = Argument2.Member.Name;
|
||||
string Operator = Convert.ToBoolean(isTrue) ? "in" : " not in";
|
||||
string CompName = string.Join(",", SetInPara);
|
||||
string Result = string.Format("{0} {1} ({2})", Name, Operator, CompName);
|
||||
return Result;
|
||||
}
|
||||
private static string Like(MethodCallExpression expression)
|
||||
{
|
||||
|
||||
var Temp = expression.Arguments[0];
|
||||
LambdaExpression lambda = Expression.Lambda(Temp);
|
||||
Delegate fn = lambda.Compile();
|
||||
var tempValue = Expression.Constant(fn.DynamicInvoke(null), Temp.Type);
|
||||
string Value = string.Format("%{0}%", tempValue);
|
||||
string Name = (expression.Object as MemberExpression).Member.Name;
|
||||
string Result = string.Format("{0} like {1}", Name, Value);
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
private static string Len(MethodCallExpression expression, object value, ExpressionType expressiontype)
|
||||
{
|
||||
object Name = (expression.Arguments[0] as MemberExpression).Member.Name;
|
||||
string Operator = GetOperator(expressiontype);
|
||||
string Result = string.Format("len({0}){1}{2}", Name, Operator, value.ToString());
|
||||
return Result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
68
CoreCms.Net.Core/AOP/MemoryCacheAop.cs
Normal file
68
CoreCms.Net.Core/AOP/MemoryCacheAop.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms.Net *
|
||||
* Web: https://CoreCms.Net *
|
||||
* ProjectName: 核心内容管理系统 *
|
||||
* Author: 大灰灰 *
|
||||
* Email: JianWeie@163.com *
|
||||
* CreateTime: 2020-05-08 23:27:26
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Castle.DynamicProxy;
|
||||
using CoreCms.Net.Caching.AutoMate.MemoryCache;
|
||||
using CoreCms.Net.Core.Attribute;
|
||||
|
||||
namespace CoreCms.Net.Core.AOP
|
||||
{
|
||||
/// <summary>
|
||||
/// 面向切换的内存缓存使用
|
||||
/// </summary>
|
||||
public class MemoryCacheAop : CacheAopBase
|
||||
{
|
||||
//通过注入的方式,把缓存操作接口通过构造函数注入
|
||||
private readonly ICachingProvider _cache;
|
||||
public MemoryCacheAop(ICachingProvider cache)
|
||||
{
|
||||
_cache = cache;
|
||||
}
|
||||
|
||||
//Intercept方法是拦截的关键所在,也是IInterceptor接口中的唯一定义
|
||||
public override void Intercept(IInvocation invocation)
|
||||
{
|
||||
var method = invocation.MethodInvocationTarget ?? invocation.Method;
|
||||
//对当前方法的特性验证
|
||||
//如果需要验证
|
||||
var CachingAttribute = method.GetCustomAttributes(true).FirstOrDefault(x => x.GetType() == typeof(CachingAttribute));
|
||||
if (CachingAttribute is CachingAttribute qCachingAttribute)
|
||||
{
|
||||
//获取自定义缓存键
|
||||
var cacheKey = CustomCacheKey(invocation);
|
||||
//根据key获取相应的缓存值
|
||||
var cacheValue = _cache.Get(cacheKey);
|
||||
if (cacheValue != null)
|
||||
{
|
||||
//将当前获取到的缓存值,赋值给当前执行方法
|
||||
invocation.ReturnValue = cacheValue;
|
||||
return;
|
||||
}
|
||||
//去执行当前的方法
|
||||
invocation.Proceed();
|
||||
//存入缓存
|
||||
if (!string.IsNullOrWhiteSpace(cacheKey))
|
||||
{
|
||||
_cache.Set(cacheKey, invocation.ReturnValue, qCachingAttribute.AbsoluteExpiration);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
invocation.Proceed();//直接执行被拦截方法
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
91
CoreCms.Net.Core/AOP/RedisCacheAop.cs
Normal file
91
CoreCms.Net.Core/AOP/RedisCacheAop.cs
Normal file
@@ -0,0 +1,91 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms.Net *
|
||||
* Web: https://CoreCms.Net *
|
||||
* ProjectName: 核心内容管理系统 *
|
||||
* Author: 大灰灰 *
|
||||
* Email: JianWeie@163.com *
|
||||
* CreateTime: 2020-05-09 0:13:52
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Castle.DynamicProxy;
|
||||
using CoreCms.Net.Caching.AutoMate.RedisCache;
|
||||
using CoreCms.Net.Core.Attribute;
|
||||
|
||||
namespace CoreCms.Net.Core.AOP
|
||||
{
|
||||
/// <summary>
|
||||
/// 面向切面的Redis缓存使用
|
||||
/// </summary>
|
||||
public class RedisCacheAop : CacheAopBase
|
||||
{
|
||||
//通过注入的方式,把缓存操作接口通过构造函数注入
|
||||
private readonly IRedisOperationRepository _cache;
|
||||
public RedisCacheAop(IRedisOperationRepository cache)
|
||||
{
|
||||
_cache = cache;
|
||||
}
|
||||
|
||||
//Intercept方法是拦截的关键所在,也是IInterceptor接口中的唯一定义
|
||||
public override void Intercept(IInvocation invocation)
|
||||
{
|
||||
var method = invocation.MethodInvocationTarget ?? invocation.Method;
|
||||
if (method.ReturnType == typeof(void) || method.ReturnType == typeof(Task))
|
||||
{
|
||||
invocation.Proceed();
|
||||
return;
|
||||
}
|
||||
//对当前方法的特性验证
|
||||
if (method.GetCustomAttributes(true).FirstOrDefault(x => x.GetType() == typeof(CachingAttribute)) is CachingAttribute qCachingAttribute)
|
||||
{
|
||||
//获取自定义缓存键
|
||||
var cacheKey = CustomCacheKey(invocation);
|
||||
//注意是 string 类型,方法GetValue
|
||||
var cacheValue = _cache.Get(cacheKey).Result;
|
||||
if (cacheValue != null)
|
||||
{
|
||||
//将当前获取到的缓存值,赋值给当前执行方法
|
||||
var returnType = typeof(Task).IsAssignableFrom(method.ReturnType) ? method.ReturnType.GenericTypeArguments.FirstOrDefault() : method.ReturnType;
|
||||
|
||||
dynamic result = Newtonsoft.Json.JsonConvert.DeserializeObject(cacheValue, returnType);
|
||||
invocation.ReturnValue = (typeof(Task).IsAssignableFrom(method.ReturnType)) ? Task.FromResult(result) : result;
|
||||
return;
|
||||
}
|
||||
//去执行当前的方法
|
||||
invocation.Proceed();
|
||||
|
||||
//存入缓存
|
||||
if (!string.IsNullOrWhiteSpace(cacheKey))
|
||||
{
|
||||
object response;
|
||||
|
||||
//Type type = invocation.ReturnValue?.GetType();
|
||||
var type = invocation.Method.ReturnType;
|
||||
if (typeof(Task).IsAssignableFrom(type))
|
||||
{
|
||||
var resultProperty = type.GetProperty("Result");
|
||||
response = resultProperty.GetValue(invocation.ReturnValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
response = invocation.ReturnValue;
|
||||
}
|
||||
response ??= string.Empty;
|
||||
|
||||
_cache.Set(cacheKey, response, TimeSpan.FromMinutes(qCachingAttribute.AbsoluteExpiration)).Wait();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
invocation.Proceed();//直接执行被拦截方法
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
30
CoreCms.Net.Core/Attribute/CachingAttribute.cs
Normal file
30
CoreCms.Net.Core/Attribute/CachingAttribute.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms.Net *
|
||||
* Web: https://CoreCms.Net *
|
||||
* ProjectName: 核心内容管理系统 *
|
||||
* Author: 大灰灰 *
|
||||
* Email: JianWeie@163.com *
|
||||
* CreateTime: 2020-05-08 23:54:42
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CoreCms.Net.Core.Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// 这个Attribute就是使用时候的验证,把它添加到要缓存数据的方法中,即可完成缓存的操作。
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Method, Inherited = true)]
|
||||
public class CachingAttribute : System.Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// 缓存绝对过期时间(分钟)
|
||||
/// </summary>
|
||||
public int AbsoluteExpiration { get; set; } = 30;
|
||||
|
||||
}
|
||||
}
|
||||
26
CoreCms.Net.Core/Attribute/UseTranAttribute.cs
Normal file
26
CoreCms.Net.Core/Attribute/UseTranAttribute.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms.Net *
|
||||
* Web: https://CoreCms.Net *
|
||||
* ProjectName: 核心内容管理系统 *
|
||||
* Author: 大灰灰 *
|
||||
* Email: JianWeie@163.com *
|
||||
* CreateTime: 2020-05-08 23:55:07
|
||||
* Description: 暂无
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace CoreCms.Net.Core.Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// 这个Attribute就是使用时候的验证,把它添加到需要执行事务的方法中,即可完成事务的操作。
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Method, Inherited = true)]
|
||||
public class UseTranAttribute : System.Attribute
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
82
CoreCms.Net.Core/AutoFac/AutofacModuleRegister.cs
Normal file
82
CoreCms.Net.Core/AutoFac/AutofacModuleRegister.cs
Normal file
@@ -0,0 +1,82 @@
|
||||
using Autofac;
|
||||
using Autofac.Extras.DynamicProxy;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.Core.AOP;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NLog;
|
||||
|
||||
namespace CoreCms.Net.Core.AutoFac
|
||||
{
|
||||
public class AutofacModuleRegister : Autofac.Module
|
||||
{
|
||||
protected override void Load(ContainerBuilder builder)
|
||||
{
|
||||
var basePath = AppContext.BaseDirectory;
|
||||
|
||||
#region 带有接口层的服务注入
|
||||
|
||||
var servicesDllFile = Path.Combine(basePath, "CoreCms.Net.Services.dll");
|
||||
var repositoryDllFile = Path.Combine(basePath, "CoreCms.Net.Repository.dll");
|
||||
|
||||
if (!(File.Exists(servicesDllFile) && File.Exists(repositoryDllFile)))
|
||||
{
|
||||
var msg = "Repository.dll和Services.dll 丢失,因为项目解耦了,所以需要先F6编译,再F5运行,请检查 bin 文件夹,并拷贝。";
|
||||
throw new Exception(msg);
|
||||
}
|
||||
|
||||
// AOP 开关,如果想要打开指定的功能,只需要在 appsettigns.json 对应对应 true 就行。
|
||||
//var cacheType = new List<Type>();
|
||||
//if (AppSettingsConstVars.RedisConfigEnabled)
|
||||
//{
|
||||
// builder.RegisterType<RedisCacheAop>();
|
||||
// cacheType.Add(typeof(RedisCacheAop));
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// builder.RegisterType<MemoryCacheAop>();
|
||||
// cacheType.Add(typeof(MemoryCacheAop));
|
||||
//}
|
||||
|
||||
// 获取 Service.dll 程序集服务,并注册
|
||||
var assemblysServices = Assembly.LoadFrom(servicesDllFile);
|
||||
//支持属性注入依赖重复
|
||||
builder.RegisterAssemblyTypes(assemblysServices).AsImplementedInterfaces().InstancePerDependency()
|
||||
.PropertiesAutowired(PropertyWiringOptions.AllowCircularDependencies);
|
||||
|
||||
// 获取 Repository.dll 程序集服务,并注册
|
||||
var assemblysRepository = Assembly.LoadFrom(repositoryDllFile);
|
||||
//支持属性注入依赖重复
|
||||
builder.RegisterAssemblyTypes(assemblysRepository).AsImplementedInterfaces().InstancePerDependency()
|
||||
.PropertiesAutowired(PropertyWiringOptions.AllowCircularDependencies);
|
||||
|
||||
|
||||
// 获取 Service.dll 程序集服务,并注册
|
||||
//var assemblysServices = Assembly.LoadFrom(servicesDllFile);
|
||||
//builder.RegisterAssemblyTypes(assemblysServices)
|
||||
// .AsImplementedInterfaces()
|
||||
// .InstancePerDependency()
|
||||
// .PropertiesAutowired()
|
||||
// .EnableInterfaceInterceptors()//引用Autofac.Extras.DynamicProxy;
|
||||
// .InterceptedBy(cacheType.ToArray());//允许将拦截器服务的列表分配给注册。
|
||||
|
||||
//// 获取 Repository.dll 程序集服务,并注册
|
||||
//var assemblysRepository = Assembly.LoadFrom(repositoryDllFile);
|
||||
//builder.RegisterAssemblyTypes(assemblysRepository)
|
||||
// .AsImplementedInterfaces()
|
||||
// .PropertiesAutowired()
|
||||
// .InstancePerDependency();
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
56
CoreCms.Net.Core/Config/CorsSetup.cs
Normal file
56
CoreCms.Net.Core/Config/CorsSetup.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms.Net *
|
||||
* Web: https://CoreCms.Net *
|
||||
* ProjectName: 核心内容管理系统 *
|
||||
* Author: 大灰灰 *
|
||||
* Email: JianWeie@163.com *
|
||||
* Versions: 1.0 *
|
||||
* CreateTime: 2020-02-03 22:49:41
|
||||
* NameSpace: CoreCms.Net.Framework
|
||||
* FileName: Cors
|
||||
* ClassDescription:
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
using System;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace CoreCms.Net.Core.Config
|
||||
{
|
||||
/// <summary>
|
||||
/// 配置跨域(CORS)
|
||||
/// </summary>
|
||||
public static class CorsSetup
|
||||
{
|
||||
public static void AddCorsSetup(this IServiceCollection services)
|
||||
{
|
||||
if (services == null) throw new ArgumentNullException(nameof(services));
|
||||
services.AddCors(c =>
|
||||
{
|
||||
if (!AppSettingsConstVars.CorsEnableAllIPs)
|
||||
{
|
||||
c.AddPolicy(AppSettingsConstVars.CorsPolicyName, policy =>
|
||||
{
|
||||
policy.WithOrigins(AppSettingsConstVars.CorsIPs.Split(','));
|
||||
policy.AllowAnyHeader();//Ensures that the policy allows any header.
|
||||
policy.AllowAnyMethod();
|
||||
policy.AllowCredentials();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
//允许任意跨域请求
|
||||
c.AddPolicy(AppSettingsConstVars.CorsPolicyName, policy =>
|
||||
{
|
||||
policy.SetIsOriginAllowed((host) => true)
|
||||
.AllowAnyMethod()
|
||||
.AllowAnyHeader()
|
||||
.AllowCredentials();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
73
CoreCms.Net.Core/Config/HangFireSetup.cs
Normal file
73
CoreCms.Net.Core/Config/HangFireSetup.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms.Net *
|
||||
* Web: https://CoreCms.Net *
|
||||
* ProjectName: 核心内容管理系统 *
|
||||
* Author: 大灰灰 *
|
||||
* Email: JianWeie@163.com *
|
||||
* Versions: 1.0 *
|
||||
* CreateTime: 2020-02-03 22:49:41
|
||||
* ClassDescription:
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
using System;
|
||||
using System.Transactions;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using Hangfire;
|
||||
using Hangfire.MySql;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
|
||||
namespace CoreCms.Net.Core.Config
|
||||
{
|
||||
/// <summary>
|
||||
/// 增加HangFire到单独配置
|
||||
/// </summary>
|
||||
public static class HangFireSetup
|
||||
{
|
||||
public static void AddHangFireSetup(this IServiceCollection services)
|
||||
{
|
||||
if (services == null) throw new ArgumentNullException(nameof(services));
|
||||
|
||||
//注册Hangfire定时任务
|
||||
var isEnabledRedis = AppSettingsConstVars.RedisUseTimedTask;
|
||||
if (isEnabledRedis)
|
||||
{
|
||||
services.AddHangfire(x => x.UseRedisStorage(AppSettingsConstVars.RedisConfigConnectionString));
|
||||
}
|
||||
else
|
||||
{
|
||||
string dbTypeString = AppSettingsConstVars.DbDbType;
|
||||
if (dbTypeString == DbType.MySql.ToString())
|
||||
{
|
||||
services.AddHangfire(x => x.UseStorage(new MySqlStorage(AppSettingsConstVars.DbSqlConnection, new MySqlStorageOptions
|
||||
{
|
||||
TransactionIsolationLevel = IsolationLevel.ReadCommitted, // 事务隔离级别。默认是读取已提交。
|
||||
QueuePollInterval = TimeSpan.FromSeconds(15), //- 作业队列轮询间隔。默认值为15秒。
|
||||
JobExpirationCheckInterval = TimeSpan.FromHours(1), //- 作业到期检查间隔(管理过期记录)。默认值为1小时。
|
||||
CountersAggregateInterval = TimeSpan.FromMinutes(5), //- 聚合计数器的间隔。默认为5分钟。
|
||||
PrepareSchemaIfNecessary = true, //- 如果设置为true,则创建数据库表。默认是true。
|
||||
DashboardJobListLimit = 50000, //- 仪表板作业列表限制。默认值为50000。
|
||||
TransactionTimeout = TimeSpan.FromMinutes(1), //- 交易超时。默认为1分钟。
|
||||
TablesPrefix = "Hangfire" //- 数据库中表的前缀。默认为none
|
||||
})));
|
||||
}
|
||||
else if (dbTypeString == DbType.SqlServer.ToString())
|
||||
{
|
||||
services.AddHangfire(x => x.UseSqlServerStorage(AppSettingsConstVars.DbSqlConnection));
|
||||
}
|
||||
}
|
||||
|
||||
services.AddHangfireServer(options =>
|
||||
{
|
||||
options.Queues = new[] { GlobalEnumVars.HangFireQueuesConfig.@default.ToString(), GlobalEnumVars.HangFireQueuesConfig.apis.ToString(), GlobalEnumVars.HangFireQueuesConfig.web.ToString(), GlobalEnumVars.HangFireQueuesConfig.recurring.ToString() };
|
||||
options.ServerTimeout = TimeSpan.FromMinutes(4);
|
||||
options.SchedulePollingInterval = TimeSpan.FromSeconds(15);//秒级任务需要配置短点,一般任务可以配置默认时间,默认15秒
|
||||
options.ShutdownTimeout = TimeSpan.FromMinutes(30); //超时时间
|
||||
options.WorkerCount = Math.Max(Environment.ProcessorCount, 20); //工作线程数,当前允许的最大线程,默认20
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
29
CoreCms.Net.Core/Config/MemoryCacheSetup.cs
Normal file
29
CoreCms.Net.Core/Config/MemoryCacheSetup.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Caching.AutoMate.MemoryCache;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace CoreCms.Net.Core.Config
|
||||
{
|
||||
/// <summary>
|
||||
/// Memory缓存 启动服务
|
||||
/// </summary>
|
||||
public static class MemoryCacheSetup
|
||||
{
|
||||
public static void AddMemoryCacheSetup(this IServiceCollection services)
|
||||
{
|
||||
if (services == null) throw new ArgumentNullException(nameof(services));
|
||||
|
||||
services.AddScoped<ICachingProvider, MemoryCaching>();
|
||||
services.AddSingleton<IMemoryCache>(factory =>
|
||||
{
|
||||
var cache = new MemoryCache(new MemoryCacheOptions());
|
||||
return cache;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
39
CoreCms.Net.Core/Config/RedisCacheSetup.cs
Normal file
39
CoreCms.Net.Core/Config/RedisCacheSetup.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Caching.AutoMate.RedisCache;
|
||||
using CoreCms.Net.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using StackExchange.Redis;
|
||||
|
||||
namespace CoreCms.Net.Core.Config
|
||||
{
|
||||
/// <summary>
|
||||
/// Redis缓存 启动服务
|
||||
/// </summary>
|
||||
public static class RedisCacheSetup
|
||||
{
|
||||
public static void AddRedisCacheSetup(this IServiceCollection services)
|
||||
{
|
||||
if (services == null) throw new ArgumentNullException(nameof(services));
|
||||
|
||||
services.AddTransient<IRedisOperationRepository, RedisOperationRepository>();
|
||||
|
||||
// 配置启动Redis服务,虽然可能影响项目启动速度,但是不能在运行的时候报错,所以是合理的
|
||||
services.AddSingleton<ConnectionMultiplexer>(sp =>
|
||||
{
|
||||
//获取连接字符串
|
||||
string redisConfiguration = AppSettingsConstVars.RedisConfigConnectionString;
|
||||
|
||||
var configuration = ConfigurationOptions.Parse(redisConfiguration, true);
|
||||
|
||||
configuration.ResolveDns = true;
|
||||
|
||||
return ConnectionMultiplexer.Connect(configuration);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
48
CoreCms.Net.Core/Config/RedisMessageQueueSetup.cs
Normal file
48
CoreCms.Net.Core/Config/RedisMessageQueueSetup.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.RedisMQ.Subscribe;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using InitQ;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace CoreCms.Net.Core.Config
|
||||
{
|
||||
/// <summary>
|
||||
/// Redis 消息队列 启动服务
|
||||
/// </summary>
|
||||
public static class RedisMessageQueueSetup
|
||||
{
|
||||
public static void AddRedisMessageQueueSetup(this IServiceCollection services)
|
||||
{
|
||||
if (services == null) throw new ArgumentNullException(nameof(services));
|
||||
|
||||
services.AddInitQ(m =>
|
||||
{
|
||||
//时间间隔
|
||||
m.SuspendTime = 1000;
|
||||
//redis服务器地址
|
||||
m.ConnectionString = AppSettingsConstVars.RedisConfigConnectionString;
|
||||
//对应的订阅者类,需要new一个实例对象,当然你也可以传参,比如日志对象
|
||||
m.ListSubscribe = new List<Type>() {
|
||||
typeof(OrderAgentOrDistributionSubscribe),
|
||||
typeof(OrderAutomaticDeliverySubscribe),
|
||||
typeof(OrderFinishCommandSubscribe),
|
||||
typeof(OrderPrintSubscribe),
|
||||
|
||||
typeof(LogingSubscribe),
|
||||
|
||||
typeof(UserSubscribe),
|
||||
typeof(WeChatPayNoticeSubscribe),
|
||||
typeof(SendWxTemplateMessageSubscribe),
|
||||
typeof(AfterSalesReviewSubscribe),
|
||||
};
|
||||
//显示日志
|
||||
m.ShowLog = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
95
CoreCms.Net.Core/Config/SqlSugarSetup.cs
Normal file
95
CoreCms.Net.Core/Config/SqlSugarSetup.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms.Net *
|
||||
* Web: https://CoreCms.Net *
|
||||
* ProjectName: 核心内容管理系统 *
|
||||
* Author: 大灰灰 *
|
||||
* Email: JianWeie@163.com *
|
||||
* Versions: 1.0 *
|
||||
* CreateTime: 2020-02-03 22:45:34
|
||||
* FileName: SqlSugarSetup
|
||||
* ClassDescription:
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
using System;
|
||||
using CoreCms.Net.Caching.SqlSugar;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.Loging;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
|
||||
namespace CoreCms.Net.Core.Config
|
||||
{
|
||||
/// <summary>
|
||||
/// SqlSugar 启动服务
|
||||
/// </summary>
|
||||
public static class SqlSugarSetup
|
||||
{
|
||||
public static void AddSqlSugarSetup(this IServiceCollection services)
|
||||
{
|
||||
if (services == null) throw new ArgumentNullException(nameof(services));
|
||||
string connectionString = AppSettingsConstVars.DbSqlConnection;
|
||||
string dbTypeString = AppSettingsConstVars.DbDbType;
|
||||
|
||||
//获取数据类型
|
||||
var dbType = dbTypeString == DbType.MySql.ToString() ? DbType.MySql : DbType.SqlServer;
|
||||
//判断是否开启redis设置二级缓存方式
|
||||
ICacheService myCache = AppSettingsConstVars.RedisUseCache
|
||||
? (ICacheService)new SqlSugarRedisCache()
|
||||
: new SqlSugarMemoryCache();
|
||||
|
||||
var connectionConfig = new ConnectionConfig()
|
||||
{
|
||||
ConnectionString = connectionString, //必填
|
||||
DbType = dbType, //必填
|
||||
IsAutoCloseConnection = false,
|
||||
InitKeyType = InitKeyType.Attribute,
|
||||
|
||||
ConfigureExternalServices = new ConfigureExternalServices()
|
||||
{
|
||||
DataInfoCacheService = myCache
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
services.AddScoped<ISqlSugarClient>(o =>
|
||||
{
|
||||
|
||||
var db = new SqlSugarClient(connectionConfig); //默认SystemTable
|
||||
|
||||
//日志处理
|
||||
////SQL执行前 可以修改SQL
|
||||
//db.Aop.OnLogExecuting = (sql, pars) =>
|
||||
//{
|
||||
// //获取sql
|
||||
// Console.WriteLine(sql + "\r\n" + db.Utilities.SerializeObject(pars.ToDictionary(it => it.ParameterName, it => it.Value)));
|
||||
// Console.WriteLine();
|
||||
|
||||
// //通过TempItems这个变量来算出这个SQL执行时间(1)
|
||||
// if (db.TempItems == null) db.TempItems = new Dictionary<string, object>();
|
||||
// db.TempItems.Add("logTime", DateTime.Now);
|
||||
// //通过TempItems这个变量来算出这个SQL执行时间(2)
|
||||
// var startingTime = db.TempItems["logTime"];
|
||||
// db.TempItems.Remove("time");
|
||||
// var completedTime = DateTime.Now;
|
||||
|
||||
|
||||
//};
|
||||
//db.Aop.OnLogExecuted = (sql, pars) => //SQL执行完事件
|
||||
//{
|
||||
|
||||
//};
|
||||
//db.Aop.OnLogExecuting = (sql, pars) => //SQL执行前事件
|
||||
//{
|
||||
|
||||
//};
|
||||
db.Aop.OnError = (exp) =>//执行SQL 错误事件
|
||||
{
|
||||
NLogUtil.WriteFileLog(NLog.LogLevel.Error, LogType.Other, "SqlSugar", "执行SQL错误事件", exp);
|
||||
};
|
||||
return db;
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
132
CoreCms.Net.Core/Config/SwaggerSetup.cs
Normal file
132
CoreCms.Net.Core/Config/SwaggerSetup.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
/***********************************************************************
|
||||
* Project: CoreCms.Net *
|
||||
* Web: https://CoreCms.Net *
|
||||
* ProjectName: 核心内容管理系统 *
|
||||
* Author: 大灰灰 *
|
||||
* Email: JianWeie@163.com *
|
||||
* Versions: 1.0 *
|
||||
* CreateTime: 2020-02-02 18:41:38
|
||||
* FileName: SwaggerSetup
|
||||
* ClassDescription:
|
||||
***********************************************************************/
|
||||
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using CoreCms.Net.Loging;
|
||||
using CoreCms.Net.Swagger;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Swashbuckle.AspNetCore.Filters;
|
||||
|
||||
namespace CoreCms.Net.Core.Config
|
||||
{
|
||||
public static class SwaggerSetup
|
||||
{
|
||||
|
||||
public static void AddAdminSwaggerSetup(this IServiceCollection services)
|
||||
{
|
||||
if (services == null) throw new ArgumentNullException(nameof(services));
|
||||
var apiName = "核心商城系统管理端";
|
||||
|
||||
services.AddSwaggerGen((s) =>
|
||||
{
|
||||
//遍历出全部的版本,做文档信息展示
|
||||
typeof(CustomApiVersion.ApiVersions).GetEnumNames().ToList().ForEach(version =>
|
||||
{
|
||||
s.SwaggerDoc(version, new OpenApiInfo
|
||||
{
|
||||
Version = version,
|
||||
Title = $"{apiName} 接口文档",
|
||||
Description = $"{apiName} HTTP API " + version,
|
||||
Contact = new OpenApiContact { Name = apiName, Email = "JianWeie@163.com", Url = new Uri("https://CoreCms.Net") },
|
||||
});
|
||||
s.OrderActionsBy(o => o.RelativePath);
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
//生成API XML文档
|
||||
var basePath = AppContext.BaseDirectory;
|
||||
var xmlPath = Path.Combine(basePath, "doc.xml");
|
||||
s.IncludeXmlComments(xmlPath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
NLogUtil.WriteFileLog(NLog.LogLevel.Error, LogType.Swagger, "Swagger", "Swagger生成失败,Doc.xml丢失,请检查并拷贝。", ex);
|
||||
}
|
||||
|
||||
// 开启加权小锁
|
||||
s.OperationFilter<AddResponseHeadersFilter>();
|
||||
s.OperationFilter<AppendAuthorizeToSummaryOperationFilter>();
|
||||
|
||||
// 在header中添加token,传递到后台
|
||||
s.OperationFilter<SecurityRequirementsOperationFilter>();
|
||||
|
||||
// 必须是 oauth2
|
||||
s.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
|
||||
{
|
||||
Description = "JWT授权(数据将在请求头中进行传输) 直接在下框中输入Bearer {token}(注意两者之间是一个空格)\"",
|
||||
Name = "Authorization",//jwt默认的参数名称
|
||||
In = ParameterLocation.Header,//jwt默认存放Authorization信息的位置(请求头中)
|
||||
Type = SecuritySchemeType.ApiKey
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public static void AddClientSwaggerSetup(this IServiceCollection services)
|
||||
{
|
||||
if (services == null) throw new ArgumentNullException(nameof(services));
|
||||
var apiName = "核心商城系统接口端";
|
||||
|
||||
services.AddSwaggerGen((s) =>
|
||||
{
|
||||
//遍历出全部的版本,做文档信息展示
|
||||
typeof(CustomApiVersion.ApiVersions).GetEnumNames().ToList().ForEach(version =>
|
||||
{
|
||||
s.SwaggerDoc(version, new OpenApiInfo
|
||||
{
|
||||
Version = version,
|
||||
Title = $"{apiName} 接口文档",
|
||||
Description = $"{apiName} HTTP API " + version,
|
||||
Contact = new OpenApiContact { Name = apiName, Email = "JianWeie@163.com", Url = new Uri("https://CoreCms.Net") },
|
||||
});
|
||||
s.OrderActionsBy(o => o.RelativePath);
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
//生成API XML文档
|
||||
var basePath = AppContext.BaseDirectory;
|
||||
var xmlPath = Path.Combine(basePath, "doc.xml");
|
||||
s.IncludeXmlComments(xmlPath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
NLogUtil.WriteFileLog(NLog.LogLevel.Error, LogType.Swagger, "Swagger", "Swagger生成失败,Doc.xml丢失,请检查并拷贝。", ex);
|
||||
}
|
||||
|
||||
// 开启加权小锁
|
||||
s.OperationFilter<AddResponseHeadersFilter>();
|
||||
s.OperationFilter<AppendAuthorizeToSummaryOperationFilter>();
|
||||
|
||||
// 在header中添加token,传递到后台
|
||||
s.OperationFilter<SecurityRequirementsOperationFilter>();
|
||||
|
||||
// 必须是 oauth2
|
||||
s.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
|
||||
{
|
||||
Description = "JWT授权(数据将在请求头中进行传输) 直接在下框中输入Bearer {token}(注意两者之间是一个空格)\"",
|
||||
Name = "Authorization",//jwt默认的参数名称
|
||||
In = ParameterLocation.Header,//jwt默认存放Authorization信息的位置(请求头中)
|
||||
Type = SecuritySchemeType.ApiKey
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
34
CoreCms.Net.Core/Config/YiLianYunSetup.cs
Normal file
34
CoreCms.Net.Core/Config/YiLianYunSetup.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CoreCms.Net.Configuration;
|
||||
using CoreCms.Net.RedisMQ.Subscribe;
|
||||
using CoreCms.Net.Utility.Extensions;
|
||||
using InitQ;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Qc.YilianyunSdk;
|
||||
|
||||
namespace CoreCms.Net.Core.Config
|
||||
{
|
||||
/// <summary>
|
||||
/// 易联云打印机 启动服务
|
||||
/// </summary>
|
||||
public static class YiLianYunSetup
|
||||
{
|
||||
public static void AddYiLianYunSetup(this IServiceCollection services)
|
||||
{
|
||||
if (services == null) throw new ArgumentNullException(nameof(services));
|
||||
|
||||
services.AddYilianyunSdk<DefaultYilianyunSdkHook>(opt =>
|
||||
{
|
||||
// 应用ID请自行前往 dev.10ss.net 获取
|
||||
opt.ClientId = AppSettingsConstVars.YiLianYunConfigClientId;
|
||||
opt.ClientSecret = AppSettingsConstVars.YiLianYunConfigClientSecret;
|
||||
opt.YilianyunClientType = YilianyunClientType.自有应用;
|
||||
opt.SaveTokenDirPath = "./App_Data/YiLianYunLogs";
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
41
CoreCms.Net.Core/CoreCms.Net.Core.csproj
Normal file
41
CoreCms.Net.Core/CoreCms.Net.Core.csproj
Normal file
@@ -0,0 +1,41 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Sms\**" />
|
||||
<EmbeddedResource Remove="Sms\**" />
|
||||
<None Remove="Sms\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
|
||||
<PackageReference Include="Autofac.Extras.DynamicProxy" Version="6.0.0" />
|
||||
<PackageReference Include="Castle.Core" Version="4.4.1" />
|
||||
<PackageReference Include="Hangfire" Version="1.7.25" />
|
||||
<PackageReference Include="Hangfire.AspNetCore" Version="1.7.25" />
|
||||
<PackageReference Include="Hangfire.Core" Version="1.7.25" />
|
||||
<PackageReference Include="Hangfire.Dashboard.BasicAuthorization" Version="1.0.2" />
|
||||
<PackageReference Include="Hangfire.MySqlStorage" Version="2.0.3" />
|
||||
<PackageReference Include="Hangfire.Redis.StackExchange" Version="1.8.4" />
|
||||
<PackageReference Include="InitQ" Version="1.0.0.7" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="5.0.2" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.OpenApi" Version="1.2.3" />
|
||||
<PackageReference Include="Qc.YilianyunSdk" Version="1.0.7" />
|
||||
<PackageReference Include="sqlSugarCore" Version="5.0.4.2" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Filters" Version="7.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CoreCms.Net.Caching\CoreCms.Net.Caching.csproj" />
|
||||
<ProjectReference Include="..\CoreCms.Net.Configuration\CoreCms.Net.Configuration.csproj" />
|
||||
<ProjectReference Include="..\CoreCms.Net.IRepository\CoreCms.Net.IRepository.csproj" />
|
||||
<ProjectReference Include="..\CoreCms.Net.Loging\CoreCms.Net.Loging.csproj" />
|
||||
<ProjectReference Include="..\CoreCms.Net.RedisMQ\CoreCms.Net.RedisMQ.csproj" />
|
||||
<ProjectReference Include="..\CoreCms.Net.Swagger\CoreCms.Net.Swagger.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Reference in New Issue
Block a user