├── codearts.png
├── Tests
├── Mvc.Core
│ ├── Startup.cs
│ ├── appsettings.json
│ ├── Services
│ │ └── PushService.cs
│ ├── appsettings.Development.json
│ ├── Domain
│ │ ├── UserRepository.cs
│ │ ├── EfContext.cs
│ │ └── Entities
│ │ │ └── User.cs
│ ├── WeatherForecast.cs
│ ├── Protos
│ │ └── push.proto
│ └── Program.cs
├── Mvc.Core2_1
│ ├── appsettings.json
│ ├── appsettings.Development.json
│ ├── Domain
│ │ ├── UserRepository.cs
│ │ └── Entities
│ │ │ └── User.cs
│ ├── log4net.config
│ └── Program.cs
├── CodeArts.Emit.Tests
│ └── UnitTest1.cs
├── CodeArts.Db.Lts.Tests
│ ├── SqlServerTest.cs
│ ├── Domain
│ │ ├── OrgTreeRepository.cs
│ │ ├── AuthShipRepository.cs
│ │ ├── AuthTreeRepository.cs
│ │ ├── MySqlUserRespository.cs
│ │ ├── OrmTestRepository.cs
│ │ ├── UserDetailsRepository.cs
│ │ ├── UserWeChatRepository.cs
│ │ ├── UserRepository.cs
│ │ ├── TaxCodeRepository.cs
│ │ └── Entities
│ │ │ └── OrmTest.cs
│ ├── Dtos
│ │ ├── UserSimDto.cs
│ │ └── TaxCodeTreeSimDto.cs
│ ├── Serialize
│ │ ├── DateTimeTokenAttribute.cs
│ │ ├── SqlServerConnectionAttribute.cs
│ │ └── DefaultDbConfigAttribute.cs
│ ├── UnitTest1.cs
│ ├── Enums
│ │ ├── OssAclEnum.cs
│ │ ├── OssAlgorithmEnum.cs
│ │ ├── OssStorageEnum.cs
│ │ ├── AuthShipEnum.cs
│ │ ├── OssKmsEncryptionAlgorithmEnum.cs
│ │ ├── OrgTreeEnum.cs
│ │ ├── UserSex.cs
│ │ ├── CommonStatusEnum.cs
│ │ ├── AuthTreeEnum.cs
│ │ └── UserRole.cs
│ ├── MySqlConsts.cs
│ ├── SqlServerConsts.cs
│ └── CodeArts.Db.Lts.Tests.csproj
├── CodeArts.Db.EntityFramework.Tests
│ ├── SqlServerTest.cs
│ ├── UnitTest1.cs
│ ├── Dtos
│ │ ├── UserSimDto.cs
│ │ └── TaxCodeTreeSimDto.cs
│ ├── Domain
│ │ ├── UserRepository.cs
│ │ ├── UserDetailsRepository.cs
│ │ └── UserWeChatRepository.cs
│ ├── DbTestContext.cs
│ ├── Enums
│ │ ├── AuthShipEnum.cs
│ │ ├── OrgTreeEnum.cs
│ │ ├── UserSex.cs
│ │ ├── CommonStatusEnum.cs
│ │ ├── AuthTreeEnum.cs
│ │ └── UserRole.cs
│ ├── SqlServerConsts.cs
│ └── Serialize
│ │ ├── DefaultDbConfigAttribute.cs
│ │ └── SqlServerConnectionAttribute.cs
├── ConsoleEmit
│ ├── App.config
│ └── Properties
│ │ └── AssemblyInfo.cs
├── GrpcClient
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ ├── GrpcClient.csproj
│ ├── Protos
│ │ └── push.proto
│ └── Program.cs
├── CodeArts.Tests
│ ├── packages.config
│ ├── Enums
│ │ └── RoleEnum.cs
│ ├── StringExtentions.cs
│ ├── CryptoExtentions.cs
│ ├── EnumExtensions.cs
│ └── CodeArts.Tests.csproj
├── Mvc4
│ ├── Views
│ │ └── TestView.cs
│ ├── packages.config
│ ├── Startup.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Web.Debug.config
│ └── Web.Release.config
├── MVC461
│ ├── Domain
│ │ ├── UserRepository.cs
│ │ └── Entities
│ │ │ └── User.cs
│ ├── App_Start
│ │ └── WebApiConfig.cs
│ ├── Startup.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── Web.Debug.config
│ └── Web.Release.config
├── CodeArts.Db.Dapper.Tests
│ ├── SkyDbContext.cs
│ ├── SqlServerConsts.cs
│ ├── Serialize
│ │ └── SqlServerConnectionAttribute.cs
│ └── CodeArts.Db.Dapper.Tests.csproj
└── Mvc45
│ ├── Startup.cs
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── Web.Debug.config
│ ├── Web.Release.config
│ ├── packages.config
│ └── Controllers
│ └── ValuesController.cs
├── .editorconfig
├── .github
└── ISSUE_REPLY_TEMPLATE.md
├── project.json
├── src
├── CodeArts.Db.Linq2Sql
│ ├── ICustomVisitorList.cs
│ ├── CustomVisitorList.cs
│ ├── IQueryVisitor.cs
│ ├── IExecuteVisitor.cs
│ ├── IVisitor.cs
│ ├── IStartupVisitor.cs
│ ├── ICustomVisitor.cs
│ ├── CommandBehavior.cs
│ ├── IWriterMap.cs
│ └── Expressions
│ │ ├── JoinSelectVisitor.cs
│ │ └── NestedContainsVisitor.cs
├── CodeArts.DependencyInjection
│ ├── ServiceLookup
│ │ ├── SingletonCallSite.cs
│ │ ├── CreateInstanceCallSite.cs
│ │ ├── CallSiteResultCacheLocation.cs
│ │ ├── CallSiteKind.cs
│ │ ├── IServiceProviderEngine.cs
│ │ ├── IServiceProviderEngineCallback.cs
│ │ ├── CallSiteExpressionBuilderContext.cs
│ │ ├── ThrowHelper.cs
│ │ ├── ILEmit
│ │ │ ├── ILEmitResolverBuilderContext.cs
│ │ │ ├── ILEmitCallSiteAnalysisResult.cs
│ │ │ └── ILEmitServiceProviderEngine.cs
│ │ ├── ServiceProviderCallSite.cs
│ │ ├── ServiceScopeFactoryCallSite.cs
│ │ ├── ServiceCallSite.cs
│ │ ├── ConstantCallSite.cs
│ │ ├── FactoryCallSite.cs
│ │ ├── Expressions
│ │ │ └── ExpressionsServiceProviderEngine.cs
│ │ ├── IEnumerableCallSite.cs
│ │ ├── RuntimeServiceProviderEngine.cs
│ │ ├── CompiledServiceProviderEngine.cs
│ │ ├── ConstructorCallSite.cs
│ │ └── DynamicServiceProviderEngine.cs
│ ├── ServiceProviderMode.cs
│ └── ServiceProviderOptions.cs
├── CodeArts
│ ├── IKeyGenFactory.cs
│ ├── IConfigable.cs
│ ├── IgnoreAttribute.cs
│ ├── Collections
│ │ └── Generic
│ │ │ ├── IReadOnlyCollection.cs
│ │ │ ├── IReadOnlyList.cs
│ │ │ ├── IAsyncEnumerable.cs
│ │ │ └── IAsyncEnumerator.cs
│ ├── DevelopAttribute.cs
│ ├── PatternKind.cs
│ ├── NamingType.cs
│ ├── IKeyGen.cs
│ ├── IStartup.cs
│ ├── Config
│ │ └── IConfigHelper.cs
│ ├── KeyGenFactory.cs
│ ├── Extentions
│ │ └── QueryableExtentions.cs
│ ├── Singleton.cs
│ ├── Exceptions
│ │ ├── BusiException.cs
│ │ ├── ServException.cs
│ │ ├── CodeException.cs
│ │ └── SyntaxException.cs
│ ├── SnowflakeFactory.cs
│ ├── IResult.cs
│ ├── IMapper.cs
│ ├── CodeArts.csproj
│ ├── Threading
│ │ └── AsyncLocalValueChangedArgs.cs
│ ├── Serialize
│ │ └── Json
│ │ │ └── IJsonHelper.cs
│ ├── NamingAttribute.cs
│ └── JsonSettings.cs
├── CodeArts.Db
│ ├── IDbConnectionAdapter.cs
│ ├── IReadOnlyConnectionConfig.cs
│ ├── TokenAttribute.cs
│ ├── IEntiy.cs
│ ├── IFormatter.cs
│ ├── IDispatchConnections.cs
│ ├── Exceptions
│ │ ├── NotImplementedKeyException.cs
│ │ ├── NonAuthorizedException.cs
│ │ ├── DRequiredException.cs
│ │ ├── DSyntaxErrorException.cs
│ │ └── TypeAccessInvalidException.cs
│ ├── DbWriteConfigAttribute.cs
│ ├── IDbConnectionFactory.cs
│ ├── Extentions
│ │ └── QueryableExtentions.cs
│ ├── DatabaseEngine.cs
│ ├── ConnectionConfig.cs
│ ├── Types.cs
│ ├── IDbRouter.cs
│ ├── ITableInfo.cs
│ ├── DbConfigAttribute.cs
│ └── CommandTypes.cs
├── CodeArts.Emit
│ ├── NoninterceptAttribute.cs
│ ├── INamingScope.cs
│ ├── AstException.cs
│ ├── Emitters
│ │ └── ClassEmitter.cs
│ ├── Intercept.cs
│ ├── Expressions
│ │ ├── DefaultAst.cs
│ │ ├── ArrayLengthAst.cs
│ │ └── NewArrayAst.cs
│ ├── InterceptAsync.cs
│ ├── NamingScope.cs
│ ├── InterceptContext.cs
│ └── CodeArts.Emit.csproj
├── CodeArts.Db.Lts
│ ├── IDbConnectionLtsAdapter.cs
│ ├── IRepository.cs
│ ├── IAsyncQueryProvider.cs
│ └── Extentions
│ │ └── QueryableAsyncExtentions.cs
├── CodeArts.Casting
│ ├── IProfileMap.cs
│ ├── IMapExpression.cs
│ ├── IProfile.cs
│ ├── IProfileConfiguration.cs
│ ├── ProfileConfiguration.cs
│ ├── CastingStartup.cs
│ ├── IMapConfiguration.cs
│ ├── CodeArts.Casting.csproj
│ └── IProfileExpression.cs
├── CodeArts.Caching
│ ├── ICachingProvider.cs
│ ├── Level.cs
│ └── CodeArts.Caching.csproj
├── CodeArts.Middleware
│ ├── IProxyByPattern.cs
│ └── Proxies
│ │ ├── ProxyByInstance.cs
│ │ └── ProxyByFactory.cs
├── CodeArts.Db.MySql
│ ├── MySqlAdapter.cs
│ └── MySqlFactory.cs
├── CodeArts.Db.Sqlite
│ └── SqliteAdapter.cs
├── CodeArts.Db.SqlServer
│ ├── SqlServerAdapter.cs
│ ├── SqlServer2012Adapter.cs
│ ├── SqlServerFactory.cs
│ └── SqlServer2012CorrectSettings.cs
├── CodeArts.Mvc
│ ├── JwtToken.cs
│ ├── IJwtAlgorithmGen.cs
│ ├── Algorithms
│ │ └── HMACSHA256AlgorithmGen.cs
│ ├── JwtAlgorithmGen.cs
│ ├── DependencyInjectionOptions.cs
│ ├── HttpVerbs.cs
│ └── Builder
│ │ └── IApplicationBuilder.cs
├── CodeArts.DependencyInjection.Abstractions
│ ├── IServiceCollection.cs
│ ├── IServiceScope.cs
│ ├── ServiceLifetime.cs
│ ├── IServiceProviderFactory.cs
│ ├── ISupportRequiredService.cs
│ ├── IServiceScopeFactory.cs
│ └── CodeArts.DependencyInjection.Abstractions.csproj
├── CodeArts.MemoryCaching
│ ├── MemoryCachingStartup.cs
│ └── MemoryCachingProvider.cs
├── CodeArts.RedisCaching
│ └── RedisCachingStartup.cs
├── CodeArts.Json
│ └── JsonStartup.cs
├── CodeArts.Db.EntityFramework
│ ├── IDbConnectionLinqAdapter.cs
│ ├── IDbTransactionProvider.cs
│ └── DbTransactionProvider.cs
├── CodeArts.Configuration
│ └── ConfigurationStartup.cs
├── CodeArts.Db.Lts.MySql
│ └── MySqlLtsAdapter.cs
├── CodeArts.Db.Lts.SqlServer
│ ├── SqlServerLtsAdapter.cs
│ └── SqlServer2012LtsAdapter.cs
├── CodeArts.Db.EntityFramework.Sqlite
│ └── SqliteLinqAdapter.cs
├── CodeArts.Db.EntityFramework.SqlServer
│ └── SqlServerLinqAdapter.cs
└── CodeArts.Net
│ └── WebCoreClient.cs
└── LICENSE.txt
/codearts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tinylit/codearts/HEAD/codearts.png
--------------------------------------------------------------------------------
/Tests/Mvc.Core/Startup.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tinylit/codearts/HEAD/Tests/Mvc.Core/Startup.cs
--------------------------------------------------------------------------------
/Tests/Mvc.Core/appsettings.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tinylit/codearts/HEAD/Tests/Mvc.Core/appsettings.json
--------------------------------------------------------------------------------
/Tests/Mvc.Core2_1/appsettings.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tinylit/codearts/HEAD/Tests/Mvc.Core2_1/appsettings.json
--------------------------------------------------------------------------------
/Tests/CodeArts.Emit.Tests/UnitTest1.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tinylit/codearts/HEAD/Tests/CodeArts.Emit.Tests/UnitTest1.cs
--------------------------------------------------------------------------------
/Tests/Mvc.Core/Services/PushService.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tinylit/codearts/HEAD/Tests/Mvc.Core/Services/PushService.cs
--------------------------------------------------------------------------------
/Tests/CodeArts.Db.Lts.Tests/SqlServerTest.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tinylit/codearts/HEAD/Tests/CodeArts.Db.Lts.Tests/SqlServerTest.cs
--------------------------------------------------------------------------------
/Tests/CodeArts.Db.EntityFramework.Tests/SqlServerTest.cs:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/tinylit/codearts/HEAD/Tests/CodeArts.Db.EntityFramework.Tests/SqlServerTest.cs
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | [*.cs]
2 |
3 | # IDE0066: 将 switch 语句转换为表达式
4 | dotnet_diagnostic.IDE0066.severity = none
5 |
6 | # IDE0063: 使用简单的 "using" 语句
7 | dotnet_diagnostic.IDE0063.severity = none
8 |
--------------------------------------------------------------------------------
/.github/ISSUE_REPLY_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug.
3 | about: The framework is abnormal.
4 | ---
5 |
6 | ## ISSUE TEMPLATE
7 |
8 | #### 实例:
9 |
10 | ```c
11 | // 异常代码。
12 | ```
13 |
14 | #### 说明:
15 |
16 | * 异常描述。
--------------------------------------------------------------------------------
/Tests/Mvc.Core/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Debug",
5 | "System": "Information",
6 | "Microsoft": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Tests/ConsoleEmit/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/Tests/Mvc.Core2_1/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Debug",
5 | "System": "Information",
6 | "Microsoft": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/Tests/GrpcClient/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Debug",
5 | "System": "Information",
6 | "Grpc": "Information",
7 | "Microsoft": "Information"
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/Tests/CodeArts.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "dependencies": {
3 | "netstandard.library": "1.6.0"
4 | },
5 | "frameworks": {
6 | "netstandard2.0": {
7 | "imports": "dnxcore50"
8 | },
9 | "net40": {}
10 | },
11 | "buildOptions": {
12 | "xmlDoc": true
13 | }
14 | }
--------------------------------------------------------------------------------
/src/CodeArts.Db.Linq2Sql/ICustomVisitorList.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace CodeArts.Db
4 | {
5 | ///
6 | /// 自定义表达式集合。
7 | ///
8 | public interface ICustomVisitorList : IList
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/CodeArts.Db.Linq2Sql/CustomVisitorList.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace CodeArts.Db
4 | {
5 | ///
6 | /// 自定义表达式集合。
7 | ///
8 | public class CustomVisitorList : List, ICustomVisitorList
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Tests/CodeArts.Db.Lts.Tests/Domain/OrgTreeRepository.cs:
--------------------------------------------------------------------------------
1 | using CodeArts.Db.Lts;
2 | using UnitTest.Domain.Entities;
3 | using UnitTest.Serialize;
4 |
5 | namespace UnitTest.Domain
6 | {
7 | [DefaultDbConfig]
8 | public class OrgTreeRepository : DbRepository
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Tests/CodeArts.Db.Lts.Tests/Domain/AuthShipRepository.cs:
--------------------------------------------------------------------------------
1 | using CodeArts.Db.Lts;
2 | using UnitTest.Domain.Entities;
3 | using UnitTest.Serialize;
4 |
5 | namespace UnitTest.Domain
6 | {
7 | [DefaultDbConfig]
8 | public class AuthShipRepository : DbRepository
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Tests/Mvc4/Views/TestView.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Web;
5 |
6 | namespace Mvc4.Views
7 | {
8 | public class TestView
9 | {
10 | public int Id { get; set; }
11 |
12 | public string Name { get; set; }
13 | }
14 | }
--------------------------------------------------------------------------------
/src/CodeArts.DependencyInjection/ServiceLookup/SingletonCallSite.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | namespace Microsoft.Extensions.DependencyInjection.ServiceLookup
5 | {
6 | }
--------------------------------------------------------------------------------
/Tests/CodeArts.Db.Lts.Tests/Domain/AuthTreeRepository.cs:
--------------------------------------------------------------------------------
1 | using CodeArts.Db.Lts;
2 | using UnitTest.Domain.Entities;
3 | using UnitTest.Serialize;
4 |
5 | namespace UnitTest.Domain
6 | {
7 | [DefaultDbConfig]
8 | public class AuthTreeRepository : DbRepository
9 | {
10 |
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Tests/CodeArts.Db.Lts.Tests/Domain/MySqlUserRespository.cs:
--------------------------------------------------------------------------------
1 | using CodeArts.Db.Lts;
2 | using UnitTest.Domain.Entities;
3 | using UnitTest.Serialize;
4 |
5 | namespace UnitTest.Domain
6 | {
7 | [DefaultDbConfig]
8 | public class MySqlUserRespository : DbRepository
9 | {
10 |
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Tests/GrpcClient/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Warning",
5 | "Microsoft.Hosting.Lifetime": "Information"
6 | }
7 | },
8 | "AllowedHosts": "*",
9 | "Kestrel": {
10 | "EndpointDefaults": {
11 | "Protocols": "Http2"
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Tests/CodeArts.Db.Lts.Tests/Domain/OrmTestRepository.cs:
--------------------------------------------------------------------------------
1 | using CodeArts.Db.Lts;
2 | using CodeArts.Db.Tests.Domain.Entities;
3 | using UnitTest.Serialize;
4 |
5 | namespace CodeArts.Db.Tests.Domain
6 | {
7 | [DefaultDbConfig]
8 | public class OrmTestRepository : DbRepository
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Tests/CodeArts.Db.Lts.Tests/Domain/UserDetailsRepository.cs:
--------------------------------------------------------------------------------
1 | using CodeArts.Db.Lts;
2 | using UnitTest.Domain.Entities;
3 | using UnitTest.Serialize;
4 |
5 | namespace CodeArts.Db.Domain
6 | {
7 | [SqlServerConnection]
8 | public class UserDetailsRepository : Repository
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Tests/CodeArts.Db.Lts.Tests/Domain/UserWeChatRepository.cs:
--------------------------------------------------------------------------------
1 | using CodeArts.Db.Lts;
2 | using UnitTest.Domain.Entities;
3 | using UnitTest.Serialize;
4 |
5 | namespace CodeArts.Db.Domain
6 | {
7 | [SqlServerConnection]
8 | public class UserWeChatRepository : DbRepository
9 | {
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Tests/MVC461/Domain/UserRepository.cs:
--------------------------------------------------------------------------------
1 | using CodeArts.Db;
2 | using CodeArts.Db.Lts;
3 | using Mvc461.Domain.Entities;
4 |
5 | namespace Mvc461.Domain
6 | {
7 | ///
8 | /// 用户仓库。
9 | ///
10 | [DbConfig]
11 | public class UserRepository : DbRepository
12 | {
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/CodeArts/IKeyGenFactory.cs:
--------------------------------------------------------------------------------
1 | namespace CodeArts
2 | {
3 | ///
4 | /// KeyGen 创建器。
5 | ///
6 | public interface IKeyGenFactory
7 | {
8 | ///
9 | /// 创建。
10 | ///
11 | ///
12 | IKeyGen Create();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Tests/Mvc.Core2_1/Domain/UserRepository.cs:
--------------------------------------------------------------------------------
1 | using Mvc.Core2_1.Domain.Entities;
2 | using CodeArts.Db;
3 | using CodeArts.Db.Lts;
4 |
5 | namespace Mvc.Core2_1.Domain
6 | {
7 | ///
8 | /// 用户仓库。
9 | ///
10 | [DbConfig]
11 | public class UserRepository : DbRepository
12 | {
13 |
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/CodeArts.Db/IDbConnectionAdapter.cs:
--------------------------------------------------------------------------------
1 | namespace CodeArts.Db
2 | {
3 | ///
4 | /// 数据库链接适配器。
5 | ///
6 | public interface IDbConnectionAdapter : IDbConnectionFactory
7 | {
8 | ///
9 | /// SQL矫正设置。
10 | ///
11 | ISQLCorrectSettings Settings { get; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tests/CodeArts.Db.Lts.Tests/Domain/UserRepository.cs:
--------------------------------------------------------------------------------
1 | using CodeArts.Db.Lts;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using UnitTest.Domain.Entities;
5 | using UnitTest.Serialize;
6 |
7 | namespace CodeArts.Db.Domain
8 | {
9 | [SqlServerConnection]
10 | public class UserRepository : DbRepository
11 | {
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tests/Mvc.Core/Domain/UserRepository.cs:
--------------------------------------------------------------------------------
1 | using Mvc.Core.Domain.Entities;
2 | using CodeArts.Db;
3 | using CodeArts.Db.Lts;
4 |
5 | namespace Mvc.Core.Domain
6 | {
7 | ///
8 | /// 用户仓库。
9 | ///
10 | [DbConfig("connectionStrings:default")]
11 | public class UserRepository : DbRepository
12 | {
13 |
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/CodeArts.Emit/NoninterceptAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace CodeArts
4 | {
5 | ///
6 | /// 不拦截拦截属性。
7 | ///
8 | [AttributeUsage( AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = true, Inherited = true)]
9 | public sealed class NoninterceptAttribute : Attribute
10 | {
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/CodeArts.Db.Linq2Sql/IQueryVisitor.cs:
--------------------------------------------------------------------------------
1 | namespace CodeArts.Db
2 | {
3 | ///
4 | /// 查询访问器。
5 | ///
6 | public interface IQueryVisitor : IStartupVisitor
7 | {
8 | ///
9 | /// SQL语句。
10 | ///
11 | ///
12 | CommandSql ToSQL();
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/CodeArts.Db.Lts/IDbConnectionLtsAdapter.cs:
--------------------------------------------------------------------------------
1 | namespace CodeArts.Db.Lts
2 | {
3 | ///
4 | /// 数据库链接适配器。
5 | ///
6 | public interface IDbConnectionLtsAdapter : IDbConnectionAdapter
7 | {
8 | ///
9 | /// 访问器。
10 | ///
11 | ICustomVisitorList Visitors { get; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/CodeArts.Casting/IProfileMap.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace CodeArts.Casting
8 | {
9 | ///
10 | /// 映射配置。
11 | ///
12 | public interface IProfileMap : IProfile, IProfileConfiguration
13 | {
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/CodeArts.Caching/ICachingProvider.cs:
--------------------------------------------------------------------------------
1 |
2 | namespace CodeArts.Caching
3 | {
4 | ///
5 | /// 缓存服务供应商。
6 | ///
7 | public interface ICachingProvider
8 | {
9 | /// 获取缓存对象。
10 | /// 缓存名称。
11 | ///
12 | ICaching GetCache(string name);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/CodeArts.DependencyInjection/ServiceLookup/CreateInstanceCallSite.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | using System;
5 | using System.Runtime.ExceptionServices;
6 |
7 | namespace Microsoft.Extensions.DependencyInjection.ServiceLookup
8 | {
9 | }
10 |
--------------------------------------------------------------------------------
/src/CodeArts.Db.Linq2Sql/IExecuteVisitor.cs:
--------------------------------------------------------------------------------
1 | using System.Data;
2 |
3 | namespace CodeArts.Db
4 | {
5 | ///
6 | /// 执行能力访问器。
7 | ///
8 | public interface IExecuteVisitor : IStartupVisitor
9 | {
10 | ///
11 | /// SQL语句。
12 | ///
13 | ///
14 | CommandSql ToSQL();
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/CodeArts.Middleware/IProxyByPattern.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Extensions.DependencyInjection;
2 |
3 | namespace CodeArts
4 | {
5 | ///
6 | /// 代理方式。
7 | ///
8 | public interface IProxyByPattern
9 | {
10 | ///
11 | /// 创建类型。
12 | ///
13 | ///
14 | ServiceDescriptor Resolve();
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Tests/CodeArts.Db.Dapper.Tests/SkyDbContext.cs:
--------------------------------------------------------------------------------
1 | using CodeArts.Db.Dapper.Tests.Domain.Entities;
2 | using UnitTest.Serialize;
3 |
4 | namespace CodeArts.Db.Dapper.Tests
5 | {
6 | [SqlServerConnection]
7 | public class SkyDbContext : DbContext
8 | {
9 | public DbServiceSet Users { get; set; }
10 |
11 | public DbServiceSet Userdetails { get; set; }
12 | }
13 | }
--------------------------------------------------------------------------------
/Tests/CodeArts.Db.EntityFramework.Tests/UnitTest1.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.VisualStudio.TestTools.UnitTesting;
2 |
3 | namespace CodeArts.Db.EntityFramework.Tests
4 | {
5 | [TestClass]
6 | public class Tests
7 | {
8 | [TestInitialize]
9 | public void Setup()
10 | {
11 | }
12 |
13 | [TestMethod]
14 | public void Test1()
15 | {
16 |
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/src/CodeArts/IConfigable.cs:
--------------------------------------------------------------------------------
1 | namespace CodeArts
2 | {
3 | ///
4 | /// 配置变更监听能力。
5 | ///
6 | public interface IConfigable where TSelf : class, IConfigable
7 | {
8 | ///
9 | /// 监听到变更后的新数据。
10 | ///
11 | /// 变更后的数据。
12 | void SaveChanges(TSelf changedValue);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Tests/GrpcClient/GrpcClient.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp3.1
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/CodeArts.Db.MySql/MySqlAdapter.cs:
--------------------------------------------------------------------------------
1 | namespace CodeArts.Db
2 | {
3 | ///
4 | /// MySQL 适配器。
5 | ///
6 | public class MySqlAdapter : MySqlFactory, IDbConnectionAdapter, IDbConnectionFactory
7 | {
8 | ///
9 | /// 矫正配置。
10 | ///
11 | public virtual ISQLCorrectSettings Settings => Singleton.Instance;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/CodeArts/IgnoreAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace CodeArts
4 | {
5 | ///
6 | /// 忽略的键。
7 | ///
8 | [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)]
9 | public sealed class IgnoreAttribute : Attribute
10 | {
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/CodeArts.Db.Sqlite/SqliteAdapter.cs:
--------------------------------------------------------------------------------
1 | namespace CodeArts.Db
2 | {
3 | ///
4 | /// Sqlite 适配器。
5 | ///
6 | public class SqliteAdapter : SqliteFactory, IDbConnectionAdapter, IDbConnectionFactory
7 | {
8 | ///
9 | /// 矫正配置。
10 | ///
11 | public virtual ISQLCorrectSettings Settings => Singleton.Instance;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tests/CodeArts.Db.Lts.Tests/Dtos/UserSimDto.cs:
--------------------------------------------------------------------------------
1 | namespace UnitTest.Dtos
2 | {
3 | ///
4 | /// 用户简表。
5 | ///
6 | public class UserSimDto
7 | {
8 | ///
9 | /// ID。
10 | ///
11 | public int Id { get; set; }
12 | ///
13 | /// 用户名称。
14 | ///
15 | public string Username { get; set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/CodeArts.DependencyInjection/ServiceProviderMode.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | namespace Microsoft.Extensions.DependencyInjection
5 | {
6 | internal enum ServiceProviderMode
7 | {
8 | Dynamic,
9 | Runtime,
10 | Expressions,
11 | ILEmit
12 | }
13 | }
--------------------------------------------------------------------------------
/Tests/CodeArts.Db.EntityFramework.Tests/Dtos/UserSimDto.cs:
--------------------------------------------------------------------------------
1 | namespace UnitTest.Dtos
2 | {
3 | ///
4 | /// 用户简表。
5 | ///
6 | public class UserSimDto
7 | {
8 | ///
9 | /// ID。
10 | ///
11 | public int Id { get; set; }
12 | ///
13 | /// 用户名称。
14 | ///
15 | public string Username { get; set; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/CodeArts.Db.Linq2Sql/IVisitor.cs:
--------------------------------------------------------------------------------
1 | using System.Linq.Expressions;
2 |
3 | namespace CodeArts.Db
4 | {
5 | ///
6 | /// 访问器。
7 | ///
8 | public interface IVisitor
9 | {
10 | ///
11 | /// 能否解决表达式。
12 | ///
13 | /// 表达式。
14 | ///
15 | bool CanResolve(MethodCallExpression node);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/CodeArts.Db.SqlServer/SqlServerAdapter.cs:
--------------------------------------------------------------------------------
1 | namespace CodeArts.Db
2 | {
3 | ///
4 | /// SqlServer 适配器。
5 | ///
6 | public class SqlServerAdapter : SqlServerFactory, IDbConnectionAdapter, IDbConnectionFactory
7 | {
8 | ///
9 | /// 矫正配置。
10 | ///
11 | public virtual ISQLCorrectSettings Settings => Singleton.Instance;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Tests/CodeArts.Db.Lts.Tests/Serialize/DateTimeTokenAttribute.cs:
--------------------------------------------------------------------------------
1 | using CodeArts.Db.Lts;
2 | using System;
3 |
4 | namespace CodeArts.Db.Tests.Serialize
5 | {
6 | ///
7 | /// 日期令牌。
8 | ///
9 | [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
10 | public class DateTimeTokenAttribute : TokenAttribute
11 | {
12 | public override object Create() => DateTime.Now;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/CodeArts.Db.SqlServer/SqlServer2012Adapter.cs:
--------------------------------------------------------------------------------
1 | namespace CodeArts.Db
2 | {
3 | ///
4 | /// SqlServer 适配器。
5 | ///
6 | public class SqlServer2012Adapter : SqlServerFactory, IDbConnectionAdapter, IDbConnectionFactory
7 | {
8 | ///
9 | /// 矫正配置。
10 | ///
11 | public virtual ISQLCorrectSettings Settings => Singleton.Instance;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/CodeArts/Collections/Generic/IReadOnlyCollection.cs:
--------------------------------------------------------------------------------
1 | #if NET40
2 | namespace System.Collections.Generic
3 | {
4 | ///
5 | /// 表示元素的强类型化只读集合。
6 | ///
7 | /// 元素的类型。
8 | public interface IReadOnlyCollection : IEnumerable, IEnumerable
9 | {
10 | ///
11 | /// 获取集合中的元素数。
12 | ///
13 | int Count { get; }
14 | }
15 | }
16 | #endif
--------------------------------------------------------------------------------
/src/CodeArts.Mvc/JwtToken.cs:
--------------------------------------------------------------------------------
1 | #if NETCOREAPP2_0_OR_GREATER
2 | namespace CodeArts.Mvc
3 | {
4 | ///
5 | /// JWT令牌。
6 | ///
7 | public class JwtToken
8 | {
9 | ///
10 | /// 类型。
11 | ///
12 | public string Type { get; set; } = "Bearer";
13 | ///
14 | /// 令牌。
15 | ///
16 | public string Token { get; set; }
17 | }
18 | }
19 | #endif
--------------------------------------------------------------------------------
/src/CodeArts/DevelopAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace CodeArts
8 | {
9 | ///
10 | /// 开发模拟标记。
11 | ///
12 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]
13 | public sealed class DevelopAttribute : Attribute
14 | {
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/CodeArts.DependencyInjection/ServiceLookup/CallSiteResultCacheLocation.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | namespace Microsoft.Extensions.DependencyInjection.ServiceLookup
5 | {
6 | internal enum CallSiteResultCacheLocation
7 | {
8 | Root,
9 | Scope,
10 | Dispose,
11 | None
12 | }
13 | }
--------------------------------------------------------------------------------
/src/CodeArts.Db/IReadOnlyConnectionConfig.cs:
--------------------------------------------------------------------------------
1 | namespace CodeArts.Db
2 | {
3 | ///
4 | /// 只读配置。
5 | ///
6 | public interface IReadOnlyConnectionConfig
7 | {
8 | /// 连接名称。
9 | string Name { get; }
10 |
11 | /// 数据库驱动名称。
12 | string ProviderName { get; }
13 |
14 | /// 连接字符串。
15 | string ConnectionString { get; }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/CodeArts.Mvc/IJwtAlgorithmGen.cs:
--------------------------------------------------------------------------------
1 | #if NET40_OR_GREATER
2 | #if NET461_OR_GREATER
3 | using JWT.Algorithms;
4 | #else
5 | using JWT;
6 | #endif
7 |
8 | namespace CodeArts.Mvc
9 | {
10 | ///
11 | /// JWT 算法工厂。
12 | ///
13 | public interface IJwtAlgorithmGen
14 | {
15 | ///
16 | /// 创建 JWT 算法。
17 | ///
18 | ///
19 | IJwtAlgorithm Create();
20 | }
21 | }
22 | #endif
--------------------------------------------------------------------------------
/Tests/CodeArts.Tests/Enums/RoleEnum.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Text;
5 |
6 | namespace CodeArts.Tests.Enums
7 | {
8 | public enum RoleEnum
9 | {
10 | User,
11 | [Description("管理员")]
12 | Admin
13 | }
14 |
15 | [Flags]
16 | public enum RoleFlagsEnum
17 | {
18 | User = 1 << 0,
19 | [Description("管理员")]
20 | Admin = 1 << 1
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/CodeArts/PatternKind.cs:
--------------------------------------------------------------------------------
1 | namespace CodeArts
2 | {
3 | ///
4 | /// 匹配性质。
5 | ///
6 | public enum PatternKind
7 | {
8 | ///
9 | /// 属性。
10 | ///
11 | Property = 1 << 0,
12 | ///
13 | /// 字段。
14 | ///
15 | Field = 1 << 1,
16 | ///
17 | /// 属性与字段。
18 | ///
19 | All = 1 << 2
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/CodeArts.Db.Linq2Sql/IStartupVisitor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Linq.Expressions;
3 |
4 | namespace CodeArts.Db
5 | {
6 | ///
7 | /// 启动访问器。
8 | ///
9 | public interface IStartupVisitor : IVisitor, IDisposable
10 | {
11 | ///
12 | /// 启动。
13 | ///
14 | /// 分析表达式。
15 | ///
16 | void Startup(Expression node);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/CodeArts.Db/TokenAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace CodeArts.Db
4 | {
5 | ///
6 | /// 令牌(作为更新数据库的唯一标识,会体现在更新的条件语句中)。
7 | ///
8 | [AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
9 | public abstract class TokenAttribute : Attribute
10 | {
11 | ///
12 | /// 创建新令牌。
13 | ///
14 | ///
15 | public abstract object Create();
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/CodeArts.DependencyInjection/ServiceLookup/CallSiteKind.cs:
--------------------------------------------------------------------------------
1 | namespace Microsoft.Extensions.DependencyInjection.ServiceLookup
2 | {
3 | internal enum CallSiteKind
4 | {
5 | Factory,
6 |
7 | Constructor,
8 |
9 | Constant,
10 |
11 | IEnumerable,
12 |
13 | ServiceProvider,
14 |
15 | Scope,
16 |
17 | Transient,
18 |
19 | CreateInstance,
20 |
21 | ServiceScopeFactory,
22 |
23 | Singleton
24 | }
25 | }
--------------------------------------------------------------------------------
/src/CodeArts.DependencyInjection/ServiceLookup/IServiceProviderEngine.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) .NET Foundation. All rights reserved.
2 | // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3 |
4 | using System;
5 |
6 | namespace Microsoft.Extensions.DependencyInjection.ServiceLookup
7 | {
8 | internal interface IServiceProviderEngine : IDisposable, IServiceProvider
9 | {
10 | IServiceScope RootScope { get; }
11 | }
12 | }
--------------------------------------------------------------------------------
/src/CodeArts.Db/IEntiy.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace CodeArts.Db
4 | {
5 | ///
6 | /// 实体基本接口。
7 | ///
8 | public interface IEntiy
9 | {
10 | }
11 |
12 | ///
13 | /// 实体基本接口。
14 | ///
15 | public interface IEntiy : IEntiy where TKey : IEquatable, IComparable
16 | {
17 | ///
18 | /// 主键。
19 | ///
20 | TKey Id { get; set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/src/CodeArts/NamingType.cs:
--------------------------------------------------------------------------------
1 | namespace CodeArts
2 | {
3 | /// 命名规范。
4 | public enum NamingType
5 | {
6 | /// 默认命名(原样/业务自定义)。
7 | Normal = 0,
8 |
9 | /// 驼峰命名,如:userName。
10 | CamelCase = 1,
11 |
12 | /// url命名,如:user_name,注:反序列化时也需要指明。
13 | UrlCase = 2,
14 |
15 | /// 帕斯卡命名,如:UserName。
16 | PascalCase = 3
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/CodeArts.Casting/IMapExpression.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace CodeArts.Casting
4 | {
5 | ///
6 | /// 映射。
7 | ///
8 | public interface IMapExpression
9 | {
10 | ///
11 | /// 是否匹配。
12 | ///
13 | /// 源类型。
14 | /// 目标类型。
15 | ///
16 | bool IsMatch(Type sourceType, Type conversionType);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/CodeArts/IKeyGen.cs:
--------------------------------------------------------------------------------
1 | namespace CodeArts
2 | {
3 | ///
4 | /// 主键生成器接口。
5 | ///
6 | public interface IKeyGen
7 | {
8 | ///
9 | /// 生成新主键。
10 | ///
11 | ///
12 | long Id();
13 |
14 | ///
15 | /// 创建主键。
16 | ///
17 | /// 主键值。
18 | ///
19 | Key Create(long key);
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/CodeArts.Casting/IProfile.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace CodeArts.Casting
4 | {
5 | ///
6 | /// 配置文件。
7 | ///
8 | public interface IProfile
9 | {
10 | ///
11 | /// 创建工厂。
12 | ///
13 | /// 源数据类型。
14 | /// 目标数据类型。
15 | ///
16 | Func