解决此问题的一种方法是在拥有数据之后再从L2SQL切换到L2Object,然后再次进行分组,以便进行排序:
var result = databaseList.GroupBy(x => x.Key) .SelectMany(...) .AsEnumerable() .GroupBy(x => x.DB) .OrderByDescending(g => g.Max(x => x.LastOccured));
这会给你组列表与
Key的
DB,在群体的最后一个异常的顺序。
要使用这些结果,可以使用嵌套的foreach循环:
<div id="results"> @foreach(var group in Model) { int currentCol = 0; <br /> <h3> @group.Key </h3> @foreach(var database in group) { <div onclick="location.href='/logs/[email protected]&[email protected]&[email protected]';"> @if (database.Count > 999) { <div ><b>@database.Count</b></div> } else {<div ><b>@database.Count</b></div> } <div > Exceptions of Type: @database.Exception</div> <div >Siste: @database.LastOccurred</div> <hr /> </div> currentCol += 1; if (currentCol == 2) { //3 columns were displayed, switch row currentCol = 0; <br /> } } }</div>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)