diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1ff0c423..00000000 --- a/.gitattributes +++ /dev/null @@ -1,63 +0,0 @@ -############################################################################### -# Set default behavior to automatically normalize line endings. -############################################################################### -* text=auto - -############################################################################### -# Set default behavior for command prompt diff. -# -# This is need for earlier builds of msysgit that does not have it on by -# default for csharp files. -# Note: This is only used by command line -############################################################################### -#*.cs diff=csharp - -############################################################################### -# Set the merge driver for project and solution files -# -# Merging from the command prompt will add diff markers to the files if there -# are conflicts (Merging from VS is not affected by the settings below, in VS -# the diff markers are never inserted). Diff markers may cause the following -# file extensions to fail to load in VS. An alternative would be to treat -# these files as binary and thus will always conflict and require user -# intervention with every merge. To do so, just uncomment the entries below -############################################################################### -#*.sln merge=binary -#*.csproj merge=binary -#*.vbproj merge=binary -#*.vcxproj merge=binary -#*.vcproj merge=binary -#*.dbproj merge=binary -#*.fsproj merge=binary -#*.lsproj merge=binary -#*.wixproj merge=binary -#*.modelproj merge=binary -#*.sqlproj merge=binary -#*.wwaproj merge=binary - -############################################################################### -# behavior for image files -# -# image files are treated as binary by default. -############################################################################### -#*.jpg binary -#*.png binary -#*.gif binary - -############################################################################### -# diff behavior for common document formats -# -# Convert binary document formats to text before diffing them. This feature -# is only available from the command line. Turn it on by uncommenting the -# entries below. -############################################################################### -#*.doc diff=astextplain -#*.DOC diff=astextplain -#*.docx diff=astextplain -#*.DOCX diff=astextplain -#*.dot diff=astextplain -#*.DOT diff=astextplain -#*.pdf diff=astextplain -#*.PDF diff=astextplain -#*.rtf diff=astextplain -#*.RTF diff=astextplain diff --git a/WebFirst/database/sqlite.db b/WebFirst/database/sqlite.db deleted file mode 100644 index eec321e3..00000000 Binary files a/WebFirst/database/sqlite.db and /dev/null differ diff --git a/Yi.Framework.Net6/Yi.Framework.Uow/IUnitOfWork.cs b/Yi.Framework.Net6/Yi.Framework.Uow/IUnitOfWork.cs deleted file mode 100644 index b98951b2..00000000 --- a/Yi.Framework.Net6/Yi.Framework.Uow/IUnitOfWork.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Data; - -namespace Yi.Framework.Uow -{ - public interface IUnitOfWork : IDisposable - { - public void Init(bool isTransactional, IsolationLevel? isolationLevel, int? timeout); - public void BeginTran(); - - public void CommitTran(); - public void RollbackTran(); - } -} \ No newline at end of file diff --git a/Yi.Framework.Net6/Yi.Framework.Uow/Interceptors/UnitOfWorkAttribute.cs b/Yi.Framework.Net6/Yi.Framework.Uow/Interceptors/UnitOfWorkAttribute.cs deleted file mode 100644 index 3d681c2d..00000000 --- a/Yi.Framework.Net6/Yi.Framework.Uow/Interceptors/UnitOfWorkAttribute.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Uow.Interceptors -{ - public class UnitOfWorkAttribute : Attribute// : AbstractInterceptorAttribute - { - public UnitOfWorkAttribute(bool isTransactional = true) - { - IsTransactional = isTransactional; - } - public UnitOfWorkAttribute(IsolationLevel isolationLevel, bool isTransactional = true) : this(isTransactional) - { - IsolationLevel = isolationLevel; - } - public UnitOfWorkAttribute(IsolationLevel isolationLevel, int timeout, bool isTransactional = true) : this(isolationLevel, isTransactional) - { - Timeout = timeout; - } - - public bool IsTransactional { get; } - - public IsolationLevel? IsolationLevel { get; } - - /// - /// Milliseconds - /// - public int? Timeout { get; } - public bool IsDisabled { get; } - - - //public override Task Invoke(AspectContext context, AspectDelegate next) - //{ - // if (IsTransactional) - // { - // ServiceLocator.in.getservice() - // } - //} - } -} diff --git a/Yi.Framework.Net6/Yi.Framework.Uow/Interceptors/UnitOfWorkInterceptor.cs b/Yi.Framework.Net6/Yi.Framework.Uow/Interceptors/UnitOfWorkInterceptor.cs deleted file mode 100644 index 912d2d10..00000000 --- a/Yi.Framework.Net6/Yi.Framework.Uow/Interceptors/UnitOfWorkInterceptor.cs +++ /dev/null @@ -1,78 +0,0 @@ -using Castle.DynamicProxy; -using Nest; -using System; -using System.Collections.Generic; -using System.Diagnostics.CodeAnalysis; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Uow.Interceptors -{ - public class UnitOfWorkInterceptor : IInterceptor - { - private readonly IUnitOfWork _unitOfWork; - public UnitOfWorkInterceptor(IUnitOfWork unitOfWork) - { - _unitOfWork = unitOfWork; - } - - public void Intercept(IInvocation invocation) - { - if (!IsUnitOfWorkMethod(invocation.Method, out var uowAttr)) - { - invocation.Proceed(); - return; - } - - try - { - _unitOfWork.BeginTran(); - //执行被拦截的方法 - invocation.Proceed(); - _unitOfWork.CommitTran(); - } - catch (Exception ex) - { - _unitOfWork.RollbackTran(); - throw ex; - } - } - - - public static bool IsUnitOfWorkMethod( MethodInfo methodInfo,out UnitOfWorkAttribute unitOfWorkAttribute) - { - - //Method declaration - var attrs = methodInfo.GetCustomAttributes(true).OfType().ToArray(); - if (attrs.Any()) - { - unitOfWorkAttribute = attrs.First(); - return !unitOfWorkAttribute.IsDisabled; - } - - if (methodInfo.DeclaringType != null) - { - //Class declaration - attrs = methodInfo.DeclaringType.GetTypeInfo().GetCustomAttributes(true).OfType().ToArray(); - if (attrs.Any()) - { - unitOfWorkAttribute = attrs.First(); - return !unitOfWorkAttribute.IsDisabled; - } - - ////Conventional classes - //if (typeof(IUnitOfWorkEnabled).GetTypeInfo().IsAssignableFrom(methodInfo.DeclaringType)) - //{ - // unitOfWorkAttribute = null; - // return true; - //} - } - - unitOfWorkAttribute = null; - return false; - } - - } -} diff --git a/Yi.Framework.Net6/Yi.Framework.Uow/Microsoft/ApsNetCore/Extensions/UowIServiceCollectionExtensions.cs b/Yi.Framework.Net6/Yi.Framework.Uow/Microsoft/ApsNetCore/Extensions/UowIServiceCollectionExtensions.cs deleted file mode 100644 index bd424fdc..00000000 --- a/Yi.Framework.Net6/Yi.Framework.Uow/Microsoft/ApsNetCore/Extensions/UowIServiceCollectionExtensions.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Yi.Framework.Uow; -using Yi.Framework.Uow.Interceptors; - -namespace Microsoft.Extensions.DependencyInjection -{ - public static class UowIServiceCollectionExtensions - { - public static void AddUnitOfWork(this IServiceCollection services) - { - services.AddScoped(typeof(IUnitOfWork), typeof(UnitOfWork)); - - services.AddSingleton(); - } - } -} diff --git a/Yi.Framework.Net6/Yi.Framework.Uow/UnitOfWork.cs b/Yi.Framework.Net6/Yi.Framework.Uow/UnitOfWork.cs deleted file mode 100644 index 84c74df1..00000000 --- a/Yi.Framework.Net6/Yi.Framework.Uow/UnitOfWork.cs +++ /dev/null @@ -1,75 +0,0 @@ -using SqlSugar; -using System; -using System.Collections.Generic; -using System.Data; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Yi.Framework.Uow -{ - public class UnitOfWork : IUnitOfWork - { - - public bool IsTransactional { get; protected set; } - - public IsolationLevel? IsolationLevel { get; protected set; } - - /// - /// Milliseconds - /// - public int? Timeout { get; protected set; } - - public void Init(bool isTransactional, IsolationLevel? isolationLevel, int? timeout) - { - IsTransactional = isTransactional; - IsolationLevel = isolationLevel; - Timeout = timeout; - } - - public ISqlSugarClient SugarClient { get; set; } - /// - /// 因为sqlsugarclient的生命周期是作用域的,也就是说一个请求线程内是共用一个client,暂时先直接注入 - /// - /// - public UnitOfWork(ISqlSugarClient sqlSugarClient) - { - this.SugarClient = sqlSugarClient; - } - - - public void Dispose() - { - SugarClient?.Dispose(); - SugarClient?.Close(); - } - - - - public void BeginTran() - { - if (IsTransactional) - { - if (IsolationLevel.HasValue) - { - SugarClient.Ado.BeginTran(IsolationLevel.Value); - } - else - { - SugarClient.Ado.BeginTran(); - } - } - } - - public void CommitTran() - { - if (IsTransactional) - SugarClient.Ado.CommitTran(); - } - public void RollbackTran() - { - if (IsTransactional) - SugarClient.Ado.RollbackTran(); - } - } -} diff --git a/Yi.Framework.Net6/Yi.Framework.Uow/Yi.Framework.Uow.csproj b/Yi.Framework.Net6/Yi.Framework.Uow/Yi.Framework.Uow.csproj deleted file mode 100644 index 8ac127cb..00000000 --- a/Yi.Framework.Net6/Yi.Framework.Uow/Yi.Framework.Uow.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - - net6.0 - enable - enable - - - - - - - - - - -