ICodeFirst 增加 ConfigEntity 方法,现实干净实体无特性的需求

This commit is contained in:
28810
2019-01-22 12:56:45 +08:00
parent 0bcacc706a
commit 4bf8d60361
22 changed files with 270 additions and 65 deletions

View File

@ -5,10 +5,26 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
public static class FreeSqlGlobalExtensions {
static Lazy<Dictionary<Type, bool>> dicIsNumberType = new Lazy<Dictionary<Type, bool>>(() => new Dictionary<Type, bool> {
[typeof(sbyte)] = true,
[typeof(short)] = true,
[typeof(int)] = true,
[typeof(long)] = true,
[typeof(byte)] = true,
[typeof(ushort)] = true,
[typeof(uint)] = true,
[typeof(ulong)] = true,
[typeof(double)] = true,
[typeof(float)] = true,
[typeof(decimal)] = true
});
public static bool IsNumberType(this Type that) => that == null ? false : dicIsNumberType.Value.ContainsKey(that.GenericTypeArguments.FirstOrDefault() ?? that);
/// <summary>
/// 测量两个经纬度的距离,返回单位:米
/// </summary>