mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-08-23 13:06:50 +08:00
Rename
This commit is contained in:
parent
6f50ac1b95
commit
05f3209812
@ -7,7 +7,8 @@ namespace OrmTest
|
|||||||
public class Program
|
public class Program
|
||||||
{
|
{
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
|
UnitStringToExp.Init();
|
||||||
//Each example will automatically create a table and can run independently.
|
//Each example will automatically create a table and can run independently.
|
||||||
//每个例子都会自动建表 并且可以独立运行
|
//每个例子都会自动建表 并且可以独立运行
|
||||||
_1_CodeFirst.Init();
|
_1_CodeFirst.Init();
|
||||||
|
@ -56,6 +56,15 @@ namespace OrmTest
|
|||||||
" it.Name as Name" }
|
" it.Name as Name" }
|
||||||
, 10)
|
, 10)
|
||||||
.ToListAsync().GetAwaiter().GetResult();
|
.ToListAsync().GetAwaiter().GetResult();
|
||||||
|
|
||||||
|
var userInfo5 = db.Queryable<Order>()
|
||||||
|
.Select("it",
|
||||||
|
new List<string>()
|
||||||
|
{ "it.Id as userId",
|
||||||
|
" {0} as id",
|
||||||
|
" it.Name as Name" }
|
||||||
|
, 10)
|
||||||
|
.InSingleAsync(1).GetAwaiter().GetResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Test03()
|
private static void Test03()
|
||||||
|
@ -11,7 +11,7 @@ namespace SqlSugar
|
|||||||
internal object MethodInfos { get; set; }
|
internal object MethodInfos { get; set; }
|
||||||
internal SqlSugarProvider Context { get; set; }
|
internal SqlSugarProvider Context { get; set; }
|
||||||
|
|
||||||
public DeleteNavMethodInfo IncludeByNameString(string navMemberName, DeleteNavOptions updateNavOptions = null)
|
public DeleteNavMethodInfo IncludeByNameString(string navMemberName, DeleteNavOptions deleteNavOptions = null)
|
||||||
{
|
{
|
||||||
var type = MethodInfos.GetType().GetGenericArguments()[0];
|
var type = MethodInfos.GetType().GetGenericArguments()[0];
|
||||||
var entityInfo = this.Context.EntityMaintenance.GetEntityInfo(type);
|
var entityInfo = this.Context.EntityMaintenance.GetEntityInfo(type);
|
||||||
@ -20,11 +20,11 @@ namespace SqlSugar
|
|||||||
Expression exp = UtilMethods.GetIncludeExpression(navMemberName, entityInfo, out properyItemType, out isList);
|
Expression exp = UtilMethods.GetIncludeExpression(navMemberName, entityInfo, out properyItemType, out isList);
|
||||||
var method = this.MethodInfos.GetType().GetMyMethod("Include", 2, isList)
|
var method = this.MethodInfos.GetType().GetMyMethod("Include", 2, isList)
|
||||||
.MakeGenericMethod(properyItemType);
|
.MakeGenericMethod(properyItemType);
|
||||||
var obj = method.Invoke(this.MethodInfos, new object[] { exp, updateNavOptions });
|
var obj = method.Invoke(this.MethodInfos, new object[] { exp, deleteNavOptions });
|
||||||
this.MethodInfos = obj;
|
this.MethodInfos = obj;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
public DeleteNavMethodInfo ThenIncludeByNameString(string navMemberName, DeleteNavOptions updateNavOptions = null)
|
public DeleteNavMethodInfo ThenIncludeByNameString(string navMemberName, DeleteNavOptions deleteNavOptions = null)
|
||||||
{
|
{
|
||||||
var type = MethodInfos.GetType().GetGenericArguments()[1];
|
var type = MethodInfos.GetType().GetGenericArguments()[1];
|
||||||
var entityInfo = this.Context.EntityMaintenance.GetEntityInfo(type);
|
var entityInfo = this.Context.EntityMaintenance.GetEntityInfo(type);
|
||||||
@ -33,7 +33,7 @@ namespace SqlSugar
|
|||||||
Expression exp = UtilMethods.GetIncludeExpression(navMemberName, entityInfo, out properyItemType, out isList);
|
Expression exp = UtilMethods.GetIncludeExpression(navMemberName, entityInfo, out properyItemType, out isList);
|
||||||
var method = this.MethodInfos.GetType().GetMyMethod("ThenInclude", 2, isList)
|
var method = this.MethodInfos.GetType().GetMyMethod("ThenInclude", 2, isList)
|
||||||
.MakeGenericMethod(properyItemType);
|
.MakeGenericMethod(properyItemType);
|
||||||
var obj = method.Invoke(this.MethodInfos, new object[] { exp, updateNavOptions });
|
var obj = method.Invoke(this.MethodInfos, new object[] { exp, deleteNavOptions });
|
||||||
this.MethodInfos = obj;
|
this.MethodInfos = obj;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,39 @@ namespace SqlSugar
|
|||||||
public class DynamicCoreSelectModel
|
public class DynamicCoreSelectModel
|
||||||
{
|
{
|
||||||
public object Value { get; set; }
|
public object Value { get; set; }
|
||||||
|
public object InSingle(object value)
|
||||||
|
{
|
||||||
|
if (Value is null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Value cannot be null.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var method = Value.GetType().GetMyMethod("InSingle", 1);
|
||||||
|
if (method == null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("The Value object does not have an InSingle method with one parameter.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return method.Invoke(Value, new object[] { value });
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<object> InSingleAsync(object value)
|
||||||
|
{
|
||||||
|
if (Value is null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("Value cannot be null.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var method = Value.GetType().GetMyMethod("InSingleAsync", 1);
|
||||||
|
if (method == null)
|
||||||
|
{
|
||||||
|
throw new InvalidOperationException("The Value object does not have an InSingleAsync method with one parameter.");
|
||||||
|
}
|
||||||
|
|
||||||
|
var task = (Task)method.Invoke(Value, new object[] { value });
|
||||||
|
return await GetTask(task).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public object ToList()
|
public object ToList()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user