From 4df3ed17a4aea32a17a9d441da00b39cdee7d55b Mon Sep 17 00:00:00 2001 From: Damian Viktorovich Morozov Date: Sat, 2 Nov 2024 16:44:41 +0400 Subject: [PATCH] Updated TgStorage --- Core/TgStorage/Common/TgEfEntityBase.cs | 30 ------------- .../Domain/Filters/TgEfFilterRepository.cs | 32 +++++++------- .../Domain/Proxies/TgEfProxyRepository.cs | 44 +++++++++---------- .../Domain/Sources/TgEfSourceRepository.cs | 32 +++++++------- .../Domain/Sources/TgEfSourceViewModel.cs | 2 +- .../Domain/Versions/TgEfVersionRepository.cs | 32 +++++++------- Core/TgStorage/TgEfContext.cs | 10 ++--- 7 files changed, 75 insertions(+), 107 deletions(-) delete mode 100644 Core/TgStorage/Common/TgEfEntityBase.cs diff --git a/Core/TgStorage/Common/TgEfEntityBase.cs b/Core/TgStorage/Common/TgEfEntityBase.cs deleted file mode 100644 index df40e8c..0000000 --- a/Core/TgStorage/Common/TgEfEntityBase.cs +++ /dev/null @@ -1,30 +0,0 @@ -//// This is an independent project of an individual developer. Dear PVS-Studio, please check it. -//// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com - -//namespace TgStorage.Common; - -//public abstract class TgEfEntityBase -//{ -// #region Public and private fields, properties, constructor - -// //[NotMapped] -// //[Column(TgEfConstants.ColumnRowVersion)] -// //public byte[] RowVersion { get; set; } -// //public static readonly string RowVersion = nameof(RowVersion); - -// //[NotMapped] -// //[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] -// //[JsonPropertyName("@odata.etag")] -// //public string ETag -// //{ -// // get; -// // set; -// //} - -// //protected TgEfEntityBase() -// //{ -// // Default(); -// //} - -// #endregion -//} \ No newline at end of file diff --git a/Core/TgStorage/Domain/Filters/TgEfFilterRepository.cs b/Core/TgStorage/Domain/Filters/TgEfFilterRepository.cs index c390a2c..c1eddf4 100644 --- a/Core/TgStorage/Domain/Filters/TgEfFilterRepository.cs +++ b/Core/TgStorage/Domain/Filters/TgEfFilterRepository.cs @@ -15,14 +15,14 @@ public override TgEfStorageResult Get(TgEfFilterEntity item, b if (storageResult.IsExists) return storageResult; TgEfFilterEntity? itemFind = isNoTracking - ? EfContext.Filters.AsNoTracking() - .Where(x => x.FilterType == item.FilterType && x.Name == item.Name) - .SingleOrDefault() - : EfContext.Filters.AsTracking() - .Where(x => x.FilterType == item.FilterType && x.Name == item.Name) - .SingleOrDefault(); + ? EfContext.Filters + .AsNoTracking() + .SingleOrDefault(x => x.FilterType == item.FilterType && x.Name == item.Name) + : EfContext.Filters + .AsTracking() + .SingleOrDefault(x => x.FilterType == item.FilterType && x.Name == item.Name); return itemFind is not null - ? new TgEfStorageResult(TgEnumEntityState.IsExists, itemFind) + ? new(TgEnumEntityState.IsExists, itemFind) : new TgEfStorageResult(TgEnumEntityState.NotExists, item); } @@ -41,7 +41,7 @@ public override async Task> GetAsync(TgEfFil .SingleOrDefaultAsync() .ConfigureAwait(false); return itemFind is not null - ? new TgEfStorageResult(TgEnumEntityState.IsExists, itemFind) + ? new(TgEnumEntityState.IsExists, itemFind) : new TgEfStorageResult(TgEnumEntityState.NotExists, item); } @@ -53,7 +53,7 @@ public override TgEfStorageResult GetFirst(bool isNoTracking) : EfContext.Filters.AsTracking() .FirstOrDefault(); return item is null - ? new TgEfStorageResult(TgEnumEntityState.NotExists) + ? new(TgEnumEntityState.NotExists) : new TgEfStorageResult(TgEnumEntityState.IsExists, item); } @@ -65,7 +65,7 @@ public override async Task> GetFirstAsync(bo : await EfContext.Filters.AsTracking() .FirstOrDefaultAsync().ConfigureAwait(false); return item is null - ? new TgEfStorageResult(TgEnumEntityState.NotExists) + ? new(TgEnumEntityState.NotExists) : new TgEfStorageResult(TgEnumEntityState.IsExists, item); } @@ -88,7 +88,7 @@ public override TgEfStorageResult GetList(int take, int skip, : EfContext.Filters.AsTracking() .ToList(); } - return new TgEfStorageResult(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); + return new(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); } public override async Task> GetListAsync(int take, int skip, bool isNoTracking) @@ -107,7 +107,7 @@ public override async Task> GetListAsync(int ? EfContext.Filters.AsNoTracking().ToList() : EfContext.Filters.AsTracking().ToList(); } - return new TgEfStorageResult(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); + return new(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); } public override TgEfStorageResult GetList(int take, int skip, Expression> where, bool isNoTracking) @@ -133,7 +133,7 @@ public override TgEfStorageResult GetList(int take, int skip, .Where(where) .ToList(); } - return new TgEfStorageResult(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); + return new(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); } public override async Task> GetListAsync(int take, int skip, Expression> where, bool isNoTracking) @@ -160,7 +160,7 @@ public override async Task> GetListAsync(int .Where(where) .ToList(); } - return new TgEfStorageResult(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); + return new(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); } public override int GetCount() => EfContext.Filters.AsNoTracking().Count(); @@ -193,7 +193,7 @@ public override TgEfStorageResult DeleteAll() Delete(item, isSkipFind: true); } } - return new TgEfStorageResult(storageResult.IsExists ? TgEnumEntityState.IsDeleted : TgEnumEntityState.NotDeleted); + return new(storageResult.IsExists ? TgEnumEntityState.IsDeleted : TgEnumEntityState.NotDeleted); } public override async Task> DeleteAllAsync() @@ -206,7 +206,7 @@ public override async Task> DeleteAllAsync() await DeleteAsync(item, isSkipFind: true).ConfigureAwait(false); } } - return new TgEfStorageResult(storageResult.IsExists ? TgEnumEntityState.IsDeleted : TgEnumEntityState.NotDeleted); + return new(storageResult.IsExists ? TgEnumEntityState.IsDeleted : TgEnumEntityState.NotDeleted); } #endregion diff --git a/Core/TgStorage/Domain/Proxies/TgEfProxyRepository.cs b/Core/TgStorage/Domain/Proxies/TgEfProxyRepository.cs index fbe3fa1..86f4bb7 100644 --- a/Core/TgStorage/Domain/Proxies/TgEfProxyRepository.cs +++ b/Core/TgStorage/Domain/Proxies/TgEfProxyRepository.cs @@ -15,14 +15,14 @@ public override TgEfStorageResult Get(TgEfProxyEntity item, boo if (storageResult.IsExists) return storageResult; TgEfProxyEntity? itemFind = isNoTracking - ? EfContext.Proxies.AsNoTracking() - .Where(x => x.Type == item.Type && x.HostName == item.HostName && x.Port == item.Port) - .SingleOrDefault() - : EfContext.Proxies.AsTracking() - .Where(x => x.Type == item.Type && x.HostName == item.HostName && x.Port == item.Port) - .SingleOrDefault(); + ? EfContext.Proxies + .AsNoTracking() + .SingleOrDefault(x => x.Type == item.Type && x.HostName == item.HostName && x.Port == item.Port) + : EfContext.Proxies + .AsTracking() + .SingleOrDefault(x => x.Type == item.Type && x.HostName == item.HostName && x.Port == item.Port); return itemFind is not null - ? new TgEfStorageResult(TgEnumEntityState.IsExists, itemFind) + ? new(TgEnumEntityState.IsExists, itemFind) : new TgEfStorageResult(TgEnumEntityState.NotExists, item); } @@ -41,7 +41,7 @@ public override async Task> GetAsync(TgEfProx .SingleOrDefaultAsync() .ConfigureAwait(false); return itemFind is not null - ? new TgEfStorageResult(TgEnumEntityState.IsExists, itemFind) + ? new(TgEnumEntityState.IsExists, itemFind) : new TgEfStorageResult(TgEnumEntityState.NotExists, item); } @@ -51,7 +51,7 @@ public override TgEfStorageResult GetFirst(bool isNoTracking) ? EfContext.Proxies.AsNoTracking().FirstOrDefault() : EfContext.Proxies.AsTracking().FirstOrDefault(); return item is null - ? new TgEfStorageResult(TgEnumEntityState.NotExists) + ? new(TgEnumEntityState.NotExists) : new TgEfStorageResult(TgEnumEntityState.IsExists, item); } @@ -61,7 +61,7 @@ public override async Task> GetFirstAsync(boo ? await EfContext.Proxies.AsNoTracking().FirstOrDefaultAsync().ConfigureAwait(false) : await EfContext.Proxies.AsTracking().FirstOrDefaultAsync().ConfigureAwait(false); return item is null - ? new TgEfStorageResult(TgEnumEntityState.NotExists) + ? new(TgEnumEntityState.NotExists) : new TgEfStorageResult(TgEnumEntityState.IsExists, item); } @@ -80,7 +80,7 @@ public override TgEfStorageResult GetList(int take, int skip, b ? EfContext.Proxies.AsNoTracking().ToList() : EfContext.Proxies.AsTracking().ToList(); } - return new TgEfStorageResult(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); + return new(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); } public override async Task> GetListAsync(int take, int skip, bool isNoTracking) @@ -99,7 +99,7 @@ public override async Task> GetListAsync(int ? EfContext.Proxies.AsNoTracking().ToList() : EfContext.Proxies.AsTracking().ToList(); } - return new TgEfStorageResult(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); + return new(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); } public override TgEfStorageResult GetList(int take, int skip, Expression> where, bool isNoTracking) @@ -125,7 +125,7 @@ public override TgEfStorageResult GetList(int take, int skip, E .Where(where) .ToList(); } - return new TgEfStorageResult(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); + return new(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); } public override async Task> GetListAsync(int take, int skip, Expression> where, bool isNoTracking) @@ -152,7 +152,7 @@ public override async Task> GetListAsync(int .Where(where) .ToList(); } - return new TgEfStorageResult(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); + return new(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); } public override int GetCount() => EfContext.Proxies.AsNoTracking().Count(); @@ -185,7 +185,7 @@ public override TgEfStorageResult DeleteAll() Delete(item, isSkipFind: true); } } - return new TgEfStorageResult(storageResult.IsExists ? TgEnumEntityState.IsDeleted : TgEnumEntityState.NotDeleted); + return new(storageResult.IsExists ? TgEnumEntityState.IsDeleted : TgEnumEntityState.NotDeleted); } public override async Task> DeleteAllAsync() @@ -198,7 +198,7 @@ public override async Task> DeleteAllAsync() await DeleteAsync(item, isSkipFind: true).ConfigureAwait(false); } } - return new TgEfStorageResult(storageResult.IsExists ? TgEnumEntityState.IsDeleted : TgEnumEntityState.NotDeleted); + return new(storageResult.IsExists ? TgEnumEntityState.IsDeleted : TgEnumEntityState.NotDeleted); } #endregion @@ -208,21 +208,21 @@ public override async Task> DeleteAllAsync() public TgEfStorageResult GetCurrentProxy(TgEfStorageResult storageResult) { if (!storageResult.IsExists) - return new TgEfStorageResult(TgEnumEntityState.NotExists); + return new(TgEnumEntityState.NotExists); TgEfStorageResult storageResultProxy = Get( - new TgEfProxyEntity { Uid = storageResult.Item.ProxyUid ?? Guid.Empty }, isNoTracking: false); - return storageResultProxy.IsExists ? storageResultProxy : new TgEfStorageResult(TgEnumEntityState.NotExists); + new() { Uid = storageResult.Item.ProxyUid ?? Guid.Empty }, isNoTracking: false); + return storageResultProxy.IsExists ? storageResultProxy : new(TgEnumEntityState.NotExists); } public async Task> GetCurrentProxyAsync(TgEfStorageResult storageResult) { if (!storageResult.IsExists) - return new TgEfStorageResult(TgEnumEntityState.NotExists); + return new(TgEnumEntityState.NotExists); TgEfStorageResult storageResultProxy = await GetAsync( - new TgEfProxyEntity { Uid = storageResult.Item.ProxyUid ?? Guid.Empty }, isNoTracking: false); - return storageResultProxy.IsExists ? storageResultProxy : new TgEfStorageResult(TgEnumEntityState.NotExists); + new() { Uid = storageResult.Item.ProxyUid ?? Guid.Empty }, isNoTracking: false); + return storageResultProxy.IsExists ? storageResultProxy : new(TgEnumEntityState.NotExists); } public Guid GetCurrentProxyUid(TgEfStorageResult storageResult) => GetCurrentProxy(storageResult).Item.Uid; diff --git a/Core/TgStorage/Domain/Sources/TgEfSourceRepository.cs b/Core/TgStorage/Domain/Sources/TgEfSourceRepository.cs index 733f790..cf55469 100644 --- a/Core/TgStorage/Domain/Sources/TgEfSourceRepository.cs +++ b/Core/TgStorage/Domain/Sources/TgEfSourceRepository.cs @@ -15,14 +15,14 @@ public override TgEfStorageResult Get(TgEfSourceEntity item, b if (storageResult.IsExists) return storageResult; TgEfSourceEntity? itemFind = isNoTracking - ? EfContext.Sources.AsNoTracking() - .Where(x => x.Id == item.Id) - .SingleOrDefault() - : EfContext.Sources.AsTracking() - .Where(x => x.Id == item.Id) - .SingleOrDefault(); + ? EfContext.Sources + .AsNoTracking() + .SingleOrDefault(x => x.Id == item.Id) + : EfContext.Sources + .AsTracking() + .SingleOrDefault(x => x.Id == item.Id); return itemFind is not null - ? new TgEfStorageResult(TgEnumEntityState.IsExists, itemFind) + ? new(TgEnumEntityState.IsExists, itemFind) : new TgEfStorageResult(TgEnumEntityState.NotExists, item); } @@ -41,7 +41,7 @@ public override async Task> GetAsync(TgEfSou .SingleOrDefaultAsync() .ConfigureAwait(false); return itemFind is not null - ? new TgEfStorageResult(TgEnumEntityState.IsExists, itemFind) + ? new(TgEnumEntityState.IsExists, itemFind) : new TgEfStorageResult(TgEnumEntityState.NotExists, item); } @@ -51,7 +51,7 @@ public override TgEfStorageResult GetFirst(bool isNoTracking) ? EfContext.Sources.AsNoTracking().FirstOrDefault() : EfContext.Sources.AsTracking().FirstOrDefault(); return item is null - ? new TgEfStorageResult(TgEnumEntityState.NotExists) + ? new(TgEnumEntityState.NotExists) : new TgEfStorageResult(TgEnumEntityState.IsExists, item); } @@ -61,7 +61,7 @@ public override async Task> GetFirstAsync(bo ? await EfContext.Sources.AsNoTracking().FirstOrDefaultAsync().ConfigureAwait(false) : await EfContext.Sources.AsTracking().FirstOrDefaultAsync().ConfigureAwait(false); return item is null - ? new TgEfStorageResult(TgEnumEntityState.NotExists) + ? new(TgEnumEntityState.NotExists) : new TgEfStorageResult(TgEnumEntityState.IsExists, item); } @@ -80,7 +80,7 @@ public override TgEfStorageResult GetList(int take, int skip, ? EfContext.Sources.AsNoTracking().ToList() : EfContext.Sources.AsTracking().ToList(); } - return new TgEfStorageResult(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); + return new(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); } public override async Task> GetListAsync(int take, int skip, bool isNoTracking) @@ -99,7 +99,7 @@ public override async Task> GetListAsync(int ? EfContext.Sources.AsNoTracking().ToList() : EfContext.Sources.AsTracking().ToList(); } - return new TgEfStorageResult(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); + return new(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); } public override TgEfStorageResult GetList(int take, int skip, Expression> where, bool isNoTracking) @@ -125,7 +125,7 @@ public override TgEfStorageResult GetList(int take, int skip, .Where(where) .ToList(); } - return new TgEfStorageResult(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); + return new(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); } public override async Task> GetListAsync(int take, int skip, Expression> where, bool isNoTracking) @@ -152,7 +152,7 @@ public override async Task> GetListAsync(int .Where(where) .ToList(); } - return new TgEfStorageResult(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); + return new(items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); } public override int GetCount() => EfContext.Sources.AsNoTracking().Count(); @@ -185,7 +185,7 @@ public override TgEfStorageResult DeleteAll() Delete(item, isSkipFind: true); } } - return new TgEfStorageResult(storageResult.IsExists ? TgEnumEntityState.IsDeleted : TgEnumEntityState.NotDeleted); + return new(storageResult.IsExists ? TgEnumEntityState.IsDeleted : TgEnumEntityState.NotDeleted); } public override async Task> DeleteAllAsync() @@ -198,7 +198,7 @@ public override async Task> DeleteAllAsync() await DeleteAsync(item, isSkipFind: true).ConfigureAwait(false); } } - return new TgEfStorageResult(storageResult.IsExists ? TgEnumEntityState.IsDeleted : TgEnumEntityState.NotDeleted); + return new(storageResult.IsExists ? TgEnumEntityState.IsDeleted : TgEnumEntityState.NotDeleted); } #endregion diff --git a/Core/TgStorage/Domain/Sources/TgEfSourceViewModel.cs b/Core/TgStorage/Domain/Sources/TgEfSourceViewModel.cs index 64da471..fa2de6f 100644 --- a/Core/TgStorage/Domain/Sources/TgEfSourceViewModel.cs +++ b/Core/TgStorage/Domain/Sources/TgEfSourceViewModel.cs @@ -38,7 +38,7 @@ public Guid SourceUid set { TgEfStorageResult storageResult = SourceRepository.Get( - new TgEfSourceEntity { Uid = value }, isNoTracking: false); + new() { Uid = value }, isNoTracking: false); Item = storageResult.IsExists ? storageResult.Item : SourceRepository.GetNew(isNoTracking: false).Item; diff --git a/Core/TgStorage/Domain/Versions/TgEfVersionRepository.cs b/Core/TgStorage/Domain/Versions/TgEfVersionRepository.cs index 4c7716c..f79f0fb 100644 --- a/Core/TgStorage/Domain/Versions/TgEfVersionRepository.cs +++ b/Core/TgStorage/Domain/Versions/TgEfVersionRepository.cs @@ -15,14 +15,14 @@ public override TgEfStorageResult Get(TgEfVersionEntity item, if (storageResult.IsExists) return storageResult; TgEfVersionEntity? itemFind = isNoTracking - ? EfContext.Versions.AsNoTracking() - .Where(x => x.Version == item.Version) - .SingleOrDefault() - : EfContext.Versions.AsTracking() - .Where(x => x.Version == item.Version) - .SingleOrDefault(); + ? EfContext.Versions + .AsNoTracking() + .SingleOrDefault(x => x.Version == item.Version) + : EfContext.Versions + .AsTracking() + .SingleOrDefault(x => x.Version == item.Version); return itemFind is not null - ? new TgEfStorageResult(TgEnumEntityState.IsExists, itemFind) + ? new(TgEnumEntityState.IsExists, itemFind) : new TgEfStorageResult(TgEnumEntityState.NotExists, item); } @@ -41,7 +41,7 @@ public override async Task> GetAsync(TgEfVe .SingleOrDefaultAsync() .ConfigureAwait(false); return itemFind is not null - ? new TgEfStorageResult(TgEnumEntityState.IsExists, itemFind) + ? new(TgEnumEntityState.IsExists, itemFind) : new TgEfStorageResult(TgEnumEntityState.NotExists, item); } @@ -51,7 +51,7 @@ public override TgEfStorageResult GetFirst(bool isNoTracking) ? EfContext.Versions.AsNoTracking().FirstOrDefault() : EfContext.Versions.AsTracking().FirstOrDefault(); return item is null - ? new TgEfStorageResult(TgEnumEntityState.NotExists) + ? new(TgEnumEntityState.NotExists) : new TgEfStorageResult(TgEnumEntityState.IsExists, item); } @@ -61,7 +61,7 @@ public override async Task> GetFirstAsync(b ? await EfContext.Versions.AsNoTracking().FirstOrDefaultAsync().ConfigureAwait(false) : await EfContext.Versions.AsTracking().FirstOrDefaultAsync().ConfigureAwait(false); return item is null - ? new TgEfStorageResult(TgEnumEntityState.NotExists) + ? new(TgEnumEntityState.NotExists) : new TgEfStorageResult(TgEnumEntityState.IsExists, item); } @@ -81,7 +81,7 @@ public override TgEfStorageResult GetList(int take, int skip, : EfContext.Versions.AsTracking().ToList(); } - return new TgEfStorageResult( + return new( items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); } @@ -102,7 +102,7 @@ public override async Task> GetListAsync(in : EfContext.Versions.AsTracking().ToList(); } - return new TgEfStorageResult( + return new( items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); } @@ -130,7 +130,7 @@ public override TgEfStorageResult GetList(int take, int skip, .ToList(); } - return new TgEfStorageResult( + return new( items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); } @@ -159,7 +159,7 @@ public override async Task> GetListAsync(in .ToList(); } - return new TgEfStorageResult( + return new( items.Any() ? TgEnumEntityState.IsExists : TgEnumEntityState.NotExists, items); } @@ -195,7 +195,7 @@ public override TgEfStorageResult DeleteAll() } } - return new TgEfStorageResult(storageResult.IsExists + return new(storageResult.IsExists ? TgEnumEntityState.IsDeleted : TgEnumEntityState.NotDeleted); } @@ -212,7 +212,7 @@ public override async Task> DeleteAllAsync( } } - return new TgEfStorageResult(storageResult.IsExists + return new(storageResult.IsExists ? TgEnumEntityState.IsDeleted : TgEnumEntityState.NotDeleted); } diff --git a/Core/TgStorage/TgEfContext.cs b/Core/TgStorage/TgEfContext.cs index f2d8491..0adbe17 100644 --- a/Core/TgStorage/TgEfContext.cs +++ b/Core/TgStorage/TgEfContext.cs @@ -183,7 +183,6 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) //modelBuilder.Entity().Property(TgEfConstants.ColumnRowVersion).IsRowVersion().HasColumnName(TgEfConstants.ColumnRowVersion); //modelBuilder.Entity().Property(TgEfConstants.ColumnRowVersion).IsRowVersion().HasColumnName(TgEfConstants.ColumnRowVersion); //// Ingore - //modelBuilder.Ignore(); //modelBuilder.Entity().Ignore(TgEfConstants.ColumnRowVersion); //modelBuilder.Entity().Ignore(TgEfConstants.ColumnRowVersion); //modelBuilder.Entity().Ignore(TgEfConstants.ColumnRowVersion); @@ -191,6 +190,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) //modelBuilder.Entity().Ignore(TgEfConstants.ColumnRowVersion); //modelBuilder.Entity().Ignore(TgEfConstants.ColumnRowVersion); //modelBuilder.Entity().Ignore(TgEfConstants.ColumnRowVersion); + // FOREIGN KEY: Apps modelBuilder.Entity() .HasOne(app => app.Proxy) @@ -220,13 +220,11 @@ public string ToConsoleString(TgEfSourceEntity source) => public string ToConsoleString(TgEfVersionEntity version) => $"{version.Version} {version.Description}"; /// Check table exists - /// public bool IsTableExists(string tableName) { - string? result = Database.SqlQuery( - $"SELECT [name] AS [Value] FROM [sqlite_master]") - .Where(x => x == tableName) - .SingleOrDefault(); + string? result = Database + .SqlQuery($"SELECT [name] AS [Value] FROM [sqlite_master]") + .SingleOrDefault(x => x == tableName); return tableName == result; }