添加项目文件。

This commit is contained in:
DK
2022-03-28 15:27:40 +08:00
parent b620fcb0cf
commit dc78fd1a09
898 changed files with 173053 additions and 0 deletions
@@ -0,0 +1,36 @@
using AutoMapper.EquivalencyExpression;
using IRaCIS.Core.Application.Service;
using Microsoft.Extensions.DependencyInjection;
namespace IRaCIS.Core.API
{
public static class AutoMapperSetup
{
public static void AddAutoMapperSetup(this IServiceCollection services)
{
services.AddAutoMapper(automapper =>
{
//AutoMapper.Collection.EntityFrameworkCore
automapper.AddCollectionMappers();
#region 使 IncludeMembers 使
//mapping an EntityFramework Core DbContext-object.
//automapper.UseEntityFrameworkCoreModel<IRaCISDBContext>(services);
//automapper.ForAllMaps((a, b) => b.ForAllMembers(opt => opt.Condition((src, dest, srcMember, desMenber) =>
//{
// //// Can test When Guid? -> Guid if source is null will change to Guid.Empty
// //Console.WriteLine("srcMember:" + srcMember + "desMenber:" + desMenber);
// return srcMember != null && srcMember.ToString() != Guid.Empty.ToString();
// // not want to map a null Guid? value to db Guid value
//})));
#endregion
}, typeof(QCConfig).Assembly);
}
}
}