mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-24 07:22:57 +08:00
Update QueryableByObject.As
This commit is contained in:
parent
a324c353a3
commit
a0c648f4cc
@ -4,6 +4,7 @@ using System.Data;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
|
||||||
@ -30,6 +31,10 @@ namespace SqlSugar
|
|||||||
public QueryMethodInfo AS(string tableName)
|
public QueryMethodInfo AS(string tableName)
|
||||||
{
|
{
|
||||||
string shortName = $"{tableName}_1";
|
string shortName = $"{tableName}_1";
|
||||||
|
if (!Regex.IsMatch(shortName, @"^\w+$"))
|
||||||
|
{
|
||||||
|
shortName = "maintable";
|
||||||
|
}
|
||||||
var method = QueryableObj.GetType().GetMyMethod("AS", 2, typeof(string), typeof(string));
|
var method = QueryableObj.GetType().GetMyMethod("AS", 2, typeof(string), typeof(string));
|
||||||
this.QueryableObj = method.Invoke(QueryableObj, new object[] { tableName, shortName });
|
this.QueryableObj = method.Invoke(QueryableObj, new object[] { tableName, shortName });
|
||||||
return this;
|
return this;
|
||||||
|
Loading…
Reference in New Issue
Block a user