mirror of
https://github.com/RaidMax/IW4M-Admin.git
synced 2025-06-11 15:52:25 -05:00
implement custom tag (descriptor) feature
allow override of level names through configuration few small fixes/improvements
This commit is contained in:
@ -57,12 +57,12 @@ namespace SharedLibraryCore.Database
|
||||
|
||||
public DatabaseContext(DbContextOptions<DatabaseContext> options) : base(options)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected DatabaseContext(DbContextOptions options) : base(options)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
public override Task<int> SaveChangesAsync(bool acceptAllChangesOnSuccess, CancellationToken cancellationToken = default)
|
||||
@ -123,6 +123,10 @@ namespace SharedLibraryCore.Database
|
||||
modelBuilder.Entity<EFMeta>(ent =>
|
||||
{
|
||||
ent.HasIndex(_meta => _meta.Key);
|
||||
ent.HasIndex(_meta => _meta.LinkedMetaId);
|
||||
ent.HasOne(_meta => _meta.LinkedMeta)
|
||||
.WithMany()
|
||||
.OnDelete(DeleteBehavior.SetNull);
|
||||
});
|
||||
|
||||
// force full name for database conversion
|
||||
|
@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text;
|
||||
|
||||
namespace SharedLibraryCore.Database.Models
|
||||
{
|
||||
@ -11,15 +9,18 @@ namespace SharedLibraryCore.Database.Models
|
||||
/// </summary>
|
||||
public class EFMeta : SharedEntity
|
||||
{
|
||||
public const string ClientTagName = nameof(ClientTagName);
|
||||
public const string ClientTag = nameof(ClientTag);
|
||||
|
||||
[Key]
|
||||
public int MetaId { get; set; }
|
||||
[Required]
|
||||
public DateTime Created { get; set; } = DateTime.UtcNow;
|
||||
[Required]
|
||||
public DateTime Updated { get; set; } = DateTime.UtcNow;
|
||||
[Required]
|
||||
public int ClientId { get; set; }
|
||||
[ForeignKey("ClientId")] // this is the client that the meta belongs to
|
||||
public int? ClientId { get; set; }
|
||||
// this is the client that the meta could belong to
|
||||
[ForeignKey(nameof(ClientId))]
|
||||
public virtual EFClient Client { get; set; }
|
||||
[Required]
|
||||
[MinLength(3)]
|
||||
@ -29,5 +30,9 @@ namespace SharedLibraryCore.Database.Models
|
||||
[Required]
|
||||
public string Value { get; set; }
|
||||
public string Extra { get; set; }
|
||||
|
||||
public int? LinkedMetaId { get; set; }
|
||||
[ForeignKey(nameof(LinkedMetaId))]
|
||||
public virtual EFMeta LinkedMeta { get; set; }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user