From d3dbd6fd08ad638f1c94aa1aeec37b1061a79529 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Mon, 27 Jul 2026 03:07:37 -0700 Subject: [PATCH 01/60] forgot include --- Integration Tests/Tests/DepotBaseTests.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Integration Tests/Tests/DepotBaseTests.cs b/Integration Tests/Tests/DepotBaseTests.cs index a48bffb..917cdd1 100644 --- a/Integration Tests/Tests/DepotBaseTests.cs +++ b/Integration Tests/Tests/DepotBaseTests.cs @@ -19,6 +19,11 @@ public class DepotBaseTests protected override EntityProxy EntityFactory(string Entropy) { return new EntityProxy { + EntityDependencyProxy = _storeManager.Store( + new EntityDependencyProxy() + ) + .GetAwaiter() + .GetResult() }; } From 77d7442e17cd11b1b65a4539a2b0997b05ae38a4 Mon Sep 17 00:00:00 2001 From: jr110 Date: Mon, 27 Jul 2026 21:54:30 -0700 Subject: [PATCH 02/60] Issue #41 - Adding async support for testing methods --- CSM Database Core/CHANGELOG.md | 12 +++++ .../Bases/DepotIntegrationTestsBase.cs | 52 +++++++++++++------ .../Bases/TestingDataHandlerBase.cs | 23 ++++++-- .../Managers/TestingStoreManager.cs | 28 ++++++++-- Integration Tests/Tests/DepotBaseTests.cs | 12 ++++- 5 files changed, 101 insertions(+), 26 deletions(-) diff --git a/CSM Database Core/CHANGELOG.md b/CSM Database Core/CHANGELOG.md index 4d90278..dbd0d72 100644 --- a/CSM Database Core/CHANGELOG.md +++ b/CSM Database Core/CHANGELOG.md @@ -1,5 +1,17 @@ # CSM Database Core CHANGELOG +## [x.x.x] - xx.xx-xxxx + +### Changes +- Added synchronous and asynchronous support methods for CSM Database Testing: + + - EntityFactory/EntityFactoryAsync. + - Sampling/SamplingAsync. + - RunEntityFactory/RunEntityFactoryAsync. + +### Breaks +- Now the Store() Method requires the EntityFactoryAsync parameter method instead of the EntityFactory method for asynchronous operations. + ## [7.0.0] - 21.07-2026 ### Changes diff --git a/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs b/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs index d9ad720..535b5c8 100644 --- a/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs +++ b/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs @@ -102,6 +102,17 @@ public DepotIntegrationTestsBase(DatabaseFactory? database = null, params Databa #region Abtraction + /// + /// Creates a context [Entity] for asynchronous testing data creation and assertion. + /// + /// + /// Random 16 length value for unique properties. + /// + /// + /// A correctly built . + /// + protected abstract Task EntityFactoryAsync(string Entropy); + /// /// Creates a context [Entity] for testing data creation and assertion. /// @@ -184,6 +195,17 @@ protected TEntity Sampling() { return TestingStoreManager.RunEntityFactory(EntityFactory); } + /// + /// Creates a new Asynchronous instance based on the implementation. + /// + /// A new instance + /// + /// This instance is created but not stored in the database. + /// + protected async Task SamplingAsync() { + return await TestingStoreManager.RunEntityFactoryAsync(EntityFactoryAsync); + } + /// /// Creates a new collection of instances based on the implementation. /// @@ -210,7 +232,7 @@ protected TEntity[] Sampling(int Count) { /// [Fact(DisplayName = "[Create Single]: Entity created")] public virtual async Task Create_Single_Success() { - TEntity sample = Sampling(); + TEntity sample = Sampling(); TEntity storedEntity = await _depot.Create(sample); await CommitSampleEntities([storedEntity]); @@ -260,7 +282,7 @@ public virtual async Task Create_Batch_Success() { /// [Fact(DisplayName = "[Read Single]: Entity read by (Id)")] public virtual async Task Read_Single_ById_Success() { - TEntity sample = await Store(EntityFactory); + TEntity sample = await Store(EntityFactoryAsync); TEntity readEntity = await _depot.Read(sample.Id); Assert.Multiple( @@ -282,7 +304,7 @@ public virtual async Task Read_Single_ById_Success() { /// [Fact(DisplayName = "[Read Batch]: Entities read by (Id)")] public virtual async Task Read_Batch_ById_Sucess() { - TEntity[] samples = await Store(20, EntityFactory); + TEntity[] samples = await Store(20, EntityFactoryAsync); long[] sampleIds = [.. samples.Select(i => i.Id)]; BatchOperationOutput readEntities = await _depot.Read(sampleIds); @@ -313,7 +335,7 @@ public virtual async Task Read_Batch_ById_Sucess() { /// [Fact(DisplayName = "[Read Batch]: Entities read by (Query [First matching])")] public virtual async Task Read_Batch_ByQueryFirstMatch_Success() { - TEntity[] samples = await Store(2, EntityFactory); + TEntity[] samples = await Store(2, EntityFactoryAsync); TEntity samplePivot = samples[0]; BatchOperationOutput readEntites = await _depot.Read( @@ -349,7 +371,7 @@ public virtual async Task Read_Batch_ByQueryFirstMatch_Success() { /// [Fact(DisplayName = "[Read Batch]: Entities read by (Query [Last matching])")] public virtual async Task Read_Batch_ByQueryLastMatch_Success() { - TEntity[] samples = await Store(2, EntityFactory); + TEntity[] samples = await Store(2, EntityFactoryAsync); TEntity samplePivot = samples[1]; BatchOperationOutput readEntites = await _depot.Read( @@ -385,7 +407,7 @@ public virtual async Task Read_Batch_ByQueryLastMatch_Success() { /// [Fact(DisplayName = "[Read Batch]: Entities read by (Query [All matching])")] public virtual async Task Read_Batch_ByQueryAllMatches_Success() { - TEntity[] samples = await Store(2, EntityFactory); + TEntity[] samples = await Store(2, EntityFactoryAsync); BatchOperationOutput readEntites = await _depot.Read( new QueryInput> { @@ -427,7 +449,7 @@ public virtual async Task Read_Batch_ByQueryAllMatches_Success() { /// [Fact(DisplayName = $"[Update Single]: Created when (Create) property enabled")] public virtual async Task Update_Single_OnCreateEnabled_Success() { - TEntity sample = TestingStoreManager.RunEntityFactory(EntityFactory); + TEntity sample = await TestingStoreManager.RunEntityFactoryAsync(EntityFactoryAsync); UpdateOutput updateOutput = await _depot.Update( new QueryInput> { @@ -459,7 +481,7 @@ public virtual async Task Update_Single_OnCreateEnabled_Success() { /// [Fact(DisplayName = $"[Update Single]: Throws exception (CREATE_DISABLED).")] public virtual async Task Update_Single_OnCreateDisabled_ErrorCreateDisabled() { - TEntity sample = TestingStoreManager.RunEntityFactory(EntityFactory); + TEntity sample = await TestingStoreManager.RunEntityFactoryAsync(EntityFactoryAsync); DepotError depotException = await Assert.ThrowsAsync>( async () => { @@ -482,7 +504,7 @@ public virtual async Task Update_Single_OnCreateDisabled_ErrorCreateDisabled() { /// [Fact(DisplayName = $"[Update Single]: Throws exception (UNFOUND)")] public virtual async Task Update_Single_ErrorUnfound() { - TEntity sample = TestingStoreManager.RunEntityFactory(EntityFactory); + TEntity sample = await TestingStoreManager.RunEntityFactoryAsync(EntityFactoryAsync); sample.Id = await GeneratePointer(); DepotError depotException = await Assert.ThrowsAsync>( @@ -533,7 +555,7 @@ public virtual async Task Delete_Single_ById_ErrorUnfound() { /// [Fact(DisplayName = $"[Delete Single]: Entity deleted by (Id)")] public virtual async Task Delete_Single_ById_Success() { - TEntity entity = await Store(EntityFactory); + TEntity entity = await Store(EntityFactoryAsync); await _depot.Delete(entity.Id); await CommitSampleEntities([]); @@ -548,7 +570,7 @@ public virtual async Task Delete_Single_ById_Success() { /// [Fact(DisplayName = $"[Delete Batch]: Entities deleted by (Query)")] public virtual async Task Delete_Batch_ByQuery_Success() { - TEntity entity = (await Store(10, EntityFactory))[0]; + TEntity entity = (await Store(10, EntityFactoryAsync))[0]; BatchOperationOutput deleteOutput = await _depot.Delete( new QueryInput>() { @@ -589,7 +611,7 @@ public virtual async Task Delete_Batch_ByQuery_Success() { [Fact(DisplayName = "[View]: Simple view calculation")] public virtual async Task View_Scucess() { const int viewPage = 1; - await Store(30, EntityFactory); + await Store(30, EntityFactoryAsync); ViewOutput viewOutput = await _depot.View( new QueryInput> { @@ -616,7 +638,7 @@ public virtual async Task View_Scucess() { [Fact(DisplayName = "[View]: Specific page")] public virtual async Task View_OnSpecificPage_Sucess() { const int viewPage = 2; - await Store(30, EntityFactory); + await Store(30, EntityFactoryAsync); ViewOutput viewOutput = await _depot.View( new QueryInput> { @@ -722,7 +744,7 @@ public virtual async Task View_ProeprtyFilteredByContains_Success() { throw SkipException.ForSkip("This assertion is only available for entities that have an evaluable string property since CONTAINS method is currently only supported to filter string type properties."); } - TEntity sampleEntity = await Store(EntityFactory); + TEntity sampleEntity = await Store(EntityFactoryAsync); object? sampleValue = _evaluableProperty.GetValue(sampleEntity); ViewOutput qOut = await _depot.View( @@ -761,7 +783,7 @@ public virtual async Task View_LogicalFilteredByOr_Success() { throw SkipException.ForSkip("This assertion is only available for entities that have an evaluable string property since CONTAINS method is currently only supported to filter string type properties."); } - TEntity[] entities = await Store(2, EntityFactory); + TEntity[] entities = await Store(2, EntityFactoryAsync); List possibleValues = []; List> filters = []; diff --git a/CSM Database Testing/Abstractions/Bases/TestingDataHandlerBase.cs b/CSM Database Testing/Abstractions/Bases/TestingDataHandlerBase.cs index 0185827..08deba0 100644 --- a/CSM Database Testing/Abstractions/Bases/TestingDataHandlerBase.cs +++ b/CSM Database Testing/Abstractions/Bases/TestingDataHandlerBase.cs @@ -21,6 +21,21 @@ namespace CSM_Database_Testing.Abstractions.Bases; public delegate TEntity EntityFactory(string Entropy) where TEntity : class, IEntity; +/// +/// Public Delegate for Asynchronous [Entity] factory [Quality] purposes. +/// +/// +/// Type of the [Entity] to build. +/// +/// +/// Random 16 length to generate unique properties records. +/// +/// +/// The Entity stored in the database. +/// +public delegate Task EntityFactoryAsync(string Entropy) + where TEntity : class, IEntity; + /// /// [Abstract] for Quality Suits implementations that uses database data direct handling to store data for testing purposes. /// @@ -64,15 +79,15 @@ public Task Store(TEntity2 entity) return _storeManager.Store(entity); } - /// - protected Task Store(EntityFactory entityFactory) + /// + protected Task Store(EntityFactoryAsync entityFactory) where TEntity2 : class, IEntity { return _storeManager.Store(entityFactory); } - /// - protected async Task Store(int quantity, EntityFactory entityFactory) + /// + protected async Task Store(int quantity, EntityFactoryAsync entityFactory) where TEntity2 : class, IEntity, new() { return await _storeManager.Store(quantity, entityFactory); diff --git a/CSM Database Testing/Managers/TestingStoreManager.cs b/CSM Database Testing/Managers/TestingStoreManager.cs index 3d78b76..6a04848 100644 --- a/CSM Database Testing/Managers/TestingStoreManager.cs +++ b/CSM Database Testing/Managers/TestingStoreManager.cs @@ -124,10 +124,10 @@ await DatabaseUtils.SanitizeEntity(db, entity) /// /// Stored built . /// - public async Task Store(EntityFactory entityFactory) + public async Task Store(EntityFactoryAsync entityFactory) where TEntity2 : class, IEntity { - TEntity2 toStore = RunEntityFactory(entityFactory); + TEntity2 toStore = await RunEntityFactoryAsync(entityFactory); toStore = await Store(toStore); return toStore; @@ -148,7 +148,7 @@ public async Task Store(EntityFactory entityFactor /// /// The stored and updated [Entities] stored. /// - public async Task Store(int quantity, EntityFactory entityFactory) + public async Task Store(int quantity, EntityFactoryAsync entityFactory) where TEntity2 : class, IEntity, new() { List entities = []; @@ -156,7 +156,7 @@ public async Task Store(int quantity, EntityFactory Store(int quantity, EntityFactory /// The generated [Entity] object. /// - public static TEntity2 RunEntityFactory(EntityFactory factory) + public static TEntity2 RunEntityFactory(EntityFactory factory) where TEntity2 : class, IEntity { return factory(RandomUtils.String(16)); } + /// + /// Internal runner for utilizations, automatically sends the [Entropy] parameter. + /// + /// + /// Type of the [Entity] build by the . + /// + /// + /// [Entity] factory function. + /// + /// + /// The generated [Entity] object. + /// + public static async Task RunEntityFactoryAsync(EntityFactoryAsync factory) + where TEntity2 : class, IEntity { + + return await factory(RandomUtils.String(16)); + } + /// /// Retrieves the database instance for the given based on the subscribed DatabaseFactories. /// diff --git a/Integration Tests/Tests/DepotBaseTests.cs b/Integration Tests/Tests/DepotBaseTests.cs index a48bffb..0c28ab4 100644 --- a/Integration Tests/Tests/DepotBaseTests.cs +++ b/Integration Tests/Tests/DepotBaseTests.cs @@ -17,10 +17,17 @@ namespace Integration_Tests.Tests; public class DepotBaseTests : DepotIntegrationTestsBase { - protected override EntityProxy EntityFactory(string Entropy) { + protected override async Task EntityFactoryAsync(string Entropy) { + return await Task.FromResult(new EntityProxy { + + }); + } + + protected override EntityProxy EntityFactory(string Entropy) { return new EntityProxy { + }; - } + } /// /// Method: @@ -96,4 +103,5 @@ await Store( updatedEntity.EntityDependencyProxy.Id ); } + } From 33f3fd5263c6fd040b7196635a6fc83a0624f7cf Mon Sep 17 00:00:00 2001 From: jr110 Date: Wed, 29 Jul 2026 19:29:55 -0700 Subject: [PATCH 03/60] Issue #44 - Adding get method in [TestingStoreManager] --- CSM Database Core/CHANGELOG.md | 12 -------- .../Bases/DepotIntegrationTestsBase.cs | 8 +++-- .../Bases/TestingDataHandlerBase.cs | 7 +++++ CSM Database Testing/CHANGELOG.md | 19 ++++++++++++ .../Managers/TestingStoreManager.cs | 29 +++++++++++++++++++ 5 files changed, 61 insertions(+), 14 deletions(-) diff --git a/CSM Database Core/CHANGELOG.md b/CSM Database Core/CHANGELOG.md index dbd0d72..4d90278 100644 --- a/CSM Database Core/CHANGELOG.md +++ b/CSM Database Core/CHANGELOG.md @@ -1,17 +1,5 @@ # CSM Database Core CHANGELOG -## [x.x.x] - xx.xx-xxxx - -### Changes -- Added synchronous and asynchronous support methods for CSM Database Testing: - - - EntityFactory/EntityFactoryAsync. - - Sampling/SamplingAsync. - - RunEntityFactory/RunEntityFactoryAsync. - -### Breaks -- Now the Store() Method requires the EntityFactoryAsync parameter method instead of the EntityFactory method for asynchronous operations. - ## [7.0.0] - 21.07-2026 ### Changes diff --git a/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs b/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs index 535b5c8..4a96ace 100644 --- a/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs +++ b/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs @@ -560,8 +560,8 @@ public virtual async Task Delete_Single_ById_Success() { await _depot.Delete(entity.Id); await CommitSampleEntities([]); - TEntity? searchedEntity = _database.Set().Find(entity.Id); - Assert.Null(searchedEntity); + List searchedEntity = await Get([entity]); + Assert.Empty(searchedEntity); } /// @@ -581,11 +581,15 @@ public virtual async Task Delete_Batch_ByQuery_Success() { ); await CommitSampleEntities([]); + List searchedEntity = await Get([entity]); + Assert.Empty(searchedEntity); + Assert.Multiple( [ () => Assert.False(deleteOutput.Failed), () => Assert.Empty(deleteOutput.Failures), () => Assert.NotEmpty(deleteOutput.Successes), + () => Assert.Empty(searchedEntity), () => { TEntity deletedEntity = deleteOutput.Successes[0]; diff --git a/CSM Database Testing/Abstractions/Bases/TestingDataHandlerBase.cs b/CSM Database Testing/Abstractions/Bases/TestingDataHandlerBase.cs index 08deba0..b28150b 100644 --- a/CSM Database Testing/Abstractions/Bases/TestingDataHandlerBase.cs +++ b/CSM Database Testing/Abstractions/Bases/TestingDataHandlerBase.cs @@ -92,4 +92,11 @@ protected async Task Store(int quantity, EntityFactoryAsyn return await _storeManager.Store(quantity, entityFactory); } + + /// + protected async Task> Get(TEntity2[] entities) + where TEntity2 : class, IEntity, new() { + + return await _storeManager.Get(entities); + } } diff --git a/CSM Database Testing/CHANGELOG.md b/CSM Database Testing/CHANGELOG.md index 008f85d..9f1a3e3 100644 --- a/CSM Database Testing/CHANGELOG.md +++ b/CSM Database Testing/CHANGELOG.md @@ -1,5 +1,24 @@ # CSM Database Testing CHANGELOG +## [x.x.x] - xx.xx-xxxx + +### Changes + +- Added synchronous and asynchronous support methods for CSM Database Testing: + + - EntityFactory/EntityFactoryAsync. + - Sampling/SamplingAsync. + - RunEntityFactory/RunEntityFactoryAsync. + +- Added Get() method to [TestingStoreManager] for entity persistence validation. + +- Added persistence validations for Delete tests in [DepotIntegrationTests]. + +### Breaks + +- Now the Store() Method requires the EntityFactoryAsync parameter method instead of the EntityFactory method for asynchronous operations. + + ## [7.0.2] - 18.06-2026 ### Removed diff --git a/CSM Database Testing/Managers/TestingStoreManager.cs b/CSM Database Testing/Managers/TestingStoreManager.cs index 6a04848..dd56640 100644 --- a/CSM Database Testing/Managers/TestingStoreManager.cs +++ b/CSM Database Testing/Managers/TestingStoreManager.cs @@ -221,4 +221,33 @@ DbContext GetDatabase(Type databaseType) { ? throw new Exception($"No factory subscribed for [({databaseType.Name})]") : factory(); } + + /// + /// Retrieves the stored instances that match the given . + /// + /// + /// Type of the to retrieve. + /// + /// + /// Collection of instances to look up. + /// + /// + /// Array of instances whose is contained in . + /// Only the IDs that exist in the database are included. + /// + public async Task> Get(TEntity2[] entities) + where TEntity2 : class, IEntity, new() { + + using DbContext database = GetDatabase(new TEntity2().Database); + + List found = []; + foreach (TEntity2 entity in entities) { + TEntity2? foundEntity = await database.Set().FindAsync(entity.Id); + if (foundEntity is not null) { + found.Add(foundEntity); + } + } + + return found; + } } From 74e8a471a84eb705778be9fa6dd5ac78900ddfa6 Mon Sep 17 00:00:00 2001 From: jr110 Date: Wed, 29 Jul 2026 20:02:39 -0700 Subject: [PATCH 04/60] removing unnecesary sync methods in csm database testing --- .../Bases/DepotIntegrationTestsBase.cs | 64 ++++++------------- .../Bases/TestingDataHandlerBase.cs | 27 ++------ CSM Database Testing/CHANGELOG.md | 10 +-- .../Managers/TestingStoreManager.cs | 28 ++------ Integration Tests/Tests/DepotBaseTests.cs | 8 +-- 5 files changed, 38 insertions(+), 99 deletions(-) diff --git a/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs b/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs index 4a96ace..542acfe 100644 --- a/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs +++ b/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs @@ -111,18 +111,7 @@ public DepotIntegrationTestsBase(DatabaseFactory? database = null, params Databa /// /// A correctly built . /// - protected abstract Task EntityFactoryAsync(string Entropy); - - /// - /// Creates a context [Entity] for testing data creation and assertion. - /// - /// - /// Random 16 length value for unique properties. - /// - /// - /// A correctly built . - /// - protected abstract TEntity EntityFactory(string Entropy); + protected abstract Task EntityFactory(string Entropy); #endregion @@ -184,17 +173,6 @@ protected async Task GeneratePointer(bool noStored = false) { #region Sampling - /// - /// Creates a new instance based on the implementation. - /// - /// A new instance - /// - /// This instance is created but not stored in the database. - /// - protected TEntity Sampling() { - return TestingStoreManager.RunEntityFactory(EntityFactory); - } - /// /// Creates a new Asynchronous instance based on the implementation. /// @@ -202,8 +180,8 @@ protected TEntity Sampling() { /// /// This instance is created but not stored in the database. /// - protected async Task SamplingAsync() { - return await TestingStoreManager.RunEntityFactoryAsync(EntityFactoryAsync); + protected async Task Sampling() { + return await TestingStoreManager.RunEntityFactory(EntityFactory); } /// @@ -218,8 +196,8 @@ protected async Task SamplingAsync() { /// /// This instance collection is created but not stored in the database. /// - protected TEntity[] Sampling(int Count) { - return [.. Enumerable.Range(0, Count).Select(_ => TestingStoreManager.RunEntityFactory(EntityFactory))]; + protected Task Sampling(int Count) { + return Task.WhenAll([.. Enumerable.Range(0, Count).Select(_ => TestingStoreManager.RunEntityFactory(EntityFactory))]); } #endregion @@ -232,7 +210,7 @@ protected TEntity[] Sampling(int Count) { /// [Fact(DisplayName = "[Create Single]: Entity created")] public virtual async Task Create_Single_Success() { - TEntity sample = Sampling(); + TEntity sample = await Sampling(); TEntity storedEntity = await _depot.Create(sample); await CommitSampleEntities([storedEntity]); @@ -258,7 +236,7 @@ await Assert.ThrowsAnyAsync( /// [Fact(DisplayName = "[Create Batch]: Entities created")] public virtual async Task Create_Batch_Success() { - TEntity[] samples = Sampling(3); + TEntity[] samples = await Sampling(3); BatchOperationOutput qOut = await _depot.Create(samples); await CommitSampleEntities(samples); @@ -282,7 +260,7 @@ public virtual async Task Create_Batch_Success() { /// [Fact(DisplayName = "[Read Single]: Entity read by (Id)")] public virtual async Task Read_Single_ById_Success() { - TEntity sample = await Store(EntityFactoryAsync); + TEntity sample = await Store(EntityFactory); TEntity readEntity = await _depot.Read(sample.Id); Assert.Multiple( @@ -304,7 +282,7 @@ public virtual async Task Read_Single_ById_Success() { /// [Fact(DisplayName = "[Read Batch]: Entities read by (Id)")] public virtual async Task Read_Batch_ById_Sucess() { - TEntity[] samples = await Store(20, EntityFactoryAsync); + TEntity[] samples = await Store(20, EntityFactory); long[] sampleIds = [.. samples.Select(i => i.Id)]; BatchOperationOutput readEntities = await _depot.Read(sampleIds); @@ -335,7 +313,7 @@ public virtual async Task Read_Batch_ById_Sucess() { /// [Fact(DisplayName = "[Read Batch]: Entities read by (Query [First matching])")] public virtual async Task Read_Batch_ByQueryFirstMatch_Success() { - TEntity[] samples = await Store(2, EntityFactoryAsync); + TEntity[] samples = await Store(2, EntityFactory); TEntity samplePivot = samples[0]; BatchOperationOutput readEntites = await _depot.Read( @@ -371,7 +349,7 @@ public virtual async Task Read_Batch_ByQueryFirstMatch_Success() { /// [Fact(DisplayName = "[Read Batch]: Entities read by (Query [Last matching])")] public virtual async Task Read_Batch_ByQueryLastMatch_Success() { - TEntity[] samples = await Store(2, EntityFactoryAsync); + TEntity[] samples = await Store(2, EntityFactory); TEntity samplePivot = samples[1]; BatchOperationOutput readEntites = await _depot.Read( @@ -407,7 +385,7 @@ public virtual async Task Read_Batch_ByQueryLastMatch_Success() { /// [Fact(DisplayName = "[Read Batch]: Entities read by (Query [All matching])")] public virtual async Task Read_Batch_ByQueryAllMatches_Success() { - TEntity[] samples = await Store(2, EntityFactoryAsync); + TEntity[] samples = await Store(2, EntityFactory); BatchOperationOutput readEntites = await _depot.Read( new QueryInput> { @@ -449,7 +427,7 @@ public virtual async Task Read_Batch_ByQueryAllMatches_Success() { /// [Fact(DisplayName = $"[Update Single]: Created when (Create) property enabled")] public virtual async Task Update_Single_OnCreateEnabled_Success() { - TEntity sample = await TestingStoreManager.RunEntityFactoryAsync(EntityFactoryAsync); + TEntity sample = await TestingStoreManager.RunEntityFactory(EntityFactory); UpdateOutput updateOutput = await _depot.Update( new QueryInput> { @@ -481,7 +459,7 @@ public virtual async Task Update_Single_OnCreateEnabled_Success() { /// [Fact(DisplayName = $"[Update Single]: Throws exception (CREATE_DISABLED).")] public virtual async Task Update_Single_OnCreateDisabled_ErrorCreateDisabled() { - TEntity sample = await TestingStoreManager.RunEntityFactoryAsync(EntityFactoryAsync); + TEntity sample = await TestingStoreManager.RunEntityFactory(EntityFactory); DepotError depotException = await Assert.ThrowsAsync>( async () => { @@ -504,7 +482,7 @@ public virtual async Task Update_Single_OnCreateDisabled_ErrorCreateDisabled() { /// [Fact(DisplayName = $"[Update Single]: Throws exception (UNFOUND)")] public virtual async Task Update_Single_ErrorUnfound() { - TEntity sample = await TestingStoreManager.RunEntityFactoryAsync(EntityFactoryAsync); + TEntity sample = await TestingStoreManager.RunEntityFactory(EntityFactory); sample.Id = await GeneratePointer(); DepotError depotException = await Assert.ThrowsAsync>( @@ -555,7 +533,7 @@ public virtual async Task Delete_Single_ById_ErrorUnfound() { /// [Fact(DisplayName = $"[Delete Single]: Entity deleted by (Id)")] public virtual async Task Delete_Single_ById_Success() { - TEntity entity = await Store(EntityFactoryAsync); + TEntity entity = await Store(EntityFactory); await _depot.Delete(entity.Id); await CommitSampleEntities([]); @@ -570,7 +548,7 @@ public virtual async Task Delete_Single_ById_Success() { /// [Fact(DisplayName = $"[Delete Batch]: Entities deleted by (Query)")] public virtual async Task Delete_Batch_ByQuery_Success() { - TEntity entity = (await Store(10, EntityFactoryAsync))[0]; + TEntity entity = (await Store(10, EntityFactory))[0]; BatchOperationOutput deleteOutput = await _depot.Delete( new QueryInput>() { @@ -615,7 +593,7 @@ public virtual async Task Delete_Batch_ByQuery_Success() { [Fact(DisplayName = "[View]: Simple view calculation")] public virtual async Task View_Scucess() { const int viewPage = 1; - await Store(30, EntityFactoryAsync); + await Store(30, EntityFactory); ViewOutput viewOutput = await _depot.View( new QueryInput> { @@ -642,7 +620,7 @@ public virtual async Task View_Scucess() { [Fact(DisplayName = "[View]: Specific page")] public virtual async Task View_OnSpecificPage_Sucess() { const int viewPage = 2; - await Store(30, EntityFactoryAsync); + await Store(30, EntityFactory); ViewOutput viewOutput = await _depot.View( new QueryInput> { @@ -748,7 +726,7 @@ public virtual async Task View_ProeprtyFilteredByContains_Success() { throw SkipException.ForSkip("This assertion is only available for entities that have an evaluable string property since CONTAINS method is currently only supported to filter string type properties."); } - TEntity sampleEntity = await Store(EntityFactoryAsync); + TEntity sampleEntity = await Store(EntityFactory); object? sampleValue = _evaluableProperty.GetValue(sampleEntity); ViewOutput qOut = await _depot.View( @@ -787,7 +765,7 @@ public virtual async Task View_LogicalFilteredByOr_Success() { throw SkipException.ForSkip("This assertion is only available for entities that have an evaluable string property since CONTAINS method is currently only supported to filter string type properties."); } - TEntity[] entities = await Store(2, EntityFactoryAsync); + TEntity[] entities = await Store(2, EntityFactory); List possibleValues = []; List> filters = []; diff --git a/CSM Database Testing/Abstractions/Bases/TestingDataHandlerBase.cs b/CSM Database Testing/Abstractions/Bases/TestingDataHandlerBase.cs index b28150b..3729cc6 100644 --- a/CSM Database Testing/Abstractions/Bases/TestingDataHandlerBase.cs +++ b/CSM Database Testing/Abstractions/Bases/TestingDataHandlerBase.cs @@ -6,21 +6,6 @@ namespace CSM_Database_Testing.Abstractions.Bases; -/// -/// Public Delegate for [Entity] factory [Quality] purposes. -/// -/// -/// Type of the [Entity] to build. -/// -/// -/// Random 16 length to generate unique properties records. -/// -/// -/// The Entity stored in the database. -/// -public delegate TEntity EntityFactory(string Entropy) - where TEntity : class, IEntity; - /// /// Public Delegate for Asynchronous [Entity] factory [Quality] purposes. /// @@ -33,7 +18,7 @@ public delegate TEntity EntityFactory(string Entropy) /// /// The Entity stored in the database. /// -public delegate Task EntityFactoryAsync(string Entropy) +public delegate Task EntityFactory(string Entropy) where TEntity : class, IEntity; /// @@ -79,15 +64,15 @@ public Task Store(TEntity2 entity) return _storeManager.Store(entity); } - /// - protected Task Store(EntityFactoryAsync entityFactory) + /// + protected async Task Store(EntityFactory entityFactory) where TEntity2 : class, IEntity { - return _storeManager.Store(entityFactory); + return await _storeManager.Store(entityFactory); } - /// - protected async Task Store(int quantity, EntityFactoryAsync entityFactory) + /// + protected async Task Store(int quantity, EntityFactory entityFactory) where TEntity2 : class, IEntity, new() { return await _storeManager.Store(quantity, entityFactory); diff --git a/CSM Database Testing/CHANGELOG.md b/CSM Database Testing/CHANGELOG.md index 9f1a3e3..0962202 100644 --- a/CSM Database Testing/CHANGELOG.md +++ b/CSM Database Testing/CHANGELOG.md @@ -4,11 +4,11 @@ ### Changes -- Added synchronous and asynchronous support methods for CSM Database Testing: +- The following methods were converted from sync to async in CSM Database Testing: - - EntityFactory/EntityFactoryAsync. - - Sampling/SamplingAsync. - - RunEntityFactory/RunEntityFactoryAsync. + - EntityFactory. + - Sampling. + - RunEntityFactory. - Added Get() method to [TestingStoreManager] for entity persistence validation. @@ -16,7 +16,7 @@ ### Breaks -- Now the Store() Method requires the EntityFactoryAsync parameter method instead of the EntityFactory method for asynchronous operations. +- Now the EntityFactory() method in [DepotIntegrationTestsBase] it's an asynchronous method, so it must be awaited. ## [7.0.2] - 18.06-2026 diff --git a/CSM Database Testing/Managers/TestingStoreManager.cs b/CSM Database Testing/Managers/TestingStoreManager.cs index dd56640..20b70b4 100644 --- a/CSM Database Testing/Managers/TestingStoreManager.cs +++ b/CSM Database Testing/Managers/TestingStoreManager.cs @@ -124,10 +124,10 @@ await DatabaseUtils.SanitizeEntity(db, entity) /// /// Stored built . /// - public async Task Store(EntityFactoryAsync entityFactory) + public async Task Store(EntityFactory entityFactory) where TEntity2 : class, IEntity { - TEntity2 toStore = await RunEntityFactoryAsync(entityFactory); + TEntity2 toStore = await RunEntityFactory(entityFactory); toStore = await Store(toStore); return toStore; @@ -148,7 +148,7 @@ public async Task Store(EntityFactoryAsync entityF /// /// The stored and updated [Entities] stored. /// - public async Task Store(int quantity, EntityFactoryAsync entityFactory) + public async Task Store(int quantity, EntityFactory entityFactory) where TEntity2 : class, IEntity, new() { List entities = []; @@ -156,7 +156,7 @@ public async Task Store(int quantity, EntityFactoryAsync Store(int quantity, EntityFactoryAsync /// The generated [Entity] object. /// - public static TEntity2 RunEntityFactory(EntityFactory factory) - where TEntity2 : class, IEntity { - - return factory(RandomUtils.String(16)); - } - - /// - /// Internal runner for utilizations, automatically sends the [Entropy] parameter. - /// - /// - /// Type of the [Entity] build by the . - /// - /// - /// [Entity] factory function. - /// - /// - /// The generated [Entity] object. - /// - public static async Task RunEntityFactoryAsync(EntityFactoryAsync factory) + public static async Task RunEntityFactory(EntityFactory factory) where TEntity2 : class, IEntity { return await factory(RandomUtils.String(16)); diff --git a/Integration Tests/Tests/DepotBaseTests.cs b/Integration Tests/Tests/DepotBaseTests.cs index 0c28ab4..a8734e9 100644 --- a/Integration Tests/Tests/DepotBaseTests.cs +++ b/Integration Tests/Tests/DepotBaseTests.cs @@ -17,18 +17,12 @@ namespace Integration_Tests.Tests; public class DepotBaseTests : DepotIntegrationTestsBase { - protected override async Task EntityFactoryAsync(string Entropy) { + protected override async Task EntityFactory(string Entropy) { return await Task.FromResult(new EntityProxy { }); } - protected override EntityProxy EntityFactory(string Entropy) { - return new EntityProxy { - - }; - } - /// /// Method: /// Expectation: Success updating. From c3eed142b0601a723878a3256591e9e0776734b2 Mon Sep 17 00:00:00 2001 From: jr110 Date: Fri, 2 Oct 2026 22:10:08 -0700 Subject: [PATCH 05/60] testing methods optimizations --- .../Abstractions/Bases/DepotIntegrationTestsBase.cs | 13 ++++++++----- CSM Database Testing/CHANGELOG.md | 3 +-- .../Managers/TestingStoreManager.cs | 13 +++++-------- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs b/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs index 542acfe..9c0d39d 100644 --- a/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs +++ b/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs @@ -174,7 +174,7 @@ protected async Task GeneratePointer(bool noStored = false) { #region Sampling /// - /// Creates a new Asynchronous instance based on the implementation. + /// Creates a new asynchronous instance based on the implementation. /// /// A new instance /// @@ -196,8 +196,12 @@ protected async Task Sampling() { /// /// This instance collection is created but not stored in the database. /// - protected Task Sampling(int Count) { - return Task.WhenAll([.. Enumerable.Range(0, Count).Select(_ => TestingStoreManager.RunEntityFactory(EntityFactory))]); + protected async Task Sampling(int Count) { + List samples = []; + for (int i = 0; i < Count; i++) { + samples.Add(await TestingStoreManager.RunEntityFactory(EntityFactory)); + } + return [.. samples]; } #endregion @@ -560,14 +564,13 @@ public virtual async Task Delete_Batch_ByQuery_Success() { await CommitSampleEntities([]); List searchedEntity = await Get([entity]); - Assert.Empty(searchedEntity); Assert.Multiple( [ + () => Assert.Empty(searchedEntity), () => Assert.False(deleteOutput.Failed), () => Assert.Empty(deleteOutput.Failures), () => Assert.NotEmpty(deleteOutput.Successes), - () => Assert.Empty(searchedEntity), () => { TEntity deletedEntity = deleteOutput.Successes[0]; diff --git a/CSM Database Testing/CHANGELOG.md b/CSM Database Testing/CHANGELOG.md index 0962202..b53cdbe 100644 --- a/CSM Database Testing/CHANGELOG.md +++ b/CSM Database Testing/CHANGELOG.md @@ -16,8 +16,7 @@ ### Breaks -- Now the EntityFactory() method in [DepotIntegrationTestsBase] it's an asynchronous method, so it must be awaited. - +- The EntityFactory() method in [DepotIntegrationTestsBase] is now asynchronous and must be awaited. ## [7.0.2] - 18.06-2026 diff --git a/CSM Database Testing/Managers/TestingStoreManager.cs b/CSM Database Testing/Managers/TestingStoreManager.cs index 20b70b4..4d189af 100644 --- a/CSM Database Testing/Managers/TestingStoreManager.cs +++ b/CSM Database Testing/Managers/TestingStoreManager.cs @@ -214,7 +214,7 @@ DbContext GetDatabase(Type databaseType) { /// Collection of instances to look up. /// /// - /// Array of instances whose is contained in . + /// A list of instances whose is contained in . /// Only the IDs that exist in the database are included. /// public async Task> Get(TEntity2[] entities) @@ -222,13 +222,10 @@ public async Task> Get(TEntity2[] entities) using DbContext database = GetDatabase(new TEntity2().Database); - List found = []; - foreach (TEntity2 entity in entities) { - TEntity2? foundEntity = await database.Set().FindAsync(entity.Id); - if (foundEntity is not null) { - found.Add(foundEntity); - } - } + object[] ids = [.. entities.Select(entity => entity.Id)]; + List found = await database.Set() + .Where(entity => ids.Contains(entity.Id)) + .ToListAsync(); return found; } From e934c8dcddbf6809bcc06372c36bc340c71e31cf Mon Sep 17 00:00:00 2001 From: jr110 Date: Sat, 3 Oct 2026 22:34:45 -0700 Subject: [PATCH 06/60] Summary definitions changes --- .../Abstractions/Bases/DepotIntegrationTestsBase.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs b/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs index 9c0d39d..af8885c 100644 --- a/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs +++ b/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs @@ -103,7 +103,7 @@ public DepotIntegrationTestsBase(DatabaseFactory? database = null, params Databa #region Abtraction /// - /// Creates a context [Entity] for asynchronous testing data creation and assertion. + /// Creates an [Entity] for testing purposes. /// /// /// Random 16 length value for unique properties. @@ -174,7 +174,7 @@ protected async Task GeneratePointer(bool noStored = false) { #region Sampling /// - /// Creates a new asynchronous instance based on the implementation. + /// Creates a new asynchronous instance based on the implementation. /// /// A new instance /// From 3f6fc83d020f9f1de9da046caf7b682b0d809136 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Sun, 4 Oct 2026 13:11:29 -0700 Subject: [PATCH 07/60] file structuring --- README.md | 19 +- .../.editorconfig | 0 .../.gitignore | 0 .../CHANGELOG.md | 0 .../Abstractions/Bases/DatabaseBase.cs | 0 .../Bases/DatabaseDesignerBase.cs | 0 .../Abstractions/Interfaces/IDatabase.cs | 0 .../CSM Database Core}/CHANGELOG.md | 0 .../CSharp Database Extension.csproj | 0 .../Bases/RelationAttributeBase.cs | 0 .../Interfaces/IRelationAttribute.cs | 0 .../Attributes/EntityRelationAttribute.cs | 0 .../Core/Errors/DatabaseError.cs | 0 .../Core/Errors/DepotError.cs | 0 .../Core/Errors/EntityError.cs | 0 .../Core/Errors/EntityValidationError.cs | 0 .../Core/Errors/ValidatorError.cs | 0 .../Extensions/EntityTypeBuilderExtension.cs | 0 .../Core/Extensions/IQueryableExtension.cs | 0 .../Core/Extensions/TypeExtension.cs | 0 .../Core/Models/ConnectionOptions.cs | 0 .../Core/Models/DatabaseOptions.cs | 0 .../Core/Utils/DatabaseUtils.cs | 0 .../Core/Utils/EntityUtils.cs | 0 .../Depots/Abstractions/Bases/DepotBase.cs | 0 .../Depots/Abstractions/Interfaces/IDepot.cs | 0 .../Abstractions/Interfaces/IDepotCreate.cs | 0 .../Abstractions/Interfaces/IDepotDelete.cs | 0 .../Abstractions/Interfaces/IDepotRead.cs | 0 .../Abstractions/Interfaces/IDepotUpdate.cs | 0 .../Abstractions/Interfaces/IDepotView.cs | 0 .../Interfaces/IUpdateEntityInput.cs | 0 .../Abstractions/Interfaces/IViewFilter.cs | 0 .../Interfaces/IViewFilterNode.cs | 0 .../Depots/Models/BatchOperationOutput.cs | 0 .../Depots/Models/FilterQueryInput.cs | 0 .../Depots/Models/PaginationOutput.cs | 0 .../Depots/Models/PropertyValidationResult.cs | 0 .../Depots/Models/QueryInput.cs | 0 .../Depots/Models/Structs/RelationUpdate.cs | 0 .../Depots/Models/UpdateInput.cs | 0 .../Depots/Models/UpdateOutput.cs | 0 .../Depots/Models/ViewInput.cs | 0 .../Depots/Models/ViewOrdering.cs | 0 .../Depots/Models/ViewOutput.cs | 0 .../Depots/ViewFilters/ViewFilterDate.cs | 0 .../Depots/ViewFilters/ViewFilterLogical.cs | 0 .../Depots/ViewFilters/ViewFilterProperty.cs | 0 .../Abstractions/Bases/ActivableEntityBase.cs | 0 .../Entities/Abstractions/Bases/EntityBase.cs | 0 .../Abstractions/Bases/NamedEntityBase.cs | 0 .../Bases/PartnerBridgeEntityBase.cs | 0 .../Bases/PartnerScopeEntityBase.cs | 0 .../Interfaces/IActivableEntity.cs | 0 .../Abstractions/Interfaces/IEntity.cs | 0 .../Abstractions/Interfaces/INamedEntity.cs | 0 .../Interfaces/IPartnerBridgeEntity.cs | 0 .../Interfaces/IPartnerScopeEntity.cs | 0 .../Abstractions/Bases/ValidatorBase.cs | 0 .../Abstractions/Interfaces/IValidator.cs | 0 .../Validation/ExclusiveValidator.cs | 0 .../Bases/DepotIntegrationTestsBase.cs | 812 ++++++++++++++++++ .../Bases/TestingDataHandlerBase.cs | 87 ++ .../CSM Database Testing/CHANGELOG.md | 275 ++++++ .../Managers/TestingStoreManager.cs | 232 +++++ .../CSharp Database Extension.sln | 20 +- .../DatabaseProxy}/DatabaseProxy.cs | 0 .../DatabaseProxy}/DatabaseProxy.csproj | 2 +- .../DatabaseProxyDesignFactory.cs | 0 .../DatabaseProxy}/DepotProxy.cs | 0 .../Entities/EntityDependantProxy.cs | 0 .../Entities/EntityDependencyProxy.cs | 0 .../DatabaseProxy}/Entities/EntityProxy.cs | 0 .../20260401220538_Init Db.Designer.cs | 0 .../Migrations/20260401220538_Init Db.cs | 0 .../20260401221950_Init_Db_2.Designer.cs | 0 .../Migrations/20260401221950_Init_Db_2.cs | 0 ...260506231958_added_autoloading.Designer.cs | 0 .../20260506231958_added_autoloading.cs | 0 ...20260506232702_added_renamings.Designer.cs | 0 .../20260506232702_added_renamings.cs | 0 ...0260506232938_added_attributes.Designer.cs | 0 .../20260506232938_added_attributes.cs | 0 ...60506233726_added_attributes_2.Designer.cs | 0 .../20260506233726_added_attributes_2.cs | 0 ...230_standarized db for proxies.Designer.cs | 0 ...260507000230_standarized db for proxies.cs | 0 ...1_standarized db for proxies 2.Designer.cs | 0 ...0507000851_standarized db for proxies 2.cs | 0 ...5_standarized db for proxies 3.Designer.cs | 0 ...0507000955_standarized db for proxies 3.cs | 0 ...113_IncludingCascadingDeletion.Designer.cs | 0 ...260619050113_IncludingCascadingDeletion.cs | 0 .../Migrations/DatabaseProxyModelSnapshot.cs | 0 .../DatabaseProxy}/csmdq.dev.connection.json | 0 .../Integration Tests/Tests/DepotBaseTests.cs | 103 +++ .../Tests/UtilsTests/DatabaseUtilsTests.cs | 35 + .../Unit Tests/Unit Tests.csproj | 35 + .../local.integration_tests.runsettings | 0 99 files changed, 1598 insertions(+), 22 deletions(-) rename .editorconfig => csharp_database_extension/.editorconfig (100%) rename .gitignore => csharp_database_extension/.gitignore (100%) rename CHANGELOG.md => csharp_database_extension/CHANGELOG.md (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Abstractions/Bases/DatabaseBase.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Abstractions/Bases/DatabaseDesignerBase.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Abstractions/Interfaces/IDatabase.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/CHANGELOG.md (100%) rename CSM Database Core/CSM Database Core.csproj => csharp_database_extension/CSM Database Core/CSharp Database Extension.csproj (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Core/Attributes/Abstractions/Bases/RelationAttributeBase.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Core/Attributes/Abstractions/Interfaces/IRelationAttribute.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Core/Attributes/EntityRelationAttribute.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Core/Errors/DatabaseError.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Core/Errors/DepotError.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Core/Errors/EntityError.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Core/Errors/EntityValidationError.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Core/Errors/ValidatorError.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Core/Extensions/EntityTypeBuilderExtension.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Core/Extensions/IQueryableExtension.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Core/Extensions/TypeExtension.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Core/Models/ConnectionOptions.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Core/Models/DatabaseOptions.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Core/Utils/DatabaseUtils.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Core/Utils/EntityUtils.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/Abstractions/Bases/DepotBase.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/Abstractions/Interfaces/IDepot.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/Abstractions/Interfaces/IDepotCreate.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/Abstractions/Interfaces/IDepotDelete.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/Abstractions/Interfaces/IDepotRead.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/Abstractions/Interfaces/IDepotUpdate.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/Abstractions/Interfaces/IDepotView.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/Abstractions/Interfaces/IUpdateEntityInput.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/Abstractions/Interfaces/IViewFilter.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/Abstractions/Interfaces/IViewFilterNode.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/Models/BatchOperationOutput.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/Models/FilterQueryInput.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/Models/PaginationOutput.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/Models/PropertyValidationResult.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/Models/QueryInput.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/Models/Structs/RelationUpdate.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/Models/UpdateInput.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/Models/UpdateOutput.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/Models/ViewInput.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/Models/ViewOrdering.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/Models/ViewOutput.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/ViewFilters/ViewFilterDate.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/ViewFilters/ViewFilterLogical.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Depots/ViewFilters/ViewFilterProperty.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Entities/Abstractions/Bases/ActivableEntityBase.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Entities/Abstractions/Bases/EntityBase.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Entities/Abstractions/Bases/NamedEntityBase.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Entities/Abstractions/Bases/PartnerBridgeEntityBase.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Entities/Abstractions/Bases/PartnerScopeEntityBase.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Entities/Abstractions/Interfaces/IActivableEntity.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Entities/Abstractions/Interfaces/IEntity.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Entities/Abstractions/Interfaces/INamedEntity.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Entities/Abstractions/Interfaces/IPartnerBridgeEntity.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Entities/Abstractions/Interfaces/IPartnerScopeEntity.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Validation/Abstractions/Bases/ValidatorBase.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Validation/Abstractions/Interfaces/IValidator.cs (100%) rename {CSM Database Core => csharp_database_extension/CSM Database Core}/Validation/ExclusiveValidator.cs (100%) create mode 100644 csharp_database_extension/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs create mode 100644 csharp_database_extension/CSM Database Testing/Abstractions/Bases/TestingDataHandlerBase.cs create mode 100644 csharp_database_extension/CSM Database Testing/CHANGELOG.md create mode 100644 csharp_database_extension/CSM Database Testing/Managers/TestingStoreManager.cs rename CSM Database.sln => csharp_database_extension/CSharp Database Extension.sln (51%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/DatabaseProxy.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/DatabaseProxy.csproj (88%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/DatabaseProxyDesignFactory.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/DepotProxy.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Entities/EntityDependantProxy.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Entities/EntityDependencyProxy.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Entities/EntityProxy.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Migrations/20260401220538_Init Db.Designer.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Migrations/20260401220538_Init Db.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Migrations/20260401221950_Init_Db_2.Designer.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Migrations/20260401221950_Init_Db_2.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Migrations/20260506231958_added_autoloading.Designer.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Migrations/20260506231958_added_autoloading.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Migrations/20260506232702_added_renamings.Designer.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Migrations/20260506232702_added_renamings.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Migrations/20260506232938_added_attributes.Designer.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Migrations/20260506232938_added_attributes.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Migrations/20260506233726_added_attributes_2.Designer.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Migrations/20260506233726_added_attributes_2.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Migrations/20260507000230_standarized db for proxies.Designer.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Migrations/20260507000230_standarized db for proxies.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Migrations/20260507000851_standarized db for proxies 2.Designer.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Migrations/20260507000851_standarized db for proxies 2.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Migrations/20260507000955_standarized db for proxies 3.Designer.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Migrations/20260507000955_standarized db for proxies 3.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Migrations/20260619050113_IncludingCascadingDeletion.Designer.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Migrations/20260619050113_IncludingCascadingDeletion.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/Migrations/DatabaseProxyModelSnapshot.cs (100%) rename {DatabaseProxy => csharp_database_extension/DatabaseProxy}/csmdq.dev.connection.json (100%) create mode 100644 csharp_database_extension/Integration Tests/Tests/DepotBaseTests.cs create mode 100644 csharp_database_extension/Unit Tests/Tests/UtilsTests/DatabaseUtilsTests.cs create mode 100644 csharp_database_extension/Unit Tests/Unit Tests.csproj rename local.integration_tests.runsettings => csharp_database_extension/local.integration_tests.runsettings (100%) diff --git a/README.md b/README.md index 934ec96..166586c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,17 @@ -# csm_foundation_database -A .Net package solution for database related core tools. +# *CSharp Database Extension* + +A repository for a framweork extensions package. Framweork extensions are CSM shaped utilities and tools for frameworks and languages used during development. + +[Changelog](./csharp_database_extension/CHANGELOG.md) + +## **Installation & Usage** + +// --> Example for NuGet based packages. + +> dotnet nuget add source --name "github" --username {*GITHUB.USR*} --password {*GITHUB.PAT*} "" + +* GITHUB.USR: It's your github user account. + +* GITHUB.PAT: It's a generated personal access token, go to *Settings* > *Developer Settings* > *Personal access tokens*, create a **Classic** type access token and provide at minimum **Read:Packages** permission. + +> dotnet add package **CSharp.Database.Extension** --source github diff --git a/.editorconfig b/csharp_database_extension/.editorconfig similarity index 100% rename from .editorconfig rename to csharp_database_extension/.editorconfig diff --git a/.gitignore b/csharp_database_extension/.gitignore similarity index 100% rename from .gitignore rename to csharp_database_extension/.gitignore diff --git a/CHANGELOG.md b/csharp_database_extension/CHANGELOG.md similarity index 100% rename from CHANGELOG.md rename to csharp_database_extension/CHANGELOG.md diff --git a/CSM Database Core/Abstractions/Bases/DatabaseBase.cs b/csharp_database_extension/CSM Database Core/Abstractions/Bases/DatabaseBase.cs similarity index 100% rename from CSM Database Core/Abstractions/Bases/DatabaseBase.cs rename to csharp_database_extension/CSM Database Core/Abstractions/Bases/DatabaseBase.cs diff --git a/CSM Database Core/Abstractions/Bases/DatabaseDesignerBase.cs b/csharp_database_extension/CSM Database Core/Abstractions/Bases/DatabaseDesignerBase.cs similarity index 100% rename from CSM Database Core/Abstractions/Bases/DatabaseDesignerBase.cs rename to csharp_database_extension/CSM Database Core/Abstractions/Bases/DatabaseDesignerBase.cs diff --git a/CSM Database Core/Abstractions/Interfaces/IDatabase.cs b/csharp_database_extension/CSM Database Core/Abstractions/Interfaces/IDatabase.cs similarity index 100% rename from CSM Database Core/Abstractions/Interfaces/IDatabase.cs rename to csharp_database_extension/CSM Database Core/Abstractions/Interfaces/IDatabase.cs diff --git a/CSM Database Core/CHANGELOG.md b/csharp_database_extension/CSM Database Core/CHANGELOG.md similarity index 100% rename from CSM Database Core/CHANGELOG.md rename to csharp_database_extension/CSM Database Core/CHANGELOG.md diff --git a/CSM Database Core/CSM Database Core.csproj b/csharp_database_extension/CSM Database Core/CSharp Database Extension.csproj similarity index 100% rename from CSM Database Core/CSM Database Core.csproj rename to csharp_database_extension/CSM Database Core/CSharp Database Extension.csproj diff --git a/CSM Database Core/Core/Attributes/Abstractions/Bases/RelationAttributeBase.cs b/csharp_database_extension/CSM Database Core/Core/Attributes/Abstractions/Bases/RelationAttributeBase.cs similarity index 100% rename from CSM Database Core/Core/Attributes/Abstractions/Bases/RelationAttributeBase.cs rename to csharp_database_extension/CSM Database Core/Core/Attributes/Abstractions/Bases/RelationAttributeBase.cs diff --git a/CSM Database Core/Core/Attributes/Abstractions/Interfaces/IRelationAttribute.cs b/csharp_database_extension/CSM Database Core/Core/Attributes/Abstractions/Interfaces/IRelationAttribute.cs similarity index 100% rename from CSM Database Core/Core/Attributes/Abstractions/Interfaces/IRelationAttribute.cs rename to csharp_database_extension/CSM Database Core/Core/Attributes/Abstractions/Interfaces/IRelationAttribute.cs diff --git a/CSM Database Core/Core/Attributes/EntityRelationAttribute.cs b/csharp_database_extension/CSM Database Core/Core/Attributes/EntityRelationAttribute.cs similarity index 100% rename from CSM Database Core/Core/Attributes/EntityRelationAttribute.cs rename to csharp_database_extension/CSM Database Core/Core/Attributes/EntityRelationAttribute.cs diff --git a/CSM Database Core/Core/Errors/DatabaseError.cs b/csharp_database_extension/CSM Database Core/Core/Errors/DatabaseError.cs similarity index 100% rename from CSM Database Core/Core/Errors/DatabaseError.cs rename to csharp_database_extension/CSM Database Core/Core/Errors/DatabaseError.cs diff --git a/CSM Database Core/Core/Errors/DepotError.cs b/csharp_database_extension/CSM Database Core/Core/Errors/DepotError.cs similarity index 100% rename from CSM Database Core/Core/Errors/DepotError.cs rename to csharp_database_extension/CSM Database Core/Core/Errors/DepotError.cs diff --git a/CSM Database Core/Core/Errors/EntityError.cs b/csharp_database_extension/CSM Database Core/Core/Errors/EntityError.cs similarity index 100% rename from CSM Database Core/Core/Errors/EntityError.cs rename to csharp_database_extension/CSM Database Core/Core/Errors/EntityError.cs diff --git a/CSM Database Core/Core/Errors/EntityValidationError.cs b/csharp_database_extension/CSM Database Core/Core/Errors/EntityValidationError.cs similarity index 100% rename from CSM Database Core/Core/Errors/EntityValidationError.cs rename to csharp_database_extension/CSM Database Core/Core/Errors/EntityValidationError.cs diff --git a/CSM Database Core/Core/Errors/ValidatorError.cs b/csharp_database_extension/CSM Database Core/Core/Errors/ValidatorError.cs similarity index 100% rename from CSM Database Core/Core/Errors/ValidatorError.cs rename to csharp_database_extension/CSM Database Core/Core/Errors/ValidatorError.cs diff --git a/CSM Database Core/Core/Extensions/EntityTypeBuilderExtension.cs b/csharp_database_extension/CSM Database Core/Core/Extensions/EntityTypeBuilderExtension.cs similarity index 100% rename from CSM Database Core/Core/Extensions/EntityTypeBuilderExtension.cs rename to csharp_database_extension/CSM Database Core/Core/Extensions/EntityTypeBuilderExtension.cs diff --git a/CSM Database Core/Core/Extensions/IQueryableExtension.cs b/csharp_database_extension/CSM Database Core/Core/Extensions/IQueryableExtension.cs similarity index 100% rename from CSM Database Core/Core/Extensions/IQueryableExtension.cs rename to csharp_database_extension/CSM Database Core/Core/Extensions/IQueryableExtension.cs diff --git a/CSM Database Core/Core/Extensions/TypeExtension.cs b/csharp_database_extension/CSM Database Core/Core/Extensions/TypeExtension.cs similarity index 100% rename from CSM Database Core/Core/Extensions/TypeExtension.cs rename to csharp_database_extension/CSM Database Core/Core/Extensions/TypeExtension.cs diff --git a/CSM Database Core/Core/Models/ConnectionOptions.cs b/csharp_database_extension/CSM Database Core/Core/Models/ConnectionOptions.cs similarity index 100% rename from CSM Database Core/Core/Models/ConnectionOptions.cs rename to csharp_database_extension/CSM Database Core/Core/Models/ConnectionOptions.cs diff --git a/CSM Database Core/Core/Models/DatabaseOptions.cs b/csharp_database_extension/CSM Database Core/Core/Models/DatabaseOptions.cs similarity index 100% rename from CSM Database Core/Core/Models/DatabaseOptions.cs rename to csharp_database_extension/CSM Database Core/Core/Models/DatabaseOptions.cs diff --git a/CSM Database Core/Core/Utils/DatabaseUtils.cs b/csharp_database_extension/CSM Database Core/Core/Utils/DatabaseUtils.cs similarity index 100% rename from CSM Database Core/Core/Utils/DatabaseUtils.cs rename to csharp_database_extension/CSM Database Core/Core/Utils/DatabaseUtils.cs diff --git a/CSM Database Core/Core/Utils/EntityUtils.cs b/csharp_database_extension/CSM Database Core/Core/Utils/EntityUtils.cs similarity index 100% rename from CSM Database Core/Core/Utils/EntityUtils.cs rename to csharp_database_extension/CSM Database Core/Core/Utils/EntityUtils.cs diff --git a/CSM Database Core/Depots/Abstractions/Bases/DepotBase.cs b/csharp_database_extension/CSM Database Core/Depots/Abstractions/Bases/DepotBase.cs similarity index 100% rename from CSM Database Core/Depots/Abstractions/Bases/DepotBase.cs rename to csharp_database_extension/CSM Database Core/Depots/Abstractions/Bases/DepotBase.cs diff --git a/CSM Database Core/Depots/Abstractions/Interfaces/IDepot.cs b/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepot.cs similarity index 100% rename from CSM Database Core/Depots/Abstractions/Interfaces/IDepot.cs rename to csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepot.cs diff --git a/CSM Database Core/Depots/Abstractions/Interfaces/IDepotCreate.cs b/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotCreate.cs similarity index 100% rename from CSM Database Core/Depots/Abstractions/Interfaces/IDepotCreate.cs rename to csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotCreate.cs diff --git a/CSM Database Core/Depots/Abstractions/Interfaces/IDepotDelete.cs b/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotDelete.cs similarity index 100% rename from CSM Database Core/Depots/Abstractions/Interfaces/IDepotDelete.cs rename to csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotDelete.cs diff --git a/CSM Database Core/Depots/Abstractions/Interfaces/IDepotRead.cs b/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotRead.cs similarity index 100% rename from CSM Database Core/Depots/Abstractions/Interfaces/IDepotRead.cs rename to csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotRead.cs diff --git a/CSM Database Core/Depots/Abstractions/Interfaces/IDepotUpdate.cs b/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotUpdate.cs similarity index 100% rename from CSM Database Core/Depots/Abstractions/Interfaces/IDepotUpdate.cs rename to csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotUpdate.cs diff --git a/CSM Database Core/Depots/Abstractions/Interfaces/IDepotView.cs b/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotView.cs similarity index 100% rename from CSM Database Core/Depots/Abstractions/Interfaces/IDepotView.cs rename to csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotView.cs diff --git a/CSM Database Core/Depots/Abstractions/Interfaces/IUpdateEntityInput.cs b/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IUpdateEntityInput.cs similarity index 100% rename from CSM Database Core/Depots/Abstractions/Interfaces/IUpdateEntityInput.cs rename to csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IUpdateEntityInput.cs diff --git a/CSM Database Core/Depots/Abstractions/Interfaces/IViewFilter.cs b/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IViewFilter.cs similarity index 100% rename from CSM Database Core/Depots/Abstractions/Interfaces/IViewFilter.cs rename to csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IViewFilter.cs diff --git a/CSM Database Core/Depots/Abstractions/Interfaces/IViewFilterNode.cs b/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IViewFilterNode.cs similarity index 100% rename from CSM Database Core/Depots/Abstractions/Interfaces/IViewFilterNode.cs rename to csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IViewFilterNode.cs diff --git a/CSM Database Core/Depots/Models/BatchOperationOutput.cs b/csharp_database_extension/CSM Database Core/Depots/Models/BatchOperationOutput.cs similarity index 100% rename from CSM Database Core/Depots/Models/BatchOperationOutput.cs rename to csharp_database_extension/CSM Database Core/Depots/Models/BatchOperationOutput.cs diff --git a/CSM Database Core/Depots/Models/FilterQueryInput.cs b/csharp_database_extension/CSM Database Core/Depots/Models/FilterQueryInput.cs similarity index 100% rename from CSM Database Core/Depots/Models/FilterQueryInput.cs rename to csharp_database_extension/CSM Database Core/Depots/Models/FilterQueryInput.cs diff --git a/CSM Database Core/Depots/Models/PaginationOutput.cs b/csharp_database_extension/CSM Database Core/Depots/Models/PaginationOutput.cs similarity index 100% rename from CSM Database Core/Depots/Models/PaginationOutput.cs rename to csharp_database_extension/CSM Database Core/Depots/Models/PaginationOutput.cs diff --git a/CSM Database Core/Depots/Models/PropertyValidationResult.cs b/csharp_database_extension/CSM Database Core/Depots/Models/PropertyValidationResult.cs similarity index 100% rename from CSM Database Core/Depots/Models/PropertyValidationResult.cs rename to csharp_database_extension/CSM Database Core/Depots/Models/PropertyValidationResult.cs diff --git a/CSM Database Core/Depots/Models/QueryInput.cs b/csharp_database_extension/CSM Database Core/Depots/Models/QueryInput.cs similarity index 100% rename from CSM Database Core/Depots/Models/QueryInput.cs rename to csharp_database_extension/CSM Database Core/Depots/Models/QueryInput.cs diff --git a/CSM Database Core/Depots/Models/Structs/RelationUpdate.cs b/csharp_database_extension/CSM Database Core/Depots/Models/Structs/RelationUpdate.cs similarity index 100% rename from CSM Database Core/Depots/Models/Structs/RelationUpdate.cs rename to csharp_database_extension/CSM Database Core/Depots/Models/Structs/RelationUpdate.cs diff --git a/CSM Database Core/Depots/Models/UpdateInput.cs b/csharp_database_extension/CSM Database Core/Depots/Models/UpdateInput.cs similarity index 100% rename from CSM Database Core/Depots/Models/UpdateInput.cs rename to csharp_database_extension/CSM Database Core/Depots/Models/UpdateInput.cs diff --git a/CSM Database Core/Depots/Models/UpdateOutput.cs b/csharp_database_extension/CSM Database Core/Depots/Models/UpdateOutput.cs similarity index 100% rename from CSM Database Core/Depots/Models/UpdateOutput.cs rename to csharp_database_extension/CSM Database Core/Depots/Models/UpdateOutput.cs diff --git a/CSM Database Core/Depots/Models/ViewInput.cs b/csharp_database_extension/CSM Database Core/Depots/Models/ViewInput.cs similarity index 100% rename from CSM Database Core/Depots/Models/ViewInput.cs rename to csharp_database_extension/CSM Database Core/Depots/Models/ViewInput.cs diff --git a/CSM Database Core/Depots/Models/ViewOrdering.cs b/csharp_database_extension/CSM Database Core/Depots/Models/ViewOrdering.cs similarity index 100% rename from CSM Database Core/Depots/Models/ViewOrdering.cs rename to csharp_database_extension/CSM Database Core/Depots/Models/ViewOrdering.cs diff --git a/CSM Database Core/Depots/Models/ViewOutput.cs b/csharp_database_extension/CSM Database Core/Depots/Models/ViewOutput.cs similarity index 100% rename from CSM Database Core/Depots/Models/ViewOutput.cs rename to csharp_database_extension/CSM Database Core/Depots/Models/ViewOutput.cs diff --git a/CSM Database Core/Depots/ViewFilters/ViewFilterDate.cs b/csharp_database_extension/CSM Database Core/Depots/ViewFilters/ViewFilterDate.cs similarity index 100% rename from CSM Database Core/Depots/ViewFilters/ViewFilterDate.cs rename to csharp_database_extension/CSM Database Core/Depots/ViewFilters/ViewFilterDate.cs diff --git a/CSM Database Core/Depots/ViewFilters/ViewFilterLogical.cs b/csharp_database_extension/CSM Database Core/Depots/ViewFilters/ViewFilterLogical.cs similarity index 100% rename from CSM Database Core/Depots/ViewFilters/ViewFilterLogical.cs rename to csharp_database_extension/CSM Database Core/Depots/ViewFilters/ViewFilterLogical.cs diff --git a/CSM Database Core/Depots/ViewFilters/ViewFilterProperty.cs b/csharp_database_extension/CSM Database Core/Depots/ViewFilters/ViewFilterProperty.cs similarity index 100% rename from CSM Database Core/Depots/ViewFilters/ViewFilterProperty.cs rename to csharp_database_extension/CSM Database Core/Depots/ViewFilters/ViewFilterProperty.cs diff --git a/CSM Database Core/Entities/Abstractions/Bases/ActivableEntityBase.cs b/csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/ActivableEntityBase.cs similarity index 100% rename from CSM Database Core/Entities/Abstractions/Bases/ActivableEntityBase.cs rename to csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/ActivableEntityBase.cs diff --git a/CSM Database Core/Entities/Abstractions/Bases/EntityBase.cs b/csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/EntityBase.cs similarity index 100% rename from CSM Database Core/Entities/Abstractions/Bases/EntityBase.cs rename to csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/EntityBase.cs diff --git a/CSM Database Core/Entities/Abstractions/Bases/NamedEntityBase.cs b/csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/NamedEntityBase.cs similarity index 100% rename from CSM Database Core/Entities/Abstractions/Bases/NamedEntityBase.cs rename to csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/NamedEntityBase.cs diff --git a/CSM Database Core/Entities/Abstractions/Bases/PartnerBridgeEntityBase.cs b/csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/PartnerBridgeEntityBase.cs similarity index 100% rename from CSM Database Core/Entities/Abstractions/Bases/PartnerBridgeEntityBase.cs rename to csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/PartnerBridgeEntityBase.cs diff --git a/CSM Database Core/Entities/Abstractions/Bases/PartnerScopeEntityBase.cs b/csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/PartnerScopeEntityBase.cs similarity index 100% rename from CSM Database Core/Entities/Abstractions/Bases/PartnerScopeEntityBase.cs rename to csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/PartnerScopeEntityBase.cs diff --git a/CSM Database Core/Entities/Abstractions/Interfaces/IActivableEntity.cs b/csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/IActivableEntity.cs similarity index 100% rename from CSM Database Core/Entities/Abstractions/Interfaces/IActivableEntity.cs rename to csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/IActivableEntity.cs diff --git a/CSM Database Core/Entities/Abstractions/Interfaces/IEntity.cs b/csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/IEntity.cs similarity index 100% rename from CSM Database Core/Entities/Abstractions/Interfaces/IEntity.cs rename to csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/IEntity.cs diff --git a/CSM Database Core/Entities/Abstractions/Interfaces/INamedEntity.cs b/csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/INamedEntity.cs similarity index 100% rename from CSM Database Core/Entities/Abstractions/Interfaces/INamedEntity.cs rename to csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/INamedEntity.cs diff --git a/CSM Database Core/Entities/Abstractions/Interfaces/IPartnerBridgeEntity.cs b/csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/IPartnerBridgeEntity.cs similarity index 100% rename from CSM Database Core/Entities/Abstractions/Interfaces/IPartnerBridgeEntity.cs rename to csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/IPartnerBridgeEntity.cs diff --git a/CSM Database Core/Entities/Abstractions/Interfaces/IPartnerScopeEntity.cs b/csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/IPartnerScopeEntity.cs similarity index 100% rename from CSM Database Core/Entities/Abstractions/Interfaces/IPartnerScopeEntity.cs rename to csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/IPartnerScopeEntity.cs diff --git a/CSM Database Core/Validation/Abstractions/Bases/ValidatorBase.cs b/csharp_database_extension/CSM Database Core/Validation/Abstractions/Bases/ValidatorBase.cs similarity index 100% rename from CSM Database Core/Validation/Abstractions/Bases/ValidatorBase.cs rename to csharp_database_extension/CSM Database Core/Validation/Abstractions/Bases/ValidatorBase.cs diff --git a/CSM Database Core/Validation/Abstractions/Interfaces/IValidator.cs b/csharp_database_extension/CSM Database Core/Validation/Abstractions/Interfaces/IValidator.cs similarity index 100% rename from CSM Database Core/Validation/Abstractions/Interfaces/IValidator.cs rename to csharp_database_extension/CSM Database Core/Validation/Abstractions/Interfaces/IValidator.cs diff --git a/CSM Database Core/Validation/ExclusiveValidator.cs b/csharp_database_extension/CSM Database Core/Validation/ExclusiveValidator.cs similarity index 100% rename from CSM Database Core/Validation/ExclusiveValidator.cs rename to csharp_database_extension/CSM Database Core/Validation/ExclusiveValidator.cs diff --git a/csharp_database_extension/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs b/csharp_database_extension/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs new file mode 100644 index 0000000..af8885c --- /dev/null +++ b/csharp_database_extension/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs @@ -0,0 +1,812 @@ +using System.Linq.Expressions; +using System.Reflection; + +using CSM_Database_Core; +using CSM_Database_Core.Core.Errors; +using CSM_Database_Core.Core.Models; +using CSM_Database_Core.Depots.Abstractions.Interfaces; +using CSM_Database_Core.Depots.Models; +using CSM_Database_Core.Depots.ViewFilters; +using CSM_Database_Core.Entities.Abstractions.Interfaces; + +using CSM_Database_Testing.Disposing.Abstractions.Bases; +using CSM_Database_Testing.Managers; + +using Xunit; +using Xunit.Sdk; + +namespace CSM_Database_Testing.Abstractions.Bases; + +/// +/// Represents a testing base class for a data source depot. +/// +/// +/// Type of the being tested. +/// +/// +/// Type of the being tested. +/// +/// +/// Type of the handling the . +/// +public abstract class DepotIntegrationTestsBase + : TestingDataHandlerBase + where TEntity : class, IEntity, new() + where TDepot : IDepot + where TDatabase : DatabaseBase, new() { + + /// + /// instance to test. + /// + protected readonly TDepot _depot; + + /// + /// 's database context. + /// + protected readonly TDatabase _database; + + /// + /// Stores the most valid evaluable property from the current . used for ordering and filtering at View operations and evaluate their quality. + /// + protected readonly PropertyInfo _evaluableProperty; + + /// + /// Generates a new behavior base for . + /// + /// + /// Database factories for relations sampleEntity at external databases needed for . + /// + /// + /// Main Entity database handler instance. If isn't given will use a default built instance. + /// + public DepotIntegrationTestsBase(DatabaseFactory? database = null, params DatabaseFactory[] factories) + : base( + [ + ..factories, + () => database?.Invoke() + ?? (TDatabase)Activator.CreateInstance( + typeof(TDatabase), + new DatabaseOptions { + ForTesting = true, + } + )!, + ] + ) { + + _database = (TDatabase)database?.Invoke()! + ?? (TDatabase)Activator.CreateInstance( + typeof(TDatabase), + new DatabaseOptions { + ForTesting = true, + } + )!; + _depot = (TDepot)Activator.CreateInstance(typeof(TDepot), _database, null)!; + + PropertyInfo[] entityProperties = typeof(TEntity).GetProperties(); + + PropertyInfo? orderableTmp = null; + foreach (PropertyInfo propertyInfo in entityProperties) { + + Type propertyType = propertyInfo.PropertyType; + + if ((propertyType != typeof(string) && propertyType != typeof(int)) || propertyInfo.Name == nameof(IEntity.Discriminator)) { + continue; + } + + orderableTmp = propertyInfo; + break; + } + + _evaluableProperty = orderableTmp ?? typeof(TEntity).GetProperty(nameof(IEntity.Id))!; // By default if the [Entity] doesn't have a valid evaluable property will use the Id. + } + + #region Abtraction + + /// + /// Creates an [Entity] for testing purposes. + /// + /// + /// Random 16 length value for unique properties. + /// + /// + /// A correctly built . + /// + protected abstract Task EntityFactory(string Entropy); + + #endregion + + #region Private / Protected Functions + + /// + /// + /// + /// + protected async Task CommitSampleEntities(ICollection SampleEntities) { + await _database.SaveChangesAsync(); + _disposer.Push([.. SampleEntities]); + } + + /// + /// + /// + /// + /// + protected void AssertEvaluable(TEntity expected, TEntity actual) { + object? sampleEvaluableValue = _evaluableProperty.GetValue(expected); + object? overwrittenEvaluableValue = _evaluableProperty.GetValue(actual); + + Assert.Equal(sampleEvaluableValue, overwrittenEvaluableValue); + } + + /// + /// Looks into the database for a random that hasn't been used yet. + /// + /// + /// Wheter the generator should verify the generated isn't used + /// for a stored yet. + /// + /// + /// A valid random value for + /// + protected async Task GeneratePointer(bool noStored = false) { + Random random = new(); + + // Generate two 32-bit random integers + int high = random.Next(int.MinValue, int.MaxValue); + int low = random.Next(int.MinValue, int.MaxValue); + + // Combine them into a long value + long randomLong = (((long)high << 32) | (uint)low) & long.MaxValue; + if (!noStored) { + return randomLong; + } + + bool iteratorLock; + do { + iteratorLock = await _database.Set().FindAsync(randomLong) is not null; + } while (iteratorLock); + + return randomLong; + } + + #endregion + + #region Sampling + + /// + /// Creates a new asynchronous instance based on the implementation. + /// + /// A new instance + /// + /// This instance is created but not stored in the database. + /// + protected async Task Sampling() { + return await TestingStoreManager.RunEntityFactory(EntityFactory); + } + + /// + /// Creates a new collection of instances based on the implementation. + /// + /// + /// Number of instances to create. + /// + /// + /// A new instance collection. + /// + /// + /// This instance collection is created but not stored in the database. + /// + protected async Task Sampling(int Count) { + List samples = []; + for (int i = 0; i < Count; i++) { + samples.Add(await TestingStoreManager.RunEntityFactory(EntityFactory)); + } + return [.. samples]; + } + + #endregion + + #region Create Base Tests + + /// + /// Method: + /// Expectation: Success creation. + /// + [Fact(DisplayName = "[Create Single]: Entity created")] + public virtual async Task Create_Single_Success() { + TEntity sample = await Sampling(); + + TEntity storedEntity = await _depot.Create(sample); + await CommitSampleEntities([storedEntity]); + + Assert.Multiple( + [ + () => Assert.True(storedEntity.Id > 0), + async () => { + await Assert.ThrowsAnyAsync( + async () => { + await _depot.Create(sample); + await CommitSampleEntities([sample]); + } + ); + }, + ] + ); + } + + /// + /// Method: + /// Expectation: Success creation. + /// + [Fact(DisplayName = "[Create Batch]: Entities created")] + public virtual async Task Create_Batch_Success() { + TEntity[] samples = await Sampling(3); + + BatchOperationOutput qOut = await _depot.Create(samples); + await CommitSampleEntities(samples); + + Assert.Multiple( + [ + () => Assert.Equal(qOut.OperationsCount, samples.Length), + () => Assert.True(qOut.SuccessesCount.Equals(samples.Length), qOut.FailuresCount > 0 ? qOut.Failures[0].Message : ""), + () => Assert.All(qOut.Successes, i => { Assert.True(i.Id > 0); }) + ] + ); + } + + #endregion + + #region Read Base Tests + + /// + /// Method: + /// Expectation: Success reading. + /// + [Fact(DisplayName = "[Read Single]: Entity read by (Id)")] + public virtual async Task Read_Single_ById_Success() { + TEntity sample = await Store(EntityFactory); + + TEntity readEntity = await _depot.Read(sample.Id); + Assert.Multiple( + [ + () => Assert.Equal(sample.Id, readEntity.Id), + () => Assert.Equal(sample.Timestamp, readEntity.Timestamp), + () => { + object? sampleEvaluableValue = _evaluableProperty.GetValue(sample); + object? readEvaluableValue = _evaluableProperty.GetValue(readEntity); + Assert.Equal(sampleEvaluableValue, readEvaluableValue); + } + ] + ); + } + + /// + /// Method: + /// Expectation: Success reading. + /// + [Fact(DisplayName = "[Read Batch]: Entities read by (Id)")] + public virtual async Task Read_Batch_ById_Sucess() { + TEntity[] samples = await Store(20, EntityFactory); + long[] sampleIds = [.. samples.Select(i => i.Id)]; + + BatchOperationOutput readEntities = await _depot.Read(sampleIds); + Assert.Multiple( + [ + () => Assert.Empty(readEntities.Failures), + () => Assert.Equal(samples.Length, readEntities.SuccessesCount), + () => Assert.All( + readEntities.Successes, + (entity) => { + TEntity sample = samples.First(j => j.Id == entity.Id); + + Assert.Equal(sample.Id, entity.Id); + Assert.Equal(sample.Timestamp, entity.Timestamp); + + object? evaluableSampleValue = _evaluableProperty.GetValue(sample); + object? evaluableEntityValue = _evaluableProperty.GetValue(entity); + Assert.Equal(evaluableSampleValue, evaluableEntityValue); + } + ) + ] + ); + } + + /// + /// Method: + /// Expectation: Success reading. + /// + [Fact(DisplayName = "[Read Batch]: Entities read by (Query [First matching])")] + public virtual async Task Read_Batch_ByQueryFirstMatch_Success() { + TEntity[] samples = await Store(2, EntityFactory); + TEntity samplePivot = samples[0]; + + BatchOperationOutput readEntites = await _depot.Read( + new QueryInput> { + Parameters = new FilterQueryInput { + Behavior = FilteringBehaviors.First, + Filter = (entity) => entity.Id == samplePivot.Id || entity.Id == samples[1].Id + } + } + ); + + Assert.Multiple( + [ + () => Assert.Empty(readEntites.Failures), + () => Assert.Equal(1, readEntites.SuccessesCount), + () => { + TEntity readEntity = readEntites.Successes[0]; + + Assert.Equal(samplePivot.Id, readEntity.Id); + Assert.Equal(samplePivot.Timestamp, readEntity.Timestamp); + + object? evaluableSampleValue = _evaluableProperty.GetValue(samplePivot); + object? evaluableEntityValue = _evaluableProperty.GetValue(readEntity); + Assert.Equal(evaluableSampleValue, evaluableEntityValue); + }, + ] + ); + } + + /// + /// Method: + /// Expectation: Success reading. + /// + [Fact(DisplayName = "[Read Batch]: Entities read by (Query [Last matching])")] + public virtual async Task Read_Batch_ByQueryLastMatch_Success() { + TEntity[] samples = await Store(2, EntityFactory); + TEntity samplePivot = samples[1]; + + BatchOperationOutput readEntites = await _depot.Read( + new QueryInput> { + Parameters = new FilterQueryInput { + Behavior = FilteringBehaviors.Last, + Filter = (entity) => entity.Id == samplePivot.Id || entity.Id == samples[0].Id + } + } + ); + + Assert.Multiple( + [ + () => Assert.Empty(readEntites.Failures), + () => Assert.Equal(1, readEntites.SuccessesCount), + () => { + TEntity readEntity = readEntites.Successes[0]; + + Assert.Equal(samplePivot.Id, readEntity.Id); + Assert.Equal(samplePivot.Timestamp, readEntity.Timestamp); + + object? evaluableSampleValue = _evaluableProperty.GetValue(samplePivot); + object? evaluableEntityValue = _evaluableProperty.GetValue(readEntity); + Assert.Equal(evaluableSampleValue, evaluableEntityValue); + }, + ] + ); + } + + /// + /// Method: + /// Expectation: Success reading. + /// + [Fact(DisplayName = "[Read Batch]: Entities read by (Query [All matching])")] + public virtual async Task Read_Batch_ByQueryAllMatches_Success() { + TEntity[] samples = await Store(2, EntityFactory); + + BatchOperationOutput readEntites = await _depot.Read( + new QueryInput> { + Parameters = new FilterQueryInput { + Behavior = FilteringBehaviors.All, + Filter = (entity) => entity.Id == samples[0].Id || entity.Id == samples[1].Id + } + } + ); + + Assert.Multiple( + [ + () => Assert.Empty(readEntites.Failures), + () => Assert.Equal(2, readEntites.SuccessesCount), + () => Assert.All( + samples, + (sample) => { + TEntity entity = readEntites.Successes.First(i => i.Id == sample.Id); + + Assert.Equal(sample.Id, entity.Id); + Assert.Equal(sample.Timestamp, entity.Timestamp); + + object? evaluableSampleValue = _evaluableProperty.GetValue(sample); + object? evaluableEntityValue = _evaluableProperty.GetValue(entity); + Assert.Equal(evaluableSampleValue, evaluableEntityValue); + } + ), + ] + ); + } + + #endregion + + #region Update Base Tests + + /// + /// Method: + /// Expectation: Succeess created. + /// + [Fact(DisplayName = $"[Update Single]: Created when (Create) property enabled")] + public virtual async Task Update_Single_OnCreateEnabled_Success() { + TEntity sample = await TestingStoreManager.RunEntityFactory(EntityFactory); + + UpdateOutput updateOutput = await _depot.Update( + new QueryInput> { + Parameters = new UpdateInput { + Entity = sample, + Create = true, + }, + } + ); + + await CommitSampleEntities([updateOutput.Updated]); + + Assert.Multiple( + [ + () => Assert.Null(updateOutput.Original), + () => { + TEntity overwritten = updateOutput.Updated; + + Assert.True(overwritten.Id > 0); + AssertEvaluable(sample, overwritten); + }, + ] + ); + } + + /// + /// Method: + /// Expectation: Throws () with event () + /// + [Fact(DisplayName = $"[Update Single]: Throws exception (CREATE_DISABLED).")] + public virtual async Task Update_Single_OnCreateDisabled_ErrorCreateDisabled() { + TEntity sample = await TestingStoreManager.RunEntityFactory(EntityFactory); + + DepotError depotException = await Assert.ThrowsAsync>( + async () => { + UpdateOutput updateOutput = await _depot.Update( + new QueryInput> { + Parameters = new UpdateInput { + Entity = sample, + }, + } + ); + } + ); + + Assert.Equal(DepotErrorEvents.CREATE_DISABLED, depotException.Event); + } + + /// + /// Method: + /// Expectation: Throws () with event () + /// + [Fact(DisplayName = $"[Update Single]: Throws exception (UNFOUND)")] + public virtual async Task Update_Single_ErrorUnfound() { + TEntity sample = await TestingStoreManager.RunEntityFactory(EntityFactory); + sample.Id = await GeneratePointer(); + + DepotError depotException = await Assert.ThrowsAsync>( + async () => { + UpdateOutput updateOutput = await _depot.Update( + new QueryInput> { + Parameters = new UpdateInput { + Entity = sample, + }, + } + ); + } + ); + Assert.Equal(DepotErrorEvents.UNFOUND, depotException.Event); + } + + /// + /// Method: + /// Expectation: Success update. + /// + [Fact(DisplayName = $"[Update Single]: Entity gets updated correctly")] + public abstract Task Update_Single_Success(); + + #endregion + + #region Delete Base Tests + + /// + /// Method: + /// Expectation: Throws error () with event (). + /// + [Fact(DisplayName = $"[Delete Single]: Throws error (UNFOUND)")] + public virtual async Task Delete_Single_ById_ErrorUnfound() { + long unexistPointer = await GeneratePointer(true); + + DepotError depotException = await Assert.ThrowsAsync>( + async () => { + await _depot.Delete(unexistPointer); + } + ); + + Assert.Equal(DepotErrorEvents.UNFOUND, depotException.Event); + } + + /// + /// Method: + /// Expectation: Success deleted. + /// + [Fact(DisplayName = $"[Delete Single]: Entity deleted by (Id)")] + public virtual async Task Delete_Single_ById_Success() { + TEntity entity = await Store(EntityFactory); + + await _depot.Delete(entity.Id); + await CommitSampleEntities([]); + + List searchedEntity = await Get([entity]); + Assert.Empty(searchedEntity); + } + + /// + /// Method: + /// Expectation: Success deleted. + /// + [Fact(DisplayName = $"[Delete Batch]: Entities deleted by (Query)")] + public virtual async Task Delete_Batch_ByQuery_Success() { + TEntity entity = (await Store(10, EntityFactory))[0]; + + BatchOperationOutput deleteOutput = await _depot.Delete( + new QueryInput>() { + Parameters = new FilterQueryInput { + Filter = (entityB) => entityB.Id == entity.Id, + } + } + ); + await CommitSampleEntities([]); + + List searchedEntity = await Get([entity]); + + Assert.Multiple( + [ + () => Assert.Empty(searchedEntity), + () => Assert.False(deleteOutput.Failed), + () => Assert.Empty(deleteOutput.Failures), + () => Assert.NotEmpty(deleteOutput.Successes), + () => { + TEntity deletedEntity = deleteOutput.Successes[0]; + + Assert.Equal(entity.Id, deletedEntity.Id); + }, + () => { + Assert.Null( + _database.Set().Find(entity.Id) + ); + } + ] + ); + } + + #endregion + + #region View Base Tests + + /// + /// Method: . + /// Expectation: Success view. + /// + [Fact(DisplayName = "[View]: Simple view calculation")] + public virtual async Task View_Scucess() { + const int viewPage = 1; + await Store(30, EntityFactory); + + ViewOutput viewOutput = await _depot.View( + new QueryInput> { + Parameters = new() { + Retroactive = false, + Range = 20, + Page = viewPage, + } + } + ); + + Assert.Multiple( + () => Assert.True(viewOutput.Pages > 1), + () => Assert.True(viewOutput.Length > 0), + () => Assert.Equal(viewPage, viewOutput.Page), + () => Assert.Equal(viewOutput.Length, viewOutput.Entities.Length) + ); + } + + /// + /// Method: . + /// Expectation: Success view. + /// + [Fact(DisplayName = "[View]: Specific page")] + public virtual async Task View_OnSpecificPage_Sucess() { + const int viewPage = 2; + await Store(30, EntityFactory); + + ViewOutput viewOutput = await _depot.View( + new QueryInput> { + Parameters = new ViewInput { + Retroactive = false, + Range = 20, + Page = viewPage, + } + } + ); + + Assert.Multiple( + () => Assert.True(viewOutput.Pages > 1), + () => Assert.True(viewOutput.Length > 0), + () => Assert.Equal(viewPage, viewOutput.Page), + () => Assert.Equal(viewOutput.Length, viewOutput.Entities.Length) + ); + } + + /// + /// Method: . + /// Expectation: Success view. + /// + [Fact(DisplayName = $"[View]: Ordering by property")] + public virtual async Task View_OnOrdering_Success() { + + ViewOutput orderedViewOutput = await _depot.View( + new QueryInput> { + Parameters = new() { + Page = 1, + Range = 20, + Retroactive = false, + Orderings = [ + new ViewOrdering { + Property = _evaluableProperty.Name, + Ordering = ViewOrderings.Descending, + }, + ], + }, + } + ); + + // --> Manual ordering undordered result for reference. + IEnumerable orderedReferenceRecords = orderedViewOutput.Entities.Cast(); + { + Type setType = typeof(TEntity); + ParameterExpression parameterExpression = Expression.Parameter(setType, $"X0"); + + MemberExpression memberExpression = Expression.MakeMemberAccess(parameterExpression, _evaluableProperty); + UnaryExpression translationExpression = Expression.Convert(memberExpression, typeof(object)); + Expression> orderingExpression = Expression.Lambda>(translationExpression, parameterExpression); + + IQueryable sorted = orderedReferenceRecords.AsQueryable(); + sorted = sorted.OrderByDescending(orderingExpression); + orderedReferenceRecords = [.. sorted]; + } + + for (int i = 0; i < orderedReferenceRecords.Count(); i++) { + TEntity expected = orderedReferenceRecords.ElementAt(i); + TEntity actual = (TEntity)orderedViewOutput.Entities[i]; + + Assert.Equal(_evaluableProperty.GetValue(expected), _evaluableProperty.GetValue(actual)); + } + } + + /// + /// Method: . + /// Expectation: Success view. + /// + [Fact(DisplayName = "[View]: Using date filter")] + public virtual async Task View_DateFiltered_Success() { + ViewOutput viewOutput = await _depot.View( + new QueryInput> { + Parameters = new() { + Page = 1, + Range = 20, + Retroactive = false, + Filters = [ + new ViewFilterDate { + From = DateTime.UtcNow.Date, + }, + ], + }, + } + ); + + + Assert.All( + viewOutput.Entities, + (i) => { + Assert.True(DateTime.Compare(i.Timestamp, DateTime.UtcNow.Date) > 0); + } + ); + } + + /// + /// Method: . + /// Expectation: Success view. + /// + [Fact(DisplayName = "[View]: Using property filter (CONTAINS)")] + public virtual async Task View_ProeprtyFilteredByContains_Success() { + if (_evaluableProperty.PropertyType != typeof(string)) { + throw SkipException.ForSkip("This assertion is only available for entities that have an evaluable string property since CONTAINS method is currently only supported to filter string type properties."); + } + + TEntity sampleEntity = await Store(EntityFactory); + object? sampleValue = _evaluableProperty.GetValue(sampleEntity); + + ViewOutput qOut = await _depot.View( + new QueryInput> { + Parameters = new() { + Retroactive = false, + Range = 20, + Page = 1, + Filters = [ + new ViewFilterProperty { + Operator = ViewFilterOperators.CONTAINS, + Property = _evaluableProperty.Name, + Value = sampleValue, + } + ], + } + } + ); + Assert.All( + qOut.Entities, + (i) => { + object? value = _evaluableProperty.GetValue(i); + + Assert.Equal(sampleValue, value); + } + ); + } + + /// + /// Method: . + /// Expectation: Success view. + /// + [Fact(DisplayName = "[View]: Using filter logical (OR)")] + public virtual async Task View_LogicalFilteredByOr_Success() { + if (_evaluableProperty.PropertyType != typeof(string)) { + throw SkipException.ForSkip("This assertion is only available for entities that have an evaluable string property since CONTAINS method is currently only supported to filter string type properties."); + } + + TEntity[] entities = await Store(2, EntityFactory); + + List possibleValues = []; + List> filters = []; + + foreach (TEntity entity in entities) { + object? sampleValue = _evaluableProperty.GetValue(entity); + filters.Add( + new ViewFilterProperty { + Operator = ViewFilterOperators.CONTAINS, + Property = _evaluableProperty.Name, + Value = sampleValue, + } + ); + possibleValues.Add(sampleValue); + } + ViewOutput viewOutput = await _depot.View( + new QueryInput> { + Parameters = new() { + Retroactive = false, + Range = 20, + Page = 1, + Filters = [ + new ViewFilterLogical{ + Operator = ViewFilterLogicalOperators.OR, + Filters = [..filters], + }, + ], + } + } + ); + Assert.All( + viewOutput.Entities, + (i) => { + object? actualValue = _evaluableProperty.GetValue(i); + Assert.Contains(actualValue, possibleValues); + } + ); + } + + #endregion +} \ No newline at end of file diff --git a/csharp_database_extension/CSM Database Testing/Abstractions/Bases/TestingDataHandlerBase.cs b/csharp_database_extension/CSM Database Testing/Abstractions/Bases/TestingDataHandlerBase.cs new file mode 100644 index 0000000..3729cc6 --- /dev/null +++ b/csharp_database_extension/CSM Database Testing/Abstractions/Bases/TestingDataHandlerBase.cs @@ -0,0 +1,87 @@ +using CSM_Database_Core.Entities.Abstractions.Interfaces; + +using CSM_Database_Testing.Disposing; +using CSM_Database_Testing.Disposing.Abstractions.Bases; +using CSM_Database_Testing.Managers; + +namespace CSM_Database_Testing.Abstractions.Bases; + +/// +/// Public Delegate for Asynchronous [Entity] factory [Quality] purposes. +/// +/// +/// Type of the [Entity] to build. +/// +/// +/// Random 16 length to generate unique properties records. +/// +/// +/// The Entity stored in the database. +/// +public delegate Task EntityFactory(string Entropy) + where TEntity : class, IEntity; + +/// +/// [Abstract] for Quality Suits implementations that uses database data direct handling to store data for testing purposes. +/// +/// +/// All stored data is being removed from a . Testing data purposes can't be hold in the datasources. +/// +public class TestingDataHandlerBase + : IDisposable { + + /// + /// Testing data disposition manager, used to store to-remove entries after tests finished. + /// + protected readonly TestingDisposer _disposer; + + /// + /// Testing data store manager. + /// + protected readonly TestingStoreManager _storeManager; + + /// + /// Creates a new instance. + /// + /// + /// Collection of databases factories available for the handler to operate data. + /// + public TestingDataHandlerBase(params DatabaseFactory[] dbFactories) { + _disposer = new TestingDisposer(dbFactories); + _storeManager = new TestingStoreManager(_disposer, dbFactories); + } + + /// + public void Dispose() { + _storeManager.Dispose(); + GC.SuppressFinalize(this); + } + + /// + public Task Store(TEntity2 entity) + where TEntity2 : class, IEntity { + + return _storeManager.Store(entity); + } + + /// + protected async Task Store(EntityFactory entityFactory) + where TEntity2 : class, IEntity { + + return await _storeManager.Store(entityFactory); + } + + /// + protected async Task Store(int quantity, EntityFactory entityFactory) + where TEntity2 : class, IEntity, new() { + + return await _storeManager.Store(quantity, entityFactory); + } + + /// + protected async Task> Get(TEntity2[] entities) + where TEntity2 : class, IEntity, new() { + + return await _storeManager.Get(entities); + } +} diff --git a/csharp_database_extension/CSM Database Testing/CHANGELOG.md b/csharp_database_extension/CSM Database Testing/CHANGELOG.md new file mode 100644 index 0000000..b53cdbe --- /dev/null +++ b/csharp_database_extension/CSM Database Testing/CHANGELOG.md @@ -0,0 +1,275 @@ +# CSM Database Testing CHANGELOG + +## [x.x.x] - xx.xx-xxxx + +### Changes + +- The following methods were converted from sync to async in CSM Database Testing: + + - EntityFactory. + - Sampling. + - RunEntityFactory. + +- Added Get() method to [TestingStoreManager] for entity persistence validation. + +- Added persistence validations for Delete tests in [DepotIntegrationTests]. + +### Breaks + +- The EntityFactory() method in [DepotIntegrationTestsBase] is now asynchronous and must be awaited. + +## [7.0.2] - 18.06-2026 + +### Removed + +- Removed drafting for [CatalogEntity] and [ReferencedEntity] since they were removed at version [7.0.0] of [CSM Database Core]. + +### Dependencies + +| Package | Previous Version | New Version | +|:----------------------------------------|:----------------:|:---------------:| +| CSM.Foundation.Core | 4.0.0 | 4.0.0 | +| xunit.v3 | 3.2.2 | 3.2.2 | + +## [7.0.2] - 18.06-2026 + +### Fixed + +- Fixed code style + +#### Dependencies + +| Package | Previous Version | New Version | +|:----------------------------------------|:----------------:|:---------------:| +| CSM.Foundation.Core | 2.1.0 | 4.0.0 | +| xunit.v3 | 3.2.2 | 3.2.2 | + +## [7.0.1] - 18.06-2026 + +### Fixed + +- Fixed some [Store] method errors at [TestingStoreManager] that were missing entity sanitization logic. + +#### Dependencies + +| Package | Previous Version | New Version | +|:----------------------------------------|:----------------:|:---------------:| +| CSM.Foundation.Core | 2.1.0 | 4.0.0 | +| xunit.v3 | 3.2.2 | 3.2.2 | + +## [7.0.0] - 18.06-2026 + +### Fixed + +- Exposing as virtual some missing test cases from [DepotTestsBase]. + +#### Dependencies + +| Package | Previous Version | New Version | +|:----------------------------------------|:----------------:|:---------------:| +| CSM.Foundation.Core | 2.1.0 | 4.0.0 | +| xunit.v3 | 3.2.2 | 3.2.2 | + +## [6.0.0] - 19.05-2026 + +### Changes + +- Updated [TestingStoreManager] to handle sanitized data for integration testing iterations. + +#### Dependencies + +| Package | Previous Version | New Version | +|:----------------------------------------|:----------------:|:---------------:| +| CSM.Foundation.Core | 2.1.0 | 4.0.0 | +| xunit.v3 | 3.2.2 | 3.2.2 | + +## [5.1.0] - 16.03-2026 + +### Changes + +- Now testing base methods names have a better description of the test itself. +- Now [Update_Success] tests is required to be implemented since there're special checks. + +#### Dependencies + +| Package | Previous Version | New Version | +|:----------------------------------------|:----------------:|:---------------:| +| CSM.Foundation.Core | 2.1.0 | 2.1.0 | +| xunit.v3 | 3.2.2 | 3.2.2 | + +## [5.0.1] - 16.03-2026 + +### Changed + +- Exposed package documentation. +- Added solution documentation. + +#### Dependencies + +| Package | Previous Version | New Version | +|:----------------------------------------|:----------------:|:---------------:| +| CSM.Foundation.Core | 2.1.0 | 2.1.0 | +| xunit.v3 | 3.2.2 | 3.2.2 | + +## [5.0.0] - 15.02-2026 + +### Changed + +- Removed [xunit] and [SkippableFact] packages for [xunit.v3] upgrade. + +#### Dependencies + +| Package | Previous Version | New Version | +|:----------------------------------------|:----------------:|:---------------:| +| CSM.Foundation.Core | 2.1.0 | 2.1.0 | +| xunit.v3 | -.-.- | 3.2.2 | +| xunit | x.x.x | x.x.x | + +## [4.1.1] - 24.12-2025 + +### Changed + +- Updated packages and framework. + +#### Dependencies + +| Package | Previous Version | New Version | +|:----------------------------------------|:----------------:|:---------------:| +| CSM.Foundation.Core | 2.0.0 | 2.1.0 | +| xunit | 2.9.3 | 2.9.3 | +| xunit.SkippableFact | 1.5.23 | 1.5.23 | + +## [4.1.1] - 22.12-2025 + +### Changed + +- Updated packages and framework. + +#### Dependencies + +| Package | Previous Version | New Version | +|:----------------------------------------|:----------------:|:---------------:| +| CSM.Foundation.Core | 2.0.0 | 2.0.0 | +| xunit | 2.9.3 | 2.9.3 | +| xunit.SkippableFact | 1.5.23 | 1.5.23 | + +## [4.1.0] - 16.12-2025 + +### Added + +- Added new [BaseDraftUtils] to draft entities based on their base classes, simplifying data mocking. + +#### Dependencies + +| Package | Previous Version | New Version | +|:----------------------------------------|:----------------:|:---------------:| +| CSM.Foundation.Core | 2.0.0 | 2.0.0 | +| xunit | 2.9.3 | 2.9.3 | +| xunit.SkippableFact | 1.5.23 | 1.5.23 | + +## [4.0.0] - 11.12-2025 + +### Changed + +- Reverted and removed version [3.0.0], the interface are not needed in this context abstraction level + +#### Dependencies + +| Package | Previous Version | New Version | +|:----------------------------------------|:----------------:|:---------------:| +| CSM.Foundation.Core | 1.3.1 | 2.0.0 | +| xunit | 2.9.3 | 2.9.3 | +| xunit.SkippableFact | 1.5.23 | 1.5.23 | + +## [3.0.0] - 11.12-2025 + +### Changed + +- Changed [TestDepotBase] to handle correctly interfacing for operations. + +#### Dependencies + +| Package | Previous Version | New Version | +|:----------------------------------------|:----------------:|:---------------:| +| CSM.Foundation.Core | 1.3.1 | 2.0.0 | +| xunit | 2.9.3 | 2.9.3 | +| xunit.SkippableFact | 1.5.23 | 1.5.23 | + +## [2.1.0] - 26.11-2025 + +### Changed + +- Added database activation for testing purposes. + +#### Dependencies + +| Package | Previous Version | New Version | +|:----------------------------------------|:----------------:|:---------------:| +| CSM.Foundation.Core | 1.3.1 | 1.3.0 | +| xunit | 2.9.3 | 2.9.3 | +| xunit.SkippableFact | 1.5.23 | 1.5.23 | + +## [2.0.2] - 25.11-2025 + +### Changed + +- Removed unnecessary param from [TestingDepotBase] Sign. + +#### Dependencies + +| Package | Previous Version | New Version | +|:----------------------------------------|:----------------:|:---------------:| +| CSM.Foundation.Core | 1.3.1 | 1.3.0 | +| xunit | 2.9.3 | 2.9.3 | +| xunit.SkippableFact | 1.5.23 | 1.5.23 | + +## [2.0.1] - 25.11-2025 + +### Changed + +- Simplified access for testing database activation using signature property. + +#### Dependencies + +| Package | Previous Version | New Version | +|:----------------------------------------|:----------------:|:---------------:| +| CSM.Foundation.Core | 1.3.1 | 1.3.0 | +| xunit | 2.9.3 | 2.9.3 | +| xunit.SkippableFact | 1.5.23 | 1.5.23 | + +## [2.0.0] - 24.11-2025 + +### Added + +- Package initialization. + +### Changed + +- Renaming of abstractions and organization. +- Renaming of [Q_EntityValidations] to [TestingEntityBase] + +#### Dependencies + +| Package | Previous Version | New Version | +|:----------------------------------------|:----------------:|:---------------:| +| CSM.Foundation.Core | 1.2.1 | 1.3.0 | +| xunit | 2.9.3 | 2.9.3 | +| xunit.SkippableFact | --.--.-- | 1.5.23 | + + +## [1.0.0] - 06.08-2025 + +### Added + +- Package initialization. + +### Fixed + +### Changed + +#### Dependencies + +| Package | Previous Version | New Version | +|:----------------------------------------|:----------------:|:---------------:| +| CSM.Foundation.Core | --.--.-- | 1.2.1 | +| xunit | --.--.-- | 2.9.3 | \ No newline at end of file diff --git a/csharp_database_extension/CSM Database Testing/Managers/TestingStoreManager.cs b/csharp_database_extension/CSM Database Testing/Managers/TestingStoreManager.cs new file mode 100644 index 0000000..4d189af --- /dev/null +++ b/csharp_database_extension/CSM Database Testing/Managers/TestingStoreManager.cs @@ -0,0 +1,232 @@ +using CSM_Database_Core.Core.Utils; +using CSM_Database_Core.Entities.Abstractions.Interfaces; + +using CSM_Database_Testing.Abstractions.Bases; +using CSM_Database_Testing.Disposing; +using CSM_Database_Testing.Disposing.Abstractions.Bases; +using CSM_Database_Testing.Disposing.Abstractions.Interfaces; + +using CSM_Foundation_Core.Core.Utils; + +using Microsoft.EntityFrameworkCore; + +namespace CSM_Database_Testing.Managers; + +/// +/// Represents a testing data storing methods manager. +/// +public class TestingStoreManager + : IDisposable { + + /// + /// Testing data disposer. + /// + readonly ITestingDisposer _disposer; + + /// + /// Database factories available for Samples Storing/Disposing. + /// + readonly Dictionary _dbFactories = []; + + /// + /// Creates a new instance. + /// + /// + /// Testing data disposition manager. + /// + /// + /// Storing manager context factories.. + /// + public TestingStoreManager(ITestingDisposer? disposer, params DatabaseFactory[] dbFactories) { + foreach (DatabaseFactory factory in dbFactories) { + using DbContext dbContext = factory(); + Type dbType = dbContext.GetType(); + + _dbFactories.Add(dbType, factory); + } + + _disposer = disposer ?? new TestingDisposer(dbFactories); + } + + /// + public void Dispose() { + _disposer.Dispose(); + GC.SuppressFinalize(this); + } + + /// + /// Stores the given . + /// + /// + /// Type of the to store. + /// + /// + /// Entity to store. + /// + /// + /// Stored . + /// + public async Task Store(TEntity2 entity) + where TEntity2 : class, IEntity { + + DbContext db = GetDatabase(entity.Database); + + entity = await DatabaseUtils.SanitizeEntity(db, entity); + db.Set().Add(entity); + db.SaveChanges(); + + _disposer.Push(entity); + + return entity; + } + + /// + /// Stores the given . + /// + /// + /// Type of the to store. + /// + /// + /// Entities to store. + /// + /// + /// Stored . + /// + public async Task Store(TEntity2[] entities) + where TEntity2 : class, IEntity { + + DbContext db = GetDatabase(entities[0].Database); + List refs = []; + + foreach (TEntity2 entity in entities) { + refs.Add( + await DatabaseUtils.SanitizeEntity(db, entity) + ); + } + + await db.Set().AddRangeAsync(refs); + await db.SaveChangesAsync(); + + _disposer.Push([.. refs]); + + return [.. refs]; + } + + /// + /// Stores the given built . + /// + /// + /// Type of the to store. + /// + /// + /// Entity factory method. + /// + /// + /// Stored built . + /// + public async Task Store(EntityFactory entityFactory) + where TEntity2 : class, IEntity { + + TEntity2 toStore = await RunEntityFactory(entityFactory); + toStore = await Store(toStore); + + return toStore; + } + + /// + /// Iterates based on to generate [Entities] to store based on . + /// + /// + /// Type of the [Entity] to store. + /// + /// + /// Quantity of iterations to call and store the factory result. + /// + /// + /// Factory to build the [Entity] to store. + /// + /// + /// The stored and updated [Entities] stored. + /// + public async Task Store(int quantity, EntityFactory entityFactory) + where TEntity2 : class, IEntity, new() { + + List entities = []; + + using DbContext database = GetDatabase(new TEntity2().Database); + for (int i = 0; i < quantity; i++) { + + TEntity2 entity = await RunEntityFactory(entityFactory); + entity = await DatabaseUtils.SanitizeEntity(database, entity); + entities.Add(entity); + } + + await database.Set().AddRangeAsync(entities); + await database.SaveChangesAsync(); + _disposer.Push([.. entities]); + + return [.. entities]; + } + + /// + /// Internal runner for utilizations, automatically sends the [Entropy] parameter. + /// + /// + /// Type of the [Entity] build by the . + /// + /// + /// [Entity] factory function. + /// + /// + /// The generated [Entity] object. + /// + public static async Task RunEntityFactory(EntityFactory factory) + where TEntity2 : class, IEntity { + + return await factory(RandomUtils.String(16)); + } + + /// + /// Retrieves the database instance for the given based on the subscribed DatabaseFactories. + /// + /// + /// of the database requested. + /// + /// + /// The matched database context instance. + /// + /// + /// Thrown when the requested database isn't found in the subcribed database factories. + /// + DbContext GetDatabase(Type databaseType) { + return !_dbFactories.TryGetValue(databaseType, out DatabaseFactory? factory) + ? throw new Exception($"No factory subscribed for [({databaseType.Name})]") + : factory(); + } + + /// + /// Retrieves the stored instances that match the given . + /// + /// + /// Type of the to retrieve. + /// + /// + /// Collection of instances to look up. + /// + /// + /// A list of instances whose is contained in . + /// Only the IDs that exist in the database are included. + /// + public async Task> Get(TEntity2[] entities) + where TEntity2 : class, IEntity, new() { + + using DbContext database = GetDatabase(new TEntity2().Database); + + object[] ids = [.. entities.Select(entity => entity.Id)]; + List found = await database.Set() + .Where(entity => ids.Contains(entity.Id)) + .ToListAsync(); + + return found; + } +} diff --git a/CSM Database.sln b/csharp_database_extension/CSharp Database Extension.sln similarity index 51% rename from CSM Database.sln rename to csharp_database_extension/CSharp Database Extension.sln index aa09627..214b441 100644 --- a/CSM Database.sln +++ b/csharp_database_extension/CSharp Database Extension.sln @@ -10,16 +10,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution local.integration_tests.runsettings = local.integration_tests.runsettings EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSM Database Core", "CSM Database Core\CSM Database Core.csproj", "{4A3C8AEE-DF2B-0967-7D71-5B7C61239D19}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSM Database Testing", "CSM Database Testing\CSM Database Testing.csproj", "{82BDDC7B-DFF5-141A-9515-08F20D497D11}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharp Database Extension", "CSM Database Core\CSharp Database Extension.csproj", "{4A3C8AEE-DF2B-0967-7D71-5B7C61239D19}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unit Tests", "Unit Tests\Unit Tests.csproj", "{CBAAFF94-19D9-CA27-EB09-AC83990DFBC8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Integration Tests", "Integration Tests\Integration Tests.csproj", "{DEE0BFEC-6ED6-42CD-8F60-D3C2823DDDDA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DatabaseProxy", "DatabaseProxy\DatabaseProxy.csproj", "{5FFED488-8120-4A2C-BE06-A8E1D5E9D6E6}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -30,22 +24,10 @@ Global {4A3C8AEE-DF2B-0967-7D71-5B7C61239D19}.Debug|Any CPU.Build.0 = Debug|Any CPU {4A3C8AEE-DF2B-0967-7D71-5B7C61239D19}.Release|Any CPU.ActiveCfg = Release|Any CPU {4A3C8AEE-DF2B-0967-7D71-5B7C61239D19}.Release|Any CPU.Build.0 = Release|Any CPU - {82BDDC7B-DFF5-141A-9515-08F20D497D11}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {82BDDC7B-DFF5-141A-9515-08F20D497D11}.Debug|Any CPU.Build.0 = Debug|Any CPU - {82BDDC7B-DFF5-141A-9515-08F20D497D11}.Release|Any CPU.ActiveCfg = Release|Any CPU - {82BDDC7B-DFF5-141A-9515-08F20D497D11}.Release|Any CPU.Build.0 = Release|Any CPU {CBAAFF94-19D9-CA27-EB09-AC83990DFBC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CBAAFF94-19D9-CA27-EB09-AC83990DFBC8}.Debug|Any CPU.Build.0 = Debug|Any CPU {CBAAFF94-19D9-CA27-EB09-AC83990DFBC8}.Release|Any CPU.ActiveCfg = Release|Any CPU {CBAAFF94-19D9-CA27-EB09-AC83990DFBC8}.Release|Any CPU.Build.0 = Release|Any CPU - {DEE0BFEC-6ED6-42CD-8F60-D3C2823DDDDA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DEE0BFEC-6ED6-42CD-8F60-D3C2823DDDDA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DEE0BFEC-6ED6-42CD-8F60-D3C2823DDDDA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DEE0BFEC-6ED6-42CD-8F60-D3C2823DDDDA}.Release|Any CPU.Build.0 = Release|Any CPU - {5FFED488-8120-4A2C-BE06-A8E1D5E9D6E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5FFED488-8120-4A2C-BE06-A8E1D5E9D6E6}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5FFED488-8120-4A2C-BE06-A8E1D5E9D6E6}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5FFED488-8120-4A2C-BE06-A8E1D5E9D6E6}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/DatabaseProxy/DatabaseProxy.cs b/csharp_database_extension/DatabaseProxy/DatabaseProxy.cs similarity index 100% rename from DatabaseProxy/DatabaseProxy.cs rename to csharp_database_extension/DatabaseProxy/DatabaseProxy.cs diff --git a/DatabaseProxy/DatabaseProxy.csproj b/csharp_database_extension/DatabaseProxy/DatabaseProxy.csproj similarity index 88% rename from DatabaseProxy/DatabaseProxy.csproj rename to csharp_database_extension/DatabaseProxy/DatabaseProxy.csproj index 10d670e..db4ee23 100644 --- a/DatabaseProxy/DatabaseProxy.csproj +++ b/csharp_database_extension/DatabaseProxy/DatabaseProxy.csproj @@ -14,7 +14,7 @@ - + diff --git a/DatabaseProxy/DatabaseProxyDesignFactory.cs b/csharp_database_extension/DatabaseProxy/DatabaseProxyDesignFactory.cs similarity index 100% rename from DatabaseProxy/DatabaseProxyDesignFactory.cs rename to csharp_database_extension/DatabaseProxy/DatabaseProxyDesignFactory.cs diff --git a/DatabaseProxy/DepotProxy.cs b/csharp_database_extension/DatabaseProxy/DepotProxy.cs similarity index 100% rename from DatabaseProxy/DepotProxy.cs rename to csharp_database_extension/DatabaseProxy/DepotProxy.cs diff --git a/DatabaseProxy/Entities/EntityDependantProxy.cs b/csharp_database_extension/DatabaseProxy/Entities/EntityDependantProxy.cs similarity index 100% rename from DatabaseProxy/Entities/EntityDependantProxy.cs rename to csharp_database_extension/DatabaseProxy/Entities/EntityDependantProxy.cs diff --git a/DatabaseProxy/Entities/EntityDependencyProxy.cs b/csharp_database_extension/DatabaseProxy/Entities/EntityDependencyProxy.cs similarity index 100% rename from DatabaseProxy/Entities/EntityDependencyProxy.cs rename to csharp_database_extension/DatabaseProxy/Entities/EntityDependencyProxy.cs diff --git a/DatabaseProxy/Entities/EntityProxy.cs b/csharp_database_extension/DatabaseProxy/Entities/EntityProxy.cs similarity index 100% rename from DatabaseProxy/Entities/EntityProxy.cs rename to csharp_database_extension/DatabaseProxy/Entities/EntityProxy.cs diff --git a/DatabaseProxy/Migrations/20260401220538_Init Db.Designer.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260401220538_Init Db.Designer.cs similarity index 100% rename from DatabaseProxy/Migrations/20260401220538_Init Db.Designer.cs rename to csharp_database_extension/DatabaseProxy/Migrations/20260401220538_Init Db.Designer.cs diff --git a/DatabaseProxy/Migrations/20260401220538_Init Db.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260401220538_Init Db.cs similarity index 100% rename from DatabaseProxy/Migrations/20260401220538_Init Db.cs rename to csharp_database_extension/DatabaseProxy/Migrations/20260401220538_Init Db.cs diff --git a/DatabaseProxy/Migrations/20260401221950_Init_Db_2.Designer.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260401221950_Init_Db_2.Designer.cs similarity index 100% rename from DatabaseProxy/Migrations/20260401221950_Init_Db_2.Designer.cs rename to csharp_database_extension/DatabaseProxy/Migrations/20260401221950_Init_Db_2.Designer.cs diff --git a/DatabaseProxy/Migrations/20260401221950_Init_Db_2.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260401221950_Init_Db_2.cs similarity index 100% rename from DatabaseProxy/Migrations/20260401221950_Init_Db_2.cs rename to csharp_database_extension/DatabaseProxy/Migrations/20260401221950_Init_Db_2.cs diff --git a/DatabaseProxy/Migrations/20260506231958_added_autoloading.Designer.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260506231958_added_autoloading.Designer.cs similarity index 100% rename from DatabaseProxy/Migrations/20260506231958_added_autoloading.Designer.cs rename to csharp_database_extension/DatabaseProxy/Migrations/20260506231958_added_autoloading.Designer.cs diff --git a/DatabaseProxy/Migrations/20260506231958_added_autoloading.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260506231958_added_autoloading.cs similarity index 100% rename from DatabaseProxy/Migrations/20260506231958_added_autoloading.cs rename to csharp_database_extension/DatabaseProxy/Migrations/20260506231958_added_autoloading.cs diff --git a/DatabaseProxy/Migrations/20260506232702_added_renamings.Designer.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260506232702_added_renamings.Designer.cs similarity index 100% rename from DatabaseProxy/Migrations/20260506232702_added_renamings.Designer.cs rename to csharp_database_extension/DatabaseProxy/Migrations/20260506232702_added_renamings.Designer.cs diff --git a/DatabaseProxy/Migrations/20260506232702_added_renamings.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260506232702_added_renamings.cs similarity index 100% rename from DatabaseProxy/Migrations/20260506232702_added_renamings.cs rename to csharp_database_extension/DatabaseProxy/Migrations/20260506232702_added_renamings.cs diff --git a/DatabaseProxy/Migrations/20260506232938_added_attributes.Designer.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260506232938_added_attributes.Designer.cs similarity index 100% rename from DatabaseProxy/Migrations/20260506232938_added_attributes.Designer.cs rename to csharp_database_extension/DatabaseProxy/Migrations/20260506232938_added_attributes.Designer.cs diff --git a/DatabaseProxy/Migrations/20260506232938_added_attributes.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260506232938_added_attributes.cs similarity index 100% rename from DatabaseProxy/Migrations/20260506232938_added_attributes.cs rename to csharp_database_extension/DatabaseProxy/Migrations/20260506232938_added_attributes.cs diff --git a/DatabaseProxy/Migrations/20260506233726_added_attributes_2.Designer.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260506233726_added_attributes_2.Designer.cs similarity index 100% rename from DatabaseProxy/Migrations/20260506233726_added_attributes_2.Designer.cs rename to csharp_database_extension/DatabaseProxy/Migrations/20260506233726_added_attributes_2.Designer.cs diff --git a/DatabaseProxy/Migrations/20260506233726_added_attributes_2.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260506233726_added_attributes_2.cs similarity index 100% rename from DatabaseProxy/Migrations/20260506233726_added_attributes_2.cs rename to csharp_database_extension/DatabaseProxy/Migrations/20260506233726_added_attributes_2.cs diff --git a/DatabaseProxy/Migrations/20260507000230_standarized db for proxies.Designer.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260507000230_standarized db for proxies.Designer.cs similarity index 100% rename from DatabaseProxy/Migrations/20260507000230_standarized db for proxies.Designer.cs rename to csharp_database_extension/DatabaseProxy/Migrations/20260507000230_standarized db for proxies.Designer.cs diff --git a/DatabaseProxy/Migrations/20260507000230_standarized db for proxies.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260507000230_standarized db for proxies.cs similarity index 100% rename from DatabaseProxy/Migrations/20260507000230_standarized db for proxies.cs rename to csharp_database_extension/DatabaseProxy/Migrations/20260507000230_standarized db for proxies.cs diff --git a/DatabaseProxy/Migrations/20260507000851_standarized db for proxies 2.Designer.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260507000851_standarized db for proxies 2.Designer.cs similarity index 100% rename from DatabaseProxy/Migrations/20260507000851_standarized db for proxies 2.Designer.cs rename to csharp_database_extension/DatabaseProxy/Migrations/20260507000851_standarized db for proxies 2.Designer.cs diff --git a/DatabaseProxy/Migrations/20260507000851_standarized db for proxies 2.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260507000851_standarized db for proxies 2.cs similarity index 100% rename from DatabaseProxy/Migrations/20260507000851_standarized db for proxies 2.cs rename to csharp_database_extension/DatabaseProxy/Migrations/20260507000851_standarized db for proxies 2.cs diff --git a/DatabaseProxy/Migrations/20260507000955_standarized db for proxies 3.Designer.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260507000955_standarized db for proxies 3.Designer.cs similarity index 100% rename from DatabaseProxy/Migrations/20260507000955_standarized db for proxies 3.Designer.cs rename to csharp_database_extension/DatabaseProxy/Migrations/20260507000955_standarized db for proxies 3.Designer.cs diff --git a/DatabaseProxy/Migrations/20260507000955_standarized db for proxies 3.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260507000955_standarized db for proxies 3.cs similarity index 100% rename from DatabaseProxy/Migrations/20260507000955_standarized db for proxies 3.cs rename to csharp_database_extension/DatabaseProxy/Migrations/20260507000955_standarized db for proxies 3.cs diff --git a/DatabaseProxy/Migrations/20260619050113_IncludingCascadingDeletion.Designer.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260619050113_IncludingCascadingDeletion.Designer.cs similarity index 100% rename from DatabaseProxy/Migrations/20260619050113_IncludingCascadingDeletion.Designer.cs rename to csharp_database_extension/DatabaseProxy/Migrations/20260619050113_IncludingCascadingDeletion.Designer.cs diff --git a/DatabaseProxy/Migrations/20260619050113_IncludingCascadingDeletion.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260619050113_IncludingCascadingDeletion.cs similarity index 100% rename from DatabaseProxy/Migrations/20260619050113_IncludingCascadingDeletion.cs rename to csharp_database_extension/DatabaseProxy/Migrations/20260619050113_IncludingCascadingDeletion.cs diff --git a/DatabaseProxy/Migrations/DatabaseProxyModelSnapshot.cs b/csharp_database_extension/DatabaseProxy/Migrations/DatabaseProxyModelSnapshot.cs similarity index 100% rename from DatabaseProxy/Migrations/DatabaseProxyModelSnapshot.cs rename to csharp_database_extension/DatabaseProxy/Migrations/DatabaseProxyModelSnapshot.cs diff --git a/DatabaseProxy/csmdq.dev.connection.json b/csharp_database_extension/DatabaseProxy/csmdq.dev.connection.json similarity index 100% rename from DatabaseProxy/csmdq.dev.connection.json rename to csharp_database_extension/DatabaseProxy/csmdq.dev.connection.json diff --git a/csharp_database_extension/Integration Tests/Tests/DepotBaseTests.cs b/csharp_database_extension/Integration Tests/Tests/DepotBaseTests.cs new file mode 100644 index 0000000..e16097f --- /dev/null +++ b/csharp_database_extension/Integration Tests/Tests/DepotBaseTests.cs @@ -0,0 +1,103 @@ +using CSM_Database_Core.Depots.Abstractions.Bases; +using CSM_Database_Core.Depots.Models; +using CSM_Database_Core.Depots.Models.Structs; + +using CSM_Database_Testing.Abstractions.Bases; + +using DatabaseProxy; +using DatabaseProxy.Entities; + +using Microsoft.EntityFrameworkCore; + +namespace Integration_Tests.Tests; + +/// +/// Integration tests class for +/// +public class DepotBaseTests + : DepotIntegrationTestsBase { + + protected override async Task EntityFactory(string Entropy) { + return new EntityProxy { + EntityDependencyProxy = await _storeManager.Store( + new EntityDependencyProxy() + ) + }; + } + + /// + /// Method: + /// Expectation: Success updating. + /// + public override async Task Update_Single_Success() { + //Expectation + EntityProxy testEntity = await Store( + new EntityProxy { + + } + ); + + EntityDependencyProxy dependency = await Store( + new EntityDependencyProxy() + ); + + EntityDependantProxy dependant = await Store( + new EntityDependantProxy() + ); + + await Store( + new EntityDependantProxy { + EntityProxy = testEntity + } + ); + + testEntity.EntityDependencyProxy = dependency; + + UpdateOutput updateOutput = await _depot.Update( + new QueryInput> { + Parameters = new UpdateInput { + Entity = testEntity, + Relations = new Dictionary> { + { + nameof(EntityProxy.EntityDependantProxies), + new Dictionary { + { + string.Empty, + new RelationUpdate[] { + new() { + Entity = dependant, + Action = RelationUpdateAction.ADD + } + } + } + } + + }, + }, + }, + PostProcessor = (query) => { + return query.Include(i => i.EntityDependantProxies); + } + } + ); + + EntityProxy? ogEntity = updateOutput.Original; + EntityProxy updatedEntity = updateOutput.Updated; + + + Assert.NotNull(ogEntity); + Assert.Single(ogEntity.EntityDependantProxies); + + Assert.NotEmpty(updatedEntity.EntityDependantProxies); + + Assert.Contains( + updatedEntity.EntityDependantProxies, + (dependantEntry) => dependantEntry.Id == dependant.Id + ); + Assert.Equal( + dependency.Id, + updatedEntity.EntityDependencyProxy.Id + ); + } + +} diff --git a/csharp_database_extension/Unit Tests/Tests/UtilsTests/DatabaseUtilsTests.cs b/csharp_database_extension/Unit Tests/Tests/UtilsTests/DatabaseUtilsTests.cs new file mode 100644 index 0000000..53be18c --- /dev/null +++ b/csharp_database_extension/Unit Tests/Tests/UtilsTests/DatabaseUtilsTests.cs @@ -0,0 +1,35 @@ +using CSM_Database_Core.Core.Utils; + +using DatabaseProxy.Entities; + +using Microsoft.EntityFrameworkCore; + +using Moq; + +namespace UnitTests.Tests.UtilsTests; + + +/// +/// Unit tests class for . +/// +public class DatabaseUtilsTests { + + + /// + /// Method: + /// Expectation: Entity dependencies don´t throw relation detection exceptions. + /// + [Fact] + public async Task SatinizeEntity_RelationDetection() { + + //Mocking + Mock databaseProxyMock = new(); + Mock entityProxyMock = new(); + + //Acting + EntityProxy output = await DatabaseUtils.SanitizeEntity(databaseProxyMock.Object, entityProxyMock.Object); + + //Asserting + Assert.NotNull(output); + } +} diff --git a/csharp_database_extension/Unit Tests/Unit Tests.csproj b/csharp_database_extension/Unit Tests/Unit Tests.csproj new file mode 100644 index 0000000..4e6a15b --- /dev/null +++ b/csharp_database_extension/Unit Tests/Unit Tests.csproj @@ -0,0 +1,35 @@ + + + + net10.0 + UnitTests + enable + enable + + false + true + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + + diff --git a/local.integration_tests.runsettings b/csharp_database_extension/local.integration_tests.runsettings similarity index 100% rename from local.integration_tests.runsettings rename to csharp_database_extension/local.integration_tests.runsettings From 4dd9ad7fbe36117f20f00026084e80592c8d1d22 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Sun, 4 Oct 2026 19:54:20 -0700 Subject: [PATCH 08/60] organizing solution --- .../Bases/DepotIntegrationTestsBase.cs | 812 ------------------ .../Bases/TestingDataHandlerBase.cs | 87 -- CSM Database Testing/CHANGELOG.md | 275 ------ .../Managers/TestingStoreManager.cs | 232 ----- Integration Tests/Tests/DepotBaseTests.cs | 103 --- README.md | 14 +- .../Tests/UtilsTests/DatabaseUtilsTests.cs | 35 - Unit Tests/Unit Tests.csproj | 36 - .../Bases/DatabaseIntegrationTestsBase.cs | 0 .../Bases/EntityIntegrationTestsBase.cs | 0 .../Interfaces/ITestingDatabase.cs | 0 .../CSM Database Testing}/BaseDraftUtils.cs | 0 .../CSharp Database Extension Testing.csproj | 0 .../Abstractions/Bases/TestingDisposerBase.cs | 0 .../Interfaces/ITestingDisposer.cs | 0 .../Disposing/TestingDisposer.cs | 0 .../CSharp Database Extension.sln | 6 - .../Integration Tests.csproj | 0 .../Unit Tests/Unit Tests.csproj | 3 +- 19 files changed, 13 insertions(+), 1590 deletions(-) delete mode 100644 CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs delete mode 100644 CSM Database Testing/Abstractions/Bases/TestingDataHandlerBase.cs delete mode 100644 CSM Database Testing/CHANGELOG.md delete mode 100644 CSM Database Testing/Managers/TestingStoreManager.cs delete mode 100644 Integration Tests/Tests/DepotBaseTests.cs delete mode 100644 Unit Tests/Tests/UtilsTests/DatabaseUtilsTests.cs delete mode 100644 Unit Tests/Unit Tests.csproj rename {CSM Database Testing => csharp_database_extension/CSM Database Testing}/Abstractions/Bases/DatabaseIntegrationTestsBase.cs (100%) rename {CSM Database Testing => csharp_database_extension/CSM Database Testing}/Abstractions/Bases/EntityIntegrationTestsBase.cs (100%) rename {CSM Database Testing => csharp_database_extension/CSM Database Testing}/Abstractions/Interfaces/ITestingDatabase.cs (100%) rename {CSM Database Testing => csharp_database_extension/CSM Database Testing}/BaseDraftUtils.cs (100%) rename CSM Database Testing/CSM Database Testing.csproj => csharp_database_extension/CSM Database Testing/CSharp Database Extension Testing.csproj (100%) rename {CSM Database Testing => csharp_database_extension/CSM Database Testing}/Disposing/Abstractions/Bases/TestingDisposerBase.cs (100%) rename {CSM Database Testing => csharp_database_extension/CSM Database Testing}/Disposing/Abstractions/Interfaces/ITestingDisposer.cs (100%) rename {CSM Database Testing => csharp_database_extension/CSM Database Testing}/Disposing/TestingDisposer.cs (100%) rename {Integration Tests => csharp_database_extension/Integration Tests}/Integration Tests.csproj (100%) diff --git a/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs b/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs deleted file mode 100644 index af8885c..0000000 --- a/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs +++ /dev/null @@ -1,812 +0,0 @@ -using System.Linq.Expressions; -using System.Reflection; - -using CSM_Database_Core; -using CSM_Database_Core.Core.Errors; -using CSM_Database_Core.Core.Models; -using CSM_Database_Core.Depots.Abstractions.Interfaces; -using CSM_Database_Core.Depots.Models; -using CSM_Database_Core.Depots.ViewFilters; -using CSM_Database_Core.Entities.Abstractions.Interfaces; - -using CSM_Database_Testing.Disposing.Abstractions.Bases; -using CSM_Database_Testing.Managers; - -using Xunit; -using Xunit.Sdk; - -namespace CSM_Database_Testing.Abstractions.Bases; - -/// -/// Represents a testing base class for a data source depot. -/// -/// -/// Type of the being tested. -/// -/// -/// Type of the being tested. -/// -/// -/// Type of the handling the . -/// -public abstract class DepotIntegrationTestsBase - : TestingDataHandlerBase - where TEntity : class, IEntity, new() - where TDepot : IDepot - where TDatabase : DatabaseBase, new() { - - /// - /// instance to test. - /// - protected readonly TDepot _depot; - - /// - /// 's database context. - /// - protected readonly TDatabase _database; - - /// - /// Stores the most valid evaluable property from the current . used for ordering and filtering at View operations and evaluate their quality. - /// - protected readonly PropertyInfo _evaluableProperty; - - /// - /// Generates a new behavior base for . - /// - /// - /// Database factories for relations sampleEntity at external databases needed for . - /// - /// - /// Main Entity database handler instance. If isn't given will use a default built instance. - /// - public DepotIntegrationTestsBase(DatabaseFactory? database = null, params DatabaseFactory[] factories) - : base( - [ - ..factories, - () => database?.Invoke() - ?? (TDatabase)Activator.CreateInstance( - typeof(TDatabase), - new DatabaseOptions { - ForTesting = true, - } - )!, - ] - ) { - - _database = (TDatabase)database?.Invoke()! - ?? (TDatabase)Activator.CreateInstance( - typeof(TDatabase), - new DatabaseOptions { - ForTesting = true, - } - )!; - _depot = (TDepot)Activator.CreateInstance(typeof(TDepot), _database, null)!; - - PropertyInfo[] entityProperties = typeof(TEntity).GetProperties(); - - PropertyInfo? orderableTmp = null; - foreach (PropertyInfo propertyInfo in entityProperties) { - - Type propertyType = propertyInfo.PropertyType; - - if ((propertyType != typeof(string) && propertyType != typeof(int)) || propertyInfo.Name == nameof(IEntity.Discriminator)) { - continue; - } - - orderableTmp = propertyInfo; - break; - } - - _evaluableProperty = orderableTmp ?? typeof(TEntity).GetProperty(nameof(IEntity.Id))!; // By default if the [Entity] doesn't have a valid evaluable property will use the Id. - } - - #region Abtraction - - /// - /// Creates an [Entity] for testing purposes. - /// - /// - /// Random 16 length value for unique properties. - /// - /// - /// A correctly built . - /// - protected abstract Task EntityFactory(string Entropy); - - #endregion - - #region Private / Protected Functions - - /// - /// - /// - /// - protected async Task CommitSampleEntities(ICollection SampleEntities) { - await _database.SaveChangesAsync(); - _disposer.Push([.. SampleEntities]); - } - - /// - /// - /// - /// - /// - protected void AssertEvaluable(TEntity expected, TEntity actual) { - object? sampleEvaluableValue = _evaluableProperty.GetValue(expected); - object? overwrittenEvaluableValue = _evaluableProperty.GetValue(actual); - - Assert.Equal(sampleEvaluableValue, overwrittenEvaluableValue); - } - - /// - /// Looks into the database for a random that hasn't been used yet. - /// - /// - /// Wheter the generator should verify the generated isn't used - /// for a stored yet. - /// - /// - /// A valid random value for - /// - protected async Task GeneratePointer(bool noStored = false) { - Random random = new(); - - // Generate two 32-bit random integers - int high = random.Next(int.MinValue, int.MaxValue); - int low = random.Next(int.MinValue, int.MaxValue); - - // Combine them into a long value - long randomLong = (((long)high << 32) | (uint)low) & long.MaxValue; - if (!noStored) { - return randomLong; - } - - bool iteratorLock; - do { - iteratorLock = await _database.Set().FindAsync(randomLong) is not null; - } while (iteratorLock); - - return randomLong; - } - - #endregion - - #region Sampling - - /// - /// Creates a new asynchronous instance based on the implementation. - /// - /// A new instance - /// - /// This instance is created but not stored in the database. - /// - protected async Task Sampling() { - return await TestingStoreManager.RunEntityFactory(EntityFactory); - } - - /// - /// Creates a new collection of instances based on the implementation. - /// - /// - /// Number of instances to create. - /// - /// - /// A new instance collection. - /// - /// - /// This instance collection is created but not stored in the database. - /// - protected async Task Sampling(int Count) { - List samples = []; - for (int i = 0; i < Count; i++) { - samples.Add(await TestingStoreManager.RunEntityFactory(EntityFactory)); - } - return [.. samples]; - } - - #endregion - - #region Create Base Tests - - /// - /// Method: - /// Expectation: Success creation. - /// - [Fact(DisplayName = "[Create Single]: Entity created")] - public virtual async Task Create_Single_Success() { - TEntity sample = await Sampling(); - - TEntity storedEntity = await _depot.Create(sample); - await CommitSampleEntities([storedEntity]); - - Assert.Multiple( - [ - () => Assert.True(storedEntity.Id > 0), - async () => { - await Assert.ThrowsAnyAsync( - async () => { - await _depot.Create(sample); - await CommitSampleEntities([sample]); - } - ); - }, - ] - ); - } - - /// - /// Method: - /// Expectation: Success creation. - /// - [Fact(DisplayName = "[Create Batch]: Entities created")] - public virtual async Task Create_Batch_Success() { - TEntity[] samples = await Sampling(3); - - BatchOperationOutput qOut = await _depot.Create(samples); - await CommitSampleEntities(samples); - - Assert.Multiple( - [ - () => Assert.Equal(qOut.OperationsCount, samples.Length), - () => Assert.True(qOut.SuccessesCount.Equals(samples.Length), qOut.FailuresCount > 0 ? qOut.Failures[0].Message : ""), - () => Assert.All(qOut.Successes, i => { Assert.True(i.Id > 0); }) - ] - ); - } - - #endregion - - #region Read Base Tests - - /// - /// Method: - /// Expectation: Success reading. - /// - [Fact(DisplayName = "[Read Single]: Entity read by (Id)")] - public virtual async Task Read_Single_ById_Success() { - TEntity sample = await Store(EntityFactory); - - TEntity readEntity = await _depot.Read(sample.Id); - Assert.Multiple( - [ - () => Assert.Equal(sample.Id, readEntity.Id), - () => Assert.Equal(sample.Timestamp, readEntity.Timestamp), - () => { - object? sampleEvaluableValue = _evaluableProperty.GetValue(sample); - object? readEvaluableValue = _evaluableProperty.GetValue(readEntity); - Assert.Equal(sampleEvaluableValue, readEvaluableValue); - } - ] - ); - } - - /// - /// Method: - /// Expectation: Success reading. - /// - [Fact(DisplayName = "[Read Batch]: Entities read by (Id)")] - public virtual async Task Read_Batch_ById_Sucess() { - TEntity[] samples = await Store(20, EntityFactory); - long[] sampleIds = [.. samples.Select(i => i.Id)]; - - BatchOperationOutput readEntities = await _depot.Read(sampleIds); - Assert.Multiple( - [ - () => Assert.Empty(readEntities.Failures), - () => Assert.Equal(samples.Length, readEntities.SuccessesCount), - () => Assert.All( - readEntities.Successes, - (entity) => { - TEntity sample = samples.First(j => j.Id == entity.Id); - - Assert.Equal(sample.Id, entity.Id); - Assert.Equal(sample.Timestamp, entity.Timestamp); - - object? evaluableSampleValue = _evaluableProperty.GetValue(sample); - object? evaluableEntityValue = _evaluableProperty.GetValue(entity); - Assert.Equal(evaluableSampleValue, evaluableEntityValue); - } - ) - ] - ); - } - - /// - /// Method: - /// Expectation: Success reading. - /// - [Fact(DisplayName = "[Read Batch]: Entities read by (Query [First matching])")] - public virtual async Task Read_Batch_ByQueryFirstMatch_Success() { - TEntity[] samples = await Store(2, EntityFactory); - TEntity samplePivot = samples[0]; - - BatchOperationOutput readEntites = await _depot.Read( - new QueryInput> { - Parameters = new FilterQueryInput { - Behavior = FilteringBehaviors.First, - Filter = (entity) => entity.Id == samplePivot.Id || entity.Id == samples[1].Id - } - } - ); - - Assert.Multiple( - [ - () => Assert.Empty(readEntites.Failures), - () => Assert.Equal(1, readEntites.SuccessesCount), - () => { - TEntity readEntity = readEntites.Successes[0]; - - Assert.Equal(samplePivot.Id, readEntity.Id); - Assert.Equal(samplePivot.Timestamp, readEntity.Timestamp); - - object? evaluableSampleValue = _evaluableProperty.GetValue(samplePivot); - object? evaluableEntityValue = _evaluableProperty.GetValue(readEntity); - Assert.Equal(evaluableSampleValue, evaluableEntityValue); - }, - ] - ); - } - - /// - /// Method: - /// Expectation: Success reading. - /// - [Fact(DisplayName = "[Read Batch]: Entities read by (Query [Last matching])")] - public virtual async Task Read_Batch_ByQueryLastMatch_Success() { - TEntity[] samples = await Store(2, EntityFactory); - TEntity samplePivot = samples[1]; - - BatchOperationOutput readEntites = await _depot.Read( - new QueryInput> { - Parameters = new FilterQueryInput { - Behavior = FilteringBehaviors.Last, - Filter = (entity) => entity.Id == samplePivot.Id || entity.Id == samples[0].Id - } - } - ); - - Assert.Multiple( - [ - () => Assert.Empty(readEntites.Failures), - () => Assert.Equal(1, readEntites.SuccessesCount), - () => { - TEntity readEntity = readEntites.Successes[0]; - - Assert.Equal(samplePivot.Id, readEntity.Id); - Assert.Equal(samplePivot.Timestamp, readEntity.Timestamp); - - object? evaluableSampleValue = _evaluableProperty.GetValue(samplePivot); - object? evaluableEntityValue = _evaluableProperty.GetValue(readEntity); - Assert.Equal(evaluableSampleValue, evaluableEntityValue); - }, - ] - ); - } - - /// - /// Method: - /// Expectation: Success reading. - /// - [Fact(DisplayName = "[Read Batch]: Entities read by (Query [All matching])")] - public virtual async Task Read_Batch_ByQueryAllMatches_Success() { - TEntity[] samples = await Store(2, EntityFactory); - - BatchOperationOutput readEntites = await _depot.Read( - new QueryInput> { - Parameters = new FilterQueryInput { - Behavior = FilteringBehaviors.All, - Filter = (entity) => entity.Id == samples[0].Id || entity.Id == samples[1].Id - } - } - ); - - Assert.Multiple( - [ - () => Assert.Empty(readEntites.Failures), - () => Assert.Equal(2, readEntites.SuccessesCount), - () => Assert.All( - samples, - (sample) => { - TEntity entity = readEntites.Successes.First(i => i.Id == sample.Id); - - Assert.Equal(sample.Id, entity.Id); - Assert.Equal(sample.Timestamp, entity.Timestamp); - - object? evaluableSampleValue = _evaluableProperty.GetValue(sample); - object? evaluableEntityValue = _evaluableProperty.GetValue(entity); - Assert.Equal(evaluableSampleValue, evaluableEntityValue); - } - ), - ] - ); - } - - #endregion - - #region Update Base Tests - - /// - /// Method: - /// Expectation: Succeess created. - /// - [Fact(DisplayName = $"[Update Single]: Created when (Create) property enabled")] - public virtual async Task Update_Single_OnCreateEnabled_Success() { - TEntity sample = await TestingStoreManager.RunEntityFactory(EntityFactory); - - UpdateOutput updateOutput = await _depot.Update( - new QueryInput> { - Parameters = new UpdateInput { - Entity = sample, - Create = true, - }, - } - ); - - await CommitSampleEntities([updateOutput.Updated]); - - Assert.Multiple( - [ - () => Assert.Null(updateOutput.Original), - () => { - TEntity overwritten = updateOutput.Updated; - - Assert.True(overwritten.Id > 0); - AssertEvaluable(sample, overwritten); - }, - ] - ); - } - - /// - /// Method: - /// Expectation: Throws () with event () - /// - [Fact(DisplayName = $"[Update Single]: Throws exception (CREATE_DISABLED).")] - public virtual async Task Update_Single_OnCreateDisabled_ErrorCreateDisabled() { - TEntity sample = await TestingStoreManager.RunEntityFactory(EntityFactory); - - DepotError depotException = await Assert.ThrowsAsync>( - async () => { - UpdateOutput updateOutput = await _depot.Update( - new QueryInput> { - Parameters = new UpdateInput { - Entity = sample, - }, - } - ); - } - ); - - Assert.Equal(DepotErrorEvents.CREATE_DISABLED, depotException.Event); - } - - /// - /// Method: - /// Expectation: Throws () with event () - /// - [Fact(DisplayName = $"[Update Single]: Throws exception (UNFOUND)")] - public virtual async Task Update_Single_ErrorUnfound() { - TEntity sample = await TestingStoreManager.RunEntityFactory(EntityFactory); - sample.Id = await GeneratePointer(); - - DepotError depotException = await Assert.ThrowsAsync>( - async () => { - UpdateOutput updateOutput = await _depot.Update( - new QueryInput> { - Parameters = new UpdateInput { - Entity = sample, - }, - } - ); - } - ); - Assert.Equal(DepotErrorEvents.UNFOUND, depotException.Event); - } - - /// - /// Method: - /// Expectation: Success update. - /// - [Fact(DisplayName = $"[Update Single]: Entity gets updated correctly")] - public abstract Task Update_Single_Success(); - - #endregion - - #region Delete Base Tests - - /// - /// Method: - /// Expectation: Throws error () with event (). - /// - [Fact(DisplayName = $"[Delete Single]: Throws error (UNFOUND)")] - public virtual async Task Delete_Single_ById_ErrorUnfound() { - long unexistPointer = await GeneratePointer(true); - - DepotError depotException = await Assert.ThrowsAsync>( - async () => { - await _depot.Delete(unexistPointer); - } - ); - - Assert.Equal(DepotErrorEvents.UNFOUND, depotException.Event); - } - - /// - /// Method: - /// Expectation: Success deleted. - /// - [Fact(DisplayName = $"[Delete Single]: Entity deleted by (Id)")] - public virtual async Task Delete_Single_ById_Success() { - TEntity entity = await Store(EntityFactory); - - await _depot.Delete(entity.Id); - await CommitSampleEntities([]); - - List searchedEntity = await Get([entity]); - Assert.Empty(searchedEntity); - } - - /// - /// Method: - /// Expectation: Success deleted. - /// - [Fact(DisplayName = $"[Delete Batch]: Entities deleted by (Query)")] - public virtual async Task Delete_Batch_ByQuery_Success() { - TEntity entity = (await Store(10, EntityFactory))[0]; - - BatchOperationOutput deleteOutput = await _depot.Delete( - new QueryInput>() { - Parameters = new FilterQueryInput { - Filter = (entityB) => entityB.Id == entity.Id, - } - } - ); - await CommitSampleEntities([]); - - List searchedEntity = await Get([entity]); - - Assert.Multiple( - [ - () => Assert.Empty(searchedEntity), - () => Assert.False(deleteOutput.Failed), - () => Assert.Empty(deleteOutput.Failures), - () => Assert.NotEmpty(deleteOutput.Successes), - () => { - TEntity deletedEntity = deleteOutput.Successes[0]; - - Assert.Equal(entity.Id, deletedEntity.Id); - }, - () => { - Assert.Null( - _database.Set().Find(entity.Id) - ); - } - ] - ); - } - - #endregion - - #region View Base Tests - - /// - /// Method: . - /// Expectation: Success view. - /// - [Fact(DisplayName = "[View]: Simple view calculation")] - public virtual async Task View_Scucess() { - const int viewPage = 1; - await Store(30, EntityFactory); - - ViewOutput viewOutput = await _depot.View( - new QueryInput> { - Parameters = new() { - Retroactive = false, - Range = 20, - Page = viewPage, - } - } - ); - - Assert.Multiple( - () => Assert.True(viewOutput.Pages > 1), - () => Assert.True(viewOutput.Length > 0), - () => Assert.Equal(viewPage, viewOutput.Page), - () => Assert.Equal(viewOutput.Length, viewOutput.Entities.Length) - ); - } - - /// - /// Method: . - /// Expectation: Success view. - /// - [Fact(DisplayName = "[View]: Specific page")] - public virtual async Task View_OnSpecificPage_Sucess() { - const int viewPage = 2; - await Store(30, EntityFactory); - - ViewOutput viewOutput = await _depot.View( - new QueryInput> { - Parameters = new ViewInput { - Retroactive = false, - Range = 20, - Page = viewPage, - } - } - ); - - Assert.Multiple( - () => Assert.True(viewOutput.Pages > 1), - () => Assert.True(viewOutput.Length > 0), - () => Assert.Equal(viewPage, viewOutput.Page), - () => Assert.Equal(viewOutput.Length, viewOutput.Entities.Length) - ); - } - - /// - /// Method: . - /// Expectation: Success view. - /// - [Fact(DisplayName = $"[View]: Ordering by property")] - public virtual async Task View_OnOrdering_Success() { - - ViewOutput orderedViewOutput = await _depot.View( - new QueryInput> { - Parameters = new() { - Page = 1, - Range = 20, - Retroactive = false, - Orderings = [ - new ViewOrdering { - Property = _evaluableProperty.Name, - Ordering = ViewOrderings.Descending, - }, - ], - }, - } - ); - - // --> Manual ordering undordered result for reference. - IEnumerable orderedReferenceRecords = orderedViewOutput.Entities.Cast(); - { - Type setType = typeof(TEntity); - ParameterExpression parameterExpression = Expression.Parameter(setType, $"X0"); - - MemberExpression memberExpression = Expression.MakeMemberAccess(parameterExpression, _evaluableProperty); - UnaryExpression translationExpression = Expression.Convert(memberExpression, typeof(object)); - Expression> orderingExpression = Expression.Lambda>(translationExpression, parameterExpression); - - IQueryable sorted = orderedReferenceRecords.AsQueryable(); - sorted = sorted.OrderByDescending(orderingExpression); - orderedReferenceRecords = [.. sorted]; - } - - for (int i = 0; i < orderedReferenceRecords.Count(); i++) { - TEntity expected = orderedReferenceRecords.ElementAt(i); - TEntity actual = (TEntity)orderedViewOutput.Entities[i]; - - Assert.Equal(_evaluableProperty.GetValue(expected), _evaluableProperty.GetValue(actual)); - } - } - - /// - /// Method: . - /// Expectation: Success view. - /// - [Fact(DisplayName = "[View]: Using date filter")] - public virtual async Task View_DateFiltered_Success() { - ViewOutput viewOutput = await _depot.View( - new QueryInput> { - Parameters = new() { - Page = 1, - Range = 20, - Retroactive = false, - Filters = [ - new ViewFilterDate { - From = DateTime.UtcNow.Date, - }, - ], - }, - } - ); - - - Assert.All( - viewOutput.Entities, - (i) => { - Assert.True(DateTime.Compare(i.Timestamp, DateTime.UtcNow.Date) > 0); - } - ); - } - - /// - /// Method: . - /// Expectation: Success view. - /// - [Fact(DisplayName = "[View]: Using property filter (CONTAINS)")] - public virtual async Task View_ProeprtyFilteredByContains_Success() { - if (_evaluableProperty.PropertyType != typeof(string)) { - throw SkipException.ForSkip("This assertion is only available for entities that have an evaluable string property since CONTAINS method is currently only supported to filter string type properties."); - } - - TEntity sampleEntity = await Store(EntityFactory); - object? sampleValue = _evaluableProperty.GetValue(sampleEntity); - - ViewOutput qOut = await _depot.View( - new QueryInput> { - Parameters = new() { - Retroactive = false, - Range = 20, - Page = 1, - Filters = [ - new ViewFilterProperty { - Operator = ViewFilterOperators.CONTAINS, - Property = _evaluableProperty.Name, - Value = sampleValue, - } - ], - } - } - ); - Assert.All( - qOut.Entities, - (i) => { - object? value = _evaluableProperty.GetValue(i); - - Assert.Equal(sampleValue, value); - } - ); - } - - /// - /// Method: . - /// Expectation: Success view. - /// - [Fact(DisplayName = "[View]: Using filter logical (OR)")] - public virtual async Task View_LogicalFilteredByOr_Success() { - if (_evaluableProperty.PropertyType != typeof(string)) { - throw SkipException.ForSkip("This assertion is only available for entities that have an evaluable string property since CONTAINS method is currently only supported to filter string type properties."); - } - - TEntity[] entities = await Store(2, EntityFactory); - - List possibleValues = []; - List> filters = []; - - foreach (TEntity entity in entities) { - object? sampleValue = _evaluableProperty.GetValue(entity); - filters.Add( - new ViewFilterProperty { - Operator = ViewFilterOperators.CONTAINS, - Property = _evaluableProperty.Name, - Value = sampleValue, - } - ); - possibleValues.Add(sampleValue); - } - ViewOutput viewOutput = await _depot.View( - new QueryInput> { - Parameters = new() { - Retroactive = false, - Range = 20, - Page = 1, - Filters = [ - new ViewFilterLogical{ - Operator = ViewFilterLogicalOperators.OR, - Filters = [..filters], - }, - ], - } - } - ); - Assert.All( - viewOutput.Entities, - (i) => { - object? actualValue = _evaluableProperty.GetValue(i); - Assert.Contains(actualValue, possibleValues); - } - ); - } - - #endregion -} \ No newline at end of file diff --git a/CSM Database Testing/Abstractions/Bases/TestingDataHandlerBase.cs b/CSM Database Testing/Abstractions/Bases/TestingDataHandlerBase.cs deleted file mode 100644 index 3729cc6..0000000 --- a/CSM Database Testing/Abstractions/Bases/TestingDataHandlerBase.cs +++ /dev/null @@ -1,87 +0,0 @@ -using CSM_Database_Core.Entities.Abstractions.Interfaces; - -using CSM_Database_Testing.Disposing; -using CSM_Database_Testing.Disposing.Abstractions.Bases; -using CSM_Database_Testing.Managers; - -namespace CSM_Database_Testing.Abstractions.Bases; - -/// -/// Public Delegate for Asynchronous [Entity] factory [Quality] purposes. -/// -/// -/// Type of the [Entity] to build. -/// -/// -/// Random 16 length to generate unique properties records. -/// -/// -/// The Entity stored in the database. -/// -public delegate Task EntityFactory(string Entropy) - where TEntity : class, IEntity; - -/// -/// [Abstract] for Quality Suits implementations that uses database data direct handling to store data for testing purposes. -/// -/// -/// All stored data is being removed from a . Testing data purposes can't be hold in the datasources. -/// -public class TestingDataHandlerBase - : IDisposable { - - /// - /// Testing data disposition manager, used to store to-remove entries after tests finished. - /// - protected readonly TestingDisposer _disposer; - - /// - /// Testing data store manager. - /// - protected readonly TestingStoreManager _storeManager; - - /// - /// Creates a new instance. - /// - /// - /// Collection of databases factories available for the handler to operate data. - /// - public TestingDataHandlerBase(params DatabaseFactory[] dbFactories) { - _disposer = new TestingDisposer(dbFactories); - _storeManager = new TestingStoreManager(_disposer, dbFactories); - } - - /// - public void Dispose() { - _storeManager.Dispose(); - GC.SuppressFinalize(this); - } - - /// - public Task Store(TEntity2 entity) - where TEntity2 : class, IEntity { - - return _storeManager.Store(entity); - } - - /// - protected async Task Store(EntityFactory entityFactory) - where TEntity2 : class, IEntity { - - return await _storeManager.Store(entityFactory); - } - - /// - protected async Task Store(int quantity, EntityFactory entityFactory) - where TEntity2 : class, IEntity, new() { - - return await _storeManager.Store(quantity, entityFactory); - } - - /// - protected async Task> Get(TEntity2[] entities) - where TEntity2 : class, IEntity, new() { - - return await _storeManager.Get(entities); - } -} diff --git a/CSM Database Testing/CHANGELOG.md b/CSM Database Testing/CHANGELOG.md deleted file mode 100644 index b53cdbe..0000000 --- a/CSM Database Testing/CHANGELOG.md +++ /dev/null @@ -1,275 +0,0 @@ -# CSM Database Testing CHANGELOG - -## [x.x.x] - xx.xx-xxxx - -### Changes - -- The following methods were converted from sync to async in CSM Database Testing: - - - EntityFactory. - - Sampling. - - RunEntityFactory. - -- Added Get() method to [TestingStoreManager] for entity persistence validation. - -- Added persistence validations for Delete tests in [DepotIntegrationTests]. - -### Breaks - -- The EntityFactory() method in [DepotIntegrationTestsBase] is now asynchronous and must be awaited. - -## [7.0.2] - 18.06-2026 - -### Removed - -- Removed drafting for [CatalogEntity] and [ReferencedEntity] since they were removed at version [7.0.0] of [CSM Database Core]. - -### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 4.0.0 | 4.0.0 | -| xunit.v3 | 3.2.2 | 3.2.2 | - -## [7.0.2] - 18.06-2026 - -### Fixed - -- Fixed code style - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.1.0 | 4.0.0 | -| xunit.v3 | 3.2.2 | 3.2.2 | - -## [7.0.1] - 18.06-2026 - -### Fixed - -- Fixed some [Store] method errors at [TestingStoreManager] that were missing entity sanitization logic. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.1.0 | 4.0.0 | -| xunit.v3 | 3.2.2 | 3.2.2 | - -## [7.0.0] - 18.06-2026 - -### Fixed - -- Exposing as virtual some missing test cases from [DepotTestsBase]. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.1.0 | 4.0.0 | -| xunit.v3 | 3.2.2 | 3.2.2 | - -## [6.0.0] - 19.05-2026 - -### Changes - -- Updated [TestingStoreManager] to handle sanitized data for integration testing iterations. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.1.0 | 4.0.0 | -| xunit.v3 | 3.2.2 | 3.2.2 | - -## [5.1.0] - 16.03-2026 - -### Changes - -- Now testing base methods names have a better description of the test itself. -- Now [Update_Success] tests is required to be implemented since there're special checks. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.1.0 | 2.1.0 | -| xunit.v3 | 3.2.2 | 3.2.2 | - -## [5.0.1] - 16.03-2026 - -### Changed - -- Exposed package documentation. -- Added solution documentation. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.1.0 | 2.1.0 | -| xunit.v3 | 3.2.2 | 3.2.2 | - -## [5.0.0] - 15.02-2026 - -### Changed - -- Removed [xunit] and [SkippableFact] packages for [xunit.v3] upgrade. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.1.0 | 2.1.0 | -| xunit.v3 | -.-.- | 3.2.2 | -| xunit | x.x.x | x.x.x | - -## [4.1.1] - 24.12-2025 - -### Changed - -- Updated packages and framework. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.0.0 | 2.1.0 | -| xunit | 2.9.3 | 2.9.3 | -| xunit.SkippableFact | 1.5.23 | 1.5.23 | - -## [4.1.1] - 22.12-2025 - -### Changed - -- Updated packages and framework. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.0.0 | 2.0.0 | -| xunit | 2.9.3 | 2.9.3 | -| xunit.SkippableFact | 1.5.23 | 1.5.23 | - -## [4.1.0] - 16.12-2025 - -### Added - -- Added new [BaseDraftUtils] to draft entities based on their base classes, simplifying data mocking. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.0.0 | 2.0.0 | -| xunit | 2.9.3 | 2.9.3 | -| xunit.SkippableFact | 1.5.23 | 1.5.23 | - -## [4.0.0] - 11.12-2025 - -### Changed - -- Reverted and removed version [3.0.0], the interface are not needed in this context abstraction level - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 1.3.1 | 2.0.0 | -| xunit | 2.9.3 | 2.9.3 | -| xunit.SkippableFact | 1.5.23 | 1.5.23 | - -## [3.0.0] - 11.12-2025 - -### Changed - -- Changed [TestDepotBase] to handle correctly interfacing for operations. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 1.3.1 | 2.0.0 | -| xunit | 2.9.3 | 2.9.3 | -| xunit.SkippableFact | 1.5.23 | 1.5.23 | - -## [2.1.0] - 26.11-2025 - -### Changed - -- Added database activation for testing purposes. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 1.3.1 | 1.3.0 | -| xunit | 2.9.3 | 2.9.3 | -| xunit.SkippableFact | 1.5.23 | 1.5.23 | - -## [2.0.2] - 25.11-2025 - -### Changed - -- Removed unnecessary param from [TestingDepotBase] Sign. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 1.3.1 | 1.3.0 | -| xunit | 2.9.3 | 2.9.3 | -| xunit.SkippableFact | 1.5.23 | 1.5.23 | - -## [2.0.1] - 25.11-2025 - -### Changed - -- Simplified access for testing database activation using signature property. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 1.3.1 | 1.3.0 | -| xunit | 2.9.3 | 2.9.3 | -| xunit.SkippableFact | 1.5.23 | 1.5.23 | - -## [2.0.0] - 24.11-2025 - -### Added - -- Package initialization. - -### Changed - -- Renaming of abstractions and organization. -- Renaming of [Q_EntityValidations] to [TestingEntityBase] - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 1.2.1 | 1.3.0 | -| xunit | 2.9.3 | 2.9.3 | -| xunit.SkippableFact | --.--.-- | 1.5.23 | - - -## [1.0.0] - 06.08-2025 - -### Added - -- Package initialization. - -### Fixed - -### Changed - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | --.--.-- | 1.2.1 | -| xunit | --.--.-- | 2.9.3 | \ No newline at end of file diff --git a/CSM Database Testing/Managers/TestingStoreManager.cs b/CSM Database Testing/Managers/TestingStoreManager.cs deleted file mode 100644 index 4d189af..0000000 --- a/CSM Database Testing/Managers/TestingStoreManager.cs +++ /dev/null @@ -1,232 +0,0 @@ -using CSM_Database_Core.Core.Utils; -using CSM_Database_Core.Entities.Abstractions.Interfaces; - -using CSM_Database_Testing.Abstractions.Bases; -using CSM_Database_Testing.Disposing; -using CSM_Database_Testing.Disposing.Abstractions.Bases; -using CSM_Database_Testing.Disposing.Abstractions.Interfaces; - -using CSM_Foundation_Core.Core.Utils; - -using Microsoft.EntityFrameworkCore; - -namespace CSM_Database_Testing.Managers; - -/// -/// Represents a testing data storing methods manager. -/// -public class TestingStoreManager - : IDisposable { - - /// - /// Testing data disposer. - /// - readonly ITestingDisposer _disposer; - - /// - /// Database factories available for Samples Storing/Disposing. - /// - readonly Dictionary _dbFactories = []; - - /// - /// Creates a new instance. - /// - /// - /// Testing data disposition manager. - /// - /// - /// Storing manager context factories.. - /// - public TestingStoreManager(ITestingDisposer? disposer, params DatabaseFactory[] dbFactories) { - foreach (DatabaseFactory factory in dbFactories) { - using DbContext dbContext = factory(); - Type dbType = dbContext.GetType(); - - _dbFactories.Add(dbType, factory); - } - - _disposer = disposer ?? new TestingDisposer(dbFactories); - } - - /// - public void Dispose() { - _disposer.Dispose(); - GC.SuppressFinalize(this); - } - - /// - /// Stores the given . - /// - /// - /// Type of the to store. - /// - /// - /// Entity to store. - /// - /// - /// Stored . - /// - public async Task Store(TEntity2 entity) - where TEntity2 : class, IEntity { - - DbContext db = GetDatabase(entity.Database); - - entity = await DatabaseUtils.SanitizeEntity(db, entity); - db.Set().Add(entity); - db.SaveChanges(); - - _disposer.Push(entity); - - return entity; - } - - /// - /// Stores the given . - /// - /// - /// Type of the to store. - /// - /// - /// Entities to store. - /// - /// - /// Stored . - /// - public async Task Store(TEntity2[] entities) - where TEntity2 : class, IEntity { - - DbContext db = GetDatabase(entities[0].Database); - List refs = []; - - foreach (TEntity2 entity in entities) { - refs.Add( - await DatabaseUtils.SanitizeEntity(db, entity) - ); - } - - await db.Set().AddRangeAsync(refs); - await db.SaveChangesAsync(); - - _disposer.Push([.. refs]); - - return [.. refs]; - } - - /// - /// Stores the given built . - /// - /// - /// Type of the to store. - /// - /// - /// Entity factory method. - /// - /// - /// Stored built . - /// - public async Task Store(EntityFactory entityFactory) - where TEntity2 : class, IEntity { - - TEntity2 toStore = await RunEntityFactory(entityFactory); - toStore = await Store(toStore); - - return toStore; - } - - /// - /// Iterates based on to generate [Entities] to store based on . - /// - /// - /// Type of the [Entity] to store. - /// - /// - /// Quantity of iterations to call and store the factory result. - /// - /// - /// Factory to build the [Entity] to store. - /// - /// - /// The stored and updated [Entities] stored. - /// - public async Task Store(int quantity, EntityFactory entityFactory) - where TEntity2 : class, IEntity, new() { - - List entities = []; - - using DbContext database = GetDatabase(new TEntity2().Database); - for (int i = 0; i < quantity; i++) { - - TEntity2 entity = await RunEntityFactory(entityFactory); - entity = await DatabaseUtils.SanitizeEntity(database, entity); - entities.Add(entity); - } - - await database.Set().AddRangeAsync(entities); - await database.SaveChangesAsync(); - _disposer.Push([.. entities]); - - return [.. entities]; - } - - /// - /// Internal runner for utilizations, automatically sends the [Entropy] parameter. - /// - /// - /// Type of the [Entity] build by the . - /// - /// - /// [Entity] factory function. - /// - /// - /// The generated [Entity] object. - /// - public static async Task RunEntityFactory(EntityFactory factory) - where TEntity2 : class, IEntity { - - return await factory(RandomUtils.String(16)); - } - - /// - /// Retrieves the database instance for the given based on the subscribed DatabaseFactories. - /// - /// - /// of the database requested. - /// - /// - /// The matched database context instance. - /// - /// - /// Thrown when the requested database isn't found in the subcribed database factories. - /// - DbContext GetDatabase(Type databaseType) { - return !_dbFactories.TryGetValue(databaseType, out DatabaseFactory? factory) - ? throw new Exception($"No factory subscribed for [({databaseType.Name})]") - : factory(); - } - - /// - /// Retrieves the stored instances that match the given . - /// - /// - /// Type of the to retrieve. - /// - /// - /// Collection of instances to look up. - /// - /// - /// A list of instances whose is contained in . - /// Only the IDs that exist in the database are included. - /// - public async Task> Get(TEntity2[] entities) - where TEntity2 : class, IEntity, new() { - - using DbContext database = GetDatabase(new TEntity2().Database); - - object[] ids = [.. entities.Select(entity => entity.Id)]; - List found = await database.Set() - .Where(entity => ids.Contains(entity.Id)) - .ToListAsync(); - - return found; - } -} diff --git a/Integration Tests/Tests/DepotBaseTests.cs b/Integration Tests/Tests/DepotBaseTests.cs deleted file mode 100644 index e16097f..0000000 --- a/Integration Tests/Tests/DepotBaseTests.cs +++ /dev/null @@ -1,103 +0,0 @@ -using CSM_Database_Core.Depots.Abstractions.Bases; -using CSM_Database_Core.Depots.Models; -using CSM_Database_Core.Depots.Models.Structs; - -using CSM_Database_Testing.Abstractions.Bases; - -using DatabaseProxy; -using DatabaseProxy.Entities; - -using Microsoft.EntityFrameworkCore; - -namespace Integration_Tests.Tests; - -/// -/// Integration tests class for -/// -public class DepotBaseTests - : DepotIntegrationTestsBase { - - protected override async Task EntityFactory(string Entropy) { - return new EntityProxy { - EntityDependencyProxy = await _storeManager.Store( - new EntityDependencyProxy() - ) - }; - } - - /// - /// Method: - /// Expectation: Success updating. - /// - public override async Task Update_Single_Success() { - //Expectation - EntityProxy testEntity = await Store( - new EntityProxy { - - } - ); - - EntityDependencyProxy dependency = await Store( - new EntityDependencyProxy() - ); - - EntityDependantProxy dependant = await Store( - new EntityDependantProxy() - ); - - await Store( - new EntityDependantProxy { - EntityProxy = testEntity - } - ); - - testEntity.EntityDependencyProxy = dependency; - - UpdateOutput updateOutput = await _depot.Update( - new QueryInput> { - Parameters = new UpdateInput { - Entity = testEntity, - Relations = new Dictionary> { - { - nameof(EntityProxy.EntityDependantProxies), - new Dictionary { - { - string.Empty, - new RelationUpdate[] { - new() { - Entity = dependant, - Action = RelationUpdateAction.ADD - } - } - } - } - - }, - }, - }, - PostProcessor = (query) => { - return query.Include(i => i.EntityDependantProxies); - } - } - ); - - EntityProxy? ogEntity = updateOutput.Original; - EntityProxy updatedEntity = updateOutput.Updated; - - - Assert.NotNull(ogEntity); - Assert.Single(ogEntity.EntityDependantProxies); - - Assert.NotEmpty(updatedEntity.EntityDependantProxies); - - Assert.Contains( - updatedEntity.EntityDependantProxies, - (dependantEntry) => dependantEntry.Id == dependant.Id - ); - Assert.Equal( - dependency.Id, - updatedEntity.EntityDependencyProxy.Id - ); - } - -} diff --git a/README.md b/README.md index 166586c..45487d9 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,10 @@ A repository for a framweork extensions package. Framweork extensions are CSM shaped utilities and tools for frameworks and languages used during development. -[Changelog](./csharp_database_extension/CHANGELOG.md) +> For more details about each version content, please consult [Changelog](./csharp_database_extension/CHANGELOG.md) ## **Installation & Usage** -// --> Example for NuGet based packages. - > dotnet nuget add source --name "github" --username {*GITHUB.USR*} --password {*GITHUB.PAT*} "" * GITHUB.USR: It's your github user account. @@ -15,3 +13,13 @@ A repository for a framweork extensions package. Framweork extensions are CSM sh * GITHUB.PAT: It's a generated personal access token, go to *Settings* > *Developer Settings* > *Personal access tokens*, create a **Classic** type access token and provide at minimum **Read:Packages** permission. > dotnet add package **CSharp.Database.Extension** --source github + +## **Testing** + +A testing purposes package is included, provides tools to handle easier tests setup, configurations, and managament of classes. + +> dotnet add package **CSharp.Database.Extension.Testing** --source github + +Highly recommended only use on testing projects. + +> For more details about package content please consult [CHANGELOG]() \ No newline at end of file diff --git a/Unit Tests/Tests/UtilsTests/DatabaseUtilsTests.cs b/Unit Tests/Tests/UtilsTests/DatabaseUtilsTests.cs deleted file mode 100644 index 53be18c..0000000 --- a/Unit Tests/Tests/UtilsTests/DatabaseUtilsTests.cs +++ /dev/null @@ -1,35 +0,0 @@ -using CSM_Database_Core.Core.Utils; - -using DatabaseProxy.Entities; - -using Microsoft.EntityFrameworkCore; - -using Moq; - -namespace UnitTests.Tests.UtilsTests; - - -/// -/// Unit tests class for . -/// -public class DatabaseUtilsTests { - - - /// - /// Method: - /// Expectation: Entity dependencies don´t throw relation detection exceptions. - /// - [Fact] - public async Task SatinizeEntity_RelationDetection() { - - //Mocking - Mock databaseProxyMock = new(); - Mock entityProxyMock = new(); - - //Acting - EntityProxy output = await DatabaseUtils.SanitizeEntity(databaseProxyMock.Object, entityProxyMock.Object); - - //Asserting - Assert.NotNull(output); - } -} diff --git a/Unit Tests/Unit Tests.csproj b/Unit Tests/Unit Tests.csproj deleted file mode 100644 index f10ade8..0000000 --- a/Unit Tests/Unit Tests.csproj +++ /dev/null @@ -1,36 +0,0 @@ - - - - net10.0 - UnitTests - enable - enable - - false - true - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - - diff --git a/CSM Database Testing/Abstractions/Bases/DatabaseIntegrationTestsBase.cs b/csharp_database_extension/CSM Database Testing/Abstractions/Bases/DatabaseIntegrationTestsBase.cs similarity index 100% rename from CSM Database Testing/Abstractions/Bases/DatabaseIntegrationTestsBase.cs rename to csharp_database_extension/CSM Database Testing/Abstractions/Bases/DatabaseIntegrationTestsBase.cs diff --git a/CSM Database Testing/Abstractions/Bases/EntityIntegrationTestsBase.cs b/csharp_database_extension/CSM Database Testing/Abstractions/Bases/EntityIntegrationTestsBase.cs similarity index 100% rename from CSM Database Testing/Abstractions/Bases/EntityIntegrationTestsBase.cs rename to csharp_database_extension/CSM Database Testing/Abstractions/Bases/EntityIntegrationTestsBase.cs diff --git a/CSM Database Testing/Abstractions/Interfaces/ITestingDatabase.cs b/csharp_database_extension/CSM Database Testing/Abstractions/Interfaces/ITestingDatabase.cs similarity index 100% rename from CSM Database Testing/Abstractions/Interfaces/ITestingDatabase.cs rename to csharp_database_extension/CSM Database Testing/Abstractions/Interfaces/ITestingDatabase.cs diff --git a/CSM Database Testing/BaseDraftUtils.cs b/csharp_database_extension/CSM Database Testing/BaseDraftUtils.cs similarity index 100% rename from CSM Database Testing/BaseDraftUtils.cs rename to csharp_database_extension/CSM Database Testing/BaseDraftUtils.cs diff --git a/CSM Database Testing/CSM Database Testing.csproj b/csharp_database_extension/CSM Database Testing/CSharp Database Extension Testing.csproj similarity index 100% rename from CSM Database Testing/CSM Database Testing.csproj rename to csharp_database_extension/CSM Database Testing/CSharp Database Extension Testing.csproj diff --git a/CSM Database Testing/Disposing/Abstractions/Bases/TestingDisposerBase.cs b/csharp_database_extension/CSM Database Testing/Disposing/Abstractions/Bases/TestingDisposerBase.cs similarity index 100% rename from CSM Database Testing/Disposing/Abstractions/Bases/TestingDisposerBase.cs rename to csharp_database_extension/CSM Database Testing/Disposing/Abstractions/Bases/TestingDisposerBase.cs diff --git a/CSM Database Testing/Disposing/Abstractions/Interfaces/ITestingDisposer.cs b/csharp_database_extension/CSM Database Testing/Disposing/Abstractions/Interfaces/ITestingDisposer.cs similarity index 100% rename from CSM Database Testing/Disposing/Abstractions/Interfaces/ITestingDisposer.cs rename to csharp_database_extension/CSM Database Testing/Disposing/Abstractions/Interfaces/ITestingDisposer.cs diff --git a/CSM Database Testing/Disposing/TestingDisposer.cs b/csharp_database_extension/CSM Database Testing/Disposing/TestingDisposer.cs similarity index 100% rename from CSM Database Testing/Disposing/TestingDisposer.cs rename to csharp_database_extension/CSM Database Testing/Disposing/TestingDisposer.cs diff --git a/csharp_database_extension/CSharp Database Extension.sln b/csharp_database_extension/CSharp Database Extension.sln index 214b441..547c156 100644 --- a/csharp_database_extension/CSharp Database Extension.sln +++ b/csharp_database_extension/CSharp Database Extension.sln @@ -12,8 +12,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharp Database Extension", "CSM Database Core\CSharp Database Extension.csproj", "{4A3C8AEE-DF2B-0967-7D71-5B7C61239D19}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unit Tests", "Unit Tests\Unit Tests.csproj", "{CBAAFF94-19D9-CA27-EB09-AC83990DFBC8}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -24,10 +22,6 @@ Global {4A3C8AEE-DF2B-0967-7D71-5B7C61239D19}.Debug|Any CPU.Build.0 = Debug|Any CPU {4A3C8AEE-DF2B-0967-7D71-5B7C61239D19}.Release|Any CPU.ActiveCfg = Release|Any CPU {4A3C8AEE-DF2B-0967-7D71-5B7C61239D19}.Release|Any CPU.Build.0 = Release|Any CPU - {CBAAFF94-19D9-CA27-EB09-AC83990DFBC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CBAAFF94-19D9-CA27-EB09-AC83990DFBC8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CBAAFF94-19D9-CA27-EB09-AC83990DFBC8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CBAAFF94-19D9-CA27-EB09-AC83990DFBC8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Integration Tests/Integration Tests.csproj b/csharp_database_extension/Integration Tests/Integration Tests.csproj similarity index 100% rename from Integration Tests/Integration Tests.csproj rename to csharp_database_extension/Integration Tests/Integration Tests.csproj diff --git a/csharp_database_extension/Unit Tests/Unit Tests.csproj b/csharp_database_extension/Unit Tests/Unit Tests.csproj index 4e6a15b..f10ade8 100644 --- a/csharp_database_extension/Unit Tests/Unit Tests.csproj +++ b/csharp_database_extension/Unit Tests/Unit Tests.csproj @@ -25,7 +25,8 @@ - + + From fcad98ed7424c15e4917afc6076553809e68db92 Mon Sep 17 00:00:00 2001 From: Renato Urrea Date: Mon, 5 Oct 2026 21:58:21 -0700 Subject: [PATCH 09/60] Checking project adjustments and content --- .../Bases/DatabaseIntegrationTestsBase.cs | 8 +- .../Bases/DepotIntegrationTestsBase.cs | 16 +- .../Bases/EntityIntegrationTestsBase.cs | 4 +- .../Bases/TestingDataHandlerBase.cs | 2 +- .../Interfaces/ITestingDatabase.cs | 0 .../BaseDraftUtils.cs | 4 +- .../CHANGELOG.md | 0 .../CSharp Database Extension Testing.csproj | 10 +- .../Abstractions/Bases/TestingDisposerBase.cs | 2 +- .../Interfaces/ITestingDisposer.cs | 4 +- .../Disposing/TestingDisposer.cs | 0 .../Managers/TestingStoreManager.cs | 8 +- .../CSharp Database Extension.sln | 16 +- .../Abstractions/Bases/DatabaseBase.cs | 159 +++++++++--------- .../Bases/DatabaseDesignerBase.cs | 6 +- .../Abstractions/Interfaces/IDatabase.cs | 10 +- .../CHANGELOG.md | 0 .../CSharp Database Extension.csproj | 14 +- .../Bases/RelationAttributeBase.cs | 4 +- .../Interfaces/IRelationAttribute.cs | 5 +- .../Attributes/EntityRelationAttribute.cs | 4 +- .../Common/Enums/DatabaseProviders.cs | 17 ++ .../Common}/Errors/DatabaseError.cs | 4 +- .../Common}/Errors/DepotError.cs | 14 +- .../Common}/Errors/EntityError.cs | 6 +- .../Common}/Errors/EntityValidationError.cs | 6 +- .../Common}/Errors/ValidatorError.cs | 8 +- .../Extensions/EntityTypeBuilderExtension.cs | 4 +- .../Common}/Extensions/IQueryableExtension.cs | 8 +- .../Common}/Extensions/TypeExtension.cs | 2 +- .../Common}/Models/ConnectionOptions.cs | 2 +- .../Common}/Models/DatabaseOptions.cs | 22 ++- .../Common}/Utils/DatabaseUtils.cs | 16 +- .../Common}/Utils/EntityUtils.cs | 6 +- .../Depots/Abstractions/Bases/DepotBase.cs | 66 ++++---- .../Depots/Abstractions/Interfaces/IDepot.cs | 4 +- .../Abstractions/Interfaces/IDepotCreate.cs | 6 +- .../Abstractions/Interfaces/IDepotDelete.cs | 6 +- .../Abstractions/Interfaces/IDepotRead.cs | 6 +- .../Abstractions/Interfaces/IDepotUpdate.cs | 6 +- .../Abstractions/Interfaces/IDepotView.cs | 6 +- .../Interfaces/IUpdateEntityInput.cs | 4 +- .../Abstractions/Interfaces/IViewFilter.cs | 13 +- .../Interfaces/IViewFilterNode.cs | 10 +- .../Depots/Models/BatchOperationOutput.cs | 6 +- .../Depots/Models/FilterQueryInput.cs | 4 +- .../Depots/Models/PaginationOutput.cs | 4 +- .../Depots/Models/PropertyValidationResult.cs | 4 +- .../Depots/Models/QueryInput.cs | 6 +- .../Depots/Models/Structs/RelationUpdate.cs | 4 +- .../Depots/Models/UpdateInput.cs | 6 +- .../Depots/Models/UpdateOutput.cs | 5 +- .../Depots/Models/ViewInput.cs | 7 +- .../Depots/Models/ViewOrdering.cs | 2 +- .../Depots/Models/ViewOutput.cs | 16 +- .../Depots/ViewFilters/ViewFilterDate.cs | 6 +- .../Depots/ViewFilters/ViewFilterLogical.cs | 6 +- .../Depots/ViewFilters/ViewFilterProperty.cs | 6 +- .../Abstractions/Bases/ActivableEntityBase.cs | 4 +- .../Entities/Abstractions/Bases/EntityBase.cs | 10 +- .../Abstractions/Bases/NamedEntityBase.cs | 4 +- .../Bases/PartnerBridgeEntityBase.cs | 4 +- .../Bases/PartnerScopeEntityBase.cs | 6 +- .../Interfaces/IActivableEntity.cs | 2 +- .../Abstractions/Interfaces/IEntity.cs | 10 +- .../Abstractions/Interfaces/INamedEntity.cs | 2 +- .../Interfaces/IPartnerBridgeEntity.cs | 2 +- .../Interfaces/IPartnerScopeEntity.cs | 2 +- .../Abstractions/Bases/ValidatorBase.cs | 4 +- .../Abstractions/Interfaces/IValidator.cs | 2 +- .../Validation/ExclusiveValidator.cs | 4 +- 71 files changed, 345 insertions(+), 311 deletions(-) rename csharp_database_extension/{CSM Database Testing => CSharp Database Extension Testing}/Abstractions/Bases/DatabaseIntegrationTestsBase.cs (93%) rename csharp_database_extension/{CSM Database Testing => CSharp Database Extension Testing}/Abstractions/Bases/DepotIntegrationTestsBase.cs (98%) rename csharp_database_extension/{CSM Database Testing => CSharp Database Extension Testing}/Abstractions/Bases/EntityIntegrationTestsBase.cs (89%) rename csharp_database_extension/{CSM Database Testing => CSharp Database Extension Testing}/Abstractions/Bases/TestingDataHandlerBase.cs (97%) rename csharp_database_extension/{CSM Database Testing => CSharp Database Extension Testing}/Abstractions/Interfaces/ITestingDatabase.cs (100%) rename csharp_database_extension/{CSM Database Testing => CSharp Database Extension Testing}/BaseDraftUtils.cs (97%) rename csharp_database_extension/{CSM Database Testing => CSharp Database Extension Testing}/CHANGELOG.md (100%) rename csharp_database_extension/{CSM Database Testing => CSharp Database Extension Testing}/CSharp Database Extension Testing.csproj (74%) rename csharp_database_extension/{CSM Database Testing => CSharp Database Extension Testing}/Disposing/Abstractions/Bases/TestingDisposerBase.cs (98%) rename csharp_database_extension/{CSM Database Testing => CSharp Database Extension Testing}/Disposing/Abstractions/Interfaces/ITestingDisposer.cs (64%) rename csharp_database_extension/{CSM Database Testing => CSharp Database Extension Testing}/Disposing/TestingDisposer.cs (100%) rename csharp_database_extension/{CSM Database Testing => CSharp Database Extension Testing}/Managers/TestingStoreManager.cs (98%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Abstractions/Bases/DatabaseBase.cs (80%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Abstractions/Bases/DatabaseDesignerBase.cs (84%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Abstractions/Interfaces/IDatabase.cs (57%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/CHANGELOG.md (100%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/CSharp Database Extension.csproj (75%) rename csharp_database_extension/{CSM Database Core/Core => CSharp Database Extension/Common}/Attributes/Abstractions/Bases/RelationAttributeBase.cs (74%) rename csharp_database_extension/{CSM Database Core/Core => CSharp Database Extension/Common}/Attributes/Abstractions/Interfaces/IRelationAttribute.cs (63%) rename csharp_database_extension/{CSM Database Core/Core => CSharp Database Extension/Common}/Attributes/EntityRelationAttribute.cs (73%) create mode 100644 csharp_database_extension/CSharp Database Extension/Common/Enums/DatabaseProviders.cs rename csharp_database_extension/{CSM Database Core/Core => CSharp Database Extension/Common}/Errors/DatabaseError.cs (91%) rename csharp_database_extension/{CSM Database Core/Core => CSharp Database Extension/Common}/Errors/DepotError.cs (89%) rename csharp_database_extension/{CSM Database Core/Core => CSharp Database Extension/Common}/Errors/EntityError.cs (92%) rename csharp_database_extension/{CSM Database Core/Core => CSharp Database Extension/Common}/Errors/EntityValidationError.cs (90%) rename csharp_database_extension/{CSM Database Core/Core => CSharp Database Extension/Common}/Errors/ValidatorError.cs (88%) rename csharp_database_extension/{CSM Database Core/Core => CSharp Database Extension/Common}/Extensions/EntityTypeBuilderExtension.cs (98%) rename csharp_database_extension/{CSM Database Core/Core => CSharp Database Extension/Common}/Extensions/IQueryableExtension.cs (96%) rename csharp_database_extension/{CSM Database Core/Core => CSharp Database Extension/Common}/Extensions/TypeExtension.cs (97%) rename csharp_database_extension/{CSM Database Core/Core => CSharp Database Extension/Common}/Models/ConnectionOptions.cs (97%) rename csharp_database_extension/{CSM Database Core/Core => CSharp Database Extension/Common}/Models/DatabaseOptions.cs (68%) rename csharp_database_extension/{CSM Database Core/Core => CSharp Database Extension/Common}/Utils/DatabaseUtils.cs (98%) rename csharp_database_extension/{CSM Database Core/Core => CSharp Database Extension/Common}/Utils/EntityUtils.cs (92%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/Abstractions/Bases/DepotBase.cs (94%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/Abstractions/Interfaces/IDepot.cs (87%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/Abstractions/Interfaces/IDepotCreate.cs (85%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/Abstractions/Interfaces/IDepotDelete.cs (92%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/Abstractions/Interfaces/IDepotRead.cs (88%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/Abstractions/Interfaces/IDepotUpdate.cs (77%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/Abstractions/Interfaces/IDepotView.cs (78%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/Abstractions/Interfaces/IUpdateEntityInput.cs (85%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/Abstractions/Interfaces/IViewFilter.cs (92%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/Abstractions/Interfaces/IViewFilterNode.cs (89%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/Models/BatchOperationOutput.cs (92%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/Models/FilterQueryInput.cs (89%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/Models/PaginationOutput.cs (89%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/Models/PropertyValidationResult.cs (81%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/Models/QueryInput.cs (80%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/Models/Structs/RelationUpdate.cs (85%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/Models/UpdateInput.cs (89%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/Models/UpdateOutput.cs (80%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/Models/ViewInput.cs (88%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/Models/ViewOrdering.cs (93%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/Models/ViewOutput.cs (83%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/ViewFilters/ViewFilterDate.cs (91%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/ViewFilters/ViewFilterLogical.cs (93%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Depots/ViewFilters/ViewFilterProperty.cs (95%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Entities/Abstractions/Bases/ActivableEntityBase.cs (66%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Entities/Abstractions/Bases/EntityBase.cs (85%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Entities/Abstractions/Bases/NamedEntityBase.cs (78%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Entities/Abstractions/Bases/PartnerBridgeEntityBase.cs (93%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Entities/Abstractions/Bases/PartnerScopeEntityBase.cs (89%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Entities/Abstractions/Interfaces/IActivableEntity.cs (77%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Entities/Abstractions/Interfaces/IEntity.cs (85%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Entities/Abstractions/Interfaces/INamedEntity.cs (90%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Entities/Abstractions/Interfaces/IPartnerBridgeEntity.cs (94%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Entities/Abstractions/Interfaces/IPartnerScopeEntity.cs (90%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Validation/Abstractions/Bases/ValidatorBase.cs (68%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Validation/Abstractions/Interfaces/IValidator.cs (91%) rename csharp_database_extension/{CSM Database Core => CSharp Database Extension}/Validation/ExclusiveValidator.cs (96%) diff --git a/csharp_database_extension/CSM Database Testing/Abstractions/Bases/DatabaseIntegrationTestsBase.cs b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/DatabaseIntegrationTestsBase.cs similarity index 93% rename from csharp_database_extension/CSM Database Testing/Abstractions/Bases/DatabaseIntegrationTestsBase.cs rename to csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/DatabaseIntegrationTestsBase.cs index 5f31b8e..0531d64 100644 --- a/csharp_database_extension/CSM Database Testing/Abstractions/Bases/DatabaseIntegrationTestsBase.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/DatabaseIntegrationTestsBase.cs @@ -1,9 +1,9 @@ -using CSM_Database_Core; -using CSM_Database_Core.Core.Models; +using CSharp_Database_Extension; +using CSharp_Database_Extension.Core.Models; -using CSM_Database_Testing.Abstractions.Interfaces; +using CSharp_Extension.Common.Extensions; -using CSM_Foundation_Core.Core.Extensions; +using CSM_Database_Testing.Abstractions.Interfaces; using Microsoft.EntityFrameworkCore; diff --git a/csharp_database_extension/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs similarity index 98% rename from csharp_database_extension/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs rename to csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs index af8885c..132ea0c 100644 --- a/csharp_database_extension/CSM Database Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs @@ -1,13 +1,13 @@ using System.Linq.Expressions; using System.Reflection; -using CSM_Database_Core; -using CSM_Database_Core.Core.Errors; -using CSM_Database_Core.Core.Models; -using CSM_Database_Core.Depots.Abstractions.Interfaces; -using CSM_Database_Core.Depots.Models; -using CSM_Database_Core.Depots.ViewFilters; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension; +using CSharp_Database_Extension.Core.Errors; +using CSharp_Database_Extension.Core.Models; +using CSharp_Database_Extension.Depots.Abstractions.Interfaces; +using CSharp_Database_Extension.Depots.Models; +using CSharp_Database_Extension.Depots.ViewFilters; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; using CSM_Database_Testing.Disposing.Abstractions.Bases; using CSM_Database_Testing.Managers; @@ -27,7 +27,7 @@ namespace CSM_Database_Testing.Abstractions.Bases; /// Type of the being tested. /// /// -/// Type of the handling the . +/// Type of the handling the . /// public abstract class DepotIntegrationTestsBase : TestingDataHandlerBase diff --git a/csharp_database_extension/CSM Database Testing/Abstractions/Bases/EntityIntegrationTestsBase.cs b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/EntityIntegrationTestsBase.cs similarity index 89% rename from csharp_database_extension/CSM Database Testing/Abstractions/Bases/EntityIntegrationTestsBase.cs rename to csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/EntityIntegrationTestsBase.cs index 93a8b94..0af25aa 100644 --- a/csharp_database_extension/CSM Database Testing/Abstractions/Bases/EntityIntegrationTestsBase.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/EntityIntegrationTestsBase.cs @@ -1,5 +1,5 @@ -using CSM_Database_Core.Entities.Abstractions.Interfaces; -using CSM_Database_Core.Validation.Abstractions.Bases; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Validation.Abstractions.Bases; namespace CSM_Database_Testing.Abstractions.Bases; diff --git a/csharp_database_extension/CSM Database Testing/Abstractions/Bases/TestingDataHandlerBase.cs b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/TestingDataHandlerBase.cs similarity index 97% rename from csharp_database_extension/CSM Database Testing/Abstractions/Bases/TestingDataHandlerBase.cs rename to csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/TestingDataHandlerBase.cs index 3729cc6..de0c47b 100644 --- a/csharp_database_extension/CSM Database Testing/Abstractions/Bases/TestingDataHandlerBase.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/TestingDataHandlerBase.cs @@ -1,4 +1,4 @@ -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; using CSM_Database_Testing.Disposing; using CSM_Database_Testing.Disposing.Abstractions.Bases; diff --git a/csharp_database_extension/CSM Database Testing/Abstractions/Interfaces/ITestingDatabase.cs b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Interfaces/ITestingDatabase.cs similarity index 100% rename from csharp_database_extension/CSM Database Testing/Abstractions/Interfaces/ITestingDatabase.cs rename to csharp_database_extension/CSharp Database Extension Testing/Abstractions/Interfaces/ITestingDatabase.cs diff --git a/csharp_database_extension/CSM Database Testing/BaseDraftUtils.cs b/csharp_database_extension/CSharp Database Extension Testing/BaseDraftUtils.cs similarity index 97% rename from csharp_database_extension/CSM Database Testing/BaseDraftUtils.cs rename to csharp_database_extension/CSharp Database Extension Testing/BaseDraftUtils.cs index d2d762a..5e5ebd9 100644 --- a/csharp_database_extension/CSM Database Testing/BaseDraftUtils.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/BaseDraftUtils.cs @@ -1,6 +1,6 @@ -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -using CSM_Foundation_Core.Core.Utils; +using CSharp_Extension.Common.Utils; namespace CSM_Database_Testing; diff --git a/csharp_database_extension/CSM Database Testing/CHANGELOG.md b/csharp_database_extension/CSharp Database Extension Testing/CHANGELOG.md similarity index 100% rename from csharp_database_extension/CSM Database Testing/CHANGELOG.md rename to csharp_database_extension/CSharp Database Extension Testing/CHANGELOG.md diff --git a/csharp_database_extension/CSM Database Testing/CSharp Database Extension Testing.csproj b/csharp_database_extension/CSharp Database Extension Testing/CSharp Database Extension Testing.csproj similarity index 74% rename from csharp_database_extension/CSM Database Testing/CSharp Database Extension Testing.csproj rename to csharp_database_extension/CSharp Database Extension Testing/CSharp Database Extension Testing.csproj index 3fb0b0b..5b86424 100644 --- a/csharp_database_extension/CSM Database Testing/CSharp Database Extension Testing.csproj +++ b/csharp_database_extension/CSharp Database Extension Testing/CSharp Database Extension Testing.csproj @@ -1,10 +1,11 @@  + 1.0.0 + CSharp.Database.Extension.Testing + CSharp_Database_Extension_Testing + net10.0 - CSM_Database_Testing - CSM.Database.Testing - 8.0.0 Renato Urrea Cosmos (CSM) https://github.com/Cosmos-CSM/csm_database @@ -23,12 +24,11 @@ - - + diff --git a/csharp_database_extension/CSM Database Testing/Disposing/Abstractions/Bases/TestingDisposerBase.cs b/csharp_database_extension/CSharp Database Extension Testing/Disposing/Abstractions/Bases/TestingDisposerBase.cs similarity index 98% rename from csharp_database_extension/CSM Database Testing/Disposing/Abstractions/Bases/TestingDisposerBase.cs rename to csharp_database_extension/CSharp Database Extension Testing/Disposing/Abstractions/Bases/TestingDisposerBase.cs index b04a070..1de0bd9 100644 --- a/csharp_database_extension/CSM Database Testing/Disposing/Abstractions/Bases/TestingDisposerBase.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/Disposing/Abstractions/Bases/TestingDisposerBase.cs @@ -1,6 +1,6 @@ using System.Collections.Concurrent; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; using CSM_Database_Testing.Disposing.Abstractions.Interfaces; diff --git a/csharp_database_extension/CSM Database Testing/Disposing/Abstractions/Interfaces/ITestingDisposer.cs b/csharp_database_extension/CSharp Database Extension Testing/Disposing/Abstractions/Interfaces/ITestingDisposer.cs similarity index 64% rename from csharp_database_extension/CSM Database Testing/Disposing/Abstractions/Interfaces/ITestingDisposer.cs rename to csharp_database_extension/CSharp Database Extension Testing/Disposing/Abstractions/Interfaces/ITestingDisposer.cs index 00de600..92de63d 100644 --- a/csharp_database_extension/CSM Database Testing/Disposing/Abstractions/Interfaces/ITestingDisposer.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/Disposing/Abstractions/Interfaces/ITestingDisposer.cs @@ -1,6 +1,6 @@ -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -using CSM_Foundation_Core.Abstractions.Interfaces; +using CSharp_Extension.Common.Abstractions.Interfaces; namespace CSM_Database_Testing.Disposing.Abstractions.Interfaces; diff --git a/csharp_database_extension/CSM Database Testing/Disposing/TestingDisposer.cs b/csharp_database_extension/CSharp Database Extension Testing/Disposing/TestingDisposer.cs similarity index 100% rename from csharp_database_extension/CSM Database Testing/Disposing/TestingDisposer.cs rename to csharp_database_extension/CSharp Database Extension Testing/Disposing/TestingDisposer.cs diff --git a/csharp_database_extension/CSM Database Testing/Managers/TestingStoreManager.cs b/csharp_database_extension/CSharp Database Extension Testing/Managers/TestingStoreManager.cs similarity index 98% rename from csharp_database_extension/CSM Database Testing/Managers/TestingStoreManager.cs rename to csharp_database_extension/CSharp Database Extension Testing/Managers/TestingStoreManager.cs index 4d189af..e55bc75 100644 --- a/csharp_database_extension/CSM Database Testing/Managers/TestingStoreManager.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/Managers/TestingStoreManager.cs @@ -1,13 +1,13 @@ -using CSM_Database_Core.Core.Utils; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Core.Utils; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; + +using CSharp_Extension.Common.Utils; using CSM_Database_Testing.Abstractions.Bases; using CSM_Database_Testing.Disposing; using CSM_Database_Testing.Disposing.Abstractions.Bases; using CSM_Database_Testing.Disposing.Abstractions.Interfaces; -using CSM_Foundation_Core.Core.Utils; - using Microsoft.EntityFrameworkCore; namespace CSM_Database_Testing.Managers; diff --git a/csharp_database_extension/CSharp Database Extension.sln b/csharp_database_extension/CSharp Database Extension.sln index 547c156..65722ed 100644 --- a/csharp_database_extension/CSharp Database Extension.sln +++ b/csharp_database_extension/CSharp Database Extension.sln @@ -10,7 +10,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution local.integration_tests.runsettings = local.integration_tests.runsettings EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharp Database Extension", "CSM Database Core\CSharp Database Extension.csproj", "{4A3C8AEE-DF2B-0967-7D71-5B7C61239D19}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharp Database Extension", "CSharp Database Extension\CSharp Database Extension.csproj", "{72B5B574-C82D-1E32-04E2-C221BE46753D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharp Database Extension Testing", "CSharp Database Extension Testing\CSharp Database Extension Testing.csproj", "{0EAC75F4-83B9-73B2-74CF-F6D4BBD3BEBF}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -18,10 +20,14 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4A3C8AEE-DF2B-0967-7D71-5B7C61239D19}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4A3C8AEE-DF2B-0967-7D71-5B7C61239D19}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4A3C8AEE-DF2B-0967-7D71-5B7C61239D19}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4A3C8AEE-DF2B-0967-7D71-5B7C61239D19}.Release|Any CPU.Build.0 = Release|Any CPU + {72B5B574-C82D-1E32-04E2-C221BE46753D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {72B5B574-C82D-1E32-04E2-C221BE46753D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {72B5B574-C82D-1E32-04E2-C221BE46753D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {72B5B574-C82D-1E32-04E2-C221BE46753D}.Release|Any CPU.Build.0 = Release|Any CPU + {0EAC75F4-83B9-73B2-74CF-F6D4BBD3BEBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0EAC75F4-83B9-73B2-74CF-F6D4BBD3BEBF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0EAC75F4-83B9-73B2-74CF-F6D4BBD3BEBF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0EAC75F4-83B9-73B2-74CF-F6D4BBD3BEBF}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/csharp_database_extension/CSM Database Core/Abstractions/Bases/DatabaseBase.cs b/csharp_database_extension/CSharp Database Extension/Abstractions/Bases/DatabaseBase.cs similarity index 80% rename from csharp_database_extension/CSM Database Core/Abstractions/Bases/DatabaseBase.cs rename to csharp_database_extension/CSharp Database Extension/Abstractions/Bases/DatabaseBase.cs index e91c45c..6a1accb 100644 --- a/csharp_database_extension/CSM Database Core/Abstractions/Bases/DatabaseBase.cs +++ b/csharp_database_extension/CSharp Database Extension/Abstractions/Bases/DatabaseBase.cs @@ -1,43 +1,42 @@ using System.Reflection; -using CSM_Database_Core.Abstractions.Interfaces; -using CSM_Database_Core.Core.Errors; -using CSM_Database_Core.Core.Models; -using CSM_Database_Core.Core.Utils; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Abstractions.Interfaces; +using CSharp_Database_Extension.Common.Models; +using CSharp_Database_Extension.Core.Errors; +using CSharp_Database_Extension.Core.Utils; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -using CSM_Foundation_Core.Core.Utils; +using CSharp_Extension.Common.Utils; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata.Builders; -namespace CSM_Database_Core; +namespace CSharp_Database_Extension; /// -/// Represents a CSM Database, wich configures and handles data management along business entities and -/// data persistence. +/// Represents a Database Model. /// /// -/// implementation of the database handler. +/// Type of the database model. /// public abstract partial class DatabaseBase : DbContext, IDatabase where TDatabases : DbContext { /// - public virtual string Sign { get; protected set; } = "DBSign"; + public virtual string Signature { get; protected set; } = ""; /// - /// Database context options. + /// Database model; options. /// - public DatabaseOptions DatabaseOptions { get; init; } + public DatabaseOptions Options { get; init; } /// /// Creates a new instance. /// public DatabaseBase() { - DatabaseOptions = new DatabaseOptions(); + Options = new DatabaseOptions(); BuildOptions(); } @@ -45,38 +44,84 @@ public DatabaseBase() { /// Creates a new instance. /// /// - /// Database context options. + /// EF Database context options. /// public DatabaseBase(DatabaseOptions databaseOptions) : base(databaseOptions.DbContextOptions ?? new()) { - DatabaseOptions = databaseOptions; + Options = databaseOptions; BuildOptions(); } + + #region Public + + /// + public bool Validate(bool strict = true) { + bool logsOn = Options.EnableLogging; + + if (logsOn) { + ConsoleUtils.Announce( + $"Setting up ORM", + new() { + { "Database", GetType()?.Namespace ?? "---" }, + { "Base", nameof(DatabaseBase<>) } + } + ); + } + + if (Database.CanConnect()) { + if (logsOn) + ConsoleUtils.Success($"[{GetType().FullName}] ORM Set"); + + IEnumerable pendingMigrations = Database.GetPendingMigrations(); + if (pendingMigrations.Any()) { + + if (strict) + throw new Exception($"ORM ({GetType().FullName}) has pending migrations ({pendingMigrations.Count()})"); + + return false; + } + return ValidateEntityDefinitions(strict); + } + + try { + Database.OpenConnection(); + return true; + } catch (Exception ex) { + + if (strict) + throw new Exception($"Invalid connection with Database ({GetType().FullName}) | {ex.InnerException?.Message}"); + + return false; + } + } + + #endregion + /// - /// Validates dependencies and generates required ones. + /// Validates dependencies and generates required ones. /// /// /// Important process, is required to be called in each constructor. /// void BuildOptions() { - DatabaseOptions.Sign ??= Sign; + Options.Signature ??= Signature; - DatabaseOptions.ConnectionOptions ??= DatabaseUtils.GetConnectionOptions(Sign, DatabaseOptions.ForTesting); + Options.ConnectionOptions ??= DatabaseUtils.GetConnectionOptions(Signature, Options.ForTesting); } /// - /// Validates if all the are assuring contains the correct methods needed. + /// Gets all database entity definitions. /// /// - /// Validated entity types to be handled. + /// Database entity definitions. /// - protected EntityBase[] GetSetsDefinitions() { - Type databaseType = GetType(); + protected EntityBase[] GetEntityDefinitions() { + Type dbType = GetType(); List entityModels = []; - IEnumerable dbSets = databaseType + IEnumerable dbSets = dbType .GetProperties() .Where( (propInfo) => { @@ -106,30 +151,33 @@ protected EntityBase[] GetSetsDefinitions() { } /// - /// Evaluates if are correctly configured and translated to the internal framework handler. + /// Validate that all database entities are correctly defined. /// - bool ValidateSetsDefinitions(bool strict = true) { + /// + /// Whether the engines should be stopped on invalid entities. + /// + bool ValidateEntityDefinitions(bool strict = true) { - bool logsOn = DatabaseOptions.EnableLogging; - EntityBase[] sets = GetSetsDefinitions(); + bool logsOn = Options.EnableLogging; + EntityBase[] defs = GetEntityDefinitions(); if (logsOn) { ConsoleUtils.Announce( $"[{GetType().Name}] Validatig Sets...", new() { - { "Count", sets.Length } + { "Count", defs.Length } } ); } Exception[] evResults = []; - foreach (EntityBase set in sets) { - Exception[] result = set.EvaluateDefinition(); + foreach (EntityBase entity in defs) { + Exception[] result = entity.EvaluateModel(); if (result.Length > 0 && logsOn) { ConsoleUtils.Warning( "Wrong [DbSet] definition", new() { - { "Set", set.GetType().Name }, + { "Set", entity.GetType().Name }, { "Exceptions", result }, } ); @@ -151,47 +199,6 @@ bool ValidateSetsDefinitions(bool strict = true) { return true; } - /// - public bool Validate(bool strict = true) { - bool logsOn = DatabaseOptions.EnableLogging; - - if (logsOn) { - ConsoleUtils.Announce( - $"Setting up ORM", - new() { - { "Database", GetType()?.Namespace ?? "---" }, - { "Base", nameof(DatabaseBase<>) } - } - ); - } - - if (Database.CanConnect()) { - if (logsOn) - ConsoleUtils.Success($"[{GetType().FullName}] ORM Set"); - - IEnumerable pendingMigrations = Database.GetPendingMigrations(); - if (pendingMigrations.Any()) { - - if (strict) - throw new Exception($"ORM ({GetType().FullName}) has pending migrations ({pendingMigrations.Count()})"); - - return false; - } - return ValidateSetsDefinitions(strict); - } - - try { - Database.OpenConnection(); - return true; - } catch (Exception ex) { - - if (strict) - throw new Exception($"Invalid connection with Database ({GetType().FullName}) | {ex.InnerException?.Message}"); - - return false; - } - } - /// /// Designs the current instance for the given , overriding /// the current behavior. @@ -214,7 +221,7 @@ protected virtual void DesignDatabase(ModelBuilder mBuilder) { } /// protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { - string connectionString = DatabaseOptions.ConnectionOptions!.ConnectionString; + string connectionString = Options.ConnectionOptions!.ConnectionString; optionsBuilder.UseSqlServer(connectionString); // We catch when the execution context is an Entity Framework design runtime. @@ -222,7 +229,7 @@ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { string envValue = SystemUtils.GetVar("ASPNETCORE_ENVIRONMENT") ?? SystemUtils.GetVar("DOTNET_ENVIRONMENT") ?? "---"; - if (DatabaseOptions.EnableLogging) { + if (Options.EnableLogging) { ConsoleUtils.Warning( $"Running EF Design Time Execution", new Dictionary { @@ -253,7 +260,7 @@ protected override void OnModelCreating(ModelBuilder mBuilder) { } } - EntityBase[] sets = GetSetsDefinitions(); + EntityBase[] sets = GetEntityDefinitions(); foreach (EntityBase entity in sets) { Type setType = entity.GetType(); diff --git a/csharp_database_extension/CSM Database Core/Abstractions/Bases/DatabaseDesignerBase.cs b/csharp_database_extension/CSharp Database Extension/Abstractions/Bases/DatabaseDesignerBase.cs similarity index 84% rename from csharp_database_extension/CSM Database Core/Abstractions/Bases/DatabaseDesignerBase.cs rename to csharp_database_extension/CSharp Database Extension/Abstractions/Bases/DatabaseDesignerBase.cs index 0321bef..f90cf8f 100644 --- a/csharp_database_extension/CSM Database Core/Abstractions/Bases/DatabaseDesignerBase.cs +++ b/csharp_database_extension/CSharp Database Extension/Abstractions/Bases/DatabaseDesignerBase.cs @@ -1,11 +1,11 @@ -using CSM_Database_Core.Abstractions.Interfaces; +using CSharp_Database_Extension.Abstractions.Interfaces; -using CSM_Foundation_Core.Core.Utils; +using CSharp_Extension.Common.Utils; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; -namespace CSM_Database_Core.Abstractions.Bases; +namespace CSharp_Database_Extension.Abstractions.Bases; /// /// Represents a design time factory. diff --git a/csharp_database_extension/CSM Database Core/Abstractions/Interfaces/IDatabase.cs b/csharp_database_extension/CSharp Database Extension/Abstractions/Interfaces/IDatabase.cs similarity index 57% rename from csharp_database_extension/CSM Database Core/Abstractions/Interfaces/IDatabase.cs rename to csharp_database_extension/CSharp Database Extension/Abstractions/Interfaces/IDatabase.cs index f8c2cbe..7070dd9 100644 --- a/csharp_database_extension/CSM Database Core/Abstractions/Interfaces/IDatabase.cs +++ b/csharp_database_extension/CSharp Database Extension/Abstractions/Interfaces/IDatabase.cs @@ -1,20 +1,20 @@ -namespace CSM_Database_Core.Abstractions.Interfaces; +namespace CSharp_Database_Extension.Abstractions.Interfaces; /// -/// Represents a Database context. +/// Represents a Database model. /// public interface IDatabase { /// - /// Database unique identification sign. + /// Database signature, used to be identified along ecosystems. /// - string Sign { get; } + string Signature { get; } /// /// Validates database connection and configuration health. /// /// - /// Whether the validation process is strict, throwing exceptions on failures. + /// Whether the validation process is strict, breaking execution on error. /// /// /// Whether the validation process was sucessful or not. diff --git a/csharp_database_extension/CSM Database Core/CHANGELOG.md b/csharp_database_extension/CSharp Database Extension/CHANGELOG.md similarity index 100% rename from csharp_database_extension/CSM Database Core/CHANGELOG.md rename to csharp_database_extension/CSharp Database Extension/CHANGELOG.md diff --git a/csharp_database_extension/CSM Database Core/CSharp Database Extension.csproj b/csharp_database_extension/CSharp Database Extension/CSharp Database Extension.csproj similarity index 75% rename from csharp_database_extension/CSM Database Core/CSharp Database Extension.csproj rename to csharp_database_extension/CSharp Database Extension/CSharp Database Extension.csproj index 703a830..5819a9b 100644 --- a/csharp_database_extension/CSM Database Core/CSharp Database Extension.csproj +++ b/csharp_database_extension/CSharp Database Extension/CSharp Database Extension.csproj @@ -1,10 +1,12 @@  + 1.0.0 + CSharp.Database.Extension + CSharp_Database_Extension + + net10.0 - CSM_Database_Core - CSM.Database.Core - 7.0.0 Renato Urrea Cosmos (CSM) https://github.com/Cosmos-CSM/csm_database @@ -21,9 +23,9 @@ - - - + + + diff --git a/csharp_database_extension/CSM Database Core/Core/Attributes/Abstractions/Bases/RelationAttributeBase.cs b/csharp_database_extension/CSharp Database Extension/Common/Attributes/Abstractions/Bases/RelationAttributeBase.cs similarity index 74% rename from csharp_database_extension/CSM Database Core/Core/Attributes/Abstractions/Bases/RelationAttributeBase.cs rename to csharp_database_extension/CSharp Database Extension/Common/Attributes/Abstractions/Bases/RelationAttributeBase.cs index 4416745..3f44490 100644 --- a/csharp_database_extension/CSM Database Core/Core/Attributes/Abstractions/Bases/RelationAttributeBase.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Attributes/Abstractions/Bases/RelationAttributeBase.cs @@ -1,6 +1,6 @@ -using CSM_Database_Core.Core.Attributes.Abstractions.Interfaces; +using CSharp_Database_Extension.Core.Attributes.Abstractions.Interfaces; -namespace CSM_Database_Core.Core.Attributes.Abstractions.Bases; +namespace CSharp_Database_Extension.Core.Attributes.Abstractions.Bases; /// public abstract class RelationAttributeBase diff --git a/csharp_database_extension/CSM Database Core/Core/Attributes/Abstractions/Interfaces/IRelationAttribute.cs b/csharp_database_extension/CSharp Database Extension/Common/Attributes/Abstractions/Interfaces/IRelationAttribute.cs similarity index 63% rename from csharp_database_extension/CSM Database Core/Core/Attributes/Abstractions/Interfaces/IRelationAttribute.cs rename to csharp_database_extension/CSharp Database Extension/Common/Attributes/Abstractions/Interfaces/IRelationAttribute.cs index 0eaffe1..eb897f4 100644 --- a/csharp_database_extension/CSM Database Core/Core/Attributes/Abstractions/Interfaces/IRelationAttribute.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Attributes/Abstractions/Interfaces/IRelationAttribute.cs @@ -1,7 +1,6 @@ - -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSM_Database_Core.Core.Attributes.Abstractions.Interfaces; +namespace CSharp_Database_Extension.Core.Attributes.Abstractions.Interfaces; /// diff --git a/csharp_database_extension/CSM Database Core/Core/Attributes/EntityRelationAttribute.cs b/csharp_database_extension/CSharp Database Extension/Common/Attributes/EntityRelationAttribute.cs similarity index 73% rename from csharp_database_extension/CSM Database Core/Core/Attributes/EntityRelationAttribute.cs rename to csharp_database_extension/CSharp Database Extension/Common/Attributes/EntityRelationAttribute.cs index 717bc23..67b9ab7 100644 --- a/csharp_database_extension/CSM Database Core/Core/Attributes/EntityRelationAttribute.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Attributes/EntityRelationAttribute.cs @@ -1,6 +1,6 @@ -using CSM_Database_Core.Core.Attributes.Abstractions.Bases; +using CSharp_Database_Extension.Core.Attributes.Abstractions.Bases; -namespace CSM_Database_Core.Core.Attributes; +namespace CSharp_Database_Extension.Core.Attributes; /// /// Attribute to mark a relation dependency. diff --git a/csharp_database_extension/CSharp Database Extension/Common/Enums/DatabaseProviders.cs b/csharp_database_extension/CSharp Database Extension/Common/Enums/DatabaseProviders.cs new file mode 100644 index 0000000..d210023 --- /dev/null +++ b/csharp_database_extension/CSharp Database Extension/Common/Enums/DatabaseProviders.cs @@ -0,0 +1,17 @@ +namespace CSharp_Database_Extension.Common.Enums; + +/// +/// Represents the supported database providers. +/// +public enum DatabaseProviders { + + /// + /// Represents a Microsoft SQL Server database provider. + /// + SQLServer, + + /// + /// Represents a PostgreSQL database provider. + /// + PostgreSQL, +} diff --git a/csharp_database_extension/CSM Database Core/Core/Errors/DatabaseError.cs b/csharp_database_extension/CSharp Database Extension/Common/Errors/DatabaseError.cs similarity index 91% rename from csharp_database_extension/CSM Database Core/Core/Errors/DatabaseError.cs rename to csharp_database_extension/CSharp Database Extension/Common/Errors/DatabaseError.cs index 2399e6c..7ce63fb 100644 --- a/csharp_database_extension/CSM Database Core/Core/Errors/DatabaseError.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Errors/DatabaseError.cs @@ -1,6 +1,6 @@ -using CSM_Foundation_Core.Errors.Abstractions.Bases; +using CSharp_Extension.Errors.Abstractions.Bases; -namespace CSM_Database_Core.Core.Errors; +namespace CSharp_Database_Extension.Core.Errors; /// /// Represents the exception events. diff --git a/csharp_database_extension/CSM Database Core/Core/Errors/DepotError.cs b/csharp_database_extension/CSharp Database Extension/Common/Errors/DepotError.cs similarity index 89% rename from csharp_database_extension/CSM Database Core/Core/Errors/DepotError.cs rename to csharp_database_extension/CSharp Database Extension/Common/Errors/DepotError.cs index 0bd48b7..b818123 100644 --- a/csharp_database_extension/CSM Database Core/Core/Errors/DepotError.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Errors/DepotError.cs @@ -1,12 +1,12 @@ -using CSM_Database_Core.Depots.Abstractions.Interfaces; -using CSM_Database_Core.Depots.Models; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Depots.Abstractions.Interfaces; +using CSharp_Database_Extension.Depots.Models; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -using CSM_Foundation_Core; -using CSM_Foundation_Core.Errors.Abstractions.Bases; -using CSM_Foundation_Core.Errors.Models; +using CSharp_Extension; +using CSharp_Extension.Errors.Abstractions.Bases; +using CSharp_Extension.Errors.Models; -namespace CSM_Database_Core.Core.Errors; +namespace CSharp_Database_Extension.Core.Errors; /// /// Represents the trigger events. diff --git a/csharp_database_extension/CSM Database Core/Core/Errors/EntityError.cs b/csharp_database_extension/CSharp Database Extension/Common/Errors/EntityError.cs similarity index 92% rename from csharp_database_extension/CSM Database Core/Core/Errors/EntityError.cs rename to csharp_database_extension/CSharp Database Extension/Common/Errors/EntityError.cs index d43eb62..746cbef 100644 --- a/csharp_database_extension/CSM Database Core/Core/Errors/EntityError.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Errors/EntityError.cs @@ -1,8 +1,8 @@ -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -using CSM_Foundation_Core.Errors.Abstractions.Bases; +using CSharp_Extension.Errors.Abstractions.Bases; -namespace CSM_Database_Core.Core.Errors; +namespace CSharp_Database_Extension.Core.Errors; /// /// Represents exception events. diff --git a/csharp_database_extension/CSM Database Core/Core/Errors/EntityValidationError.cs b/csharp_database_extension/CSharp Database Extension/Common/Errors/EntityValidationError.cs similarity index 90% rename from csharp_database_extension/CSM Database Core/Core/Errors/EntityValidationError.cs rename to csharp_database_extension/CSharp Database Extension/Common/Errors/EntityValidationError.cs index f860103..85523f0 100644 --- a/csharp_database_extension/CSM Database Core/Core/Errors/EntityValidationError.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Errors/EntityValidationError.cs @@ -1,8 +1,8 @@ -using CSM_Database_Core.Depots.Models; +using CSharp_Database_Extension.Depots.Models; -using CSM_Foundation_Core.Errors.Abstractions.Bases; +using CSharp_Extension.Errors.Abstractions.Bases; -namespace CSM_Database_Core.Core.Errors; +namespace CSharp_Database_Extension.Core.Errors; /// /// Represents events. diff --git a/csharp_database_extension/CSM Database Core/Core/Errors/ValidatorError.cs b/csharp_database_extension/CSharp Database Extension/Common/Errors/ValidatorError.cs similarity index 88% rename from csharp_database_extension/CSM Database Core/Core/Errors/ValidatorError.cs rename to csharp_database_extension/CSharp Database Extension/Common/Errors/ValidatorError.cs index 967e81c..7340c64 100644 --- a/csharp_database_extension/CSM Database Core/Core/Errors/ValidatorError.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Errors/ValidatorError.cs @@ -1,11 +1,11 @@ using System.Reflection; -using CSM_Database_Core.Entities.Abstractions.Interfaces; -using CSM_Database_Core.Validation.Abstractions.Bases; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Validation.Abstractions.Bases; -using CSM_Foundation_Core.Errors.Abstractions.Bases; +using CSharp_Extension.Errors.Abstractions.Bases; -namespace CSM_Database_Core.Core.Errors; +namespace CSharp_Database_Extension.Core.Errors; /// /// Represents events. diff --git a/csharp_database_extension/CSM Database Core/Core/Extensions/EntityTypeBuilderExtension.cs b/csharp_database_extension/CSharp Database Extension/Common/Extensions/EntityTypeBuilderExtension.cs similarity index 98% rename from csharp_database_extension/CSM Database Core/Core/Extensions/EntityTypeBuilderExtension.cs rename to csharp_database_extension/CSharp Database Extension/Common/Extensions/EntityTypeBuilderExtension.cs index c005dd5..4e801b8 100644 --- a/csharp_database_extension/CSM Database Core/Core/Extensions/EntityTypeBuilderExtension.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Extensions/EntityTypeBuilderExtension.cs @@ -1,11 +1,11 @@ using System.Reflection; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; -namespace CSM_Database_Core.Core.Extensions; +namespace CSharp_Database_Extension.Core.Extensions; /// /// Provide extension methods for class type. diff --git a/csharp_database_extension/CSM Database Core/Core/Extensions/IQueryableExtension.cs b/csharp_database_extension/CSharp Database Extension/Common/Extensions/IQueryableExtension.cs similarity index 96% rename from csharp_database_extension/CSM Database Core/Core/Extensions/IQueryableExtension.cs rename to csharp_database_extension/CSharp Database Extension/Common/Extensions/IQueryableExtension.cs index e42c139..dba1b68 100644 --- a/csharp_database_extension/CSM Database Core/Core/Extensions/IQueryableExtension.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Extensions/IQueryableExtension.cs @@ -2,13 +2,13 @@ using System.Reflection; -using CSM_Database_Core.Depots.Abstractions.Interfaces; -using CSM_Database_Core.Depots.Models; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Depots.Abstractions.Interfaces; +using CSharp_Database_Extension.Depots.Models; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; using Microsoft.EntityFrameworkCore; -namespace CSM_Database_Core.Core.Extensions; +namespace CSharp_Database_Extension.Core.Extensions; /// /// Extension class for objects. diff --git a/csharp_database_extension/CSM Database Core/Core/Extensions/TypeExtension.cs b/csharp_database_extension/CSharp Database Extension/Common/Extensions/TypeExtension.cs similarity index 97% rename from csharp_database_extension/CSM Database Core/Core/Extensions/TypeExtension.cs rename to csharp_database_extension/CSharp Database Extension/Common/Extensions/TypeExtension.cs index 4f6c009..2fddce4 100644 --- a/csharp_database_extension/CSM Database Core/Core/Extensions/TypeExtension.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Extensions/TypeExtension.cs @@ -1,7 +1,7 @@ using System.Collections; using System.Reflection; -namespace CSM_Database_Core.Core.Extensions; +namespace CSharp_Database_Extension.Core.Extensions; /// /// Provides extension methods for the class. diff --git a/csharp_database_extension/CSM Database Core/Core/Models/ConnectionOptions.cs b/csharp_database_extension/CSharp Database Extension/Common/Models/ConnectionOptions.cs similarity index 97% rename from csharp_database_extension/CSM Database Core/Core/Models/ConnectionOptions.cs rename to csharp_database_extension/CSharp Database Extension/Common/Models/ConnectionOptions.cs index 42f1bcb..6255c5c 100644 --- a/csharp_database_extension/CSM Database Core/Core/Models/ConnectionOptions.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Models/ConnectionOptions.cs @@ -1,4 +1,4 @@ -namespace CSM_Database_Core.Core.Models; +namespace CSharp_Database_Extension.Core.Models; /// /// Represents a database server connection options. diff --git a/csharp_database_extension/CSM Database Core/Core/Models/DatabaseOptions.cs b/csharp_database_extension/CSharp Database Extension/Common/Models/DatabaseOptions.cs similarity index 68% rename from csharp_database_extension/CSM Database Core/Core/Models/DatabaseOptions.cs rename to csharp_database_extension/CSharp Database Extension/Common/Models/DatabaseOptions.cs index 92f047b..a1cdcfb 100644 --- a/csharp_database_extension/CSM Database Core/Core/Models/DatabaseOptions.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Models/DatabaseOptions.cs @@ -1,6 +1,9 @@ -using Microsoft.EntityFrameworkCore; +using CSharp_Database_Extension.Common.Enums; +using CSharp_Database_Extension.Core.Models; -namespace CSM_Database_Core.Core.Models; +using Microsoft.EntityFrameworkCore; + +namespace CSharp_Database_Extension.Common.Models; /// /// Represents a building options. @@ -8,6 +11,16 @@ namespace CSM_Database_Core.Core.Models; public partial record DatabaseOptions where TDatabase : DbContext { + /// + /// Database signature. + /// + public string? Signature { get; set; } + + /// + /// Database provider. + /// + public DatabaseProviders Provider { get; set; } = DatabaseProviders.PostgreSQL; + /// /// Whether the logging service is enabled. /// @@ -18,11 +31,6 @@ public partial record DatabaseOptions /// public bool ForTesting { get; init; } = false; - /// - /// Database context signature. - /// - public string? Sign { get; set; } - /// /// Database connection options. /// diff --git a/csharp_database_extension/CSM Database Core/Core/Utils/DatabaseUtils.cs b/csharp_database_extension/CSharp Database Extension/Common/Utils/DatabaseUtils.cs similarity index 98% rename from csharp_database_extension/CSM Database Core/Core/Utils/DatabaseUtils.cs rename to csharp_database_extension/CSharp Database Extension/Common/Utils/DatabaseUtils.cs index b2e3f9b..495a3c7 100644 --- a/csharp_database_extension/CSM Database Core/Core/Utils/DatabaseUtils.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Utils/DatabaseUtils.cs @@ -1,18 +1,18 @@ using System.Reflection; using System.Text.Json; -using CSM_Database_Core.Core.Attributes; -using CSM_Database_Core.Core.Models; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Core.Attributes; +using CSharp_Database_Extension.Core.Models; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -using CSM_Foundation_Core; -using CSM_Foundation_Core.Core.Errors; -using CSM_Foundation_Core.Core.Utils; +using CSharp_Extension; +using CSharp_Extension.Common.Utils; +using CSharp_Extension.Errors; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; -namespace CSM_Database_Core.Core.Utils; +namespace CSharp_Database_Extension.Core.Utils; /// /// Provide utilities methods for database purposes. @@ -114,7 +114,7 @@ public static ConnectionOptions GetConnectionOptions(string sign, bool forTestin string? appDirConnFile = appDirFiles .FirstOrDefault(file => file.Contains(fileName)); - if(appDirConnFile is null) { + if (appDirConnFile is null) { ConsoleUtils.Error( "Database connection options not found in app assemblies", details: new Dictionary { diff --git a/csharp_database_extension/CSM Database Core/Core/Utils/EntityUtils.cs b/csharp_database_extension/CSharp Database Extension/Common/Utils/EntityUtils.cs similarity index 92% rename from csharp_database_extension/CSM Database Core/Core/Utils/EntityUtils.cs rename to csharp_database_extension/CSharp Database Extension/Common/Utils/EntityUtils.cs index 96df204..0574785 100644 --- a/csharp_database_extension/CSM Database Core/Core/Utils/EntityUtils.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Utils/EntityUtils.cs @@ -1,10 +1,10 @@ using System.Collections; using System.Reflection; -using CSM_Database_Core.Core.Attributes.Abstractions.Interfaces; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Core.Attributes.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSM_Database_Core.Core.Utils; +namespace CSharp_Database_Extension.Core.Utils; /// /// Provide utility methods for objects. diff --git a/csharp_database_extension/CSM Database Core/Depots/Abstractions/Bases/DepotBase.cs b/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Bases/DepotBase.cs similarity index 94% rename from csharp_database_extension/CSM Database Core/Depots/Abstractions/Bases/DepotBase.cs rename to csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Bases/DepotBase.cs index 86f4f49..b751358 100644 --- a/csharp_database_extension/CSM Database Core/Depots/Abstractions/Bases/DepotBase.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Bases/DepotBase.cs @@ -2,23 +2,23 @@ using System.Data; using System.Reflection; -using CSM_Database_Core.Core.Attributes.Abstractions.Interfaces; -using CSM_Database_Core.Core.Errors; -using CSM_Database_Core.Core.Extensions; -using CSM_Database_Core.Core.Utils; -using CSM_Database_Core.Depots.Abstractions.Interfaces; -using CSM_Database_Core.Depots.Models; -using CSM_Database_Core.Depots.Models.Structs; -using CSM_Database_Core.Entities.Abstractions.Interfaces; - -using CSM_Foundation_Core.Abstractions.Interfaces; -using CSM_Foundation_Core.Core.Errors; +using CSharp_Database_Extension.Core.Attributes.Abstractions.Interfaces; +using CSharp_Database_Extension.Core.Errors; +using CSharp_Database_Extension.Core.Extensions; +using CSharp_Database_Extension.Core.Utils; +using CSharp_Database_Extension.Depots.Abstractions.Interfaces; +using CSharp_Database_Extension.Depots.Models; +using CSharp_Database_Extension.Depots.Models.Structs; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; + +using CSharp_Extension.Common.Abstractions.Interfaces; +using CSharp_Extension.Errors; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.IdentityModel.Tokens; -namespace CSM_Database_Core.Depots.Abstractions.Bases; +namespace CSharp_Database_Extension.Depots.Abstractions.Bases; /// /// @@ -319,12 +319,12 @@ public async Task> Update(QueryInput srcRelUpdates = relationUpdates.Value; PropertyInfo srcRelProp = trackedEntityBase.GetProperty(srcRelName); - + // Validating source entity relation property is a valid collection. - if(!srcRelProp.PropertyType.IsAssignableTo(typeof(IEnumerable))) + if (!srcRelProp.PropertyType.IsAssignableTo(typeof(IEnumerable))) throw new EntityError( - EntityErrorEvents.RELATION_NOT_COLLECTION, - updateEntity, + EntityErrorEvents.RELATION_NOT_COLLECTION, + updateEntity, new InvalidCastException($"Cannot cast relation ({srcRelName}) into [IEnumerable] object") ); @@ -348,7 +348,7 @@ public async Task> Update(QueryInput 1 && srcRelUpdates.Any( sourceRelUpdate => string.IsNullOrWhiteSpace(sourceRelUpdate.Key) @@ -364,15 +364,15 @@ public async Task> Update(QueryInput targetUpdate in srcRelUpdates) { string tarRelName = targetUpdate.Key; RelationUpdate[] tarRelUpdates = targetUpdate.Value; - + PropertyInfo? tarEntityRelRef; - if( + if ( string.IsNullOrWhiteSpace(tarRelName) ) { tarEntityRelRef = tarRelSrcProps[0]; - if(tarRelSrcProps.Length != 1) + if (tarRelSrcProps.Length != 1) throw new DepotError( - DepotErrorEvents.RELATIONS_UPDATE_MISMATCH_TARGET_REFS, + DepotErrorEvents.RELATIONS_UPDATE_MISMATCH_TARGET_REFS, exception: new InvalidOperationException($"Relations update were expecting 1 reference but got ({tarRelSrcProps}) at target entity type") ); } else { @@ -381,7 +381,7 @@ public async Task> Update(QueryInput( DepotErrorEvents.RELATIONS_UPDATE_MISMATCH_TARGET_REFS, exception: new InvalidOperationException($"Relations update were expecting a reference ({tarRelName}) but got ({tarRelSrcProps}) references at target entity type") @@ -397,29 +397,29 @@ public async Task> Update(QueryInput relationAddAction = (obj ) => { }; + Action relationAddAction = (obj) => { }; Action relationRemoveAction = (obj) => { }; - if(tarEntityRelRefType.IsAssignableTo(typeof(IEntity))) { + if (tarEntityRelRefType.IsAssignableTo(typeof(IEntity))) { relationAddAction = (obj) => { _db.Attach(obj); tarEntityRelRef.SetValue(obj, trackedEntity); }; relationRemoveAction = (obj) => { - object? currValue = tarEntityRelRef.GetValue(obj); - if(currValue is null) + object? currValue = tarEntityRelRef.GetValue(obj); + if (currValue is null) return; IEntity currValueEntity = (IEntity)currValue; - if(currValueEntity.Id != trackedEntity.Id) + if (currValueEntity.Id != trackedEntity.Id) return; tarEntityRelRef.SetValue(obj, null); }; - } - - if(tarEntityRelRefType.IsAssignableTo(typeof(IEnumerable))) { + } + + if (tarEntityRelRefType.IsAssignableTo(typeof(IEnumerable))) { relationAddAction = (obj) => { object? collectionItem = srcRelCastColl.FirstOrDefault( relationItem => relationItem.Id == obj.Id @@ -430,7 +430,7 @@ public async Task> Update(QueryInput> Update(QueryInput> Update(QueryInput /// [Delegate] declaration to expose an easier API to generate the accumulative instructions for the query after filtering. diff --git a/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotCreate.cs b/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IDepotCreate.cs similarity index 85% rename from csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotCreate.cs rename to csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IDepotCreate.cs index d13c624..95f754d 100644 --- a/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotCreate.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IDepotCreate.cs @@ -1,7 +1,7 @@ -using CSM_Database_Core.Depots.Models; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Depots.Models; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSM_Database_Core.Depots.Abstractions.Interfaces; +namespace CSharp_Database_Extension.Depots.Abstractions.Interfaces; /// /// Represents create logic for a . diff --git a/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotDelete.cs b/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IDepotDelete.cs similarity index 92% rename from csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotDelete.cs rename to csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IDepotDelete.cs index 2b3349b..127685f 100644 --- a/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotDelete.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IDepotDelete.cs @@ -1,7 +1,7 @@ -using CSM_Database_Core.Depots.Models; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Depots.Models; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSM_Database_Core.Depots.Abstractions.Interfaces; +namespace CSharp_Database_Extension.Depots.Abstractions.Interfaces; /// /// Represents deleting logic for a . diff --git a/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotRead.cs b/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IDepotRead.cs similarity index 88% rename from csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotRead.cs rename to csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IDepotRead.cs index 5c77158..11344e9 100644 --- a/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotRead.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IDepotRead.cs @@ -1,7 +1,7 @@ -using CSM_Database_Core.Depots.Models; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Depots.Models; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSM_Database_Core.Depots.Abstractions.Interfaces; +namespace CSharp_Database_Extension.Depots.Abstractions.Interfaces; /// /// Represents reading logic for a . diff --git a/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotUpdate.cs b/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IDepotUpdate.cs similarity index 77% rename from csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotUpdate.cs rename to csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IDepotUpdate.cs index 335af7f..a645702 100644 --- a/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotUpdate.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IDepotUpdate.cs @@ -1,7 +1,7 @@ -using CSM_Database_Core.Depots.Models; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Depots.Models; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSM_Database_Core.Depots.Abstractions.Interfaces; +namespace CSharp_Database_Extension.Depots.Abstractions.Interfaces; /// /// Represents updating logic for a . diff --git a/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotView.cs b/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IDepotView.cs similarity index 78% rename from csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotView.cs rename to csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IDepotView.cs index 2434b4c..558d616 100644 --- a/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IDepotView.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IDepotView.cs @@ -1,7 +1,7 @@ -using CSM_Database_Core.Depots.Models; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Depots.Models; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSM_Database_Core.Depots.Abstractions.Interfaces; +namespace CSharp_Database_Extension.Depots.Abstractions.Interfaces; /// /// Represents a [View] operations logic for a diff --git a/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IUpdateEntityInput.cs b/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IUpdateEntityInput.cs similarity index 85% rename from csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IUpdateEntityInput.cs rename to csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IUpdateEntityInput.cs index 56f16f1..5f71ff5 100644 --- a/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IUpdateEntityInput.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IUpdateEntityInput.cs @@ -1,6 +1,6 @@ -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSM_Database_Core.Depots.Abstractions.Interfaces; +namespace CSharp_Database_Extension.Depots.Abstractions.Interfaces; /// /// Represents an Entity shpaed update instructions input. diff --git a/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IViewFilter.cs b/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IViewFilter.cs similarity index 92% rename from csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IViewFilter.cs rename to csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IViewFilter.cs index 4db163e..12c87b4 100644 --- a/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IViewFilter.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IViewFilter.cs @@ -1,11 +1,10 @@ -using CSM_Database_Core.Depots.ViewFilters; -using CSM_Database_Core.Entities.Abstractions.Bases; -using CSM_Database_Core.Entities.Abstractions.Interfaces; - -using System.Text.Json; +using System.Text.Json; using System.Text.Json.Serialization; -namespace CSM_Database_Core.Depots.Abstractions.Interfaces; +using CSharp_Database_Extension.Depots.ViewFilters; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; + +namespace CSharp_Database_Extension.Depots.Abstractions.Interfaces; /// /// for . @@ -79,7 +78,7 @@ public override bool CanConvert(Type typeToConvert) { /// /// /// -public class ISetViewFilterConverter +public class ISetViewFilterConverter : JsonConverter> where TSet : IEntity { /// diff --git a/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IViewFilterNode.cs b/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IViewFilterNode.cs similarity index 89% rename from csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IViewFilterNode.cs rename to csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IViewFilterNode.cs index 3ff8876..3de8be5 100644 --- a/csharp_database_extension/CSM Database Core/Depots/Abstractions/Interfaces/IViewFilterNode.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Interfaces/IViewFilterNode.cs @@ -2,13 +2,13 @@ using System.Text.Json; using System.Text.Json.Serialization; -using CSM_Database_Core.Depots.ViewFilters; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Depots.ViewFilters; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -using CSM_Foundation_Core.Convertion.Abstractions.Bases; -using CSM_Foundation_Core.Convertion.Abstractions.Interfaces; +using CSharp_Extension.Convertion.Abstractions.Bases; +using CSharp_Extension.Convertion.Abstractions.Interfaces; -namespace CSM_Database_Core.Depots.Abstractions.Interfaces; +namespace CSharp_Database_Extension.Depots.Abstractions.Interfaces; /// /// Represents a View system filter node, building and evaluating by itself (implementations) the way the View operation will be filtered. diff --git a/csharp_database_extension/CSM Database Core/Depots/Models/BatchOperationOutput.cs b/csharp_database_extension/CSharp Database Extension/Depots/Models/BatchOperationOutput.cs similarity index 92% rename from csharp_database_extension/CSM Database Core/Depots/Models/BatchOperationOutput.cs rename to csharp_database_extension/CSharp Database Extension/Depots/Models/BatchOperationOutput.cs index db05ad5..90a3f69 100644 --- a/csharp_database_extension/CSM Database Core/Depots/Models/BatchOperationOutput.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Models/BatchOperationOutput.cs @@ -1,7 +1,7 @@ -using CSM_Database_Core.Core.Errors; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Core.Errors; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSM_Database_Core.Depots.Models; +namespace CSharp_Database_Extension.Depots.Models; /// /// [Record] that stores the information about a batch operation output result. diff --git a/csharp_database_extension/CSM Database Core/Depots/Models/FilterQueryInput.cs b/csharp_database_extension/CSharp Database Extension/Depots/Models/FilterQueryInput.cs similarity index 89% rename from csharp_database_extension/CSM Database Core/Depots/Models/FilterQueryInput.cs rename to csharp_database_extension/CSharp Database Extension/Depots/Models/FilterQueryInput.cs index db62110..5cbc3ba 100644 --- a/csharp_database_extension/CSM Database Core/Depots/Models/FilterQueryInput.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Models/FilterQueryInput.cs @@ -1,8 +1,8 @@ using System.Linq.Expressions; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSM_Database_Core.Depots.Models; +namespace CSharp_Database_Extension.Depots.Models; /// diff --git a/csharp_database_extension/CSM Database Core/Depots/Models/PaginationOutput.cs b/csharp_database_extension/CSharp Database Extension/Depots/Models/PaginationOutput.cs similarity index 89% rename from csharp_database_extension/CSM Database Core/Depots/Models/PaginationOutput.cs rename to csharp_database_extension/CSharp Database Extension/Depots/Models/PaginationOutput.cs index 4dbb348..abb7f73 100644 --- a/csharp_database_extension/CSM Database Core/Depots/Models/PaginationOutput.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Models/PaginationOutput.cs @@ -1,6 +1,6 @@ -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSM_Database_Core.Depots.Models; +namespace CSharp_Database_Extension.Depots.Models; /// /// [Output] object for a pagination proccess result information. diff --git a/csharp_database_extension/CSM Database Core/Depots/Models/PropertyValidationResult.cs b/csharp_database_extension/CSharp Database Extension/Depots/Models/PropertyValidationResult.cs similarity index 81% rename from csharp_database_extension/CSM Database Core/Depots/Models/PropertyValidationResult.cs rename to csharp_database_extension/CSharp Database Extension/Depots/Models/PropertyValidationResult.cs index 24c7e99..aa52010 100644 --- a/csharp_database_extension/CSM Database Core/Depots/Models/PropertyValidationResult.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Models/PropertyValidationResult.cs @@ -1,8 +1,8 @@ using System.Reflection; -using CSM_Database_Core.Core.Errors; +using CSharp_Database_Extension.Core.Errors; -namespace CSM_Database_Core.Depots.Models; +namespace CSharp_Database_Extension.Depots.Models; /// /// Represents an Entity property validation result. diff --git a/csharp_database_extension/CSM Database Core/Depots/Models/QueryInput.cs b/csharp_database_extension/CSharp Database Extension/Depots/Models/QueryInput.cs similarity index 80% rename from csharp_database_extension/CSM Database Core/Depots/Models/QueryInput.cs rename to csharp_database_extension/CSharp Database Extension/Depots/Models/QueryInput.cs index bb88eef..417dc29 100644 --- a/csharp_database_extension/CSM Database Core/Depots/Models/QueryInput.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Models/QueryInput.cs @@ -1,7 +1,7 @@ -using CSM_Database_Core.Depots.Abstractions.Interfaces; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Depots.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSM_Database_Core.Depots.Models; +namespace CSharp_Database_Extension.Depots.Models; /// /// [Record] for specific operations, diff --git a/csharp_database_extension/CSM Database Core/Depots/Models/Structs/RelationUpdate.cs b/csharp_database_extension/CSharp Database Extension/Depots/Models/Structs/RelationUpdate.cs similarity index 85% rename from csharp_database_extension/CSM Database Core/Depots/Models/Structs/RelationUpdate.cs rename to csharp_database_extension/CSharp Database Extension/Depots/Models/Structs/RelationUpdate.cs index 2b769b4..4883f66 100644 --- a/csharp_database_extension/CSM Database Core/Depots/Models/Structs/RelationUpdate.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Models/Structs/RelationUpdate.cs @@ -1,6 +1,6 @@ -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSM_Database_Core.Depots.Models.Structs; +namespace CSharp_Database_Extension.Depots.Models.Structs; /// /// Represents available actions to perform for a . diff --git a/csharp_database_extension/CSM Database Core/Depots/Models/UpdateInput.cs b/csharp_database_extension/CSharp Database Extension/Depots/Models/UpdateInput.cs similarity index 89% rename from csharp_database_extension/CSM Database Core/Depots/Models/UpdateInput.cs rename to csharp_database_extension/CSharp Database Extension/Depots/Models/UpdateInput.cs index e5966f4..ca09762 100644 --- a/csharp_database_extension/CSM Database Core/Depots/Models/UpdateInput.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Models/UpdateInput.cs @@ -1,7 +1,7 @@ -using CSM_Database_Core.Depots.Models.Structs; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Depots.Models.Structs; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSM_Database_Core.Depots.Models; +namespace CSharp_Database_Extension.Depots.Models; /// /// [Record] for single update operation. diff --git a/csharp_database_extension/CSM Database Core/Depots/Models/UpdateOutput.cs b/csharp_database_extension/CSharp Database Extension/Depots/Models/UpdateOutput.cs similarity index 80% rename from csharp_database_extension/CSM Database Core/Depots/Models/UpdateOutput.cs rename to csharp_database_extension/CSharp Database Extension/Depots/Models/UpdateOutput.cs index b1b8b35..56d018c 100644 --- a/csharp_database_extension/CSM Database Core/Depots/Models/UpdateOutput.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Models/UpdateOutput.cs @@ -1,7 +1,6 @@ -using CSM_Database_Core.Entities.Abstractions.Bases; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSM_Database_Core.Depots.Models; +namespace CSharp_Database_Extension.Depots.Models; /// /// [Record] for the output of an entity [Update] operation. diff --git a/csharp_database_extension/CSM Database Core/Depots/Models/ViewInput.cs b/csharp_database_extension/CSharp Database Extension/Depots/Models/ViewInput.cs similarity index 88% rename from csharp_database_extension/CSM Database Core/Depots/Models/ViewInput.cs rename to csharp_database_extension/CSharp Database Extension/Depots/Models/ViewInput.cs index 221b03a..45cc1ca 100644 --- a/csharp_database_extension/CSM Database Core/Depots/Models/ViewInput.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Models/ViewInput.cs @@ -1,8 +1,7 @@ -using CSM_Database_Core.Depots.Abstractions.Interfaces; -using CSM_Database_Core.Entities.Abstractions.Bases; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Depots.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSM_Database_Core.Depots.Models; +namespace CSharp_Database_Extension.Depots.Models; /// /// Defines options to build a [View] diff --git a/csharp_database_extension/CSM Database Core/Depots/Models/ViewOrdering.cs b/csharp_database_extension/CSharp Database Extension/Depots/Models/ViewOrdering.cs similarity index 93% rename from csharp_database_extension/CSM Database Core/Depots/Models/ViewOrdering.cs rename to csharp_database_extension/CSharp Database Extension/Depots/Models/ViewOrdering.cs index 256dfb1..0c4a5ed 100644 --- a/csharp_database_extension/CSM Database Core/Depots/Models/ViewOrdering.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Models/ViewOrdering.cs @@ -1,4 +1,4 @@ -namespace CSM_Database_Core.Depots.Models; +namespace CSharp_Database_Extension.Depots.Models; /// /// Stores a ordering step options for the /// builder, indicating how the current ordering step should behave. diff --git a/csharp_database_extension/CSM Database Core/Depots/Models/ViewOutput.cs b/csharp_database_extension/CSharp Database Extension/Depots/Models/ViewOutput.cs similarity index 83% rename from csharp_database_extension/CSM Database Core/Depots/Models/ViewOutput.cs rename to csharp_database_extension/CSharp Database Extension/Depots/Models/ViewOutput.cs index f721f26..8c6a93d 100644 --- a/csharp_database_extension/CSM Database Core/Depots/Models/ViewOutput.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Models/ViewOutput.cs @@ -1,8 +1,7 @@ -using CSM_Database_Core.Depots.Abstractions.Interfaces; -using CSM_Database_Core.Entities.Abstractions.Bases; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Depots.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSM_Database_Core.Depots.Models; +namespace CSharp_Database_Extension.Depots.Models; /// /// {model} class for . @@ -17,18 +16,17 @@ namespace CSM_Database_Core.Depots.Models; /// public class ViewOutput where TEntity : IEntity { - - TEntity[] _Records = []; /// /// The collection of items gathered. /// public required TEntity[] Entities { - get => _Records; + get; init { - _Records = value; + field = value; Length = value.Length; } - } + } = []; + /// /// The available pages. /// diff --git a/csharp_database_extension/CSM Database Core/Depots/ViewFilters/ViewFilterDate.cs b/csharp_database_extension/CSharp Database Extension/Depots/ViewFilters/ViewFilterDate.cs similarity index 91% rename from csharp_database_extension/CSM Database Core/Depots/ViewFilters/ViewFilterDate.cs rename to csharp_database_extension/CSharp Database Extension/Depots/ViewFilters/ViewFilterDate.cs index f922ed2..20ece75 100644 --- a/csharp_database_extension/CSM Database Core/Depots/ViewFilters/ViewFilterDate.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/ViewFilters/ViewFilterDate.cs @@ -1,9 +1,9 @@ using System.Linq.Expressions; -using CSM_Database_Core.Depots.Abstractions.Interfaces; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Depots.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSM_Database_Core.Depots.ViewFilters; +namespace CSharp_Database_Extension.Depots.ViewFilters; /// /// {implementation} for . diff --git a/csharp_database_extension/CSM Database Core/Depots/ViewFilters/ViewFilterLogical.cs b/csharp_database_extension/CSharp Database Extension/Depots/ViewFilters/ViewFilterLogical.cs similarity index 93% rename from csharp_database_extension/CSM Database Core/Depots/ViewFilters/ViewFilterLogical.cs rename to csharp_database_extension/CSharp Database Extension/Depots/ViewFilters/ViewFilterLogical.cs index 848a2c8..5fe5787 100644 --- a/csharp_database_extension/CSM Database Core/Depots/ViewFilters/ViewFilterLogical.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/ViewFilters/ViewFilterLogical.cs @@ -1,9 +1,9 @@ using System.Linq.Expressions; -using CSM_Database_Core.Depots.Abstractions.Interfaces; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Depots.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSM_Database_Core.Depots.ViewFilters; +namespace CSharp_Database_Extension.Depots.ViewFilters; /// /// {implementation} for . diff --git a/csharp_database_extension/CSM Database Core/Depots/ViewFilters/ViewFilterProperty.cs b/csharp_database_extension/CSharp Database Extension/Depots/ViewFilters/ViewFilterProperty.cs similarity index 95% rename from csharp_database_extension/CSM Database Core/Depots/ViewFilters/ViewFilterProperty.cs rename to csharp_database_extension/CSharp Database Extension/Depots/ViewFilters/ViewFilterProperty.cs index 6f6b87f..ea35b74 100644 --- a/csharp_database_extension/CSM Database Core/Depots/ViewFilters/ViewFilterProperty.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/ViewFilters/ViewFilterProperty.cs @@ -2,10 +2,10 @@ using System.Reflection; using System.Text.Json; -using CSM_Database_Core.Depots.Abstractions.Interfaces; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Depots.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSM_Database_Core.Depots.ViewFilters; +namespace CSharp_Database_Extension.Depots.ViewFilters; /// /// Stores the available options for [View] [Filter] behavior. diff --git a/csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/ActivableEntityBase.cs b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/ActivableEntityBase.cs similarity index 66% rename from csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/ActivableEntityBase.cs rename to csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/ActivableEntityBase.cs index d40b2dd..152cde7 100644 --- a/csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/ActivableEntityBase.cs +++ b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/ActivableEntityBase.cs @@ -1,6 +1,6 @@ -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSM_Database_Core.Entities.Abstractions.Bases; +namespace CSharp_Database_Extension.Entities.Abstractions.Bases; /// /// Represents an with enablement control. diff --git a/csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/EntityBase.cs b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/EntityBase.cs similarity index 85% rename from csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/EntityBase.cs rename to csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/EntityBase.cs index b0b970c..81a1739 100644 --- a/csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/EntityBase.cs +++ b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/EntityBase.cs @@ -2,12 +2,12 @@ using System.Reflection; using System.Text.Json.Serialization; -using CSM_Database_Core.Entities.Abstractions.Interfaces; -using CSM_Database_Core.Validation.Abstractions.Bases; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Validation.Abstractions.Bases; -using CSM_Foundation_Core.Abstractions.Bases; +using CSharp_Extension.Common.Abstractions.Bases; -namespace CSM_Database_Core; +namespace CSharp_Database_Extension; /// /// Represents a business entity. @@ -71,7 +71,7 @@ public void EvaluateWrite() { } /// - public Exception[] EvaluateDefinition() { + public Exception[] EvaluateModel() { return []; } } \ No newline at end of file diff --git a/csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/NamedEntityBase.cs b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/NamedEntityBase.cs similarity index 78% rename from csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/NamedEntityBase.cs rename to csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/NamedEntityBase.cs index 953d34a..c52ce06 100644 --- a/csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/NamedEntityBase.cs +++ b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/NamedEntityBase.cs @@ -1,6 +1,6 @@ -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSM_Database_Core.Entities.Abstractions.Bases; +namespace CSharp_Database_Extension.Entities.Abstractions.Bases; /// /// Represents an with and properties diff --git a/csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/PartnerBridgeEntityBase.cs b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/PartnerBridgeEntityBase.cs similarity index 93% rename from csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/PartnerBridgeEntityBase.cs rename to csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/PartnerBridgeEntityBase.cs index 1a817c6..70fd383 100644 --- a/csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/PartnerBridgeEntityBase.cs +++ b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/PartnerBridgeEntityBase.cs @@ -1,8 +1,8 @@ -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; using Microsoft.EntityFrameworkCore.Metadata.Builders; -namespace CSM_Database_Core.Entities.Abstractions.Bases; +namespace CSharp_Database_Extension.Entities.Abstractions.Bases; /// /// Represents an that holds a scope between internal ( tenant business entities data ) and external ( tenant partners entities data ). diff --git a/csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/PartnerScopeEntityBase.cs b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/PartnerScopeEntityBase.cs similarity index 89% rename from csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/PartnerScopeEntityBase.cs rename to csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/PartnerScopeEntityBase.cs index 7c5b593..b0348bd 100644 --- a/csharp_database_extension/CSM Database Core/Entities/Abstractions/Bases/PartnerScopeEntityBase.cs +++ b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/PartnerScopeEntityBase.cs @@ -1,11 +1,11 @@ using System.Reflection; -using CSM_Database_Core.Core.Extensions; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Core.Extensions; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; using Microsoft.EntityFrameworkCore.Metadata.Builders; -namespace CSM_Database_Core.Entities.Abstractions.Bases; +namespace CSharp_Database_Extension.Entities.Abstractions.Bases; /// /// Represents an scope for a . diff --git a/csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/IActivableEntity.cs b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IActivableEntity.cs similarity index 77% rename from csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/IActivableEntity.cs rename to csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IActivableEntity.cs index cf9876c..7b56a3e 100644 --- a/csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/IActivableEntity.cs +++ b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IActivableEntity.cs @@ -1,4 +1,4 @@ -namespace CSM_Database_Core.Entities.Abstractions.Interfaces; +namespace CSharp_Database_Extension.Entities.Abstractions.Interfaces; /// /// Represents an with enablement control. /// diff --git a/csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/IEntity.cs b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IEntity.cs similarity index 85% rename from csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/IEntity.cs rename to csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IEntity.cs index 9427224..0eb1130 100644 --- a/csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/IEntity.cs +++ b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IEntity.cs @@ -3,9 +3,9 @@ using System.ComponentModel.DataAnnotations.Schema; using System.Text.Json.Serialization; -using CSM_Foundation_Core.Convertion.Abstractions.Interfaces; +using CSharp_Extension.Convertion.Abstractions.Interfaces; -namespace CSM_Database_Core.Entities.Abstractions.Interfaces; +namespace CSharp_Database_Extension.Entities.Abstractions.Interfaces; /// /// Represents a tenant business live stored entity model, that usually are objects wich data are grouped by bound that @@ -15,7 +15,7 @@ public interface IEntity : IConverterVariant { /// - /// Type of the implementation that stores this implementation. + /// Type of the implementation that stores this implementation. /// [JsonIgnore, NotMapped] Type Database { get; init; } @@ -56,7 +56,7 @@ public interface IEntity void EvaluateWrite(); /// - /// This method is used to evaluate the implementation definition, this means will evaluate + /// This method is used to evaluate the model definition, this means will evaluate /// if the and operations work as expected /// before the system start its engine, this function might break the system rawSet up and stop advising /// about the found exceptions. @@ -64,5 +64,5 @@ public interface IEntity /// /// Collection of exceptions found at definition evaluation. /// - Exception[] EvaluateDefinition(); + Exception[] EvaluateModel(); } \ No newline at end of file diff --git a/csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/INamedEntity.cs b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/INamedEntity.cs similarity index 90% rename from csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/INamedEntity.cs rename to csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/INamedEntity.cs index 2810d81..2add695 100644 --- a/csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/INamedEntity.cs +++ b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/INamedEntity.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace CSM_Database_Core.Entities.Abstractions.Interfaces; +namespace CSharp_Database_Extension.Entities.Abstractions.Interfaces; /// /// Represents an with and diff --git a/csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/IPartnerBridgeEntity.cs b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IPartnerBridgeEntity.cs similarity index 94% rename from csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/IPartnerBridgeEntity.cs rename to csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IPartnerBridgeEntity.cs index 67765ef..c152df2 100644 --- a/csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/IPartnerBridgeEntity.cs +++ b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IPartnerBridgeEntity.cs @@ -1,4 +1,4 @@ -namespace CSM_Database_Core.Entities.Abstractions.Interfaces; +namespace CSharp_Database_Extension.Entities.Abstractions.Interfaces; /// /// Represents an as a bridge between a possible internal business entity or a partner provided entity data. diff --git a/csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/IPartnerScopeEntity.cs b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IPartnerScopeEntity.cs similarity index 90% rename from csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/IPartnerScopeEntity.cs rename to csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IPartnerScopeEntity.cs index d4fb1f5..9075739 100644 --- a/csharp_database_extension/CSM Database Core/Entities/Abstractions/Interfaces/IPartnerScopeEntity.cs +++ b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IPartnerScopeEntity.cs @@ -1,4 +1,4 @@ -namespace CSM_Database_Core.Entities.Abstractions.Interfaces; +namespace CSharp_Database_Extension.Entities.Abstractions.Interfaces; /// /// Represents an scope for a . /// diff --git a/csharp_database_extension/CSM Database Core/Validation/Abstractions/Bases/ValidatorBase.cs b/csharp_database_extension/CSharp Database Extension/Validation/Abstractions/Bases/ValidatorBase.cs similarity index 68% rename from csharp_database_extension/CSM Database Core/Validation/Abstractions/Bases/ValidatorBase.cs rename to csharp_database_extension/CSharp Database Extension/Validation/Abstractions/Bases/ValidatorBase.cs index 074152e..723f2dc 100644 --- a/csharp_database_extension/CSM Database Core/Validation/Abstractions/Bases/ValidatorBase.cs +++ b/csharp_database_extension/CSharp Database Extension/Validation/Abstractions/Bases/ValidatorBase.cs @@ -1,6 +1,6 @@ -using CSM_Database_Core.Validation.Abstractions.Interfaces; +using CSharp_Database_Extension.Validation.Abstractions.Interfaces; -namespace CSM_Database_Core.Validation.Abstractions.Bases; +namespace CSharp_Database_Extension.Validation.Abstractions.Bases; /// [AttributeUsage(AttributeTargets.Property)] diff --git a/csharp_database_extension/CSM Database Core/Validation/Abstractions/Interfaces/IValidator.cs b/csharp_database_extension/CSharp Database Extension/Validation/Abstractions/Interfaces/IValidator.cs similarity index 91% rename from csharp_database_extension/CSM Database Core/Validation/Abstractions/Interfaces/IValidator.cs rename to csharp_database_extension/CSharp Database Extension/Validation/Abstractions/Interfaces/IValidator.cs index 5c9ee89..d31bcb5 100644 --- a/csharp_database_extension/CSM Database Core/Validation/Abstractions/Interfaces/IValidator.cs +++ b/csharp_database_extension/CSharp Database Extension/Validation/Abstractions/Interfaces/IValidator.cs @@ -1,4 +1,4 @@ -namespace CSM_Database_Core.Validation.Abstractions.Interfaces; +namespace CSharp_Database_Extension.Validation.Abstractions.Interfaces; /// /// Represents a property validator instruction. diff --git a/csharp_database_extension/CSM Database Core/Validation/ExclusiveValidator.cs b/csharp_database_extension/CSharp Database Extension/Validation/ExclusiveValidator.cs similarity index 96% rename from csharp_database_extension/CSM Database Core/Validation/ExclusiveValidator.cs rename to csharp_database_extension/CSharp Database Extension/Validation/ExclusiveValidator.cs index 16f8c6c..16a47e1 100644 --- a/csharp_database_extension/CSM Database Core/Validation/ExclusiveValidator.cs +++ b/csharp_database_extension/CSharp Database Extension/Validation/ExclusiveValidator.cs @@ -1,8 +1,8 @@ using System.Reflection; -using CSM_Database_Core.Validation.Abstractions.Bases; +using CSharp_Database_Extension.Validation.Abstractions.Bases; -namespace CSM_Database_Core.Validation; +namespace CSharp_Database_Extension.Validation; /// /// From 1547493605dce670217584ba9819106264285f6d Mon Sep 17 00:00:00 2001 From: Renato Urrea Date: Tue, 6 Oct 2026 13:34:46 -0700 Subject: [PATCH 10/60] testing and main project building --- .../Bases/DatabaseIntegrationTestsBase.cs | 2 +- .../Bases/DepotIntegrationTestsBase.cs | 39 ++- .../Bases/EntityIntegrationTestsBase.cs | 4 +- .../Bases/TestingDataHandlerBase.cs | 2 +- .../BaseDraftUtils.cs | 56 +--- .../Abstractions/Bases/TestingDisposerBase.cs | 1 + .../Interfaces/ITestingDisposer.cs | 2 +- .../Managers/TestingStoreManager.cs | 4 +- .../Abstractions/Bases/DatabaseBase.cs | 274 +++++++++--------- .../Abstractions/Interfaces/IDatabase.cs | 9 +- .../CSharp Database Extension.csproj | 1 + .../Bases/RelationAttributeBase.cs | 4 +- .../Interfaces/IRelationAttribute.cs | 2 +- .../Attributes/EntityRelationAttribute.cs | 4 +- .../Common/Errors/DatabaseError.cs | 2 +- .../Common/Errors/DepotError.cs | 2 +- .../Common/Errors/EntityError.cs | 2 +- .../Common/Errors/EntityValidationError.cs | 2 +- .../Common/Errors/ValidatorError.cs | 4 +- .../Extensions/EntityTypeBuilderExtension.cs | 2 +- .../Common/Extensions/IQueryableExtension.cs | 2 +- .../Common/Extensions/TypeExtension.cs | 2 +- .../Common/Models/ConnectionOptions.cs | 2 +- .../Common/Models/DatabaseOptions.cs | 1 - .../Common/Utils/DatabaseUtils.cs | 6 +- .../Common/Utils/EntityUtils.cs | 4 +- .../Depots/Abstractions/Bases/DepotBase.cs | 8 +- .../Depots/Models/BatchOperationOutput.cs | 2 +- .../Depots/Models/PropertyValidationResult.cs | 2 +- .../Abstractions/Bases/ActivableEntityBase.cs | 13 - .../Entities/Abstractions/Bases/EntityBase.cs | 8 +- .../Abstractions/Bases/NamedEntityBase.cs | 17 -- .../Bases/PartnerScopeEntityBase.cs | 2 +- .../Interfaces/IActivableEntity.cs | 12 - .../Abstractions/Interfaces/IEntity.cs | 28 +- .../Abstractions/Interfaces/INamedEntity.cs | 25 -- .../Abstractions/Bases/ValidatorBase.cs | 4 +- .../Abstractions/Interfaces/IValidator.cs | 2 +- .../Validation/ExclusiveValidator.cs | 6 +- 39 files changed, 249 insertions(+), 315 deletions(-) delete mode 100644 csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/ActivableEntityBase.cs delete mode 100644 csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/NamedEntityBase.cs delete mode 100644 csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IActivableEntity.cs delete mode 100644 csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/INamedEntity.cs rename csharp_database_extension/CSharp Database Extension/{ => Entities}/Validation/Abstractions/Bases/ValidatorBase.cs (65%) rename csharp_database_extension/CSharp Database Extension/{ => Entities}/Validation/Abstractions/Interfaces/IValidator.cs (90%) rename csharp_database_extension/CSharp Database Extension/{ => Entities}/Validation/ExclusiveValidator.cs (92%) diff --git a/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/DatabaseIntegrationTestsBase.cs b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/DatabaseIntegrationTestsBase.cs index 0531d64..76ad1ba 100644 --- a/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/DatabaseIntegrationTestsBase.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/DatabaseIntegrationTestsBase.cs @@ -1,5 +1,5 @@ using CSharp_Database_Extension; -using CSharp_Database_Extension.Core.Models; +using CSharp_Database_Extension.Common.Models; using CSharp_Extension.Common.Extensions; diff --git a/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs index 132ea0c..53fd0a4 100644 --- a/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs @@ -2,12 +2,11 @@ using System.Reflection; using CSharp_Database_Extension; -using CSharp_Database_Extension.Core.Errors; -using CSharp_Database_Extension.Core.Models; +using CSharp_Database_Extension.Common.Errors; +using CSharp_Database_Extension.Common.Models; using CSharp_Database_Extension.Depots.Abstractions.Interfaces; using CSharp_Database_Extension.Depots.Models; using CSharp_Database_Extension.Depots.ViewFilters; -using CSharp_Database_Extension.Entities.Abstractions.Interfaces; using CSM_Database_Testing.Disposing.Abstractions.Bases; using CSM_Database_Testing.Managers; @@ -61,17 +60,17 @@ public abstract class DepotIntegrationTestsBase /// public DepotIntegrationTestsBase(DatabaseFactory? database = null, params DatabaseFactory[] factories) : base( - [ - ..factories, - () => database?.Invoke() - ?? (TDatabase)Activator.CreateInstance( - typeof(TDatabase), - new DatabaseOptions { - ForTesting = true, - } - )!, - ] - ) { + [ + ..factories, + () => database?.Invoke() + ?? (TDatabase)Activator.CreateInstance( + typeof(TDatabase), + new DatabaseOptions { + ForTesting = true, + } + )!, + ] +) { _database = (TDatabase)database?.Invoke()! ?? (TDatabase)Activator.CreateInstance( @@ -197,11 +196,11 @@ protected async Task Sampling() { /// This instance collection is created but not stored in the database. /// protected async Task Sampling(int Count) { - List samples = []; + List samples = new List(); for (int i = 0; i < Count; i++) { samples.Add(await TestingStoreManager.RunEntityFactory(EntityFactory)); } - return [.. samples]; + return samples.ToArray(); } #endregion @@ -217,7 +216,7 @@ public virtual async Task Create_Single_Success() { TEntity sample = await Sampling(); TEntity storedEntity = await _depot.Create(sample); - await CommitSampleEntities([storedEntity]); + await CommitSampleEntities(new IEntity[] { storedEntity }); Assert.Multiple( [ @@ -287,7 +286,7 @@ public virtual async Task Read_Single_ById_Success() { [Fact(DisplayName = "[Read Batch]: Entities read by (Id)")] public virtual async Task Read_Batch_ById_Sucess() { TEntity[] samples = await Store(20, EntityFactory); - long[] sampleIds = [.. samples.Select(i => i.Id)]; + long[] sampleIds = samples.Select(i => i.Id).ToArray(); BatchOperationOutput readEntities = await _depot.Read(sampleIds); Assert.Multiple( @@ -540,9 +539,9 @@ public virtual async Task Delete_Single_ById_Success() { TEntity entity = await Store(EntityFactory); await _depot.Delete(entity.Id); - await CommitSampleEntities([]); + await CommitSampleEntities(Array.Empty()); - List searchedEntity = await Get([entity]); + List searchedEntity = await Get(new[] { entity }); Assert.Empty(searchedEntity); } diff --git a/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/EntityIntegrationTestsBase.cs b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/EntityIntegrationTestsBase.cs index 0af25aa..b9c68b5 100644 --- a/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/EntityIntegrationTestsBase.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/EntityIntegrationTestsBase.cs @@ -1,5 +1,5 @@ -using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -using CSharp_Database_Extension.Validation.Abstractions.Bases; +using CSharp_Database_Extension; +using CSharp_Database_Extension.Entities.Validation.Abstractions.Bases; namespace CSM_Database_Testing.Abstractions.Bases; diff --git a/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/TestingDataHandlerBase.cs b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/TestingDataHandlerBase.cs index de0c47b..a7b0e14 100644 --- a/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/TestingDataHandlerBase.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/TestingDataHandlerBase.cs @@ -1,4 +1,4 @@ -using CSharp_Database_Extension.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension; using CSM_Database_Testing.Disposing; using CSM_Database_Testing.Disposing.Abstractions.Bases; diff --git a/csharp_database_extension/CSharp Database Extension Testing/BaseDraftUtils.cs b/csharp_database_extension/CSharp Database Extension Testing/BaseDraftUtils.cs index 5e5ebd9..07c97aa 100644 --- a/csharp_database_extension/CSharp Database Extension Testing/BaseDraftUtils.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/BaseDraftUtils.cs @@ -1,4 +1,5 @@ -using CSharp_Database_Extension.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension; +using CSharp_Database_Extension.Entities.Abstractions.Interfaces; using CSharp_Extension.Common.Utils; @@ -76,42 +77,21 @@ static public TPartnerScopeEntity PartnerScopeEntity(TPartn } /// - /// Drafts an instance with random data. + /// Drafts an instance with random data. /// - /// + /// /// Type of the entity to draft. /// /// /// Default values for the entity. /// /// - /// A drafted instance. - /// - static public TActivableEntity ActivableEntity(TActivableEntity? @ref = default) - where TActivableEntity : IActivableEntity, new() { - - @ref ??= Entity(@ref); - - return @ref; - } - - /// - /// Drafts a instance with random data. - /// - /// - /// Type of the entity to draft. - /// - /// - /// Default entity values. - /// - /// - /// A drafted instance. + /// A drafted instance. /// - static public TNamedEntity NamedEntity(TNamedEntity? @ref = default) - where TNamedEntity : INamedEntity, new() { - - @ref ??= Entity(@ref); + static public TEntity Entity(TEntity? @ref = default) + where TEntity : IEntity, new() { + @ref ??= new TEntity(); if (string.IsNullOrWhiteSpace(@ref.Name)) { @ref.Name = $"{Rnd}_name"; } @@ -122,24 +102,4 @@ static public TNamedEntity NamedEntity(TNamedEntity? @ref = defaul return @ref; } - - /// - /// Drafts an instance with random data. - /// - /// - /// Type of the entity to draft. - /// - /// - /// Default values for the entity. - /// - /// - /// A drafted instance. - /// - static public TEntity Entity(TEntity? @ref = default) - where TEntity : IEntity, new() { - - @ref ??= new TEntity(); - - return @ref; - } } diff --git a/csharp_database_extension/CSharp Database Extension Testing/Disposing/Abstractions/Bases/TestingDisposerBase.cs b/csharp_database_extension/CSharp Database Extension Testing/Disposing/Abstractions/Bases/TestingDisposerBase.cs index 1de0bd9..97356a1 100644 --- a/csharp_database_extension/CSharp Database Extension Testing/Disposing/Abstractions/Bases/TestingDisposerBase.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/Disposing/Abstractions/Bases/TestingDisposerBase.cs @@ -1,5 +1,6 @@ using System.Collections.Concurrent; +using CSharp_Database_Extension; using CSharp_Database_Extension.Entities.Abstractions.Interfaces; using CSM_Database_Testing.Disposing.Abstractions.Interfaces; diff --git a/csharp_database_extension/CSharp Database Extension Testing/Disposing/Abstractions/Interfaces/ITestingDisposer.cs b/csharp_database_extension/CSharp Database Extension Testing/Disposing/Abstractions/Interfaces/ITestingDisposer.cs index 92de63d..0edb57d 100644 --- a/csharp_database_extension/CSharp Database Extension Testing/Disposing/Abstractions/Interfaces/ITestingDisposer.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/Disposing/Abstractions/Interfaces/ITestingDisposer.cs @@ -1,4 +1,4 @@ -using CSharp_Database_Extension.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension; using CSharp_Extension.Common.Abstractions.Interfaces; diff --git a/csharp_database_extension/CSharp Database Extension Testing/Managers/TestingStoreManager.cs b/csharp_database_extension/CSharp Database Extension Testing/Managers/TestingStoreManager.cs index e55bc75..0124ff2 100644 --- a/csharp_database_extension/CSharp Database Extension Testing/Managers/TestingStoreManager.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/Managers/TestingStoreManager.cs @@ -1,5 +1,5 @@ -using CSharp_Database_Extension.Core.Utils; -using CSharp_Database_Extension.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension; +using CSharp_Database_Extension.Common.Utils; using CSharp_Extension.Common.Utils; diff --git a/csharp_database_extension/CSharp Database Extension/Abstractions/Bases/DatabaseBase.cs b/csharp_database_extension/CSharp Database Extension/Abstractions/Bases/DatabaseBase.cs index 6a1accb..7be59d4 100644 --- a/csharp_database_extension/CSharp Database Extension/Abstractions/Bases/DatabaseBase.cs +++ b/csharp_database_extension/CSharp Database Extension/Abstractions/Bases/DatabaseBase.cs @@ -1,9 +1,10 @@ using System.Reflection; using CSharp_Database_Extension.Abstractions.Interfaces; +using CSharp_Database_Extension.Common.Enums; +using CSharp_Database_Extension.Common.Errors; using CSharp_Database_Extension.Common.Models; -using CSharp_Database_Extension.Core.Errors; -using CSharp_Database_Extension.Core.Utils; +using CSharp_Database_Extension.Common.Utils; using CSharp_Database_Extension.Entities.Abstractions.Interfaces; using CSharp_Extension.Common.Utils; @@ -27,8 +28,11 @@ public abstract partial class DatabaseBase /// public virtual string Signature { get; protected set; } = ""; + /// + public virtual DatabaseProviders Provider { get; protected set; } = DatabaseProviders.PostgreSQL; + /// - /// Database model; options. + /// Database model options. /// public DatabaseOptions Options { get; init; } @@ -37,7 +41,7 @@ public abstract partial class DatabaseBase /// public DatabaseBase() { Options = new DatabaseOptions(); - BuildOptions(); + CompleteOptions(); } /// @@ -50,12 +54,9 @@ public DatabaseBase(DatabaseOptions databaseOptions) : base(databaseOptions.DbContextOptions ?? new()) { Options = databaseOptions; - BuildOptions(); + CompleteOptions(); } - - #region Public - /// public bool Validate(bool strict = true) { bool logsOn = Options.EnableLogging; @@ -82,7 +83,7 @@ public bool Validate(bool strict = true) { return false; } - return ValidateEntityDefinitions(strict); + return ValidateEntityModels(strict); } try { @@ -97,27 +98,13 @@ public bool Validate(bool strict = true) { } } - #endregion - /// - /// Validates dependencies and generates required ones. - /// - /// - /// Important process, is required to be called in each constructor. - /// - void BuildOptions() { - Options.Signature ??= Signature; - - Options.ConnectionOptions ??= DatabaseUtils.GetConnectionOptions(Signature, Options.ForTesting); - } - - /// - /// Gets all database entity definitions. + /// Gets database entity models. /// /// - /// Database entity definitions. + /// Database entity instances as models. /// - protected EntityBase[] GetEntityDefinitions() { + protected EntityBase[] GetEntityModels() { Type dbType = GetType(); List entityModels = []; @@ -150,79 +137,26 @@ protected EntityBase[] GetEntityDefinitions() { return [.. entityModels]; } - /// - /// Validate that all database entities are correctly defined. - /// - /// - /// Whether the engines should be stopped on invalid entities. - /// - bool ValidateEntityDefinitions(bool strict = true) { - - bool logsOn = Options.EnableLogging; - EntityBase[] defs = GetEntityDefinitions(); - - if (logsOn) { - ConsoleUtils.Announce( - $"[{GetType().Name}] Validatig Sets...", - new() { - { "Count", defs.Length } - } - ); - } - - Exception[] evResults = []; - foreach (EntityBase entity in defs) { - Exception[] result = entity.EvaluateModel(); - if (result.Length > 0 && logsOn) { - ConsoleUtils.Warning( - "Wrong [DbSet] definition", - new() { - { "Set", entity.GetType().Name }, - { "Exceptions", result }, - } - ); - } - - evResults = [.. evResults, .. result]; - } - - if (evResults.Length > 0) { - if (strict) - throw new Exception("Database [DbSet] definition failures"); - - return false; - } - - if (logsOn) - ConsoleUtils.Success($"[{GetType().Name}] Set validation succeeded"); - - return true; - } - - /// - /// Designs the current instance for the given , overriding - /// the current behavior. - /// - /// - /// Entity instance being designed. - /// - /// - /// Global database model builder instance. - /// - protected virtual void DesignEntity(EntityBase entity, EntityTypeBuilder mBuilder) { } - - /// - /// Designs the current instance for the database, overriding the current behavior. - /// - /// - /// Global database model builder instance. - /// - protected virtual void DesignDatabase(ModelBuilder mBuilder) { } - /// protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { string connectionString = Options.ConnectionOptions!.ConnectionString; - optionsBuilder.UseSqlServer(connectionString); + + string assemblyNamespace = $"{GetType().Assembly.GetName().Name}.Migrations"; + + switch (Options.Provider) { + case DatabaseProviders.SQLServer: + optionsBuilder.UseSqlServer( + connectionString, + builder => builder.MigrationsAssembly($"{assemblyNamespace}.SQLServer") + ); + break; + case DatabaseProviders.PostgreSQL: + optionsBuilder.UseNpgsql( + connectionString, + builder => builder.MigrationsAssembly($"{assemblyNamespace}.PostgreSQL") + ); + break; + } // We catch when the execution context is an Entity Framework design runtime. if (AppDomain.CurrentDomain.FriendlyName.Contains("ef")) { @@ -260,23 +194,16 @@ protected override void OnModelCreating(ModelBuilder mBuilder) { } } - EntityBase[] sets = GetEntityDefinitions(); + EntityBase[] entityModels = GetEntityModels(); - foreach (EntityBase entity in sets) { - Type setType = entity.GetType(); + foreach (EntityBase entity in entityModels) { + Type entityModelType = entity.GetType(); mBuilder.Entity( - setType, + entityModelType, (etBuilder) => { - etBuilder.HasKey(nameof(IEntity.Id)); - etBuilder.Property(nameof(IEntity.Id)).IsRequired(); - - DesignEntityInterfacing(etBuilder, entity); + DesignEntityModelInterfaces(etBuilder, entity); DesignEntity(entity, etBuilder); - etBuilder.Property(nameof(IEntity.Timestamp)) - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - entity.DesignEntity(etBuilder); } ); @@ -285,6 +212,92 @@ protected override void OnModelCreating(ModelBuilder mBuilder) { base.OnModelCreating(mBuilder); } + /// + /// Designs the database entity models type, in order to be translated to database provider language. + /// + /// + /// Entity Model to be designed. + /// + /// + /// Global database entity model builder. + /// + protected virtual void DesignEntity(EntityBase entity, EntityTypeBuilder mBuilder) { } + + /// + /// Designs the current instance for the database, overriding the current behavior. + /// + /// + /// Global database model builder instance. + /// + protected virtual void DesignDatabase(ModelBuilder mBuilder) { } + + /// + /// Completes missing values that are auto-loaded + /// by system properties or values calculated at runtime. + /// + /// + /// Important process, is required to be called in each constructor of this class. + /// + void CompleteOptions() { + Options.Signature ??= Signature; + + // When current options provider is the default one. + if (Options.Provider == DatabaseProviders.PostgreSQL) { + Options.Provider = Provider; + } + + Options.ConnectionOptions ??= DatabaseUtils.GetConnectionOptions(Signature, Options.ForTesting); + } + + /// + /// Validate database entity models. + /// + /// + /// Whether the engines should be stopped on invalid entities. + /// + bool ValidateEntityModels(bool strict = true) { + + bool logsOn = Options.EnableLogging; + EntityBase[] defs = GetEntityModels(); + + if (logsOn) { + ConsoleUtils.Announce( + $"[{GetType().Name}] Validatig Entity Models...", + new() { + { "Count", defs.Length } + } + ); + } + + Exception[] evResults = []; + foreach (EntityBase entity in defs) { + Exception[] result = entity.EvaluateModel(); + if (result.Length > 0 && logsOn) { + ConsoleUtils.Warning( + "Wrong [Entity Model] definition", + new() { + { "Entity Model", entity.GetType().Name }, + { "Result", result }, + } + ); + } + + evResults = [.. evResults, .. result]; + } + + if (evResults.Length > 0) { + if (strict) + throw new Exception("Database [Entity Models] validation failed"); + + return false; + } + + if (logsOn) + ConsoleUtils.Success($"[{GetType().Name}] Set validation succeeded"); + + return true; + } + /// /// Design business interfacing for business entities with their defined properties and behavior. /// @@ -294,28 +307,29 @@ protected override void OnModelCreating(ModelBuilder mBuilder) { /// /// Entity instance modeled. /// - static void DesignEntityInterfacing(EntityTypeBuilder etBuilder, EntityBase entity) { - if (entity is INamedEntity) { - PropertyInfo nameProperty = entity.GetProperty(nameof(INamedEntity.Name)); - PropertyInfo descriptionProperty = entity.GetProperty(nameof(INamedEntity.Description)); - - etBuilder - .HasIndex(nameProperty.Name) - .IsUnique(); - etBuilder - .Property(nameProperty.Name) - .HasMaxLength(100).IsRequired(); - - etBuilder - .Property(descriptionProperty.Name); - } - - if (entity is IActivableEntity) { - PropertyInfo isEnabledProperty = entity.GetProperty(nameof(IActivableEntity.IsEnabled)); - - etBuilder.Property(isEnabledProperty.Name) - .IsRequired(); - } + static void DesignEntityModelInterfaces(EntityTypeBuilder etBuilder, EntityBase entity) { + etBuilder.HasKey(nameof(IEntity.Id)); + etBuilder.Property(nameof(IEntity.Id)) + .IsRequired(); + + PropertyInfo nameProperty = entity.GetProperty(nameof(IEntity.Name)); + PropertyInfo descriptionProperty = entity.GetProperty(nameof(IEntity.Description)); + + etBuilder + .HasIndex(nameProperty.Name) + .IsUnique(); + etBuilder + .Property(nameProperty.Name) + .HasMaxLength(200) + .IsRequired(); + + etBuilder + .Property(descriptionProperty.Name); + + etBuilder.Property(nameof(IEntity.Timestamp)) + .HasColumnType("datetime2(7)") + .HasDefaultValueSql("GETUTCDATE()") + .IsRowVersion(); } } diff --git a/csharp_database_extension/CSharp Database Extension/Abstractions/Interfaces/IDatabase.cs b/csharp_database_extension/CSharp Database Extension/Abstractions/Interfaces/IDatabase.cs index 7070dd9..58741a1 100644 --- a/csharp_database_extension/CSharp Database Extension/Abstractions/Interfaces/IDatabase.cs +++ b/csharp_database_extension/CSharp Database Extension/Abstractions/Interfaces/IDatabase.cs @@ -1,4 +1,6 @@ -namespace CSharp_Database_Extension.Abstractions.Interfaces; +using CSharp_Database_Extension.Common.Enums; + +namespace CSharp_Database_Extension.Abstractions.Interfaces; /// /// Represents a Database model. @@ -10,6 +12,11 @@ public interface IDatabase { /// string Signature { get; } + /// + /// Database provider type. + /// + DatabaseProviders Provider { get; } + /// /// Validates database connection and configuration health. /// diff --git a/csharp_database_extension/CSharp Database Extension/CSharp Database Extension.csproj b/csharp_database_extension/CSharp Database Extension/CSharp Database Extension.csproj index 5819a9b..1ffe6d4 100644 --- a/csharp_database_extension/CSharp Database Extension/CSharp Database Extension.csproj +++ b/csharp_database_extension/CSharp Database Extension/CSharp Database Extension.csproj @@ -26,6 +26,7 @@ + diff --git a/csharp_database_extension/CSharp Database Extension/Common/Attributes/Abstractions/Bases/RelationAttributeBase.cs b/csharp_database_extension/CSharp Database Extension/Common/Attributes/Abstractions/Bases/RelationAttributeBase.cs index 3f44490..ef5409c 100644 --- a/csharp_database_extension/CSharp Database Extension/Common/Attributes/Abstractions/Bases/RelationAttributeBase.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Attributes/Abstractions/Bases/RelationAttributeBase.cs @@ -1,6 +1,6 @@ -using CSharp_Database_Extension.Core.Attributes.Abstractions.Interfaces; +using CSharp_Database_Extension.Common.Attributes.Abstractions.Interfaces; -namespace CSharp_Database_Extension.Core.Attributes.Abstractions.Bases; +namespace CSharp_Database_Extension.Common.Attributes.Abstractions.Bases; /// public abstract class RelationAttributeBase diff --git a/csharp_database_extension/CSharp Database Extension/Common/Attributes/Abstractions/Interfaces/IRelationAttribute.cs b/csharp_database_extension/CSharp Database Extension/Common/Attributes/Abstractions/Interfaces/IRelationAttribute.cs index eb897f4..3f7a14c 100644 --- a/csharp_database_extension/CSharp Database Extension/Common/Attributes/Abstractions/Interfaces/IRelationAttribute.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Attributes/Abstractions/Interfaces/IRelationAttribute.cs @@ -1,6 +1,6 @@ using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSharp_Database_Extension.Core.Attributes.Abstractions.Interfaces; +namespace CSharp_Database_Extension.Common.Attributes.Abstractions.Interfaces; /// diff --git a/csharp_database_extension/CSharp Database Extension/Common/Attributes/EntityRelationAttribute.cs b/csharp_database_extension/CSharp Database Extension/Common/Attributes/EntityRelationAttribute.cs index 67b9ab7..4354bc1 100644 --- a/csharp_database_extension/CSharp Database Extension/Common/Attributes/EntityRelationAttribute.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Attributes/EntityRelationAttribute.cs @@ -1,6 +1,6 @@ -using CSharp_Database_Extension.Core.Attributes.Abstractions.Bases; +using CSharp_Database_Extension.Common.Attributes.Abstractions.Bases; -namespace CSharp_Database_Extension.Core.Attributes; +namespace CSharp_Database_Extension.Common.Attributes; /// /// Attribute to mark a relation dependency. diff --git a/csharp_database_extension/CSharp Database Extension/Common/Errors/DatabaseError.cs b/csharp_database_extension/CSharp Database Extension/Common/Errors/DatabaseError.cs index 7ce63fb..7b03260 100644 --- a/csharp_database_extension/CSharp Database Extension/Common/Errors/DatabaseError.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Errors/DatabaseError.cs @@ -1,6 +1,6 @@ using CSharp_Extension.Errors.Abstractions.Bases; -namespace CSharp_Database_Extension.Core.Errors; +namespace CSharp_Database_Extension.Common.Errors; /// /// Represents the exception events. diff --git a/csharp_database_extension/CSharp Database Extension/Common/Errors/DepotError.cs b/csharp_database_extension/CSharp Database Extension/Common/Errors/DepotError.cs index b818123..95f3880 100644 --- a/csharp_database_extension/CSharp Database Extension/Common/Errors/DepotError.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Errors/DepotError.cs @@ -6,7 +6,7 @@ using CSharp_Extension.Errors.Abstractions.Bases; using CSharp_Extension.Errors.Models; -namespace CSharp_Database_Extension.Core.Errors; +namespace CSharp_Database_Extension.Common.Errors; /// /// Represents the trigger events. diff --git a/csharp_database_extension/CSharp Database Extension/Common/Errors/EntityError.cs b/csharp_database_extension/CSharp Database Extension/Common/Errors/EntityError.cs index 746cbef..1261b22 100644 --- a/csharp_database_extension/CSharp Database Extension/Common/Errors/EntityError.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Errors/EntityError.cs @@ -2,7 +2,7 @@ using CSharp_Extension.Errors.Abstractions.Bases; -namespace CSharp_Database_Extension.Core.Errors; +namespace CSharp_Database_Extension.Common.Errors; /// /// Represents exception events. diff --git a/csharp_database_extension/CSharp Database Extension/Common/Errors/EntityValidationError.cs b/csharp_database_extension/CSharp Database Extension/Common/Errors/EntityValidationError.cs index 85523f0..1b9e37c 100644 --- a/csharp_database_extension/CSharp Database Extension/Common/Errors/EntityValidationError.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Errors/EntityValidationError.cs @@ -2,7 +2,7 @@ using CSharp_Extension.Errors.Abstractions.Bases; -namespace CSharp_Database_Extension.Core.Errors; +namespace CSharp_Database_Extension.Common.Errors; /// /// Represents events. diff --git a/csharp_database_extension/CSharp Database Extension/Common/Errors/ValidatorError.cs b/csharp_database_extension/CSharp Database Extension/Common/Errors/ValidatorError.cs index 7340c64..2e69c07 100644 --- a/csharp_database_extension/CSharp Database Extension/Common/Errors/ValidatorError.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Errors/ValidatorError.cs @@ -1,11 +1,11 @@ using System.Reflection; using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -using CSharp_Database_Extension.Validation.Abstractions.Bases; +using CSharp_Database_Extension.Entities.Validation.Abstractions.Bases; using CSharp_Extension.Errors.Abstractions.Bases; -namespace CSharp_Database_Extension.Core.Errors; +namespace CSharp_Database_Extension.Common.Errors; /// /// Represents events. diff --git a/csharp_database_extension/CSharp Database Extension/Common/Extensions/EntityTypeBuilderExtension.cs b/csharp_database_extension/CSharp Database Extension/Common/Extensions/EntityTypeBuilderExtension.cs index 4e801b8..5e0aeb5 100644 --- a/csharp_database_extension/CSharp Database Extension/Common/Extensions/EntityTypeBuilderExtension.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Extensions/EntityTypeBuilderExtension.cs @@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; -namespace CSharp_Database_Extension.Core.Extensions; +namespace CSharp_Database_Extension.Common.Extensions; /// /// Provide extension methods for class type. diff --git a/csharp_database_extension/CSharp Database Extension/Common/Extensions/IQueryableExtension.cs b/csharp_database_extension/CSharp Database Extension/Common/Extensions/IQueryableExtension.cs index dba1b68..ee00551 100644 --- a/csharp_database_extension/CSharp Database Extension/Common/Extensions/IQueryableExtension.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Extensions/IQueryableExtension.cs @@ -8,7 +8,7 @@ using Microsoft.EntityFrameworkCore; -namespace CSharp_Database_Extension.Core.Extensions; +namespace CSharp_Database_Extension.Common.Extensions; /// /// Extension class for objects. diff --git a/csharp_database_extension/CSharp Database Extension/Common/Extensions/TypeExtension.cs b/csharp_database_extension/CSharp Database Extension/Common/Extensions/TypeExtension.cs index 2fddce4..c7ae1e2 100644 --- a/csharp_database_extension/CSharp Database Extension/Common/Extensions/TypeExtension.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Extensions/TypeExtension.cs @@ -1,7 +1,7 @@ using System.Collections; using System.Reflection; -namespace CSharp_Database_Extension.Core.Extensions; +namespace CSharp_Database_Extension.Common.Extensions; /// /// Provides extension methods for the class. diff --git a/csharp_database_extension/CSharp Database Extension/Common/Models/ConnectionOptions.cs b/csharp_database_extension/CSharp Database Extension/Common/Models/ConnectionOptions.cs index 6255c5c..3cd63fe 100644 --- a/csharp_database_extension/CSharp Database Extension/Common/Models/ConnectionOptions.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Models/ConnectionOptions.cs @@ -1,4 +1,4 @@ -namespace CSharp_Database_Extension.Core.Models; +namespace CSharp_Database_Extension.Common.Models; /// /// Represents a database server connection options. diff --git a/csharp_database_extension/CSharp Database Extension/Common/Models/DatabaseOptions.cs b/csharp_database_extension/CSharp Database Extension/Common/Models/DatabaseOptions.cs index a1cdcfb..39c68a6 100644 --- a/csharp_database_extension/CSharp Database Extension/Common/Models/DatabaseOptions.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Models/DatabaseOptions.cs @@ -1,5 +1,4 @@ using CSharp_Database_Extension.Common.Enums; -using CSharp_Database_Extension.Core.Models; using Microsoft.EntityFrameworkCore; diff --git a/csharp_database_extension/CSharp Database Extension/Common/Utils/DatabaseUtils.cs b/csharp_database_extension/CSharp Database Extension/Common/Utils/DatabaseUtils.cs index 495a3c7..80e6187 100644 --- a/csharp_database_extension/CSharp Database Extension/Common/Utils/DatabaseUtils.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Utils/DatabaseUtils.cs @@ -1,8 +1,8 @@ using System.Reflection; using System.Text.Json; -using CSharp_Database_Extension.Core.Attributes; -using CSharp_Database_Extension.Core.Models; +using CSharp_Database_Extension.Common.Attributes; +using CSharp_Database_Extension.Common.Models; using CSharp_Database_Extension.Entities.Abstractions.Interfaces; using CSharp_Extension; @@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; -namespace CSharp_Database_Extension.Core.Utils; +namespace CSharp_Database_Extension.Common.Utils; /// /// Provide utilities methods for database purposes. diff --git a/csharp_database_extension/CSharp Database Extension/Common/Utils/EntityUtils.cs b/csharp_database_extension/CSharp Database Extension/Common/Utils/EntityUtils.cs index 0574785..4acd457 100644 --- a/csharp_database_extension/CSharp Database Extension/Common/Utils/EntityUtils.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Utils/EntityUtils.cs @@ -1,10 +1,10 @@ using System.Collections; using System.Reflection; -using CSharp_Database_Extension.Core.Attributes.Abstractions.Interfaces; +using CSharp_Database_Extension.Common.Attributes.Abstractions.Interfaces; using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -namespace CSharp_Database_Extension.Core.Utils; +namespace CSharp_Database_Extension.Common.Utils; /// /// Provide utility methods for objects. diff --git a/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Bases/DepotBase.cs b/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Bases/DepotBase.cs index b751358..76c2c90 100644 --- a/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Bases/DepotBase.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Bases/DepotBase.cs @@ -2,10 +2,10 @@ using System.Data; using System.Reflection; -using CSharp_Database_Extension.Core.Attributes.Abstractions.Interfaces; -using CSharp_Database_Extension.Core.Errors; -using CSharp_Database_Extension.Core.Extensions; -using CSharp_Database_Extension.Core.Utils; +using CSharp_Database_Extension.Common.Attributes.Abstractions.Interfaces; +using CSharp_Database_Extension.Common.Errors; +using CSharp_Database_Extension.Common.Extensions; +using CSharp_Database_Extension.Common.Utils; using CSharp_Database_Extension.Depots.Abstractions.Interfaces; using CSharp_Database_Extension.Depots.Models; using CSharp_Database_Extension.Depots.Models.Structs; diff --git a/csharp_database_extension/CSharp Database Extension/Depots/Models/BatchOperationOutput.cs b/csharp_database_extension/CSharp Database Extension/Depots/Models/BatchOperationOutput.cs index 90a3f69..1f6505a 100644 --- a/csharp_database_extension/CSharp Database Extension/Depots/Models/BatchOperationOutput.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Models/BatchOperationOutput.cs @@ -1,4 +1,4 @@ -using CSharp_Database_Extension.Core.Errors; +using CSharp_Database_Extension.Common.Errors; using CSharp_Database_Extension.Entities.Abstractions.Interfaces; namespace CSharp_Database_Extension.Depots.Models; diff --git a/csharp_database_extension/CSharp Database Extension/Depots/Models/PropertyValidationResult.cs b/csharp_database_extension/CSharp Database Extension/Depots/Models/PropertyValidationResult.cs index aa52010..2fff84d 100644 --- a/csharp_database_extension/CSharp Database Extension/Depots/Models/PropertyValidationResult.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Models/PropertyValidationResult.cs @@ -1,6 +1,6 @@ using System.Reflection; -using CSharp_Database_Extension.Core.Errors; +using CSharp_Database_Extension.Common.Errors; namespace CSharp_Database_Extension.Depots.Models; diff --git a/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/ActivableEntityBase.cs b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/ActivableEntityBase.cs deleted file mode 100644 index 152cde7..0000000 --- a/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/ActivableEntityBase.cs +++ /dev/null @@ -1,13 +0,0 @@ -using CSharp_Database_Extension.Entities.Abstractions.Interfaces; - -namespace CSharp_Database_Extension.Entities.Abstractions.Bases; - -/// -/// Represents an with enablement control. -/// -public abstract class ActivableEntityBase - : EntityBase, IEntity, IActivableEntity { - - /// - public bool IsEnabled { get; set; } = false; -} diff --git a/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/EntityBase.cs b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/EntityBase.cs index 81a1739..3e32de8 100644 --- a/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/EntityBase.cs +++ b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/EntityBase.cs @@ -3,7 +3,7 @@ using System.Text.Json.Serialization; using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -using CSharp_Database_Extension.Validation.Abstractions.Bases; +using CSharp_Database_Extension.Entities.Validation.Abstractions.Bases; using CSharp_Extension.Common.Abstractions.Bases; @@ -34,6 +34,12 @@ public abstract partial class EntityBase /// public DateTime Timestamp { get; set; } = DateTime.UtcNow; + /// + public string Name { get; set; } = string.Empty; + + /// + public string? Description { get; set; } + /// /// Creates a new instance. /// diff --git a/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/NamedEntityBase.cs b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/NamedEntityBase.cs deleted file mode 100644 index c52ce06..0000000 --- a/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/NamedEntityBase.cs +++ /dev/null @@ -1,17 +0,0 @@ -using CSharp_Database_Extension.Entities.Abstractions.Interfaces; - -namespace CSharp_Database_Extension.Entities.Abstractions.Bases; - -/// -/// Represents an with and properties -/// that can help to identify a based on property as this defines them as unique. -/// -public abstract class NamedEntityBase - : EntityBase, INamedEntity { - - /// - public string Name { get; set; } = string.Empty; - - /// - public string? Description { get; set; } -} \ No newline at end of file diff --git a/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/PartnerScopeEntityBase.cs b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/PartnerScopeEntityBase.cs index b0348bd..b315b7a 100644 --- a/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/PartnerScopeEntityBase.cs +++ b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/PartnerScopeEntityBase.cs @@ -1,6 +1,6 @@ using System.Reflection; -using CSharp_Database_Extension.Core.Extensions; +using CSharp_Database_Extension.Common.Extensions; using CSharp_Database_Extension.Entities.Abstractions.Interfaces; using Microsoft.EntityFrameworkCore.Metadata.Builders; diff --git a/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IActivableEntity.cs b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IActivableEntity.cs deleted file mode 100644 index 7b56a3e..0000000 --- a/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IActivableEntity.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace CSharp_Database_Extension.Entities.Abstractions.Interfaces; -/// -/// Represents an with enablement control. -/// -public interface IActivableEntity - : IEntity { - - /// - /// Whether is enabled. - /// - bool IsEnabled { get; set; } -} \ No newline at end of file diff --git a/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IEntity.cs b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IEntity.cs index 0eb1130..79e5fa3 100644 --- a/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IEntity.cs +++ b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IEntity.cs @@ -1,21 +1,21 @@ - - +using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Text.Json.Serialization; using CSharp_Extension.Convertion.Abstractions.Interfaces; -namespace CSharp_Database_Extension.Entities.Abstractions.Interfaces; +#pragma warning disable IDE0130 // Namespace does not match folder structure +namespace CSharp_Database_Extension; +#pragma warning restore IDE0130 // Namespace does not match folder structure /// -/// Represents a tenant business live stored entity model, that usually are objects wich data are grouped by bound that -/// instrinsictly defines their own. +/// Represents a business entity model. /// -public interface IEntity +public partial interface IEntity : IConverterVariant { /// - /// Type of the implementation that stores this implementation. + /// Type of the implementation that stores this implementation. /// [JsonIgnore, NotMapped] Type Database { get; init; } @@ -25,6 +25,20 @@ public interface IEntity /// long Id { get; set; } + /// + /// Entity instance name. + /// + /// + /// Length min 1, max 200. + /// + [StringLength(200, MinimumLength = 1)] + string Name { get; set; } + + /// + /// Entity instance description. + /// + string? Description { get; set; } + /// /// Time mark for the last time this got created and stored into data storage sources. /// diff --git a/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/INamedEntity.cs b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/INamedEntity.cs deleted file mode 100644 index 2add695..0000000 --- a/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/INamedEntity.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace CSharp_Database_Extension.Entities.Abstractions.Interfaces; - -/// -/// Represents an with and -/// that can help to identify a based on property as this defines them as unique. -/// -public interface INamedEntity - : IEntity { - - /// - /// Entity instance name. - /// - /// - /// Length must be between 1 and 100. - /// - [StringLength(100, MinimumLength = 1)] - string Name { get; set; } - - /// - /// Entity instance description. - /// - string? Description { get; set; } -} diff --git a/csharp_database_extension/CSharp Database Extension/Validation/Abstractions/Bases/ValidatorBase.cs b/csharp_database_extension/CSharp Database Extension/Entities/Validation/Abstractions/Bases/ValidatorBase.cs similarity index 65% rename from csharp_database_extension/CSharp Database Extension/Validation/Abstractions/Bases/ValidatorBase.cs rename to csharp_database_extension/CSharp Database Extension/Entities/Validation/Abstractions/Bases/ValidatorBase.cs index 723f2dc..a56cc02 100644 --- a/csharp_database_extension/CSharp Database Extension/Validation/Abstractions/Bases/ValidatorBase.cs +++ b/csharp_database_extension/CSharp Database Extension/Entities/Validation/Abstractions/Bases/ValidatorBase.cs @@ -1,6 +1,6 @@ -using CSharp_Database_Extension.Validation.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Validation.Abstractions.Interfaces; -namespace CSharp_Database_Extension.Validation.Abstractions.Bases; +namespace CSharp_Database_Extension.Entities.Validation.Abstractions.Bases; /// [AttributeUsage(AttributeTargets.Property)] diff --git a/csharp_database_extension/CSharp Database Extension/Validation/Abstractions/Interfaces/IValidator.cs b/csharp_database_extension/CSharp Database Extension/Entities/Validation/Abstractions/Interfaces/IValidator.cs similarity index 90% rename from csharp_database_extension/CSharp Database Extension/Validation/Abstractions/Interfaces/IValidator.cs rename to csharp_database_extension/CSharp Database Extension/Entities/Validation/Abstractions/Interfaces/IValidator.cs index d31bcb5..d3d3326 100644 --- a/csharp_database_extension/CSharp Database Extension/Validation/Abstractions/Interfaces/IValidator.cs +++ b/csharp_database_extension/CSharp Database Extension/Entities/Validation/Abstractions/Interfaces/IValidator.cs @@ -1,4 +1,4 @@ -namespace CSharp_Database_Extension.Validation.Abstractions.Interfaces; +namespace CSharp_Database_Extension.Entities.Validation.Abstractions.Interfaces; /// /// Represents a property validator instruction. diff --git a/csharp_database_extension/CSharp Database Extension/Validation/ExclusiveValidator.cs b/csharp_database_extension/CSharp Database Extension/Entities/Validation/ExclusiveValidator.cs similarity index 92% rename from csharp_database_extension/CSharp Database Extension/Validation/ExclusiveValidator.cs rename to csharp_database_extension/CSharp Database Extension/Entities/Validation/ExclusiveValidator.cs index 16a47e1..92aef81 100644 --- a/csharp_database_extension/CSharp Database Extension/Validation/ExclusiveValidator.cs +++ b/csharp_database_extension/CSharp Database Extension/Entities/Validation/ExclusiveValidator.cs @@ -1,11 +1,11 @@ using System.Reflection; -using CSharp_Database_Extension.Validation.Abstractions.Bases; +using CSharp_Database_Extension.Entities.Validation.Abstractions.Bases; -namespace CSharp_Database_Extension.Validation; +namespace CSharp_Database_Extension.Entities.Validation; /// -/// +/// Repreents an Entity Model property groups strict assigantion validator. /// [AttributeUsage(AttributeTargets.Property)] public class ExclusiveValidator From 81437fb292d9ed3ceb0334cd5a3c435668bf9fe1 Mon Sep 17 00:00:00 2001 From: Renato Urrea Date: Tue, 6 Oct 2026 13:43:12 -0700 Subject: [PATCH 11/60] integration tests added pending to check --- .../CSharp Database Extension.sln | 12 ++++++++++++ .../Abstractions/Bases/DatabaseBase.cs | 2 +- .../DatabaseProxy/DatabaseProxy.cs | 6 +++--- .../DatabaseProxy/DatabaseProxy.csproj | 2 +- .../DatabaseProxy/DatabaseProxyDesignFactory.cs | 12 ++++++------ .../DatabaseProxy/DepotProxy.cs | 6 +++--- .../DatabaseProxy/Entities/EntityDependantProxy.cs | 6 +++--- .../DatabaseProxy/Entities/EntityDependencyProxy.cs | 4 ++-- .../DatabaseProxy/Entities/EntityProxy.cs | 6 +++--- .../Integration Tests/Integration Tests.csproj | 4 ++-- .../Integration Tests/Tests/DepotBaseTests.cs | 5 ++--- 11 files changed, 38 insertions(+), 27 deletions(-) diff --git a/csharp_database_extension/CSharp Database Extension.sln b/csharp_database_extension/CSharp Database Extension.sln index 65722ed..1f57860 100644 --- a/csharp_database_extension/CSharp Database Extension.sln +++ b/csharp_database_extension/CSharp Database Extension.sln @@ -14,6 +14,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharp Database Extension", EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSharp Database Extension Testing", "CSharp Database Extension Testing\CSharp Database Extension Testing.csproj", "{0EAC75F4-83B9-73B2-74CF-F6D4BBD3BEBF}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Integration Tests", "Integration Tests\Integration Tests.csproj", "{91408A5A-3EBE-2556-7CBA-4031BA06CE0B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DatabaseProxy", "DatabaseProxy\DatabaseProxy.csproj", "{5FBB0C80-E310-CB96-56E1-AF38D8BA8F32}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -28,6 +32,14 @@ Global {0EAC75F4-83B9-73B2-74CF-F6D4BBD3BEBF}.Debug|Any CPU.Build.0 = Debug|Any CPU {0EAC75F4-83B9-73B2-74CF-F6D4BBD3BEBF}.Release|Any CPU.ActiveCfg = Release|Any CPU {0EAC75F4-83B9-73B2-74CF-F6D4BBD3BEBF}.Release|Any CPU.Build.0 = Release|Any CPU + {91408A5A-3EBE-2556-7CBA-4031BA06CE0B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {91408A5A-3EBE-2556-7CBA-4031BA06CE0B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {91408A5A-3EBE-2556-7CBA-4031BA06CE0B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {91408A5A-3EBE-2556-7CBA-4031BA06CE0B}.Release|Any CPU.Build.0 = Release|Any CPU + {5FBB0C80-E310-CB96-56E1-AF38D8BA8F32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5FBB0C80-E310-CB96-56E1-AF38D8BA8F32}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5FBB0C80-E310-CB96-56E1-AF38D8BA8F32}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5FBB0C80-E310-CB96-56E1-AF38D8BA8F32}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/csharp_database_extension/CSharp Database Extension/Abstractions/Bases/DatabaseBase.cs b/csharp_database_extension/CSharp Database Extension/Abstractions/Bases/DatabaseBase.cs index 7be59d4..32539d4 100644 --- a/csharp_database_extension/CSharp Database Extension/Abstractions/Bases/DatabaseBase.cs +++ b/csharp_database_extension/CSharp Database Extension/Abstractions/Bases/DatabaseBase.cs @@ -344,7 +344,7 @@ public abstract partial class EntityBase { /// Proxy object to configure Entity Model to Entity Framework Core. /// /// - /// Don't describe properties they are being auto-described by the [CSM] engine, , and . + /// Don't describe properties they are being auto-described by the [CSM] engine, , and . /// protected internal virtual void DesignEntity(EntityTypeBuilder etBuilder) { } } \ No newline at end of file diff --git a/csharp_database_extension/DatabaseProxy/DatabaseProxy.cs b/csharp_database_extension/DatabaseProxy/DatabaseProxy.cs index 0350bf6..5cec6a7 100644 --- a/csharp_database_extension/DatabaseProxy/DatabaseProxy.cs +++ b/csharp_database_extension/DatabaseProxy/DatabaseProxy.cs @@ -1,5 +1,5 @@ -using CSM_Database_Core; -using CSM_Database_Core.Core.Models; +using CSharp_Database_Extension; +using CSharp_Database_Extension.Common.Models; using DatabaseProxy.Entities; @@ -14,7 +14,7 @@ public class DatabaseProxy : DatabaseBase { /// - public override string Sign { get; protected set; } = "CSMDQ"; + public override string Signature { get; protected set; } = "CSMDQ"; /// public DatabaseProxy() diff --git a/csharp_database_extension/DatabaseProxy/DatabaseProxy.csproj b/csharp_database_extension/DatabaseProxy/DatabaseProxy.csproj index db4ee23..7d34f83 100644 --- a/csharp_database_extension/DatabaseProxy/DatabaseProxy.csproj +++ b/csharp_database_extension/DatabaseProxy/DatabaseProxy.csproj @@ -14,7 +14,7 @@ - + diff --git a/csharp_database_extension/DatabaseProxy/DatabaseProxyDesignFactory.cs b/csharp_database_extension/DatabaseProxy/DatabaseProxyDesignFactory.cs index df30d77..4630595 100644 --- a/csharp_database_extension/DatabaseProxy/DatabaseProxyDesignFactory.cs +++ b/csharp_database_extension/DatabaseProxy/DatabaseProxyDesignFactory.cs @@ -1,25 +1,25 @@ -using CSM_Foundation_Core.Core.Utils; +using CSharp_Extension.Common.Utils; using Microsoft.EntityFrameworkCore.Design; -namespace CSM_Security_Database_Core; +namespace DatabaseProxy; /// /// EF Design time factory for /// internal class DatabaseProxyDesignFactory - : IDesignTimeDbContextFactory { + : IDesignTimeDbContextFactory { - public DatabaseProxy.DatabaseProxy CreateDbContext(string[] args) { + public DatabaseProxy CreateDbContext(string[] args) { ConsoleUtils.Warning( "Designing database using a design factory", new Dictionary { { "DesignFactory", GetType().FullName }, - { "Database", typeof(DatabaseProxy.DatabaseProxy).FullName }, + { "Database", typeof(DatabaseProxy).FullName }, } ); - return new DatabaseProxy.DatabaseProxy(); + return new DatabaseProxy(); } } diff --git a/csharp_database_extension/DatabaseProxy/DepotProxy.cs b/csharp_database_extension/DatabaseProxy/DepotProxy.cs index be208e7..b549561 100644 --- a/csharp_database_extension/DatabaseProxy/DepotProxy.cs +++ b/csharp_database_extension/DatabaseProxy/DepotProxy.cs @@ -1,7 +1,7 @@ -using CSM_Database_Core.Depots.Abstractions.Bases; -using CSM_Database_Core.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension; +using CSharp_Database_Extension.Depots.Abstractions.Bases; -using CSM_Foundation_Core.Abstractions.Interfaces; +using CSharp_Extension.Common.Abstractions.Interfaces; using DatabaseProxy.Entities; diff --git a/csharp_database_extension/DatabaseProxy/Entities/EntityDependantProxy.cs b/csharp_database_extension/DatabaseProxy/Entities/EntityDependantProxy.cs index 82aaa8b..2c8cea4 100644 --- a/csharp_database_extension/DatabaseProxy/Entities/EntityDependantProxy.cs +++ b/csharp_database_extension/DatabaseProxy/Entities/EntityDependantProxy.cs @@ -1,6 +1,6 @@ -using CSM_Database_Core; -using CSM_Database_Core.Core.Attributes; -using CSM_Database_Core.Core.Extensions; +using CSharp_Database_Extension; +using CSharp_Database_Extension.Common.Attributes; +using CSharp_Database_Extension.Common.Extensions; using Microsoft.EntityFrameworkCore.Metadata.Builders; diff --git a/csharp_database_extension/DatabaseProxy/Entities/EntityDependencyProxy.cs b/csharp_database_extension/DatabaseProxy/Entities/EntityDependencyProxy.cs index a5ee98c..fcaffa5 100644 --- a/csharp_database_extension/DatabaseProxy/Entities/EntityDependencyProxy.cs +++ b/csharp_database_extension/DatabaseProxy/Entities/EntityDependencyProxy.cs @@ -1,5 +1,5 @@ -using CSM_Database_Core; -using CSM_Database_Core.Core.Attributes; +using CSharp_Database_Extension; +using CSharp_Database_Extension.Common.Attributes; namespace DatabaseProxy.Entities; diff --git a/csharp_database_extension/DatabaseProxy/Entities/EntityProxy.cs b/csharp_database_extension/DatabaseProxy/Entities/EntityProxy.cs index af1d99c..5c37921 100644 --- a/csharp_database_extension/DatabaseProxy/Entities/EntityProxy.cs +++ b/csharp_database_extension/DatabaseProxy/Entities/EntityProxy.cs @@ -1,6 +1,6 @@ -using CSM_Database_Core; -using CSM_Database_Core.Core.Attributes; -using CSM_Database_Core.Core.Extensions; +using CSharp_Database_Extension; +using CSharp_Database_Extension.Common.Attributes; +using CSharp_Database_Extension.Common.Extensions; using Microsoft.EntityFrameworkCore.Metadata.Builders; diff --git a/csharp_database_extension/Integration Tests/Integration Tests.csproj b/csharp_database_extension/Integration Tests/Integration Tests.csproj index c28a224..e9bde07 100644 --- a/csharp_database_extension/Integration Tests/Integration Tests.csproj +++ b/csharp_database_extension/Integration Tests/Integration Tests.csproj @@ -21,8 +21,8 @@ - - + + diff --git a/csharp_database_extension/Integration Tests/Tests/DepotBaseTests.cs b/csharp_database_extension/Integration Tests/Tests/DepotBaseTests.cs index e16097f..dcbe36b 100644 --- a/csharp_database_extension/Integration Tests/Tests/DepotBaseTests.cs +++ b/csharp_database_extension/Integration Tests/Tests/DepotBaseTests.cs @@ -1,6 +1,5 @@ -using CSM_Database_Core.Depots.Abstractions.Bases; -using CSM_Database_Core.Depots.Models; -using CSM_Database_Core.Depots.Models.Structs; +using CSharp_Database_Extension.Depots.Models; +using CSharp_Database_Extension.Depots.Models.Structs; using CSM_Database_Testing.Abstractions.Bases; From 2d78a1c7573ad41c88a59983edde2c7ce648b377 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Tue, 13 Oct 2026 00:16:20 -0700 Subject: [PATCH 12/60] structuring multi providers --- .../Bases/DatabaseIntegrationTestsBase.cs | 6 +- .../Bases/DepotIntegrationTestsBase.cs | 8 +- .../Bases/EntityIntegrationTestsBase.cs | 2 +- .../Bases/TestingDataHandlerBase.cs | 8 +- .../Interfaces/ITestingDatabase.cs | 2 +- .../BaseDraftUtils.cs | 2 +- .../CHANGELOG.md | 275 ------------ .../CSharp Database Extension Testing.csproj | 2 +- .../Abstractions/Bases/TestingDisposerBase.cs | 4 +- .../Interfaces/ITestingDisposer.cs | 2 +- .../Disposing/TestingDisposer.cs | 4 +- .../Managers/TestingStoreManager.cs | 12 +- .../Abstractions/Bases/DatabaseBase.cs | 69 ++- .../CSharp Database Extension/CHANGELOG.md | 396 ------------------ .../CSharp Database Extension.csproj | 2 +- .../Bases/RelationAttributeBase.cs | 9 +- .../Interfaces/IRelationAttribute.cs | 9 +- .../Attributes/EntityRelationAttribute.cs | 4 +- .../Common/Models/DatabaseOptions.cs | 9 +- .../Depots/Abstractions/Bases/DepotBase.cs | 6 +- .../Entities/Abstractions/Bases/EntityBase.cs | 69 +-- .../Abstractions/Interfaces/IEntity.cs | 75 ++-- .../Models/EntityEvaluationFailure.cs | 37 ++ .../DatabaseProxy/DatabaseProxy.csproj | 6 - .../20260401220538_Init Db.Designer.cs | 29 -- .../Migrations/20260401220538_Init Db.cs | 22 - .../20260401221950_Init_Db_2.Designer.cs | 118 ------ .../Migrations/20260401221950_Init_Db_2.cs | 89 ---- ...260506231958_added_autoloading.Designer.cs | 133 ------ .../20260506231958_added_autoloading.cs | 51 --- ...20260506232702_added_renamings.Designer.cs | 133 ------ .../20260506232702_added_renamings.cs | 74 ---- ...0260506232938_added_attributes.Designer.cs | 133 ------ .../20260506232938_added_attributes.cs | 22 - ...60506233726_added_attributes_2.Designer.cs | 118 ------ .../20260506233726_added_attributes_2.cs | 51 --- ...230_standarized db for proxies.Designer.cs | 150 ------- ...260507000230_standarized db for proxies.cs | 85 ---- ...1_standarized db for proxies 2.Designer.cs | 137 ------ ...0507000851_standarized db for proxies 2.cs | 68 --- ...5_standarized db for proxies 3.Designer.cs | 126 ------ ...0507000955_standarized db for proxies 3.cs | 68 --- ...113_IncludingCascadingDeletion.Designer.cs | 126 ------ ...260619050113_IncludingCascadingDeletion.cs | 42 -- .../Migrations/DatabaseProxyModelSnapshot.cs | 123 ------ .../Tests/DatabaseBaseTests.cs | 6 + .../Integration Tests/Tests/DepotBaseTests.cs | 2 +- .../local.integration_tests.runsettings | 2 +- 48 files changed, 219 insertions(+), 2707 deletions(-) create mode 100644 csharp_database_extension/CSharp Database Extension/Entities/Validation/Models/EntityEvaluationFailure.cs delete mode 100644 csharp_database_extension/DatabaseProxy/Migrations/20260401220538_Init Db.Designer.cs delete mode 100644 csharp_database_extension/DatabaseProxy/Migrations/20260401220538_Init Db.cs delete mode 100644 csharp_database_extension/DatabaseProxy/Migrations/20260401221950_Init_Db_2.Designer.cs delete mode 100644 csharp_database_extension/DatabaseProxy/Migrations/20260401221950_Init_Db_2.cs delete mode 100644 csharp_database_extension/DatabaseProxy/Migrations/20260506231958_added_autoloading.Designer.cs delete mode 100644 csharp_database_extension/DatabaseProxy/Migrations/20260506231958_added_autoloading.cs delete mode 100644 csharp_database_extension/DatabaseProxy/Migrations/20260506232702_added_renamings.Designer.cs delete mode 100644 csharp_database_extension/DatabaseProxy/Migrations/20260506232702_added_renamings.cs delete mode 100644 csharp_database_extension/DatabaseProxy/Migrations/20260506232938_added_attributes.Designer.cs delete mode 100644 csharp_database_extension/DatabaseProxy/Migrations/20260506232938_added_attributes.cs delete mode 100644 csharp_database_extension/DatabaseProxy/Migrations/20260506233726_added_attributes_2.Designer.cs delete mode 100644 csharp_database_extension/DatabaseProxy/Migrations/20260506233726_added_attributes_2.cs delete mode 100644 csharp_database_extension/DatabaseProxy/Migrations/20260507000230_standarized db for proxies.Designer.cs delete mode 100644 csharp_database_extension/DatabaseProxy/Migrations/20260507000230_standarized db for proxies.cs delete mode 100644 csharp_database_extension/DatabaseProxy/Migrations/20260507000851_standarized db for proxies 2.Designer.cs delete mode 100644 csharp_database_extension/DatabaseProxy/Migrations/20260507000851_standarized db for proxies 2.cs delete mode 100644 csharp_database_extension/DatabaseProxy/Migrations/20260507000955_standarized db for proxies 3.Designer.cs delete mode 100644 csharp_database_extension/DatabaseProxy/Migrations/20260507000955_standarized db for proxies 3.cs delete mode 100644 csharp_database_extension/DatabaseProxy/Migrations/20260619050113_IncludingCascadingDeletion.Designer.cs delete mode 100644 csharp_database_extension/DatabaseProxy/Migrations/20260619050113_IncludingCascadingDeletion.cs delete mode 100644 csharp_database_extension/DatabaseProxy/Migrations/DatabaseProxyModelSnapshot.cs create mode 100644 csharp_database_extension/Integration Tests/Tests/DatabaseBaseTests.cs diff --git a/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/DatabaseIntegrationTestsBase.cs b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/DatabaseIntegrationTestsBase.cs index 76ad1ba..59edb85 100644 --- a/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/DatabaseIntegrationTestsBase.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/DatabaseIntegrationTestsBase.cs @@ -1,15 +1,15 @@ using CSharp_Database_Extension; using CSharp_Database_Extension.Common.Models; -using CSharp_Extension.Common.Extensions; +using CSharp_Database_Extension_Testing.Abstractions.Interfaces; -using CSM_Database_Testing.Abstractions.Interfaces; +using CSharp_Extension.Common.Extensions; using Microsoft.EntityFrameworkCore; using Xunit; -namespace CSM_Database_Testing.Abstractions.Bases; +namespace CSharp_Database_Extension_Testing.Abstractions.Bases; /// /// Represents a testing class for a Database context. diff --git a/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs index 53fd0a4..537c779 100644 --- a/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/DepotIntegrationTestsBase.cs @@ -8,13 +8,13 @@ using CSharp_Database_Extension.Depots.Models; using CSharp_Database_Extension.Depots.ViewFilters; -using CSM_Database_Testing.Disposing.Abstractions.Bases; -using CSM_Database_Testing.Managers; +using CSharp_Database_Extension_Testing.Disposing.Abstractions.Bases; +using CSharp_Database_Extension_Testing.Managers; using Xunit; using Xunit.Sdk; -namespace CSM_Database_Testing.Abstractions.Bases; +namespace CSharp_Database_Extension_Testing.Abstractions.Bases; /// /// Represents a testing base class for a data source depot. @@ -196,7 +196,7 @@ protected async Task Sampling() { /// This instance collection is created but not stored in the database. /// protected async Task Sampling(int Count) { - List samples = new List(); + List samples = []; for (int i = 0; i < Count; i++) { samples.Add(await TestingStoreManager.RunEntityFactory(EntityFactory)); } diff --git a/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/EntityIntegrationTestsBase.cs b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/EntityIntegrationTestsBase.cs index b9c68b5..eed1a98 100644 --- a/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/EntityIntegrationTestsBase.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/EntityIntegrationTestsBase.cs @@ -1,7 +1,7 @@ using CSharp_Database_Extension; using CSharp_Database_Extension.Entities.Validation.Abstractions.Bases; -namespace CSM_Database_Testing.Abstractions.Bases; +namespace CSharp_Database_Extension_Testing.Abstractions.Bases; /// /// Represents an integration tests class for implementations. diff --git a/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/TestingDataHandlerBase.cs b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/TestingDataHandlerBase.cs index a7b0e14..9d502f7 100644 --- a/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/TestingDataHandlerBase.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Bases/TestingDataHandlerBase.cs @@ -1,10 +1,10 @@ using CSharp_Database_Extension; -using CSM_Database_Testing.Disposing; -using CSM_Database_Testing.Disposing.Abstractions.Bases; -using CSM_Database_Testing.Managers; +using CSharp_Database_Extension_Testing.Disposing; +using CSharp_Database_Extension_Testing.Disposing.Abstractions.Bases; +using CSharp_Database_Extension_Testing.Managers; -namespace CSM_Database_Testing.Abstractions.Bases; +namespace CSharp_Database_Extension_Testing.Abstractions.Bases; /// /// Public Delegate for Asynchronous [Entity] factory [Quality] purposes. diff --git a/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Interfaces/ITestingDatabase.cs b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Interfaces/ITestingDatabase.cs index 21ca231..3ba5874 100644 --- a/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Interfaces/ITestingDatabase.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/Abstractions/Interfaces/ITestingDatabase.cs @@ -1,4 +1,4 @@ -namespace CSM_Database_Testing.Abstractions.Interfaces; +namespace CSharp_Database_Extension_Testing.Abstractions.Interfaces; /// /// Interface Quality for [MigrationDatabases]. /// diff --git a/csharp_database_extension/CSharp Database Extension Testing/BaseDraftUtils.cs b/csharp_database_extension/CSharp Database Extension Testing/BaseDraftUtils.cs index 07c97aa..0e9483c 100644 --- a/csharp_database_extension/CSharp Database Extension Testing/BaseDraftUtils.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/BaseDraftUtils.cs @@ -3,7 +3,7 @@ using CSharp_Extension.Common.Utils; -namespace CSM_Database_Testing; +namespace CSharp_Database_Extension_Testing; /// /// Provide utils methods for entities bases drafting diff --git a/csharp_database_extension/CSharp Database Extension Testing/CHANGELOG.md b/csharp_database_extension/CSharp Database Extension Testing/CHANGELOG.md index b53cdbe..e69de29 100644 --- a/csharp_database_extension/CSharp Database Extension Testing/CHANGELOG.md +++ b/csharp_database_extension/CSharp Database Extension Testing/CHANGELOG.md @@ -1,275 +0,0 @@ -# CSM Database Testing CHANGELOG - -## [x.x.x] - xx.xx-xxxx - -### Changes - -- The following methods were converted from sync to async in CSM Database Testing: - - - EntityFactory. - - Sampling. - - RunEntityFactory. - -- Added Get() method to [TestingStoreManager] for entity persistence validation. - -- Added persistence validations for Delete tests in [DepotIntegrationTests]. - -### Breaks - -- The EntityFactory() method in [DepotIntegrationTestsBase] is now asynchronous and must be awaited. - -## [7.0.2] - 18.06-2026 - -### Removed - -- Removed drafting for [CatalogEntity] and [ReferencedEntity] since they were removed at version [7.0.0] of [CSM Database Core]. - -### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 4.0.0 | 4.0.0 | -| xunit.v3 | 3.2.2 | 3.2.2 | - -## [7.0.2] - 18.06-2026 - -### Fixed - -- Fixed code style - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.1.0 | 4.0.0 | -| xunit.v3 | 3.2.2 | 3.2.2 | - -## [7.0.1] - 18.06-2026 - -### Fixed - -- Fixed some [Store] method errors at [TestingStoreManager] that were missing entity sanitization logic. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.1.0 | 4.0.0 | -| xunit.v3 | 3.2.2 | 3.2.2 | - -## [7.0.0] - 18.06-2026 - -### Fixed - -- Exposing as virtual some missing test cases from [DepotTestsBase]. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.1.0 | 4.0.0 | -| xunit.v3 | 3.2.2 | 3.2.2 | - -## [6.0.0] - 19.05-2026 - -### Changes - -- Updated [TestingStoreManager] to handle sanitized data for integration testing iterations. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.1.0 | 4.0.0 | -| xunit.v3 | 3.2.2 | 3.2.2 | - -## [5.1.0] - 16.03-2026 - -### Changes - -- Now testing base methods names have a better description of the test itself. -- Now [Update_Success] tests is required to be implemented since there're special checks. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.1.0 | 2.1.0 | -| xunit.v3 | 3.2.2 | 3.2.2 | - -## [5.0.1] - 16.03-2026 - -### Changed - -- Exposed package documentation. -- Added solution documentation. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.1.0 | 2.1.0 | -| xunit.v3 | 3.2.2 | 3.2.2 | - -## [5.0.0] - 15.02-2026 - -### Changed - -- Removed [xunit] and [SkippableFact] packages for [xunit.v3] upgrade. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.1.0 | 2.1.0 | -| xunit.v3 | -.-.- | 3.2.2 | -| xunit | x.x.x | x.x.x | - -## [4.1.1] - 24.12-2025 - -### Changed - -- Updated packages and framework. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.0.0 | 2.1.0 | -| xunit | 2.9.3 | 2.9.3 | -| xunit.SkippableFact | 1.5.23 | 1.5.23 | - -## [4.1.1] - 22.12-2025 - -### Changed - -- Updated packages and framework. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.0.0 | 2.0.0 | -| xunit | 2.9.3 | 2.9.3 | -| xunit.SkippableFact | 1.5.23 | 1.5.23 | - -## [4.1.0] - 16.12-2025 - -### Added - -- Added new [BaseDraftUtils] to draft entities based on their base classes, simplifying data mocking. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.0.0 | 2.0.0 | -| xunit | 2.9.3 | 2.9.3 | -| xunit.SkippableFact | 1.5.23 | 1.5.23 | - -## [4.0.0] - 11.12-2025 - -### Changed - -- Reverted and removed version [3.0.0], the interface are not needed in this context abstraction level - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 1.3.1 | 2.0.0 | -| xunit | 2.9.3 | 2.9.3 | -| xunit.SkippableFact | 1.5.23 | 1.5.23 | - -## [3.0.0] - 11.12-2025 - -### Changed - -- Changed [TestDepotBase] to handle correctly interfacing for operations. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 1.3.1 | 2.0.0 | -| xunit | 2.9.3 | 2.9.3 | -| xunit.SkippableFact | 1.5.23 | 1.5.23 | - -## [2.1.0] - 26.11-2025 - -### Changed - -- Added database activation for testing purposes. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 1.3.1 | 1.3.0 | -| xunit | 2.9.3 | 2.9.3 | -| xunit.SkippableFact | 1.5.23 | 1.5.23 | - -## [2.0.2] - 25.11-2025 - -### Changed - -- Removed unnecessary param from [TestingDepotBase] Sign. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 1.3.1 | 1.3.0 | -| xunit | 2.9.3 | 2.9.3 | -| xunit.SkippableFact | 1.5.23 | 1.5.23 | - -## [2.0.1] - 25.11-2025 - -### Changed - -- Simplified access for testing database activation using signature property. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 1.3.1 | 1.3.0 | -| xunit | 2.9.3 | 2.9.3 | -| xunit.SkippableFact | 1.5.23 | 1.5.23 | - -## [2.0.0] - 24.11-2025 - -### Added - -- Package initialization. - -### Changed - -- Renaming of abstractions and organization. -- Renaming of [Q_EntityValidations] to [TestingEntityBase] - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 1.2.1 | 1.3.0 | -| xunit | 2.9.3 | 2.9.3 | -| xunit.SkippableFact | --.--.-- | 1.5.23 | - - -## [1.0.0] - 06.08-2025 - -### Added - -- Package initialization. - -### Fixed - -### Changed - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | --.--.-- | 1.2.1 | -| xunit | --.--.-- | 2.9.3 | \ No newline at end of file diff --git a/csharp_database_extension/CSharp Database Extension Testing/CSharp Database Extension Testing.csproj b/csharp_database_extension/CSharp Database Extension Testing/CSharp Database Extension Testing.csproj index 5b86424..25672d8 100644 --- a/csharp_database_extension/CSharp Database Extension Testing/CSharp Database Extension Testing.csproj +++ b/csharp_database_extension/CSharp Database Extension Testing/CSharp Database Extension Testing.csproj @@ -1,7 +1,7 @@  - 1.0.0 + $(GitVersion) CSharp.Database.Extension.Testing CSharp_Database_Extension_Testing diff --git a/csharp_database_extension/CSharp Database Extension Testing/Disposing/Abstractions/Bases/TestingDisposerBase.cs b/csharp_database_extension/CSharp Database Extension Testing/Disposing/Abstractions/Bases/TestingDisposerBase.cs index 97356a1..f292403 100644 --- a/csharp_database_extension/CSharp Database Extension Testing/Disposing/Abstractions/Bases/TestingDisposerBase.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/Disposing/Abstractions/Bases/TestingDisposerBase.cs @@ -3,12 +3,12 @@ using CSharp_Database_Extension; using CSharp_Database_Extension.Entities.Abstractions.Interfaces; -using CSM_Database_Testing.Disposing.Abstractions.Interfaces; +using CSharp_Database_Extension_Testing.Disposing.Abstractions.Interfaces; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; -namespace CSM_Database_Testing.Disposing.Abstractions.Bases; +namespace CSharp_Database_Extension_Testing.Disposing.Abstractions.Bases; /// /// Database context factory delegate. diff --git a/csharp_database_extension/CSharp Database Extension Testing/Disposing/Abstractions/Interfaces/ITestingDisposer.cs b/csharp_database_extension/CSharp Database Extension Testing/Disposing/Abstractions/Interfaces/ITestingDisposer.cs index 0edb57d..ba1f25f 100644 --- a/csharp_database_extension/CSharp Database Extension Testing/Disposing/Abstractions/Interfaces/ITestingDisposer.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/Disposing/Abstractions/Interfaces/ITestingDisposer.cs @@ -2,7 +2,7 @@ using CSharp_Extension.Common.Abstractions.Interfaces; -namespace CSM_Database_Testing.Disposing.Abstractions.Interfaces; +namespace CSharp_Database_Extension_Testing.Disposing.Abstractions.Interfaces; /// /// Represents a testing data disposer context handler. diff --git a/csharp_database_extension/CSharp Database Extension Testing/Disposing/TestingDisposer.cs b/csharp_database_extension/CSharp Database Extension Testing/Disposing/TestingDisposer.cs index bc98167..2d38cdf 100644 --- a/csharp_database_extension/CSharp Database Extension Testing/Disposing/TestingDisposer.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/Disposing/TestingDisposer.cs @@ -1,6 +1,6 @@ -using CSM_Database_Testing.Disposing.Abstractions.Bases; +using CSharp_Database_Extension_Testing.Disposing.Abstractions.Bases; -namespace CSM_Database_Testing.Disposing; +namespace CSharp_Database_Extension_Testing.Disposing; /// public class TestingDisposer diff --git a/csharp_database_extension/CSharp Database Extension Testing/Managers/TestingStoreManager.cs b/csharp_database_extension/CSharp Database Extension Testing/Managers/TestingStoreManager.cs index 0124ff2..e2c6efa 100644 --- a/csharp_database_extension/CSharp Database Extension Testing/Managers/TestingStoreManager.cs +++ b/csharp_database_extension/CSharp Database Extension Testing/Managers/TestingStoreManager.cs @@ -1,16 +1,16 @@ using CSharp_Database_Extension; using CSharp_Database_Extension.Common.Utils; -using CSharp_Extension.Common.Utils; +using CSharp_Database_Extension_Testing.Abstractions.Bases; +using CSharp_Database_Extension_Testing.Disposing; +using CSharp_Database_Extension_Testing.Disposing.Abstractions.Bases; +using CSharp_Database_Extension_Testing.Disposing.Abstractions.Interfaces; -using CSM_Database_Testing.Abstractions.Bases; -using CSM_Database_Testing.Disposing; -using CSM_Database_Testing.Disposing.Abstractions.Bases; -using CSM_Database_Testing.Disposing.Abstractions.Interfaces; +using CSharp_Extension.Common.Utils; using Microsoft.EntityFrameworkCore; -namespace CSM_Database_Testing.Managers; +namespace CSharp_Database_Extension_Testing.Managers; /// /// Represents a testing data storing methods manager. diff --git a/csharp_database_extension/CSharp Database Extension/Abstractions/Bases/DatabaseBase.cs b/csharp_database_extension/CSharp Database Extension/Abstractions/Bases/DatabaseBase.cs index 32539d4..b817e83 100644 --- a/csharp_database_extension/CSharp Database Extension/Abstractions/Bases/DatabaseBase.cs +++ b/csharp_database_extension/CSharp Database Extension/Abstractions/Bases/DatabaseBase.cs @@ -5,7 +5,7 @@ using CSharp_Database_Extension.Common.Errors; using CSharp_Database_Extension.Common.Models; using CSharp_Database_Extension.Common.Utils; -using CSharp_Database_Extension.Entities.Abstractions.Interfaces; +using CSharp_Database_Extension.Entities.Validation.Models; using CSharp_Extension.Common.Utils; @@ -18,12 +18,12 @@ namespace CSharp_Database_Extension; /// /// Represents a Database Model. /// -/// +/// /// Type of the database model. /// -public abstract partial class DatabaseBase +public abstract partial class DatabaseBase : DbContext, IDatabase - where TDatabases : DbContext { + where TDatabase : DbContext { /// public virtual string Signature { get; protected set; } = ""; @@ -34,13 +34,13 @@ public abstract partial class DatabaseBase /// /// Database model options. /// - public DatabaseOptions Options { get; init; } + public DatabaseOptions Options { get; init; } /// /// Creates a new instance. /// public DatabaseBase() { - Options = new DatabaseOptions(); + Options = new DatabaseOptions(); CompleteOptions(); } @@ -50,7 +50,7 @@ public DatabaseBase() { /// /// EF Database context options. /// - public DatabaseBase(DatabaseOptions databaseOptions) + public DatabaseBase(DatabaseOptions databaseOptions) : base(databaseOptions.DbContextOptions ?? new()) { Options = databaseOptions; @@ -141,19 +141,18 @@ protected EntityBase[] GetEntityModels() { protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { string connectionString = Options.ConnectionOptions!.ConnectionString; - string assemblyNamespace = $"{GetType().Assembly.GetName().Name}.Migrations"; - + string migrationsAssembly = $"{GetType().Assembly.GetName().Name}.Migrations"; switch (Options.Provider) { case DatabaseProviders.SQLServer: optionsBuilder.UseSqlServer( connectionString, - builder => builder.MigrationsAssembly($"{assemblyNamespace}.SQLServer") + builder => builder.MigrationsAssembly($"{migrationsAssembly}.SQLServer") ); break; case DatabaseProviders.PostgreSQL: optionsBuilder.UseNpgsql( connectionString, - builder => builder.MigrationsAssembly($"{assemblyNamespace}.PostgreSQL") + builder => builder.MigrationsAssembly($"{migrationsAssembly}.PostgreSQL") ); break; } @@ -231,24 +230,6 @@ protected virtual void DesignEntity(EntityBase entity, EntityTypeBuilder mBuilde /// protected virtual void DesignDatabase(ModelBuilder mBuilder) { } - /// - /// Completes missing values that are auto-loaded - /// by system properties or values calculated at runtime. - /// - /// - /// Important process, is required to be called in each constructor of this class. - /// - void CompleteOptions() { - Options.Signature ??= Signature; - - // When current options provider is the default one. - if (Options.Provider == DatabaseProviders.PostgreSQL) { - Options.Provider = Provider; - } - - Options.ConnectionOptions ??= DatabaseUtils.GetConnectionOptions(Signature, Options.ForTesting); - } - /// /// Validate database entity models. /// @@ -269,20 +250,20 @@ bool ValidateEntityModels(bool strict = true) { ); } - Exception[] evResults = []; + EntityEvaluationFailure[] evResults = []; foreach (EntityBase entity in defs) { - Exception[] result = entity.EvaluateModel(); - if (result.Length > 0 && logsOn) { + EntityEvaluationFailure[] modelFailures = entity.EvaluateModel(); + if (modelFailures.Length > 0 && logsOn) { ConsoleUtils.Warning( "Wrong [Entity Model] definition", new() { { "Entity Model", entity.GetType().Name }, - { "Result", result }, + { "Result", modelFailures }, } ); } - evResults = [.. evResults, .. result]; + evResults = [.. evResults, .. modelFailures]; } if (evResults.Length > 0) { @@ -298,6 +279,24 @@ bool ValidateEntityModels(bool strict = true) { return true; } + /// + /// Completes missing values that are auto-loaded + /// by system properties or values calculated at runtime. + /// + /// + /// Important process, is required to be called in each constructor of this class. + /// + void CompleteOptions() { + Options.Signature ??= Signature; + + // When current options provider is the default one. + if (Options.Provider == DatabaseProviders.PostgreSQL) { + Options.Provider = Provider; + } + + Options.ConnectionOptions ??= DatabaseUtils.GetConnectionOptions(Signature, Options.ForTesting); + } + /// /// Design business interfacing for business entities with their defined properties and behavior. /// @@ -333,7 +332,7 @@ static void DesignEntityModelInterfaces(EntityTypeBuilder etBuilder, EntityBase } } -/// +/// public abstract partial class EntityBase { /// diff --git a/csharp_database_extension/CSharp Database Extension/CHANGELOG.md b/csharp_database_extension/CSharp Database Extension/CHANGELOG.md index 4d90278..e69de29 100644 --- a/csharp_database_extension/CSharp Database Extension/CHANGELOG.md +++ b/csharp_database_extension/CSharp Database Extension/CHANGELOG.md @@ -1,396 +0,0 @@ -# CSM Database Core CHANGELOG - -## [7.0.0] - 21.07-2026 - -### Changes - -- Now when database connection options weren't found on app assemblies a detailed console message is displayed on Design an Development time. - -### Breaks - -- Now [NamedEntity] have new properties definitions. - - - [Description]: Now it doesn't have length limit. - - [Name]: Now is unique along entities. - -- Renamed [DatabaseDesignFactoryBase] to [DatabaseDesignerBase] to keep shorter naming conventions with sense. -- Removed [CatalogEntity] and [ReferencedEntity] since [NamedEntities] have enough properties to deteermine an entity efficient search and constant referencing. - -### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 4.0.0 | 4.0.0 | -| Microsoft.EntityFrameworkCore | 10.0.9 | 10.0.10 | -| Microsoft.EntityFrameworkCore.SqlServer | 10.0.9 | 10.0.10 | - -## [6.1.0] - 24.06-2026 - -### Changes - -- Now relations are able to be added no matter what direction of relationship they have at update operations. - -### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 4.0.0 | 4.0.0 | -| Microsoft.EntityFrameworkCore | 10.0.8 | 10.0.9 | -| Microsoft.EntityFrameworkCore.SqlServer | 10.0.8 | 10.0.9 | - -## [6.0.6] - 18.06-2026 - -### Fixes - -- Fixed [DepotBase] [Update] method issue for a safe entity relation update just when the Ids are different. - -### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 4.0.0 | 4.0.0 | -| Microsoft.EntityFrameworkCore | 10.0.8 | 10.0.9 | -| Microsoft.EntityFrameworkCore.SqlServer | 10.0.8 | 10.0.9 | - -## [6.0.5] - 18.06-2026 - -### Fixes - -- Fixed [DepotBase] [Update] method issue for a safe entity relation update just when the Ids are different. - -### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 4.0.0 | 4.0.0 | -| Microsoft.EntityFrameworkCore | 10.0.8 | 10.0.9 | -| Microsoft.EntityFrameworkCore.SqlServer | 10.0.8 | 10.0.9 | - -## [6.0.4] - 18.06-2026 - -### Fixes - -- Fixed [DepotBase] [Update] method issue that was causing not relation inclussion on original entity object. - -### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 4.0.0 | 4.0.0 | -| Microsoft.EntityFrameworkCore | 10.0.8 | 10.0.9 | -| Microsoft.EntityFrameworkCore.SqlServer | 10.0.8 | 10.0.9 | - -## [6.0.3] - 18.06-2026 - -### Fixes - -- Fixed [DepotBase] [Update] method issue that was causing miss calculation of Flat relations upgrading. - -### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 4.0.0 | 4.0.0 | -| Microsoft.EntityFrameworkCore | 10.0.8 | 10.0.9 | -| Microsoft.EntityFrameworkCore.SqlServer | 10.0.8 | 10.0.9 | - -## [6.0.2] - 18.06-2026 - -### Fixes - -- Fixed [SanitizeEntity] issue that was causing wrong relation detections for collections. Removed deprecated dependants logic. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 4.0.0 | 4.0.0 | -| Microsoft.EntityFrameworkCore | 10.0.8 | 10.0.9 | -| Microsoft.EntityFrameworkCore.SqlServer | 10.0.8 | 10.0.9 | - -## [6.0.1] - 18.06-2026 - -### Fixes - -- Fixed [SanitizeEntity] issue that was causing wrong relation detections for collections. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 4.0.0 | 4.0.0 | -| Microsoft.EntityFrameworkCore | 10.0.8 | 10.0.9 | -| Microsoft.EntityFrameworkCore.SqlServer | 10.0.8 | 10.0.9 | - -## [6.0.0] - 18.06-2026 - -### Fixes - -- Fixed [SanitizeEntity] issue that was causing wrong relation detections for collections. - -### Removed - -- Removed [EntityDependencyAttribute] and [EntityDependantAttribute] now we only use [EntityRelation]. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 4.0.0 | 4.0.0 | -| Microsoft.EntityFrameworkCore | 10.0.8 | 10.0.9 | -| Microsoft.EntityFrameworkCore.SqlServer | 10.0.8 | 10.0.9 | - -## [5.0.0] - 18.06-2026 - -### Changes - -- Removed [IRelationAttribute] unnecessary members. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 4.0.0 | 4.0.0 | -| Microsoft.EntityFrameworkCore | 10.0.8 | 10.0.9 | -| Microsoft.EntityFrameworkCore.SqlServer | 10.0.8 | 10.0.9 | - -## [4.4.0] - 19.05-2026 - -### Changes - -- Reworked [Update] operations along depots for a easy management - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.1.0 | 4.0.0 | -| Microsoft.EntityFrameworkCore | 10.0.5 | 10.0.8 | -| Microsoft.EntityFrameworkCore.SqlServer | 10.0.5 | 10.0.8 | - -## [4.3.1] - 16.03-2026 - -### Changes - -- Exposed package documentation. -- Added solution documentation. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.1.0 | 2.1.0 | -| Microsoft.EntityFrameworkCore | 10.0.3 | 10.0.5 | -| Microsoft.EntityFrameworkCore.SqlServer | 10.0.3 | 10.0.5 | - -## [4.3.0] - 16.02-2026 - -### Fixed - -- Added [EntityBase{IEntity}] to correctly implement [Clone] features from [ObjectBase]. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.1.0 | 2.1.0 | -| Microsoft.EntityFrameworkCore | 10.0.3 | 10.0.3 | -| Microsoft.EntityFrameworkCore.SqlServer | 10.0.3 | 10.0.3 | - -## [4.2.3] - 13.02-2026 - -### Fixed - -- Fixed an issue with [EntityError] that was not passing the [Exception] caught to its base, causing error handling errors. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.0.0 | 2.1.0 | -| Microsoft.EntityFrameworkCore | 10.0.1 | 10.0.3 | -| Microsoft.EntityFrameworkCore.SqlServer | 10.0.1 | 10.0.3 | - -## [4.2.0] - 29.01-2026 - -### Patched - -- Patched an error that was throwing errors about never finding connection options for Databases when searching at application assemblies. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.0.0 | 2.1.0 | -| Microsoft.EntityFrameworkCore | 9.0.8 | 10.0.1 | -| Microsoft.EntityFrameworkCore.SqlServer | 9.0.8 | 10.0.1 | - -## [4.1.2] - 24.12-2025 - -### Patched - -- Patched connection options tracing when the file is configured at machine / user environment variables. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.0.0 | 2.1.0 | -| Microsoft.EntityFrameworkCore | 9.0.8 | 10.0.1 | -| Microsoft.EntityFrameworkCore.SqlServer | 9.0.8 | 10.0.1 | - -## [4.1.1] - 22.12-2025 - -### Patched - -- Patched the way DatabaseUtils were locating connection options automatically for database context building, now using the correct application directory and not the assembly directory. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.0.0 | 2.0.0 | -| Microsoft.EntityFrameworkCore | 9.0.8 | 10.0.1 | -| Microsoft.EntityFrameworkCore.SqlServer | 9.0.8 | 10.0.1 | - -## [4.1.0] - 22.12-2025 - -### Added - -- Added a base class for database design ef context handling. - -### Changed - -- Updated packages and framework. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.0.0 | 2.0.0 | -| Microsoft.EntityFrameworkCore | 9.0.8 | 10.0.1 | -| Microsoft.EntityFrameworkCore.SqlServer | 9.0.8 | 10.0.1 | - -## [4.0.0] - 11.12-2025 - -### Changed - -- Reverted and removed version [3.0.0] interface concept is not needed in this abstraction layer. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.0.0 | 2.0.0 | -| Microsoft.EntityFrameworkCore | 9.0.8 | 9.0.8 | -| Microsoft.EntityFrameworkCore.SqlServer | 9.0.8 | 9.0.8 | - -## [3.0.0] - 26.11-2025 - -### Changed - -- Now DepotBase operations are based on interfaces trading instead of object classes. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.0.0 | 2.0.0 | -| Microsoft.EntityFrameworkCore | 9.0.8 | 9.0.8 | -| Microsoft.EntityFrameworkCore.SqlServer | 9.0.8 | 9.0.8 | - -## [2.1.0] - 26.11-2025 - -### Changed - -- Database activation based on testing purposes. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.0.0 | 2.0.0 | -| Microsoft.EntityFrameworkCore | 9.0.8 | 9.0.8 | -| Microsoft.EntityFrameworkCore.SqlServer | 9.0.8 | 9.0.8 | - - -## [2.0.1] - 25.11-2025 - -### Changed - -- Repository name. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 2.0.0 | 2.0.0 | -| Microsoft.EntityFrameworkCore | 9.0.8 | 9.0.8 | -| Microsoft.EntityFrameworkCore.SqlServer | 9.0.8 | 9.0.8 | - -## [2.0.0] - 24.11-2025 - -### Changed - -- File and abstraction organizations. -- Renaming of concepts. -- Added a way to get the [Sign] directly from [IDatabase] fro Testing Classes. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 1.3.0 | 2.0.0 | -| Microsoft.EntityFrameworkCore | 9.0.8 | 9.0.8 | -| Microsoft.EntityFrameworkCore.SqlServer | 9.0.8 | 9.0.8 | - -## [1.2.0] - 03.09-2025 - -### Added - -- A new [BActivableEntity] / [IActivableEntity] base added, that indicates an entity has [IsEnabled] property indicating if the object is enabled or no. - -- A new [BCatalogEntity] / [ICatalogEntity] base added, that indicates an entity is catalog referenced, meaning it has [Name], [Description], [IsEnabled] and a [Reference]. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 1.3.0 | 1.3.0 | -| Microsoft.EntityFrameworkCore | 9.0.8 | 9.0.8 | -| Microsoft.EntityFrameworkCore.SqlServer | 9.0.8 | 9.0.8 | - -## [1.1.0] - 06.08-2025 - -### Added - -- A new [ActivationReference] attribute was created to handle database contexts DbSet usage with interfaces setting a default reference as the activation at the database activation process. - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | 1.2.1 | 1.3.0 | -| Microsoft.EntityFrameworkCore | 9.0.8 | 9.0.8 | -| Microsoft.EntityFrameworkCore.SqlServer | 9.0.8 | 9.0.8 | - -## [1.0.0] - 06.08-2025 - -### Added - -- Package initialization. - -### Fixed - -### Changed - -#### Dependencies - -| Package | Previous Version | New Version | -|:----------------------------------------|:----------------:|:---------------:| -| CSM.Foundation.Core | --.--.-- | 1.2.1 | -| Microsoft.EntityFrameworkCore | --.--.-- | 9.0.8 | -| Microsoft.EntityFrameworkCore.SqlServer | --.--.-- | 9.0.8 | -| xunit | --.--.-- | 2.9.3 | - -### Removed diff --git a/csharp_database_extension/CSharp Database Extension/CSharp Database Extension.csproj b/csharp_database_extension/CSharp Database Extension/CSharp Database Extension.csproj index 1ffe6d4..80a6fa9 100644 --- a/csharp_database_extension/CSharp Database Extension/CSharp Database Extension.csproj +++ b/csharp_database_extension/CSharp Database Extension/CSharp Database Extension.csproj @@ -1,7 +1,7 @@  - 1.0.0 + $(GitVersion) CSharp.Database.Extension CSharp_Database_Extension diff --git a/csharp_database_extension/CSharp Database Extension/Common/Attributes/Abstractions/Bases/RelationAttributeBase.cs b/csharp_database_extension/CSharp Database Extension/Common/Attributes/Abstractions/Bases/RelationAttributeBase.cs index ef5409c..3f81819 100644 --- a/csharp_database_extension/CSharp Database Extension/Common/Attributes/Abstractions/Bases/RelationAttributeBase.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Attributes/Abstractions/Bases/RelationAttributeBase.cs @@ -9,13 +9,20 @@ public abstract class RelationAttributeBase /// public string? Name { get; set; } + /// + public bool IsCrossDatabase { get; set; } + /// /// Creates a new instance. /// /// /// Relation's name. /// - public RelationAttributeBase(string? name = null) { + /// + /// Whether the relation references an entity on a different database. + /// + public RelationAttributeBase(string? name = null, bool isCrossDatabase = false) { Name = name; + IsCrossDatabase = isCrossDatabase; } } diff --git a/csharp_database_extension/CSharp Database Extension/Common/Attributes/Abstractions/Interfaces/IRelationAttribute.cs b/csharp_database_extension/CSharp Database Extension/Common/Attributes/Abstractions/Interfaces/IRelationAttribute.cs index 3f7a14c..908926f 100644 --- a/csharp_database_extension/CSharp Database Extension/Common/Attributes/Abstractions/Interfaces/IRelationAttribute.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Attributes/Abstractions/Interfaces/IRelationAttribute.cs @@ -2,14 +2,17 @@ namespace CSharp_Database_Extension.Common.Attributes.Abstractions.Interfaces; - /// /// Represents an relation attribute. /// public interface IRelationAttribute { - /// /// Relation name. /// - public string? Name { get; set; } + string? Name { get; set; } + + /// + /// Wheter this relation references an entity on a different database. + /// + bool IsCrossDatabase { get; set; } } diff --git a/csharp_database_extension/CSharp Database Extension/Common/Attributes/EntityRelationAttribute.cs b/csharp_database_extension/CSharp Database Extension/Common/Attributes/EntityRelationAttribute.cs index 4354bc1..b7db1de 100644 --- a/csharp_database_extension/CSharp Database Extension/Common/Attributes/EntityRelationAttribute.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Attributes/EntityRelationAttribute.cs @@ -10,7 +10,7 @@ public class EntityRelationAttribute : RelationAttributeBase { /// - public EntityRelationAttribute(string? name = null) - : base(name) { + public EntityRelationAttribute(string? name = null, bool isCrossDatabase = false) + : base(name, isCrossDatabase) { } } diff --git a/csharp_database_extension/CSharp Database Extension/Common/Models/DatabaseOptions.cs b/csharp_database_extension/CSharp Database Extension/Common/Models/DatabaseOptions.cs index 39c68a6..a9b37c5 100644 --- a/csharp_database_extension/CSharp Database Extension/Common/Models/DatabaseOptions.cs +++ b/csharp_database_extension/CSharp Database Extension/Common/Models/DatabaseOptions.cs @@ -1,4 +1,6 @@ -using CSharp_Database_Extension.Common.Enums; +using System.Reflection; + +using CSharp_Database_Extension.Common.Enums; using Microsoft.EntityFrameworkCore; @@ -15,6 +17,11 @@ public partial record DatabaseOptions /// public string? Signature { get; set; } + /// + /// Migrations assembly to use. + /// + public Assembly? Migrations { get; set; } + /// /// Database provider. /// diff --git a/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Bases/DepotBase.cs b/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Bases/DepotBase.cs index 76c2c90..4424395 100644 --- a/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Bases/DepotBase.cs +++ b/csharp_database_extension/CSharp Database Extension/Depots/Abstractions/Bases/DepotBase.cs @@ -124,7 +124,7 @@ public virtual async Task Create(TEntity entity) { TEntity instEntity = entity; instEntity.Timestamp = DateTime.UtcNow; - instEntity.EvaluateWrite(); + instEntity.EvaluateData(); instEntity = await DatabaseUtils.SanitizeEntity(_db, instEntity); await _dbSet.AddAsync(instEntity); @@ -171,7 +171,7 @@ public async Task Read(long id) { .FirstOrDefaultAsync() ?? throw new DepotError(DepotErrorEvents.UNFOUND, $"{nameof(IEntity.Id)} = {id}"); - entity.EvaluateRead(); + entity.EvaluateData(); return entity; } @@ -230,7 +230,7 @@ public async Task> Read(QueryInput> errors = []; foreach (TEntity item in resultItems) { try { - item.EvaluateRead(); + item.EvaluateData(); successes.Add(item); } catch (Exception exception) { EntityError error = new(EntityErrorEvents.READ_VALIDATION_FAILED, item, exception); diff --git a/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/EntityBase.cs b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/EntityBase.cs index 3e32de8..d8b217c 100644 --- a/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/EntityBase.cs +++ b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Bases/EntityBase.cs @@ -2,16 +2,27 @@ using System.Reflection; using System.Text.Json.Serialization; -using CSharp_Database_Extension.Entities.Abstractions.Interfaces; using CSharp_Database_Extension.Entities.Validation.Abstractions.Bases; +using CSharp_Database_Extension.Entities.Validation.Models; using CSharp_Extension.Common.Abstractions.Bases; namespace CSharp_Database_Extension; -/// -/// Represents a business entity. -/// +/// +public abstract partial class EntityBase + : EntityBase, IEntity + where TStatus : class, IEntity + where TUser : class, IEntity { + + /// + public TStatus SystemStatus { get; set; } = default!; + + /// + public TUser EntityOwner { get; set; } = default!; +} + +/// public abstract partial class EntityBase : ObjectBase, IEntity { @@ -27,19 +38,18 @@ public abstract partial class EntityBase #endregion - /// public long Id { get; set; } - /// - public DateTime Timestamp { get; set; } = DateTime.UtcNow; - /// public string Name { get; set; } = string.Empty; /// public string? Description { get; set; } + /// + public DateTime Timestamp { get; set; } = DateTime.UtcNow; + /// /// Creates a new instance. /// @@ -48,8 +58,7 @@ public EntityBase() { } /// - protected void Evaluate() { - + public void EvaluateData() { foreach (PropertyInfo property in GetType().GetProperties()) { IEnumerable attributes = property.GetCustomAttributes(); @@ -57,27 +66,37 @@ protected void Evaluate() { return; foreach (ValidatorBase validator in attributes) { - try { - validator.Validate(this); - } catch { - - } + validator.Validate(this); } } } /// - public void EvaluateRead() { - Evaluate(); - } + public EntityEvaluationFailure[] EvaluateModel() { - /// - public void EvaluateWrite() { - Evaluate(); - } + Type modelType = GetType(); + PropertyInfo[] modelProps = modelType.GetProperties(); - /// - public Exception[] EvaluateModel() { - return []; + List failures = []; + foreach (PropertyInfo property in modelProps) { + + IEnumerable attributes = property.GetCustomAttributes(); + if (!attributes.Any()) + continue; + + foreach (ValidatorBase validator in attributes) { + if (!validator.ValidateType(modelType)) { + failures.Add( + new EntityEvaluationFailure { + Property = property, + Validator = validator, + Type = EntityEvaluationFailures.WRONG_VALIDATOR_TYPE + } + ); + } + } + } + + return [.. failures]; } } \ No newline at end of file diff --git a/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IEntity.cs b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IEntity.cs index 79e5fa3..9c3fe7f 100644 --- a/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IEntity.cs +++ b/csharp_database_extension/CSharp Database Extension/Entities/Abstractions/Interfaces/IEntity.cs @@ -2,12 +2,43 @@ using System.ComponentModel.DataAnnotations.Schema; using System.Text.Json.Serialization; +using CSharp_Database_Extension.Common.Attributes; +using CSharp_Database_Extension.Entities.Validation.Models; + using CSharp_Extension.Convertion.Abstractions.Interfaces; #pragma warning disable IDE0130 // Namespace does not match folder structure namespace CSharp_Database_Extension; #pragma warning restore IDE0130 // Namespace does not match folder structure + +/// +/// Represents a business entity model with status relation. +/// +/// +/// Type of the status entity model. +/// +/// +/// Type of the user entity model. +/// +public partial interface IEntity + : IEntity + where TStatus : class, IEntity + where TUser : class, IEntity { + + /// + /// System level entity status. + /// + [NotMapped, EntityRelation(IsCrossDatabase = true)] + TStatus SystemStatus { get; set; } + + /// + /// Last user that owned this entity. + /// + [NotMapped, EntityRelation(IsCrossDatabase = true)] + TUser EntityOwner { get; set; } +} + /// /// Represents a business entity model. /// @@ -15,18 +46,18 @@ public partial interface IEntity : IConverterVariant { /// - /// Type of the implementation that stores this implementation. + /// Database that owns this entity model. /// [JsonIgnore, NotMapped] Type Database { get; init; } /// - /// Unique data storages direct pointer identifier. + /// Database identifier. /// long Id { get; set; } /// - /// Entity instance name. + /// Entity name. /// /// /// Length min 1, max 200. @@ -35,48 +66,26 @@ public partial interface IEntity string Name { get; set; } /// - /// Entity instance description. + /// Entity description. /// string? Description { get; set; } /// - /// Time mark for the last time this got created and stored into data storage sources. + /// Last entity change timestamp. /// DateTime Timestamp { get; set; } /// - /// This method evaluates the current record after being read from [Database] to determine - /// if all ist content is correctly reviewed, this is done because there might be a posibility that some users - /// or administration pushes data directly into the [Database] bypassing the system programmed validations. - /// - /// - /// This method can throw directly exceptions due to this kind of integrity methods are - /// strict and must mandatory break any kind of operation into the system to prevent - /// wrong usage and handling of corrupt data. - /// - /// - void EvaluateRead(); - - /// - /// This method evaluates the current record to be stored in the [Database] storage system, - /// this helps to keep the integrity of our data into our storage systems. - /// - /// - /// This method can throw directly exceptions due to this kind of integrity methods are - /// strict and must mandatory break any kind of operation into the system to prevent - /// wrong usage and handling of corrupt data. - /// + /// Evaluates current entity data integrity at Read or Write operations in database. This prevents possible user level direct databases + /// modifications. /// - void EvaluateWrite(); + void EvaluateData(); /// - /// This method is used to evaluate the model definition, this means will evaluate - /// if the and operations work as expected - /// before the system start its engine, this function might break the system rawSet up and stop advising - /// about the found exceptions. + /// Evaluate that entity model is correctly configured. /// /// - /// Collection of exceptions found at definition evaluation. + /// Evaluation failures. /// - Exception[] EvaluateModel(); + EntityEvaluationFailure[] EvaluateModel(); } \ No newline at end of file diff --git a/csharp_database_extension/CSharp Database Extension/Entities/Validation/Models/EntityEvaluationFailure.cs b/csharp_database_extension/CSharp Database Extension/Entities/Validation/Models/EntityEvaluationFailure.cs new file mode 100644 index 0000000..68396f6 --- /dev/null +++ b/csharp_database_extension/CSharp Database Extension/Entities/Validation/Models/EntityEvaluationFailure.cs @@ -0,0 +1,37 @@ +using System.Reflection; + +using CSharp_Database_Extension.Entities.Validation.Abstractions.Bases; + +namespace CSharp_Database_Extension.Entities.Validation.Models; + +/// +/// Represents types of . +/// +public enum EntityEvaluationFailures { + /// + /// When a property validator has unsupported type for that property. + /// + WRONG_VALIDATOR_TYPE, +} + +/// +/// Represents an entity validation result data. +/// +public record EntityEvaluationFailure { + + /// + /// Property caught in validation process. + /// + public PropertyInfo Property { get; init; } = default!; + + /// + /// Validator that was used to validate the property. + /// + public ValidatorBase Validator { get; init; } = default!; + + /// + /// Type of validation result. + /// + public EntityEvaluationFailures Type { get; init; } = default!; + +} diff --git a/csharp_database_extension/DatabaseProxy/DatabaseProxy.csproj b/csharp_database_extension/DatabaseProxy/DatabaseProxy.csproj index 7d34f83..b36e7a3 100644 --- a/csharp_database_extension/DatabaseProxy/DatabaseProxy.csproj +++ b/csharp_database_extension/DatabaseProxy/DatabaseProxy.csproj @@ -17,10 +17,4 @@ - - - PreserveNewest - - - diff --git a/csharp_database_extension/DatabaseProxy/Migrations/20260401220538_Init Db.Designer.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260401220538_Init Db.Designer.cs deleted file mode 100644 index 387484f..0000000 --- a/csharp_database_extension/DatabaseProxy/Migrations/20260401220538_Init Db.Designer.cs +++ /dev/null @@ -1,29 +0,0 @@ -// -using DatabaseProxy; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace DatabaseProxy.Migrations -{ - [DbContext(typeof(DatabaseProxy))] - [Migration("20260401220538_Init Db")] - partial class InitDb - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.5") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); -#pragma warning restore 612, 618 - } - } -} diff --git a/csharp_database_extension/DatabaseProxy/Migrations/20260401220538_Init Db.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260401220538_Init Db.cs deleted file mode 100644 index 9eada13..0000000 --- a/csharp_database_extension/DatabaseProxy/Migrations/20260401220538_Init Db.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DatabaseProxy.Migrations -{ - /// - public partial class InitDb : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/csharp_database_extension/DatabaseProxy/Migrations/20260401221950_Init_Db_2.Designer.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260401221950_Init_Db_2.Designer.cs deleted file mode 100644 index ad8135b..0000000 --- a/csharp_database_extension/DatabaseProxy/Migrations/20260401221950_Init_Db_2.Designer.cs +++ /dev/null @@ -1,118 +0,0 @@ -// -using System; -using DatabaseProxy; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace DatabaseProxy.Migrations -{ - [DbContext(typeof(DatabaseProxy))] - [Migration("20260401221950_Init_Db_2")] - partial class Init_Db_2 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.5") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("DatabaseProxy.EntityDependantProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("EntityProxyId") - .HasColumnType("bigint"); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.HasIndex("EntityProxyId"); - - b.ToTable("EntityDependantProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityDependencyProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.ToTable("EntityDependencyProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("EntityDependencyProxyId") - .HasColumnType("bigint"); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.HasIndex("EntityDependencyProxyId"); - - b.ToTable("EntityProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityDependantProxy", b => - { - b.HasOne("DatabaseProxy.EntityProxy", null) - .WithMany("Dependants") - .HasForeignKey("EntityProxyId"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityProxy", b => - { - b.HasOne("DatabaseProxy.EntityDependencyProxy", null) - .WithMany("Dependants") - .HasForeignKey("EntityDependencyProxyId"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityDependencyProxy", b => - { - b.Navigation("Dependants"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityProxy", b => - { - b.Navigation("Dependants"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/csharp_database_extension/DatabaseProxy/Migrations/20260401221950_Init_Db_2.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260401221950_Init_Db_2.cs deleted file mode 100644 index 820c7cc..0000000 --- a/csharp_database_extension/DatabaseProxy/Migrations/20260401221950_Init_Db_2.cs +++ /dev/null @@ -1,89 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DatabaseProxy.Migrations -{ - /// - public partial class Init_Db_2 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "EntityDependencyProxies", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Timestamp = table.Column(type: "datetime2(7)", nullable: false, defaultValueSql: "GETUTCDATE()") - }, - constraints: table => - { - table.PrimaryKey("PK_EntityDependencyProxies", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "EntityProxies", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - EntityDependencyProxyId = table.Column(type: "bigint", nullable: true), - Timestamp = table.Column(type: "datetime2(7)", nullable: false, defaultValueSql: "GETUTCDATE()") - }, - constraints: table => - { - table.PrimaryKey("PK_EntityProxies", x => x.Id); - table.ForeignKey( - name: "FK_EntityProxies_EntityDependencyProxies_EntityDependencyProxyId", - column: x => x.EntityDependencyProxyId, - principalTable: "EntityDependencyProxies", - principalColumn: "Id"); - }); - - migrationBuilder.CreateTable( - name: "EntityDependantProxies", - columns: table => new - { - Id = table.Column(type: "bigint", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - EntityProxyId = table.Column(type: "bigint", nullable: true), - Timestamp = table.Column(type: "datetime2(7)", nullable: false, defaultValueSql: "GETUTCDATE()") - }, - constraints: table => - { - table.PrimaryKey("PK_EntityDependantProxies", x => x.Id); - table.ForeignKey( - name: "FK_EntityDependantProxies_EntityProxies_EntityProxyId", - column: x => x.EntityProxyId, - principalTable: "EntityProxies", - principalColumn: "Id"); - }); - - migrationBuilder.CreateIndex( - name: "IX_EntityDependantProxies_EntityProxyId", - table: "EntityDependantProxies", - column: "EntityProxyId"); - - migrationBuilder.CreateIndex( - name: "IX_EntityProxies_EntityDependencyProxyId", - table: "EntityProxies", - column: "EntityDependencyProxyId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "EntityDependantProxies"); - - migrationBuilder.DropTable( - name: "EntityProxies"); - - migrationBuilder.DropTable( - name: "EntityDependencyProxies"); - } - } -} diff --git a/csharp_database_extension/DatabaseProxy/Migrations/20260506231958_added_autoloading.Designer.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260506231958_added_autoloading.Designer.cs deleted file mode 100644 index 527843f..0000000 --- a/csharp_database_extension/DatabaseProxy/Migrations/20260506231958_added_autoloading.Designer.cs +++ /dev/null @@ -1,133 +0,0 @@ -// -using System; -using DatabaseProxy; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace DatabaseProxy.Migrations -{ - [DbContext(typeof(DatabaseProxy))] - [Migration("20260506231958_added_autoloading")] - partial class added_autoloading - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.5") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("DatabaseProxy.EntityDependantProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("EntityProxyId") - .HasColumnType("bigint"); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.HasIndex("EntityProxyId"); - - b.ToTable("EntityDependantProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityDependencyProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.ToTable("EntityDependencyProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("DependencyShadow") - .HasColumnType("bigint") - .HasColumnName("Dependency"); - - b.Property("EntityDependencyProxyId") - .HasColumnType("bigint"); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.HasIndex("DependencyShadow") - .IsUnique() - .HasFilter("[Dependency] IS NOT NULL"); - - b.HasIndex("EntityDependencyProxyId"); - - b.ToTable("EntityProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityDependantProxy", b => - { - b.HasOne("DatabaseProxy.EntityProxy", null) - .WithMany("Dependants") - .HasForeignKey("EntityProxyId"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityProxy", b => - { - b.HasOne("DatabaseProxy.EntityDependencyProxy", "Dependency") - .WithOne() - .HasForeignKey("DatabaseProxy.EntityProxy", "DependencyShadow") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("DatabaseProxy.EntityDependencyProxy", null) - .WithMany("Dependants") - .HasForeignKey("EntityDependencyProxyId"); - - b.Navigation("Dependency"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityDependencyProxy", b => - { - b.Navigation("Dependants"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityProxy", b => - { - b.Navigation("Dependants"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/csharp_database_extension/DatabaseProxy/Migrations/20260506231958_added_autoloading.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260506231958_added_autoloading.cs deleted file mode 100644 index f906b78..0000000 --- a/csharp_database_extension/DatabaseProxy/Migrations/20260506231958_added_autoloading.cs +++ /dev/null @@ -1,51 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DatabaseProxy.Migrations -{ - /// - public partial class added_autoloading : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Dependency", - table: "EntityProxies", - type: "bigint", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_EntityProxies_Dependency", - table: "EntityProxies", - column: "Dependency", - unique: true, - filter: "[Dependency] IS NOT NULL"); - - migrationBuilder.AddForeignKey( - name: "FK_EntityProxies_EntityDependencyProxies_Dependency", - table: "EntityProxies", - column: "Dependency", - principalTable: "EntityDependencyProxies", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_EntityProxies_EntityDependencyProxies_Dependency", - table: "EntityProxies"); - - migrationBuilder.DropIndex( - name: "IX_EntityProxies_Dependency", - table: "EntityProxies"); - - migrationBuilder.DropColumn( - name: "Dependency", - table: "EntityProxies"); - } - } -} diff --git a/csharp_database_extension/DatabaseProxy/Migrations/20260506232702_added_renamings.Designer.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260506232702_added_renamings.Designer.cs deleted file mode 100644 index 1383369..0000000 --- a/csharp_database_extension/DatabaseProxy/Migrations/20260506232702_added_renamings.Designer.cs +++ /dev/null @@ -1,133 +0,0 @@ -// -using System; -using DatabaseProxy; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace DatabaseProxy.Migrations -{ - [DbContext(typeof(DatabaseProxy))] - [Migration("20260506232702_added_renamings")] - partial class added_renamings - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.5") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("DatabaseProxy.EntityDependantProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("EntityProxyId") - .HasColumnType("bigint"); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.HasIndex("EntityProxyId"); - - b.ToTable("EntityDependantProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityDependencyProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.ToTable("EntityDependencyProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("EntityDependencyProxyId") - .HasColumnType("bigint"); - - b.Property("EntityDependencyProxyShadow") - .HasColumnType("bigint") - .HasColumnName("EntityDependencyProxy"); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.HasIndex("EntityDependencyProxyId"); - - b.HasIndex("EntityDependencyProxyShadow") - .IsUnique() - .HasFilter("[EntityDependencyProxy] IS NOT NULL"); - - b.ToTable("EntityProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityDependantProxy", b => - { - b.HasOne("DatabaseProxy.EntityProxy", null) - .WithMany("EntityDependantProxies") - .HasForeignKey("EntityProxyId"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityProxy", b => - { - b.HasOne("DatabaseProxy.EntityDependencyProxy", null) - .WithMany("Dependants") - .HasForeignKey("EntityDependencyProxyId"); - - b.HasOne("DatabaseProxy.EntityDependencyProxy", "EntityDependencyProxy") - .WithOne() - .HasForeignKey("DatabaseProxy.EntityProxy", "EntityDependencyProxyShadow") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EntityDependencyProxy"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityDependencyProxy", b => - { - b.Navigation("Dependants"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityProxy", b => - { - b.Navigation("EntityDependantProxies"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/csharp_database_extension/DatabaseProxy/Migrations/20260506232702_added_renamings.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260506232702_added_renamings.cs deleted file mode 100644 index e058d1f..0000000 --- a/csharp_database_extension/DatabaseProxy/Migrations/20260506232702_added_renamings.cs +++ /dev/null @@ -1,74 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DatabaseProxy.Migrations -{ - /// - public partial class added_renamings : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_EntityProxies_EntityDependencyProxies_Dependency", - table: "EntityProxies"); - - migrationBuilder.DropIndex( - name: "IX_EntityProxies_Dependency", - table: "EntityProxies"); - - migrationBuilder.RenameColumn( - name: "Dependency", - table: "EntityProxies", - newName: "EntityDependencyProxy"); - - migrationBuilder.CreateIndex( - name: "IX_EntityProxies_EntityDependencyProxy", - table: "EntityProxies", - column: "EntityDependencyProxy", - unique: true, - filter: "[EntityDependencyProxy] IS NOT NULL"); - - migrationBuilder.AddForeignKey( - name: "FK_EntityProxies_EntityDependencyProxies_EntityDependencyProxy", - table: "EntityProxies", - column: "EntityDependencyProxy", - principalTable: "EntityDependencyProxies", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_EntityProxies_EntityDependencyProxies_EntityDependencyProxy", - table: "EntityProxies"); - - migrationBuilder.DropIndex( - name: "IX_EntityProxies_EntityDependencyProxy", - table: "EntityProxies"); - - migrationBuilder.RenameColumn( - name: "EntityDependencyProxy", - table: "EntityProxies", - newName: "Dependency"); - - migrationBuilder.CreateIndex( - name: "IX_EntityProxies_Dependency", - table: "EntityProxies", - column: "Dependency", - unique: true, - filter: "[Dependency] IS NOT NULL"); - - migrationBuilder.AddForeignKey( - name: "FK_EntityProxies_EntityDependencyProxies_Dependency", - table: "EntityProxies", - column: "Dependency", - principalTable: "EntityDependencyProxies", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - } -} diff --git a/csharp_database_extension/DatabaseProxy/Migrations/20260506232938_added_attributes.Designer.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260506232938_added_attributes.Designer.cs deleted file mode 100644 index 0456cdf..0000000 --- a/csharp_database_extension/DatabaseProxy/Migrations/20260506232938_added_attributes.Designer.cs +++ /dev/null @@ -1,133 +0,0 @@ -// -using System; -using DatabaseProxy; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace DatabaseProxy.Migrations -{ - [DbContext(typeof(DatabaseProxy))] - [Migration("20260506232938_added_attributes")] - partial class added_attributes - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.5") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("DatabaseProxy.EntityDependantProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("EntityProxyId") - .HasColumnType("bigint"); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.HasIndex("EntityProxyId"); - - b.ToTable("EntityDependantProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityDependencyProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.ToTable("EntityDependencyProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("EntityDependencyProxyId") - .HasColumnType("bigint"); - - b.Property("EntityDependencyProxyShadow") - .HasColumnType("bigint") - .HasColumnName("EntityDependencyProxy"); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.HasIndex("EntityDependencyProxyId"); - - b.HasIndex("EntityDependencyProxyShadow") - .IsUnique() - .HasFilter("[EntityDependencyProxy] IS NOT NULL"); - - b.ToTable("EntityProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityDependantProxy", b => - { - b.HasOne("DatabaseProxy.EntityProxy", null) - .WithMany("EntityDependantProxies") - .HasForeignKey("EntityProxyId"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityProxy", b => - { - b.HasOne("DatabaseProxy.EntityDependencyProxy", null) - .WithMany("EntityProxies") - .HasForeignKey("EntityDependencyProxyId"); - - b.HasOne("DatabaseProxy.EntityDependencyProxy", "EntityDependencyProxy") - .WithOne() - .HasForeignKey("DatabaseProxy.EntityProxy", "EntityDependencyProxyShadow") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EntityDependencyProxy"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityDependencyProxy", b => - { - b.Navigation("EntityProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityProxy", b => - { - b.Navigation("EntityDependantProxies"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/csharp_database_extension/DatabaseProxy/Migrations/20260506232938_added_attributes.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260506232938_added_attributes.cs deleted file mode 100644 index b535c53..0000000 --- a/csharp_database_extension/DatabaseProxy/Migrations/20260506232938_added_attributes.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DatabaseProxy.Migrations -{ - /// - public partial class added_attributes : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - - } - } -} diff --git a/csharp_database_extension/DatabaseProxy/Migrations/20260506233726_added_attributes_2.Designer.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260506233726_added_attributes_2.Designer.cs deleted file mode 100644 index bd8b13f..0000000 --- a/csharp_database_extension/DatabaseProxy/Migrations/20260506233726_added_attributes_2.Designer.cs +++ /dev/null @@ -1,118 +0,0 @@ -// -using System; -using DatabaseProxy; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace DatabaseProxy.Migrations -{ - [DbContext(typeof(DatabaseProxy))] - [Migration("20260506233726_added_attributes_2")] - partial class added_attributes_2 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.5") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("DatabaseProxy.EntityDependantProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("EntityProxyId") - .HasColumnType("bigint"); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.HasIndex("EntityProxyId"); - - b.ToTable("EntityDependantProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityDependencyProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.ToTable("EntityDependencyProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("EntityDependencyProxyId") - .HasColumnType("bigint"); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.HasIndex("EntityDependencyProxyId"); - - b.ToTable("EntityProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityDependantProxy", b => - { - b.HasOne("DatabaseProxy.EntityProxy", null) - .WithMany("EntityDependantProxies") - .HasForeignKey("EntityProxyId"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityProxy", b => - { - b.HasOne("DatabaseProxy.EntityDependencyProxy", null) - .WithMany("EntityProxies") - .HasForeignKey("EntityDependencyProxyId"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityDependencyProxy", b => - { - b.Navigation("EntityProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.EntityProxy", b => - { - b.Navigation("EntityDependantProxies"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/csharp_database_extension/DatabaseProxy/Migrations/20260506233726_added_attributes_2.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260506233726_added_attributes_2.cs deleted file mode 100644 index 7ebf990..0000000 --- a/csharp_database_extension/DatabaseProxy/Migrations/20260506233726_added_attributes_2.cs +++ /dev/null @@ -1,51 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DatabaseProxy.Migrations -{ - /// - public partial class added_attributes_2 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_EntityProxies_EntityDependencyProxies_EntityDependencyProxy", - table: "EntityProxies"); - - migrationBuilder.DropIndex( - name: "IX_EntityProxies_EntityDependencyProxy", - table: "EntityProxies"); - - migrationBuilder.DropColumn( - name: "EntityDependencyProxy", - table: "EntityProxies"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "EntityDependencyProxy", - table: "EntityProxies", - type: "bigint", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_EntityProxies_EntityDependencyProxy", - table: "EntityProxies", - column: "EntityDependencyProxy", - unique: true, - filter: "[EntityDependencyProxy] IS NOT NULL"); - - migrationBuilder.AddForeignKey( - name: "FK_EntityProxies_EntityDependencyProxies_EntityDependencyProxy", - table: "EntityProxies", - column: "EntityDependencyProxy", - principalTable: "EntityDependencyProxies", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - } -} diff --git a/csharp_database_extension/DatabaseProxy/Migrations/20260507000230_standarized db for proxies.Designer.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260507000230_standarized db for proxies.Designer.cs deleted file mode 100644 index c60f54d..0000000 --- a/csharp_database_extension/DatabaseProxy/Migrations/20260507000230_standarized db for proxies.Designer.cs +++ /dev/null @@ -1,150 +0,0 @@ -// -using System; -using DatabaseProxy; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace DatabaseProxy.Migrations -{ - [DbContext(typeof(DatabaseProxy))] - [Migration("20260507000230_standarized db for proxies")] -#pragma warning disable CS8981 // The type name only contains lower-cased ascii characters. Such names may become reserved for the language. - partial class standarizeddbforproxies -#pragma warning restore CS8981 // The type name only contains lower-cased ascii characters. Such names may become reserved for the language. - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.5") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityDependantProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("EntityProxyId") - .HasColumnType("bigint"); - - b.Property("EntityProxyShadow") - .HasColumnType("bigint") - .HasColumnName("EntityProxy"); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.HasIndex("EntityProxyId"); - - b.HasIndex("EntityProxyShadow") - .IsUnique() - .HasFilter("[EntityProxy] IS NOT NULL"); - - b.ToTable("EntityDependantProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityDependencyProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.ToTable("EntityDependencyProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("EntityDependencyProxyId") - .HasColumnType("bigint"); - - b.Property("EntityDependencyProxyShadow") - .HasColumnType("bigint") - .HasColumnName("EntityDependencyProxy"); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.HasIndex("EntityDependencyProxyId"); - - b.HasIndex("EntityDependencyProxyShadow") - .IsUnique() - .HasFilter("[EntityDependencyProxy] IS NOT NULL"); - - b.ToTable("EntityProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityDependantProxy", b => - { - b.HasOne("DatabaseProxy.Entities.EntityProxy", null) - .WithMany("EntityDependantProxies") - .HasForeignKey("EntityProxyId"); - - b.HasOne("DatabaseProxy.Entities.EntityProxy", "EntityProxy") - .WithOne() - .HasForeignKey("DatabaseProxy.Entities.EntityDependantProxy", "EntityProxyShadow") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EntityProxy"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityProxy", b => - { - b.HasOne("DatabaseProxy.Entities.EntityDependencyProxy", null) - .WithMany("EntityProxies") - .HasForeignKey("EntityDependencyProxyId"); - - b.HasOne("DatabaseProxy.Entities.EntityDependencyProxy", "EntityDependencyProxy") - .WithOne() - .HasForeignKey("DatabaseProxy.Entities.EntityProxy", "EntityDependencyProxyShadow") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EntityDependencyProxy"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityDependencyProxy", b => - { - b.Navigation("EntityProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityProxy", b => - { - b.Navigation("EntityDependantProxies"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/csharp_database_extension/DatabaseProxy/Migrations/20260507000230_standarized db for proxies.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260507000230_standarized db for proxies.cs deleted file mode 100644 index 35fe9a3..0000000 --- a/csharp_database_extension/DatabaseProxy/Migrations/20260507000230_standarized db for proxies.cs +++ /dev/null @@ -1,85 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DatabaseProxy.Migrations; - -/// -#pragma warning disable CS8981 // The type name only contains lower-cased ascii characters. Such names may become reserved for the language. -public partial class standarizeddbforproxies : Migration -#pragma warning restore CS8981 // The type name only contains lower-cased ascii characters. Such names may become reserved for the language. -{ - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "EntityDependencyProxy", - table: "EntityProxies", - type: "bigint", - nullable: true); - - migrationBuilder.AddColumn( - name: "EntityProxy", - table: "EntityDependantProxies", - type: "bigint", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_EntityProxies_EntityDependencyProxy", - table: "EntityProxies", - column: "EntityDependencyProxy", - unique: true, - filter: "[EntityDependencyProxy] IS NOT NULL"); - - migrationBuilder.CreateIndex( - name: "IX_EntityDependantProxies_EntityProxy", - table: "EntityDependantProxies", - column: "EntityProxy", - unique: true, - filter: "[EntityProxy] IS NOT NULL"); - - migrationBuilder.AddForeignKey( - name: "FK_EntityDependantProxies_EntityProxies_EntityProxy", - table: "EntityDependantProxies", - column: "EntityProxy", - principalTable: "EntityProxies", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_EntityProxies_EntityDependencyProxies_EntityDependencyProxy", - table: "EntityProxies", - column: "EntityDependencyProxy", - principalTable: "EntityDependencyProxies", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_EntityDependantProxies_EntityProxies_EntityProxy", - table: "EntityDependantProxies"); - - migrationBuilder.DropForeignKey( - name: "FK_EntityProxies_EntityDependencyProxies_EntityDependencyProxy", - table: "EntityProxies"); - - migrationBuilder.DropIndex( - name: "IX_EntityProxies_EntityDependencyProxy", - table: "EntityProxies"); - - migrationBuilder.DropIndex( - name: "IX_EntityDependantProxies_EntityProxy", - table: "EntityDependantProxies"); - - migrationBuilder.DropColumn( - name: "EntityDependencyProxy", - table: "EntityProxies"); - - migrationBuilder.DropColumn( - name: "EntityProxy", - table: "EntityDependantProxies"); - } -} diff --git a/csharp_database_extension/DatabaseProxy/Migrations/20260507000851_standarized db for proxies 2.Designer.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260507000851_standarized db for proxies 2.Designer.cs deleted file mode 100644 index 63319b5..0000000 --- a/csharp_database_extension/DatabaseProxy/Migrations/20260507000851_standarized db for proxies 2.Designer.cs +++ /dev/null @@ -1,137 +0,0 @@ -// -using System; -using DatabaseProxy; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace DatabaseProxy.Migrations -{ - [DbContext(typeof(DatabaseProxy))] - [Migration("20260507000851_standarized db for proxies 2")] - partial class standarizeddbforproxies2 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.5") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityDependantProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("EntityProxyId") - .HasColumnType("bigint"); - - b.Property("EntityProxyShadow") - .HasColumnType("bigint") - .HasColumnName("EntityProxy"); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.HasIndex("EntityProxyId"); - - b.HasIndex("EntityProxyShadow") - .IsUnique() - .HasFilter("[EntityProxy] IS NOT NULL"); - - b.ToTable("EntityDependantProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityDependencyProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.ToTable("EntityDependencyProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("EntityDependencyProxyShadow") - .HasColumnType("bigint") - .HasColumnName("EntityDependencyProxy"); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.HasIndex("EntityDependencyProxyShadow"); - - b.ToTable("EntityProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityDependantProxy", b => - { - b.HasOne("DatabaseProxy.Entities.EntityProxy", null) - .WithMany("EntityDependantProxies") - .HasForeignKey("EntityProxyId"); - - b.HasOne("DatabaseProxy.Entities.EntityProxy", "EntityProxy") - .WithOne() - .HasForeignKey("DatabaseProxy.Entities.EntityDependantProxy", "EntityProxyShadow") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EntityProxy"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityProxy", b => - { - b.HasOne("DatabaseProxy.Entities.EntityDependencyProxy", "EntityDependencyProxy") - .WithMany("EntityProxies") - .HasForeignKey("EntityDependencyProxyShadow") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EntityDependencyProxy"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityDependencyProxy", b => - { - b.Navigation("EntityProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityProxy", b => - { - b.Navigation("EntityDependantProxies"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/csharp_database_extension/DatabaseProxy/Migrations/20260507000851_standarized db for proxies 2.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260507000851_standarized db for proxies 2.cs deleted file mode 100644 index ef4566a..0000000 --- a/csharp_database_extension/DatabaseProxy/Migrations/20260507000851_standarized db for proxies 2.cs +++ /dev/null @@ -1,68 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DatabaseProxy.Migrations -{ - /// - public partial class standarizeddbforproxies2 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_EntityProxies_EntityDependencyProxies_EntityDependencyProxyId", - table: "EntityProxies"); - - migrationBuilder.DropIndex( - name: "IX_EntityProxies_EntityDependencyProxy", - table: "EntityProxies"); - - migrationBuilder.DropIndex( - name: "IX_EntityProxies_EntityDependencyProxyId", - table: "EntityProxies"); - - migrationBuilder.DropColumn( - name: "EntityDependencyProxyId", - table: "EntityProxies"); - - migrationBuilder.CreateIndex( - name: "IX_EntityProxies_EntityDependencyProxy", - table: "EntityProxies", - column: "EntityDependencyProxy"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_EntityProxies_EntityDependencyProxy", - table: "EntityProxies"); - - migrationBuilder.AddColumn( - name: "EntityDependencyProxyId", - table: "EntityProxies", - type: "bigint", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_EntityProxies_EntityDependencyProxy", - table: "EntityProxies", - column: "EntityDependencyProxy", - unique: true, - filter: "[EntityDependencyProxy] IS NOT NULL"); - - migrationBuilder.CreateIndex( - name: "IX_EntityProxies_EntityDependencyProxyId", - table: "EntityProxies", - column: "EntityDependencyProxyId"); - - migrationBuilder.AddForeignKey( - name: "FK_EntityProxies_EntityDependencyProxies_EntityDependencyProxyId", - table: "EntityProxies", - column: "EntityDependencyProxyId", - principalTable: "EntityDependencyProxies", - principalColumn: "Id"); - } - } -} diff --git a/csharp_database_extension/DatabaseProxy/Migrations/20260507000955_standarized db for proxies 3.Designer.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260507000955_standarized db for proxies 3.Designer.cs deleted file mode 100644 index d531dcd..0000000 --- a/csharp_database_extension/DatabaseProxy/Migrations/20260507000955_standarized db for proxies 3.Designer.cs +++ /dev/null @@ -1,126 +0,0 @@ -// -using System; -using DatabaseProxy; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace DatabaseProxy.Migrations -{ - [DbContext(typeof(DatabaseProxy))] - [Migration("20260507000955_standarized db for proxies 3")] - partial class standarizeddbforproxies3 - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.5") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityDependantProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("EntityProxyShadow") - .HasColumnType("bigint") - .HasColumnName("EntityProxy"); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.HasIndex("EntityProxyShadow"); - - b.ToTable("EntityDependantProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityDependencyProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.ToTable("EntityDependencyProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("EntityDependencyProxyShadow") - .HasColumnType("bigint") - .HasColumnName("EntityDependencyProxy"); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.HasIndex("EntityDependencyProxyShadow"); - - b.ToTable("EntityProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityDependantProxy", b => - { - b.HasOne("DatabaseProxy.Entities.EntityProxy", "EntityProxy") - .WithMany("EntityDependantProxies") - .HasForeignKey("EntityProxyShadow") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EntityProxy"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityProxy", b => - { - b.HasOne("DatabaseProxy.Entities.EntityDependencyProxy", "EntityDependencyProxy") - .WithMany("EntityProxies") - .HasForeignKey("EntityDependencyProxyShadow") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EntityDependencyProxy"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityDependencyProxy", b => - { - b.Navigation("EntityProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityProxy", b => - { - b.Navigation("EntityDependantProxies"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/csharp_database_extension/DatabaseProxy/Migrations/20260507000955_standarized db for proxies 3.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260507000955_standarized db for proxies 3.cs deleted file mode 100644 index 4d0fa16..0000000 --- a/csharp_database_extension/DatabaseProxy/Migrations/20260507000955_standarized db for proxies 3.cs +++ /dev/null @@ -1,68 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DatabaseProxy.Migrations -{ - /// - public partial class standarizeddbforproxies3 : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_EntityDependantProxies_EntityProxies_EntityProxyId", - table: "EntityDependantProxies"); - - migrationBuilder.DropIndex( - name: "IX_EntityDependantProxies_EntityProxy", - table: "EntityDependantProxies"); - - migrationBuilder.DropIndex( - name: "IX_EntityDependantProxies_EntityProxyId", - table: "EntityDependantProxies"); - - migrationBuilder.DropColumn( - name: "EntityProxyId", - table: "EntityDependantProxies"); - - migrationBuilder.CreateIndex( - name: "IX_EntityDependantProxies_EntityProxy", - table: "EntityDependantProxies", - column: "EntityProxy"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropIndex( - name: "IX_EntityDependantProxies_EntityProxy", - table: "EntityDependantProxies"); - - migrationBuilder.AddColumn( - name: "EntityProxyId", - table: "EntityDependantProxies", - type: "bigint", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_EntityDependantProxies_EntityProxy", - table: "EntityDependantProxies", - column: "EntityProxy", - unique: true, - filter: "[EntityProxy] IS NOT NULL"); - - migrationBuilder.CreateIndex( - name: "IX_EntityDependantProxies_EntityProxyId", - table: "EntityDependantProxies", - column: "EntityProxyId"); - - migrationBuilder.AddForeignKey( - name: "FK_EntityDependantProxies_EntityProxies_EntityProxyId", - table: "EntityDependantProxies", - column: "EntityProxyId", - principalTable: "EntityProxies", - principalColumn: "Id"); - } - } -} diff --git a/csharp_database_extension/DatabaseProxy/Migrations/20260619050113_IncludingCascadingDeletion.Designer.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260619050113_IncludingCascadingDeletion.Designer.cs deleted file mode 100644 index 6240d32..0000000 --- a/csharp_database_extension/DatabaseProxy/Migrations/20260619050113_IncludingCascadingDeletion.Designer.cs +++ /dev/null @@ -1,126 +0,0 @@ -// -using System; -using DatabaseProxy; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace DatabaseProxy.Migrations -{ - [DbContext(typeof(DatabaseProxy))] - [Migration("20260619050113_IncludingCascadingDeletion")] - partial class IncludingCascadingDeletion - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityDependantProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("EntityProxyShadow") - .HasColumnType("bigint") - .HasColumnName("EntityProxy"); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.HasIndex("EntityProxyShadow"); - - b.ToTable("EntityDependantProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityDependencyProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.ToTable("EntityDependencyProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("EntityDependencyProxyShadow") - .HasColumnType("bigint") - .HasColumnName("EntityDependencyProxy"); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.HasIndex("EntityDependencyProxyShadow"); - - b.ToTable("EntityProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityDependantProxy", b => - { - b.HasOne("DatabaseProxy.Entities.EntityProxy", "EntityProxy") - .WithMany("EntityDependantProxies") - .HasForeignKey("EntityProxyShadow") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EntityProxy"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityProxy", b => - { - b.HasOne("DatabaseProxy.Entities.EntityDependencyProxy", "EntityDependencyProxy") - .WithMany("EntityProxies") - .HasForeignKey("EntityDependencyProxyShadow") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("EntityDependencyProxy"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityDependencyProxy", b => - { - b.Navigation("EntityProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityProxy", b => - { - b.Navigation("EntityDependantProxies"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/csharp_database_extension/DatabaseProxy/Migrations/20260619050113_IncludingCascadingDeletion.cs b/csharp_database_extension/DatabaseProxy/Migrations/20260619050113_IncludingCascadingDeletion.cs deleted file mode 100644 index 1b5d885..0000000 --- a/csharp_database_extension/DatabaseProxy/Migrations/20260619050113_IncludingCascadingDeletion.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace DatabaseProxy.Migrations -{ - /// - public partial class IncludingCascadingDeletion : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_EntityProxies_EntityDependencyProxies_EntityDependencyProxy", - table: "EntityProxies"); - - migrationBuilder.AddForeignKey( - name: "FK_EntityProxies_EntityDependencyProxies_EntityDependencyProxy", - table: "EntityProxies", - column: "EntityDependencyProxy", - principalTable: "EntityDependencyProxies", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_EntityProxies_EntityDependencyProxies_EntityDependencyProxy", - table: "EntityProxies"); - - migrationBuilder.AddForeignKey( - name: "FK_EntityProxies_EntityDependencyProxies_EntityDependencyProxy", - table: "EntityProxies", - column: "EntityDependencyProxy", - principalTable: "EntityDependencyProxies", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - } -} diff --git a/csharp_database_extension/DatabaseProxy/Migrations/DatabaseProxyModelSnapshot.cs b/csharp_database_extension/DatabaseProxy/Migrations/DatabaseProxyModelSnapshot.cs deleted file mode 100644 index 30523af..0000000 --- a/csharp_database_extension/DatabaseProxy/Migrations/DatabaseProxyModelSnapshot.cs +++ /dev/null @@ -1,123 +0,0 @@ -// -using System; -using DatabaseProxy; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace DatabaseProxy.Migrations -{ - [DbContext(typeof(DatabaseProxy))] - partial class DatabaseProxyModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.9") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityDependantProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("EntityProxyShadow") - .HasColumnType("bigint") - .HasColumnName("EntityProxy"); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.HasIndex("EntityProxyShadow"); - - b.ToTable("EntityDependantProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityDependencyProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.ToTable("EntityDependencyProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityProxy", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("bigint"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("EntityDependencyProxyShadow") - .HasColumnType("bigint") - .HasColumnName("EntityDependencyProxy"); - - b.Property("Timestamp") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2(7)") - .HasDefaultValueSql("GETUTCDATE()"); - - b.HasKey("Id"); - - b.HasIndex("EntityDependencyProxyShadow"); - - b.ToTable("EntityProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityDependantProxy", b => - { - b.HasOne("DatabaseProxy.Entities.EntityProxy", "EntityProxy") - .WithMany("EntityDependantProxies") - .HasForeignKey("EntityProxyShadow") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("EntityProxy"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityProxy", b => - { - b.HasOne("DatabaseProxy.Entities.EntityDependencyProxy", "EntityDependencyProxy") - .WithMany("EntityProxies") - .HasForeignKey("EntityDependencyProxyShadow") - .OnDelete(DeleteBehavior.Cascade); - - b.Navigation("EntityDependencyProxy"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityDependencyProxy", b => - { - b.Navigation("EntityProxies"); - }); - - modelBuilder.Entity("DatabaseProxy.Entities.EntityProxy", b => - { - b.Navigation("EntityDependantProxies"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/csharp_database_extension/Integration Tests/Tests/DatabaseBaseTests.cs b/csharp_database_extension/Integration Tests/Tests/DatabaseBaseTests.cs new file mode 100644 index 0000000..f87d60b --- /dev/null +++ b/csharp_database_extension/Integration Tests/Tests/DatabaseBaseTests.cs @@ -0,0 +1,6 @@ +using CSharp_Database_Extension_Testing.Abstractions.Bases; + +namespace Integration_Tests.Tests; + +public class DatabaseBaseTests : DatabaseIntegrationTestsBase { +} diff --git a/csharp_database_extension/Integration Tests/Tests/DepotBaseTests.cs b/csharp_database_extension/Integration Tests/Tests/DepotBaseTests.cs index dcbe36b..3453d3a 100644 --- a/csharp_database_extension/Integration Tests/Tests/DepotBaseTests.cs +++ b/csharp_database_extension/Integration Tests/Tests/DepotBaseTests.cs @@ -1,7 +1,7 @@ using CSharp_Database_Extension.Depots.Models; using CSharp_Database_Extension.Depots.Models.Structs; -using CSM_Database_Testing.Abstractions.Bases; +using CSharp_Database_Extension_Testing.Abstractions.Bases; using DatabaseProxy; using DatabaseProxy.Entities; diff --git a/csharp_database_extension/local.integration_tests.runsettings b/csharp_database_extension/local.integration_tests.runsettings index ad856dc..5d37eac 100644 --- a/csharp_database_extension/local.integration_tests.runsettings +++ b/csharp_database_extension/local.integration_tests.runsettings @@ -4,7 +4,7 @@ net10.0 TestResults - C:\Users\Usuar\Desktop\workspaces\Cosmos (CSM)\csm_database\DatabaseProxy\csmdq.dev.connection.json + C:\Users\Usuar\Desktop\db-extension.itests.json \ No newline at end of file From 2874f86fc815aae580711dda116c7ba34946bea9 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Thu, 15 Oct 2026 17:02:34 -0700 Subject: [PATCH 13/60] finishing standarization and ready to go first version --- .../CSharp Database Extension Testing/CHANGELOG.md | 1 + .../Abstractions/Bases/DatabaseBase.cs | 13 ++++++++++--- .../CSharp Database Extension/CHANGELOG.md | 1 + .../CSharp Database Extension.csproj | 5 +++-- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/csharp_database_extension/CSharp Database Extension Testing/CHANGELOG.md b/csharp_database_extension/CSharp Database Extension Testing/CHANGELOG.md index e69de29..505d21d 100644 --- a/csharp_database_extension/CSharp Database Extension Testing/CHANGELOG.md +++ b/csharp_database_extension/CSharp Database Extension Testing/CHANGELOG.md @@ -0,0 +1 @@ +# CHANGELOG \ No newline at end of file diff --git a/csharp_database_extension/CSharp Database Extension/Abstractions/Bases/DatabaseBase.cs b/csharp_database_extension/CSharp Database Extension/Abstractions/Bases/DatabaseBase.cs index b817e83..eb33e15 100644 --- a/csharp_database_extension/CSharp Database Extension/Abstractions/Bases/DatabaseBase.cs +++ b/csharp_database_extension/CSharp Database Extension/Abstractions/Bases/DatabaseBase.cs @@ -141,18 +141,25 @@ protected EntityBase[] GetEntityModels() { protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { string connectionString = Options.ConnectionOptions!.ConnectionString; - string migrationsAssembly = $"{GetType().Assembly.GetName().Name}.Migrations"; switch (Options.Provider) { case DatabaseProviders.SQLServer: optionsBuilder.UseSqlServer( connectionString, - builder => builder.MigrationsAssembly($"{migrationsAssembly}.SQLServer") + builder => { + if (Options.Migrations is not null) { + builder.MigrationsAssembly(Options.Migrations); + } + } ); break; case DatabaseProviders.PostgreSQL: optionsBuilder.UseNpgsql( connectionString, - builder => builder.MigrationsAssembly($"{migrationsAssembly}.PostgreSQL") + builder => { + if(Options.Migrations is not null) { + builder.MigrationsAssembly(Options.Migrations); + } + } ); break; } diff --git a/csharp_database_extension/CSharp Database Extension/CHANGELOG.md b/csharp_database_extension/CSharp Database Extension/CHANGELOG.md index e69de29..505d21d 100644 --- a/csharp_database_extension/CSharp Database Extension/CHANGELOG.md +++ b/csharp_database_extension/CSharp Database Extension/CHANGELOG.md @@ -0,0 +1 @@ +# CHANGELOG \ No newline at end of file diff --git a/csharp_database_extension/CSharp Database Extension/CSharp Database Extension.csproj b/csharp_database_extension/CSharp Database Extension/CSharp Database Extension.csproj index 80a6fa9..563b526 100644 --- a/csharp_database_extension/CSharp Database Extension/CSharp Database Extension.csproj +++ b/csharp_database_extension/CSharp Database Extension/CSharp Database Extension.csproj @@ -24,9 +24,10 @@ - - + + + From cc39754bdff67ae75de184f31bce61e8a9d75402 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Thu, 15 Oct 2026 17:28:32 -0700 Subject: [PATCH 14/60] added unit tests project, correected ci workflow --- ...yaml => ci-chsarp_database_extension.yaml} | 19 ++++++++++++++----- .../CSharp Database Extension.sln | 6 ++++++ .../Tests/UtilsTests/DatabaseUtilsTests.cs | 2 +- .../Unit Tests/Unit Tests.csproj | 2 +- 4 files changed, 22 insertions(+), 7 deletions(-) rename .github/workflows/{run_unit_tests.yaml => ci-chsarp_database_extension.yaml} (81%) diff --git a/.github/workflows/run_unit_tests.yaml b/.github/workflows/ci-chsarp_database_extension.yaml similarity index 81% rename from .github/workflows/run_unit_tests.yaml rename to .github/workflows/ci-chsarp_database_extension.yaml index c730df7..ac94ce7 100644 --- a/.github/workflows/run_unit_tests.yaml +++ b/.github/workflows/ci-chsarp_database_extension.yaml @@ -1,9 +1,18 @@ -name: Unit Testing +name: CI CSharp Database Extension + +# CI Workflow checks that solution builds, unit tests passes and code-health. on: pull_request: - branches: [ dev, main ] - types: [ opened, synchronize, reopened ] + branches: [ + dev, + main, + ] + types: [ + opened, + reopened, + synchronize, + ] jobs: unit_testing: @@ -19,7 +28,7 @@ jobs: with: fetch-depth: 0 - - name: 🔑 Configure NuGet to use GitHub Packages + - name: Setup GitHub source packages. env: NUGET_AUTH_TOKEN: ${{ secrets.PUBLISH_PAT }} run: | @@ -33,7 +42,7 @@ jobs: - name: Setup .NET SDK uses: actions/setup-dotnet@v3 with: - dotnet-version: '10.0.x' # ← install .NET 8 + dotnet-version: '10.0.x' - name: Cache NuGet packages uses: actions/cache@v3 diff --git a/csharp_database_extension/CSharp Database Extension.sln b/csharp_database_extension/CSharp Database Extension.sln index 1f57860..fed831b 100644 --- a/csharp_database_extension/CSharp Database Extension.sln +++ b/csharp_database_extension/CSharp Database Extension.sln @@ -18,6 +18,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Integration Tests", "Integr EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DatabaseProxy", "DatabaseProxy\DatabaseProxy.csproj", "{5FBB0C80-E310-CB96-56E1-AF38D8BA8F32}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Unit Tests", "Unit Tests\Unit Tests.csproj", "{CBAAFF94-19D9-CA27-EB09-AC83990DFBC8}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -40,6 +42,10 @@ Global {5FBB0C80-E310-CB96-56E1-AF38D8BA8F32}.Debug|Any CPU.Build.0 = Debug|Any CPU {5FBB0C80-E310-CB96-56E1-AF38D8BA8F32}.Release|Any CPU.ActiveCfg = Release|Any CPU {5FBB0C80-E310-CB96-56E1-AF38D8BA8F32}.Release|Any CPU.Build.0 = Release|Any CPU + {CBAAFF94-19D9-CA27-EB09-AC83990DFBC8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CBAAFF94-19D9-CA27-EB09-AC83990DFBC8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CBAAFF94-19D9-CA27-EB09-AC83990DFBC8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CBAAFF94-19D9-CA27-EB09-AC83990DFBC8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/csharp_database_extension/Unit Tests/Tests/UtilsTests/DatabaseUtilsTests.cs b/csharp_database_extension/Unit Tests/Tests/UtilsTests/DatabaseUtilsTests.cs index 53be18c..b2151a1 100644 --- a/csharp_database_extension/Unit Tests/Tests/UtilsTests/DatabaseUtilsTests.cs +++ b/csharp_database_extension/Unit Tests/Tests/UtilsTests/DatabaseUtilsTests.cs @@ -1,4 +1,4 @@ -using CSM_Database_Core.Core.Utils; +using CSharp_Database_Extension.Common.Utils; using DatabaseProxy.Entities; diff --git a/csharp_database_extension/Unit Tests/Unit Tests.csproj b/csharp_database_extension/Unit Tests/Unit Tests.csproj index f10ade8..d894d38 100644 --- a/csharp_database_extension/Unit Tests/Unit Tests.csproj +++ b/csharp_database_extension/Unit Tests/Unit Tests.csproj @@ -25,7 +25,7 @@ - + From fbcc3c30dbcc9d7ae8198fd3d7438bf7012f490d Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Thu, 15 Oct 2026 17:40:46 -0700 Subject: [PATCH 15/60] updating CI workflow --- .../{ci-chsarp_database_extension.yaml => ci.yaml} | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) rename .github/workflows/{ci-chsarp_database_extension.yaml => ci.yaml} (91%) diff --git a/.github/workflows/ci-chsarp_database_extension.yaml b/.github/workflows/ci.yaml similarity index 91% rename from .github/workflows/ci-chsarp_database_extension.yaml rename to .github/workflows/ci.yaml index ac94ce7..c21b5aa 100644 --- a/.github/workflows/ci-chsarp_database_extension.yaml +++ b/.github/workflows/ci.yaml @@ -1,4 +1,4 @@ -name: CI CSharp Database Extension +name: CI # CI Workflow checks that solution builds, unit tests passes and code-health. @@ -16,6 +16,8 @@ on: jobs: unit_testing: + env: + WDIR: csharp_database_extension name: Unit Testing runs-on: ubuntu-latest concurrency: @@ -53,9 +55,11 @@ jobs: ${{ runner.os }}-nuget- - name: Restore dependencies + working-directory: ${{ env.WDIR }} run: dotnet restore - name: Build solution + working-directory: ${{ env.WDIR }} run: | dotnet build --no-restore --configuration Release From 5fdd0a28313ced749a95116828dcbbfbfec6ffd3 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Thu, 15 Oct 2026 17:42:50 -0700 Subject: [PATCH 16/60] fixing CI --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c21b5aa..111549f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -64,5 +64,6 @@ jobs: dotnet build --no-restore --configuration Release - name: Run tests + working-directory: ${{ env.WDIR }} run: | dotnet test "./Unit Tests/Unit Tests.csproj" --no-build --configuration Release --verbosity normal From ddf89b749c7553b8a04f469bb964591df498cc14 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Fri, 16 Oct 2026 20:03:45 -0700 Subject: [PATCH 17/60] updating cd workflows --- ....yml => cd-csharp_database_eextension.yml} | 4 +- ... cd-csharp_database_extension_testing.yml} | 2 +- .github/workflows/ci.yaml | 77 ++++++++++++++----- .github/workflows/codeql.yml | 37 --------- .../workflows/vcheck_csm-database-testing.yml | 50 ------------ .../workflows/vcheck_csm-database_core.yml | 50 ------------ 6 files changed, 58 insertions(+), 162 deletions(-) rename .github/workflows/{publish_csm-database-core.yml => cd-csharp_database_eextension.yml} (92%) rename .github/workflows/{publish_csm-database-testing.yml => cd-csharp_database_extension_testing.yml} (97%) delete mode 100644 .github/workflows/codeql.yml delete mode 100644 .github/workflows/vcheck_csm-database-testing.yml delete mode 100644 .github/workflows/vcheck_csm-database_core.yml diff --git a/.github/workflows/publish_csm-database-core.yml b/.github/workflows/cd-csharp_database_eextension.yml similarity index 92% rename from .github/workflows/publish_csm-database-core.yml rename to .github/workflows/cd-csharp_database_eextension.yml index 335f9da..f5505eb 100644 --- a/.github/workflows/publish_csm-database-core.yml +++ b/.github/workflows/cd-csharp_database_eextension.yml @@ -1,10 +1,8 @@ -name: Publish [CSM Database Core] +name: CD CSharp Database Extension on: - # 1) Manual trigger in the Actions tab workflow_dispatch: - # 2) Push to main, but only if files under the folder change push: branches: - main diff --git a/.github/workflows/publish_csm-database-testing.yml b/.github/workflows/cd-csharp_database_extension_testing.yml similarity index 97% rename from .github/workflows/publish_csm-database-testing.yml rename to .github/workflows/cd-csharp_database_extension_testing.yml index f38fbbc..c566f93 100644 --- a/.github/workflows/publish_csm-database-testing.yml +++ b/.github/workflows/cd-csharp_database_extension_testing.yml @@ -1,4 +1,4 @@ -name: Publish CSM Foundation Database Testing +name: CD CSharp Database Extension Testing on: # 1) Manual trigger in the Actions tab diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 111549f..e78dba0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,42 +1,37 @@ name: CI -# CI Workflow checks that solution builds, unit tests passes and code-health. - on: + workflow_dispatch: + pull_request: - branches: [ - dev, - main, - ] - types: [ - opened, - reopened, - synchronize, - ] + branches: [dev, main] + types: [opened, reopened, synchronize] jobs: unit_testing: - env: - WDIR: csharp_database_extension name: Unit Testing runs-on: ubuntu-latest concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number }} cancel-in-progress: true + env: + WDIR: csharp_database_extension + TEST_PROJECT: "Unit Tests/Unit Tests.csproj" + steps: - name: Checkout code uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Setup GitHub source packages. + - name: Configure NuGet (GitHub Packages) env: NUGET_AUTH_TOKEN: ${{ secrets.PUBLISH_PAT }} run: | dotnet nuget add source \ "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \ - --name "github" \ + --name github \ --username ${{ github.actor }} \ --password "$NUGET_AUTH_TOKEN" \ --store-password-in-clear-text @@ -51,19 +46,59 @@ jobs: with: path: ~/.nuget/packages key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} - restore-keys: | - ${{ runner.os }}-nuget- + restore-keys: ${{ runner.os }}-nuget- - name: Restore dependencies working-directory: ${{ env.WDIR }} run: dotnet restore - - name: Build solution + - name: Enforce code formatting (EditorConfig) working-directory: ${{ env.WDIR }} - run: | - dotnet build --no-restore --configuration Release + run: dotnet format --verify-no-changes + + - name: Build with analyzers (warnaserror) + working-directory: ${{ env.WDIR }} + run: dotnet build --no-restore --configuration Release -warnaserror - name: Run tests working-directory: ${{ env.WDIR }} + run: dotnet test "$TEST_PROJECT" --no-build --configuration Release --verbosity normal + + - name: Dependency Review (security) + uses: actions/dependency-review-action@v4 + + - name: Secret Scan + uses: gitleaks/gitleaks-action@v3 + + + code_analyze: + name: CodeQL Analysis + runs-on: ubuntu-latest + permissions: + security-events: write + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Configure NuGet (GitHub Packages) + env: + NUGET_AUTH_TOKEN: ${{ secrets.PUBLISH_PAT }} run: | - dotnet test "./Unit Tests/Unit Tests.csproj" --no-build --configuration Release --verbosity normal + dotnet nuget add source \ + "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \ + --name github \ + --username ${{ github.actor }} \ + --password "$NUGET_AUTH_TOKEN" \ + --store-password-in-clear-text + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: csharp + + - name: Autobuild + uses: github/codeql-action/autobuild@v3 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml deleted file mode 100644 index 5839516..0000000 --- a/.github/workflows/codeql.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: "CodeQL" - -on: - pull_request: - branches: [main, dev] - -jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - security-events: write - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: 🔑 Configure NuGet to use GitHub Packages - env: - NUGET_AUTH_TOKEN: ${{ secrets.PUBLISH_PAT }} - run: | - dotnet nuget add source \ - "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \ - --name "github" \ - --username ${{ github.actor }} \ - --password "$NUGET_AUTH_TOKEN" \ - --store-password-in-clear-text - - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: csharp - - - name: Autobuild - uses: github/codeql-action/autobuild@v3 - - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/vcheck_csm-database-testing.yml b/.github/workflows/vcheck_csm-database-testing.yml deleted file mode 100644 index 62669cf..0000000 --- a/.github/workflows/vcheck_csm-database-testing.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Version Check [CSM Database Testing] - -on: - pull_request: - branches: - - main - types: [opened, synchronize] - paths: - - 'CSM Database Testing/**' - -jobs: - check-version: - runs-on: ubuntu-latest - if: github.base_ref == 'main' - steps: - - name: Checkout PR branch - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Define project path - id: config - run: | - echo 'project_path="CSM Database Testing/CSM Database Testing.csproj"' >> $GITHUB_OUTPUT - - - name: Get version from PR branch - id: pr_version - run: | - PROJECT_PATH=${{ steps.config.outputs.project_path }} - VERSION_PR=$(grep -oPm1 "(?<=)[^<]+" "$PROJECT_PATH") - echo "version_pr=$VERSION_PR" >> $GITHUB_OUTPUT - - - name: Get version from main branch - id: main_version - run: | - PROJECT_PATH=${{ steps.config.outputs.project_path }} - git fetch origin main - VERSION_MAIN=$(git show origin/main:"$PROJECT_PATH" | grep -oPm1 "(?<=)[^<]+") - echo "version_main=$VERSION_MAIN" >> $GITHUB_OUTPUT - - - name: Compare versions - run: | - echo "PR version: ${{ steps.pr_version.outputs.version_pr }}" - echo "Main version: ${{ steps.main_version.outputs.version_main }}" - if [ "${{ steps.pr_version.outputs.version_pr }}" == "${{ steps.main_version.outputs.version_main }}" ]; then - echo "❌ Version has not been updated!" - exit 1 - else - echo "✅ Version updated." - fi diff --git a/.github/workflows/vcheck_csm-database_core.yml b/.github/workflows/vcheck_csm-database_core.yml deleted file mode 100644 index 3a38f1f..0000000 --- a/.github/workflows/vcheck_csm-database_core.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Version Check [CSM Database Core] - -on: - pull_request: - branches: - - main - types: [opened, synchronize] - paths: - - 'CSM Database Core/**' - -jobs: - check-version: - runs-on: ubuntu-latest - if: github.base_ref == 'main' - steps: - - name: Checkout PR branch - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Define project path - id: config - run: | - echo 'project_path="CSM Database Core/CSM Database Core.csproj"' >> $GITHUB_OUTPUT - - - name: Get version from PR branch - id: pr_version - run: | - PROJECT_PATH=${{ steps.config.outputs.project_path }} - VERSION_PR=$(grep -oPm1 "(?<=)[^<]+" "$PROJECT_PATH") - echo "version_pr=$VERSION_PR" >> $GITHUB_OUTPUT - - - name: Get version from main branch - id: main_version - run: | - PROJECT_PATH=${{ steps.config.outputs.project_path }} - git fetch origin main - VERSION_MAIN=$(git show origin/main:"$PROJECT_PATH" | grep -oPm1 "(?<=)[^<]+") - echo "version_main=$VERSION_MAIN" >> $GITHUB_OUTPUT - - - name: Compare versions - run: | - echo "PR version: ${{ steps.pr_version.outputs.version_pr }}" - echo "Main version: ${{ steps.main_version.outputs.version_main }}" - if [ "${{ steps.pr_version.outputs.version_pr }}" == "${{ steps.main_version.outputs.version_main }}" ]; then - echo "❌ Version has not been updated!" - exit 1 - else - echo "✅ Version updated." - fi From 9ff51262b5ab85e419ec41049c77ae277ce3d3d6 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Fri, 16 Oct 2026 20:08:22 -0700 Subject: [PATCH 18/60] pusing eol validation --- csharp_database_extension/.editorconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/csharp_database_extension/.editorconfig b/csharp_database_extension/.editorconfig index 384a997..57d857f 100644 --- a/csharp_database_extension/.editorconfig +++ b/csharp_database_extension/.editorconfig @@ -262,4 +262,5 @@ dotnet_style_predefined_type_for_member_access = true:silent dotnet_style_require_accessibility_modifiers = omit_if_default:silent dotnet_style_allow_statement_immediately_after_block_experimental = true:silent dotnet_style_allow_multiple_blank_lines_experimental = true:silent -dotnet_code_quality_unused_parameters = all:silent \ No newline at end of file +dotnet_code_quality_unused_parameters = all:silent +dotnet_diagnostic.end_of_line.severity = none \ No newline at end of file From 7fb7b54e48718464f9643bc1bd51826ca37a7b2b Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Fri, 16 Oct 2026 20:22:32 -0700 Subject: [PATCH 19/60] trying something else --- .github/workflows/ci.yaml | 1 - csharp_database_extension/.editorconfig | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e78dba0..59a3be4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -70,7 +70,6 @@ jobs: - name: Secret Scan uses: gitleaks/gitleaks-action@v3 - code_analyze: name: CodeQL Analysis runs-on: ubuntu-latest diff --git a/csharp_database_extension/.editorconfig b/csharp_database_extension/.editorconfig index 57d857f..8a2f364 100644 --- a/csharp_database_extension/.editorconfig +++ b/csharp_database_extension/.editorconfig @@ -4,6 +4,7 @@ root = true # C# files [*.cs] dotnet_diagnostic.IDE0058.severity = none +csharp_new_line_end_of_line = ignore #### Core EditorConfig Options #### @@ -262,5 +263,4 @@ dotnet_style_predefined_type_for_member_access = true:silent dotnet_style_require_accessibility_modifiers = omit_if_default:silent dotnet_style_allow_statement_immediately_after_block_experimental = true:silent dotnet_style_allow_multiple_blank_lines_experimental = true:silent -dotnet_code_quality_unused_parameters = all:silent -dotnet_diagnostic.end_of_line.severity = none \ No newline at end of file +dotnet_code_quality_unused_parameters = all:silent \ No newline at end of file From 69331f6976363f35dca7efac533881a963eece9e Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Fri, 16 Oct 2026 20:25:19 -0700 Subject: [PATCH 20/60] adding git attributes --- .gitattributes | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..db2a596 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text eol=crlf \ No newline at end of file From 68152a635563a72f7667bfcde1f64601913ba906 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Fri, 16 Oct 2026 20:30:04 -0700 Subject: [PATCH 21/60] checking now --- csharp_database_extension/.editorconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/csharp_database_extension/.editorconfig b/csharp_database_extension/.editorconfig index 8a2f364..e292354 100644 --- a/csharp_database_extension/.editorconfig +++ b/csharp_database_extension/.editorconfig @@ -4,7 +4,6 @@ root = true # C# files [*.cs] dotnet_diagnostic.IDE0058.severity = none -csharp_new_line_end_of_line = ignore #### Core EditorConfig Options #### @@ -15,7 +14,7 @@ tab_width = 4 # New line preferences end_of_line = crlf -insert_final_newline = false +insert_final_newline = true #### .NET Coding Conventions #### From 1305b5258cc2ed9b7501717765c99a6391aa2c57 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Fri, 16 Oct 2026 20:36:24 -0700 Subject: [PATCH 22/60] changing approach --- .github/workflows/ci.yaml | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 59a3be4..f04e32d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -52,11 +52,7 @@ jobs: working-directory: ${{ env.WDIR }} run: dotnet restore - - name: Enforce code formatting (EditorConfig) - working-directory: ${{ env.WDIR }} - run: dotnet format --verify-no-changes - - - name: Build with analyzers (warnaserror) + - name: Build with analyzers working-directory: ${{ env.WDIR }} run: dotnet build --no-restore --configuration Release -warnaserror @@ -101,3 +97,21 @@ jobs: - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 + + style_analyze: + name: Code Analyze + runs-on: ubuntu-latest + permissions: + security-events: write + + env: + WDIR: csharp_database_extension + + steps: + - name: Formatting style + working-directory: ${{ env.WDIR }} + run: dotnet format style --verify-no-changes + + - name: Formatting analyzer + working-directory: ${{ env.WDIR }} + run: dotnet format analyzers --verify-no-changes \ No newline at end of file From c9e97f47377021f3eee7c8d34dd8d46f349eba90 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Fri, 16 Oct 2026 20:39:18 -0700 Subject: [PATCH 23/60] applying checks --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f04e32d..294bf81 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -105,7 +105,7 @@ jobs: security-events: write env: - WDIR: csharp_database_extension + WDIR: ./csharp_database_extension steps: - name: Formatting style From 550a46d09eafe0e284d6515a317692a0d3054b18 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Fri, 16 Oct 2026 20:44:22 -0700 Subject: [PATCH 24/60] trying again --- .github/workflows/ci.yaml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 294bf81..99d1407 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -60,12 +60,6 @@ jobs: working-directory: ${{ env.WDIR }} run: dotnet test "$TEST_PROJECT" --no-build --configuration Release --verbosity normal - - name: Dependency Review (security) - uses: actions/dependency-review-action@v4 - - - name: Secret Scan - uses: gitleaks/gitleaks-action@v3 - code_analyze: name: CodeQL Analysis runs-on: ubuntu-latest @@ -97,6 +91,9 @@ jobs: - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v3 + + - name: Dependency Review (security) + uses: actions/dependency-review-action@v4 style_analyze: name: Code Analyze @@ -104,14 +101,9 @@ jobs: permissions: security-events: write - env: - WDIR: ./csharp_database_extension - steps: - name: Formatting style - working-directory: ${{ env.WDIR }} run: dotnet format style --verify-no-changes - name: Formatting analyzer - working-directory: ${{ env.WDIR }} run: dotnet format analyzers --verify-no-changes \ No newline at end of file From 53d54dc957c99081e8dd9ceb7571e9deb9d1d89e Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Fri, 16 Oct 2026 20:45:05 -0700 Subject: [PATCH 25/60] updating workflow --- .github/workflows/ci.yaml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 99d1407..f7cecc7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -65,6 +65,9 @@ jobs: runs-on: ubuntu-latest permissions: security-events: write + concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true steps: - name: Checkout code @@ -98,8 +101,9 @@ jobs: style_analyze: name: Code Analyze runs-on: ubuntu-latest - permissions: - security-events: write + concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true steps: - name: Formatting style From ac2b36850e99c9ed3397dbbf9aa653b086f2a0e2 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Fri, 16 Oct 2026 20:45:44 -0700 Subject: [PATCH 26/60] aother update --- .github/workflows/ci.yaml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f7cecc7..3862ec6 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -65,9 +65,6 @@ jobs: runs-on: ubuntu-latest permissions: security-events: write - concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number }} - cancel-in-progress: true steps: - name: Checkout code @@ -101,9 +98,6 @@ jobs: style_analyze: name: Code Analyze runs-on: ubuntu-latest - concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number }} - cancel-in-progress: true steps: - name: Formatting style From 5c5e6ee8686b95830456c577d3f123c4ae4f242b Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Fri, 16 Oct 2026 20:47:57 -0700 Subject: [PATCH 27/60] another try --- .github/workflows/ci.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3862ec6..48895ac 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -8,6 +8,17 @@ on: types: [opened, reopened, synchronize] jobs: + style_analyze: + name: Code Analyze + runs-on: ubuntu-latest + + steps: + - name: Formatting style + run: dotnet format style --verify-no-changes + + - name: Formatting analyzer + run: dotnet format analyzers --verify-no-changes + unit_testing: name: Unit Testing runs-on: ubuntu-latest @@ -94,14 +105,3 @@ jobs: - name: Dependency Review (security) uses: actions/dependency-review-action@v4 - - style_analyze: - name: Code Analyze - runs-on: ubuntu-latest - - steps: - - name: Formatting style - run: dotnet format style --verify-no-changes - - - name: Formatting analyzer - run: dotnet format analyzers --verify-no-changes \ No newline at end of file From 9cc6b48a7c6f0dcf985d7e51abbfd009a127daf2 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Fri, 16 Oct 2026 20:52:39 -0700 Subject: [PATCH 28/60] last try --- .github/workflows/ci.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 48895ac..83de5f4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,11 +12,21 @@ jobs: name: Code Analyze runs-on: ubuntu-latest + env: + WDIR: csharp_database_extension + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Formatting style + working-directory: ${{ env.WDIR }} run: dotnet format style --verify-no-changes - name: Formatting analyzer + working-directory: ${{ env.WDIR }} run: dotnet format analyzers --verify-no-changes unit_testing: From a60747ed212a4b3a14160cdd2b249713fc824e42 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Fri, 16 Oct 2026 20:56:47 -0700 Subject: [PATCH 29/60] adding nuget source --- .github/workflows/ci.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 83de5f4..eae7c2f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,6 +21,22 @@ jobs: with: fetch-depth: 0 + - name: 🔑 Configure NuGet to use GitHub Packages + env: + NUGET_AUTH_TOKEN: ${{ secrets.PUBLISH_PAT }} + run: | + dotnet nuget add source \ + "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \ + --name "github" \ + --username ${{ github.actor }} \ + --password "$NUGET_AUTH_TOKEN" \ + --store-password-in-clear-text + + - name: ⚙️ Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + - name: Formatting style working-directory: ${{ env.WDIR }} run: dotnet format style --verify-no-changes From bda649d2c59aaedca3fbbae5744b8c1bc5f4c080 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Sat, 17 Oct 2026 02:10:40 -0700 Subject: [PATCH 30/60] removing cd workflows --- .../cd-csharp_database_eextension.yml | 71 ------------------- .../cd-csharp_database_extension_testing.yml | 71 ------------------- 2 files changed, 142 deletions(-) delete mode 100644 .github/workflows/cd-csharp_database_eextension.yml delete mode 100644 .github/workflows/cd-csharp_database_extension_testing.yml diff --git a/.github/workflows/cd-csharp_database_eextension.yml b/.github/workflows/cd-csharp_database_eextension.yml deleted file mode 100644 index f5505eb..0000000 --- a/.github/workflows/cd-csharp_database_eextension.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: CD CSharp Database Extension - -on: - workflow_dispatch: - - push: - branches: - - main - paths: - - 'CSM Database Core/**' - -permissions: - contents: read - packages: write - -jobs: - package_publish: - runs-on: ubuntu-latest - - env: - CS_PROJECT_PATH: 'CSM Database Core/CSM Database Core.csproj' - - steps: - - name: 🔄 Checkout repo - uses: actions/checkout@v3 - - - name: 🔑 Configure NuGet to use GitHub Packages - env: - NUGET_AUTH_TOKEN: ${{ secrets.PUBLISH_PAT }} - run: | - dotnet nuget add source \ - "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \ - --name "github" \ - --username ${{ github.actor }} \ - --password "$NUGET_AUTH_TOKEN" \ - --store-password-in-clear-text - - - name: ⚙️ Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.0.x' - - - name: 🔧 Restore & Build - run: | - dotnet restore "$CS_PROJECT_PATH" - dotnet build "$CS_PROJECT_PATH" \ - --configuration Release - - - name: 📦 Pack NuGet project - run: | - # ensure output folder exists at the repo root - mkdir -p "$GITHUB_WORKSPACE/nupkgs" - dotnet pack "$CS_PROJECT_PATH" \ - --configuration Release \ - --output "$GITHUB_WORKSPACE/nupkgs" - - - - name: 📋 Verify generated packages - run: | - echo "Contents of nupkgs folder:" - ls -la "$GITHUB_WORKSPACE/nupkgs" - - - - name: 📤 Push to GitHub Packages - run: | - dotnet nuget push "$GITHUB_WORKSPACE/nupkgs/*.nupkg" \ - --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \ - --api-key "${{ secrets.PUBLISH_PAT }}" \ - --skip-duplicate - - diff --git a/.github/workflows/cd-csharp_database_extension_testing.yml b/.github/workflows/cd-csharp_database_extension_testing.yml deleted file mode 100644 index c566f93..0000000 --- a/.github/workflows/cd-csharp_database_extension_testing.yml +++ /dev/null @@ -1,71 +0,0 @@ -name: CD CSharp Database Extension Testing - -on: - # 1) Manual trigger in the Actions tab - workflow_dispatch: - - # 2) Push to main, but only if files under the folder change - push: - branches: - - main - paths: - - 'CSM Database Testing/**' - -permissions: - contents: read - packages: write - -jobs: - package_publish: - runs-on: ubuntu-latest - - env: - CS_PROJECT_PATH: 'CSM Database Testing/CSM Database Testing.csproj' - - steps: - - name: 🔄 Checkout repo - uses: actions/checkout@v3 - - - name: 🔑 Configure NuGet to use GitHub Packages - env: - NUGET_AUTH_TOKEN: ${{ secrets.PUBLISH_PAT }} - run: | - dotnet nuget add source \ - "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \ - --name "github" \ - --username ${{ github.actor }} \ - --password "$NUGET_AUTH_TOKEN" \ - --store-password-in-clear-text - - - name: ⚙️ Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: '8.0.x' - - - name: 🔧 Restore & Build - run: | - dotnet restore "$CS_PROJECT_PATH" - dotnet build "$CS_PROJECT_PATH" \ - --configuration Release - - - name: 📦 Pack NuGet project - run: | - # ensure output folder exists at the repo root - mkdir -p "$GITHUB_WORKSPACE/nupkgs" - dotnet pack "$CS_PROJECT_PATH" \ - --configuration Release \ - --output "$GITHUB_WORKSPACE/nupkgs" - - - - name: 📋 Verify generated packages - run: | - echo "Contents of nupkgs folder:" - ls -la "$GITHUB_WORKSPACE/nupkgs" - - - - name: 📤 Push to GitHub Packages - run: | - dotnet nuget push "$GITHUB_WORKSPACE/nupkgs/*.nupkg" \ - --source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" \ - --api-key "${{ secrets.PUBLISH_PAT }}" \ - --skip-duplicate From ec1741c0de85e243523c8a51286e7208758eecbc Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Sat, 17 Oct 2026 02:34:54 -0700 Subject: [PATCH 31/60] adding package metadata and bump checker --- .github/workflows/cd-1.yml | 74 ++++++++++++++++++++++++++++++++++++++ csmpackage.json | 7 ++++ 2 files changed, 81 insertions(+) create mode 100644 .github/workflows/cd-1.yml create mode 100644 csmpackage.json diff --git a/.github/workflows/cd-1.yml b/.github/workflows/cd-1.yml new file mode 100644 index 0000000..b2bb9e8 --- /dev/null +++ b/.github/workflows/cd-1.yml @@ -0,0 +1,74 @@ +name: CD 1 + +# This workflow supports the first phase of delvier process, when a PR is opened pointing [main] branch, will trigger validations. + +on: + workflow_dispatch: + + pull_request: + branches: + - main + types: + - opened + - reopened + - synchronize + +jobs: + validate-source: + name: Validate Source Branch + runs-on: ubuntu-latest + + if: > + github.event.pull_request.head.ref == 'dev' + + steps: + - run: echo "Valid PR source branch [dev]" + + compare-versions: + needs: validate-source + name: Compare Versions + runs-on: ubuntu-latest + + steps: + - name: CheckOut Base + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.base.ref }} + path: base + + - name: CheckOut Head + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.ref }} + path: head + + - name: Read Base version + id: base_version + run: | + VERSION=$(jq -r '.version' base/csmpackage.json) + echo "version=$VERSION" >> $GITHUB_OUTPUT + + - name: Read Head version + id: head_version + run: | + VERSION=$(jq -r '.version' head/csmpackage.json) + echo "version=$VERSION" >> $GITHUB_OUTPUT + + - name: Compare versions + run: | + BASE="${{ steps.base_version.outputs.version }}" + HEAD="${{ steps.head_version.outputs.version }}" + + echo "Base version: $BASE" + echo "Head version: $HEAD" + + if [ "$BASE" = "$HEAD" ]; then + echo "Package metadata versions are not bumped" + exit 1 + fi + + echo "Versions bumped correctly" + + + + diff --git a/csmpackage.json b/csmpackage.json new file mode 100644 index 0000000..86e74e5 --- /dev/null +++ b/csmpackage.json @@ -0,0 +1,7 @@ +{ + "version": "0.0.1-beta", + "packages": [ + "csharp_database_extension/CSharp Database Extension", + "csharp_database_extension/CSharp Database Extension Testing" + ] +} \ No newline at end of file From a4f3719be112e084fd29579d6ca44ec60267f948 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Mon, 19 Oct 2026 00:51:32 -0700 Subject: [PATCH 32/60] testing workflow to auto-generate release docs --- .github/workflows/cd-1.yml | 196 ++++++++++++++++++++++++++++++++++++- 1 file changed, 195 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cd-1.yml b/.github/workflows/cd-1.yml index b2bb9e8..aa0e33a 100644 --- a/.github/workflows/cd-1.yml +++ b/.github/workflows/cd-1.yml @@ -1,6 +1,8 @@ name: CD 1 # This workflow supports the first phase of delvier process, when a PR is opened pointing [main] branch, will trigger validations. +# First will check if all PR opened to [main] are from [dev]. +# Then will check that package metadata version was bumped correctly. on: workflow_dispatch: @@ -13,7 +15,11 @@ on: - reopened - synchronize +permissions: + contents: write + jobs: + validate-source: name: Validate Source Branch runs-on: ubuntu-latest @@ -28,6 +34,9 @@ jobs: needs: validate-source name: Compare Versions runs-on: ubuntu-latest + outputs: + version: ${{ steps.package_metadata.outputs.version }} + packages: ${{ steps.package_metadata.outputs.packages }} steps: - name: CheckOut Base @@ -69,6 +78,191 @@ jobs: echo "Versions bumped correctly" - + - name: Exposing package metadata + id: package_metadata + run: | + VERSION=$(jq -r '.version' head/csmpackage.json) + PACKAGES=$(jq -r '.packages[]' head/csmpackage.json) + + echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "packages=$PACKAGES_JSON" >> $GITHUB_OUTPUT + + generate_release_docs: + name: Generate Release Documentation (Release-Notes & Changelog) + needs: compare-versions + runs-on: ubuntu-latest + strategy: + matrix: + package: ${{ fromJson(needs.compare-versions.outputs.packages) }} + steps: + - name: CheckOut Head branch + uses: actions/checkout@v3 + with: + ref: ${{ github.event.pull_request.head.ref }} + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: SetUp GitHub Access + run: | + git config user.name "github-actions" + git config user.email "github-actions@github.com" + + - name: Prepare Package Metadata + run: | + echo "PACKAGE='${{ matrix.package }}'" + echo "VERSION='${{ needs.compare-versions.outputs.version }}'" + shell: bash + + - name: Generate release notes and update CHANGELOG + id: gen_docs + run: | + set -euo pipefail + + PACKAGE="${{ matrix.package }}" + VERSION="${{ needs.compare-versions.outputs.version }}" + + # Derive package path (preserve full path if matrix.package is a path) + PACKAGE_PATH="$PACKAGE" + # If matrix.package contains a repo-like "dir/subdir", keep it as-is. + # Release notes directory and file + RELEASE_DIR="$PACKAGE_PATH/release-notes" + RELEASE_FILE="$RELEASE_DIR/v${VERSION}.md" + + echo "Package path: $PACKAGE_PATH" + echo "Release notes file: $RELEASE_FILE" + + mkdir -p "$RELEASE_DIR" + + # Build release notes content + { + echo "## Release $VERSION" + echo "" + echo "### Commits included" + echo "" + } > "$RELEASE_FILE" + + BASE_SHA="${{ github.event.pull_request.base.sha }}" + HEAD_SHA="${{ github.event.pull_request.head.sha }}" + + if [ -z "$BASE_SHA" ] || [ -z "$HEAD_SHA" ]; then + echo "- Unable to determine commit range." >> "$RELEASE_FILE" + else + # If there are no commits in range, note it; otherwise list commits + if [ "$(git rev-list --count "$BASE_SHA..$HEAD_SHA")" -eq 0 ]; then + echo "- No commits detected between base and head." >> "$RELEASE_FILE" + else + git --no-pager log --pretty=format:"- %s (%an)" "$BASE_SHA..$HEAD_SHA" >> "$RELEASE_FILE" + fi + fi + + echo "Wrote release notes to $RELEASE_FILE" + + # Ensure CHANGELOG exists at package root + CHANGELOG_FILE="$PACKAGE_PATH/CHANGELOG" + if [ ! -f "$CHANGELOG_FILE" ]; then + echo "Creating new CHANGELOG at $CHANGELOG_FILE" + echo "# Changelog" > "$CHANGELOG_FILE" + echo "" >> "$CHANGELOG_FILE" + fi + + # Prepare new changelog entry content (you can customize the header/body format) + NEW_ENTRY_FILE="$(mktemp)" + { + echo "## v${VERSION}" + echo "" + echo "### Release notes" + echo "" + # Insert the same commit list into the changelog entry + sed -n '1,200000p' "$RELEASE_FILE" | sed '1,2d' # skip the top two lines already added above + echo "" + } > "$NEW_ENTRY_FILE" + + # Replace existing entry for this version if present, otherwise prepend new entry after top header + # We treat entries as starting with a line that matches '^## v' + if grep -qE "^## v${VERSION}\b" "$CHANGELOG_FILE"; then + echo "Found existing CHANGELOG entry for v${VERSION}, replacing it." + # Use awk to replace the section starting at "## vVERSION" up to the next "## v" or EOF + awk -v ver="v${VERSION}" -v newfile="$NEW_ENTRY_FILE" ' + BEGIN { + replaced = 0; + while ((getline line < newfile) > 0) { + newlines = newlines line "\n" + } + close(newfile) + } + { + if ($0 ~ "^## " ver "\\b") { + # print newlines and skip until next "## v" or EOF + printf "%s", newlines + replaced = 1 + # skip lines until next "## v" header + while (getline > 0) { + if ($0 ~ "^## v[0-9]+") { + print $0 + break + } + } + next + } + print $0 + } + END { + if (replaced == 0) { + # no replacement happened; print nothing here (caller will handle prepend) + } + } + ' "$CHANGELOG_FILE" > "${CHANGELOG_FILE}.tmp" || true + + # If awk produced a tmp file with content, move it back; otherwise fall back to prepend + if [ -s "${CHANGELOG_FILE}.tmp" ]; then + mv "${CHANGELOG_FILE}.tmp" "$CHANGELOG_FILE" + else + # fallback: prepend + cat "$NEW_ENTRY_FILE" "$CHANGELOG_FILE" > "${CHANGELOG_FILE}.tmp" + mv "${CHANGELOG_FILE}.tmp" "$CHANGELOG_FILE" + fi + else + echo "No existing entry for v${VERSION}. Prepending new entry to CHANGELOG." + # Prepend new entry after the top-level header if present, otherwise at top + # If file starts with "# Changelog", keep it and insert after that header + if head -n1 "$CHANGELOG_FILE" | grep -qE '^#\s+Changelog'; then + # keep header line, then insert new entry + tail -n +2 "$CHANGELOG_FILE" > "${CHANGELOG_FILE}.body.tmp" + { head -n1 "$CHANGELOG_FILE"; echo ""; cat "$NEW_ENTRY_FILE"; echo ""; cat "${CHANGELOG_FILE}.body.tmp"; } > "${CHANGELOG_FILE}.tmp" + mv "${CHANGELOG_FILE}.tmp" "$CHANGELOG_FILE" + rm -f "${CHANGELOG_FILE}.body.tmp" + else + # no top header, just prepend + cat "$NEW_ENTRY_FILE" "$CHANGELOG_FILE" > "${CHANGELOG_FILE}.tmp" + mv "${CHANGELOG_FILE}.tmp" "$CHANGELOG_FILE" + fi + fi + + rm -f "$NEW_ENTRY_FILE" + + echo "Updated CHANGELOG at $CHANGELOG_FILE" + + # Expose whether there are changes to commit + if git status --porcelain | grep -q .; then + echo "changes=true" >> "$GITHUB_OUTPUT" + else + echo "changes=false" >> "$GITHUB_OUTPUT" + fi + shell: bash + + - name: Commit Generated vdocs + if: steps.gen_docs.outputs.changes == 'true' + run: | + set -euo pipefail + git add -A + # Use exact commit title requested + git commit -m "Generated vdocs." + git push origin HEAD:${{ github.event.pull_request.head.ref }} + echo "Pushed commit 'Generated vdocs.' to branch ${{ github.event.pull_request.head.ref }}" + shell: bash + + - name: No changes to commit + if: steps.gen_docs.outputs.changes == 'false' + run: echo "No release docs changes detected; nothing to commit." From 42faf8be6bf3aa7cf7ca56fb0de701a4a047a82d Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Mon, 19 Oct 2026 00:55:27 -0700 Subject: [PATCH 33/60] corrected a workflow var --- .github/workflows/cd-1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd-1.yml b/.github/workflows/cd-1.yml index aa0e33a..6f79a8b 100644 --- a/.github/workflows/cd-1.yml +++ b/.github/workflows/cd-1.yml @@ -85,7 +85,7 @@ jobs: PACKAGES=$(jq -r '.packages[]' head/csmpackage.json) echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "packages=$PACKAGES_JSON" >> $GITHUB_OUTPUT + echo "packages=$PACKAGES" >> $GITHUB_OUTPUT generate_release_docs: name: Generate Release Documentation (Release-Notes & Changelog) From c9962a2167cac11024c602db07217f3eb0464697 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Mon, 19 Oct 2026 00:58:54 -0700 Subject: [PATCH 34/60] trying single line approach --- .github/workflows/cd-1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd-1.yml b/.github/workflows/cd-1.yml index 6f79a8b..8df8f3f 100644 --- a/.github/workflows/cd-1.yml +++ b/.github/workflows/cd-1.yml @@ -82,7 +82,7 @@ jobs: id: package_metadata run: | VERSION=$(jq -r '.version' head/csmpackage.json) - PACKAGES=$(jq -r '.packages[]' head/csmpackage.json) + PACKAGES=$(jq -c '.packages[]' head/csmpackage.json) echo "version=$VERSION" >> $GITHUB_OUTPUT echo "packages=$PACKAGES" >> $GITHUB_OUTPUT From d8f3654b482ed7071a1e607747aa5e867272cebd Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Mon, 19 Oct 2026 01:02:18 -0700 Subject: [PATCH 35/60] trying another apporach --- .github/workflows/cd-1.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cd-1.yml b/.github/workflows/cd-1.yml index 8df8f3f..7677164 100644 --- a/.github/workflows/cd-1.yml +++ b/.github/workflows/cd-1.yml @@ -78,14 +78,15 @@ jobs: echo "Versions bumped correctly" - - name: Exposing package metadata + - name: Expose Package Metadata id: package_metadata - run: | + run: | VERSION=$(jq -r '.version' head/csmpackage.json) - PACKAGES=$(jq -c '.packages[]' head/csmpackage.json) + PACKAGES_JSON=$(jq -c '.packages' head/csmpackage.json) + + printf '%s\n' "version=$VERSION" >> $GITHUB_OUTPUT + printf '%s\n' "packages=$PACKAGES_JSON" >> $GITHUB_OUTPUT - echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "packages=$PACKAGES" >> $GITHUB_OUTPUT generate_release_docs: name: Generate Release Documentation (Release-Notes & Changelog) From 15028083e7473b321000a0e8aaa78427f90a6a14 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Mon, 19 Oct 2026 01:25:15 -0700 Subject: [PATCH 36/60] testing new version --- .github/workflows/cd-1.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.github/workflows/cd-1.yml b/.github/workflows/cd-1.yml index 7677164..bc0afa0 100644 --- a/.github/workflows/cd-1.yml +++ b/.github/workflows/cd-1.yml @@ -51,6 +51,28 @@ jobs: ref: ${{ github.event.pull_request.head.ref }} path: head + - name: Prevent Merges + run: | + set -euo pipefail + HEAD_REF="${{ github.head_ref }}" + echo "Head Branch: $HEAD_REF" + + # Regex: vbump_1.2.3 or vbump_1.2.3-beta etc. + + if [ [ "$HEAD_REF" == "dev" ] ] + echo "Cannot merge into main from dev branch" + exit 1. + fi + + if [[ "$HEAD_REF" =~ ^vbump_[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9._-]+)?$ ]]; then + echo "Name matches version bump" + exit 0 + else + echo "Branch name does NOT match required pattern: vbump_{version}" + echo "Expected example: vbump_{version}" + exit 1 + fi + - name: Read Base version id: base_version run: | From efac5dcf8898d534758b27bb4ea7841f9a78d9c4 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Mon, 19 Oct 2026 01:29:48 -0700 Subject: [PATCH 37/60] fixed syntax error --- .github/workflows/cd-1.yml | 45 ++++++++++++++++---------------------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/.github/workflows/cd-1.yml b/.github/workflows/cd-1.yml index bc0afa0..374c45a 100644 --- a/.github/workflows/cd-1.yml +++ b/.github/workflows/cd-1.yml @@ -24,11 +24,26 @@ jobs: name: Validate Source Branch runs-on: ubuntu-latest - if: > - github.event.pull_request.head.ref == 'dev' + steps: + - name: Prevent Sources + run: | + set -euo pipefail + HEAD_REF="${{ github.head_ref }}" + echo "Head Branch: $HEAD_REF" - steps: - - run: echo "Valid PR source branch [dev]" + if [ [ "$HEAD_REF" == "dev" ] ] + echo "Cannot merge into main from dev branch" + exit 1 + fi + + if [[ "$HEAD_REF" =~ ^vbump_[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9._-]+)?$ ]]; then + echo "Name matches version bump" + exit 0 + else + echo "Branch name does NOT match required pattern: vbump_{version}" + echo "Expected example: vbump_{version}" + exit 1 + fi compare-versions: needs: validate-source @@ -51,28 +66,6 @@ jobs: ref: ${{ github.event.pull_request.head.ref }} path: head - - name: Prevent Merges - run: | - set -euo pipefail - HEAD_REF="${{ github.head_ref }}" - echo "Head Branch: $HEAD_REF" - - # Regex: vbump_1.2.3 or vbump_1.2.3-beta etc. - - if [ [ "$HEAD_REF" == "dev" ] ] - echo "Cannot merge into main from dev branch" - exit 1. - fi - - if [[ "$HEAD_REF" =~ ^vbump_[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9._-]+)?$ ]]; then - echo "Name matches version bump" - exit 0 - else - echo "Branch name does NOT match required pattern: vbump_{version}" - echo "Expected example: vbump_{version}" - exit 1 - fi - - name: Read Base version id: base_version run: | From bcc0f098dc6e01668ee81c12271d948d9fab32de Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Mon, 19 Oct 2026 01:31:51 -0700 Subject: [PATCH 38/60] fixed syntax --- .github/workflows/cd-1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd-1.yml b/.github/workflows/cd-1.yml index 374c45a..88ff5d0 100644 --- a/.github/workflows/cd-1.yml +++ b/.github/workflows/cd-1.yml @@ -31,7 +31,7 @@ jobs: HEAD_REF="${{ github.head_ref }}" echo "Head Branch: $HEAD_REF" - if [ [ "$HEAD_REF" == "dev" ] ] + if [ [ "$HEAD_REF" == "dev" ] ]; then echo "Cannot merge into main from dev branch" exit 1 fi From 5968d63e3c712e4cf937ffe7342bcf5265eb8de9 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Mon, 19 Oct 2026 01:32:56 -0700 Subject: [PATCH 39/60] fixing arguments --- .github/workflows/cd-1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd-1.yml b/.github/workflows/cd-1.yml index 88ff5d0..d3e4d01 100644 --- a/.github/workflows/cd-1.yml +++ b/.github/workflows/cd-1.yml @@ -31,7 +31,7 @@ jobs: HEAD_REF="${{ github.head_ref }}" echo "Head Branch: $HEAD_REF" - if [ [ "$HEAD_REF" == "dev" ] ]; then + if ["$HEAD_REF" == "dev"]; then echo "Cannot merge into main from dev branch" exit 1 fi From 136cd21b066143d9d4c887bbe41607ab823ad416 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Mon, 19 Oct 2026 01:33:59 -0700 Subject: [PATCH 40/60] fixed all syntax --- .github/workflows/cd-1.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cd-1.yml b/.github/workflows/cd-1.yml index d3e4d01..0d9db97 100644 --- a/.github/workflows/cd-1.yml +++ b/.github/workflows/cd-1.yml @@ -31,7 +31,7 @@ jobs: HEAD_REF="${{ github.head_ref }}" echo "Head Branch: $HEAD_REF" - if ["$HEAD_REF" == "dev"]; then + if [ "$HEAD_REF" = "dev" ]; then echo "Cannot merge into main from dev branch" exit 1 fi From 44317d20ee5a07f33c46391fbdfd234bf84c8ae4 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Mon, 19 Oct 2026 01:34:40 -0700 Subject: [PATCH 41/60] added message --- .github/workflows/cd-1.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/cd-1.yml b/.github/workflows/cd-1.yml index 0d9db97..366cfe9 100644 --- a/.github/workflows/cd-1.yml +++ b/.github/workflows/cd-1.yml @@ -40,8 +40,7 @@ jobs: echo "Name matches version bump" exit 0 else - echo "Branch name does NOT match required pattern: vbump_{version}" - echo "Expected example: vbump_{version}" + echo "Wrong source. Expected: vbump_{version}" exit 1 fi From 1f34a10feb7654c56a559988e1ca638ceca4cb68 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Mon, 19 Oct 2026 01:34:58 -0700 Subject: [PATCH 42/60] fixed ident --- .github/workflows/cd-1.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/cd-1.yml b/.github/workflows/cd-1.yml index 366cfe9..e653e02 100644 --- a/.github/workflows/cd-1.yml +++ b/.github/workflows/cd-1.yml @@ -101,7 +101,6 @@ jobs: printf '%s\n' "version=$VERSION" >> $GITHUB_OUTPUT printf '%s\n' "packages=$PACKAGES_JSON" >> $GITHUB_OUTPUT - generate_release_docs: name: Generate Release Documentation (Release-Notes & Changelog) needs: compare-versions From 8284a770d0b5a984272c5374c258420267325fd1 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 19 Oct 2026 08:37:58 +0000 Subject: [PATCH 43/60] Generated vdocs. --- .../CSharp Database Extension/CHANGELOG | 58 +++++++++++++++++++ .../release-notes/v0.0.1-beta.md | 52 +++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 csharp_database_extension/CSharp Database Extension/CHANGELOG create mode 100644 csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md diff --git a/csharp_database_extension/CSharp Database Extension/CHANGELOG b/csharp_database_extension/CSharp Database Extension/CHANGELOG new file mode 100644 index 0000000..a20a3a8 --- /dev/null +++ b/csharp_database_extension/CSharp Database Extension/CHANGELOG @@ -0,0 +1,58 @@ +# Changelog + +## v0.0.1-beta + +### Release notes + +### Commits included + +- fixed ident (Juan Renato Urrea Ortiz) +- added message (Juan Renato Urrea Ortiz) +- fixed all syntax (Juan Renato Urrea Ortiz) +- fixing arguments (Juan Renato Urrea Ortiz) +- fixed syntax (Juan Renato Urrea Ortiz) +- fixed syntax error (Juan Renato Urrea Ortiz) +- testing new version (Juan Renato Urrea Ortiz) +- trying another apporach (Juan Renato Urrea Ortiz) +- trying single line approach (Juan Renato Urrea Ortiz) +- corrected a workflow var (Juan Renato Urrea Ortiz) +- testing workflow to auto-generate release docs (Juan Renato Urrea Ortiz) +- Merge branch 'main' into dev (Renato Urrea) +- Merge branch 'dev' of https://github.com/Cosmos-CSM/fe_csharp_database into dev (Juan Renato Urrea Ortiz) +- adding package metadata and bump checker (Juan Renato Urrea Ortiz) +- Merge branch 'main' into dev (Renato Urrea) +- removing cd workflows (Juan Renato Urrea Ortiz) +- Merge pull request #47 from Cosmos-CSM/46-standarize-repository (Renato Urrea) +- adding nuget source (Juan Renato Urrea Ortiz) +- last try (Juan Renato Urrea Ortiz) +- another try (Juan Renato Urrea Ortiz) +- aother update (Juan Renato Urrea Ortiz) +- updating workflow (Juan Renato Urrea Ortiz) +- trying again (Juan Renato Urrea Ortiz) +- applying checks (Juan Renato Urrea Ortiz) +- changing approach (Juan Renato Urrea Ortiz) +- checking now (Juan Renato Urrea Ortiz) +- adding git attributes (Juan Renato Urrea Ortiz) +- trying something else (Juan Renato Urrea Ortiz) +- pusing eol validation (Juan Renato Urrea Ortiz) +- updating cd workflows (Juan Renato Urrea Ortiz) +- fixing CI (Juan Renato Urrea Ortiz) +- updating CI workflow (Juan Renato Urrea Ortiz) +- added unit tests project, correected ci workflow (Juan Renato Urrea Ortiz) +- finishing standarization and ready to go first version (Juan Renato Urrea Ortiz) +- structuring multi providers (Juan Renato Urrea Ortiz) +- integration tests added pending to check (Renato Urrea) +- testing and main project building (Renato Urrea) +- Checking project adjustments and content (Renato Urrea) +- organizing solution (Juan Renato Urrea Ortiz) +- file structuring (Juan Renato Urrea Ortiz) +- Merge pull request #45 from Cosmos-CSM/dev@issue_41_43 (Renato Urrea) +- Summary definitions changes (jr110) +- testing methods optimizations (jr110) +- pull dev changes (jr110) +- removing unnecesary sync methods in csm database testing (jr110) +- Issue #44 - Adding get method in [TestingStoreManager] (jr110) +- Issue #41 - Adding async support for testing methods (jr110) +- forgot include (Juan Renato Urrea Ortiz) + + diff --git a/csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md b/csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md new file mode 100644 index 0000000..d404899 --- /dev/null +++ b/csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md @@ -0,0 +1,52 @@ +## Release 0.0.1-beta + +### Commits included + +- fixed ident (Juan Renato Urrea Ortiz) +- added message (Juan Renato Urrea Ortiz) +- fixed all syntax (Juan Renato Urrea Ortiz) +- fixing arguments (Juan Renato Urrea Ortiz) +- fixed syntax (Juan Renato Urrea Ortiz) +- fixed syntax error (Juan Renato Urrea Ortiz) +- testing new version (Juan Renato Urrea Ortiz) +- trying another apporach (Juan Renato Urrea Ortiz) +- trying single line approach (Juan Renato Urrea Ortiz) +- corrected a workflow var (Juan Renato Urrea Ortiz) +- testing workflow to auto-generate release docs (Juan Renato Urrea Ortiz) +- Merge branch 'main' into dev (Renato Urrea) +- Merge branch 'dev' of https://github.com/Cosmos-CSM/fe_csharp_database into dev (Juan Renato Urrea Ortiz) +- adding package metadata and bump checker (Juan Renato Urrea Ortiz) +- Merge branch 'main' into dev (Renato Urrea) +- removing cd workflows (Juan Renato Urrea Ortiz) +- Merge pull request #47 from Cosmos-CSM/46-standarize-repository (Renato Urrea) +- adding nuget source (Juan Renato Urrea Ortiz) +- last try (Juan Renato Urrea Ortiz) +- another try (Juan Renato Urrea Ortiz) +- aother update (Juan Renato Urrea Ortiz) +- updating workflow (Juan Renato Urrea Ortiz) +- trying again (Juan Renato Urrea Ortiz) +- applying checks (Juan Renato Urrea Ortiz) +- changing approach (Juan Renato Urrea Ortiz) +- checking now (Juan Renato Urrea Ortiz) +- adding git attributes (Juan Renato Urrea Ortiz) +- trying something else (Juan Renato Urrea Ortiz) +- pusing eol validation (Juan Renato Urrea Ortiz) +- updating cd workflows (Juan Renato Urrea Ortiz) +- fixing CI (Juan Renato Urrea Ortiz) +- updating CI workflow (Juan Renato Urrea Ortiz) +- added unit tests project, correected ci workflow (Juan Renato Urrea Ortiz) +- finishing standarization and ready to go first version (Juan Renato Urrea Ortiz) +- structuring multi providers (Juan Renato Urrea Ortiz) +- integration tests added pending to check (Renato Urrea) +- testing and main project building (Renato Urrea) +- Checking project adjustments and content (Renato Urrea) +- organizing solution (Juan Renato Urrea Ortiz) +- file structuring (Juan Renato Urrea Ortiz) +- Merge pull request #45 from Cosmos-CSM/dev@issue_41_43 (Renato Urrea) +- Summary definitions changes (jr110) +- testing methods optimizations (jr110) +- pull dev changes (jr110) +- removing unnecesary sync methods in csm database testing (jr110) +- Issue #44 - Adding get method in [TestingStoreManager] (jr110) +- Issue #41 - Adding async support for testing methods (jr110) +- forgot include (Juan Renato Urrea Ortiz) \ No newline at end of file From 5feda399e2cfb9bac83e2a5c9bfaeb58f22c6290 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 19 Oct 2026 08:40:58 +0000 Subject: [PATCH 44/60] Generated vdocs. --- .../CSharp Database Extension/release-notes/v0.0.1-beta.md | 1 + 1 file changed, 1 insertion(+) diff --git a/csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md b/csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md index d404899..8c6886f 100644 --- a/csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md +++ b/csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md @@ -2,6 +2,7 @@ ### Commits included +- Generated vdocs. (github-actions) - fixed ident (Juan Renato Urrea Ortiz) - added message (Juan Renato Urrea Ortiz) - fixed all syntax (Juan Renato Urrea Ortiz) From e00420d0e4f77ae8292ffa6cf12d0b976195c2cd Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 19 Oct 2026 08:41:59 +0000 Subject: [PATCH 45/60] Generated vdocs. --- .../CHANGELOG | 59 +++++++++++++++++++ .../release-notes/v0.0.1-beta.md | 53 +++++++++++++++++ 2 files changed, 112 insertions(+) create mode 100644 csharp_database_extension/CSharp Database Extension Testing/CHANGELOG create mode 100644 csharp_database_extension/CSharp Database Extension Testing/release-notes/v0.0.1-beta.md diff --git a/csharp_database_extension/CSharp Database Extension Testing/CHANGELOG b/csharp_database_extension/CSharp Database Extension Testing/CHANGELOG new file mode 100644 index 0000000..e6b0197 --- /dev/null +++ b/csharp_database_extension/CSharp Database Extension Testing/CHANGELOG @@ -0,0 +1,59 @@ +# Changelog + +## v0.0.1-beta + +### Release notes + +### Commits included + +- Generated vdocs. (github-actions) +- fixed ident (Juan Renato Urrea Ortiz) +- added message (Juan Renato Urrea Ortiz) +- fixed all syntax (Juan Renato Urrea Ortiz) +- fixing arguments (Juan Renato Urrea Ortiz) +- fixed syntax (Juan Renato Urrea Ortiz) +- fixed syntax error (Juan Renato Urrea Ortiz) +- testing new version (Juan Renato Urrea Ortiz) +- trying another apporach (Juan Renato Urrea Ortiz) +- trying single line approach (Juan Renato Urrea Ortiz) +- corrected a workflow var (Juan Renato Urrea Ortiz) +- testing workflow to auto-generate release docs (Juan Renato Urrea Ortiz) +- Merge branch 'main' into dev (Renato Urrea) +- Merge branch 'dev' of https://github.com/Cosmos-CSM/fe_csharp_database into dev (Juan Renato Urrea Ortiz) +- adding package metadata and bump checker (Juan Renato Urrea Ortiz) +- Merge branch 'main' into dev (Renato Urrea) +- removing cd workflows (Juan Renato Urrea Ortiz) +- Merge pull request #47 from Cosmos-CSM/46-standarize-repository (Renato Urrea) +- adding nuget source (Juan Renato Urrea Ortiz) +- last try (Juan Renato Urrea Ortiz) +- another try (Juan Renato Urrea Ortiz) +- aother update (Juan Renato Urrea Ortiz) +- updating workflow (Juan Renato Urrea Ortiz) +- trying again (Juan Renato Urrea Ortiz) +- applying checks (Juan Renato Urrea Ortiz) +- changing approach (Juan Renato Urrea Ortiz) +- checking now (Juan Renato Urrea Ortiz) +- adding git attributes (Juan Renato Urrea Ortiz) +- trying something else (Juan Renato Urrea Ortiz) +- pusing eol validation (Juan Renato Urrea Ortiz) +- updating cd workflows (Juan Renato Urrea Ortiz) +- fixing CI (Juan Renato Urrea Ortiz) +- updating CI workflow (Juan Renato Urrea Ortiz) +- added unit tests project, correected ci workflow (Juan Renato Urrea Ortiz) +- finishing standarization and ready to go first version (Juan Renato Urrea Ortiz) +- structuring multi providers (Juan Renato Urrea Ortiz) +- integration tests added pending to check (Renato Urrea) +- testing and main project building (Renato Urrea) +- Checking project adjustments and content (Renato Urrea) +- organizing solution (Juan Renato Urrea Ortiz) +- file structuring (Juan Renato Urrea Ortiz) +- Merge pull request #45 from Cosmos-CSM/dev@issue_41_43 (Renato Urrea) +- Summary definitions changes (jr110) +- testing methods optimizations (jr110) +- pull dev changes (jr110) +- removing unnecesary sync methods in csm database testing (jr110) +- Issue #44 - Adding get method in [TestingStoreManager] (jr110) +- Issue #41 - Adding async support for testing methods (jr110) +- forgot include (Juan Renato Urrea Ortiz) + + diff --git a/csharp_database_extension/CSharp Database Extension Testing/release-notes/v0.0.1-beta.md b/csharp_database_extension/CSharp Database Extension Testing/release-notes/v0.0.1-beta.md new file mode 100644 index 0000000..8c6886f --- /dev/null +++ b/csharp_database_extension/CSharp Database Extension Testing/release-notes/v0.0.1-beta.md @@ -0,0 +1,53 @@ +## Release 0.0.1-beta + +### Commits included + +- Generated vdocs. (github-actions) +- fixed ident (Juan Renato Urrea Ortiz) +- added message (Juan Renato Urrea Ortiz) +- fixed all syntax (Juan Renato Urrea Ortiz) +- fixing arguments (Juan Renato Urrea Ortiz) +- fixed syntax (Juan Renato Urrea Ortiz) +- fixed syntax error (Juan Renato Urrea Ortiz) +- testing new version (Juan Renato Urrea Ortiz) +- trying another apporach (Juan Renato Urrea Ortiz) +- trying single line approach (Juan Renato Urrea Ortiz) +- corrected a workflow var (Juan Renato Urrea Ortiz) +- testing workflow to auto-generate release docs (Juan Renato Urrea Ortiz) +- Merge branch 'main' into dev (Renato Urrea) +- Merge branch 'dev' of https://github.com/Cosmos-CSM/fe_csharp_database into dev (Juan Renato Urrea Ortiz) +- adding package metadata and bump checker (Juan Renato Urrea Ortiz) +- Merge branch 'main' into dev (Renato Urrea) +- removing cd workflows (Juan Renato Urrea Ortiz) +- Merge pull request #47 from Cosmos-CSM/46-standarize-repository (Renato Urrea) +- adding nuget source (Juan Renato Urrea Ortiz) +- last try (Juan Renato Urrea Ortiz) +- another try (Juan Renato Urrea Ortiz) +- aother update (Juan Renato Urrea Ortiz) +- updating workflow (Juan Renato Urrea Ortiz) +- trying again (Juan Renato Urrea Ortiz) +- applying checks (Juan Renato Urrea Ortiz) +- changing approach (Juan Renato Urrea Ortiz) +- checking now (Juan Renato Urrea Ortiz) +- adding git attributes (Juan Renato Urrea Ortiz) +- trying something else (Juan Renato Urrea Ortiz) +- pusing eol validation (Juan Renato Urrea Ortiz) +- updating cd workflows (Juan Renato Urrea Ortiz) +- fixing CI (Juan Renato Urrea Ortiz) +- updating CI workflow (Juan Renato Urrea Ortiz) +- added unit tests project, correected ci workflow (Juan Renato Urrea Ortiz) +- finishing standarization and ready to go first version (Juan Renato Urrea Ortiz) +- structuring multi providers (Juan Renato Urrea Ortiz) +- integration tests added pending to check (Renato Urrea) +- testing and main project building (Renato Urrea) +- Checking project adjustments and content (Renato Urrea) +- organizing solution (Juan Renato Urrea Ortiz) +- file structuring (Juan Renato Urrea Ortiz) +- Merge pull request #45 from Cosmos-CSM/dev@issue_41_43 (Renato Urrea) +- Summary definitions changes (jr110) +- testing methods optimizations (jr110) +- pull dev changes (jr110) +- removing unnecesary sync methods in csm database testing (jr110) +- Issue #44 - Adding get method in [TestingStoreManager] (jr110) +- Issue #41 - Adding async support for testing methods (jr110) +- forgot include (Juan Renato Urrea Ortiz) \ No newline at end of file From 9d58b94ef578de94d46d666287ce049d528c1322 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Mon, 19 Oct 2026 01:42:49 -0700 Subject: [PATCH 46/60] adding a branch check --- .github/workflows/cd-1.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/cd-1.yml b/.github/workflows/cd-1.yml index e653e02..5749caf 100644 --- a/.github/workflows/cd-1.yml +++ b/.github/workflows/cd-1.yml @@ -71,6 +71,34 @@ jobs: VERSION=$(jq -r '.version' base/csmpackage.json) echo "version=$VERSION" >> $GITHUB_OUTPUT + - name: Compare Base Version. + run: | + set -euo pipefail + + BRANCH="${{ github.head_ref }}" + echo "Head Branch: $BRANCH" + + if [[ "$BRANCH" =~ ^vbump[_-]([0-9]+\.[0-9]+\.[0-9]+(?:-[0-9A-Za-z._-]+)?(?:\+[0-9A-Za-z._-]+)?)$ ]]; then + BRANCH_VER="${BASH_REMATCH[1]}" + echo "Extracted version from branch: $BRANCH_VER" + else + echo "Branch name does not match required pattern: vbump_{version} or vbump-{version}" + echo "Examples: vbump_1.2.3, vbump-1.2.3-alpha, vbump_1.2.3+build.1" + exit 1 + fi + + BASE_VER="${{ steps.base_version.outputs.version }}" + echo "Base version: $BASE_VER" + + if [ "$BRANCH_VER" = "$BASE_VER" ]; then + echo "Version matches: $BRANCH_VER" + else + echo "Version mismatch: branch has '$BRANCH_VER' but base metadata is '$BASE_VER'" + exit 1 + fi + shell: bash + + - name: Read Head version id: head_version run: | From 9f7702048bf1499e70fe22b1edd6ff7f97683ce4 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Mon, 19 Oct 2026 01:45:50 -0700 Subject: [PATCH 47/60] fixing error --- .github/workflows/cd-1.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cd-1.yml b/.github/workflows/cd-1.yml index 5749caf..dba6643 100644 --- a/.github/workflows/cd-1.yml +++ b/.github/workflows/cd-1.yml @@ -76,9 +76,16 @@ jobs: set -euo pipefail BRANCH="${{ github.head_ref }}" - echo "Head Branch: $BRANCH" + echo "PR head branch: $BRANCH" - if [[ "$BRANCH" =~ ^vbump[_-]([0-9]+\.[0-9]+\.[0-9]+(?:-[0-9A-Za-z._-]+)?(?:\+[0-9A-Za-z._-]+)?)$ ]]; then + # Bash-compatible regex: + # - prefix vbump_ or vbump- + # - capture semver: major.minor.patch + # - optional pre-release starting with - (e.g. -alpha, -rc.1) + # - optional build metadata starting with + (e.g. +build.1) + REGEX='^vbump[_-]([0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z._-]+)?(\+[0-9A-Za-z._-]+)?)$' + + if [[ $BRANCH =~ $REGEX ]]; then BRANCH_VER="${BASH_REMATCH[1]}" echo "Extracted version from branch: $BRANCH_VER" else @@ -88,7 +95,7 @@ jobs: fi BASE_VER="${{ steps.base_version.outputs.version }}" - echo "Base version: $BASE_VER" + echo "Base version from step: $BASE_VER" if [ "$BRANCH_VER" = "$BASE_VER" ]; then echo "Version matches: $BRANCH_VER" From 996128cd1cc9cf353ea79678455513315c892085 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Mon, 19 Oct 2026 01:51:13 -0700 Subject: [PATCH 48/60] fixing version check --- .github/workflows/cd-1.yml | 57 +++++++++++++++----------------------- 1 file changed, 22 insertions(+), 35 deletions(-) diff --git a/.github/workflows/cd-1.yml b/.github/workflows/cd-1.yml index dba6643..bdf7d1b 100644 --- a/.github/workflows/cd-1.yml +++ b/.github/workflows/cd-1.yml @@ -70,40 +70,6 @@ jobs: run: | VERSION=$(jq -r '.version' base/csmpackage.json) echo "version=$VERSION" >> $GITHUB_OUTPUT - - - name: Compare Base Version. - run: | - set -euo pipefail - - BRANCH="${{ github.head_ref }}" - echo "PR head branch: $BRANCH" - - # Bash-compatible regex: - # - prefix vbump_ or vbump- - # - capture semver: major.minor.patch - # - optional pre-release starting with - (e.g. -alpha, -rc.1) - # - optional build metadata starting with + (e.g. +build.1) - REGEX='^vbump[_-]([0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z._-]+)?(\+[0-9A-Za-z._-]+)?)$' - - if [[ $BRANCH =~ $REGEX ]]; then - BRANCH_VER="${BASH_REMATCH[1]}" - echo "Extracted version from branch: $BRANCH_VER" - else - echo "Branch name does not match required pattern: vbump_{version} or vbump-{version}" - echo "Examples: vbump_1.2.3, vbump-1.2.3-alpha, vbump_1.2.3+build.1" - exit 1 - fi - - BASE_VER="${{ steps.base_version.outputs.version }}" - echo "Base version from step: $BASE_VER" - - if [ "$BRANCH_VER" = "$BASE_VER" ]; then - echo "Version matches: $BRANCH_VER" - else - echo "Version mismatch: branch has '$BRANCH_VER' but base metadata is '$BASE_VER'" - exit 1 - fi - shell: bash - name: Read Head version @@ -114,14 +80,35 @@ jobs: - name: Compare versions run: | + set -euo pipefail + BASE="${{ steps.base_version.outputs.version }}" HEAD="${{ steps.head_version.outputs.version }}" + BRANCH="${{ github.head_ref }}" + REGEX='^vbump[_-]([0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z._-]+)?(\+[0-9A-Za-z._-]+)?)$' echo "Base version: $BASE" echo "Head version: $HEAD" + echo "Head Branch: $BRANCH" if [ "$BASE" = "$HEAD" ]; then - echo "Package metadata versions are not bumped" + echo "Package metadata version isn't bumped" + exit 1 + fi + + if [[ $BRANCH =~ $REGEX ]]; then + BRANCH_VER="${BASH_REMATCH[1]}" + echo "Extracted version from branch: $BRANCH_VER" + else + echo "Branch name does not match required pattern: vbump_{version} or vbump-{version}" + echo "Examples: vbump_1.2.3, vbump-1.2.3-alpha, vbump_1.2.3+build.1" + exit 1 + fi + + if [ "$BRANCH_VER" = "$HEAD" ]; then + echo "Version match" + else + echo "Version mismatch: branch has '$BRANCH_VER' but metadata is '$HEAD'" exit 1 fi From e35fa6f38619538312c740382c3312fac02e2d47 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 19 Oct 2026 08:51:42 +0000 Subject: [PATCH 49/60] Generated vdocs. --- .../CSharp Database Extension/release-notes/v0.0.1-beta.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md b/csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md index 8c6886f..d5e1d61 100644 --- a/csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md +++ b/csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md @@ -2,6 +2,12 @@ ### Commits included +- fixing version check (Juan Renato Urrea Ortiz) +- fixing error (Juan Renato Urrea Ortiz) +- Merge branch 'vbump_0.0.1-beta' of https://github.com/Cosmos-CSM/fe_csharp_database into vbump_0.0.1-beta (Juan Renato Urrea Ortiz) +- adding a branch check (Juan Renato Urrea Ortiz) +- Generated vdocs. (github-actions) +- Generated vdocs. (github-actions) - Generated vdocs. (github-actions) - fixed ident (Juan Renato Urrea Ortiz) - added message (Juan Renato Urrea Ortiz) From 1e0af6fc576068aa4697f20e936997aa48125f82 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 19 Oct 2026 08:52:20 +0000 Subject: [PATCH 50/60] Generated vdocs. --- .../CSharp Database Extension/release-notes/v0.0.1-beta.md | 1 + 1 file changed, 1 insertion(+) diff --git a/csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md b/csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md index d5e1d61..0b1fa1c 100644 --- a/csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md +++ b/csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md @@ -2,6 +2,7 @@ ### Commits included +- Generated vdocs. (github-actions) - fixing version check (Juan Renato Urrea Ortiz) - fixing error (Juan Renato Urrea Ortiz) - Merge branch 'vbump_0.0.1-beta' of https://github.com/Cosmos-CSM/fe_csharp_database into vbump_0.0.1-beta (Juan Renato Urrea Ortiz) From 25b5bec7114c67192bb43ade758a0ee77fda50cb Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 19 Oct 2026 08:53:26 +0000 Subject: [PATCH 51/60] Generated vdocs. --- .../CSharp Database Extension/release-notes/v0.0.1-beta.md | 1 + 1 file changed, 1 insertion(+) diff --git a/csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md b/csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md index 0b1fa1c..a88028d 100644 --- a/csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md +++ b/csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md @@ -2,6 +2,7 @@ ### Commits included +- Generated vdocs. (github-actions) - Generated vdocs. (github-actions) - fixing version check (Juan Renato Urrea Ortiz) - fixing error (Juan Renato Urrea Ortiz) From 4aa3c09c66a5e83173d5f603824cc423720ef18c Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Mon, 19 Oct 2026 02:01:18 -0700 Subject: [PATCH 52/60] preventing looping --- .github/workflows/cd-1.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.github/workflows/cd-1.yml b/.github/workflows/cd-1.yml index bdf7d1b..da96793 100644 --- a/.github/workflows/cd-1.yml +++ b/.github/workflows/cd-1.yml @@ -143,6 +143,27 @@ jobs: git config user.name "github-actions" git config user.email "github-actions@github.com" + - name: Prevent Looping + run: | + set -euo pipefail + + AUTO_NAME="github-actions" + AUTO_EMAIL="github-actions@github.com" + AUTO_COMMIT_MARKER="Generated vdocs." + + last_name=$(git log -1 --pretty=format:'%an') + last_email=$(git log -1 --pretty=format:'%ae') + last_message=$(git log -1 --pretty=format:'%s') + + echo "Last commit author: $last_name <$last_email>" + echo "Last commit message: $last_message" + + if [ "$last_name" = "$AUTO_NAME" ] || [ "$last_email" = "$AUTO_EMAIL" ] || echo "$last_message" | grep -qF "$AUTO_COMMIT_MARKER"; then + echo "Skipping generate_release_docs: last commit created by automation." + exit 0 + fi + shell: bash + - name: Prepare Package Metadata run: | echo "PACKAGE='${{ matrix.package }}'" From 8c10362ff2444c6817a661625138c01f6a0235e7 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 19 Oct 2026 09:01:46 +0000 Subject: [PATCH 53/60] Generated vdocs. --- .../CSharp Database Extension/release-notes/v0.0.1-beta.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md b/csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md index a88028d..c3e9259 100644 --- a/csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md +++ b/csharp_database_extension/CSharp Database Extension/release-notes/v0.0.1-beta.md @@ -2,6 +2,9 @@ ### Commits included +- Merge branch 'vbump_0.0.1-beta' of https://github.com/Cosmos-CSM/fe_csharp_database into vbump_0.0.1-beta (Juan Renato Urrea Ortiz) +- preventing looping (Juan Renato Urrea Ortiz) +- Generated vdocs. (github-actions) - Generated vdocs. (github-actions) - Generated vdocs. (github-actions) - fixing version check (Juan Renato Urrea Ortiz) From 1fcab9fd10c70f26dd46a064db5506bbc554453f Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Mon, 19 Oct 2026 02:05:10 -0700 Subject: [PATCH 54/60] trying new release generation --- .github/workflows/cd-1.yml | 205 +++++++------------------------------ 1 file changed, 38 insertions(+), 167 deletions(-) diff --git a/.github/workflows/cd-1.yml b/.github/workflows/cd-1.yml index da96793..da8d401 100644 --- a/.github/workflows/cd-1.yml +++ b/.github/workflows/cd-1.yml @@ -1,21 +1,17 @@ name: CD 1 -# This workflow supports the first phase of delvier process, when a PR is opened pointing [main] branch, will trigger validations. -# First will check if all PR opened to [main] are from [dev]. -# Then will check that package metadata version was bumped correctly. - on: workflow_dispatch: pull_request: - branches: - - main + branches: + - main types: - - opened - - reopened - - synchronize + - opened + - reopened + - synchronize -permissions: +permissions: contents: write jobs: @@ -25,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - - name: Prevent Sources + - name: Prevent Sources run: | set -euo pipefail HEAD_REF="${{ github.head_ref }}" @@ -43,17 +39,17 @@ jobs: echo "Wrong source. Expected: vbump_{version}" exit 1 fi - - compare-versions: + + compare-versions: needs: validate-source - name: Compare Versions + name: Compare Versions runs-on: ubuntu-latest outputs: version: ${{ steps.package_metadata.outputs.version }} packages: ${{ steps.package_metadata.outputs.packages }} - steps: - - name: CheckOut Base + steps: + - name: CheckOut Base uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.base.ref }} @@ -70,7 +66,6 @@ jobs: run: | VERSION=$(jq -r '.version' base/csmpackage.json) echo "version=$VERSION" >> $GITHUB_OUTPUT - - name: Read Head version id: head_version @@ -170,156 +165,32 @@ jobs: echo "VERSION='${{ needs.compare-versions.outputs.version }}'" shell: bash - - name: Generate release notes and update CHANGELOG - id: gen_docs - run: | - set -euo pipefail - - PACKAGE="${{ matrix.package }}" - VERSION="${{ needs.compare-versions.outputs.version }}" - - # Derive package path (preserve full path if matrix.package is a path) - PACKAGE_PATH="$PACKAGE" - # If matrix.package contains a repo-like "dir/subdir", keep it as-is. - # Release notes directory and file - RELEASE_DIR="$PACKAGE_PATH/release-notes" - RELEASE_FILE="$RELEASE_DIR/v${VERSION}.md" - - echo "Package path: $PACKAGE_PATH" - echo "Release notes file: $RELEASE_FILE" - - mkdir -p "$RELEASE_DIR" - - # Build release notes content - { - echo "## Release $VERSION" - echo "" - echo "### Commits included" - echo "" - } > "$RELEASE_FILE" - - BASE_SHA="${{ github.event.pull_request.base.sha }}" - HEAD_SHA="${{ github.event.pull_request.head.sha }}" - - if [ -z "$BASE_SHA" ] || [ -z "$HEAD_SHA" ]; then - echo "- Unable to determine commit range." >> "$RELEASE_FILE" - else - # If there are no commits in range, note it; otherwise list commits - if [ "$(git rev-list --count "$BASE_SHA..$HEAD_SHA")" -eq 0 ]; then - echo "- No commits detected between base and head." >> "$RELEASE_FILE" - else - git --no-pager log --pretty=format:"- %s (%an)" "$BASE_SHA..$HEAD_SHA" >> "$RELEASE_FILE" - fi - fi - - echo "Wrote release notes to $RELEASE_FILE" - - # Ensure CHANGELOG exists at package root - CHANGELOG_FILE="$PACKAGE_PATH/CHANGELOG" - if [ ! -f "$CHANGELOG_FILE" ]; then - echo "Creating new CHANGELOG at $CHANGELOG_FILE" - echo "# Changelog" > "$CHANGELOG_FILE" - echo "" >> "$CHANGELOG_FILE" - fi - - # Prepare new changelog entry content (you can customize the header/body format) - NEW_ENTRY_FILE="$(mktemp)" - { - echo "## v${VERSION}" - echo "" - echo "### Release notes" - echo "" - # Insert the same commit list into the changelog entry - sed -n '1,200000p' "$RELEASE_FILE" | sed '1,2d' # skip the top two lines already added above - echo "" - } > "$NEW_ENTRY_FILE" - - # Replace existing entry for this version if present, otherwise prepend new entry after top header - # We treat entries as starting with a line that matches '^## v' - if grep -qE "^## v${VERSION}\b" "$CHANGELOG_FILE"; then - echo "Found existing CHANGELOG entry for v${VERSION}, replacing it." - # Use awk to replace the section starting at "## vVERSION" up to the next "## v" or EOF - awk -v ver="v${VERSION}" -v newfile="$NEW_ENTRY_FILE" ' - BEGIN { - replaced = 0; - while ((getline line < newfile) > 0) { - newlines = newlines line "\n" - } - close(newfile) - } - { - if ($0 ~ "^## " ver "\\b") { - # print newlines and skip until next "## v" or EOF - printf "%s", newlines - replaced = 1 - # skip lines until next "## v" header - while (getline > 0) { - if ($0 ~ "^## v[0-9]+") { - print $0 - break - } - } - next - } - print $0 - } - END { - if (replaced == 0) { - # no replacement happened; print nothing here (caller will handle prepend) - } - } - ' "$CHANGELOG_FILE" > "${CHANGELOG_FILE}.tmp" || true - - # If awk produced a tmp file with content, move it back; otherwise fall back to prepend - if [ -s "${CHANGELOG_FILE}.tmp" ]; then - mv "${CHANGELOG_FILE}.tmp" "$CHANGELOG_FILE" - else - # fallback: prepend - cat "$NEW_ENTRY_FILE" "$CHANGELOG_FILE" > "${CHANGELOG_FILE}.tmp" - mv "${CHANGELOG_FILE}.tmp" "$CHANGELOG_FILE" - fi - else - echo "No existing entry for v${VERSION}. Prepending new entry to CHANGELOG." - # Prepend new entry after the top-level header if present, otherwise at top - # If file starts with "# Changelog", keep it and insert after that header - if head -n1 "$CHANGELOG_FILE" | grep -qE '^#\s+Changelog'; then - # keep header line, then insert new entry - tail -n +2 "$CHANGELOG_FILE" > "${CHANGELOG_FILE}.body.tmp" - { head -n1 "$CHANGELOG_FILE"; echo ""; cat "$NEW_ENTRY_FILE"; echo ""; cat "${CHANGELOG_FILE}.body.tmp"; } > "${CHANGELOG_FILE}.tmp" - mv "${CHANGELOG_FILE}.tmp" "$CHANGELOG_FILE" - rm -f "${CHANGELOG_FILE}.body.tmp" - else - # no top header, just prepend - cat "$NEW_ENTRY_FILE" "$CHANGELOG_FILE" > "${CHANGELOG_FILE}.tmp" - mv "${CHANGELOG_FILE}.tmp" "$CHANGELOG_FILE" - fi - fi - - rm -f "$NEW_ENTRY_FILE" - - echo "Updated CHANGELOG at $CHANGELOG_FILE" - - # Expose whether there are changes to commit - if git status --porcelain | grep -q .; then - echo "changes=true" >> "$GITHUB_OUTPUT" - else - echo "changes=false" >> "$GITHUB_OUTPUT" - fi - shell: bash - - - name: Commit Generated vdocs - if: steps.gen_docs.outputs.changes == 'true' + - name: Build PR Summary + id: pr_summary run: | set -euo pipefail - git add -A - # Use exact commit title requested - git commit -m "Generated vdocs." - git push origin HEAD:${{ github.event.pull_request.head.ref }} - echo "Pushed commit 'Generated vdocs.' to branch ${{ github.event.pull_request.head.ref }}" - shell: bash - - - name: No changes to commit - if: steps.gen_docs.outputs.changes == 'false' - run: echo "No release docs changes detected; nothing to commit." - + PR_NUMBER="${{ github.event.pull_request.number }}" + REPO="${{ github.repository }}" + TOKEN="${{ secrets.GITHUB_TOKEN }}" + + echo "Fetching PR metadata for #$PR_NUMBER" + + PR_DATA=$(curl -s \ + -H "Authorization: Bearer $TOKEN" \ + -H "Accept: application/vnd.github+json" \ + "https://api.github.com/repos/$REPO/pulls/$PR_NUMBER") + + TITLE=$(echo "$PR_DATA" | jq -r '.title // "No title"') + BODY=$(echo "$PR_DATA" | jq -r '.body // "No description provided."') + AUTHOR=$(echo "$PR_DATA" | jq -r '.user.login // "unknown"') + LABELS=$(echo "$PR_DATA" | jq -r '[.labels[].name] | join(", ") // empty') + FILES_JSON=$(curl -s \ + -H "Authorization: Bearer $TOKEN" \ + -H "Accept: application/vnd.github+json" \ + "https://api.github.com/repos/$REPO/pulls/$PR_NUMBER/files") + FILES=$(echo "$FILES_JSON" | jq -r '.[].filename' || true) + + COMMITS_JSON=$(curl -s \ + -H "Authorization: Bearer $TOKEN" \ + - \ No newline at end of file From 98ac6f41e1fde2ee10c54c0f49e679685bddee82 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Mon, 19 Oct 2026 02:08:25 -0700 Subject: [PATCH 55/60] fixing generation --- .github/workflows/cd-1.yml | 62 ++++++++++++++++++++++++++++++-------- 1 file changed, 50 insertions(+), 12 deletions(-) diff --git a/.github/workflows/cd-1.yml b/.github/workflows/cd-1.yml index da8d401..1a71b2e 100644 --- a/.github/workflows/cd-1.yml +++ b/.github/workflows/cd-1.yml @@ -168,6 +168,7 @@ jobs: - name: Build PR Summary id: pr_summary run: | + | set -euo pipefail PR_NUMBER="${{ github.event.pull_request.number }}" @@ -176,21 +177,58 @@ jobs: echo "Fetching PR metadata for #$PR_NUMBER" - PR_DATA=$(curl -s \ - -H "Authorization: Bearer $TOKEN" \ - -H "Accept: application/vnd.github+json" \ - "https://api.github.com/repos/$REPO/pulls/$PR_NUMBER") + PR_DATA=$(curl -s -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github+json" "https://api.github.com/repos/$REPO/pulls/$PR_NUMBER") || true TITLE=$(echo "$PR_DATA" | jq -r '.title // "No title"') BODY=$(echo "$PR_DATA" | jq -r '.body // "No description provided."') AUTHOR=$(echo "$PR_DATA" | jq -r '.user.login // "unknown"') - LABELS=$(echo "$PR_DATA" | jq -r '[.labels[].name] | join(", ") // empty') - FILES_JSON=$(curl -s \ - -H "Authorization: Bearer $TOKEN" \ - -H "Accept: application/vnd.github+json" \ - "https://api.github.com/repos/$REPO/pulls/$PR_NUMBER/files") + LABELS=$(echo "$PR_DATA" | jq -r '(.labels // []) | map(.name) | join(", ")') + + FILES_JSON=$(curl -s -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github+json" "https://api.github.com/repos/$REPO/pulls/$PR_NUMBER/files") || true FILES=$(echo "$FILES_JSON" | jq -r '.[].filename' || true) - COMMITS_JSON=$(curl -s \ - -H "Authorization: Bearer $TOKEN" \ - - \ No newline at end of file + COMMITS_JSON=$(curl -s -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github+json" "https://api.github.com/repos/$REPO/pulls/$PR_NUMBER/commits") || true + COMMITS=$(echo "$COMMITS_JSON" | jq -r '.[].commit.message' || true) + + SUMMARY_FILE="pr_summary.md" + + { + echo "### PR Summary" + echo "" + echo "**Title:** $TITLE" + echo "" + echo "**Author:** @$AUTHOR" + echo "" + echo "**Description:**" + echo "" + echo "$BODY" + echo "" + if [ -n "$LABELS" ]; then + echo "**Labels:** $LABELS" + else + echo "**Labels:** None" + fi + echo "" + echo "### Changes" + echo "" + echo "**Files modified:**" + if [ -n "$FILES" ]; then + echo "$FILES" | sed 's/^/- /' + else + echo "- (no file list available)" + fi + echo "" + echo "**Commits:**" + if [ -n "$COMMITS" ]; then + echo "$COMMITS" | sed 's/^/- /' + else + echo "- (no commits available)" + fi + echo "" + echo "### Notes" + echo "" + echo "- Generated from PR metadata: title, body, labels, files, commits." + } > "$SUMMARY_FILE" + + echo "summary_path=$SUMMARY_FILE" >> $GITHUB_OUTPUT + shell: bash \ No newline at end of file From 66e709d7756adec8cc9ac935fba0b6cde313147f Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Mon, 19 Oct 2026 02:25:26 -0700 Subject: [PATCH 56/60] fixed token --- .github/workflows/cd-1.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/cd-1.yml b/.github/workflows/cd-1.yml index 1a71b2e..d2f7aa2 100644 --- a/.github/workflows/cd-1.yml +++ b/.github/workflows/cd-1.yml @@ -168,7 +168,6 @@ jobs: - name: Build PR Summary id: pr_summary run: | - | set -euo pipefail PR_NUMBER="${{ github.event.pull_request.number }}" From e9cb81f4a3ba25c4d1e93159abd2f184a1e67b78 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Mon, 19 Oct 2026 02:46:17 -0700 Subject: [PATCH 57/60] added publisihment --- .github/workflows/cd-1.yml | 178 ++++++++++++++++++++++++++++++++++++- 1 file changed, 177 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cd-1.yml b/.github/workflows/cd-1.yml index d2f7aa2..849bbd5 100644 --- a/.github/workflows/cd-1.yml +++ b/.github/workflows/cd-1.yml @@ -125,6 +125,7 @@ jobs: strategy: matrix: package: ${{ fromJson(needs.compare-versions.outputs.packages) }} + steps: - name: CheckOut Head branch uses: actions/checkout@v3 @@ -230,4 +231,179 @@ jobs: } > "$SUMMARY_FILE" echo "summary_path=$SUMMARY_FILE" >> $GITHUB_OUTPUT - shell: bash \ No newline at end of file + shell: bash + + - name: Generate release notes and update CHANGELOG + id: gen_docs + run: | + set -euo pipefail + + PACKAGE="${{ matrix.package }}" + VERSION="${{ needs.compare-versions.outputs.version }}" + SUMMARY_PATH="${{ steps.pr_summary.outputs.summary_path }}" + + PACKAGE_PATH="$PACKAGE" + RELEASE_DIR="$PACKAGE_PATH/release-notes" + RELEASE_FILE="$RELEASE_DIR/v${VERSION}.md" + + mkdir -p "$RELEASE_DIR" + + { + echo "## Release $VERSION" + echo "" + if [ -f "$SUMMARY_PATH" ]; then + cat "$SUMMARY_PATH" + else + echo "- No PR summary available." + fi + echo "" + } > "$RELEASE_FILE" + + BASE_SHA="${{ github.event.pull_request.base.sha }}" + HEAD_SHA="${{ github.event.pull_request.head.sha }}" + + if [ -z "$BASE_SHA" ] || [ -z "$HEAD_SHA" ]; then + echo "- Unable to determine commit range." >> "$RELEASE_FILE" + else + if [ "$(git rev-list --count "$BASE_SHA..$HEAD_SHA")" -eq 0 ]; then + echo "- No commits detected between base and head." >> "$RELEASE_FILE" + else + echo "" >> "$RELEASE_FILE" + git --no-pager log --pretty=format:"- %s (%an)" "$BASE_SHA..$HEAD_SHA" >> "$RELEASE_FILE" + fi + fi + + # Ensure CHANGELOG exists at package root + CHANGELOG_FILE="$PACKAGE_PATH/CHANGELOG" + if [ ! -f "$CHANGELOG_FILE" ]; then + echo "# Changelog" > "$CHANGELOG_FILE" + echo "" >> "$CHANGELOG_FILE" + fi + + NEW_ENTRY_FILE="$(mktemp)" + { + echo "## v${VERSION}" + echo "" + if [ -f "$SUMMARY_PATH" ]; then + cat "$SUMMARY_PATH" + else + echo "- No PR summary available." + fi + echo "" + echo "### Commits" + if [ -n "$HEAD_SHA" ] && [ -n "$BASE_SHA" ]; then + git --no-pager log --pretty=format:"- %s (%an)" "$BASE_SHA..$HEAD_SHA" + fi + echo "" + } > "$NEW_ENTRY_FILE" + + # Replace or prepend entry + if grep -qE "^## v${VERSION}\b" "$CHANGELOG_FILE"; then + awk -v ver="v${VERSION}" -v newfile="$NEW_ENTRY_FILE" ' + BEGIN { + replaced = 0; + while ((getline line < newfile) > 0) { + newlines = newlines line "\n" + } + close(newfile) + } + { + if ($0 ~ "^## " ver "\\b") { + printf "%s", newlines + replaced = 1 + while (getline > 0) { + if ($0 ~ "^## v[0-9]+") { + print $0 + break + } + } + next + } + print $0 + } + END { + } + ' "$CHANGELOG_FILE" > "${CHANGELOG_FILE}.tmp" || true + + if [ -s "${CHANGELOG_FILE}.tmp" ]; then + mv "${CHANGELOG_FILE}.tmp" "$CHANGELOG_FILE" + else + cat "$NEW_ENTRY_FILE" "$CHANGELOG_FILE" > "${CHANGELOG_FILE}.tmp" + mv "${CHANGELOG_FILE}.tmp" "$CHANGELOG_FILE" + fi + else + if head -n1 "$CHANGELOG_FILE" | grep -qE '^#\s+Changelog'; then + tail -n +2 "$CHANGELOG_FILE" > "${CHANGELOG_FILE}.body.tmp" + { head -n1 "$CHANGELOG_FILE"; echo ""; cat "$NEW_ENTRY_FILE"; echo ""; cat "${CHANGELOG_FILE}.body.tmp"; } > "${CHANGELOG_FILE}.tmp" + mv "${CHANGELOG_FILE}.tmp" "$CHANGELOG_FILE" + rm -f "${CHANGELOG_FILE}.body.tmp" + else + cat "$NEW_ENTRY_FILE" "$CHANGELOG_FILE" > "${CHANGELOG_FILE}.tmp" + mv "${CHANGELOG_FILE}.tmp" "$CHANGELOG_FILE" + fi + fi + + rm -f "$NEW_ENTRY_FILE" + + # Expose whether there are changes to commit + if git status --porcelain | grep -q .; then + echo "changes=true" >> $GITHUB_OUTPUT + else + echo "changes=false" >> $GITHUB_OUTPUT + fi + shell: bash + + - name: Post release notes as PR comment (works for forks) + if: always() + env: + TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + PR_NUM=${{ github.event.pull_request.number }} + REPO="${{ github.repository }}" + PACKAGE="${{ matrix.package }}" + VERSION="${{ needs.compare-versions.outputs.version }}" + RELEASE_FILE="${PACKAGE}/release-notes/v${VERSION}.md" + + if [ -f "$RELEASE_FILE" ]; then + # Use jq -Rs to safely encode the file content into JSON string + BODY_JSON=$(jq -Rs --arg title "Release notes for ${PACKAGE} v${VERSION}" '{body: (. | "\n" + .)}' < "$RELEASE_FILE") + curl -s -X POST -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github+json" \ + "https://api.github.com/repos/${REPO}/issues/${PR_NUM}/comments" \ + -d "$BODY_JSON" > /dev/null || true + echo "Posted release notes as PR comment." + else + echo "Release file not found; skipping PR comment." + fi + shell: bash + + - name: Commit Generated vdocs (only when PR branch is in same repo) + if: steps.gen_docs.outputs.changes == 'true' && (github.event.pull_request.head.repo.full_name == github.repository) + env: + GIT_PUSH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TARGET_BRANCH: ${{ github.event.pull_request.head.ref }} + run: | + set -euo pipefail + git config user.name "github-actions" + git config user.email "github-actions@github.com" + + git add -A + + if git diff --cached --quiet; then + echo "No staged changes to commit." + exit 0 + fi + + git commit -m "Generated vdocs." + + # Ensure remote URL uses token for authentication + REPO_URL="$(git remote get-url origin)" + AUTH_REMOTE="${REPO_URL/https:\/\/github.com\//https:\/\/${GIT_PUSH_TOKEN}@github.com/}" + git remote set-url origin "$AUTH_REMOTE" + + git push origin "HEAD:${TARGET_BRANCH}" + shell: bash + + - name: No changes to commit + if: steps.gen_docs.outputs.changes == 'false' + run: echo "No release docs changes detected; nothing to commit." From 22548722109a46da2b305949d94803735c1363e0 Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 19 Oct 2026 09:46:48 +0000 Subject: [PATCH 58/60] Generated vdocs. --- .../release-notes/v0.0.1-beta.md | 102 +++++++++++++++++- pr_summary.md | 83 ++++++++++++++ 2 files changed, 184 insertions(+), 1 deletion(-) create mode 100644 pr_summary.md diff --git a/csharp_database_extension/CSharp Database Extension Testing/release-notes/v0.0.1-beta.md b/csharp_database_extension/CSharp Database Extension Testing/release-notes/v0.0.1-beta.md index 8c6886f..0f1942b 100644 --- a/csharp_database_extension/CSharp Database Extension Testing/release-notes/v0.0.1-beta.md +++ b/csharp_database_extension/CSharp Database Extension Testing/release-notes/v0.0.1-beta.md @@ -1,7 +1,107 @@ ## Release 0.0.1-beta -### Commits included +### PR Summary +**Title:** vbump: 0.0.1 beta + +**Author:** @RMotive + +**Description:** + +No description provided. + +**Labels:** None + +### Changes + +**Files modified:** +- .gitattributes +- .github/workflows/cd-1.yml +- .github/workflows/ci.yaml +- CSM Database Core/Abstractions/Interfaces/IDatabase.cs +- CSM Database Core/CHANGELOG.md +- CSM Database Core/Core/Attributes/Abstractions/Bases/RelationAttributeBase.cs +- CSM Database Core/Core/Attributes/Abstractions/Interfaces/IRelationAttribute.cs +- CSM Database Core/Entities/Abstractions/Bases/ActivableEntityBase.cs +- CSM Database Core/Entities/Abstractions/Bases/EntityBase.cs +- CSM Database Core/Entities/Abstractions/Bases/NamedEntityBase.cs +- CSM Database Core/Entities/Abstractions/Interfaces/IActivableEntity.cs +- CSM Database Core/Entities/Abstractions/Interfaces/IEntity.cs +- CSM Database Core/Entities/Abstractions/Interfaces/INamedEntity.cs +- CSM Database Testing/CHANGELOG.md +- CSM Database Testing/Disposing/Abstractions/Interfaces/ITestingDisposer.cs +- DatabaseProxy/Migrations/20260401220538_Init Db.Designer.cs +- DatabaseProxy/Migrations/20260401220538_Init Db.cs +- DatabaseProxy/Migrations/20260401221950_Init_Db_2.Designer.cs +- DatabaseProxy/Migrations/20260401221950_Init_Db_2.cs +- DatabaseProxy/Migrations/20260506231958_added_autoloading.Designer.cs +- DatabaseProxy/Migrations/20260506231958_added_autoloading.cs +- DatabaseProxy/Migrations/20260506232702_added_renamings.Designer.cs +- DatabaseProxy/Migrations/20260506232702_added_renamings.cs +- DatabaseProxy/Migrations/20260506232938_added_attributes.Designer.cs +- DatabaseProxy/Migrations/20260506232938_added_attributes.cs +- DatabaseProxy/Migrations/20260506233726_added_attributes_2.Designer.cs +- DatabaseProxy/Migrations/20260506233726_added_attributes_2.cs +- DatabaseProxy/Migrations/20260507000230_standarized db for proxies.Designer.cs +- DatabaseProxy/Migrations/20260507000230_standarized db for proxies.cs +- DatabaseProxy/Migrations/20260507000851_standarized db for proxies 2.Designer.cs + +**Commits:** +- forgot include +- Issue #41 - Adding async support for testing methods +- Issue #44 - Adding get method in [TestingStoreManager] +- removing unnecesary sync methods in csm database testing +- pull dev changes +- testing methods optimizations +- Summary definitions changes +- Merge pull request #45 from Cosmos-CSM/dev@issue_41_43 +- +- Dev@issue_41_43_44 --> Dev +- file structuring +- organizing solution +- Checking project adjustments and content +- testing and main project building +- integration tests added pending to check +- structuring multi providers +- finishing standarization and ready to go first version +- added unit tests project, correected ci workflow +- updating CI workflow +- fixing CI +- updating cd workflows +- pusing eol validation +- trying something else +- adding git attributes +- checking now +- changing approach +- applying checks +- trying again +- updating workflow +- aother update +- another try +- last try + +### Notes + +- Generated from PR metadata: title, body, labels, files, commits. + + +- added publisihment (Juan Renato Urrea Ortiz) +- fixed token (Juan Renato Urrea Ortiz) +- fixing generation (Juan Renato Urrea Ortiz) +- Merge branch 'vbump_0.0.1-beta' of https://github.com/Cosmos-CSM/fe_csharp_database into vbump_0.0.1-beta (Juan Renato Urrea Ortiz) +- trying new release generation (Juan Renato Urrea Ortiz) +- Generated vdocs. (github-actions) +- Merge branch 'vbump_0.0.1-beta' of https://github.com/Cosmos-CSM/fe_csharp_database into vbump_0.0.1-beta (Juan Renato Urrea Ortiz) +- preventing looping (Juan Renato Urrea Ortiz) +- Generated vdocs. (github-actions) +- Generated vdocs. (github-actions) +- Generated vdocs. (github-actions) +- fixing version check (Juan Renato Urrea Ortiz) +- fixing error (Juan Renato Urrea Ortiz) +- Merge branch 'vbump_0.0.1-beta' of https://github.com/Cosmos-CSM/fe_csharp_database into vbump_0.0.1-beta (Juan Renato Urrea Ortiz) +- adding a branch check (Juan Renato Urrea Ortiz) +- Generated vdocs. (github-actions) +- Generated vdocs. (github-actions) - Generated vdocs. (github-actions) - fixed ident (Juan Renato Urrea Ortiz) - added message (Juan Renato Urrea Ortiz) diff --git a/pr_summary.md b/pr_summary.md new file mode 100644 index 0000000..8c0eee3 --- /dev/null +++ b/pr_summary.md @@ -0,0 +1,83 @@ +### PR Summary + +**Title:** vbump: 0.0.1 beta + +**Author:** @RMotive + +**Description:** + +No description provided. + +**Labels:** None + +### Changes + +**Files modified:** +- .gitattributes +- .github/workflows/cd-1.yml +- .github/workflows/ci.yaml +- CSM Database Core/Abstractions/Interfaces/IDatabase.cs +- CSM Database Core/CHANGELOG.md +- CSM Database Core/Core/Attributes/Abstractions/Bases/RelationAttributeBase.cs +- CSM Database Core/Core/Attributes/Abstractions/Interfaces/IRelationAttribute.cs +- CSM Database Core/Entities/Abstractions/Bases/ActivableEntityBase.cs +- CSM Database Core/Entities/Abstractions/Bases/EntityBase.cs +- CSM Database Core/Entities/Abstractions/Bases/NamedEntityBase.cs +- CSM Database Core/Entities/Abstractions/Interfaces/IActivableEntity.cs +- CSM Database Core/Entities/Abstractions/Interfaces/IEntity.cs +- CSM Database Core/Entities/Abstractions/Interfaces/INamedEntity.cs +- CSM Database Testing/CHANGELOG.md +- CSM Database Testing/Disposing/Abstractions/Interfaces/ITestingDisposer.cs +- DatabaseProxy/Migrations/20260401220538_Init Db.Designer.cs +- DatabaseProxy/Migrations/20260401220538_Init Db.cs +- DatabaseProxy/Migrations/20260401221950_Init_Db_2.Designer.cs +- DatabaseProxy/Migrations/20260401221950_Init_Db_2.cs +- DatabaseProxy/Migrations/20260506231958_added_autoloading.Designer.cs +- DatabaseProxy/Migrations/20260506231958_added_autoloading.cs +- DatabaseProxy/Migrations/20260506232702_added_renamings.Designer.cs +- DatabaseProxy/Migrations/20260506232702_added_renamings.cs +- DatabaseProxy/Migrations/20260506232938_added_attributes.Designer.cs +- DatabaseProxy/Migrations/20260506232938_added_attributes.cs +- DatabaseProxy/Migrations/20260506233726_added_attributes_2.Designer.cs +- DatabaseProxy/Migrations/20260506233726_added_attributes_2.cs +- DatabaseProxy/Migrations/20260507000230_standarized db for proxies.Designer.cs +- DatabaseProxy/Migrations/20260507000230_standarized db for proxies.cs +- DatabaseProxy/Migrations/20260507000851_standarized db for proxies 2.Designer.cs + +**Commits:** +- forgot include +- Issue #41 - Adding async support for testing methods +- Issue #44 - Adding get method in [TestingStoreManager] +- removing unnecesary sync methods in csm database testing +- pull dev changes +- testing methods optimizations +- Summary definitions changes +- Merge pull request #45 from Cosmos-CSM/dev@issue_41_43 +- +- Dev@issue_41_43_44 --> Dev +- file structuring +- organizing solution +- Checking project adjustments and content +- testing and main project building +- integration tests added pending to check +- structuring multi providers +- finishing standarization and ready to go first version +- added unit tests project, correected ci workflow +- updating CI workflow +- fixing CI +- updating cd workflows +- pusing eol validation +- trying something else +- adding git attributes +- checking now +- changing approach +- applying checks +- trying again +- updating workflow +- aother update +- another try +- last try + +### Notes + +- Generated from PR metadata: title, body, labels, files, commits. From cbfa8de3cf88d5baaa5d9a466034ae8b65c7077f Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Mon, 19 Oct 2026 03:10:35 -0700 Subject: [PATCH 59/60] pushed removing use of changelog neither release- notes --- .github/workflows/cd-1.yml | 290 ------------------------------------- 1 file changed, 290 deletions(-) diff --git a/.github/workflows/cd-1.yml b/.github/workflows/cd-1.yml index 849bbd5..6746f68 100644 --- a/.github/workflows/cd-1.yml +++ b/.github/workflows/cd-1.yml @@ -117,293 +117,3 @@ jobs: printf '%s\n' "version=$VERSION" >> $GITHUB_OUTPUT printf '%s\n' "packages=$PACKAGES_JSON" >> $GITHUB_OUTPUT - - generate_release_docs: - name: Generate Release Documentation (Release-Notes & Changelog) - needs: compare-versions - runs-on: ubuntu-latest - strategy: - matrix: - package: ${{ fromJson(needs.compare-versions.outputs.packages) }} - - steps: - - name: CheckOut Head branch - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.ref }} - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - - name: SetUp GitHub Access - run: | - git config user.name "github-actions" - git config user.email "github-actions@github.com" - - - name: Prevent Looping - run: | - set -euo pipefail - - AUTO_NAME="github-actions" - AUTO_EMAIL="github-actions@github.com" - AUTO_COMMIT_MARKER="Generated vdocs." - - last_name=$(git log -1 --pretty=format:'%an') - last_email=$(git log -1 --pretty=format:'%ae') - last_message=$(git log -1 --pretty=format:'%s') - - echo "Last commit author: $last_name <$last_email>" - echo "Last commit message: $last_message" - - if [ "$last_name" = "$AUTO_NAME" ] || [ "$last_email" = "$AUTO_EMAIL" ] || echo "$last_message" | grep -qF "$AUTO_COMMIT_MARKER"; then - echo "Skipping generate_release_docs: last commit created by automation." - exit 0 - fi - shell: bash - - - name: Prepare Package Metadata - run: | - echo "PACKAGE='${{ matrix.package }}'" - echo "VERSION='${{ needs.compare-versions.outputs.version }}'" - shell: bash - - - name: Build PR Summary - id: pr_summary - run: | - set -euo pipefail - - PR_NUMBER="${{ github.event.pull_request.number }}" - REPO="${{ github.repository }}" - TOKEN="${{ secrets.GITHUB_TOKEN }}" - - echo "Fetching PR metadata for #$PR_NUMBER" - - PR_DATA=$(curl -s -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github+json" "https://api.github.com/repos/$REPO/pulls/$PR_NUMBER") || true - - TITLE=$(echo "$PR_DATA" | jq -r '.title // "No title"') - BODY=$(echo "$PR_DATA" | jq -r '.body // "No description provided."') - AUTHOR=$(echo "$PR_DATA" | jq -r '.user.login // "unknown"') - LABELS=$(echo "$PR_DATA" | jq -r '(.labels // []) | map(.name) | join(", ")') - - FILES_JSON=$(curl -s -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github+json" "https://api.github.com/repos/$REPO/pulls/$PR_NUMBER/files") || true - FILES=$(echo "$FILES_JSON" | jq -r '.[].filename' || true) - - COMMITS_JSON=$(curl -s -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github+json" "https://api.github.com/repos/$REPO/pulls/$PR_NUMBER/commits") || true - COMMITS=$(echo "$COMMITS_JSON" | jq -r '.[].commit.message' || true) - - SUMMARY_FILE="pr_summary.md" - - { - echo "### PR Summary" - echo "" - echo "**Title:** $TITLE" - echo "" - echo "**Author:** @$AUTHOR" - echo "" - echo "**Description:**" - echo "" - echo "$BODY" - echo "" - if [ -n "$LABELS" ]; then - echo "**Labels:** $LABELS" - else - echo "**Labels:** None" - fi - echo "" - echo "### Changes" - echo "" - echo "**Files modified:**" - if [ -n "$FILES" ]; then - echo "$FILES" | sed 's/^/- /' - else - echo "- (no file list available)" - fi - echo "" - echo "**Commits:**" - if [ -n "$COMMITS" ]; then - echo "$COMMITS" | sed 's/^/- /' - else - echo "- (no commits available)" - fi - echo "" - echo "### Notes" - echo "" - echo "- Generated from PR metadata: title, body, labels, files, commits." - } > "$SUMMARY_FILE" - - echo "summary_path=$SUMMARY_FILE" >> $GITHUB_OUTPUT - shell: bash - - - name: Generate release notes and update CHANGELOG - id: gen_docs - run: | - set -euo pipefail - - PACKAGE="${{ matrix.package }}" - VERSION="${{ needs.compare-versions.outputs.version }}" - SUMMARY_PATH="${{ steps.pr_summary.outputs.summary_path }}" - - PACKAGE_PATH="$PACKAGE" - RELEASE_DIR="$PACKAGE_PATH/release-notes" - RELEASE_FILE="$RELEASE_DIR/v${VERSION}.md" - - mkdir -p "$RELEASE_DIR" - - { - echo "## Release $VERSION" - echo "" - if [ -f "$SUMMARY_PATH" ]; then - cat "$SUMMARY_PATH" - else - echo "- No PR summary available." - fi - echo "" - } > "$RELEASE_FILE" - - BASE_SHA="${{ github.event.pull_request.base.sha }}" - HEAD_SHA="${{ github.event.pull_request.head.sha }}" - - if [ -z "$BASE_SHA" ] || [ -z "$HEAD_SHA" ]; then - echo "- Unable to determine commit range." >> "$RELEASE_FILE" - else - if [ "$(git rev-list --count "$BASE_SHA..$HEAD_SHA")" -eq 0 ]; then - echo "- No commits detected between base and head." >> "$RELEASE_FILE" - else - echo "" >> "$RELEASE_FILE" - git --no-pager log --pretty=format:"- %s (%an)" "$BASE_SHA..$HEAD_SHA" >> "$RELEASE_FILE" - fi - fi - - # Ensure CHANGELOG exists at package root - CHANGELOG_FILE="$PACKAGE_PATH/CHANGELOG" - if [ ! -f "$CHANGELOG_FILE" ]; then - echo "# Changelog" > "$CHANGELOG_FILE" - echo "" >> "$CHANGELOG_FILE" - fi - - NEW_ENTRY_FILE="$(mktemp)" - { - echo "## v${VERSION}" - echo "" - if [ -f "$SUMMARY_PATH" ]; then - cat "$SUMMARY_PATH" - else - echo "- No PR summary available." - fi - echo "" - echo "### Commits" - if [ -n "$HEAD_SHA" ] && [ -n "$BASE_SHA" ]; then - git --no-pager log --pretty=format:"- %s (%an)" "$BASE_SHA..$HEAD_SHA" - fi - echo "" - } > "$NEW_ENTRY_FILE" - - # Replace or prepend entry - if grep -qE "^## v${VERSION}\b" "$CHANGELOG_FILE"; then - awk -v ver="v${VERSION}" -v newfile="$NEW_ENTRY_FILE" ' - BEGIN { - replaced = 0; - while ((getline line < newfile) > 0) { - newlines = newlines line "\n" - } - close(newfile) - } - { - if ($0 ~ "^## " ver "\\b") { - printf "%s", newlines - replaced = 1 - while (getline > 0) { - if ($0 ~ "^## v[0-9]+") { - print $0 - break - } - } - next - } - print $0 - } - END { - } - ' "$CHANGELOG_FILE" > "${CHANGELOG_FILE}.tmp" || true - - if [ -s "${CHANGELOG_FILE}.tmp" ]; then - mv "${CHANGELOG_FILE}.tmp" "$CHANGELOG_FILE" - else - cat "$NEW_ENTRY_FILE" "$CHANGELOG_FILE" > "${CHANGELOG_FILE}.tmp" - mv "${CHANGELOG_FILE}.tmp" "$CHANGELOG_FILE" - fi - else - if head -n1 "$CHANGELOG_FILE" | grep -qE '^#\s+Changelog'; then - tail -n +2 "$CHANGELOG_FILE" > "${CHANGELOG_FILE}.body.tmp" - { head -n1 "$CHANGELOG_FILE"; echo ""; cat "$NEW_ENTRY_FILE"; echo ""; cat "${CHANGELOG_FILE}.body.tmp"; } > "${CHANGELOG_FILE}.tmp" - mv "${CHANGELOG_FILE}.tmp" "$CHANGELOG_FILE" - rm -f "${CHANGELOG_FILE}.body.tmp" - else - cat "$NEW_ENTRY_FILE" "$CHANGELOG_FILE" > "${CHANGELOG_FILE}.tmp" - mv "${CHANGELOG_FILE}.tmp" "$CHANGELOG_FILE" - fi - fi - - rm -f "$NEW_ENTRY_FILE" - - # Expose whether there are changes to commit - if git status --porcelain | grep -q .; then - echo "changes=true" >> $GITHUB_OUTPUT - else - echo "changes=false" >> $GITHUB_OUTPUT - fi - shell: bash - - - name: Post release notes as PR comment (works for forks) - if: always() - env: - TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - set -euo pipefail - PR_NUM=${{ github.event.pull_request.number }} - REPO="${{ github.repository }}" - PACKAGE="${{ matrix.package }}" - VERSION="${{ needs.compare-versions.outputs.version }}" - RELEASE_FILE="${PACKAGE}/release-notes/v${VERSION}.md" - - if [ -f "$RELEASE_FILE" ]; then - # Use jq -Rs to safely encode the file content into JSON string - BODY_JSON=$(jq -Rs --arg title "Release notes for ${PACKAGE} v${VERSION}" '{body: (. | "\n" + .)}' < "$RELEASE_FILE") - curl -s -X POST -H "Authorization: Bearer $TOKEN" -H "Accept: application/vnd.github+json" \ - "https://api.github.com/repos/${REPO}/issues/${PR_NUM}/comments" \ - -d "$BODY_JSON" > /dev/null || true - echo "Posted release notes as PR comment." - else - echo "Release file not found; skipping PR comment." - fi - shell: bash - - - name: Commit Generated vdocs (only when PR branch is in same repo) - if: steps.gen_docs.outputs.changes == 'true' && (github.event.pull_request.head.repo.full_name == github.repository) - env: - GIT_PUSH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - TARGET_BRANCH: ${{ github.event.pull_request.head.ref }} - run: | - set -euo pipefail - git config user.name "github-actions" - git config user.email "github-actions@github.com" - - git add -A - - if git diff --cached --quiet; then - echo "No staged changes to commit." - exit 0 - fi - - git commit -m "Generated vdocs." - - # Ensure remote URL uses token for authentication - REPO_URL="$(git remote get-url origin)" - AUTH_REMOTE="${REPO_URL/https:\/\/github.com\//https:\/\/${GIT_PUSH_TOKEN}@github.com/}" - git remote set-url origin "$AUTH_REMOTE" - - git push origin "HEAD:${TARGET_BRANCH}" - shell: bash - - - name: No changes to commit - if: steps.gen_docs.outputs.changes == 'false' - run: echo "No release docs changes detected; nothing to commit." From 3d7c1797d9a4330f668477c1e2be5cad1398dec8 Mon Sep 17 00:00:00 2001 From: Juan Renato Urrea Ortiz Date: Mon, 19 Oct 2026 03:27:52 -0700 Subject: [PATCH 60/60] removed and standarized csproj --- .../CHANGELOG | 59 ------------------- .../CHANGELOG.md | 1 - .../CSharp Database Extension Testing.csproj | 21 ++++--- .../CSharp Database Extension/CHANGELOG | 58 ------------------ .../CSharp Database Extension/CHANGELOG.md | 1 - .../CSharp Database Extension.csproj | 18 +++--- 6 files changed, 18 insertions(+), 140 deletions(-) delete mode 100644 csharp_database_extension/CSharp Database Extension Testing/CHANGELOG delete mode 100644 csharp_database_extension/CSharp Database Extension Testing/CHANGELOG.md delete mode 100644 csharp_database_extension/CSharp Database Extension/CHANGELOG delete mode 100644 csharp_database_extension/CSharp Database Extension/CHANGELOG.md diff --git a/csharp_database_extension/CSharp Database Extension Testing/CHANGELOG b/csharp_database_extension/CSharp Database Extension Testing/CHANGELOG deleted file mode 100644 index e6b0197..0000000 --- a/csharp_database_extension/CSharp Database Extension Testing/CHANGELOG +++ /dev/null @@ -1,59 +0,0 @@ -# Changelog - -## v0.0.1-beta - -### Release notes - -### Commits included - -- Generated vdocs. (github-actions) -- fixed ident (Juan Renato Urrea Ortiz) -- added message (Juan Renato Urrea Ortiz) -- fixed all syntax (Juan Renato Urrea Ortiz) -- fixing arguments (Juan Renato Urrea Ortiz) -- fixed syntax (Juan Renato Urrea Ortiz) -- fixed syntax error (Juan Renato Urrea Ortiz) -- testing new version (Juan Renato Urrea Ortiz) -- trying another apporach (Juan Renato Urrea Ortiz) -- trying single line approach (Juan Renato Urrea Ortiz) -- corrected a workflow var (Juan Renato Urrea Ortiz) -- testing workflow to auto-generate release docs (Juan Renato Urrea Ortiz) -- Merge branch 'main' into dev (Renato Urrea) -- Merge branch 'dev' of https://github.com/Cosmos-CSM/fe_csharp_database into dev (Juan Renato Urrea Ortiz) -- adding package metadata and bump checker (Juan Renato Urrea Ortiz) -- Merge branch 'main' into dev (Renato Urrea) -- removing cd workflows (Juan Renato Urrea Ortiz) -- Merge pull request #47 from Cosmos-CSM/46-standarize-repository (Renato Urrea) -- adding nuget source (Juan Renato Urrea Ortiz) -- last try (Juan Renato Urrea Ortiz) -- another try (Juan Renato Urrea Ortiz) -- aother update (Juan Renato Urrea Ortiz) -- updating workflow (Juan Renato Urrea Ortiz) -- trying again (Juan Renato Urrea Ortiz) -- applying checks (Juan Renato Urrea Ortiz) -- changing approach (Juan Renato Urrea Ortiz) -- checking now (Juan Renato Urrea Ortiz) -- adding git attributes (Juan Renato Urrea Ortiz) -- trying something else (Juan Renato Urrea Ortiz) -- pusing eol validation (Juan Renato Urrea Ortiz) -- updating cd workflows (Juan Renato Urrea Ortiz) -- fixing CI (Juan Renato Urrea Ortiz) -- updating CI workflow (Juan Renato Urrea Ortiz) -- added unit tests project, correected ci workflow (Juan Renato Urrea Ortiz) -- finishing standarization and ready to go first version (Juan Renato Urrea Ortiz) -- structuring multi providers (Juan Renato Urrea Ortiz) -- integration tests added pending to check (Renato Urrea) -- testing and main project building (Renato Urrea) -- Checking project adjustments and content (Renato Urrea) -- organizing solution (Juan Renato Urrea Ortiz) -- file structuring (Juan Renato Urrea Ortiz) -- Merge pull request #45 from Cosmos-CSM/dev@issue_41_43 (Renato Urrea) -- Summary definitions changes (jr110) -- testing methods optimizations (jr110) -- pull dev changes (jr110) -- removing unnecesary sync methods in csm database testing (jr110) -- Issue #44 - Adding get method in [TestingStoreManager] (jr110) -- Issue #41 - Adding async support for testing methods (jr110) -- forgot include (Juan Renato Urrea Ortiz) - - diff --git a/csharp_database_extension/CSharp Database Extension Testing/CHANGELOG.md b/csharp_database_extension/CSharp Database Extension Testing/CHANGELOG.md deleted file mode 100644 index 505d21d..0000000 --- a/csharp_database_extension/CSharp Database Extension Testing/CHANGELOG.md +++ /dev/null @@ -1 +0,0 @@ -# CHANGELOG \ No newline at end of file diff --git a/csharp_database_extension/CSharp Database Extension Testing/CSharp Database Extension Testing.csproj b/csharp_database_extension/CSharp Database Extension Testing/CSharp Database Extension Testing.csproj index 25672d8..2af45b5 100644 --- a/csharp_database_extension/CSharp Database Extension Testing/CSharp Database Extension Testing.csproj +++ b/csharp_database_extension/CSharp Database Extension Testing/CSharp Database Extension Testing.csproj @@ -4,25 +4,24 @@ $(GitVersion) CSharp.Database.Extension.Testing CSharp_Database_Extension_Testing - + https://github.com/Cosmos-CSM/csm_database + net10.0 + + true + true + A framework extension package for CSM extended utilities related with database testing, provide tools to properly and easily test organization database implementations and base expectations. + Renato Urrea Cosmos (CSM) - https://github.com/Cosmos-CSM/csm_database - enable + enable - true - CHANGELOG.md + Exe true false - Exe - true + enable - - - - diff --git a/csharp_database_extension/CSharp Database Extension/CHANGELOG b/csharp_database_extension/CSharp Database Extension/CHANGELOG deleted file mode 100644 index a20a3a8..0000000 --- a/csharp_database_extension/CSharp Database Extension/CHANGELOG +++ /dev/null @@ -1,58 +0,0 @@ -# Changelog - -## v0.0.1-beta - -### Release notes - -### Commits included - -- fixed ident (Juan Renato Urrea Ortiz) -- added message (Juan Renato Urrea Ortiz) -- fixed all syntax (Juan Renato Urrea Ortiz) -- fixing arguments (Juan Renato Urrea Ortiz) -- fixed syntax (Juan Renato Urrea Ortiz) -- fixed syntax error (Juan Renato Urrea Ortiz) -- testing new version (Juan Renato Urrea Ortiz) -- trying another apporach (Juan Renato Urrea Ortiz) -- trying single line approach (Juan Renato Urrea Ortiz) -- corrected a workflow var (Juan Renato Urrea Ortiz) -- testing workflow to auto-generate release docs (Juan Renato Urrea Ortiz) -- Merge branch 'main' into dev (Renato Urrea) -- Merge branch 'dev' of https://github.com/Cosmos-CSM/fe_csharp_database into dev (Juan Renato Urrea Ortiz) -- adding package metadata and bump checker (Juan Renato Urrea Ortiz) -- Merge branch 'main' into dev (Renato Urrea) -- removing cd workflows (Juan Renato Urrea Ortiz) -- Merge pull request #47 from Cosmos-CSM/46-standarize-repository (Renato Urrea) -- adding nuget source (Juan Renato Urrea Ortiz) -- last try (Juan Renato Urrea Ortiz) -- another try (Juan Renato Urrea Ortiz) -- aother update (Juan Renato Urrea Ortiz) -- updating workflow (Juan Renato Urrea Ortiz) -- trying again (Juan Renato Urrea Ortiz) -- applying checks (Juan Renato Urrea Ortiz) -- changing approach (Juan Renato Urrea Ortiz) -- checking now (Juan Renato Urrea Ortiz) -- adding git attributes (Juan Renato Urrea Ortiz) -- trying something else (Juan Renato Urrea Ortiz) -- pusing eol validation (Juan Renato Urrea Ortiz) -- updating cd workflows (Juan Renato Urrea Ortiz) -- fixing CI (Juan Renato Urrea Ortiz) -- updating CI workflow (Juan Renato Urrea Ortiz) -- added unit tests project, correected ci workflow (Juan Renato Urrea Ortiz) -- finishing standarization and ready to go first version (Juan Renato Urrea Ortiz) -- structuring multi providers (Juan Renato Urrea Ortiz) -- integration tests added pending to check (Renato Urrea) -- testing and main project building (Renato Urrea) -- Checking project adjustments and content (Renato Urrea) -- organizing solution (Juan Renato Urrea Ortiz) -- file structuring (Juan Renato Urrea Ortiz) -- Merge pull request #45 from Cosmos-CSM/dev@issue_41_43 (Renato Urrea) -- Summary definitions changes (jr110) -- testing methods optimizations (jr110) -- pull dev changes (jr110) -- removing unnecesary sync methods in csm database testing (jr110) -- Issue #44 - Adding get method in [TestingStoreManager] (jr110) -- Issue #41 - Adding async support for testing methods (jr110) -- forgot include (Juan Renato Urrea Ortiz) - - diff --git a/csharp_database_extension/CSharp Database Extension/CHANGELOG.md b/csharp_database_extension/CSharp Database Extension/CHANGELOG.md deleted file mode 100644 index 505d21d..0000000 --- a/csharp_database_extension/CSharp Database Extension/CHANGELOG.md +++ /dev/null @@ -1 +0,0 @@ -# CHANGELOG \ No newline at end of file diff --git a/csharp_database_extension/CSharp Database Extension/CSharp Database Extension.csproj b/csharp_database_extension/CSharp Database Extension/CSharp Database Extension.csproj index 563b526..35b875f 100644 --- a/csharp_database_extension/CSharp Database Extension/CSharp Database Extension.csproj +++ b/csharp_database_extension/CSharp Database Extension/CSharp Database Extension.csproj @@ -4,24 +4,22 @@ $(GitVersion) CSharp.Database.Extension CSharp_Database_Extension + https://github.com/Cosmos-CSM/csm_database + + net10.0 + true + true + A framework extension package for CSM extended utilities related with database management, provide tools to configure easily database models and standard through organization creations. - net10.0 Renato Urrea Cosmos (CSM) - https://github.com/Cosmos-CSM/csm_database - enable + enable - true - CHANGELOG.md true - true + enable - - - -