mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-11 15:52:25 -05:00
update readme
add vision average to client stats other stuff
This commit is contained in:
@ -1,15 +1,9 @@
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Query;
|
||||
using Microsoft.EntityFrameworkCore.Query.Internal;
|
||||
using Microsoft.EntityFrameworkCore.Storage;
|
||||
using SharedLibraryCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using WebfrontCore.Controllers;
|
||||
|
||||
@ -23,7 +17,7 @@ namespace IW4MAdmin.Plugins.Stats.Web.Controllers
|
||||
ViewBag.Title = Utilities.CurrentLocalization.LocalizationIndex.Set["WEBFRONT_STATS_INDEX_TITLE"];
|
||||
ViewBag.Description = Utilities.CurrentLocalization.LocalizationIndex.Set["WEBFRONT_STATS_INDEX_DESC"];
|
||||
|
||||
return View("Index", await Plugin.Manager.GetTopStats(0, 10));
|
||||
return View("Index", await Plugin.Manager.GetTopStats(0, 50));
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
@ -78,34 +72,4 @@ namespace IW4MAdmin.Plugins.Stats.Web.Controllers
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG == true
|
||||
public static class IQueryableExtensions
|
||||
{
|
||||
private static readonly TypeInfo QueryCompilerTypeInfo = typeof(QueryCompiler).GetTypeInfo();
|
||||
|
||||
private static readonly FieldInfo QueryCompilerField = typeof(EntityQueryProvider).GetTypeInfo().DeclaredFields.First(x => x.Name == "_queryCompiler");
|
||||
|
||||
private static readonly FieldInfo QueryModelGeneratorField = QueryCompilerTypeInfo.DeclaredFields.First(x => x.Name == "_queryModelGenerator");
|
||||
|
||||
private static readonly FieldInfo DataBaseField = QueryCompilerTypeInfo.DeclaredFields.Single(x => x.Name == "_database");
|
||||
|
||||
private static readonly PropertyInfo DatabaseDependenciesField = typeof(Database).GetTypeInfo().DeclaredProperties.Single(x => x.Name == "Dependencies");
|
||||
|
||||
public static string ToSql<TEntity>(this IQueryable<TEntity> query) where TEntity : class
|
||||
{
|
||||
var queryCompiler = (QueryCompiler)QueryCompilerField.GetValue(query.Provider);
|
||||
var modelGenerator = (QueryModelGenerator)QueryModelGeneratorField.GetValue(queryCompiler);
|
||||
var queryModel = modelGenerator.ParseQuery(query.Expression);
|
||||
var database = (IDatabase)DataBaseField.GetValue(queryCompiler);
|
||||
var databaseDependencies = (DatabaseDependencies)DatabaseDependenciesField.GetValue(database);
|
||||
var queryCompilationContext = databaseDependencies.QueryCompilationContextFactory.Create(false);
|
||||
var modelVisitor = (RelationalQueryModelVisitor)queryCompilationContext.CreateQueryModelVisitor();
|
||||
modelVisitor.CreateQueryExecutor<TEntity>(queryModel);
|
||||
var sql = modelVisitor.Queries.First().ToString();
|
||||
|
||||
return sql;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user