mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-04-22 18:52:50 +08:00
add test #306
This commit is contained in:
parent
89a58a2d55
commit
2853c356e6
@ -125,13 +125,6 @@
|
|||||||
清空状态数据
|
清空状态数据
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="M:FreeSql.DbSet`1.RemoveAsync(System.Linq.Expressions.Expression{System.Func{`0,System.Boolean}})">
|
|
||||||
<summary>
|
|
||||||
根据 lambda 条件删除数据
|
|
||||||
</summary>
|
|
||||||
<param name="predicate"></param>
|
|
||||||
<returns></returns>
|
|
||||||
</member>
|
|
||||||
<member name="M:FreeSql.DbSet`1.Add(`0)">
|
<member name="M:FreeSql.DbSet`1.Add(`0)">
|
||||||
<summary>
|
<summary>
|
||||||
添加
|
添加
|
||||||
@ -486,14 +479,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>
|
||||||
|
62
FreeSql.Tests/FreeSql.Tests/Issues/306.cs
Normal file
62
FreeSql.Tests/FreeSql.Tests/Issues/306.cs
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
using FreeSql.DataAnnotations;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
using Xunit;
|
||||||
|
|
||||||
|
namespace FreeSql.Tests.Issues
|
||||||
|
{
|
||||||
|
public class _306
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
public void SelectTest()
|
||||||
|
{
|
||||||
|
IFreeSql db = g.sqlserver;
|
||||||
|
|
||||||
|
db.Select<ElectricEnergyValue, BranchMeter>()
|
||||||
|
.InnerJoin((a, b) => a.MeterSN == b.MeterSN)
|
||||||
|
.ToAggregate((a, b) => new VM_PeriodEnergy
|
||||||
|
{
|
||||||
|
Sharp = a.Sum(a.Key.Sharp),
|
||||||
|
Peak = a.Sum(a.Key.Peak),
|
||||||
|
Shoulder = a.Sum(a.Key.Shoulder),
|
||||||
|
Off = a.Sum(a.Key.Off),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ElectricEnergyValue
|
||||||
|
{
|
||||||
|
public int ID { get; set; }
|
||||||
|
|
||||||
|
public string MeterSN { get; set; }
|
||||||
|
|
||||||
|
public DateTime CollectTime { get; set; }
|
||||||
|
|
||||||
|
public decimal Sharp { get; set; }
|
||||||
|
|
||||||
|
public decimal Peak { get; set; }
|
||||||
|
|
||||||
|
public decimal Shoulder { get; set; }
|
||||||
|
|
||||||
|
public decimal Off { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class BranchMeter
|
||||||
|
{
|
||||||
|
public int BranchID { get; set; }
|
||||||
|
|
||||||
|
public string MeterSN { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class VM_PeriodEnergy
|
||||||
|
{
|
||||||
|
public decimal Sharp { get; set; }
|
||||||
|
|
||||||
|
public decimal Peak { get; set; }
|
||||||
|
|
||||||
|
public decimal Shoulder { get; set; }
|
||||||
|
|
||||||
|
public decimal Off { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user