mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
- 修复 Ado.Net 扩展方法的多表查询 bug;#592
This commit is contained in:
parent
21d597be09
commit
ade97b3f05
@ -512,14 +512,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>
|
||||||
|
64
FreeSql.Tests/FreeSql.Tests/Issues/592.cs
Normal file
64
FreeSql.Tests/FreeSql.Tests/Issues/592.cs
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
using FreeSql.DataAnnotations;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace FreeSql.Tests.Issues
|
||||||
|
{
|
||||||
|
public class _592
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void AdoNet()
|
||||||
|
{
|
||||||
|
using (var conn = g.mysql.Ado.MasterPool.Get())
|
||||||
|
{
|
||||||
|
var list = conn.Value.Select<park_sys_users, park_sys_userrole>()
|
||||||
|
.LeftJoin((rs, le) => rs.user_id == le.ur_userid)
|
||||||
|
.Where((rs, le) => rs.user_id > 0)
|
||||||
|
.Count();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Table(Name = "park_sys_users")]
|
||||||
|
public partial class park_sys_users
|
||||||
|
{
|
||||||
|
public park_sys_users()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[Column(IsIdentity = true)]
|
||||||
|
public int user_id { get; set; }
|
||||||
|
public string user_loginname { get; set; }
|
||||||
|
public string user_name { get; set; }
|
||||||
|
public string user_pwd { get; set; }
|
||||||
|
public int user_type { get; set; }
|
||||||
|
public string user_spotid { get; set; }
|
||||||
|
public string user_phone { get; set; }
|
||||||
|
public string user_email { get; set; }
|
||||||
|
public string user_remark { get; set; }
|
||||||
|
public int user_specialrole { get; set; }
|
||||||
|
public string user_createuser { get; set; }
|
||||||
|
public DateTime user_createtime { get; set; }
|
||||||
|
public int user_state { get; set; }
|
||||||
|
public int user_managetype { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public partial class park_sys_userrole
|
||||||
|
{
|
||||||
|
public park_sys_userrole()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public int ur_id { get; set; }
|
||||||
|
public int ur_userid { get; set; }
|
||||||
|
public int ur_roleid { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -195,63 +195,63 @@ namespace FreeSql
|
|||||||
/// <param name="that"></param>
|
/// <param name="that"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static ISelect<T1, T2> Select<T1, T2>(this IDbConnection that) where T1 : class where T2 : class =>
|
public static ISelect<T1, T2> Select<T1, T2>(this IDbConnection that) where T1 : class where T2 : class =>
|
||||||
GetCrud(that).Select<T1>().From<T2>((s, b) => s);
|
Select<T1>(that).From<T2>((s, b) => s);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 多表查询
|
/// 多表查询
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="that"></param>
|
/// <param name="that"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static ISelect<T1, T2, T3> Select<T1, T2, T3>(this IDbConnection that) where T1 : class where T2 : class where T3 : class =>
|
public static ISelect<T1, T2, T3> Select<T1, T2, T3>(this IDbConnection that) where T1 : class where T2 : class where T3 : class =>
|
||||||
GetCrud(that).Select<T1>().From<T2, T3>((s, b, c) => s);
|
Select<T1>(that).From<T2, T3>((s, b, c) => s);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 多表查询
|
/// 多表查询
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="that"></param>
|
/// <param name="that"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static ISelect<T1, T2, T3, T4> Select<T1, T2, T3, T4>(this IDbConnection that) where T1 : class where T2 : class where T3 : class where T4 : class =>
|
public static ISelect<T1, T2, T3, T4> Select<T1, T2, T3, T4>(this IDbConnection that) where T1 : class where T2 : class where T3 : class where T4 : class =>
|
||||||
GetCrud(that).Select<T1>().From<T2, T3, T4>((s, b, c, d) => s);
|
Select<T1>(that).From<T2, T3, T4>((s, b, c, d) => s);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 多表查询
|
/// 多表查询
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="that"></param>
|
/// <param name="that"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static ISelect<T1, T2, T3, T4, T5> Select<T1, T2, T3, T4, T5>(this IDbConnection that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class =>
|
public static ISelect<T1, T2, T3, T4, T5> Select<T1, T2, T3, T4, T5>(this IDbConnection that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class =>
|
||||||
GetCrud(that).Select<T1>().From<T2, T3, T4, T5>((s, b, c, d, e) => s);
|
Select<T1>(that).From<T2, T3, T4, T5>((s, b, c, d, e) => s);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 多表查询
|
/// 多表查询
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="that"></param>
|
/// <param name="that"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static ISelect<T1, T2, T3, T4, T5, T6> Select<T1, T2, T3, T4, T5, T6>(this IDbConnection that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class =>
|
public static ISelect<T1, T2, T3, T4, T5, T6> Select<T1, T2, T3, T4, T5, T6>(this IDbConnection that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class =>
|
||||||
GetCrud(that).Select<T1>().From<T2, T3, T4, T5, T6>((s, b, c, d, e, f) => s);
|
Select<T1>(that).From<T2, T3, T4, T5, T6>((s, b, c, d, e, f) => s);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 多表查询
|
/// 多表查询
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="that"></param>
|
/// <param name="that"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static ISelect<T1, T2, T3, T4, T5, T6, T7> Select<T1, T2, T3, T4, T5, T6, T7>(this IDbConnection that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class =>
|
public static ISelect<T1, T2, T3, T4, T5, T6, T7> Select<T1, T2, T3, T4, T5, T6, T7>(this IDbConnection that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class =>
|
||||||
GetCrud(that).Select<T1>().From<T2, T3, T4, T5, T6, T7>((s, b, c, d, e, f, g) => s);
|
Select<T1>(that).From<T2, T3, T4, T5, T6, T7>((s, b, c, d, e, f, g) => s);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 多表查询
|
/// 多表查询
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="that"></param>
|
/// <param name="that"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static ISelect<T1, T2, T3, T4, T5, T6, T7, T8> Select<T1, T2, T3, T4, T5, T6, T7, T8>(this IDbConnection that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class =>
|
public static ISelect<T1, T2, T3, T4, T5, T6, T7, T8> Select<T1, T2, T3, T4, T5, T6, T7, T8>(this IDbConnection that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class =>
|
||||||
GetCrud(that).Select<T1>().From<T2, T3, T4, T5, T6, T7, T8>((s, b, c, d, e, f, g, h) => s);
|
Select<T1>(that).From<T2, T3, T4, T5, T6, T7, T8>((s, b, c, d, e, f, g, h) => s);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 多表查询
|
/// 多表查询
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="that"></param>
|
/// <param name="that"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9> Select<T1, T2, T3, T4, T5, T6, T7, T8, T9>(this IDbConnection that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class where T9 : class =>
|
public static ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9> Select<T1, T2, T3, T4, T5, T6, T7, T8, T9>(this IDbConnection that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class where T9 : class =>
|
||||||
GetCrud(that).Select<T1>().From<T2, T3, T4, T5, T6, T7, T8, T9>((s, b, c, d, e, f, g, h, i) => s);
|
Select<T1>(that).From<T2, T3, T4, T5, T6, T7, T8, T9>((s, b, c, d, e, f, g, h, i) => s);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 多表查询
|
/// 多表查询
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="that"></param>
|
/// <param name="that"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Select<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(this IDbConnection that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class where T9 : class where T10 : class =>
|
public static ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Select<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(this IDbConnection that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class where T9 : class where T10 : class =>
|
||||||
GetCrud(that).Select<T1>().From<T2, T3, T4, T5, T6, T7, T8, T9, T10>((s, b, c, d, e, f, g, h, i, j) => s);
|
Select<T1>(that).From<T2, T3, T4, T5, T6, T7, T8, T9, T10>((s, b, c, d, e, f, g, h, i, j) => s);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IDbTransaction
|
#region IDbTransaction
|
||||||
@ -365,55 +365,55 @@ namespace FreeSql
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static ISelect<T1, T2> Select<T1, T2>(this IDbTransaction that) where T1 : class where T2 : class =>
|
public static ISelect<T1, T2> Select<T1, T2>(this IDbTransaction that) where T1 : class where T2 : class =>
|
||||||
GetCrud(that).Select<T1>().From<T2>((s, b) => s);
|
Select<T1>(that).From<T2>((s, b) => s);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 多表查询
|
/// 多表查询
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static ISelect<T1, T2, T3> Select<T1, T2, T3>(this IDbTransaction that) where T1 : class where T2 : class where T3 : class =>
|
public static ISelect<T1, T2, T3> Select<T1, T2, T3>(this IDbTransaction that) where T1 : class where T2 : class where T3 : class =>
|
||||||
GetCrud(that).Select<T1>().From<T2, T3>((s, b, c) => s);
|
Select<T1>(that).From<T2, T3>((s, b, c) => s);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 多表查询
|
/// 多表查询
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static ISelect<T1, T2, T3, T4> Select<T1, T2, T3, T4>(this IDbTransaction that) where T1 : class where T2 : class where T3 : class where T4 : class =>
|
public static ISelect<T1, T2, T3, T4> Select<T1, T2, T3, T4>(this IDbTransaction that) where T1 : class where T2 : class where T3 : class where T4 : class =>
|
||||||
GetCrud(that).Select<T1>().From<T2, T3, T4>((s, b, c, d) => s);
|
Select<T1>(that).From<T2, T3, T4>((s, b, c, d) => s);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 多表查询
|
/// 多表查询
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static ISelect<T1, T2, T3, T4, T5> Select<T1, T2, T3, T4, T5>(this IDbTransaction that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class =>
|
public static ISelect<T1, T2, T3, T4, T5> Select<T1, T2, T3, T4, T5>(this IDbTransaction that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class =>
|
||||||
GetCrud(that).Select<T1>().From<T2, T3, T4, T5>((s, b, c, d, e) => s);
|
Select<T1>(that).From<T2, T3, T4, T5>((s, b, c, d, e) => s);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 多表查询
|
/// 多表查询
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static ISelect<T1, T2, T3, T4, T5, T6> Select<T1, T2, T3, T4, T5, T6>(this IDbTransaction that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class =>
|
public static ISelect<T1, T2, T3, T4, T5, T6> Select<T1, T2, T3, T4, T5, T6>(this IDbTransaction that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class =>
|
||||||
GetCrud(that).Select<T1>().From<T2, T3, T4, T5, T6>((s, b, c, d, e, f) => s);
|
Select<T1>(that).From<T2, T3, T4, T5, T6>((s, b, c, d, e, f) => s);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 多表查询
|
/// 多表查询
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static ISelect<T1, T2, T3, T4, T5, T6, T7> Select<T1, T2, T3, T4, T5, T6, T7>(this IDbTransaction that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class =>
|
public static ISelect<T1, T2, T3, T4, T5, T6, T7> Select<T1, T2, T3, T4, T5, T6, T7>(this IDbTransaction that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class =>
|
||||||
GetCrud(that).Select<T1>().From<T2, T3, T4, T5, T6, T7>((s, b, c, d, e, f, g) => s);
|
Select<T1>(that).From<T2, T3, T4, T5, T6, T7>((s, b, c, d, e, f, g) => s);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 多表查询
|
/// 多表查询
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static ISelect<T1, T2, T3, T4, T5, T6, T7, T8> Select<T1, T2, T3, T4, T5, T6, T7, T8>(this IDbTransaction that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class =>
|
public static ISelect<T1, T2, T3, T4, T5, T6, T7, T8> Select<T1, T2, T3, T4, T5, T6, T7, T8>(this IDbTransaction that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class =>
|
||||||
GetCrud(that).Select<T1>().From<T2, T3, T4, T5, T6, T7, T8>((s, b, c, d, e, f, g, h) => s);
|
Select<T1>(that).From<T2, T3, T4, T5, T6, T7, T8>((s, b, c, d, e, f, g, h) => s);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 多表查询
|
/// 多表查询
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9> Select<T1, T2, T3, T4, T5, T6, T7, T8, T9>(this IDbTransaction that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class where T9 : class =>
|
public static ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9> Select<T1, T2, T3, T4, T5, T6, T7, T8, T9>(this IDbTransaction that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class where T9 : class =>
|
||||||
GetCrud(that).Select<T1>().From<T2, T3, T4, T5, T6, T7, T8, T9>((s, b, c, d, e, f, g, h, i) => s);
|
Select<T1>(that).From<T2, T3, T4, T5, T6, T7, T8, T9>((s, b, c, d, e, f, g, h, i) => s);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 多表查询
|
/// 多表查询
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Select<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(this IDbTransaction that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class where T9 : class where T10 : class =>
|
public static ISelect<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Select<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(this IDbTransaction that) where T1 : class where T2 : class where T3 : class where T4 : class where T5 : class where T6 : class where T7 : class where T8 : class where T9 : class where T10 : class =>
|
||||||
GetCrud(that).Select<T1>().From<T2, T3, T4, T5, T6, T7, T8, T9, T10>((s, b, c, d, e, f, g, h, i, j) => s);
|
Select<T1>(that).From<T2, T3, T4, T5, T6, T7, T8, T9, T10>((s, b, c, d, e, f, g, h, i, j) => s);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
Loading…
x
Reference in New Issue
Block a user