mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 10:42:52 +08:00
- 修复 .net5 单文本部署读取注释报错;
This commit is contained in:
parent
9dd63f165b
commit
44e6eb2979
12
Examples/dbcontext_01/.config/dotnet-tools.json
Normal file
12
Examples/dbcontext_01/.config/dotnet-tools.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"dotnet-ef": {
|
||||
"version": "5.0.0",
|
||||
"commands": [
|
||||
"dotnet-ef"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
https://go.microsoft.com/fwlink/?LinkID=208121.
|
||||
-->
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<DeleteExistingFiles>True</DeleteExistingFiles>
|
||||
<ExcludeApp_Data>False</ExcludeApp_Data>
|
||||
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
|
||||
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
|
||||
<LastUsedPlatform>Any CPU</LastUsedPlatform>
|
||||
<PublishProvider>FileSystem</PublishProvider>
|
||||
<PublishUrl>bin\Release\net5.0\publish\</PublishUrl>
|
||||
<WebPublishMethod>FileSystem</WebPublishMethod>
|
||||
<SiteUrlToLaunchAfterPublish />
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<RuntimeIdentifier>win-x86</RuntimeIdentifier>
|
||||
<ProjectGuid>690f89e0-a721-423f-8f5d-d262f73235ea</ProjectGuid>
|
||||
<SelfContained>true</SelfContained>
|
||||
<PublishSingleFile>True</PublishSingleFile>
|
||||
</PropertyGroup>
|
||||
</Project>
|
@ -3,6 +3,11 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
|
||||
<UserSecretsId>f2b3f543-99d4-4be7-b894-6df3c6cbad7e</UserSecretsId>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DocumentationFile>dbcontext_01.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -12,7 +17,7 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Extensions\FreeSql.Extensions.LazyLoading\FreeSql.Extensions.LazyLoading.csproj" />
|
||||
<ProjectReference Include="..\..\FreeSql.DbContext\FreeSql.DbContext.csproj" />
|
||||
<ProjectReference Include="..\..\Providers\FreeSql.Provider.MySql\FreeSql.Provider.MySql.csproj" />
|
||||
<ProjectReference Include="..\..\Providers\FreeSql.Provider.MySqlConnector\FreeSql.Provider.MySqlConnector.csproj" />
|
||||
<ProjectReference Include="..\..\Providers\FreeSql.Provider.Sqlite\FreeSql.Provider.Sqlite.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
8
Examples/dbcontext_01/dbcontext_01.xml
Normal file
8
Examples/dbcontext_01/dbcontext_01.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>dbcontext_01</name>
|
||||
</assembly>
|
||||
<members>
|
||||
</members>
|
||||
</doc>
|
@ -85,6 +85,7 @@ namespace FreeSql
|
||||
/// 插入数据,传入实体
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <param name="that"></param>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static IInsert<T1> Insert<T1>(this IDbConnection that, T1 source) where T1 : class => GetCrud(that).Insert<T1>(source).WithConnection(that as DbConnection);
|
||||
@ -92,6 +93,7 @@ namespace FreeSql
|
||||
/// 插入数据,传入实体数组
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <param name="that"></param>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static IInsert<T1> Insert<T1>(this IDbConnection that, T1[] source) where T1 : class => GetCrud(that).Insert<T1>(source).WithConnection(that as DbConnection);
|
||||
@ -99,6 +101,7 @@ namespace FreeSql
|
||||
/// 插入数据,传入实体集合
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <param name="that"></param>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static IInsert<T1> Insert<T1>(this IDbConnection that, List<T1> source) where T1 : class => GetCrud(that).Insert<T1>(source).WithConnection(that as DbConnection);
|
||||
@ -106,6 +109,7 @@ namespace FreeSql
|
||||
/// 插入数据,传入实体集合
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <param name="that"></param>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static IInsert<T1> Insert<T1>(this IDbConnection that, IEnumerable<T1> source) where T1 : class => GetCrud(that).Insert<T1>(source).WithConnection(that as DbConnection);
|
||||
@ -125,6 +129,7 @@ namespace FreeSql
|
||||
/// 注意区别:FreeSql.Repository 仓储也有 InsertOrUpdate 方法(不依赖数据库特性)
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <param name="that"></param>
|
||||
/// <returns></returns>
|
||||
public static IInsertOrUpdate<T1> InsertOrUpdate<T1>(this IDbConnection that) where T1 : class => GetCrud(that).InsertOrUpdate<T1>().WithConnection(that as DbConnection);
|
||||
|
||||
@ -132,12 +137,14 @@ namespace FreeSql
|
||||
/// 修改数据
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <param name="that"></param>
|
||||
/// <returns></returns>
|
||||
public static IUpdate<T1> Update<T1>(this IDbConnection that) where T1 : class => GetCrud(that).Update<T1>().WithConnection(that as DbConnection);
|
||||
/// <summary>
|
||||
/// 修改数据,传入动态条件,如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1}
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <param name="that"></param>
|
||||
/// <param name="dywhere">主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合</param>
|
||||
/// <returns></returns>
|
||||
public static IUpdate<T1> Update<T1>(this IDbConnection that, object dywhere) where T1 : class => GetCrud(that).Update<T1>(dywhere).WithConnection(that as DbConnection);
|
||||
@ -146,12 +153,14 @@ namespace FreeSql
|
||||
/// 查询数据
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <param name="that"></param>
|
||||
/// <returns></returns>
|
||||
public static ISelect<T1> Select<T1>(this IDbConnection that) where T1 : class => GetCrud(that).Select<T1>().WithConnection(that as DbConnection);
|
||||
/// <summary>
|
||||
/// 查询数据,传入动态条件,如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1}
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <param name="that"></param>
|
||||
/// <param name="dywhere">主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合</param>
|
||||
/// <returns></returns>
|
||||
public static ISelect<T1> Select<T1>(this IDbConnection that, object dywhere) where T1 : class => GetCrud(that).Select<T1>(dywhere).WithConnection(that as DbConnection);
|
||||
@ -160,12 +169,14 @@ namespace FreeSql
|
||||
/// 删除数据
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <param name="that"></param>
|
||||
/// <returns></returns>
|
||||
public static IDelete<T1> Delete<T1>(this IDbConnection that) where T1 : class => GetCrud(that).Delete<T1>().WithConnection(that as DbConnection);
|
||||
/// <summary>
|
||||
/// 删除数据,传入动态条件,如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1}
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <param name="that"></param>
|
||||
/// <param name="dywhere">主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合</param>
|
||||
/// <returns></returns>
|
||||
public static IDelete<T1> Delete<T1>(this IDbConnection that, object dywhere) where T1 : class => GetCrud(that).Delete<T1>(dywhere).WithConnection(that as DbConnection);
|
||||
@ -173,54 +184,63 @@ namespace FreeSql
|
||||
/// <summary>
|
||||
/// 多表查询
|
||||
/// </summary>
|
||||
/// <param name="that"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
/// <summary>
|
||||
/// 多表查询
|
||||
/// </summary>
|
||||
/// <param name="that"></param>
|
||||
/// <returns></returns>
|
||||
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);
|
||||
/// <summary>
|
||||
/// 多表查询
|
||||
/// </summary>
|
||||
/// <param name="that"></param>
|
||||
/// <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 =>
|
||||
GetCrud(that).Select<T1>().From<T2, T3, T4>((s, b, c, d) => s);
|
||||
/// <summary>
|
||||
/// 多表查询
|
||||
/// </summary>
|
||||
/// <param name="that"></param>
|
||||
/// <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 =>
|
||||
GetCrud(that).Select<T1>().From<T2, T3, T4, T5>((s, b, c, d, e) => s);
|
||||
/// <summary>
|
||||
/// 多表查询
|
||||
/// </summary>
|
||||
/// <param name="that"></param>
|
||||
/// <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 =>
|
||||
GetCrud(that).Select<T1>().From<T2, T3, T4, T5, T6>((s, b, c, d, e, f) => s);
|
||||
/// <summary>
|
||||
/// 多表查询
|
||||
/// </summary>
|
||||
/// <param name="that"></param>
|
||||
/// <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 =>
|
||||
GetCrud(that).Select<T1>().From<T2, T3, T4, T5, T6, T7>((s, b, c, d, e, f, g) => s);
|
||||
/// <summary>
|
||||
/// 多表查询
|
||||
/// </summary>
|
||||
/// <param name="that"></param>
|
||||
/// <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 =>
|
||||
GetCrud(that).Select<T1>().From<T2, T3, T4, T5, T6, T7, T8>((s, b, c, d, e, f, g, h) => s);
|
||||
/// <summary>
|
||||
/// 多表查询
|
||||
/// </summary>
|
||||
/// <param name="that"></param>
|
||||
/// <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 =>
|
||||
GetCrud(that).Select<T1>().From<T2, T3, T4, T5, T6, T7, T8, T9>((s, b, c, d, e, f, g, h, i) => s);
|
||||
/// <summary>
|
||||
/// 多表查询
|
||||
/// </summary>
|
||||
/// <param name="that"></param>
|
||||
/// <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 =>
|
||||
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);
|
||||
@ -237,6 +257,7 @@ namespace FreeSql
|
||||
/// 插入数据,传入实体
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <param name="that"></param>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static IInsert<T1> Insert<T1>(this IDbTransaction that, T1 source) where T1 : class => GetCrud(that).Insert<T1>(source).WithTransaction(that as DbTransaction);
|
||||
@ -244,6 +265,7 @@ namespace FreeSql
|
||||
/// 插入数据,传入实体数组
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <param name="that"></param>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static IInsert<T1> Insert<T1>(this IDbTransaction that, T1[] source) where T1 : class => GetCrud(that).Insert<T1>(source).WithTransaction(that as DbTransaction);
|
||||
@ -251,6 +273,7 @@ namespace FreeSql
|
||||
/// 插入数据,传入实体集合
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <param name="that"></param>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static IInsert<T1> Insert<T1>(this IDbTransaction that, List<T1> source) where T1 : class => GetCrud(that).Insert<T1>(source).WithTransaction(that as DbTransaction);
|
||||
@ -258,6 +281,7 @@ namespace FreeSql
|
||||
/// 插入数据,传入实体集合
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <param name="that"></param>
|
||||
/// <param name="source"></param>
|
||||
/// <returns></returns>
|
||||
public static IInsert<T1> Insert<T1>(this IDbTransaction that, IEnumerable<T1> source) where T1 : class => GetCrud(that).Insert<T1>(source).WithTransaction(that as DbTransaction);
|
||||
@ -276,6 +300,7 @@ namespace FreeSql
|
||||
/// 注意区别:FreeSql.Repository 仓储也有 InsertOrUpdate 方法(不依赖数据库特性)
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <param name="that"></param>
|
||||
/// <returns></returns>
|
||||
public static IInsertOrUpdate<T1> InsertOrUpdate<T1>(this IDbTransaction that) where T1 : class => GetCrud(that).InsertOrUpdate<T1>().WithTransaction(that as DbTransaction);
|
||||
|
||||
@ -283,12 +308,14 @@ namespace FreeSql
|
||||
/// 修改数据
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <param name="that"></param>
|
||||
/// <returns></returns>
|
||||
public static IUpdate<T1> Update<T1>(this IDbTransaction that) where T1 : class => GetCrud(that).Update<T1>().WithTransaction(that as DbTransaction);
|
||||
/// <summary>
|
||||
/// 修改数据,传入动态条件,如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1}
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <param name="that"></param>
|
||||
/// <param name="dywhere">主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合</param>
|
||||
/// <returns></returns>
|
||||
public static IUpdate<T1> Update<T1>(this IDbTransaction that, object dywhere) where T1 : class => GetCrud(that).Update<T1>(dywhere).WithTransaction(that as DbTransaction);
|
||||
@ -297,12 +324,14 @@ namespace FreeSql
|
||||
/// 查询数据
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <param name="that"></param>
|
||||
/// <returns></returns>
|
||||
public static ISelect<T1> Select<T1>(this IDbTransaction that) where T1 : class => GetCrud(that).Select<T1>().WithTransaction(that as DbTransaction);
|
||||
/// <summary>
|
||||
/// 查询数据,传入动态条件,如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1}
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <param name="that"></param>
|
||||
/// <param name="dywhere">主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合</param>
|
||||
/// <returns></returns>
|
||||
public static ISelect<T1> Select<T1>(this IDbTransaction that, object dywhere) where T1 : class => GetCrud(that).Select<T1>(dywhere).WithTransaction(that as DbTransaction);
|
||||
@ -311,12 +340,14 @@ namespace FreeSql
|
||||
/// 删除数据
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <param name="that"></param>
|
||||
/// <returns></returns>
|
||||
public static IDelete<T1> Delete<T1>(this IDbTransaction that) where T1 : class => GetCrud(that).Delete<T1>().WithTransaction(that as DbTransaction);
|
||||
/// <summary>
|
||||
/// 删除数据,传入动态条件,如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1}
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <param name="that"></param>
|
||||
/// <param name="dywhere">主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合</param>
|
||||
/// <returns></returns>
|
||||
public static IDelete<T1> Delete<T1>(this IDbTransaction that, object dywhere) where T1 : class => GetCrud(that).Delete<T1>(dywhere).WithTransaction(that as DbTransaction);
|
||||
|
@ -56,6 +56,7 @@ public static partial class FreeSqlGlobalExtensions
|
||||
/// 获取 Type 的原始 c# 文本表示
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="isNameSpace"></param>
|
||||
/// <returns></returns>
|
||||
internal static string DisplayCsharp(this Type type, bool isNameSpace = true)
|
||||
{
|
||||
@ -88,14 +89,14 @@ public static partial class FreeSqlGlobalExtensions
|
||||
if (genericParameters.Any() == false)
|
||||
return sb.Append(type.Name).ToString();
|
||||
|
||||
sb.Append(type.Name.Remove(type.Name.IndexOf('`'))).Append("<");
|
||||
sb.Append(type.Name.Remove(type.Name.IndexOf('`'))).Append('<');
|
||||
var genericTypeIndex = 0;
|
||||
foreach (var genericType in genericParameters)
|
||||
{
|
||||
if (genericTypeIndex++ > 0) sb.Append(", ");
|
||||
sb.Append(DisplayCsharp(genericType, true));
|
||||
}
|
||||
return sb.Append(">").ToString();
|
||||
return sb.Append('>').ToString();
|
||||
}
|
||||
internal static string DisplayCsharp(this MethodInfo method, bool isOverride)
|
||||
{
|
||||
@ -109,7 +110,7 @@ public static partial class FreeSqlGlobalExtensions
|
||||
if (method.IsStatic) sb.Append("static ");
|
||||
if (method.IsAbstract && method.DeclaringType.IsInterface == false) sb.Append("abstract ");
|
||||
if (method.IsVirtual && method.DeclaringType.IsInterface == false) sb.Append(isOverride ? "override " : "virtual ");
|
||||
sb.Append(method.ReturnType.DisplayCsharp()).Append(" ").Append(method.Name);
|
||||
sb.Append(method.ReturnType.DisplayCsharp()).Append(' ').Append(method.Name);
|
||||
|
||||
var genericParameters = method.GetGenericArguments();
|
||||
if (method.DeclaringType.IsNested && method.DeclaringType.DeclaringType.IsGenericType)
|
||||
@ -121,11 +122,11 @@ public static partial class FreeSqlGlobalExtensions
|
||||
genericParameters = dic.Values.ToArray();
|
||||
}
|
||||
if (genericParameters.Any())
|
||||
sb.Append("<")
|
||||
sb.Append('<')
|
||||
.Append(string.Join(", ", genericParameters.Select(a => a.DisplayCsharp())))
|
||||
.Append(">");
|
||||
.Append('>');
|
||||
|
||||
sb.Append("(").Append(string.Join(", ", method.GetParameters().Select(a => $"{a.ParameterType.DisplayCsharp()} {a.Name}"))).Append(")");
|
||||
sb.Append('(').Append(string.Join(", ", method.GetParameters().Select(a => $"{a.ParameterType.DisplayCsharp()} {a.Name}"))).Append(')');
|
||||
return sb.ToString();
|
||||
}
|
||||
public static object CreateInstanceGetDefaultValue(this Type that)
|
||||
@ -283,7 +284,10 @@ public static partial class FreeSqlGlobalExtensions
|
||||
/// 示例:new List<Song>(new[] { song1, song2, song3 }).IncludeMany(g.sqlite, a => a.Tags);<para></para>
|
||||
/// 文档:https://github.com/2881099/FreeSql/wiki/%e8%b4%aa%e5%a9%aa%e5%8a%a0%e8%bd%bd#%E5%AF%BC%E8%88%AA%E5%B1%9E%E6%80%A7-onetomanymanytomany
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <typeparam name="TNavigate"></typeparam>
|
||||
/// <param name="list"></param>
|
||||
/// <param name="orm"></param>
|
||||
/// <param name="navigateSelector">选择一个集合的导航属性,如: .IncludeMany(a => a.Tags)<para></para>
|
||||
/// 可以 .Where 设置临时的关系映射,如: .IncludeMany(a => a.Tags.Where(tag => tag.TypeId == a.Id))<para></para>
|
||||
/// 可以 .Take(5) 每个子集合只取5条,如: .IncludeMany(a => a.Tags.Take(5))<para></para>
|
||||
@ -538,7 +542,7 @@ JOIN {select._commonUtils.QuoteSqlName(tb.DbName)} a ON cte_tbc.cte_id = a.{sele
|
||||
.OrderBy(up, "a.cte_level desc") as Select1Provider<T1>;
|
||||
|
||||
var nsselsb = new StringBuilder();
|
||||
if (AdoProvider.IsFromSlave(select._select) == false) nsselsb.Append(" "); //读写分离规则,如果强制读主库,则在前面加个空格
|
||||
if (AdoProvider.IsFromSlave(select._select) == false) nsselsb.Append(' '); //读写分离规则,如果强制读主库,则在前面加个空格
|
||||
nsselsb.Append("WITH ");
|
||||
switch (select._orm.Ado.DataType)
|
||||
{
|
||||
|
@ -635,6 +635,7 @@
|
||||
插入数据,传入实体
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="that"></param>
|
||||
<param name="source"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
@ -643,6 +644,7 @@
|
||||
插入数据,传入实体数组
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="that"></param>
|
||||
<param name="source"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
@ -651,6 +653,7 @@
|
||||
插入数据,传入实体集合
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="that"></param>
|
||||
<param name="source"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
@ -659,6 +662,7 @@
|
||||
插入数据,传入实体集合
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="that"></param>
|
||||
<param name="source"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
@ -678,6 +682,7 @@
|
||||
注意区别:FreeSql.Repository 仓储也有 InsertOrUpdate 方法(不依赖数据库特性)
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="that"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.AdoNetExtensions.Update``1(System.Data.IDbConnection)">
|
||||
@ -685,6 +690,7 @@
|
||||
修改数据
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="that"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.AdoNetExtensions.Update``1(System.Data.IDbConnection,System.Object)">
|
||||
@ -692,6 +698,7 @@
|
||||
修改数据,传入动态条件,如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1}
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="that"></param>
|
||||
<param name="dywhere">主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
@ -700,6 +707,7 @@
|
||||
查询数据
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="that"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.AdoNetExtensions.Select``1(System.Data.IDbConnection,System.Object)">
|
||||
@ -707,6 +715,7 @@
|
||||
查询数据,传入动态条件,如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1}
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="that"></param>
|
||||
<param name="dywhere">主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
@ -715,6 +724,7 @@
|
||||
删除数据
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="that"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.AdoNetExtensions.Delete``1(System.Data.IDbConnection,System.Object)">
|
||||
@ -722,6 +732,7 @@
|
||||
删除数据,传入动态条件,如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1}
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="that"></param>
|
||||
<param name="dywhere">主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
@ -729,54 +740,63 @@
|
||||
<summary>
|
||||
多表查询
|
||||
</summary>
|
||||
<param name="that"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.AdoNetExtensions.Select``3(System.Data.IDbConnection)">
|
||||
<summary>
|
||||
多表查询
|
||||
</summary>
|
||||
<param name="that"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.AdoNetExtensions.Select``4(System.Data.IDbConnection)">
|
||||
<summary>
|
||||
多表查询
|
||||
</summary>
|
||||
<param name="that"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.AdoNetExtensions.Select``5(System.Data.IDbConnection)">
|
||||
<summary>
|
||||
多表查询
|
||||
</summary>
|
||||
<param name="that"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.AdoNetExtensions.Select``6(System.Data.IDbConnection)">
|
||||
<summary>
|
||||
多表查询
|
||||
</summary>
|
||||
<param name="that"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.AdoNetExtensions.Select``7(System.Data.IDbConnection)">
|
||||
<summary>
|
||||
多表查询
|
||||
</summary>
|
||||
<param name="that"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.AdoNetExtensions.Select``8(System.Data.IDbConnection)">
|
||||
<summary>
|
||||
多表查询
|
||||
</summary>
|
||||
<param name="that"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.AdoNetExtensions.Select``9(System.Data.IDbConnection)">
|
||||
<summary>
|
||||
多表查询
|
||||
</summary>
|
||||
<param name="that"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.AdoNetExtensions.Select``10(System.Data.IDbConnection)">
|
||||
<summary>
|
||||
多表查询
|
||||
</summary>
|
||||
<param name="that"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.AdoNetExtensions.Insert``1(System.Data.IDbTransaction)">
|
||||
@ -791,6 +811,7 @@
|
||||
插入数据,传入实体
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="that"></param>
|
||||
<param name="source"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
@ -799,6 +820,7 @@
|
||||
插入数据,传入实体数组
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="that"></param>
|
||||
<param name="source"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
@ -807,6 +829,7 @@
|
||||
插入数据,传入实体集合
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="that"></param>
|
||||
<param name="source"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
@ -815,6 +838,7 @@
|
||||
插入数据,传入实体集合
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="that"></param>
|
||||
<param name="source"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
@ -833,6 +857,7 @@
|
||||
注意区别:FreeSql.Repository 仓储也有 InsertOrUpdate 方法(不依赖数据库特性)
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="that"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.AdoNetExtensions.Update``1(System.Data.IDbTransaction)">
|
||||
@ -840,6 +865,7 @@
|
||||
修改数据
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="that"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.AdoNetExtensions.Update``1(System.Data.IDbTransaction,System.Object)">
|
||||
@ -847,6 +873,7 @@
|
||||
修改数据,传入动态条件,如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1}
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="that"></param>
|
||||
<param name="dywhere">主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
@ -855,6 +882,7 @@
|
||||
查询数据
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="that"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.AdoNetExtensions.Select``1(System.Data.IDbTransaction,System.Object)">
|
||||
@ -862,6 +890,7 @@
|
||||
查询数据,传入动态条件,如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1}
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="that"></param>
|
||||
<param name="dywhere">主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
@ -870,6 +899,7 @@
|
||||
删除数据
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="that"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.AdoNetExtensions.Delete``1(System.Data.IDbTransaction,System.Object)">
|
||||
@ -877,6 +907,7 @@
|
||||
删除数据,传入动态条件,如:主键值 | new[]{主键值1,主键值2} | TEntity1 | new[]{TEntity1,TEntity2} | new{id=1}
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<param name="that"></param>
|
||||
<param name="dywhere">主键值、主键值集合、实体、实体集合、匿名对象、匿名对象集合</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
@ -2268,6 +2299,7 @@
|
||||
<typeparam name="T2"></typeparam>
|
||||
<typeparam name="T3"></typeparam>
|
||||
<typeparam name="T4"></typeparam>
|
||||
<typeparam name="T5"></typeparam>
|
||||
<param name="exp">lambda表达式</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
@ -2471,6 +2503,7 @@
|
||||
</summary>
|
||||
<typeparam name="TReturn">返回类型</typeparam>
|
||||
<param name="select">选择列</param>
|
||||
<param name="fieldAlias"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.ISelectGrouping`2.ToSql(System.String)">
|
||||
@ -2925,6 +2958,7 @@
|
||||
查询,ExecuteReader(dr => {}, "select * from user where age > ?age", new { age = 25 })<para></para>
|
||||
提示:parms 参数还可以传 Dictionary<string, object>
|
||||
</summary>
|
||||
<param name="fetchHandler"></param>
|
||||
<param name="cmdText"></param>
|
||||
<param name="parms"></param>
|
||||
</member>
|
||||
@ -2932,6 +2966,7 @@
|
||||
<summary>
|
||||
查询
|
||||
</summary>
|
||||
<param name="cmdType"></param>
|
||||
<param name="cmdText"></param>
|
||||
<param name="cmdParms"></param>
|
||||
</member>
|
||||
@ -2948,6 +2983,7 @@
|
||||
<summary>
|
||||
查询
|
||||
</summary>
|
||||
<param name="cmdType"></param>
|
||||
<param name="cmdText"></param>
|
||||
<param name="cmdParms"></param>
|
||||
</member>
|
||||
@ -2964,6 +3000,7 @@
|
||||
<summary>
|
||||
查询
|
||||
</summary>
|
||||
<param name="cmdType"></param>
|
||||
<param name="cmdText"></param>
|
||||
<param name="cmdParms"></param>
|
||||
</member>
|
||||
@ -3035,6 +3072,7 @@
|
||||
执行SQL返回对象集合,Query<User>("select * from user where age > ?age; select * from address", new SqlParameter { ParameterName = "age", Value = 25 })
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<typeparam name="T2"></typeparam>
|
||||
<param name="cmdType"></param>
|
||||
<param name="cmdText"></param>
|
||||
<param name="cmdParms"></param>
|
||||
@ -3046,6 +3084,7 @@
|
||||
提示:parms 参数还可以传 Dictionary<string, object>
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<typeparam name="T2"></typeparam>
|
||||
<param name="cmdText"></param>
|
||||
<param name="parms"></param>
|
||||
<returns></returns>
|
||||
@ -3057,6 +3096,7 @@
|
||||
Oracle: SELECT 1 FROM dual<para></para>
|
||||
</summary>
|
||||
<param name="commandTimeout">命令超时设置(秒)</param>
|
||||
<param name="cancellationToken"></param>
|
||||
<returns>true: 成功, false: 失败</returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteReaderAsync(System.Func{FreeSql.Internal.Model.FetchCallbackArgs{System.Data.Common.DbDataReader},System.Threading.Tasks.Task},System.Data.CommandType,System.String,System.Data.Common.DbParameter[],System.Threading.CancellationToken)">
|
||||
@ -3067,21 +3107,26 @@
|
||||
<param name="cmdType"></param>
|
||||
<param name="cmdText"></param>
|
||||
<param name="cmdParms"></param>
|
||||
<param name="cancellationToken"></param>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteReaderAsync(System.Func{FreeSql.Internal.Model.FetchCallbackArgs{System.Data.Common.DbDataReader},System.Threading.Tasks.Task},System.String,System.Object,System.Threading.CancellationToken)">
|
||||
<summary>
|
||||
查询,ExecuteReaderAsync(dr => {}, "select * from user where age > ?age", new { age = 25 })<para></para>
|
||||
提示:parms 参数还可以传 Dictionary<string, object>
|
||||
</summary>
|
||||
<param name="readerHander"></param>
|
||||
<param name="cmdText"></param>
|
||||
<param name="parms"></param>
|
||||
<param name="cancellationToken"></param>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteArrayAsync(System.Data.CommandType,System.String,System.Data.Common.DbParameter[],System.Threading.CancellationToken)">
|
||||
<summary>
|
||||
查询
|
||||
</summary>
|
||||
<param name="cmdType"></param>
|
||||
<param name="cmdText"></param>
|
||||
<param name="cmdParms"></param>
|
||||
<param name="cancellationToken"></param>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteArrayAsync(System.String,System.Object,System.Threading.CancellationToken)">
|
||||
<summary>
|
||||
@ -3090,14 +3135,17 @@
|
||||
</summary>
|
||||
<param name="cmdText"></param>
|
||||
<param name="parms"></param>
|
||||
<param name="cancellationToken"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteDataSetAsync(System.Data.CommandType,System.String,System.Data.Common.DbParameter[],System.Threading.CancellationToken)">
|
||||
<summary>
|
||||
查询
|
||||
</summary>
|
||||
<param name="cmdType"></param>
|
||||
<param name="cmdText"></param>
|
||||
<param name="cmdParms"></param>
|
||||
<param name="cancellationToken"></param>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteDataSetAsync(System.String,System.Object,System.Threading.CancellationToken)">
|
||||
<summary>
|
||||
@ -3106,14 +3154,17 @@
|
||||
</summary>
|
||||
<param name="cmdText"></param>
|
||||
<param name="parms"></param>
|
||||
<param name="cancellationToken"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteDataTableAsync(System.Data.CommandType,System.String,System.Data.Common.DbParameter[],System.Threading.CancellationToken)">
|
||||
<summary>
|
||||
查询
|
||||
</summary>
|
||||
<param name="cmdType"></param>
|
||||
<param name="cmdText"></param>
|
||||
<param name="cmdParms"></param>
|
||||
<param name="cancellationToken"></param>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteDataTableAsync(System.String,System.Object,System.Threading.CancellationToken)">
|
||||
<summary>
|
||||
@ -3122,6 +3173,7 @@
|
||||
</summary>
|
||||
<param name="cmdText"></param>
|
||||
<param name="parms"></param>
|
||||
<param name="cancellationToken"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteNonQueryAsync(System.Data.CommandType,System.String,System.Data.Common.DbParameter[],System.Threading.CancellationToken)">
|
||||
@ -3131,6 +3183,7 @@
|
||||
<param name="cmdType"></param>
|
||||
<param name="cmdText"></param>
|
||||
<param name="cmdParms"></param>
|
||||
<param name="cancellationToken"></param>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteNonQueryAsync(System.String,System.Object,System.Threading.CancellationToken)">
|
||||
<summary>
|
||||
@ -3139,6 +3192,7 @@
|
||||
</summary>
|
||||
<param name="cmdText"></param>
|
||||
<param name="parms"></param>
|
||||
<param name="cancellationToken"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteScalarAsync(System.Data.CommandType,System.String,System.Data.Common.DbParameter[],System.Threading.CancellationToken)">
|
||||
@ -3148,6 +3202,7 @@
|
||||
<param name="cmdType"></param>
|
||||
<param name="cmdText"></param>
|
||||
<param name="cmdParms"></param>
|
||||
<param name="cancellationToken"></param>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.ExecuteScalarAsync(System.String,System.Object,System.Threading.CancellationToken)">
|
||||
<summary>
|
||||
@ -3156,6 +3211,7 @@
|
||||
</summary>
|
||||
<param name="cmdText"></param>
|
||||
<param name="parms"></param>
|
||||
<param name="cancellationToken"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.QueryAsync``1(System.Data.CommandType,System.String,System.Data.Common.DbParameter[],System.Threading.CancellationToken)">
|
||||
@ -3166,6 +3222,7 @@
|
||||
<param name="cmdType"></param>
|
||||
<param name="cmdText"></param>
|
||||
<param name="cmdParms"></param>
|
||||
<param name="cancellationToken"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.QueryAsync``1(System.String,System.Object,System.Threading.CancellationToken)">
|
||||
@ -3176,6 +3233,7 @@
|
||||
<typeparam name="T"></typeparam>
|
||||
<param name="cmdText"></param>
|
||||
<param name="parms"></param>
|
||||
<param name="cancellationToken"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.QueryAsync``2(System.Data.CommandType,System.String,System.Data.Common.DbParameter[],System.Threading.CancellationToken)">
|
||||
@ -3183,9 +3241,11 @@
|
||||
执行SQL返回对象集合,Query<User>("select * from user where age > ?age; select * from address", new SqlParameter { ParameterName = "age", Value = 25 })
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<typeparam name="T2"></typeparam>
|
||||
<param name="cmdType"></param>
|
||||
<param name="cmdText"></param>
|
||||
<param name="cmdParms"></param>
|
||||
<param name="cancellationToken"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSql.IAdo.QueryAsync``2(System.String,System.Object,System.Threading.CancellationToken)">
|
||||
@ -3194,8 +3254,10 @@
|
||||
提示:parms 参数还可以传 Dictionary<string, object>
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<typeparam name="T2"></typeparam>
|
||||
<param name="cmdText"></param>
|
||||
<param name="parms"></param>
|
||||
<param name="cancellationToken"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="E:FreeSql.IAop.ParseExpression">
|
||||
@ -4317,6 +4379,7 @@
|
||||
获取 Type 的原始 c# 文本表示
|
||||
</summary>
|
||||
<param name="type"></param>
|
||||
<param name="isNameSpace"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:FreeSqlGlobalExtensions.Distance(System.Drawing.Point,System.Drawing.Point)">
|
||||
@ -4347,7 +4410,10 @@
|
||||
示例:new List<Song>(new[] { song1, song2, song3 }).IncludeMany(g.sqlite, a => a.Tags);<para></para>
|
||||
文档:https://github.com/2881099/FreeSql/wiki/%e8%b4%aa%e5%a9%aa%e5%8a%a0%e8%bd%bd#%E5%AF%BC%E8%88%AA%E5%B1%9E%E6%80%A7-onetomanymanytomany
|
||||
</summary>
|
||||
<typeparam name="T1"></typeparam>
|
||||
<typeparam name="TNavigate"></typeparam>
|
||||
<param name="list"></param>
|
||||
<param name="orm"></param>
|
||||
<param name="navigateSelector">选择一个集合的导航属性,如: .IncludeMany(a => a.Tags)<para></para>
|
||||
可以 .Where 设置临时的关系映射,如: .IncludeMany(a => a.Tags.Where(tag => tag.TypeId == a.Id))<para></para>
|
||||
可以 .Take(5) 每个子集合只取5条,如: .IncludeMany(a => a.Tags.Take(5))<para></para>
|
||||
|
@ -242,6 +242,7 @@ namespace FreeSql
|
||||
/// <typeparam name="T2"></typeparam>
|
||||
/// <typeparam name="T3"></typeparam>
|
||||
/// <typeparam name="T4"></typeparam>
|
||||
/// <typeparam name="T5"></typeparam>
|
||||
/// <param name="exp">lambda表达式</param>
|
||||
/// <returns></returns>
|
||||
ISelect<T1> Where<T2, T3, T4, T5>(Expression<Func<T1, T2, T3, T4, T5, bool>> exp) where T2 : class where T3 : class where T4 : class where T5 : class;
|
||||
|
@ -57,6 +57,7 @@ namespace FreeSql
|
||||
/// </summary>
|
||||
/// <typeparam name="TReturn">返回类型</typeparam>
|
||||
/// <param name="select">选择列</param>
|
||||
/// <param name="fieldAlias"></param>
|
||||
/// <returns></returns>
|
||||
string ToSql<TReturn>(Expression<Func<ISelectGroupingAggregate<TKey, TValue>, TReturn>> select, FieldAliasOptions fieldAlias = FieldAliasOptions.AsIndex);
|
||||
/// <summary>
|
||||
|
@ -101,6 +101,7 @@ namespace FreeSql
|
||||
/// 查询,ExecuteReader(dr => {}, "select * from user where age > ?age", new { age = 25 })<para></para>
|
||||
/// 提示:parms 参数还可以传 Dictionary<string, object>
|
||||
/// </summary>
|
||||
/// <param name="fetchHandler"></param>
|
||||
/// <param name="cmdText"></param>
|
||||
/// <param name="parms"></param>
|
||||
void ExecuteReader(Action<FetchCallbackArgs<DbDataReader>> fetchHandler, string cmdText, object parms = null);
|
||||
@ -109,6 +110,7 @@ namespace FreeSql
|
||||
/// <summary>
|
||||
/// 查询
|
||||
/// </summary>
|
||||
/// <param name="cmdType"></param>
|
||||
/// <param name="cmdText"></param>
|
||||
/// <param name="cmdParms"></param>
|
||||
object[][] ExecuteArray(CommandType cmdType, string cmdText, params DbParameter[] cmdParms);
|
||||
@ -127,6 +129,7 @@ namespace FreeSql
|
||||
/// <summary>
|
||||
/// 查询
|
||||
/// </summary>
|
||||
/// <param name="cmdType"></param>
|
||||
/// <param name="cmdText"></param>
|
||||
/// <param name="cmdParms"></param>
|
||||
DataSet ExecuteDataSet(CommandType cmdType, string cmdText, params DbParameter[] cmdParms);
|
||||
@ -145,6 +148,7 @@ namespace FreeSql
|
||||
/// <summary>
|
||||
/// 查询
|
||||
/// </summary>
|
||||
/// <param name="cmdType"></param>
|
||||
/// <param name="cmdText"></param>
|
||||
/// <param name="cmdParms"></param>
|
||||
DataTable ExecuteDataTable(CommandType cmdType, string cmdText, params DbParameter[] cmdParms);
|
||||
@ -227,6 +231,7 @@ namespace FreeSql
|
||||
/// 执行SQL返回对象集合,Query<User>("select * from user where age > ?age; select * from address", new SqlParameter { ParameterName = "age", Value = 25 })
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <typeparam name="T2"></typeparam>
|
||||
/// <param name="cmdType"></param>
|
||||
/// <param name="cmdText"></param>
|
||||
/// <param name="cmdParms"></param>
|
||||
@ -239,6 +244,7 @@ namespace FreeSql
|
||||
/// 提示:parms 参数还可以传 Dictionary<string, object>
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <typeparam name="T2"></typeparam>
|
||||
/// <param name="cmdText"></param>
|
||||
/// <param name="parms"></param>
|
||||
/// <returns></returns>
|
||||
@ -274,6 +280,7 @@ namespace FreeSql
|
||||
/// Oracle: SELECT 1 FROM dual<para></para>
|
||||
/// </summary>
|
||||
/// <param name="commandTimeout">命令超时设置(秒)</param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns>true: 成功, false: 失败</returns>
|
||||
Task<bool> ExecuteConnectTestAsync(int commandTimeout = 0, CancellationToken cancellationToken = default);
|
||||
|
||||
@ -284,6 +291,7 @@ namespace FreeSql
|
||||
/// <param name="cmdType"></param>
|
||||
/// <param name="cmdText"></param>
|
||||
/// <param name="cmdParms"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
Task ExecuteReaderAsync(Func<FetchCallbackArgs<DbDataReader>, Task> readerHander, CommandType cmdType, string cmdText, DbParameter[] cmdParms, CancellationToken cancellationToken = default);
|
||||
Task ExecuteReaderAsync(DbTransaction transaction, Func<FetchCallbackArgs<DbDataReader>, Task> readerHander, CommandType cmdType, string cmdText, DbParameter[] cmdParms, CancellationToken cancellationToken = default);
|
||||
Task ExecuteReaderAsync(DbConnection connection, DbTransaction transaction, Func<FetchCallbackArgs<DbDataReader>, Task> readerHander, CommandType cmdType, string cmdText, int cmdTimeout, DbParameter[] cmdParms, CancellationToken cancellationToken = default);
|
||||
@ -291,16 +299,20 @@ namespace FreeSql
|
||||
/// 查询,ExecuteReaderAsync(dr => {}, "select * from user where age > ?age", new { age = 25 })<para></para>
|
||||
/// 提示:parms 参数还可以传 Dictionary<string, object>
|
||||
/// </summary>
|
||||
/// <param name="readerHander"></param>
|
||||
/// <param name="cmdText"></param>
|
||||
/// <param name="parms"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
Task ExecuteReaderAsync(Func<FetchCallbackArgs<DbDataReader>, Task> readerHander, string cmdText, object parms = null, CancellationToken cancellationToken = default);
|
||||
Task ExecuteReaderAsync(DbTransaction transaction, Func<FetchCallbackArgs<DbDataReader>, Task> readerHander, string cmdText, object parms = null, CancellationToken cancellationToken = default);
|
||||
Task ExecuteReaderAsync(DbConnection connection, DbTransaction transaction, Func<FetchCallbackArgs<DbDataReader>, Task> readerHander, string cmdText, object parms = null, CancellationToken cancellationToken = default);
|
||||
/// <summary>
|
||||
/// 查询
|
||||
/// </summary>
|
||||
/// <param name="cmdType"></param>
|
||||
/// <param name="cmdText"></param>
|
||||
/// <param name="cmdParms"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
Task<object[][]> ExecuteArrayAsync(CommandType cmdType, string cmdText, DbParameter[] cmdParms, CancellationToken cancellationToken = default);
|
||||
Task<object[][]> ExecuteArrayAsync(DbTransaction transaction, CommandType cmdType, string cmdText, DbParameter[] cmdParms, CancellationToken cancellationToken = default);
|
||||
Task<object[][]> ExecuteArrayAsync(DbConnection connection, DbTransaction transaction, CommandType cmdType, string cmdText, int cmdTimeout, DbParameter[] cmdParms, CancellationToken cancellationToken = default);
|
||||
@ -310,6 +322,7 @@ namespace FreeSql
|
||||
/// </summary>
|
||||
/// <param name="cmdText"></param>
|
||||
/// <param name="parms"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<object[][]> ExecuteArrayAsync(string cmdText, object parms = null, CancellationToken cancellationToken = default);
|
||||
Task<object[][]> ExecuteArrayAsync(DbTransaction transaction, string cmdText, object parms = null, CancellationToken cancellationToken = default);
|
||||
@ -317,8 +330,10 @@ namespace FreeSql
|
||||
/// <summary>
|
||||
/// 查询
|
||||
/// </summary>
|
||||
/// <param name="cmdType"></param>
|
||||
/// <param name="cmdText"></param>
|
||||
/// <param name="cmdParms"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
Task<DataSet> ExecuteDataSetAsync(CommandType cmdType, string cmdText, DbParameter[] cmdParms, CancellationToken cancellationToken = default);
|
||||
Task<DataSet> ExecuteDataSetAsync(DbTransaction transaction, CommandType cmdType, string cmdText, DbParameter[] cmdParms, CancellationToken cancellationToken = default);
|
||||
Task<DataSet> ExecuteDataSetAsync(DbConnection connection, DbTransaction transaction, CommandType cmdType, string cmdText, int cmdTimeout, DbParameter[] cmdParms, CancellationToken cancellationToken = default);
|
||||
@ -328,6 +343,7 @@ namespace FreeSql
|
||||
/// </summary>
|
||||
/// <param name="cmdText"></param>
|
||||
/// <param name="parms"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<DataSet> ExecuteDataSetAsync(string cmdText, object parms = null, CancellationToken cancellationToken = default);
|
||||
Task<DataSet> ExecuteDataSetAsync(DbTransaction transaction, string cmdText, object parms = null, CancellationToken cancellationToken = default);
|
||||
@ -335,8 +351,10 @@ namespace FreeSql
|
||||
/// <summary>
|
||||
/// 查询
|
||||
/// </summary>
|
||||
/// <param name="cmdType"></param>
|
||||
/// <param name="cmdText"></param>
|
||||
/// <param name="cmdParms"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
Task<DataTable> ExecuteDataTableAsync(CommandType cmdType, string cmdText, DbParameter[] cmdParms, CancellationToken cancellationToken = default);
|
||||
Task<DataTable> ExecuteDataTableAsync(DbTransaction transaction, CommandType cmdType, string cmdText, DbParameter[] cmdParms, CancellationToken cancellationToken = default);
|
||||
Task<DataTable> ExecuteDataTableAsync(DbConnection connection, DbTransaction transaction, CommandType cmdType, string cmdText, int cmdTimeout, DbParameter[] cmdParms, CancellationToken cancellationToken = default);
|
||||
@ -346,6 +364,7 @@ namespace FreeSql
|
||||
/// </summary>
|
||||
/// <param name="cmdText"></param>
|
||||
/// <param name="parms"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<DataTable> ExecuteDataTableAsync(string cmdText, object parms = null, CancellationToken cancellationToken = default);
|
||||
Task<DataTable> ExecuteDataTableAsync(DbTransaction transaction, string cmdText, object parms = null, CancellationToken cancellationToken = default);
|
||||
@ -356,6 +375,7 @@ namespace FreeSql
|
||||
/// <param name="cmdType"></param>
|
||||
/// <param name="cmdText"></param>
|
||||
/// <param name="cmdParms"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
Task<int> ExecuteNonQueryAsync(CommandType cmdType, string cmdText, DbParameter[] cmdParms, CancellationToken cancellationToken = default);
|
||||
Task<int> ExecuteNonQueryAsync(DbTransaction transaction, CommandType cmdType, string cmdText, DbParameter[] cmdParms, CancellationToken cancellationToken = default);
|
||||
Task<int> ExecuteNonQueryAsync(DbConnection connection, DbTransaction transaction, CommandType cmdType, string cmdText, int cmdTimeout, DbParameter[] cmdParms, CancellationToken cancellationToken = default);
|
||||
@ -365,6 +385,7 @@ namespace FreeSql
|
||||
/// </summary>
|
||||
/// <param name="cmdText"></param>
|
||||
/// <param name="parms"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<int> ExecuteNonQueryAsync(string cmdText, object parms = null, CancellationToken cancellationToken = default);
|
||||
Task<int> ExecuteNonQueryAsync(DbTransaction transaction, string cmdText, object parms = null, CancellationToken cancellationToken = default);
|
||||
@ -375,6 +396,7 @@ namespace FreeSql
|
||||
/// <param name="cmdType"></param>
|
||||
/// <param name="cmdText"></param>
|
||||
/// <param name="cmdParms"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
Task<object> ExecuteScalarAsync(CommandType cmdType, string cmdText, DbParameter[] cmdParms, CancellationToken cancellationToken = default);
|
||||
Task<object> ExecuteScalarAsync(DbTransaction transaction, CommandType cmdType, string cmdText, DbParameter[] cmdParms, CancellationToken cancellationToken = default);
|
||||
Task<object> ExecuteScalarAsync(DbConnection connection, DbTransaction transaction, CommandType cmdType, string cmdText, int cmdTimeout, DbParameter[] cmdParms, CancellationToken cancellationToken = default);
|
||||
@ -384,6 +406,7 @@ namespace FreeSql
|
||||
/// </summary>
|
||||
/// <param name="cmdText"></param>
|
||||
/// <param name="parms"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<object> ExecuteScalarAsync(string cmdText, object parms = null, CancellationToken cancellationToken = default);
|
||||
Task<object> ExecuteScalarAsync(DbTransaction transaction, string cmdText, object parms = null, CancellationToken cancellationToken = default);
|
||||
@ -396,6 +419,7 @@ namespace FreeSql
|
||||
/// <param name="cmdType"></param>
|
||||
/// <param name="cmdText"></param>
|
||||
/// <param name="cmdParms"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<T>> QueryAsync<T>(CommandType cmdType, string cmdText, DbParameter[] cmdParms, CancellationToken cancellationToken = default);
|
||||
Task<List<T>> QueryAsync<T>(DbTransaction transaction, CommandType cmdType, string cmdText, DbParameter[] cmdParms, CancellationToken cancellationToken = default);
|
||||
@ -408,6 +432,7 @@ namespace FreeSql
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="cmdText"></param>
|
||||
/// <param name="parms"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<T>> QueryAsync<T>(string cmdText, object parms = null, CancellationToken cancellationToken = default);
|
||||
Task<List<T>> QueryAsync<T>(DbTransaction transaction, string cmdText, object parms = null, CancellationToken cancellationToken = default);
|
||||
@ -417,9 +442,11 @@ namespace FreeSql
|
||||
/// 执行SQL返回对象集合,Query<User>("select * from user where age > ?age; select * from address", new SqlParameter { ParameterName = "age", Value = 25 })
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <typeparam name="T2"></typeparam>
|
||||
/// <param name="cmdType"></param>
|
||||
/// <param name="cmdText"></param>
|
||||
/// <param name="cmdParms"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<NativeTuple<List<T1>, List<T2>>> QueryAsync<T1, T2>(CommandType cmdType, string cmdText, DbParameter[] cmdParms, CancellationToken cancellationToken = default);
|
||||
Task<NativeTuple<List<T1>, List<T2>>> QueryAsync<T1, T2>(DbTransaction transaction, CommandType cmdType, string cmdText, DbParameter[] cmdParms, CancellationToken cancellationToken = default);
|
||||
@ -429,8 +456,10 @@ namespace FreeSql
|
||||
/// 提示:parms 参数还可以传 Dictionary<string, object>
|
||||
/// </summary>
|
||||
/// <typeparam name="T1"></typeparam>
|
||||
/// <typeparam name="T2"></typeparam>
|
||||
/// <param name="cmdText"></param>
|
||||
/// <param name="parms"></param>
|
||||
/// <param name="cancellationToken"></param>
|
||||
/// <returns></returns>
|
||||
Task<NativeTuple<List<T1>, List<T2>>> QueryAsync<T1, T2>(string cmdText, object parms = null, CancellationToken cancellationToken = default);
|
||||
Task<NativeTuple<List<T1>, List<T2>>> QueryAsync<T1, T2>(DbTransaction transaction, string cmdText, object parms = null, CancellationToken cancellationToken = default);
|
||||
|
@ -57,7 +57,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
MasterPool.Return(conn);
|
||||
var after = new Aop.TraceAfterEventArgs(before, "", ex);
|
||||
_util?._orm?.Aop.TraceAfterHandler?.Invoke(this, after);
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
if (_trans.ContainsKey(tid)) CommitTransaction();
|
||||
_trans.TryAdd(tid, tran);
|
||||
@ -122,7 +122,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (requireTran) RollbackTransaction(ex);
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -80,7 +80,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -102,7 +102,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
if (string.IsNullOrEmpty(sql)) return this;
|
||||
if (++_whereTimes > 1) _where.Append(" AND ");
|
||||
_where.Append("(").Append(sql).Append(")");
|
||||
_where.Append('(').Append(sql).Append(')');
|
||||
if (parms != null) _params.AddRange(_commonUtils.GetDbParamtersByObject(sql, parms));
|
||||
return this;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -254,7 +254,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
@ -282,7 +282,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -308,7 +308,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -360,7 +360,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
|
@ -269,7 +269,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
@ -278,7 +278,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -350,7 +350,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
@ -359,7 +359,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -429,7 +429,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
@ -438,7 +438,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -464,7 +464,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -538,7 +538,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
if (_source == null || _source.Any() == false) return null;
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("INSERT INTO ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append("(");
|
||||
sb.Append("INSERT INTO ").Append(_commonUtils.QuoteSqlName(TableRuleInvoke())).Append('(');
|
||||
var colidx = 0;
|
||||
foreach (var col in _table.Columns.Values)
|
||||
{
|
||||
@ -582,7 +582,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
}
|
||||
++colidx2;
|
||||
}
|
||||
if (isValues) sb.Append(")");
|
||||
if (isValues) sb.Append(')');
|
||||
onrow?.Invoke(d, didx, sb);
|
||||
++didx;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
@ -85,7 +85,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -157,7 +157,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
@ -166,7 +166,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -236,7 +236,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
@ -245,7 +245,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -270,7 +270,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -72,7 +72,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -107,7 +107,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -175,7 +175,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -244,7 +244,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -291,7 +291,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -327,7 +327,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -741,7 +741,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -767,7 +767,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -817,7 +817,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -855,7 +855,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -892,7 +892,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -946,7 +946,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -983,7 +983,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -1040,7 +1040,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -1066,7 +1066,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -215,7 +215,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
@ -224,7 +224,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -289,7 +289,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
@ -298,7 +298,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -327,7 +327,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -555,7 +555,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
public IUpdate<T1> Where(string sql, object parms = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(sql)) return this;
|
||||
_where.Append(" AND (").Append(sql).Append(")");
|
||||
_where.Append(" AND (").Append(sql).Append(')');
|
||||
if (parms != null) _params.AddRange(_commonUtils.GetDbParamtersByObject(sql, parms));
|
||||
return this;
|
||||
}
|
||||
@ -587,7 +587,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
if (_source.Any() == false) return null;
|
||||
if (_table.ColumnsByCs.ContainsKey(CsName) == false) throw new Exception($"找不到 {CsName} 对应的列");
|
||||
if (thenValue == null) throw new ArgumentNullException("thenValue 参数不可为 null");
|
||||
if (thenValue == null) throw new ArgumentNullException(nameof(thenValue));
|
||||
|
||||
if (_source.Count == 0) return null;
|
||||
if (_source.Count == 1)
|
||||
@ -626,7 +626,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
}
|
||||
cwsb.Append(" END");
|
||||
if (nulls == _source.Count) sb.Append("NULL");
|
||||
else sb.Append(cwsb.ToString());
|
||||
else sb.Append(cwsb);
|
||||
cwsb.Clear();
|
||||
|
||||
return sb.ToString();
|
||||
@ -752,7 +752,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
else
|
||||
{
|
||||
ToSqlCaseWhenEnd(cwsb, col);
|
||||
sb.Append(cwsb.ToString());
|
||||
sb.Append(cwsb);
|
||||
}
|
||||
cwsb.Clear();
|
||||
}
|
||||
@ -790,7 +790,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
if (_source.Any())
|
||||
{
|
||||
if (_table.Primarys.Any() == false) throw new ArgumentException($"{_table.Type.DisplayCsharp()} 没有定义主键,无法使用 SetSource,请尝试 SetDto");
|
||||
sb.Append("(").Append(_commonUtils.WhereItems(_table, "", _source)).Append(")");
|
||||
sb.Append('(').Append(_commonUtils.WhereItems(_table, "", _source)).Append(')');
|
||||
}
|
||||
|
||||
if (_where.Length > 0)
|
||||
|
@ -72,7 +72,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
@ -81,7 +81,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -145,7 +145,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
{
|
||||
_transaction.Rollback();
|
||||
_orm.Aop.TraceAfterHandler?.Invoke(this, new Aop.TraceAfterEventArgs(transBefore, "回滚", ex));
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
_transaction = null;
|
||||
}
|
||||
@ -154,7 +154,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -182,7 +182,7 @@ namespace FreeSql.Internal.CommonProvider
|
||||
catch (Exception ex)
|
||||
{
|
||||
exception = ex;
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -14,6 +14,7 @@ using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
using System.Xml.XPath;
|
||||
@ -297,7 +298,7 @@ namespace FreeSql.Internal
|
||||
foreach (var i in ie)
|
||||
{
|
||||
isAny = true;
|
||||
if (ieidx > 0) sb.Append(",");
|
||||
if (ieidx > 0) sb.Append(',');
|
||||
if (ieidx == 0)
|
||||
{
|
||||
var itype = i.GetType();
|
||||
@ -308,7 +309,7 @@ namespace FreeSql.Internal
|
||||
++ieidx;
|
||||
}
|
||||
if (isAny == false) return "";
|
||||
sb.Append(")");
|
||||
sb.Append(')');
|
||||
return sb.ToString();
|
||||
}
|
||||
else if (dywhere is IEnumerable)
|
||||
@ -361,7 +362,7 @@ namespace FreeSql.Internal
|
||||
var indt = its.Select(a => pk1.GetDbValue(a)).Where(a => a != null).ToArray();
|
||||
if (indt.Any() == false) return null;
|
||||
if (indt.Length == 1) sbin.Append(" = ").Append(GetNoneParamaterSqlValue(null, null, pk1, pk1.Attribute.MapType, indt.First()));
|
||||
else sbin.Append(" IN (").Append(string.Join(",", indt.Select(a => GetNoneParamaterSqlValue(null, null, pk1, pk1.Attribute.MapType, a)))).Append(")");
|
||||
else sbin.Append(" IN (").Append(string.Join(",", indt.Select(a => GetNoneParamaterSqlValue(null, null, pk1, pk1.Attribute.MapType, a)))).Append(')');
|
||||
return sbin.ToString();
|
||||
}
|
||||
var dicpk = its.Length > 5 ? new Dictionary<string, bool>() : null;
|
||||
@ -377,7 +378,7 @@ namespace FreeSql.Internal
|
||||
{
|
||||
sb.Append(" OR (");
|
||||
sb.Append(filter.Substring(5));
|
||||
sb.Append(")");
|
||||
sb.Append(')');
|
||||
++iidx;
|
||||
}
|
||||
if (dicpk != null)
|
||||
@ -399,7 +400,7 @@ namespace FreeSql.Internal
|
||||
{
|
||||
sb.Append(" OR (");
|
||||
sb.Append(fil.Key);
|
||||
sb.Append(")");
|
||||
sb.Append(')');
|
||||
}
|
||||
}
|
||||
return iidx == 1 ? sb.Remove(0, 5).Remove(sb.Length - 1, 1).ToString() : sb.Remove(0, 4).ToString();
|
||||
@ -447,6 +448,7 @@ namespace FreeSql.Internal
|
||||
}
|
||||
}
|
||||
|
||||
static int _CodeBaseNotSupportedException = 0;
|
||||
/// <summary>
|
||||
/// 通过属性的注释文本,通过 xml 读取
|
||||
/// </summary>
|
||||
@ -463,8 +465,18 @@ namespace FreeSql.Internal
|
||||
var regex = new Regex(@"\.(dll|exe)", RegexOptions.IgnoreCase);
|
||||
var xmlPath = regex.Replace(localType.Assembly.Location, ".xml");
|
||||
if (File.Exists(xmlPath) == false)
|
||||
{
|
||||
if (_CodeBaseNotSupportedException == 1) return null;
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrEmpty(localType.Assembly.CodeBase)) return null;
|
||||
}
|
||||
catch (NotSupportedException) //NotSupportedException: CodeBase is not supported on assemblies loaded from a single-file bundle.
|
||||
{
|
||||
Interlocked.Exchange(ref _CodeBaseNotSupportedException, 1);
|
||||
return null;
|
||||
}
|
||||
|
||||
xmlPath = regex.Replace(localType.Assembly.CodeBase, ".xml");
|
||||
if (xmlPath.StartsWith("file:///") && Uri.TryCreate(xmlPath, UriKind.Absolute, out var tryuri))
|
||||
xmlPath = tryuri.LocalPath;
|
||||
|
Loading…
x
Reference in New Issue
Block a user