mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 02:32:50 +08:00
- 修复 <object> + AsType + (a as BaseEntity) 解析问题;#1427
This commit is contained in:
parent
6fedb20673
commit
6b84bd79ae
@ -800,14 +800,5 @@
|
|||||||
<param name="that"></param>
|
<param name="that"></param>
|
||||||
<returns></returns>
|
<returns></returns>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:Microsoft.Extensions.DependencyInjection.FreeSqlRepositoryDependencyInjection.AddFreeRepository(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Action{FreeSql.FluentDataFilter},System.Reflection.Assembly[])">
|
|
||||||
<summary>
|
|
||||||
批量注入 Repository,可以参考代码自行调整
|
|
||||||
</summary>
|
|
||||||
<param name="services"></param>
|
|
||||||
<param name="globalDataFilter"></param>
|
|
||||||
<param name="assemblies"></param>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
</members>
|
</members>
|
||||||
</doc>
|
</doc>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using FreeSql.DataAnnotations;
|
using FreeSql.DataAnnotations;
|
||||||
using FreeSql.Tests.DataContext.SqlServer;
|
using FreeSql.Tests.DataContext.SqlServer;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -30,6 +30,25 @@ namespace FreeSql.Tests.SqlServer
|
|||||||
public DateTime CreateTime { get; set; }
|
public DateTime CreateTime { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abstract class EntityBase
|
||||||
|
{
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
|
class SysDictionnary : EntityBase
|
||||||
|
{
|
||||||
|
public string Name { get; set; }
|
||||||
|
}
|
||||||
|
[Fact]
|
||||||
|
public void AsType()
|
||||||
|
{
|
||||||
|
var fsql = g.sqlserver;
|
||||||
|
|
||||||
|
var delsid = new[] { 1, 2, 3, 4 };
|
||||||
|
var sqlsss22222 = fsql.Delete<object>().AsType(typeof(SysDictionnary))
|
||||||
|
.Where(o => delsid.Contains((o as EntityBase).Id))
|
||||||
|
.ToSql();
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void Dywhere()
|
public void Dywhere()
|
||||||
{
|
{
|
||||||
|
@ -1748,7 +1748,7 @@ namespace FreeSql.Internal
|
|||||||
if (oper2.NodeType == ExpressionType.Parameter)
|
if (oper2.NodeType == ExpressionType.Parameter)
|
||||||
{
|
{
|
||||||
var oper2Parm = oper2 as ParameterExpression;
|
var oper2Parm = oper2 as ParameterExpression;
|
||||||
if (exp2.Type.IsAbstract || exp2.Type.IsInterface || exp2.Type.IsAssignableFrom(oper2Parm.Type))
|
if (oper2Parm.Type != typeof(object) && (exp2.Type.IsAbstract || exp2.Type.IsInterface || exp2.Type.IsAssignableFrom(oper2Parm.Type)))
|
||||||
expStack.Push(oper2Parm);
|
expStack.Push(oper2Parm);
|
||||||
else if (oper2Parm.Type != typeof(object) && oper2Parm.Type.IsAssignableFrom(exp2.Type))
|
else if (oper2Parm.Type != typeof(object) && oper2Parm.Type.IsAssignableFrom(exp2.Type))
|
||||||
expStack.Push(oper2Parm);
|
expStack.Push(oper2Parm);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user