Skip to content

Commit 5660261

Browse files
committed
style: 移除无效文件
1 parent d9edbbc commit 5660261

File tree

41 files changed

+305
-1726
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+305
-1726
lines changed

Bing.All.sln

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.29911.84
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.3.32929.385
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "01-framework", "01-framework", "{A3E29077-2385-4F4F-B2BB-01975E24979C}"
77
EndProject
@@ -86,10 +86,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bing.Tests", "framework\tes
8686
EndProject
8787
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bing.Datas.Test.Integration", "framework\tests\Bing.Datas.Test.Integration\Bing.Datas.Test.Integration.csproj", "{0F86BCCF-6A1D-41DD-A9C0-4B3BF8A840BF}"
8888
EndProject
89-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "03-demo", "03-demo", "{2DABEEC3-E915-44D7-A4B4-50972CAF45FB}"
90-
EndProject
91-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bing.Datas.SqlBuilder.Console", "framework\demo\Bing.Datas.SqlBuilder.Console\Bing.Datas.SqlBuilder.Console.csproj", "{77817263-DB2A-4500-86A5-1ADBE3318A73}"
92-
EndProject
9389
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bing.Ddd.Domain", "framework\src\Bing.Ddd.Domain\Bing.Ddd.Domain.csproj", "{25107D91-1E7D-422C-8B03-B1C94EE3A1B5}"
9490
EndProject
9591
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bing.Ddd.Application", "framework\src\Bing.Ddd.Application\Bing.Ddd.Application.csproj", "{CAC738F2-8F95-4940-90D2-76DABF403581}"
@@ -265,7 +261,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "solution", "solution", "{B6
265261
EndProject
266262
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bing.Uow", "framework\src\Bing.Uow\Bing.Uow.csproj", "{659C6450-6A39-44A3-A1A5-449ECAA1AFBE}"
267263
EndProject
268-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bing.AspNetCore.Serilog", "framework\src\Bing.AspNetCore.Serilog\Bing.AspNetCore.Serilog.csproj", "{46718841-DF9E-41A4-AF87-C8E81AAE6F55}"
264+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bing.AspNetCore.Serilog", "framework\src\Bing.AspNetCore.Serilog\Bing.AspNetCore.Serilog.csproj", "{46718841-DF9E-41A4-AF87-C8E81AAE6F55}"
269265
EndProject
270266
Global
271267
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -405,10 +401,6 @@ Global
405401
{0F86BCCF-6A1D-41DD-A9C0-4B3BF8A840BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
406402
{0F86BCCF-6A1D-41DD-A9C0-4B3BF8A840BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
407403
{0F86BCCF-6A1D-41DD-A9C0-4B3BF8A840BF}.Release|Any CPU.Build.0 = Release|Any CPU
408-
{77817263-DB2A-4500-86A5-1ADBE3318A73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
409-
{77817263-DB2A-4500-86A5-1ADBE3318A73}.Debug|Any CPU.Build.0 = Debug|Any CPU
410-
{77817263-DB2A-4500-86A5-1ADBE3318A73}.Release|Any CPU.ActiveCfg = Release|Any CPU
411-
{77817263-DB2A-4500-86A5-1ADBE3318A73}.Release|Any CPU.Build.0 = Release|Any CPU
412404
{25107D91-1E7D-422C-8B03-B1C94EE3A1B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
413405
{25107D91-1E7D-422C-8B03-B1C94EE3A1B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
414406
{25107D91-1E7D-422C-8B03-B1C94EE3A1B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -635,8 +627,6 @@ Global
635627
{A66F9341-005F-4FAC-BF93-D676329A34B4} = {5C7976B4-C243-41B9-8303-8E8FAE099D31}
636628
{58BE2219-6694-4630-85E6-7953A608A2D6} = {5C7976B4-C243-41B9-8303-8E8FAE099D31}
637629
{0F86BCCF-6A1D-41DD-A9C0-4B3BF8A840BF} = {5C7976B4-C243-41B9-8303-8E8FAE099D31}
638-
{2DABEEC3-E915-44D7-A4B4-50972CAF45FB} = {A3E29077-2385-4F4F-B2BB-01975E24979C}
639-
{77817263-DB2A-4500-86A5-1ADBE3318A73} = {2DABEEC3-E915-44D7-A4B4-50972CAF45FB}
640630
{25107D91-1E7D-422C-8B03-B1C94EE3A1B5} = {AED4D92B-5196-47E9-BD2C-84D4077F5A70}
641631
{CAC738F2-8F95-4940-90D2-76DABF403581} = {AED4D92B-5196-47E9-BD2C-84D4077F5A70}
642632
{577D3EA3-5342-4E0D-AE51-39CBEE217089} = {AED4D92B-5196-47E9-BD2C-84D4077F5A70}

framework/demo/Bing.Datas.SqlBuilder.Console/Bing.Datas.SqlBuilder.Console.csproj

Lines changed: 0 additions & 14 deletions
This file was deleted.

framework/demo/Bing.Datas.SqlBuilder.Console/Models/UserInfo.cs

Lines changed: 0 additions & 29 deletions
This file was deleted.

framework/demo/Bing.Datas.SqlBuilder.Console/Program.cs

Lines changed: 0 additions & 78 deletions
This file was deleted.

framework/src/Bing.Datas.EntityFramework/Bing.Datas.EntityFramework.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
<ItemGroup>
99
<Folder Include="Bing\Data\Stores\EntityFrameworkCore\" />
1010
<Folder Include="Bing\Data\Filters\" />
11+
<Folder Include="Bing\EntityFrameworkCore\Internal\" />
12+
<Folder Include="Bing\EntityFrameworkCore\Modeling\" />
1113
</ItemGroup>
1214

1315
<ItemGroup>
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Reflection;
4+
using Microsoft.EntityFrameworkCore;
5+
6+
namespace Bing.EntityFrameworkCore;
7+
8+
/// <summary>
9+
/// 实体类配置类型查找器
10+
/// </summary>
11+
public interface IEntityConfigurationTypeFinder
12+
{
13+
/// <summary>
14+
/// 获取指定上下文类型的实体配置注册信息
15+
/// </summary>
16+
/// <param name="dbContextType">数据上下文类型</param>
17+
Dictionary<Type, EntityTypeConfigurationMetadata> GetEntityTypeConfigurations(Type dbContextType);
18+
19+
/// <summary>
20+
/// 获取实体类型所属的数据上下文类型
21+
/// </summary>
22+
/// <param name="entityType">实体类型</param>
23+
/// <returns>数据上下文类型</returns>
24+
Type GetDbContextTypeForEntity(Type entityType);
25+
26+
/// <summary>
27+
/// 获取全部数据上下文的实体类型
28+
/// </summary>
29+
IEnumerable<Type> GetAllDbContextTypes();
30+
31+
/// <summary>
32+
/// 判断实体是否配置到 <see cref="DbContext"/> 当中
33+
/// </summary>
34+
/// <typeparam name="T">实体类型</typeparam>
35+
bool HasDbContextForEntity<T>();
36+
37+
/// <summary>
38+
/// 判断实体是否配置到 <see cref="DbContext"/> 当中
39+
/// </summary>
40+
/// <param name="type">实体类型</param>
41+
bool HasDbContextForEntity(Type type);
42+
}
43+
44+
45+
/// <summary>
46+
/// 实体类型配置元数据
47+
/// </summary>
48+
public struct EntityTypeConfigurationMetadata
49+
{
50+
/// <summary>
51+
/// 初始化一个<see cref="EntityTypeConfigurationMetadata"/>类型的实例
52+
/// </summary>
53+
/// <param name="entityType">实体类型</param>
54+
/// <param name="methodInfo">方法信息</param>
55+
/// <param name="entityTypeConfiguration">实体类型配置</param>
56+
public EntityTypeConfigurationMetadata(Type entityType, MethodInfo methodInfo, object entityTypeConfiguration)
57+
{
58+
EntityType = entityType;
59+
MethodInfo = methodInfo;
60+
EntityTypeConfiguration = entityTypeConfiguration;
61+
}
62+
63+
/// <summary>
64+
/// 实体类型
65+
/// </summary>
66+
public Type EntityType { get; }
67+
68+
/// <summary>
69+
/// 方法信息
70+
/// </summary>
71+
public MethodInfo MethodInfo { get; }
72+
73+
/// <summary>
74+
/// 实体类型配置
75+
/// </summary>
76+
public object EntityTypeConfiguration { get; }
77+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using Microsoft.EntityFrameworkCore;
2+
3+
namespace Bing.EntityFrameworkCore;
4+
5+
/// <summary>
6+
/// 实体类型配置
7+
/// </summary>
8+
/// <typeparam name="TEntity">实体类型</typeparam>
9+
/// <typeparam name="TDbContext">数据上下文类型</typeparam>
10+
public interface IEntityTypeConfiguration<TEntity, TDbContext> : IEntityTypeConfiguration<TEntity>
11+
where TEntity : class
12+
where TDbContext : DbContext
13+
{
14+
}
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using Bing.Reflection;
4+
using Microsoft.EntityFrameworkCore;
5+
6+
namespace Bing.EntityFrameworkCore.Internal;
7+
8+
/// <summary>
9+
/// 实体类配置类型查找器
10+
/// </summary>
11+
internal sealed class EntityConfigurationTypeFinder : IEntityConfigurationTypeFinder
12+
{
13+
/// <summary>
14+
/// 实体类型注册字典
15+
/// </summary>
16+
private static readonly IDictionary<Type, Dictionary<Type, EntityTypeConfigurationMetadata>> EntityRegistersDict;
17+
18+
/// <summary>
19+
/// 实体上下文映射字典
20+
/// </summary>
21+
private static readonly IDictionary<Type, Type> EntityMapDbContextDict;
22+
23+
/// <summary>
24+
/// 空元素字典
25+
/// </summary>
26+
private static readonly Dictionary<Type, EntityTypeConfigurationMetadata> Empty;
27+
28+
/// <summary>
29+
/// 数据上下文类型哈希表
30+
/// </summary>
31+
private static readonly HashSet<Type> DbContextTypes;
32+
33+
/// <summary>
34+
/// 所有程序集查找器
35+
/// </summary>
36+
private readonly IAllAssemblyFinder _allAssemblyFinder;
37+
38+
/// <summary>
39+
/// 静态构造函数
40+
/// </summary>
41+
static EntityConfigurationTypeFinder()
42+
{
43+
EntityRegistersDict= new Dictionary<Type, Dictionary<Type, EntityTypeConfigurationMetadata>>();
44+
EntityMapDbContextDict = new Dictionary<Type, Type>();
45+
Empty = new Dictionary<Type, EntityTypeConfigurationMetadata>();
46+
DbContextTypes = new HashSet<Type>();
47+
}
48+
49+
/// <summary>
50+
/// 初始化一个<see cref="EntityConfigurationTypeFinder"/>类型的实例
51+
/// </summary>
52+
/// <param name="allAssemblyFinder">所有程序集查找器</param>
53+
public EntityConfigurationTypeFinder(IAllAssemblyFinder allAssemblyFinder)
54+
{
55+
_allAssemblyFinder = allAssemblyFinder;
56+
}
57+
58+
/// <summary>
59+
/// 获取指定上下文类型的实体配置注册信息
60+
/// </summary>
61+
/// <param name="dbContextType">数据上下文类型</param>
62+
public Dictionary<Type, EntityTypeConfigurationMetadata> GetEntityTypeConfigurations(Type dbContextType)
63+
{
64+
return EntityMapDbContextDict.ContainsKey(dbContextType) ? EntityRegistersDict[dbContextType] : Empty;
65+
}
66+
67+
/// <summary>
68+
/// 获取实体类型所属的数据上下文类型
69+
/// </summary>
70+
/// <param name="entityType">实体类型</param>
71+
/// <returns>数据上下文类型</returns>
72+
public Type GetDbContextTypeForEntity(Type entityType)
73+
{
74+
if (!EntityMapDbContextDict.ContainsKey(entityType))
75+
throw new BingFrameworkException($"[{entityType}]未发现任何数据上下文实体映射配置");
76+
return EntityMapDbContextDict[entityType];
77+
}
78+
79+
/// <summary>
80+
/// 获取全部数据上下文的实体类型
81+
/// </summary>
82+
public IEnumerable<Type> GetAllDbContextTypes() => DbContextTypes;
83+
84+
/// <summary>
85+
/// 判断实体是否配置到 <see cref="DbContext"/> 当中
86+
/// </summary>
87+
/// <typeparam name="T">实体类型</typeparam>
88+
public bool HasDbContextForEntity<T>() => HasDbContextForEntity(typeof(T));
89+
90+
/// <summary>
91+
/// 判断实体是否配置到 <see cref="DbContext"/> 当中
92+
/// </summary>
93+
/// <param name="type">实体类型</param>
94+
public bool HasDbContextForEntity(Type type) => EntityMapDbContextDict.ContainsKey(type);
95+
}

0 commit comments

Comments
 (0)