- 增加 FreeSql.Extensions.JsonMap 扩展包,实现快速将对象映射为json字符串的方法;
- 优化 表达式解析未实现的错误提醒,如 $"";
This commit is contained in:
28810
2019-09-13 00:23:52 +08:00
parent 8520008b82
commit 62a095df8f
33 changed files with 249 additions and 53 deletions

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
<Version>0.9.12</Version>
<Version>0.9.15</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>YeXiangQin</Authors>
<Description>FreeSql 数据库实现,基于 PostgreSQL 9.5</Description>
@ -12,6 +12,7 @@
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageTags>FreeSql;ORM</PackageTags>
<PackageId>$(AssemblyName)</PackageId>
<PackageIconUrl>https://github.com/2881099/FreeSql/blob/master/logo.png</PackageIconUrl>
<Title>$(AssemblyName)</Title>
<IsPackable>true</IsPackable>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>

View File

@ -421,7 +421,7 @@ namespace FreeSql.PostgreSQL
case "Equals": return $"({left} = ({getExp(exp.Arguments[0])})::varchar)";
}
}
throw new Exception($"PostgreSQLExpression 未实现函数表达式 {exp} 解析");
return null;
}
public override string ExpressionLambdaToSqlCallMath(MethodCallExpression exp, ExpTSC tsc)
{
@ -449,7 +449,7 @@ namespace FreeSql.PostgreSQL
case "Atan2": return $"atan2({getExp(exp.Arguments[0])}, {getExp(exp.Arguments[1])})";
case "Truncate": return $"trunc({getExp(exp.Arguments[0])}, 0)";
}
throw new Exception($"PostgreSQLExpression 未实现函数表达式 {exp} 解析");
return null;
}
public override string ExpressionLambdaToSqlCallDateTime(MethodCallExpression exp, ExpTSC tsc)
{
@ -499,7 +499,7 @@ namespace FreeSql.PostgreSQL
case "ToString": return $"to_char({left}, 'YYYY-MM-DD HH24:MI:SS.US')";
}
}
throw new Exception($"PostgreSQLExpression 未实现函数表达式 {exp} 解析");
return null;
}
public override string ExpressionLambdaToSqlCallTimeSpan(MethodCallExpression exp, ExpTSC tsc)
{
@ -535,7 +535,7 @@ namespace FreeSql.PostgreSQL
case "ToString": return $"({left})::varchar";
}
}
throw new Exception($"PostgreSQLExpression 未实现函数表达式 {exp} 解析");
return null;
}
public override string ExpressionLambdaToSqlCallConvert(MethodCallExpression exp, ExpTSC tsc)
{
@ -561,7 +561,7 @@ namespace FreeSql.PostgreSQL
case "ToUInt64": return $"({getExp(exp.Arguments[0])})::int8";
}
}
throw new Exception($"PostgreSQLExpression 未实现函数表达式 {exp} 解析");
return null;
}
}
}

View File

@ -51,9 +51,9 @@ namespace FreeSql.PostgreSQL
var MethodJTokenParse = typeof(JToken).GetMethod("Parse", new[] { typeof(string) });
var MethodJObjectParse = typeof(JObject).GetMethod("Parse", new[] { typeof(string) });
var MethodJArrayParse = typeof(JArray).GetMethod("Parse", new[] { typeof(string) });
Utils.GetDataReaderValueBlockExpressionSwitchTypeFullName.Add((LabelTarget returnTarget, Expression valueExp, string typeFullName) =>
Utils.GetDataReaderValueBlockExpressionSwitchTypeFullName.Add((LabelTarget returnTarget, Expression valueExp, Type type) =>
{
switch (typeFullName)
switch (type.FullName)
{
case "Newtonsoft.Json.Linq.JToken": return Expression.Return(returnTarget, Expression.TypeAs(Expression.Call(MethodJTokenParse, Expression.Convert(valueExp, typeof(string))), typeof(JToken)));
case "Newtonsoft.Json.Linq.JObject": return Expression.Return(returnTarget, Expression.TypeAs(Expression.Call(MethodJObjectParse, Expression.Convert(valueExp, typeof(string))), typeof(JObject)));