忽略dll文件git

This commit is contained in:
“wanyongkang”
2023-07-29 10:19:42 +08:00
parent 7f97317bcc
commit b562aba2b1
3868 changed files with 63608 additions and 385427 deletions

View File

@@ -1,47 +0,0 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Microsoft.EntityFrameworkCore;
namespace Hncore.Infrastructure.EF
{
public static class AutoMapExtensions
{
private static object syncRoot = new object();
private static ConcurrentDictionary<IEntityMap, object> maps;
public static void AutoMap(this ModelBuilder modelBuilder, Type assType)
{
if (maps == null)
{
lock (syncRoot)
{
if (maps == null)
{
maps = new ConcurrentDictionary<IEntityMap, object>();
Type mappingInterface = typeof(IEntityMap<>);
var mappingTypes = assType.GetTypeInfo().Assembly.GetTypes()
.Where(x => !x.IsAbstract
&& x.GetInterfaces().Any(y => y.GetTypeInfo().IsGenericType
&& y.GetGenericTypeDefinition() ==
mappingInterface));
foreach (var map in mappingTypes.Select(Activator.CreateInstance).Cast<IEntityMap>())
{
maps.TryAdd(map, null);
}
}
}
}
foreach (var map in maps.Keys)
{
map.Map(modelBuilder);
}
}
}
}