ServiceCommon/FuncExpressionMapper/MapperHelper.cs
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using ServiceCommon.FuncExpressionMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
namespace ServiceCommon
{
/// <summary>
/// 映射帮助类
/// </summary>
public static class MapperHelper
{
public static MapperHelper<TSource, TTarget> Mapper<TSource, TTarget>()
{
var obj = new MapperHelper<TSource, TTarget>();
return obj;
}
}
static class MapperCache
{
/// <summary>
/// 获取映射规则缓存
/// </summary>
/// <returns></returns>
public static Dictionary<string, Dictionary<string, string>> GetMappingCache()
{
var Cache = ExpressionMapperCache.Cache;
if (Cache == null)
{
ExpressionMapperCache.Cache = new Dictionary<string, Dictionary<string, string>>();
FuncExpressionMapping.Init();
}
return Cache;
}
public static Dictionary<string, string> FindByKey(string sourceClassName, string targetClassName)
{
string key = string.Format("{0}>{1}", sourceClassName, targetClassName);
if (GetMappingCache().Keys.Contains(key))
{
return GetMappingCache()[key];
}
return null;
}
public static Dictionary<string, string> FindByKey(string sourceClassName)
{
string key = GetMappingCache().Keys.Where(w => w.StartsWith(string.Format("{0}>", sourceClassName))).FirstOrDefault();
后面还有 100 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
