MyK3CloudCore.IOC 2023.7.28.1619

Suggested Alternatives

K3Cloud.WebApi.Core.IoC

dotnet add package MyK3CloudCore.IOC --version 2023.7.28.1619                
NuGet\Install-Package MyK3CloudCore.IOC -Version 2023.7.28.1619                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MyK3CloudCore.IOC" Version="2023.7.28.1619" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MyK3CloudCore.IOC --version 2023.7.28.1619                
#r "nuget: MyK3CloudCore.IOC, 2023.7.28.1619"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MyK3CloudCore.IOC as a Cake Addin
#addin nuget:?package=MyK3CloudCore.IOC&version=2023.7.28.1619

// Install MyK3CloudCore.IOC as a Cake Tool
#tool nuget:?package=MyK3CloudCore.IOC&version=2023.7.28.1619                

1.切换账套配置查询

// 默认配置文件第一个账套
var res = await K3Scoped.Client.Queryable<SAL_SaleOrder>().ToListAsync();
// 切换到config2账套
res = await K3Scoped.GetClient("config2").Queryable<SAL_SaleOrder>().ToListAsync();

2.条件查询

var result = await K3Scoped.Client.Queryable<SAL_SaleOrder>()
                .Where(t=>t.FBillNo=="XSDD0001")
                .ToListAsync();
// 复杂一点的
string[] FDepts = new string[] { "04", "06", "07", "08", "09", "10", "11" };
Expression<Func<STK_OutStockApply, bool>> t = t => t.FDate > DateTime.Parse("2023-07-10") && t.FDate < DateTime.Parse("2023-07-14");
t = t.AndFilter(t => t.FDocumentStatus == "C");
t = t.AndFilter(t => FDepts.Contains(t.FDeptId__FNumber));
var result = await K3Scoped.Client.Queryable<STK_OutStockApply>()
            .Where(t)
            .ToPageAsync();

3.查询某列

var result = await K3Scoped.Client.Queryable<SAL_SaleOrder>()
                .Where(t=>t.FBillNo=="XSDD0001")
                .Select(t => new { t.FBillNo })
                .ToListAsync();
var result = await K3Scoped.Client.Queryable<SAL_SaleOrder>()
                .Where(t=>t.FBillNo=="XSDD0001")
                .Select(t => new { t.FBillNo, t.FCUSTIDFName, t.FMaterialId, t.FQty })
                .ToListAsync();

4.排序

var res = await K3Scoped.Client.Queryable<SAL_SaleOrder>()
                .OrderBy(u => new { u.FId, u.FQty }, new[] { OrderType.Descending, OrderType.Ascending })
                .ToListAsync();

5.分页

var res = await K3Scoped.Client.Queryable<SAL_SaleOrder>()
                .ToPageListAsync(page, limit);
// 返回查询数据总条数
Refasync<int> total = 0;
var res = await K3Scoped.Client.Queryable<SAL_SaleOrder>()
                .ToPageListAsync(page, limit, total);
// 自定义统计返回条数字段(total返回不准确跟字段有关,需要自己定义)
var res = await K3Scoped.Client.Queryable<SAL_SaleOrder>()
                .ToPageListAsync(page, limit, t => t.FMaterialId_FNumber, total);

6.汇总

var sumData = await K3Scoped.Client.Queryable<SAL_SaleOrder>().SumAsync(t => t.FQty );
var sumData = await K3Scoped.Client.Queryable<SAL_SaleOrder>().SumAsync(t => new { t.FQty, t.FStockOutQty, t.FRemainOutQty });

7.计数

var total = await K3Scoped.Client.Queryable<SAL_SaleOrder>().CountAsync(u => u.FMaterialName);

8.缓存

var res = await K3Scoped.Client.Queryable<SAL_SaleOrder>().WithCache().ToListAsync();
// 缓存60秒
var res = await K3Scoped.Client.Queryable<SAL_SaleOrder>().WithCache(60).ToListAsync();
// 自定义缓存键
var res = await K3Scoped.Client.Queryable<SAL_SaleOrder>().WithCache("{EA97F979-5B45-4EFA-95D1-6208F8323308}").ToListAsync();
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2023.7.28.1619 155 7/28/2023