2025-04-24 18:31:27 +08:00

57 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
namespace SqlSugar
{
public class SubFromTable : ISubOperation
{
public bool HasWhere
{
get; set;
}
public string Name
{
get
{
return "Subqueryable";
}
}
public Expression Expression
{
get; set;
}
public int Sort
{
get
{
return 300;
}
}
public ExpressionContext Context
{
get;set;
}
public string GetValue(Expression expression)
{
var exp = expression as MethodCallExpression;
var resType = exp.Method.ReturnType;
var entityType = resType.GetGenericArguments().First();
var name = entityType.Name;
if (this.Context.InitMappingInfo != null)
{
this.Context.InitMappingInfo(entityType);
this.Context.RefreshMapping();
}
return "FROM "+this.Context.GetTranslationTableName(name, true);
}
}
}