where bl.BudgetID == filter.BudgetId && bl.BudgetType == filter.BudgetType group bl by new { FirstDimensionName=primaryDimension.Name,SecondDimensionName=secondaryDimension.Name } into DimGroup //group bl by new { Dimension1 = primaryDimension.Name, Dimension2 = secondaryDimension.Name } into DimGroup select new BudgetData { Dim1 = DimGroup.Key.FirstDimensionName, Dim2 = DimGroup.Key.SecondDimensionName, Sum = DimGroup.Sum(grp => (System.Single)grp.Value1) }).ToList();
DatabaseConnection.DataMemoryContext.GetTable<BudgetLineEntity>().AsQueryable() .GroupBy("Dim1","it") .Select("new (Key as Dim1,Key as Dim2, Sum(Value1) as Sum)") as IQueryable<BudgetData>;
public string Dim1 { get; set; } public string Dim2 { get; set; } public float Sum { get; set; }
[Column(Name = "BudgetLineID")] public int BudgetLineID { get; set; } [Column(Name = "BudgetID")] public int BudgetID { get; set; } [Column(Name = "BudgetType")] public int BudgetType { get; set; } [Column(Name = "Year")] public int Year { get; set; } [Column(Name = "Period")] public int Period { get; set; } [Column(Name = "Dim1")] public string Dim1 { get; set; } [Column(Name = "Dim2")] public string Dim2 { get; set; } [Column(Name = "Dim3")] public string Dim3 { get; set; } [Column(Name = "Dim4")] public string Dim4 { get; set; } [Column(Name = "Dim5")] public string Dim5 { get; set; } [Column(Name = "Value1")] public System.Single Value1 { get; set; }