mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-10 15:20:48 -05:00
renable weapon name in anticheat snapshot list
update migrations for unique index fix missing total connection time include total connection time in get client query
This commit is contained in:
@ -10,6 +10,8 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SharedLibraryCore.Database
|
||||
{
|
||||
@ -69,8 +71,8 @@ namespace SharedLibraryCore.Database
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
// optionsBuilder.UseLoggerFactory(_loggerFactory)
|
||||
// .EnableSensitiveDataLogging();
|
||||
// optionsBuilder.UseLoggerFactory(_loggerFactory)
|
||||
// .EnableSensitiveDataLogging();
|
||||
|
||||
if (string.IsNullOrEmpty(_ConnectionString))
|
||||
{
|
||||
@ -102,6 +104,41 @@ namespace SharedLibraryCore.Database
|
||||
}
|
||||
}
|
||||
|
||||
private void SetAuditColumns()
|
||||
{
|
||||
return;
|
||||
var entries = ChangeTracker
|
||||
.Entries()
|
||||
.Where(e => e.Entity is SharedEntity && (
|
||||
e.State == EntityState.Added
|
||||
|| e.State == EntityState.Modified)).ToList();
|
||||
|
||||
foreach (var entityEntry in entries)
|
||||
{
|
||||
if (entityEntry.State == EntityState.Added)
|
||||
{
|
||||
//((SharedEntity)entityEntry.Entity).CreatedDateTime = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
//((SharedEntity)entityEntry.Entity).UpdatedDateTime = DateTime.UtcNow;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override Task<int> SaveChangesAsync(bool acceptAllChangesOnSuccess, CancellationToken cancellationToken = default)
|
||||
{
|
||||
SetAuditColumns();
|
||||
return base.SaveChangesAsync(acceptAllChangesOnSuccess, cancellationToken);
|
||||
}
|
||||
|
||||
public override int SaveChanges()
|
||||
{
|
||||
SetAuditColumns();
|
||||
return base.SaveChanges();
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
// make network id unique
|
||||
|
@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace SharedLibraryCore.Database.Models
|
||||
{
|
||||
public partial class EFAlias
|
||||
public partial class EFAlias : SharedEntity
|
||||
{
|
||||
[Key]
|
||||
public int AliasId { get; set; }
|
||||
|
@ -1,13 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace SharedLibraryCore.Database.Models
|
||||
{
|
||||
public class SharedEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// indicates if the entity is active
|
||||
/// </summary>
|
||||
public bool Active { get; set; } = true;
|
||||
|
||||
///// <summary>
|
||||
///// Specifies when the entity was created
|
||||
///// </summary>
|
||||
//[Column(TypeName="datetime")]
|
||||
//public DateTime CreatedDateTime { get; set; }
|
||||
|
||||
///// <summary>
|
||||
///// Specifies when the entity was updated
|
||||
///// </summary>
|
||||
//[Column(TypeName = "datetime")]
|
||||
//public DateTime? UpdatedDateTime { get;set; }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user