diff --git a/src/V1/ServiceBricks.Logging.AzureDataTables.Debug/ServiceBricks.Logging.AzureDataTables.Debug.csproj b/src/V1/ServiceBricks.Logging.AzureDataTables.Debug/ServiceBricks.Logging.AzureDataTables.Debug.csproj index 2937d8b..6140cb1 100644 --- a/src/V1/ServiceBricks.Logging.AzureDataTables.Debug/ServiceBricks.Logging.AzureDataTables.Debug.csproj +++ b/src/V1/ServiceBricks.Logging.AzureDataTables.Debug/ServiceBricks.Logging.AzureDataTables.Debug.csproj @@ -1,4 +1,4 @@ - + net6.0;net7.0;net8.0 @@ -9,12 +9,13 @@ - + + @@ -25,9 +26,9 @@ - + - + diff --git a/src/V1/ServiceBricks.Logging.AzureDataTables/Extensions/ApplicationBuilderExtensions.cs b/src/V1/ServiceBricks.Logging.AzureDataTables/Extensions/ApplicationBuilderExtensions.cs deleted file mode 100644 index cec33c2..0000000 --- a/src/V1/ServiceBricks.Logging.AzureDataTables/Extensions/ApplicationBuilderExtensions.cs +++ /dev/null @@ -1,51 +0,0 @@ -using Azure.Data.Tables; -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using ServiceBricks.Storage.AzureDataTables; - -namespace ServiceBricks.Logging.AzureDataTables -{ - /// - /// Extensions for starting the ServiceBricks Logging Azure Data Tables module. - /// - public static partial class ApplicationBuilderExtensions - { - /// - /// Flag to indicate if the module has started. - /// - public static bool ModuleStarted = false; - - /// - /// Start the ServiceBricks Logging Azure Data Tables module. - /// - /// - /// - public static IApplicationBuilder StartServiceBricksLoggingAzureDataTables(this IApplicationBuilder applicationBuilder) - { - // AI: Get the connection string - var configuration = applicationBuilder.ApplicationServices.GetRequiredService(); - var connectionString = configuration.GetAzureDataTablesConnectionString( - LoggingAzureDataTablesConstants.APPSETTING_CONNECTION_STRING); - - // AI: Create each table in the module - TableClient tableClient = new TableClient( - connectionString, - LoggingAzureDataTablesConstants.GetTableName(nameof(LogMessage))); - tableClient.CreateIfNotExists(); - - tableClient = new TableClient( - connectionString, - LoggingAzureDataTablesConstants.GetTableName(nameof(WebRequestMessage))); - tableClient.CreateIfNotExists(); - - // AI: Set the module started flag - ModuleStarted = true; - - // AI: Start parent module - applicationBuilder.StartServiceBricksLogging(); - - return applicationBuilder; - } - } -} \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.AzureDataTables/Extensions/ServiceCollectionExtensions.cs b/src/V1/ServiceBricks.Logging.AzureDataTables/Extensions/ServiceCollectionExtensions.cs index fbfe800..e40d19a 100644 --- a/src/V1/ServiceBricks.Logging.AzureDataTables/Extensions/ServiceCollectionExtensions.cs +++ b/src/V1/ServiceBricks.Logging.AzureDataTables/Extensions/ServiceCollectionExtensions.cs @@ -16,33 +16,16 @@ public static partial class ServiceCollectionExtensions /// public static IServiceCollection AddServiceBricksLoggingAzureDataTables(this IServiceCollection services, IConfiguration configuration) { - // AI: Add the module to the ModuleRegistry - ModuleRegistry.Instance.RegisterItem(typeof(LoggingAzureDataTablesModule), new LoggingAzureDataTablesModule()); - // AI: Add parent module services.AddServiceBricksLogging(configuration); - // AI: Configure all options for the module - - // AI: Add storage services for the module. Each domain object should have its own storage repository - services.AddScoped, LoggingStorageRepository>(); - services.AddScoped, LoggingStorageRepository>(); - - // AI: Add API services for the module. Each DTO should have two registrations, one for the generic IApiService<> and one for the named interface - services.AddScoped, LogMessageApiService>(); - services.AddScoped(); - - services.AddScoped, WebRequestMessageApiService>(); - services.AddScoped(); - - // AI: Register business rules for the module - DomainCreateDateRule.Register(BusinessRuleRegistry.Instance); - LogMessageCreateRule.Register(BusinessRuleRegistry.Instance); - LogMessageQueryRule.Register(BusinessRuleRegistry.Instance); + // AI: Add the module to the ModuleRegistry + ModuleRegistry.Instance.Register(LoggingAzureDataTablesModule.Instance); - DomainCreateDateRule.Register(BusinessRuleRegistry.Instance); - WebRequestMessageCreateRule.Register(BusinessRuleRegistry.Instance); - WebRequestMessageQueryRule.Register(BusinessRuleRegistry.Instance); + // AI: Add module business rules + LoggingAzureDataTablesModuleAddRule.Register(BusinessRuleRegistry.Instance); + LoggingAzureDataTablesModuleStartRule.Register(BusinessRuleRegistry.Instance); + ModuleSetStartedRule.Register(BusinessRuleRegistry.Instance); return services; } diff --git a/src/V1/ServiceBricks.Logging.AzureDataTables/Model/LoggingAzureDataTablesModule.cs b/src/V1/ServiceBricks.Logging.AzureDataTables/Model/LoggingAzureDataTablesModule.cs index 0989078..9838c07 100644 --- a/src/V1/ServiceBricks.Logging.AzureDataTables/Model/LoggingAzureDataTablesModule.cs +++ b/src/V1/ServiceBricks.Logging.AzureDataTables/Model/LoggingAzureDataTablesModule.cs @@ -5,8 +5,13 @@ namespace ServiceBricks.Logging.AzureDataTables /// /// This is the module definition for the ServiceBricks Logging Azure Data Tables module. /// - public partial class LoggingAzureDataTablesModule : IModule + public partial class LoggingAzureDataTablesModule : ServiceBricks.Module { + /// + /// Instance + /// + public static LoggingAzureDataTablesModule Instance = new LoggingAzureDataTablesModule(); + /// /// Constructor /// @@ -21,20 +26,5 @@ public LoggingAzureDataTablesModule() new LoggingModule() }; } - - /// - /// The list of dependent modules for the module. - /// - public List DependentModules { get; } - - /// - /// The list of assemblies that contain AutoMapper profiles for the module. - /// - public List AutomapperAssemblies { get; } - - /// - /// The list of assemblies that contain view models for the module. - /// - public List ViewAssemblies { get; } } } \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.AzureDataTables/Rule/LogMessageCreateRule.cs b/src/V1/ServiceBricks.Logging.AzureDataTables/Rule/LogMessageCreateRule.cs index 48224ab..62a474c 100644 --- a/src/V1/ServiceBricks.Logging.AzureDataTables/Rule/LogMessageCreateRule.cs +++ b/src/V1/ServiceBricks.Logging.AzureDataTables/Rule/LogMessageCreateRule.cs @@ -1,5 +1,4 @@ -using Microsoft.Extensions.Logging; -using ServiceBricks.Storage.AzureDataTables; +using ServiceBricks.Storage.AzureDataTables; namespace ServiceBricks.Logging.AzureDataTables { @@ -8,15 +7,11 @@ namespace ServiceBricks.Logging.AzureDataTables /// public sealed class LogMessageCreateRule : BusinessRule { - private readonly ILogger _logger; - /// /// Constructor. /// - /// - public LogMessageCreateRule(ILoggerFactory loggerFactory) + public LogMessageCreateRule() { - _logger = loggerFactory.CreateLogger(); Priority = PRIORITY_LOW; } @@ -51,44 +46,34 @@ public override IResponse ExecuteRule(IBusinessRuleContext context) { var response = new Response(); - try + // AI: Make sure the context object is the correct type + if (context == null || context.Object == null) { - // AI: Make sure the context object is the correct type - if (context.Object is DomainCreateBeforeEvent e) - { - // AI: Set the Key, PartitionKey, and RowKey - var item = e.DomainObject; - item.Key = Guid.NewGuid(); - - // AI: Set the PartitionKey to be the year, month and day so that the data is partitioned - item.PartitionKey = item.CreateDate.ToString("yyyyMMdd"); - - // AI: Set the RowKey to be the reverse date and time so that the newest items are at the top when querying - var reverseDate = DateTimeOffset.MaxValue.Ticks - item.CreateDate.Ticks; - item.RowKey = - reverseDate.ToString("d19") + - StorageAzureDataTablesConstants.KEY_DELIMITER + - item.Key.ToString(); - } + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; } - catch (Exception ex) + var e = context.Object as DomainCreateBeforeEvent; + if (e == null || e.DomainObject == null) { - _logger.LogError(ex, ex.Message); - response.AddMessage(ResponseMessage.CreateError(LocalizationResource.ERROR_BUSINESS_RULE)); + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; } - return response; - } + // AI: Set the Key, PartitionKey, and RowKey + var item = e.DomainObject; + item.Key = Guid.NewGuid(); - /// - /// Execute the business rule. - /// - /// - /// - public override Task ExecuteRuleAsync(IBusinessRuleContext context) - { - // AI: There is no async work, so just call the sync method - return Task.FromResult(ExecuteRule(context)); + // AI: Set the PartitionKey to be the year, month and day so that the data is partitioned + item.PartitionKey = item.CreateDate.ToString("yyyyMMdd"); + + // AI: Set the RowKey to be the reverse date and time so that the newest items are at the top when querying + var reverseDate = DateTimeOffset.MaxValue.Ticks - item.CreateDate.Ticks; + item.RowKey = + reverseDate.ToString("d19") + + StorageAzureDataTablesConstants.KEY_DELIMITER + + item.Key.ToString(); + + return response; } } } \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.AzureDataTables/Rule/LogMessageQueryRule.cs b/src/V1/ServiceBricks.Logging.AzureDataTables/Rule/LogMessageQueryRule.cs index 4b8fba7..eebd0c1 100644 --- a/src/V1/ServiceBricks.Logging.AzureDataTables/Rule/LogMessageQueryRule.cs +++ b/src/V1/ServiceBricks.Logging.AzureDataTables/Rule/LogMessageQueryRule.cs @@ -1,5 +1,4 @@ -using Microsoft.Extensions.Logging; -using ServiceBricks.Storage.AzureDataTables; +using ServiceBricks.Storage.AzureDataTables; namespace ServiceBricks.Logging.AzureDataTables { @@ -8,15 +7,11 @@ namespace ServiceBricks.Logging.AzureDataTables /// public sealed class LogMessageQueryRule : BusinessRule { - private readonly ILogger _logger; - /// /// Constructor. /// - /// - public LogMessageQueryRule(ILoggerFactory loggerFactory) + public LogMessageQueryRule() { - _logger = loggerFactory.CreateLogger(); Priority = PRIORITY_NORMAL; } @@ -51,66 +46,57 @@ public override IResponse ExecuteRule(IBusinessRuleContext context) { var response = new Response(); - try + // AI: Make sure the context object is the correct type + if (context == null || context.Object == null) { - // AI: Make sure the context object is the correct type - if (context.Object is DomainQueryBeforeEvent ei) - { - var item = ei.DomainObject; - if (ei.ServiceQueryRequest == null || ei.ServiceQueryRequest.Filters == null) - return response; + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } + var ei = context.Object as DomainQueryBeforeEvent; + if (ei == null) + { + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } + + // AI: Nothing to do + if (ei.ServiceQueryRequest == null || ei.ServiceQueryRequest.Filters == null) + return response; - // AI: Iterate through the filters and modify the property name for StorageKey and change it to Key - foreach (var filter in ei.ServiceQueryRequest.Filters) + // AI: Iterate through the filters and modify the property name for StorageKey and change it to Key + foreach (var filter in ei.ServiceQueryRequest.Filters) + { + if (filter.Properties != null && + filter.Properties.Count > 0) + { + bool found = false; + for (int i = 0; i < filter.Properties.Count; i++) { - if (filter.Properties != null && - filter.Properties.Count > 0) + if (string.Compare(filter.Properties[i], "StorageKey", true) == 0) { - bool found = false; - for (int i = 0; i < filter.Properties.Count; i++) - { - if (string.Compare(filter.Properties[i], "StorageKey", true) == 0) - { - found = true; - filter.Properties[i] = "Key"; - } - } - if (found) + found = true; + filter.Properties[i] = "Key"; + } + } + if (found) + { + // AI: Iterate through the values. Split each one using the delimiter and re-set the value to use the second part. See LogMessageCreateRule for more information. + if (filter.Values != null && filter.Values.Count > 0) + { + for (int i = 0; i < filter.Values.Count; i++) { - // AI: Iterate through the values. Split each one using the delimiter and re-set the value to use the second part. See LogMessageCreateRule for more information. - if (filter.Values != null && filter.Values.Count > 0) + string[] split = filter.Values[i].Split(StorageAzureDataTablesConstants.KEY_DELIMITER); + if (split.Length == 2) { - for (int i = 0; i < filter.Values.Count; i++) - { - string[] split = filter.Values[i].Split(StorageAzureDataTablesConstants.KEY_DELIMITER); - if (split.Length == 2) - { - filter.Values[i] = split[1]; - } - } + filter.Values[i] = split[1]; } } } } } } - catch (Exception ex) - { - _logger.LogError(ex, ex.Message); - response.AddMessage(ResponseMessage.CreateError(LocalizationResource.ERROR_BUSINESS_RULE)); - } return response; } - - /// - /// Execute the business rule. - /// - /// - /// - public override Task ExecuteRuleAsync(IBusinessRuleContext context) - { - return Task.FromResult(ExecuteRule(context)); - } } } \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.AzureDataTables/Rule/LoggingAzureDataTablesModuleAddRule.cs b/src/V1/ServiceBricks.Logging.AzureDataTables/Rule/LoggingAzureDataTablesModuleAddRule.cs new file mode 100644 index 0000000..7e10511 --- /dev/null +++ b/src/V1/ServiceBricks.Logging.AzureDataTables/Rule/LoggingAzureDataTablesModuleAddRule.cs @@ -0,0 +1,81 @@ +using Microsoft.Extensions.DependencyInjection; + +namespace ServiceBricks.Logging.AzureDataTables +{ + /// + /// This rule is executed when the ServiceBricks module is added. + /// + public sealed class LoggingAzureDataTablesModuleAddRule : BusinessRule + { + /// + /// Register the rule + /// + public static void Register(IBusinessRuleRegistry registry) + { + registry.Register( + typeof(ModuleAddEvent), + typeof(LoggingAzureDataTablesModuleAddRule)); + } + + /// + /// UnRegister the rule. + /// + public static void UnRegister(IBusinessRuleRegistry registry) + { + registry.UnRegister( + typeof(ModuleAddEvent), + typeof(LoggingAzureDataTablesModuleAddRule)); + } + + /// + /// Execute the business rule. + /// + /// + /// + public override IResponse ExecuteRule(IBusinessRuleContext context) + { + var response = new Response(); + + // AI: Make sure the context object is the correct type + if (context == null || context.Object == null) + { + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } + var e = context.Object as ModuleAddEvent; + if (e == null || e.DomainObject == null || e.ServiceCollection == null) + { + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } + + // AI: Perform logic + var services = e.ServiceCollection; + //var configuration = e.Configuration; + + // AI: Configure all options for the module + + // AI: Add storage services for the module. Each domain object should have its own storage repository + services.AddScoped, LoggingStorageRepository>(); + services.AddScoped, LoggingStorageRepository>(); + + // AI: Add API services for the module. Each DTO should have two registrations, one for the generic IApiService<> and one for the named interface + services.AddScoped, LogMessageApiService>(); + services.AddScoped(); + + services.AddScoped, WebRequestMessageApiService>(); + services.AddScoped(); + + // AI: Register business rules for the module + DomainCreateDateRule.Register(BusinessRuleRegistry.Instance); + LogMessageCreateRule.Register(BusinessRuleRegistry.Instance); + LogMessageQueryRule.Register(BusinessRuleRegistry.Instance); + + DomainCreateDateRule.Register(BusinessRuleRegistry.Instance); + WebRequestMessageCreateRule.Register(BusinessRuleRegistry.Instance); + WebRequestMessageQueryRule.Register(BusinessRuleRegistry.Instance); + + return response; + } + } +} \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.AzureDataTables/Rule/LoggingAzureDataTablesModuleStartRule.cs b/src/V1/ServiceBricks.Logging.AzureDataTables/Rule/LoggingAzureDataTablesModuleStartRule.cs new file mode 100644 index 0000000..c8258b5 --- /dev/null +++ b/src/V1/ServiceBricks.Logging.AzureDataTables/Rule/LoggingAzureDataTablesModuleStartRule.cs @@ -0,0 +1,75 @@ +using Azure.Data.Tables; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using ServiceBricks.Storage.AzureDataTables; + +namespace ServiceBricks.Logging.AzureDataTables +{ + /// + /// This rule is executed when the ServiceBricks module is added. + /// + public sealed class LoggingAzureDataTablesModuleStartRule : BusinessRule + { + /// + /// Register the rule + /// + public static void Register(IBusinessRuleRegistry registry) + { + registry.Register( + typeof(ModuleStartEvent), + typeof(LoggingAzureDataTablesModuleStartRule)); + } + + /// + /// UnRegister the rule. + /// + public static void UnRegister(IBusinessRuleRegistry registry) + { + registry.UnRegister( + typeof(ModuleStartEvent), + typeof(LoggingAzureDataTablesModuleStartRule)); + } + + /// + /// Execute the business rule. + /// + /// + /// + public override IResponse ExecuteRule(IBusinessRuleContext context) + { + var response = new Response(); + + // AI: Make sure the context object is the correct type + if (context == null || context.Object == null) + { + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } + var e = context.Object as ModuleStartEvent; + if (e == null || e.DomainObject == null || e.ApplicationBuilder == null) + { + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } + + // AI: Perform logic + + // AI: Get the connection string + var configuration = e.ApplicationBuilder.ApplicationServices.GetRequiredService(); + var connectionString = configuration.GetAzureDataTablesConnectionString( + LoggingAzureDataTablesConstants.APPSETTING_CONNECTION_STRING); + + // AI: Create each table in the module + TableClient tableClient = new TableClient( + connectionString, + LoggingAzureDataTablesConstants.GetTableName(nameof(LogMessage))); + tableClient.CreateIfNotExists(); + + tableClient = new TableClient( + connectionString, + LoggingAzureDataTablesConstants.GetTableName(nameof(WebRequestMessage))); + tableClient.CreateIfNotExists(); + return response; + } + } +} \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.AzureDataTables/Rule/WebRequestMessageCreateRule.cs b/src/V1/ServiceBricks.Logging.AzureDataTables/Rule/WebRequestMessageCreateRule.cs index 706f4ec..52eea0c 100644 --- a/src/V1/ServiceBricks.Logging.AzureDataTables/Rule/WebRequestMessageCreateRule.cs +++ b/src/V1/ServiceBricks.Logging.AzureDataTables/Rule/WebRequestMessageCreateRule.cs @@ -1,5 +1,4 @@ -using Microsoft.Extensions.Logging; -using ServiceBricks.Storage.AzureDataTables; +using ServiceBricks.Storage.AzureDataTables; namespace ServiceBricks.Logging.AzureDataTables { @@ -8,15 +7,11 @@ namespace ServiceBricks.Logging.AzureDataTables /// public sealed class WebRequestMessageCreateRule : BusinessRule { - private readonly ILogger _logger; - /// /// Constructor. /// - /// - public WebRequestMessageCreateRule(ILoggerFactory loggerFactory) + public WebRequestMessageCreateRule() { - _logger = loggerFactory.CreateLogger(); Priority = PRIORITY_LOW; } @@ -47,32 +42,33 @@ public override IResponse ExecuteRule(IBusinessRuleContext context) { var response = new Response(); - try + // AI: Make sure the context object is the correct type + if (context == null || context.Object == null) { - // AI: Make sure the context object is the correct type - if (context.Object is DomainCreateBeforeEvent ei) - { - // AI: Set the Key, PartitionKey, and RowKey - var item = ei.DomainObject; - item.Key = Guid.NewGuid(); - - // AI: Set the PartitionKey to be the year, month and day so that the data is partitioned - item.PartitionKey = item.CreateDate.ToString("yyyyMMdd"); - - // AI: Set the RowKey to be the reverse date and time so that the newest items are at the top when querying - var reverseDate = DateTimeOffset.MaxValue.Ticks - item.CreateDate.Ticks; - item.RowKey = - reverseDate.ToString("d19") + - StorageAzureDataTablesConstants.KEY_DELIMITER + - item.Key.ToString(); - } + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; } - catch (Exception ex) + var ei = context.Object as DomainCreateBeforeEvent; + if (ei == null) { - _logger.LogError(ex, ex.Message); - response.AddMessage(ResponseMessage.CreateError(LocalizationResource.ERROR_BUSINESS_RULE)); + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; } + // AI: Set the Key, PartitionKey, and RowKey + var item = ei.DomainObject; + item.Key = Guid.NewGuid(); + + // AI: Set the PartitionKey to be the year, month and day so that the data is partitioned + item.PartitionKey = item.CreateDate.ToString("yyyyMMdd"); + + // AI: Set the RowKey to be the reverse date and time so that the newest items are at the top when querying + var reverseDate = DateTimeOffset.MaxValue.Ticks - item.CreateDate.Ticks; + item.RowKey = + reverseDate.ToString("d19") + + StorageAzureDataTablesConstants.KEY_DELIMITER + + item.Key.ToString(); + return response; } } diff --git a/src/V1/ServiceBricks.Logging.AzureDataTables/Rule/WebRequestMessageQueryRule.cs b/src/V1/ServiceBricks.Logging.AzureDataTables/Rule/WebRequestMessageQueryRule.cs index 3a8ddee..01e9f70 100644 --- a/src/V1/ServiceBricks.Logging.AzureDataTables/Rule/WebRequestMessageQueryRule.cs +++ b/src/V1/ServiceBricks.Logging.AzureDataTables/Rule/WebRequestMessageQueryRule.cs @@ -1,5 +1,4 @@ -using Microsoft.Extensions.Logging; -using ServiceBricks.Storage.AzureDataTables; +using ServiceBricks.Storage.AzureDataTables; namespace ServiceBricks.Logging.AzureDataTables { @@ -8,15 +7,11 @@ namespace ServiceBricks.Logging.AzureDataTables /// public sealed class WebRequestMessageQueryRule : BusinessRule { - private readonly ILogger _logger; - /// /// Constructor. /// - /// - public WebRequestMessageQueryRule(ILoggerFactory loggerFactory) + public WebRequestMessageQueryRule() { - _logger = loggerFactory.CreateLogger(); Priority = PRIORITY_NORMAL; } @@ -51,54 +46,54 @@ public override IResponse ExecuteRule(IBusinessRuleContext context) { var response = new Response(); - try + // AI: Make sure the context object is the correct type + if (context == null || context.Object == null) { - // AI: Make sure the context object is the correct type - if (context.Object is DomainQueryBeforeEvent ei) - { - var item = ei.DomainObject; - if (ei.ServiceQueryRequest == null || ei.ServiceQueryRequest.Filters == null) - return response; + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } + var ei = context.Object as DomainQueryBeforeEvent; + if (ei == null) + { + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } - // AI: Iterate through the filters and modify the property name for StorageKey and change it to Key - foreach (var filter in ei.ServiceQueryRequest.Filters) + if (ei.ServiceQueryRequest == null || ei.ServiceQueryRequest.Filters == null) + return response; + + // AI: Iterate through the filters and modify the property name for StorageKey and change it to Key + foreach (var filter in ei.ServiceQueryRequest.Filters) + { + if (filter.Properties != null && + filter.Properties.Count > 0) + { + bool found = false; + for (int i = 0; i < filter.Properties.Count; i++) { - if (filter.Properties != null && - filter.Properties.Count > 0) + if (string.Compare(filter.Properties[i], "StorageKey", true) == 0) { - bool found = false; - for (int i = 0; i < filter.Properties.Count; i++) - { - if (string.Compare(filter.Properties[i], "StorageKey", true) == 0) - { - found = true; - filter.Properties[i] = "Key"; - } - } - if (found) + found = true; + filter.Properties[i] = "Key"; + } + } + if (found) + { + // AI: Iterate through the values. Split each one using the delimiter and re-set the value to use the second part. See LogMessageCreateRule for more information. + if (filter.Values != null && filter.Values.Count > 0) + { + for (int i = 0; i < filter.Values.Count; i++) { - // AI: Iterate through the values. Split each one using the delimiter and re-set the value to use the second part. See LogMessageCreateRule for more information. - if (filter.Values != null && filter.Values.Count > 0) + string[] split = filter.Values[i].Split(StorageAzureDataTablesConstants.KEY_DELIMITER); + if (split.Length == 2) { - for (int i = 0; i < filter.Values.Count; i++) - { - string[] split = filter.Values[i].Split(StorageAzureDataTablesConstants.KEY_DELIMITER); - if (split.Length == 2) - { - filter.Values[i] = split[1]; - } - } + filter.Values[i] = split[1]; } } } } } } - catch (Exception ex) - { - _logger.LogError(ex, ex.Message); - response.AddMessage(ResponseMessage.CreateError(LocalizationResource.ERROR_BUSINESS_RULE)); - } return response; } diff --git a/src/V1/ServiceBricks.Logging.AzureDataTables/ServiceBricks.Logging.AzureDataTables.csproj b/src/V1/ServiceBricks.Logging.AzureDataTables/ServiceBricks.Logging.AzureDataTables.csproj index 068cff8..d942bfc 100644 --- a/src/V1/ServiceBricks.Logging.AzureDataTables/ServiceBricks.Logging.AzureDataTables.csproj +++ b/src/V1/ServiceBricks.Logging.AzureDataTables/ServiceBricks.Logging.AzureDataTables.csproj @@ -1,7 +1,7 @@ - 1.1.0-g + 1.1.0-l The open source microservices platform. Visit https://ServiceBricks.com to learn more. ServiceBricks.Logging.AzureDataTables ServiceBricks.Logging.AzureDataTables @@ -33,7 +33,9 @@ - - + + + + diff --git a/src/V1/ServiceBricks.Logging.Cosmos.Debug/ServiceBricks.Logging.Cosmos.Debug.csproj b/src/V1/ServiceBricks.Logging.Cosmos.Debug/ServiceBricks.Logging.Cosmos.Debug.csproj index 698d376..93eb237 100644 --- a/src/V1/ServiceBricks.Logging.Cosmos.Debug/ServiceBricks.Logging.Cosmos.Debug.csproj +++ b/src/V1/ServiceBricks.Logging.Cosmos.Debug/ServiceBricks.Logging.Cosmos.Debug.csproj @@ -1,4 +1,4 @@ - + net6.0;net7.0;net8.0 @@ -9,13 +9,13 @@ - + @@ -28,7 +28,7 @@ - + diff --git a/src/V1/ServiceBricks.Logging.Cosmos/Extensions/ApplicationBuilderExtensions.cs b/src/V1/ServiceBricks.Logging.Cosmos/Extensions/ApplicationBuilderExtensions.cs deleted file mode 100644 index 364ca9d..0000000 --- a/src/V1/ServiceBricks.Logging.Cosmos/Extensions/ApplicationBuilderExtensions.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.Extensions.DependencyInjection; -using ServiceBricks.Logging.EntityFrameworkCore; - -namespace ServiceBricks.Logging.Cosmos -{ - /// - /// Extensions to start the ServiceBricks Logging Cosmos module. - /// - public static partial class ApplicationBuilderExtensions - { - /// - /// Flag to indicate if the module has been started. - /// - public static bool ModuleStarted = false; - - /// - /// Start the ServiceBricks Logging Cosmos module. - /// - /// - /// - public static IApplicationBuilder StartServiceBricksLoggingCosmos(this IApplicationBuilder applicationBuilder) - { - // AI: Ensure the database is created - using (var scope = applicationBuilder.ApplicationServices.GetRequiredService().CreateScope()) - { - var context = scope.ServiceProvider.GetRequiredService(); - context.Database.EnsureCreated(); - } - - // AI: Set the module started flag - ModuleStarted = true; - - // AI: Start the parent module. - applicationBuilder.StartServiceBricksLoggingEntityFrameworkCore(); - - return applicationBuilder; - } - } -} \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.Cosmos/Extensions/ServiceCollectionExtensions.cs b/src/V1/ServiceBricks.Logging.Cosmos/Extensions/ServiceCollectionExtensions.cs index 8c3c015..072b6c4 100644 --- a/src/V1/ServiceBricks.Logging.Cosmos/Extensions/ServiceCollectionExtensions.cs +++ b/src/V1/ServiceBricks.Logging.Cosmos/Extensions/ServiceCollectionExtensions.cs @@ -1,5 +1,4 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using ServiceBricks.Logging.EntityFrameworkCore; using ServiceBricks.Storage.EntityFrameworkCore; @@ -19,42 +18,16 @@ public static partial class ServiceCollectionExtensions /// public static IServiceCollection AddServiceBricksLoggingCosmos(this IServiceCollection services, IConfiguration configuration) { - // AI: Add the module to the ModuleRegistry - ModuleRegistry.Instance.RegisterItem(typeof(LoggingCosmosModule), new LoggingCosmosModule()); - // AI: Add the parent module services.AddServiceBricksLoggingEntityFrameworkCore(configuration); - // AI: Register the database for the module - var builder = new DbContextOptionsBuilder(); - string connectionString = configuration.GetCosmosConnectionString( - LoggingCosmosConstants.APPSETTING_CONNECTION_STRING); - string database = configuration.GetCosmosDatabase( - LoggingCosmosConstants.APPSETTING_DATABASE); - builder.UseCosmos(connectionString, database); - services.Configure>(o => { o = builder.Options; }); - services.AddSingleton>(builder.Options); - services.AddDbContext(c => { c = builder; }, ServiceLifetime.Scoped); - - // AI: Storage Services for the module for each domain object - services.AddScoped, LoggingStorageRepository>(); - services.AddScoped, LoggingStorageRepository>(); - - // AI: Add API services for the module. Each DTO should have two registrations, one for the generic IApiService<> and one for the named interface - services.AddScoped, LogMessageApiService>(); - services.AddScoped(); - - services.AddScoped, WebRequestMessageApiService>(); - services.AddScoped(); - - // AI: Register business rules for the module - DomainCreateDateRule.Register(BusinessRuleRegistry.Instance); - DomainQueryPropertyRenameRule.Register(BusinessRuleRegistry.Instance, "StorageKey", "Key"); - LogMessageCreateRule.Register(BusinessRuleRegistry.Instance); + // AI: Add the module to the ModuleRegistry + ModuleRegistry.Instance.Register(LoggingCosmosModule.Instance); - DomainCreateDateRule.Register(BusinessRuleRegistry.Instance); - DomainQueryPropertyRenameRule.Register(BusinessRuleRegistry.Instance, "StorageKey", "Key"); - WebRequestMessageCreateRule.Register(BusinessRuleRegistry.Instance); + // AI: Add module business rules + LoggingCosmosModuleAddRule.Register(BusinessRuleRegistry.Instance); + EntityFrameworkCoreDatabaseEnsureCreatedRule.Register(BusinessRuleRegistry.Instance); + ModuleSetStartedRule.Register(BusinessRuleRegistry.Instance); return services; } diff --git a/src/V1/ServiceBricks.Logging.Cosmos/Model/LoggingCosmosModule.cs b/src/V1/ServiceBricks.Logging.Cosmos/Model/LoggingCosmosModule.cs index 22df450..44b1447 100644 --- a/src/V1/ServiceBricks.Logging.Cosmos/Model/LoggingCosmosModule.cs +++ b/src/V1/ServiceBricks.Logging.Cosmos/Model/LoggingCosmosModule.cs @@ -6,8 +6,13 @@ namespace ServiceBricks.Logging.Cosmos /// /// Logging Cosmos Module. /// - public partial class LoggingCosmosModule : IModule + public partial class LoggingCosmosModule : ServiceBricks.Module { + /// + /// Instance + /// + public static LoggingCosmosModule Instance = new LoggingCosmosModule(); + /// /// Constructor. /// @@ -22,20 +27,5 @@ public LoggingCosmosModule() new LoggingEntityFrameworkCoreModule() }; } - - /// - /// The list of dependent modules. - /// - public List DependentModules { get; } - - /// - /// The list of assemblies that contain Automapper profiles. - /// - public List AutomapperAssemblies { get; } - - /// - /// The list of view assemblies. - /// - public List ViewAssemblies { get; } } } \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.Cosmos/Rule/LogMessageCreateRule.cs b/src/V1/ServiceBricks.Logging.Cosmos/Rule/LogMessageCreateRule.cs index 054fc42..c54a735 100644 --- a/src/V1/ServiceBricks.Logging.Cosmos/Rule/LogMessageCreateRule.cs +++ b/src/V1/ServiceBricks.Logging.Cosmos/Rule/LogMessageCreateRule.cs @@ -1,22 +1,15 @@ -using Microsoft.Extensions.Logging; -using ServiceBricks.Storage.EntityFrameworkCore; - -namespace ServiceBricks.Logging.Cosmos +namespace ServiceBricks.Logging.Cosmos { /// /// This is a business rule for creating a LogMessage domain object. It will set the Key and PartitionKey. /// public sealed class LogMessageCreateRule : BusinessRule { - private readonly ILogger _logger; - /// /// Constructor. /// - /// - public LogMessageCreateRule(ILoggerFactory loggerFactory) + public LogMessageCreateRule() { - _logger = loggerFactory.CreateLogger(); Priority = PRIORITY_LOW; } @@ -51,37 +44,27 @@ public override IResponse ExecuteRule(IBusinessRuleContext context) { var response = new Response(); - try + // AI: Make sure the context object is the correct type + if (context == null || context.Object == null) { - // AI: Make sure the context object is the correct type - if (context.Object is DomainCreateBeforeEvent e) - { - // AI: Set the Key and PartitionKey - var item = e.DomainObject; - item.Key = Guid.NewGuid(); - - // AI: Set the PartitionKey to be the year, month and day so that the data is partitioned - item.PartitionKey = item.CreateDate.ToString("yyyyMMdd"); - } + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; } - catch (Exception ex) + var e = context.Object as DomainCreateBeforeEvent; + if (e == null) { - _logger.LogError(ex, ex.Message); - response.AddMessage(ResponseMessage.CreateError(LocalizationResource.ERROR_BUSINESS_RULE)); + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; } - return response; - } + // AI: Set the Key and PartitionKey + var item = e.DomainObject; + item.Key = Guid.NewGuid(); - /// - /// Execute the business rule. - /// - /// - /// - public override Task ExecuteRuleAsync(IBusinessRuleContext context) - { - // AI: There is no async work, so just call the sync method - return Task.FromResult(ExecuteRule(context)); + // AI: Set the PartitionKey to be the year, month and day so that the data is partitioned + item.PartitionKey = item.CreateDate.ToString("yyyyMMdd"); + + return response; } } } \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.Cosmos/Rule/LoggingCosmosModuleAddRule.cs b/src/V1/ServiceBricks.Logging.Cosmos/Rule/LoggingCosmosModuleAddRule.cs new file mode 100644 index 0000000..101fc7a --- /dev/null +++ b/src/V1/ServiceBricks.Logging.Cosmos/Rule/LoggingCosmosModuleAddRule.cs @@ -0,0 +1,92 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using ServiceBricks.Storage.EntityFrameworkCore; + +namespace ServiceBricks.Logging.Cosmos +{ + /// + /// This rule is executed when the ServiceBricks module is added. + /// + public sealed class LoggingCosmosModuleAddRule : BusinessRule + { + /// + /// Register the rule + /// + public static void Register(IBusinessRuleRegistry registry) + { + registry.Register( + typeof(ModuleAddEvent), + typeof(LoggingCosmosModuleAddRule)); + } + + /// + /// UnRegister the rule. + /// + public static void UnRegister(IBusinessRuleRegistry registry) + { + registry.UnRegister( + typeof(ModuleAddEvent), + typeof(LoggingCosmosModuleAddRule)); + } + + /// + /// Execute the business rule. + /// + /// + /// + public override IResponse ExecuteRule(IBusinessRuleContext context) + { + var response = new Response(); + + // AI: Make sure the context object is the correct type + if (context == null || context.Object == null) + { + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } + var e = context.Object as ModuleAddEvent; + if (e == null || e.DomainObject == null || e.ServiceCollection == null) + { + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } + + // AI: Perform logic + var services = e.ServiceCollection; + var configuration = e.Configuration; + + // AI: Register the database for the module + var builder = new DbContextOptionsBuilder(); + string connectionString = configuration.GetCosmosConnectionString( + LoggingCosmosConstants.APPSETTING_CONNECTION_STRING); + string database = configuration.GetCosmosDatabase( + LoggingCosmosConstants.APPSETTING_DATABASE); + builder.UseCosmos(connectionString, database); + services.Configure>(o => { o = builder.Options; }); + services.AddSingleton>(builder.Options); + services.AddDbContext(c => { c = builder; }, ServiceLifetime.Scoped); + + // AI: Storage Services for the module for each domain object + services.AddScoped, LoggingStorageRepository>(); + services.AddScoped, LoggingStorageRepository>(); + + // AI: Add API services for the module. Each DTO should have two registrations, one for the generic IApiService<> and one for the named interface + services.AddScoped, LogMessageApiService>(); + services.AddScoped(); + + services.AddScoped, WebRequestMessageApiService>(); + services.AddScoped(); + + // AI: Register business rules for the module + DomainCreateDateRule.Register(BusinessRuleRegistry.Instance); + DomainQueryPropertyRenameRule.Register(BusinessRuleRegistry.Instance, "StorageKey", "Key"); + LogMessageCreateRule.Register(BusinessRuleRegistry.Instance); + + DomainCreateDateRule.Register(BusinessRuleRegistry.Instance); + DomainQueryPropertyRenameRule.Register(BusinessRuleRegistry.Instance, "StorageKey", "Key"); + WebRequestMessageCreateRule.Register(BusinessRuleRegistry.Instance); + + return response; + } + } +} \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.Cosmos/Rule/WebRequestMessageCreateRule.cs b/src/V1/ServiceBricks.Logging.Cosmos/Rule/WebRequestMessageCreateRule.cs index 5e3cfb6..1cf26a2 100644 --- a/src/V1/ServiceBricks.Logging.Cosmos/Rule/WebRequestMessageCreateRule.cs +++ b/src/V1/ServiceBricks.Logging.Cosmos/Rule/WebRequestMessageCreateRule.cs @@ -1,22 +1,15 @@ -using Microsoft.Extensions.Logging; -using ServiceBricks.Storage.EntityFrameworkCore; - -namespace ServiceBricks.Logging.Cosmos +namespace ServiceBricks.Logging.Cosmos { /// /// This is a business rule for creating a WebRequestMessage domain object. It will set the Key and PartitionKey. /// public sealed class WebRequestMessageCreateRule : BusinessRule { - private readonly ILogger _logger; - /// /// Constructor. /// - /// - public WebRequestMessageCreateRule(ILoggerFactory loggerFactory) + public WebRequestMessageCreateRule() { - _logger = loggerFactory.CreateLogger(); Priority = PRIORITY_LOW; } @@ -51,37 +44,27 @@ public override IResponse ExecuteRule(IBusinessRuleContext context) { var response = new Response(); - try + // AI: Make sure the context object is the correct type + if (context == null || context.Object == null) { - // AI: Make sure the context object is the correct type - if (context.Object is DomainCreateBeforeEvent e) - { - // AI: Set the Key and PartitionKey - var item = e.DomainObject; - item.Key = Guid.NewGuid(); - - // AI: Set the PartitionKey to be the year, month and day so that the data is partitioned - item.PartitionKey = item.CreateDate.ToString("yyyyMMdd"); - } + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; } - catch (Exception ex) + var e = context.Object as DomainCreateBeforeEvent; + if (e == null) { - _logger.LogError(ex, ex.Message); - response.AddMessage(ResponseMessage.CreateError(LocalizationResource.ERROR_BUSINESS_RULE)); + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; } - return response; - } + // AI: Set the Key and PartitionKey + var item = e.DomainObject; + item.Key = Guid.NewGuid(); - /// - /// Execute the business rule. - /// - /// - /// - public override Task ExecuteRuleAsync(IBusinessRuleContext context) - { - // AI: There is no async work, so just call the sync method - return Task.FromResult(ExecuteRule(context)); + // AI: Set the PartitionKey to be the year, month and day so that the data is partitioned + item.PartitionKey = item.CreateDate.ToString("yyyyMMdd"); + + return response; } } } \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.Cosmos/ServiceBricks.Logging.Cosmos.csproj b/src/V1/ServiceBricks.Logging.Cosmos/ServiceBricks.Logging.Cosmos.csproj index 685ce2f..c80b6a8 100644 --- a/src/V1/ServiceBricks.Logging.Cosmos/ServiceBricks.Logging.Cosmos.csproj +++ b/src/V1/ServiceBricks.Logging.Cosmos/ServiceBricks.Logging.Cosmos.csproj @@ -1,7 +1,7 @@ - 1.1.0-g + 1.1.0-l The open source microservices platform. Visit https://ServiceBricks.com to learn more. ServiceBricks.Logging.Cosmos ServiceBricks.Logging.Cosmos @@ -33,11 +33,11 @@ - + - + diff --git a/src/V1/ServiceBricks.Logging.Debug/ServiceBricks.Logging.Debug.csproj b/src/V1/ServiceBricks.Logging.Debug/ServiceBricks.Logging.Debug.csproj index eb88e1a..5372b06 100644 --- a/src/V1/ServiceBricks.Logging.Debug/ServiceBricks.Logging.Debug.csproj +++ b/src/V1/ServiceBricks.Logging.Debug/ServiceBricks.Logging.Debug.csproj @@ -11,9 +11,8 @@ - - - + + @@ -32,12 +31,13 @@ - - + + + - + diff --git a/src/V1/ServiceBricks.Logging.EntityFrameworkCore.Debug/ServiceBricks.Logging.EntityFrameworkCore.Debug.csproj b/src/V1/ServiceBricks.Logging.EntityFrameworkCore.Debug/ServiceBricks.Logging.EntityFrameworkCore.Debug.csproj index 36a97ea..5ac4fad 100644 --- a/src/V1/ServiceBricks.Logging.EntityFrameworkCore.Debug/ServiceBricks.Logging.EntityFrameworkCore.Debug.csproj +++ b/src/V1/ServiceBricks.Logging.EntityFrameworkCore.Debug/ServiceBricks.Logging.EntityFrameworkCore.Debug.csproj @@ -1,4 +1,4 @@ - + net6.0;net7.0;net8.0 @@ -9,12 +9,12 @@ - + @@ -23,7 +23,7 @@ - + diff --git a/src/V1/ServiceBricks.Logging.EntityFrameworkCore/Extensions/ApplicationBuilderExtensions.cs b/src/V1/ServiceBricks.Logging.EntityFrameworkCore/Extensions/ApplicationBuilderExtensions.cs deleted file mode 100644 index 6ff3fb4..0000000 --- a/src/V1/ServiceBricks.Logging.EntityFrameworkCore/Extensions/ApplicationBuilderExtensions.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Microsoft.AspNetCore.Builder; - -namespace ServiceBricks.Logging.EntityFrameworkCore -{ - /// - /// Extensions to start the ServiceBricks Logging EntityFrameworkCore module. - /// - public static partial class ApplicationBuilderExtensions - { - /// - /// Flag to determine if the module has started. - /// - public static bool ModuleStarted = false; - - /// - /// Start the ServiceBricks Logging EntityFrameworkCore module. - /// - /// - /// - public static IApplicationBuilder StartServiceBricksLoggingEntityFrameworkCore(this IApplicationBuilder applicationBuilder) - { - // AI: Set the module started flag when complete - ModuleStarted = true; - - // AI: Start the parent module - applicationBuilder.StartServiceBricksLogging(); - - return applicationBuilder; - } - } -} \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.EntityFrameworkCore/Extensions/ServiceCollectionExtensions.cs b/src/V1/ServiceBricks.Logging.EntityFrameworkCore/Extensions/ServiceCollectionExtensions.cs index 8c42aba..2794a82 100644 --- a/src/V1/ServiceBricks.Logging.EntityFrameworkCore/Extensions/ServiceCollectionExtensions.cs +++ b/src/V1/ServiceBricks.Logging.EntityFrameworkCore/Extensions/ServiceCollectionExtensions.cs @@ -16,25 +16,15 @@ public static partial class ServiceCollectionExtensions /// public static IServiceCollection AddServiceBricksLoggingEntityFrameworkCore(this IServiceCollection services, IConfiguration configuration) { - // AI: Add the module to the ModuleRegistry - ModuleRegistry.Instance.RegisterItem(typeof(LoggingEntityFrameworkCoreModule), new LoggingEntityFrameworkCoreModule()); - // AI: Add the parent module services.AddServiceBricksLogging(configuration); - // AI: Add API services for the module. Each DTO should have two registrations, one for the generic IApiService<> and one for the named interface - services.AddScoped, LogMessageApiService>(); - services.AddScoped(); - - services.AddScoped, WebRequestMessageApiService>(); - services.AddScoped(); - - // AI: Register business rules for the module - DomainCreateDateRule.Register(BusinessRuleRegistry.Instance); - DomainQueryPropertyRenameRule.Register(BusinessRuleRegistry.Instance, "StorageKey", "Key"); + // AI: Add the module to the ModuleRegistry + ModuleRegistry.Instance.Register(LoggingEntityFrameworkCoreModule.Instance); - DomainCreateDateRule.Register(BusinessRuleRegistry.Instance); - DomainQueryPropertyRenameRule.Register(BusinessRuleRegistry.Instance, "StorageKey", "Key"); + // AI: Add module business rules + LoggingEntityFrameworkCoreModuleAddRule.Register(BusinessRuleRegistry.Instance); + ModuleSetStartedRule.Register(BusinessRuleRegistry.Instance); return services; } diff --git a/src/V1/ServiceBricks.Logging.EntityFrameworkCore/Model/LoggingEntityFrameworkCoreModule.cs b/src/V1/ServiceBricks.Logging.EntityFrameworkCore/Model/LoggingEntityFrameworkCoreModule.cs index e9befd2..79cf96a 100644 --- a/src/V1/ServiceBricks.Logging.EntityFrameworkCore/Model/LoggingEntityFrameworkCoreModule.cs +++ b/src/V1/ServiceBricks.Logging.EntityFrameworkCore/Model/LoggingEntityFrameworkCoreModule.cs @@ -5,8 +5,10 @@ namespace ServiceBricks.Logging.EntityFrameworkCore /// /// The module definition for the ServiceBricks Logging EntityFrameworkCore module. /// - public partial class LoggingEntityFrameworkCoreModule : IModule + public partial class LoggingEntityFrameworkCoreModule : ServiceBricks.Module { + public static LoggingEntityFrameworkCoreModule Instance = new LoggingEntityFrameworkCoreModule(); + /// /// Constructor for the ServiceBricks Logging EntityFrameworkCore module. /// @@ -21,20 +23,5 @@ public LoggingEntityFrameworkCoreModule() new LoggingModule() }; } - - /// - /// The list of dependent modules for the ServiceBricks Logging EntityFrameworkCore module. - /// - public List DependentModules { get; } - - /// - /// The list of Automapper assemblies for the ServiceBricks Logging EntityFrameworkCore module. - /// - public List AutomapperAssemblies { get; } - - /// - /// The list of view assemblies for the ServiceBricks Logging EntityFrameworkCore module. - /// - public List ViewAssemblies { get; } } } \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.EntityFrameworkCore/Rule/LoggingEntityFrameworkCoreModuleAddRule.cs b/src/V1/ServiceBricks.Logging.EntityFrameworkCore/Rule/LoggingEntityFrameworkCoreModuleAddRule.cs new file mode 100644 index 0000000..cd9cf56 --- /dev/null +++ b/src/V1/ServiceBricks.Logging.EntityFrameworkCore/Rule/LoggingEntityFrameworkCoreModuleAddRule.cs @@ -0,0 +1,74 @@ +using Microsoft.Extensions.DependencyInjection; + +namespace ServiceBricks.Logging.EntityFrameworkCore +{ + /// + /// This rule is executed when the ServiceBricks module is added. + /// + public sealed class LoggingEntityFrameworkCoreModuleAddRule : BusinessRule + { + /// + /// Register the rule + /// + public static void Register(IBusinessRuleRegistry registry) + { + registry.Register( + typeof(ModuleAddEvent), + typeof(LoggingEntityFrameworkCoreModuleAddRule)); + } + + /// + /// UnRegister the rule. + /// + public static void UnRegister(IBusinessRuleRegistry registry) + { + registry.UnRegister( + typeof(ModuleAddEvent), + typeof(LoggingEntityFrameworkCoreModuleAddRule)); + } + + /// + /// Execute the business rule. + /// + /// + /// + public override IResponse ExecuteRule(IBusinessRuleContext context) + { + var response = new Response(); + + // AI: Make sure the context object is the correct type + if (context == null || context.Object == null) + { + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } + var e = context.Object as ModuleAddEvent; + if (e == null || e.DomainObject == null || e.ServiceCollection == null) + { + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } + + // AI: Perform logic + var services = e.ServiceCollection; + //var configuration = e.Configuration; + + // AI: Configure all options for the module + // AI: Add API services for the module. Each DTO should have two registrations, one for the generic IApiService<> and one for the named interface + services.AddScoped, LogMessageApiService>(); + services.AddScoped(); + + services.AddScoped, WebRequestMessageApiService>(); + services.AddScoped(); + + // AI: Register business rules for the module + DomainCreateDateRule.Register(BusinessRuleRegistry.Instance); + DomainQueryPropertyRenameRule.Register(BusinessRuleRegistry.Instance, "StorageKey", "Key"); + + DomainCreateDateRule.Register(BusinessRuleRegistry.Instance); + DomainQueryPropertyRenameRule.Register(BusinessRuleRegistry.Instance, "StorageKey", "Key"); + + return response; + } + } +} \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.EntityFrameworkCore/ServiceBricks.Logging.EntityFrameworkCore.csproj b/src/V1/ServiceBricks.Logging.EntityFrameworkCore/ServiceBricks.Logging.EntityFrameworkCore.csproj index 518b17e..619b2d5 100644 --- a/src/V1/ServiceBricks.Logging.EntityFrameworkCore/ServiceBricks.Logging.EntityFrameworkCore.csproj +++ b/src/V1/ServiceBricks.Logging.EntityFrameworkCore/ServiceBricks.Logging.EntityFrameworkCore.csproj @@ -1,7 +1,7 @@ - 1.1.0-g + 1.1.0-l The open source microservices platform. Visit https://ServiceBricks.com to learn more. ServiceBricks.Logging.EntityFrameworkCore ServiceBricks.Logging.EntityFrameworkCore @@ -34,11 +34,11 @@ - + - + diff --git a/src/V1/ServiceBricks.Logging.InMemory.Debug/ServiceBricks.Logging.InMemory.Debug.csproj b/src/V1/ServiceBricks.Logging.InMemory.Debug/ServiceBricks.Logging.InMemory.Debug.csproj index 0abcef9..e0be5da 100644 --- a/src/V1/ServiceBricks.Logging.InMemory.Debug/ServiceBricks.Logging.InMemory.Debug.csproj +++ b/src/V1/ServiceBricks.Logging.InMemory.Debug/ServiceBricks.Logging.InMemory.Debug.csproj @@ -1,4 +1,4 @@ - + net6.0;net7.0;net8.0 @@ -7,10 +7,10 @@ - + @@ -19,7 +19,7 @@ - + diff --git a/src/V1/ServiceBricks.Logging.InMemory/Extensions/ApplicationBuilderExtensions.cs b/src/V1/ServiceBricks.Logging.InMemory/Extensions/ApplicationBuilderExtensions.cs deleted file mode 100644 index 17add13..0000000 --- a/src/V1/ServiceBricks.Logging.InMemory/Extensions/ApplicationBuilderExtensions.cs +++ /dev/null @@ -1,32 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using ServiceBricks.Logging.EntityFrameworkCore; - -namespace ServiceBricks.Logging.InMemory -{ - /// - /// Extensions to start the ServiceBricks Logging InMemory Module - /// - public static partial class ApplicationBuilderExtensions - { - /// - /// Flag to check if the module has been started - /// - public static bool ModuleStarted = false; - - /// - /// Start the ServiceBricks Logging InMemory Module - /// - /// - /// - public static IApplicationBuilder StartServiceBricksLoggingInMemory(this IApplicationBuilder applicationBuilder) - { - // AI: Flag the module as started - ModuleStarted = true; - - // AI: Start the parent module - applicationBuilder.StartServiceBricksLoggingEntityFrameworkCore(); - - return applicationBuilder; - } - } -} \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.InMemory/Extensions/ServiceCollectionExtensions.cs b/src/V1/ServiceBricks.Logging.InMemory/Extensions/ServiceCollectionExtensions.cs index 2fcf9d0..5544171 100644 --- a/src/V1/ServiceBricks.Logging.InMemory/Extensions/ServiceCollectionExtensions.cs +++ b/src/V1/ServiceBricks.Logging.InMemory/Extensions/ServiceCollectionExtensions.cs @@ -1,5 +1,4 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using ServiceBricks.Logging.EntityFrameworkCore; @@ -18,22 +17,15 @@ public static partial class ServiceCollectionExtensions /// public static IServiceCollection AddServiceBricksLoggingInMemory(this IServiceCollection services, IConfiguration configuration) { - // AI: Add the module to the ModuleRegistry - ModuleRegistry.Instance.RegisterItem(typeof(LoggingInMemoryModule), new LoggingInMemoryModule()); - // AI: Add the parent module services.AddServiceBricksLoggingEntityFrameworkCore(configuration); - // AI: Register the database for the module - var builder = new DbContextOptionsBuilder(); - builder.UseInMemoryDatabase(Guid.NewGuid().ToString()); - services.Configure>(o => { o = builder.Options; }); - services.AddSingleton>(builder.Options); - services.AddDbContext(c => { c = builder; }, ServiceLifetime.Scoped); + // AI: Add the module to the ModuleRegistry + ModuleRegistry.Instance.Register(LoggingInMemoryModule.Instance); - // AI: Add the storage services for the module for each domain object - services.AddScoped, LoggingStorageRepository>(); - services.AddScoped, LoggingStorageRepository>(); + // AI: Add module business rules + LoggingInMemoryModuleAddRule.Register(BusinessRuleRegistry.Instance); + ModuleSetStartedRule.Register(BusinessRuleRegistry.Instance); return services; } diff --git a/src/V1/ServiceBricks.Logging.InMemory/Model/LoggingInMemoryModule.cs b/src/V1/ServiceBricks.Logging.InMemory/Model/LoggingInMemoryModule.cs index 31c43a1..2870e38 100644 --- a/src/V1/ServiceBricks.Logging.InMemory/Model/LoggingInMemoryModule.cs +++ b/src/V1/ServiceBricks.Logging.InMemory/Model/LoggingInMemoryModule.cs @@ -1,13 +1,17 @@ using ServiceBricks.Logging.EntityFrameworkCore; -using System.Reflection; namespace ServiceBricks.Logging.InMemory { /// /// The module definition for the Logging InMemory module. /// - public partial class LoggingInMemoryModule : IModule + public partial class LoggingInMemoryModule : ServiceBricks.Module { + /// + /// Instance + /// + public static LoggingInMemoryModule Instance = new LoggingInMemoryModule(); + /// /// Constructor. /// @@ -18,20 +22,5 @@ public LoggingInMemoryModule() new LoggingEntityFrameworkCoreModule() }; } - - /// - /// The list of dependent modules. - /// - public List DependentModules { get; } - - /// - /// The list of Automapper assemblies. - /// - public List AutomapperAssemblies { get; } - - /// - /// The list of View assemblies. - /// - public List ViewAssemblies { get; } } } \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.InMemory/Rule/LoggingInMemoryModuleAddRule.cs b/src/V1/ServiceBricks.Logging.InMemory/Rule/LoggingInMemoryModuleAddRule.cs new file mode 100644 index 0000000..784ad00 --- /dev/null +++ b/src/V1/ServiceBricks.Logging.InMemory/Rule/LoggingInMemoryModuleAddRule.cs @@ -0,0 +1,72 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using ServiceBricks.Logging.EntityFrameworkCore; + +namespace ServiceBricks.Logging.InMemory +{ + /// + /// This rule is executed when the ServiceBricks module is added. + /// + public sealed class LoggingInMemoryModuleAddRule : BusinessRule + { + /// + /// Register the rule + /// + public static void Register(IBusinessRuleRegistry registry) + { + registry.Register( + typeof(ModuleAddEvent), + typeof(LoggingInMemoryModuleAddRule)); + } + + /// + /// UnRegister the rule. + /// + public static void UnRegister(IBusinessRuleRegistry registry) + { + registry.UnRegister( + typeof(ModuleAddEvent), + typeof(LoggingInMemoryModuleAddRule)); + } + + /// + /// Execute the business rule. + /// + /// + /// + public override IResponse ExecuteRule(IBusinessRuleContext context) + { + var response = new Response(); + + // AI: Make sure the context object is the correct type + if (context == null || context.Object == null) + { + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } + var e = context.Object as ModuleAddEvent; + if (e == null || e.DomainObject == null || e.ServiceCollection == null) + { + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } + + // AI: Perform logic + var services = e.ServiceCollection; + var configuration = e.Configuration; + + // AI: Register the database for the module + var builder = new DbContextOptionsBuilder(); + builder.UseInMemoryDatabase(Guid.NewGuid().ToString()); + services.Configure>(o => { o = builder.Options; }); + services.AddSingleton>(builder.Options); + services.AddDbContext(c => { c = builder; }, ServiceLifetime.Scoped); + + // AI: Add the storage services for the module for each domain object + services.AddScoped, LoggingStorageRepository>(); + services.AddScoped, LoggingStorageRepository>(); + + return response; + } + } +} \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.InMemory/ServiceBricks.Logging.InMemory.csproj b/src/V1/ServiceBricks.Logging.InMemory/ServiceBricks.Logging.InMemory.csproj index 7f7fec5..b5c6a4b 100644 --- a/src/V1/ServiceBricks.Logging.InMemory/ServiceBricks.Logging.InMemory.csproj +++ b/src/V1/ServiceBricks.Logging.InMemory/ServiceBricks.Logging.InMemory.csproj @@ -1,7 +1,7 @@ - 1.1.0-g + 1.1.0-l The open source microservices platform. Visit https://ServiceBricks.com to learn more. ServiceBricks.Logging.InMemory ServiceBricks.Logging.InMemory @@ -34,11 +34,11 @@ - + - + diff --git a/src/V1/ServiceBricks.Logging.MongoDb.Debug/ServiceBricks.Logging.MongoDb.Debug.csproj b/src/V1/ServiceBricks.Logging.MongoDb.Debug/ServiceBricks.Logging.MongoDb.Debug.csproj index 10599f3..9d9437b 100644 --- a/src/V1/ServiceBricks.Logging.MongoDb.Debug/ServiceBricks.Logging.MongoDb.Debug.csproj +++ b/src/V1/ServiceBricks.Logging.MongoDb.Debug/ServiceBricks.Logging.MongoDb.Debug.csproj @@ -1,4 +1,4 @@ - + net6.0;net7.0;net8.0 @@ -9,21 +9,21 @@ - + - + - + diff --git a/src/V1/ServiceBricks.Logging.MongoDb/Extensions/ApplicationBuilderExtensions.cs b/src/V1/ServiceBricks.Logging.MongoDb/Extensions/ApplicationBuilderExtensions.cs deleted file mode 100644 index b94dec8..0000000 --- a/src/V1/ServiceBricks.Logging.MongoDb/Extensions/ApplicationBuilderExtensions.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Microsoft.AspNetCore.Builder; - -namespace ServiceBricks.Logging.MongoDb -{ - /// - /// Extensions to start the ServiceBricks Logging MongoDb module. - /// - public static partial class ApplicationBuilderExtensions - { - /// - /// Indicates if the module has been started. - /// - public static bool ModuleStarted = false; - - /// - /// Start the ServiceBricks Logging MongoDb module. - /// - /// - /// - public static IApplicationBuilder StartServiceBricksLoggingMongoDb(this IApplicationBuilder applicationBuilder) - { - // AI: Flag the module as started - ModuleStarted = true; - - // AI: Start the parent module - applicationBuilder.StartServiceBricksLogging(); - - return applicationBuilder; - } - } -} \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.MongoDb/Extensions/ServiceCollectionExtensions.cs b/src/V1/ServiceBricks.Logging.MongoDb/Extensions/ServiceCollectionExtensions.cs index 4efb846..c470ba4 100644 --- a/src/V1/ServiceBricks.Logging.MongoDb/Extensions/ServiceCollectionExtensions.cs +++ b/src/V1/ServiceBricks.Logging.MongoDb/Extensions/ServiceCollectionExtensions.cs @@ -16,29 +16,15 @@ public static partial class ServiceCollectionExtensions /// public static IServiceCollection AddServiceBricksLoggingMongoDb(this IServiceCollection services, IConfiguration configuration) { - // AI: Add the module to the ModuleRegistry - ModuleRegistry.Instance.RegisterItem(typeof(LoggingMongoDbModule), new LoggingMongoDbModule()); - // AI: Add the parent module services.AddServiceBricksLogging(configuration); - // AI: Add the storage services for the module for each domain object - services.AddScoped, LoggingStorageRepository>(); - services.AddScoped, LoggingStorageRepository>(); - - // AI: Add API services for the module. Each DTO should have two registrations, one for the generic IApiService<> and one for the named interface - services.AddScoped, LogMessageApiService>(); - services.AddScoped(); - - services.AddScoped, WebRequestMessageApiService>(); - services.AddScoped(); - - // AI: Add business rules for the module - DomainCreateDateRule.Register(BusinessRuleRegistry.Instance); - DomainQueryPropertyRenameRule.Register(BusinessRuleRegistry.Instance, "StorageKey", "Key"); + // AI: Add the module to the ModuleRegistry + ModuleRegistry.Instance.Register(LoggingMongoDbModule.Instance); - DomainCreateDateRule.Register(BusinessRuleRegistry.Instance); - DomainQueryPropertyRenameRule.Register(BusinessRuleRegistry.Instance, "StorageKey", "Key"); + // AI: Add module business rules + LoggingMongoDbModuleAddRule.Register(BusinessRuleRegistry.Instance); + ModuleSetStartedRule.Register(BusinessRuleRegistry.Instance); return services; } diff --git a/src/V1/ServiceBricks.Logging.MongoDb/Model/LoggingMongoDbModule.cs b/src/V1/ServiceBricks.Logging.MongoDb/Model/LoggingMongoDbModule.cs index 24a5beb..67b5710 100644 --- a/src/V1/ServiceBricks.Logging.MongoDb/Model/LoggingMongoDbModule.cs +++ b/src/V1/ServiceBricks.Logging.MongoDb/Model/LoggingMongoDbModule.cs @@ -5,8 +5,13 @@ namespace ServiceBricks.Logging.MongoDb /// /// This is the logging MongoDb module. /// - public partial class LoggingMongoDbModule : IModule + public partial class LoggingMongoDbModule : ServiceBricks.Module { + /// + /// Instance. + /// + public static LoggingMongoDbModule Instance = new LoggingMongoDbModule(); + /// /// Constructor /// @@ -21,20 +26,5 @@ public LoggingMongoDbModule() new LoggingModule() }; } - - /// - /// The list of dependent modules. - /// - public List DependentModules { get; } - - /// - /// The list of automapper assemblies. - /// - public List AutomapperAssemblies { get; } - - /// - /// The list of view assemblies. - /// - public List ViewAssemblies { get; } } } \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.MongoDb/Rule/LoggingMongoDbModuleAddRule.cs b/src/V1/ServiceBricks.Logging.MongoDb/Rule/LoggingMongoDbModuleAddRule.cs new file mode 100644 index 0000000..1be8be8 --- /dev/null +++ b/src/V1/ServiceBricks.Logging.MongoDb/Rule/LoggingMongoDbModuleAddRule.cs @@ -0,0 +1,77 @@ +using Microsoft.Extensions.DependencyInjection; + +namespace ServiceBricks.Logging.MongoDb +{ + /// + /// This rule is executed when the ServiceBricks module is added. + /// + public sealed class LoggingMongoDbModuleAddRule : BusinessRule + { + /// + /// Register the rule + /// + public static void Register(IBusinessRuleRegistry registry) + { + registry.Register( + typeof(ModuleAddEvent), + typeof(LoggingMongoDbModuleAddRule)); + } + + /// + /// UnRegister the rule. + /// + public static void UnRegister(IBusinessRuleRegistry registry) + { + registry.UnRegister( + typeof(ModuleAddEvent), + typeof(LoggingMongoDbModuleAddRule)); + } + + /// + /// Execute the business rule. + /// + /// + /// + public override IResponse ExecuteRule(IBusinessRuleContext context) + { + var response = new Response(); + + // AI: Make sure the context object is the correct type + if (context == null || context.Object == null) + { + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } + var e = context.Object as ModuleAddEvent; + if (e == null || e.DomainObject == null || e.ServiceCollection == null) + { + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } + + // AI: Perform logic + var services = e.ServiceCollection; + //var configuration = e.Configuration; + + // AI: Add the storage services for the module for each domain object + services.AddScoped, LoggingStorageRepository>(); + services.AddScoped, LoggingStorageRepository>(); + + // AI: Add API services for the module. Each DTO should have two registrations, one for the generic IApiService<> and one for the named interface + services.AddScoped, LogMessageApiService>(); + services.AddScoped(); + + services.AddScoped, WebRequestMessageApiService>(); + services.AddScoped(); + + // AI: Add business rules for the module + DomainCreateDateRule.Register(BusinessRuleRegistry.Instance); + DomainQueryPropertyRenameRule.Register(BusinessRuleRegistry.Instance, "StorageKey", "Key"); + + DomainCreateDateRule.Register(BusinessRuleRegistry.Instance); + DomainQueryPropertyRenameRule.Register(BusinessRuleRegistry.Instance, "StorageKey", "Key"); + + return response; + } + } +} \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.MongoDb/ServiceBricks.Logging.MongoDb.csproj b/src/V1/ServiceBricks.Logging.MongoDb/ServiceBricks.Logging.MongoDb.csproj index 3fbdd2f..3e9d315 100644 --- a/src/V1/ServiceBricks.Logging.MongoDb/ServiceBricks.Logging.MongoDb.csproj +++ b/src/V1/ServiceBricks.Logging.MongoDb/ServiceBricks.Logging.MongoDb.csproj @@ -1,7 +1,7 @@ - 1.1.0-g + 1.1.0-l The open source microservices platform. Visit https://ServiceBricks.com to learn more. ServiceBricks.Logging.MongoDb ServiceBricks.Logging.MongoDb @@ -32,8 +32,10 @@ \ + + + - - + diff --git a/src/V1/ServiceBricks.Logging.Postgres.Debug/ServiceBricks.Logging.Postgres.Debug.csproj b/src/V1/ServiceBricks.Logging.Postgres.Debug/ServiceBricks.Logging.Postgres.Debug.csproj index 9dd9e3b..6ccdb83 100644 --- a/src/V1/ServiceBricks.Logging.Postgres.Debug/ServiceBricks.Logging.Postgres.Debug.csproj +++ b/src/V1/ServiceBricks.Logging.Postgres.Debug/ServiceBricks.Logging.Postgres.Debug.csproj @@ -7,7 +7,6 @@ - @@ -15,6 +14,7 @@ + @@ -24,6 +24,6 @@ - + diff --git a/src/V1/ServiceBricks.Logging.Postgres/Extensions/ApplicationBuilderExtensions.cs b/src/V1/ServiceBricks.Logging.Postgres/Extensions/ApplicationBuilderExtensions.cs deleted file mode 100644 index 9faf4c9..0000000 --- a/src/V1/ServiceBricks.Logging.Postgres/Extensions/ApplicationBuilderExtensions.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.DependencyInjection; -using ServiceBricks.Logging.EntityFrameworkCore; - -namespace ServiceBricks.Logging.Postgres -{ - /// - /// Extensions to start the ServiceBricks Logging Postgres module. - /// - public static partial class ApplicationBuilderExtensions - { - /// - /// Flag to check if the module has been started. - /// - public static bool ModuleStarted = false; - - /// - /// Start the ServiceBricks Logging Postgres module. - /// - /// - /// - public static IApplicationBuilder StartServiceBricksLoggingPostgres(this IApplicationBuilder applicationBuilder) - { - // AI: Migrate the database - using (var serviceScope = applicationBuilder.ApplicationServices.GetRequiredService().CreateScope()) - { - var context = serviceScope.ServiceProvider.GetService(); - context.Database.Migrate(); - context.SaveChanges(); - } - - // AI: Flag the module as started - ModuleStarted = true; - - // AI: Start parent module - applicationBuilder.StartServiceBricksLoggingEntityFrameworkCore(); - - return applicationBuilder; - } - } -} \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.Postgres/Extensions/ServiceCollectionExtensions.cs b/src/V1/ServiceBricks.Logging.Postgres/Extensions/ServiceCollectionExtensions.cs index 6972aaa..faeffb3 100644 --- a/src/V1/ServiceBricks.Logging.Postgres/Extensions/ServiceCollectionExtensions.cs +++ b/src/V1/ServiceBricks.Logging.Postgres/Extensions/ServiceCollectionExtensions.cs @@ -1,8 +1,7 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using ServiceBricks.Logging.EntityFrameworkCore; -using ServiceBricks.Storage.EntityFrameworkCore; +using ServiceBricks.Storage.Postgres; namespace ServiceBricks.Logging.Postgres { @@ -19,28 +18,16 @@ public static partial class ServiceCollectionExtensions /// public static IServiceCollection AddServiceBricksLoggingPostgres(this IServiceCollection services, IConfiguration configuration) { - // AI: Add the module to the ModuleRegistry - ModuleRegistry.Instance.RegisterItem(typeof(LoggingPostgresModule), new LoggingPostgresModule()); - // AI: Add parent module services.AddServiceBricksLoggingEntityFrameworkCore(configuration); - // AI: Register the database for the module - var builder = new DbContextOptionsBuilder(); - string connectionString = configuration.GetPostgresConnectionString( - LoggingPostgresConstants.APPSETTING_CONNECTION_STRING); - builder.UseNpgsql(connectionString, x => - { - x.MigrationsAssembly(typeof(ServiceCollectionExtensions).Assembly.GetName().Name); - x.EnableRetryOnFailure(); - }); - services.Configure>(o => { o = builder.Options; }); - services.AddSingleton>(builder.Options); - services.AddDbContext(c => { c = builder; }, ServiceLifetime.Scoped); + // AI: Add the module to the ModuleRegistry + ModuleRegistry.Instance.Register(LoggingPostgresModule.Instance); - // AI: Add storage services for the module. Each domain object should have its own storage repository. - services.AddScoped, LoggingStorageRepository>(); - services.AddScoped, LoggingStorageRepository>(); + // AI: Add module business rules + LoggingPostgresModuleAddRule.Register(BusinessRuleRegistry.Instance); + ModuleSetStartedRule.Register(BusinessRuleRegistry.Instance); + PostgresDatabaseMigrationRule.Register(BusinessRuleRegistry.Instance); return services; } diff --git a/src/V1/ServiceBricks.Logging.Postgres/Migrations/20240913102131_LoggingV1.cs b/src/V1/ServiceBricks.Logging.Postgres/Migrations/20240913102131_LoggingV1.cs index 9f35776..44d8cef 100644 --- a/src/V1/ServiceBricks.Logging.Postgres/Migrations/20240913102131_LoggingV1.cs +++ b/src/V1/ServiceBricks.Logging.Postgres/Migrations/20240913102131_LoggingV1.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable @@ -105,4 +104,4 @@ protected override void Down(MigrationBuilder migrationBuilder) schema: "Logging"); } } -} +} \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.Postgres/Model/LoggingPostgresModule.cs b/src/V1/ServiceBricks.Logging.Postgres/Model/LoggingPostgresModule.cs index f0473f4..9a338c5 100644 --- a/src/V1/ServiceBricks.Logging.Postgres/Model/LoggingPostgresModule.cs +++ b/src/V1/ServiceBricks.Logging.Postgres/Model/LoggingPostgresModule.cs @@ -1,13 +1,17 @@ using ServiceBricks.Logging.EntityFrameworkCore; -using System.Reflection; namespace ServiceBricks.Logging.Postgres { /// /// The module for the ServiceBricks Logging Postgres module. /// - public partial class LoggingPostgresModule : IModule + public partial class LoggingPostgresModule : ServiceBricks.Module { + /// + /// Instance + /// + public static LoggingPostgresModule Instance = new LoggingPostgresModule(); + /// /// Constructor. /// @@ -18,20 +22,5 @@ public LoggingPostgresModule() new LoggingEntityFrameworkCoreModule() }; } - - /// - /// The list of dependent modules. - /// - public List DependentModules { get; } - - /// - /// The list of Automapper assemblies. - /// - public List AutomapperAssemblies { get; } - - /// - /// The list of view assemblies. - /// - public List ViewAssemblies { get; } } } \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.Postgres/Rule/LoggingPostgresModuleAddRule.cs b/src/V1/ServiceBricks.Logging.Postgres/Rule/LoggingPostgresModuleAddRule.cs new file mode 100644 index 0000000..e43cae2 --- /dev/null +++ b/src/V1/ServiceBricks.Logging.Postgres/Rule/LoggingPostgresModuleAddRule.cs @@ -0,0 +1,79 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using ServiceBricks.Logging.EntityFrameworkCore; +using ServiceBricks.Storage.EntityFrameworkCore; + +namespace ServiceBricks.Logging.Postgres +{ + /// + /// This rule is executed when the ServiceBricks module is added. + /// + public sealed class LoggingPostgresModuleAddRule : BusinessRule + { + /// + /// Register the rule + /// + public static void Register(IBusinessRuleRegistry registry) + { + registry.Register( + typeof(ModuleAddEvent), + typeof(LoggingPostgresModuleAddRule)); + } + + /// + /// UnRegister the rule. + /// + public static void UnRegister(IBusinessRuleRegistry registry) + { + registry.UnRegister( + typeof(ModuleAddEvent), + typeof(LoggingPostgresModuleAddRule)); + } + + /// + /// Execute the business rule. + /// + /// + /// + public override IResponse ExecuteRule(IBusinessRuleContext context) + { + var response = new Response(); + + // AI: Make sure the context object is the correct type + if (context == null || context.Object == null) + { + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } + var e = context.Object as ModuleAddEvent; + if (e == null || e.DomainObject == null || e.ServiceCollection == null) + { + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } + + // AI: Perform logic + var services = e.ServiceCollection; + var configuration = e.Configuration; + + // AI: Register the database for the module + var builder = new DbContextOptionsBuilder(); + string connectionString = configuration.GetPostgresConnectionString( + LoggingPostgresConstants.APPSETTING_CONNECTION_STRING); + builder.UseNpgsql(connectionString, x => + { + x.MigrationsAssembly(typeof(ServiceCollectionExtensions).Assembly.GetName().Name); + x.EnableRetryOnFailure(); + }); + services.Configure>(o => { o = builder.Options; }); + services.AddSingleton>(builder.Options); + services.AddDbContext(c => { c = builder; }, ServiceLifetime.Scoped); + + // AI: Add storage services for the module. Each domain object should have its own storage repository. + services.AddScoped, LoggingStorageRepository>(); + services.AddScoped, LoggingStorageRepository>(); + + return response; + } + } +} \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.Postgres/ServiceBricks.Logging.Postgres.csproj b/src/V1/ServiceBricks.Logging.Postgres/ServiceBricks.Logging.Postgres.csproj index 39dad69..858ce99 100644 --- a/src/V1/ServiceBricks.Logging.Postgres/ServiceBricks.Logging.Postgres.csproj +++ b/src/V1/ServiceBricks.Logging.Postgres/ServiceBricks.Logging.Postgres.csproj @@ -1,7 +1,7 @@ - 1.1.0-g + 1.1.0-l The open source microservices platform. Visit https://ServiceBricks.com to learn more. ServiceBricks.Logging.Postgres ServiceBricks.Logging.Postgres @@ -34,11 +34,11 @@ - + - + diff --git a/src/V1/ServiceBricks.Logging.SqlServer.Debug/ServiceBricks.Logging.SqlServer.Debug.csproj b/src/V1/ServiceBricks.Logging.SqlServer.Debug/ServiceBricks.Logging.SqlServer.Debug.csproj index 5798e12..ecd0456 100644 --- a/src/V1/ServiceBricks.Logging.SqlServer.Debug/ServiceBricks.Logging.SqlServer.Debug.csproj +++ b/src/V1/ServiceBricks.Logging.SqlServer.Debug/ServiceBricks.Logging.SqlServer.Debug.csproj @@ -1,4 +1,4 @@ - + net6.0;net7.0;net8.0 @@ -7,7 +7,6 @@ - @@ -15,6 +14,7 @@ + @@ -23,7 +23,7 @@ - + diff --git a/src/V1/ServiceBricks.Logging.SqlServer/Extensions/ApplicationBuilderExtensions.cs b/src/V1/ServiceBricks.Logging.SqlServer/Extensions/ApplicationBuilderExtensions.cs deleted file mode 100644 index 9e79fdb..0000000 --- a/src/V1/ServiceBricks.Logging.SqlServer/Extensions/ApplicationBuilderExtensions.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.DependencyInjection; -using ServiceBricks.Logging.EntityFrameworkCore; - -namespace ServiceBricks.Logging.SqlServer -{ - /// - /// Extensions to start the ServiceBricks Logging SqlServer module. - /// - public static partial class ApplicationBuilderExtensions - { - /// - /// Flag to check if the module has been started. - /// - public static bool ModuleStarted = false; - - /// - /// Start the ServiceBricks Logging SqlServer module. - /// - /// - /// - public static IApplicationBuilder StartServiceBricksLoggingSqlServer(this IApplicationBuilder applicationBuilder) - { - // AI: Migrate the database - using (var serviceScope = applicationBuilder.ApplicationServices.GetRequiredService().CreateScope()) - { - var context = serviceScope.ServiceProvider.GetService(); - context.Database.Migrate(); - context.SaveChanges(); - } - - // AI: Set the module started flag - ModuleStarted = true; - - // AI: Start the parent module - applicationBuilder.StartServiceBricksLoggingEntityFrameworkCore(); - - return applicationBuilder; - } - } -} \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.SqlServer/Extensions/ServiceCollectionExtensions.cs b/src/V1/ServiceBricks.Logging.SqlServer/Extensions/ServiceCollectionExtensions.cs index 11775f4..dedf1f3 100644 --- a/src/V1/ServiceBricks.Logging.SqlServer/Extensions/ServiceCollectionExtensions.cs +++ b/src/V1/ServiceBricks.Logging.SqlServer/Extensions/ServiceCollectionExtensions.cs @@ -1,8 +1,7 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using ServiceBricks.Logging.EntityFrameworkCore; -using ServiceBricks.Storage.EntityFrameworkCore; +using ServiceBricks.Storage.SqlServer; namespace ServiceBricks.Logging.SqlServer { @@ -19,28 +18,16 @@ public static partial class ServiceCollectionExtensions /// public static IServiceCollection AddServiceBricksLoggingSqlServer(this IServiceCollection services, IConfiguration configuration) { - // AI: Add the module to the ModuleRegistry - ModuleRegistry.Instance.RegisterItem(typeof(LoggingSqlServerModule), new LoggingSqlServerModule()); - // AI: Add parent module services.AddServiceBricksLoggingEntityFrameworkCore(configuration); - // AI: Register the database for the module - var builder = new DbContextOptionsBuilder(); - string connectionString = configuration.GetSqlServerConnectionString( - LoggingSqlServerConstants.APPSETTING_CONNECTION_STRING); - builder.UseSqlServer(connectionString, x => - { - x.MigrationsAssembly(typeof(ServiceCollectionExtensions).Assembly.GetName().Name); - x.EnableRetryOnFailure(); - }); - services.Configure>(o => { o = builder.Options; }); - services.AddSingleton>(builder.Options); - services.AddDbContext(c => { c = builder; }, ServiceLifetime.Scoped); + // AI: Add the module to the ModuleRegistry + ModuleRegistry.Instance.Register(LoggingSqlServerModule.Instance); - // AI: Add storage services for the module. Each domain object should have its own storage repository. - services.AddScoped, LoggingStorageRepository>(); - services.AddScoped, LoggingStorageRepository>(); + // AI: Add module business rules + LoggingSqlServerModuleAddRule.Register(BusinessRuleRegistry.Instance); + ModuleSetStartedRule.Register(BusinessRuleRegistry.Instance); + SqlServerDatabaseMigrationRule.Register(BusinessRuleRegistry.Instance); return services; } diff --git a/src/V1/ServiceBricks.Logging.SqlServer/Migrations/20240913102323_LoggingV1.cs b/src/V1/ServiceBricks.Logging.SqlServer/Migrations/20240913102323_LoggingV1.cs index 50bde23..03abf1d 100644 --- a/src/V1/ServiceBricks.Logging.SqlServer/Migrations/20240913102323_LoggingV1.cs +++ b/src/V1/ServiceBricks.Logging.SqlServer/Migrations/20240913102323_LoggingV1.cs @@ -1,5 +1,4 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; #nullable disable @@ -104,4 +103,4 @@ protected override void Down(MigrationBuilder migrationBuilder) schema: "Logging"); } } -} +} \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.SqlServer/Model/LoggingSqlserverModule.cs b/src/V1/ServiceBricks.Logging.SqlServer/Model/LoggingSqlserverModule.cs index 0c5ed2f..2d29f0f 100644 --- a/src/V1/ServiceBricks.Logging.SqlServer/Model/LoggingSqlserverModule.cs +++ b/src/V1/ServiceBricks.Logging.SqlServer/Model/LoggingSqlserverModule.cs @@ -1,13 +1,17 @@ using ServiceBricks.Logging.EntityFrameworkCore; -using System.Reflection; namespace ServiceBricks.Logging.SqlServer { /// /// The module definition for the ServiceBricks.Logging.SqlServer module. /// - public partial class LoggingSqlServerModule : IModule + public partial class LoggingSqlServerModule : ServiceBricks.Module { + /// + /// Instance + /// + public static LoggingSqlServerModule Instance = new LoggingSqlServerModule(); + /// /// Constructor. /// @@ -18,20 +22,5 @@ public LoggingSqlServerModule() new LoggingEntityFrameworkCoreModule() }; } - - /// - /// The list of dependent modules. - /// - public List DependentModules { get; } - - /// - /// The list of Automapper assemblies. - /// - public List AutomapperAssemblies { get; } - - /// - /// The list of view assemblies. - /// - public List ViewAssemblies { get; } } } \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.SqlServer/Rule/LoggingSqlServerModuleAddRule.cs b/src/V1/ServiceBricks.Logging.SqlServer/Rule/LoggingSqlServerModuleAddRule.cs new file mode 100644 index 0000000..637cfae --- /dev/null +++ b/src/V1/ServiceBricks.Logging.SqlServer/Rule/LoggingSqlServerModuleAddRule.cs @@ -0,0 +1,79 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using ServiceBricks.Logging.EntityFrameworkCore; +using ServiceBricks.Storage.EntityFrameworkCore; + +namespace ServiceBricks.Logging.SqlServer +{ + /// + /// This rule is executed when the ServiceBricks module is added. + /// + public sealed class LoggingSqlServerModuleAddRule : BusinessRule + { + /// + /// Register the rule + /// + public static void Register(IBusinessRuleRegistry registry) + { + registry.Register( + typeof(ModuleAddEvent), + typeof(LoggingSqlServerModuleAddRule)); + } + + /// + /// UnRegister the rule. + /// + public static void UnRegister(IBusinessRuleRegistry registry) + { + registry.UnRegister( + typeof(ModuleAddEvent), + typeof(LoggingSqlServerModuleAddRule)); + } + + /// + /// Execute the business rule. + /// + /// + /// + public override IResponse ExecuteRule(IBusinessRuleContext context) + { + var response = new Response(); + + // AI: Make sure the context object is the correct type + if (context == null || context.Object == null) + { + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } + var e = context.Object as ModuleAddEvent; + if (e == null || e.DomainObject == null || e.ServiceCollection == null) + { + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } + + // AI: Perform logic + var services = e.ServiceCollection; + var configuration = e.Configuration; + + // AI: Register the database for the module + var builder = new DbContextOptionsBuilder(); + string connectionString = configuration.GetSqlServerConnectionString( + LoggingSqlServerConstants.APPSETTING_CONNECTION_STRING); + builder.UseSqlServer(connectionString, x => + { + x.MigrationsAssembly(typeof(ServiceCollectionExtensions).Assembly.GetName().Name); + x.EnableRetryOnFailure(); + }); + services.Configure>(o => { o = builder.Options; }); + services.AddSingleton>(builder.Options); + services.AddDbContext(c => { c = builder; }, ServiceLifetime.Scoped); + + // AI: Add storage services for the module. Each domain object should have its own storage repository. + services.AddScoped, LoggingStorageRepository>(); + services.AddScoped, LoggingStorageRepository>(); + + return response; + } + } +} \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.SqlServer/ServiceBricks.Logging.SqlServer.csproj b/src/V1/ServiceBricks.Logging.SqlServer/ServiceBricks.Logging.SqlServer.csproj index 0775fe8..d24627f 100644 --- a/src/V1/ServiceBricks.Logging.SqlServer/ServiceBricks.Logging.SqlServer.csproj +++ b/src/V1/ServiceBricks.Logging.SqlServer/ServiceBricks.Logging.SqlServer.csproj @@ -1,7 +1,7 @@ - 1.1.0-g + 1.1.0-l The open source microservices platform. Visit https://ServiceBricks.com to learn more. ServiceBricks.Logging.SqlServer ServiceBricks.Logging.SqlServer @@ -34,11 +34,11 @@ - + - + diff --git a/src/V1/ServiceBricks.Logging.Sqlite.Debug/ServiceBricks.Logging.Sqlite.Debug.csproj b/src/V1/ServiceBricks.Logging.Sqlite.Debug/ServiceBricks.Logging.Sqlite.Debug.csproj index faad906..1d6d781 100644 --- a/src/V1/ServiceBricks.Logging.Sqlite.Debug/ServiceBricks.Logging.Sqlite.Debug.csproj +++ b/src/V1/ServiceBricks.Logging.Sqlite.Debug/ServiceBricks.Logging.Sqlite.Debug.csproj @@ -1,4 +1,4 @@ - + net6.0;net7.0;net8.0 @@ -7,7 +7,6 @@ - @@ -15,6 +14,7 @@ + @@ -23,7 +23,7 @@ - + diff --git a/src/V1/ServiceBricks.Logging.Sqlite/Extensions/ApplicationBuilderExtensions.cs b/src/V1/ServiceBricks.Logging.Sqlite/Extensions/ApplicationBuilderExtensions.cs deleted file mode 100644 index 938a69a..0000000 --- a/src/V1/ServiceBricks.Logging.Sqlite/Extensions/ApplicationBuilderExtensions.cs +++ /dev/null @@ -1,42 +0,0 @@ -using Microsoft.AspNetCore.Builder; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.DependencyInjection; -using ServiceBricks.Logging.EntityFrameworkCore; - -namespace ServiceBricks.Logging.Sqlite -{ - /// - /// Extensions to start the ServiceBricks Logging Sqlite module. - /// - public static partial class ApplicationBuilderExtensions - { - /// - /// Flag to check if the module has been started. - /// - public static bool ModuleStarted = false; - - /// - /// Start the ServiceBricks Logging Sqlite module. - /// - /// - /// - public static IApplicationBuilder StartServiceBricksLoggingSqlite(this IApplicationBuilder applicationBuilder) - { - // AI: Migrate the database - using (var serviceScope = applicationBuilder.ApplicationServices.GetRequiredService().CreateScope()) - { - var context = serviceScope.ServiceProvider.GetService(); - context.Database.Migrate(); - context.SaveChanges(); - } - - // AI: Set the module started flag - ModuleStarted = true; - - // AI: Start the parent module - applicationBuilder.StartServiceBricksLoggingEntityFrameworkCore(); - - return applicationBuilder; - } - } -} \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.Sqlite/Extensions/ServiceCollectionExtensions.cs b/src/V1/ServiceBricks.Logging.Sqlite/Extensions/ServiceCollectionExtensions.cs index ae8aefd..1c237b0 100644 --- a/src/V1/ServiceBricks.Logging.Sqlite/Extensions/ServiceCollectionExtensions.cs +++ b/src/V1/ServiceBricks.Logging.Sqlite/Extensions/ServiceCollectionExtensions.cs @@ -3,6 +3,7 @@ using Microsoft.Extensions.DependencyInjection; using ServiceBricks.Logging.EntityFrameworkCore; using ServiceBricks.Storage.EntityFrameworkCore; +using ServiceBricks.Storage.Sqlite; namespace ServiceBricks.Logging.Sqlite { @@ -19,27 +20,16 @@ public static partial class ServiceCollectionExtensions /// public static IServiceCollection AddServiceBricksLoggingSqlite(this IServiceCollection services, IConfiguration configuration) { - // AI: Add the module to the ModuleRegistry - ModuleRegistry.Instance.RegisterItem(typeof(LoggingSqliteModule), new LoggingSqliteModule()); - // AI: Add parent module services.AddServiceBricksLoggingEntityFrameworkCore(configuration); - // AI: Register the database for the module - var builder = new DbContextOptionsBuilder(); - string connectionString = configuration.GetSqliteConnectionString( - LoggingSqliteConstants.APPSETTING_CONNECTION_STRING); - builder.UseSqlite(connectionString, x => - { - x.MigrationsAssembly(typeof(ServiceCollectionExtensions).Assembly.GetName().Name); - }); - services.Configure>(o => { o = builder.Options; }); - services.AddSingleton>(builder.Options); - services.AddDbContext(c => { c = builder; }, ServiceLifetime.Scoped); + // AI: Add this module to the ModuleRegistry + ModuleRegistry.Instance.Register(LoggingSqliteModule.Instance); - // AI: Add storage services for the module. Each domain object should have its own storage repository. - services.AddScoped, LoggingStorageRepository>(); - services.AddScoped, LoggingStorageRepository>(); + // AI: Add module business rules + LoggingSqliteModuleAddRule.Register(BusinessRuleRegistry.Instance); + ModuleSetStartedRule.Register(BusinessRuleRegistry.Instance); + SqliteDatabaseMigrationRule.Register(BusinessRuleRegistry.Instance); return services; } diff --git a/src/V1/ServiceBricks.Logging.Sqlite/Migrations/20240913102251_LoggingV1.cs b/src/V1/ServiceBricks.Logging.Sqlite/Migrations/20240913102251_LoggingV1.cs index 438796c..a3ab815 100644 --- a/src/V1/ServiceBricks.Logging.Sqlite/Migrations/20240913102251_LoggingV1.cs +++ b/src/V1/ServiceBricks.Logging.Sqlite/Migrations/20240913102251_LoggingV1.cs @@ -94,4 +94,4 @@ protected override void Down(MigrationBuilder migrationBuilder) name: "WebRequestMessages"); } } -} +} \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.Sqlite/Model/LoggingSqliteModule.cs b/src/V1/ServiceBricks.Logging.Sqlite/Model/LoggingSqliteModule.cs index c6c4fd7..2bf6dc8 100644 --- a/src/V1/ServiceBricks.Logging.Sqlite/Model/LoggingSqliteModule.cs +++ b/src/V1/ServiceBricks.Logging.Sqlite/Model/LoggingSqliteModule.cs @@ -1,13 +1,17 @@ using ServiceBricks.Logging.EntityFrameworkCore; -using System.Reflection; namespace ServiceBricks.Logging.Sqlite { /// /// The module definition for the ServiceBricks.Logging.Sqlite module. /// - public partial class LoggingSqliteModule : IModule + public partial class LoggingSqliteModule : ServiceBricks.Module { + /// + /// Instance. + /// + public static LoggingSqliteModule Instance = new LoggingSqliteModule(); + /// /// Constructor. /// @@ -18,20 +22,5 @@ public LoggingSqliteModule() new LoggingEntityFrameworkCoreModule() }; } - - /// - /// The list of dependent modules. - /// - public List DependentModules { get; } - - /// - /// The list of Automapper assemblies. - /// - public List AutomapperAssemblies { get; } - - /// - /// The list of view assemblies. - /// - public List ViewAssemblies { get; } } } \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.Sqlite/Rule/LoggingSqliteModuleAddRule.cs b/src/V1/ServiceBricks.Logging.Sqlite/Rule/LoggingSqliteModuleAddRule.cs new file mode 100644 index 0000000..104650e --- /dev/null +++ b/src/V1/ServiceBricks.Logging.Sqlite/Rule/LoggingSqliteModuleAddRule.cs @@ -0,0 +1,78 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; +using ServiceBricks.Logging.EntityFrameworkCore; +using ServiceBricks.Storage.EntityFrameworkCore; + +namespace ServiceBricks.Logging.Sqlite +{ + /// + /// This rule is executed when the ServiceBricks module is added. + /// + public sealed class LoggingSqliteModuleAddRule : BusinessRule + { + /// + /// Register the rule + /// + public static void Register(IBusinessRuleRegistry registry) + { + registry.Register( + typeof(ModuleAddEvent), + typeof(LoggingSqliteModuleAddRule)); + } + + /// + /// UnRegister the rule. + /// + public static void UnRegister(IBusinessRuleRegistry registry) + { + registry.UnRegister( + typeof(ModuleAddEvent), + typeof(LoggingSqliteModuleAddRule)); + } + + /// + /// Execute the business rule. + /// + /// + /// + public override IResponse ExecuteRule(IBusinessRuleContext context) + { + var response = new Response(); + + // AI: Make sure the context object is the correct type + if (context == null || context.Object == null) + { + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } + var e = context.Object as ModuleAddEvent; + if (e == null || e.DomainObject == null || e.ServiceCollection == null) + { + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } + + // AI: Perform logic + var services = e.ServiceCollection; + var configuration = e.Configuration; + + // AI: Register the database for the module + var builder = new DbContextOptionsBuilder(); + string connectionString = configuration.GetSqliteConnectionString( + LoggingSqliteConstants.APPSETTING_CONNECTION_STRING); + builder.UseSqlite(connectionString, x => + { + x.MigrationsAssembly(typeof(ServiceCollectionExtensions).Assembly.GetName().Name); + }); + services.Configure>(o => { o = builder.Options; }); + services.AddSingleton>(builder.Options); + services.AddDbContext(c => { c = builder; }, ServiceLifetime.Scoped); + + // AI: Add storage services for the module. Each domain object should have its own storage repository. + services.AddScoped, LoggingStorageRepository>(); + services.AddScoped, LoggingStorageRepository>(); + + return response; + } + } +} \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging.Sqlite/ServiceBricks.Logging.Sqlite.csproj b/src/V1/ServiceBricks.Logging.Sqlite/ServiceBricks.Logging.Sqlite.csproj index db9776e..fa8940d 100644 --- a/src/V1/ServiceBricks.Logging.Sqlite/ServiceBricks.Logging.Sqlite.csproj +++ b/src/V1/ServiceBricks.Logging.Sqlite/ServiceBricks.Logging.Sqlite.csproj @@ -1,7 +1,7 @@ - 1.1.0-g + 1.1.0-l The open source microservices platform. Visit https://ServiceBricks.com to learn more. ServiceBricks.Logging.Sqlite ServiceBricks.Logging.Sqlite @@ -34,11 +34,11 @@ - + - + diff --git a/src/V1/ServiceBricks.Logging/Background/CustomLoggerWriteMessageTimer.cs b/src/V1/ServiceBricks.Logging/Background/CustomLoggerWriteMessageTimer.cs index d367964..e2656d6 100644 --- a/src/V1/ServiceBricks.Logging/Background/CustomLoggerWriteMessageTimer.cs +++ b/src/V1/ServiceBricks.Logging/Background/CustomLoggerWriteMessageTimer.cs @@ -50,7 +50,7 @@ public override TimeSpan TimerDueTime public override bool TimerTickShouldProcessRun() { // AI: Check if the module has started, the timer is not currently running, and there are messages in the queue - return ApplicationBuilderExtensions.ModuleStarted && + return LoggingModule.Instance.Started && !IsCurrentlyRunning && CustomLogger.MessageQueue.Count > 0; } diff --git a/src/V1/ServiceBricks.Logging/Service/LogMessageApiClient.cs b/src/V1/ServiceBricks.Logging/Client/LogMessageApiClient.cs similarity index 100% rename from src/V1/ServiceBricks.Logging/Service/LogMessageApiClient.cs rename to src/V1/ServiceBricks.Logging/Client/LogMessageApiClient.cs diff --git a/src/V1/ServiceBricks.Logging/Service/WebRequestMessageApiClient.cs b/src/V1/ServiceBricks.Logging/Client/WebRequestMessageApiClient.cs similarity index 100% rename from src/V1/ServiceBricks.Logging/Service/WebRequestMessageApiClient.cs rename to src/V1/ServiceBricks.Logging/Client/WebRequestMessageApiClient.cs diff --git a/src/V1/ServiceBricks.Logging/Controller/LogMessageApiController.cs b/src/V1/ServiceBricks.Logging/Controllers/LogMessageApiController.cs similarity index 100% rename from src/V1/ServiceBricks.Logging/Controller/LogMessageApiController.cs rename to src/V1/ServiceBricks.Logging/Controllers/LogMessageApiController.cs diff --git a/src/V1/ServiceBricks.Logging/Controller/WebRequestMessageApiController.cs b/src/V1/ServiceBricks.Logging/Controllers/WebRequestMessageApiController.cs similarity index 100% rename from src/V1/ServiceBricks.Logging/Controller/WebRequestMessageApiController.cs rename to src/V1/ServiceBricks.Logging/Controllers/WebRequestMessageApiController.cs diff --git a/src/V1/ServiceBricks.Logging/Extensions/ApplicationBuilderExtensions.cs b/src/V1/ServiceBricks.Logging/Extensions/ApplicationBuilderExtensions.cs deleted file mode 100644 index 67a61e7..0000000 --- a/src/V1/ServiceBricks.Logging/Extensions/ApplicationBuilderExtensions.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.AspNetCore.Builder; - -namespace ServiceBricks.Logging -{ - /// - /// Extension methods for starting the ServiceBricks Logging module. - /// - public static partial class ApplicationBuilderExtensions - { - /// - /// Flag to indicate if the module has been started. - /// - public static bool ModuleStarted = false; - - /// - /// Start the ServiceBricks Logging module. - /// - /// - /// - public static IApplicationBuilder StartServiceBricksLogging(this IApplicationBuilder applicationBuilder) - { - // AI: Set the module started flag - ModuleStarted = true; - - return applicationBuilder; - } - } -} \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging/Extensions/ServiceCollectionExtensions.cs b/src/V1/ServiceBricks.Logging/Extensions/ServiceCollectionExtensions.cs index 133811c..c8d6ea2 100644 --- a/src/V1/ServiceBricks.Logging/Extensions/ServiceCollectionExtensions.cs +++ b/src/V1/ServiceBricks.Logging/Extensions/ServiceCollectionExtensions.cs @@ -17,35 +17,11 @@ public static partial class ServiceCollectionExtensions public static IServiceCollection AddServiceBricksLogging(this IServiceCollection services, IConfiguration configuration) { // AI: Add the module to the ModuleRegistry - ModuleRegistry.Instance.RegisterItem(typeof(LoggingModule), new LoggingModule()); + ModuleRegistry.Instance.Register(LoggingModule.Instance); - // AI: Add any custom requirements for the module - services.AddLogging(); - - // AI: Add hosted services for the module - services.AddHostedService(); - - // AI: Add workers for tasks in the module - services.AddScoped(); - - // AI: Configure all options for the module - services.Configure(configuration.GetSection(LoggingConstants.APPSETTING_WEBREQUESTMESSAGE)); - - // AI: Add API Controllers for each DTO in the module - services.AddScoped(); - services.AddScoped(); - - // AI: Add any miscellaneous services for the module - services.AddTransient(); - - // AI: Register business rules for the module - - // AI: Register servicebus subscriptions for the module - using (var serviceScope = services.BuildServiceProvider().GetRequiredService().CreateScope()) - { - var serviceBus = serviceScope.ServiceProvider.GetRequiredService(); - CreateApplicationLogRule.Register(serviceBus); - } + // AI: Add module business rules + LoggingModuleAddRule.Register(BusinessRuleRegistry.Instance); + ModuleSetStartedRule.Register(BusinessRuleRegistry.Instance); return services; } @@ -59,8 +35,12 @@ public static IServiceCollection AddServiceBricksLogging(this IServiceCollection public static IServiceCollection AddServiceBricksLoggingClient(this IServiceCollection services, IConfiguration configuration) { // AI: Add clients for the module for each DTO + services.AddScoped, LogMessageApiClient>(); services.AddScoped(); + services.AddScoped, WebRequestMessageApiClient>(); + services.AddScoped(); + return services; } } diff --git a/src/V1/ServiceBricks.Logging/Model/LoggingModule.cs b/src/V1/ServiceBricks.Logging/Model/LoggingModule.cs index 2a322b4..e850527 100644 --- a/src/V1/ServiceBricks.Logging/Model/LoggingModule.cs +++ b/src/V1/ServiceBricks.Logging/Model/LoggingModule.cs @@ -5,8 +5,13 @@ namespace ServiceBricks.Logging /// /// This is the module definition for the ServiceBricks Logging module. /// - public partial class LoggingModule : IModule + public partial class LoggingModule : ServiceBricks.Module { + /// + /// Instance + /// + public static LoggingModule Instance = new LoggingModule(); + /// /// Constructor /// @@ -17,20 +22,5 @@ public LoggingModule() typeof(LoggingModule).Assembly }; } - - /// - /// List of dependent modules. - /// - public List DependentModules { get; } - - /// - /// List of assemblies to scan for AutoMapper profiles. - /// - public List AutomapperAssemblies { get; } - - /// - /// List of assemblies to scan for view components. - /// - public List ViewAssemblies { get; } } } \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging/Rule/CreateApplicationLogRule.cs b/src/V1/ServiceBricks.Logging/Rule/CreateApplicationLogRule.cs index c624381..a4c4146 100644 --- a/src/V1/ServiceBricks.Logging/Rule/CreateApplicationLogRule.cs +++ b/src/V1/ServiceBricks.Logging/Rule/CreateApplicationLogRule.cs @@ -1,5 +1,4 @@ using AutoMapper; -using Microsoft.Extensions.Logging; namespace ServiceBricks.Logging { @@ -10,20 +9,16 @@ public sealed class CreateApplicationLogRule : BusinessRule { private readonly ILogMessageApiService _logMessageApiService; private readonly IMapper _mapper; - private readonly ILogger _logger; /// /// Constructor /// - /// /// /// public CreateApplicationLogRule( - ILoggerFactory loggerFactory, ILogMessageApiService logMessageApiService, IMapper mapper) { - _logger = loggerFactory.CreateLogger(); _mapper = mapper; _logMessageApiService = logMessageApiService; Priority = PRIORITY_NORMAL; @@ -32,10 +27,10 @@ public CreateApplicationLogRule( /// /// Register the service bus broadcast event. /// - /// - public static void Register(IServiceBus serviceBus) + /// + public static void Register(IBusinessRuleRegistry registry) { - serviceBus.Subscribe( + registry.Register( typeof(CreateApplicationLogBroadcast), typeof(CreateApplicationLogRule)); } @@ -43,10 +38,10 @@ public static void Register(IServiceBus serviceBus) /// /// Register the service bus broadcast event. /// - /// - public static void UnRegister(IServiceBus serviceBus) + /// + public static void UnRegister(IBusinessRuleRegistry registry) { - serviceBus.UnSubscribe( + registry.UnRegister( typeof(CreateApplicationLogBroadcast), typeof(CreateApplicationLogRule)); } @@ -60,29 +55,28 @@ public override IResponse ExecuteRule(IBusinessRuleContext context) { var response = new Response(); - try + // AI: Make sure the context object is the correct type + if (context == null || context.Object == null) { - // AI: Make sure the context object is the correct type - var e = context.Object as CreateApplicationLogBroadcast; - if (e == null || e.DomainObject == null) - return response; - - // AI: Map the ApplicationLogBroadcast to a LogMessageDto - var message = _mapper.Map(e.DomainObject); - - // AI: Call the API service to create the log message - var respCreate = _logMessageApiService.Create(message); - - // AI: Copy the API response to the business rule response - response.CopyFrom(respCreate); + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); return response; } - catch (Exception ex) + var e = context.Object as CreateApplicationLogBroadcast; + if (e == null || e.DomainObject == null) { - _logger.LogError(ex, ex.Message); - response.AddMessage(ResponseMessage.CreateError(LocalizationResource.ERROR_BUSINESS_RULE)); + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); return response; } + + // AI: Map the ApplicationLogBroadcast to a LogMessageDto + var message = _mapper.Map(e.DomainObject); + + // AI: Call the API service to create the log message + var respCreate = _logMessageApiService.Create(message); + + // AI: Copy the API response to the business rule response + response.CopyFrom(respCreate); + return response; } /// @@ -94,30 +88,29 @@ public override async Task ExecuteRuleAsync(IBusinessRuleContext cont { var response = new Response(); - try + // AI: Make sure the context object is the correct type + if (context == null || context.Object == null) { - // AI: Make sure the context object is the correct type - var e = context.Object as CreateApplicationLogBroadcast; - if (e == null || e.DomainObject == null) - return response; - - // AI: Map the ApplicationLogBroadcast to a LogMessageDto - var message = _mapper.Map(e.DomainObject); - - // AI: Call the API service to create the log message - var respCreate = await _logMessageApiService.CreateAsync(message); - - // AI: Copy the API response to the business rule response - response.CopyFrom(respCreate); - + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); return response; } - catch (Exception ex) + var e = context.Object as CreateApplicationLogBroadcast; + if (e == null || e.DomainObject == null) { - _logger.LogError(ex, ex.Message); - response.AddMessage(ResponseMessage.CreateError(LocalizationResource.ERROR_BUSINESS_RULE)); + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); return response; } + + // AI: Map the ApplicationLogBroadcast to a LogMessageDto + var message = _mapper.Map(e.DomainObject); + + // AI: Call the API service to create the log message + var respCreate = await _logMessageApiService.CreateAsync(message); + + // AI: Copy the API response to the business rule response + response.CopyFrom(respCreate); + + return response; } } } \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging/Rule/LoggingModuleAddRule.cs b/src/V1/ServiceBricks.Logging/Rule/LoggingModuleAddRule.cs new file mode 100644 index 0000000..d84dea4 --- /dev/null +++ b/src/V1/ServiceBricks.Logging/Rule/LoggingModuleAddRule.cs @@ -0,0 +1,84 @@ +using Microsoft.Extensions.DependencyInjection; + +namespace ServiceBricks.Logging +{ + /// + /// This rule is executed when the ServiceBricks module is added. + /// + public sealed class LoggingModuleAddRule : BusinessRule + { + /// + /// Register the rule + /// + public static void Register(IBusinessRuleRegistry registry) + { + registry.Register( + typeof(ModuleAddEvent), + typeof(LoggingModuleAddRule)); + } + + /// + /// UnRegister the rule. + /// + public static void UnRegister(IBusinessRuleRegistry registry) + { + registry.UnRegister( + typeof(ModuleAddEvent), + typeof(LoggingModuleAddRule)); + } + + /// + /// Execute the business rule. + /// + /// + /// + public override IResponse ExecuteRule(IBusinessRuleContext context) + { + var response = new Response(); + + // AI: Make sure the context object is the correct type + if (context == null || context.Object == null) + { + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } + var e = context.Object as ModuleAddEvent; + if (e == null || e.DomainObject == null || e.ServiceCollection == null) + { + response.AddMessage(ResponseMessage.CreateError(LocalizationResource.PARAMETER_MISSING, "context")); + return response; + } + + // AI: Perform logic + var services = e.ServiceCollection; + var configuration = e.Configuration; + + // AI: Add any custom requirements for the module + services.AddLogging(); + + // AI: Add hosted services for the module + services.AddHostedService(); + + // AI: Add workers for tasks in the module + services.AddScoped(); + + // AI: Configure all options for the module + services.Configure(configuration.GetSection(LoggingConstants.APPSETTING_WEBREQUESTMESSAGE)); + + // AI: Add API Controllers for each DTO in the module + services.AddScoped, LogMessageApiController>(); + services.AddScoped(); + + services.AddScoped, WebRequestMessageApiController>(); + services.AddScoped(); + + // AI: Add any miscellaneous services for the module + services.AddTransient(); + + // AI: Register business rules for the module + CreateApplicationLogRule.Register(BusinessRuleRegistry.Instance); + + return response; + } + } +} \ No newline at end of file diff --git a/src/V1/ServiceBricks.Logging/ServiceBricks.Logging.csproj b/src/V1/ServiceBricks.Logging/ServiceBricks.Logging.csproj index 0d46827..4fe31ca 100644 --- a/src/V1/ServiceBricks.Logging/ServiceBricks.Logging.csproj +++ b/src/V1/ServiceBricks.Logging/ServiceBricks.Logging.csproj @@ -1,7 +1,7 @@ - 1.1.0-g + 1.1.0-l The open source microservices platform. Visit https://ServiceBricks.com to learn more. ServiceBricks.Logging ServiceBricks.Logging @@ -33,7 +33,7 @@ - + diff --git a/src/V1/Tests/MigrationsHost/StartupMigrations.cs b/src/V1/Tests/MigrationsHost/StartupMigrations.cs index 6fec49e..d338a3a 100644 --- a/src/V1/Tests/MigrationsHost/StartupMigrations.cs +++ b/src/V1/Tests/MigrationsHost/StartupMigrations.cs @@ -29,17 +29,13 @@ public virtual void ConfigureDevelopmentServices(IServiceCollection services) if (logtimer != null) services.Remove(logtimer); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app) { base.CustomConfigure(app); app.StartServiceBricks(); - - app.StartServiceBricksLoggingPostgres(); - app.StartServiceBricksLoggingSqlServer(); - app.StartServiceBricksLoggingSqlite(); } } } \ No newline at end of file diff --git a/src/V1/Tests/ServiceBricks.Logging.AzureDataTables.XunitNet6/ServiceBricks.Logging.AzureDataTables.XunitNet6.csproj b/src/V1/Tests/ServiceBricks.Logging.AzureDataTables.XunitNet6/ServiceBricks.Logging.AzureDataTables.XunitNet6.csproj index 224f587..78ff262 100644 --- a/src/V1/Tests/ServiceBricks.Logging.AzureDataTables.XunitNet6/ServiceBricks.Logging.AzureDataTables.XunitNet6.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.AzureDataTables.XunitNet6/ServiceBricks.Logging.AzureDataTables.XunitNet6.csproj @@ -31,7 +31,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.AzureDataTables.XunitNet7/ServiceBricks - Backup.Logging.AzureDataTables.XunitNet7.csproj b/src/V1/Tests/ServiceBricks.Logging.AzureDataTables.XunitNet7/ServiceBricks - Backup.Logging.AzureDataTables.XunitNet7.csproj new file mode 100644 index 0000000..258ec34 --- /dev/null +++ b/src/V1/Tests/ServiceBricks.Logging.AzureDataTables.XunitNet7/ServiceBricks - Backup.Logging.AzureDataTables.XunitNet7.csproj @@ -0,0 +1,49 @@ + + + + net7.0 + enable + disable + + false + true + + + + + + + + + + + + Always + + + + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/V1/Tests/ServiceBricks.Logging.AzureDataTables.XunitNet7/ServiceBricks.Logging.AzureDataTables.XunitNet7.csproj b/src/V1/Tests/ServiceBricks.Logging.AzureDataTables.XunitNet7/ServiceBricks.Logging.AzureDataTables.XunitNet7.csproj index c948f83..4400d33 100644 --- a/src/V1/Tests/ServiceBricks.Logging.AzureDataTables.XunitNet7/ServiceBricks.Logging.AzureDataTables.XunitNet7.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.AzureDataTables.XunitNet7/ServiceBricks.Logging.AzureDataTables.XunitNet7.csproj @@ -31,7 +31,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.AzureDataTables.XunitNet8/ServiceBricks - Backup.Logging.AzureDataTables.XunitNet8.csproj b/src/V1/Tests/ServiceBricks.Logging.AzureDataTables.XunitNet8/ServiceBricks - Backup.Logging.AzureDataTables.XunitNet8.csproj new file mode 100644 index 0000000..4cf7483 --- /dev/null +++ b/src/V1/Tests/ServiceBricks.Logging.AzureDataTables.XunitNet8/ServiceBricks - Backup.Logging.AzureDataTables.XunitNet8.csproj @@ -0,0 +1,49 @@ + + + + net8.0 + enable + disable + + false + true + + + + + + + + + + + + Always + + + + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/V1/Tests/ServiceBricks.Logging.AzureDataTables.XunitNet8/ServiceBricks.Logging.AzureDataTables.XunitNet8.csproj b/src/V1/Tests/ServiceBricks.Logging.AzureDataTables.XunitNet8/ServiceBricks.Logging.AzureDataTables.XunitNet8.csproj index b1f3bdc..9e40e68 100644 --- a/src/V1/Tests/ServiceBricks.Logging.AzureDataTables.XunitNet8/ServiceBricks.Logging.AzureDataTables.XunitNet8.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.AzureDataTables.XunitNet8/ServiceBricks.Logging.AzureDataTables.XunitNet8.csproj @@ -31,7 +31,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.Client.XunitNet6/ServiceBricks - Backup.Logging.Client.XunitNet6.csproj b/src/V1/Tests/ServiceBricks.Logging.Client.XunitNet6/ServiceBricks - Backup.Logging.Client.XunitNet6.csproj new file mode 100644 index 0000000..8edbc2c --- /dev/null +++ b/src/V1/Tests/ServiceBricks.Logging.Client.XunitNet6/ServiceBricks - Backup.Logging.Client.XunitNet6.csproj @@ -0,0 +1,48 @@ + + + + net6.0 + enable + disable + + false + true + + + + + + + + + + + + + Always + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + diff --git a/src/V1/Tests/ServiceBricks.Logging.Client.XunitNet6/ServiceBricks.Logging.Client.XunitNet6.csproj b/src/V1/Tests/ServiceBricks.Logging.Client.XunitNet6/ServiceBricks.Logging.Client.XunitNet6.csproj index be901b2..22ab0cb 100644 --- a/src/V1/Tests/ServiceBricks.Logging.Client.XunitNet6/ServiceBricks.Logging.Client.XunitNet6.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.Client.XunitNet6/ServiceBricks.Logging.Client.XunitNet6.csproj @@ -26,7 +26,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.Client.XunitNet7/ServiceBricks - Backup.Logging.Client.XunitNet7.csproj b/src/V1/Tests/ServiceBricks.Logging.Client.XunitNet7/ServiceBricks - Backup.Logging.Client.XunitNet7.csproj new file mode 100644 index 0000000..61a9a9e --- /dev/null +++ b/src/V1/Tests/ServiceBricks.Logging.Client.XunitNet7/ServiceBricks - Backup.Logging.Client.XunitNet7.csproj @@ -0,0 +1,48 @@ + + + + net7.0 + enable + disable + + false + true + + + + + + + + + + + + + Always + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + diff --git a/src/V1/Tests/ServiceBricks.Logging.Client.XunitNet7/ServiceBricks.Logging.Client.XunitNet7.csproj b/src/V1/Tests/ServiceBricks.Logging.Client.XunitNet7/ServiceBricks.Logging.Client.XunitNet7.csproj index 081f014..f15d593 100644 --- a/src/V1/Tests/ServiceBricks.Logging.Client.XunitNet7/ServiceBricks.Logging.Client.XunitNet7.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.Client.XunitNet7/ServiceBricks.Logging.Client.XunitNet7.csproj @@ -26,7 +26,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.Client.XunitNet8/ServiceBricks - Backup.Logging.Client.XunitNet8.csproj b/src/V1/Tests/ServiceBricks.Logging.Client.XunitNet8/ServiceBricks - Backup.Logging.Client.XunitNet8.csproj new file mode 100644 index 0000000..ef095e7 --- /dev/null +++ b/src/V1/Tests/ServiceBricks.Logging.Client.XunitNet8/ServiceBricks - Backup.Logging.Client.XunitNet8.csproj @@ -0,0 +1,48 @@ + + + + net8.0 + enable + disable + + false + true + + + + + + + + + + + + + Always + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + diff --git a/src/V1/Tests/ServiceBricks.Logging.Client.XunitNet8/ServiceBricks.Logging.Client.XunitNet8.csproj b/src/V1/Tests/ServiceBricks.Logging.Client.XunitNet8/ServiceBricks.Logging.Client.XunitNet8.csproj index d99f92f..435b889 100644 --- a/src/V1/Tests/ServiceBricks.Logging.Client.XunitNet8/ServiceBricks.Logging.Client.XunitNet8.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.Client.XunitNet8/ServiceBricks.Logging.Client.XunitNet8.csproj @@ -26,7 +26,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.Cosmos.XunitNet6/ServiceBricks.Logging.Cosmos.XunitNet6.csproj b/src/V1/Tests/ServiceBricks.Logging.Cosmos.XunitNet6/ServiceBricks.Logging.Cosmos.XunitNet6.csproj index c0acf1a..7818c1c 100644 --- a/src/V1/Tests/ServiceBricks.Logging.Cosmos.XunitNet6/ServiceBricks.Logging.Cosmos.XunitNet6.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.Cosmos.XunitNet6/ServiceBricks.Logging.Cosmos.XunitNet6.csproj @@ -31,7 +31,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.Cosmos.XunitNet7/ServiceBricks - Backup.Logging.Cosmos.XunitNet7.csproj b/src/V1/Tests/ServiceBricks.Logging.Cosmos.XunitNet7/ServiceBricks - Backup.Logging.Cosmos.XunitNet7.csproj new file mode 100644 index 0000000..d370e2d --- /dev/null +++ b/src/V1/Tests/ServiceBricks.Logging.Cosmos.XunitNet7/ServiceBricks - Backup.Logging.Cosmos.XunitNet7.csproj @@ -0,0 +1,49 @@ + + + + net7.0 + enable + disable + + false + true + + + + + + + + + + + + Always + + + + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/V1/Tests/ServiceBricks.Logging.Cosmos.XunitNet7/ServiceBricks.Logging.Cosmos.XunitNet7.csproj b/src/V1/Tests/ServiceBricks.Logging.Cosmos.XunitNet7/ServiceBricks.Logging.Cosmos.XunitNet7.csproj index 76d210a..c46d1db 100644 --- a/src/V1/Tests/ServiceBricks.Logging.Cosmos.XunitNet7/ServiceBricks.Logging.Cosmos.XunitNet7.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.Cosmos.XunitNet7/ServiceBricks.Logging.Cosmos.XunitNet7.csproj @@ -31,7 +31,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.Cosmos.XunitNet8/ServiceBricks - Backup.Logging.Cosmos.XunitNet8.csproj b/src/V1/Tests/ServiceBricks.Logging.Cosmos.XunitNet8/ServiceBricks - Backup.Logging.Cosmos.XunitNet8.csproj new file mode 100644 index 0000000..d86238e --- /dev/null +++ b/src/V1/Tests/ServiceBricks.Logging.Cosmos.XunitNet8/ServiceBricks - Backup.Logging.Cosmos.XunitNet8.csproj @@ -0,0 +1,50 @@ + + + + net8.0 + enable + disable + + false + true + + + + + + + + + + + + Always + + + + + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/V1/Tests/ServiceBricks.Logging.Cosmos.XunitNet8/ServiceBricks.Logging.Cosmos.XunitNet8.csproj b/src/V1/Tests/ServiceBricks.Logging.Cosmos.XunitNet8/ServiceBricks.Logging.Cosmos.XunitNet8.csproj index fe4b658..bf9d6d5 100644 --- a/src/V1/Tests/ServiceBricks.Logging.Cosmos.XunitNet8/ServiceBricks.Logging.Cosmos.XunitNet8.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.Cosmos.XunitNet8/ServiceBricks.Logging.Cosmos.XunitNet8.csproj @@ -32,7 +32,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.InMemory.XunitNet6/ServiceBricks.Logging.InMemory.XunitNet6.csproj b/src/V1/Tests/ServiceBricks.Logging.InMemory.XunitNet6/ServiceBricks.Logging.InMemory.XunitNet6.csproj index ee1301b..7719bbf 100644 --- a/src/V1/Tests/ServiceBricks.Logging.InMemory.XunitNet6/ServiceBricks.Logging.InMemory.XunitNet6.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.InMemory.XunitNet6/ServiceBricks.Logging.InMemory.XunitNet6.csproj @@ -34,7 +34,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.InMemory.XunitNet7/ServiceBricks - Backup.Logging.InMemory.XunitNet7.csproj b/src/V1/Tests/ServiceBricks.Logging.InMemory.XunitNet7/ServiceBricks - Backup.Logging.InMemory.XunitNet7.csproj new file mode 100644 index 0000000..b42f93e --- /dev/null +++ b/src/V1/Tests/ServiceBricks.Logging.InMemory.XunitNet7/ServiceBricks - Backup.Logging.InMemory.XunitNet7.csproj @@ -0,0 +1,51 @@ + + + + net7.0 + enable + disable + + false + true + + + + + + + + + + + + + + + Always + + + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/V1/Tests/ServiceBricks.Logging.InMemory.XunitNet7/ServiceBricks.Logging.InMemory.XunitNet7.csproj b/src/V1/Tests/ServiceBricks.Logging.InMemory.XunitNet7/ServiceBricks.Logging.InMemory.XunitNet7.csproj index 3d4d0b3..f0289aa 100644 --- a/src/V1/Tests/ServiceBricks.Logging.InMemory.XunitNet7/ServiceBricks.Logging.InMemory.XunitNet7.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.InMemory.XunitNet7/ServiceBricks.Logging.InMemory.XunitNet7.csproj @@ -33,7 +33,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.InMemory.XunitNet8/ServiceBricks - Backup.Logging.InMemory.XunitNet8.csproj b/src/V1/Tests/ServiceBricks.Logging.InMemory.XunitNet8/ServiceBricks - Backup.Logging.InMemory.XunitNet8.csproj new file mode 100644 index 0000000..766c9ac --- /dev/null +++ b/src/V1/Tests/ServiceBricks.Logging.InMemory.XunitNet8/ServiceBricks - Backup.Logging.InMemory.XunitNet8.csproj @@ -0,0 +1,53 @@ + + + + net8.0 + enable + disable + + false + true + + + + + + + + + + + + + + + Always + + + + + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/V1/Tests/ServiceBricks.Logging.InMemory.XunitNet8/ServiceBricks.Logging.InMemory.XunitNet8.csproj b/src/V1/Tests/ServiceBricks.Logging.InMemory.XunitNet8/ServiceBricks.Logging.InMemory.XunitNet8.csproj index 5fa4112..001b42d 100644 --- a/src/V1/Tests/ServiceBricks.Logging.InMemory.XunitNet8/ServiceBricks.Logging.InMemory.XunitNet8.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.InMemory.XunitNet8/ServiceBricks.Logging.InMemory.XunitNet8.csproj @@ -35,7 +35,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.MongoDb.XunitNet6/ServiceBricks.Logging.MongoDb.XunitNet6.csproj b/src/V1/Tests/ServiceBricks.Logging.MongoDb.XunitNet6/ServiceBricks.Logging.MongoDb.XunitNet6.csproj index db76b7e..349e378 100644 --- a/src/V1/Tests/ServiceBricks.Logging.MongoDb.XunitNet6/ServiceBricks.Logging.MongoDb.XunitNet6.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.MongoDb.XunitNet6/ServiceBricks.Logging.MongoDb.XunitNet6.csproj @@ -33,7 +33,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.MongoDb.XunitNet7/ServiceBricks - Backup.Logging.MongoDb.XunitNet7.csproj b/src/V1/Tests/ServiceBricks.Logging.MongoDb.XunitNet7/ServiceBricks - Backup.Logging.MongoDb.XunitNet7.csproj new file mode 100644 index 0000000..487a8c9 --- /dev/null +++ b/src/V1/Tests/ServiceBricks.Logging.MongoDb.XunitNet7/ServiceBricks - Backup.Logging.MongoDb.XunitNet7.csproj @@ -0,0 +1,50 @@ + + + + net7.0 + enable + disable + + false + true + + + + + + + + + + + + + + Always + + + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/V1/Tests/ServiceBricks.Logging.MongoDb.XunitNet7/ServiceBricks.Logging.MongoDb.XunitNet7.csproj b/src/V1/Tests/ServiceBricks.Logging.MongoDb.XunitNet7/ServiceBricks.Logging.MongoDb.XunitNet7.csproj index e3aa0ca..34a2551 100644 --- a/src/V1/Tests/ServiceBricks.Logging.MongoDb.XunitNet7/ServiceBricks.Logging.MongoDb.XunitNet7.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.MongoDb.XunitNet7/ServiceBricks.Logging.MongoDb.XunitNet7.csproj @@ -32,7 +32,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.MongoDb.XunitNet8/ServiceBricks - Backup.Logging.MongoDb.XunitNet8.csproj b/src/V1/Tests/ServiceBricks.Logging.MongoDb.XunitNet8/ServiceBricks - Backup.Logging.MongoDb.XunitNet8.csproj new file mode 100644 index 0000000..6b16ccf --- /dev/null +++ b/src/V1/Tests/ServiceBricks.Logging.MongoDb.XunitNet8/ServiceBricks - Backup.Logging.MongoDb.XunitNet8.csproj @@ -0,0 +1,52 @@ + + + + net8.0 + enable + disable + + false + true + + + + + + + + + + + + + + Always + + + + + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/V1/Tests/ServiceBricks.Logging.MongoDb.XunitNet8/ServiceBricks.Logging.MongoDb.XunitNet8.csproj b/src/V1/Tests/ServiceBricks.Logging.MongoDb.XunitNet8/ServiceBricks.Logging.MongoDb.XunitNet8.csproj index 6123d3c..d5bbafd 100644 --- a/src/V1/Tests/ServiceBricks.Logging.MongoDb.XunitNet8/ServiceBricks.Logging.MongoDb.XunitNet8.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.MongoDb.XunitNet8/ServiceBricks.Logging.MongoDb.XunitNet8.csproj @@ -34,7 +34,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.Postgres.XunitNet6/ServiceBricks.Logging.Postgres.XunitNet6.csproj b/src/V1/Tests/ServiceBricks.Logging.Postgres.XunitNet6/ServiceBricks.Logging.Postgres.XunitNet6.csproj index 25cde38..83d795f 100644 --- a/src/V1/Tests/ServiceBricks.Logging.Postgres.XunitNet6/ServiceBricks.Logging.Postgres.XunitNet6.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.Postgres.XunitNet6/ServiceBricks.Logging.Postgres.XunitNet6.csproj @@ -33,7 +33,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.Postgres.XunitNet7/ServiceBricks - Backup.Logging.Postgres.XunitNet7.csproj b/src/V1/Tests/ServiceBricks.Logging.Postgres.XunitNet7/ServiceBricks - Backup.Logging.Postgres.XunitNet7.csproj new file mode 100644 index 0000000..e1a98e3 --- /dev/null +++ b/src/V1/Tests/ServiceBricks.Logging.Postgres.XunitNet7/ServiceBricks - Backup.Logging.Postgres.XunitNet7.csproj @@ -0,0 +1,50 @@ + + + + net7.0 + enable + disable + + false + true + + + + + + + + + + + + + + Always + + + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/V1/Tests/ServiceBricks.Logging.Postgres.XunitNet7/ServiceBricks.Logging.Postgres.XunitNet7.csproj b/src/V1/Tests/ServiceBricks.Logging.Postgres.XunitNet7/ServiceBricks.Logging.Postgres.XunitNet7.csproj index 3378e50..77b5fe0 100644 --- a/src/V1/Tests/ServiceBricks.Logging.Postgres.XunitNet7/ServiceBricks.Logging.Postgres.XunitNet7.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.Postgres.XunitNet7/ServiceBricks.Logging.Postgres.XunitNet7.csproj @@ -32,7 +32,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.Postgres.XunitNet8/ServiceBricks - Backup.Logging.Postgres.XunitNet8.csproj b/src/V1/Tests/ServiceBricks.Logging.Postgres.XunitNet8/ServiceBricks - Backup.Logging.Postgres.XunitNet8.csproj new file mode 100644 index 0000000..cc9c0b8 --- /dev/null +++ b/src/V1/Tests/ServiceBricks.Logging.Postgres.XunitNet8/ServiceBricks - Backup.Logging.Postgres.XunitNet8.csproj @@ -0,0 +1,52 @@ + + + + net8.0 + enable + disable + + false + true + + + + + + + + + + + + + + Always + + + + + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/V1/Tests/ServiceBricks.Logging.Postgres.XunitNet8/ServiceBricks.Logging.Postgres.XunitNet8.csproj b/src/V1/Tests/ServiceBricks.Logging.Postgres.XunitNet8/ServiceBricks.Logging.Postgres.XunitNet8.csproj index d9d2856..e09aec1 100644 --- a/src/V1/Tests/ServiceBricks.Logging.Postgres.XunitNet8/ServiceBricks.Logging.Postgres.XunitNet8.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.Postgres.XunitNet8/ServiceBricks.Logging.Postgres.XunitNet8.csproj @@ -34,7 +34,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.SqlServer.XunitNet6/ServiceBricks.Logging.SqlServer.XunitNet6.csproj b/src/V1/Tests/ServiceBricks.Logging.SqlServer.XunitNet6/ServiceBricks.Logging.SqlServer.XunitNet6.csproj index 4b50d70..180e039 100644 --- a/src/V1/Tests/ServiceBricks.Logging.SqlServer.XunitNet6/ServiceBricks.Logging.SqlServer.XunitNet6.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.SqlServer.XunitNet6/ServiceBricks.Logging.SqlServer.XunitNet6.csproj @@ -30,7 +30,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.SqlServer.XunitNet7/ServiceBricks - Backup.Logging.SqlServer.XunitNet7.csproj b/src/V1/Tests/ServiceBricks.Logging.SqlServer.XunitNet7/ServiceBricks - Backup.Logging.SqlServer.XunitNet7.csproj new file mode 100644 index 0000000..64b4cc4 --- /dev/null +++ b/src/V1/Tests/ServiceBricks.Logging.SqlServer.XunitNet7/ServiceBricks - Backup.Logging.SqlServer.XunitNet7.csproj @@ -0,0 +1,48 @@ + + + + net7.0 + enable + disable + + false + true + + + + + + + + + + + + Always + + + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/V1/Tests/ServiceBricks.Logging.SqlServer.XunitNet7/ServiceBricks.Logging.SqlServer.XunitNet7.csproj b/src/V1/Tests/ServiceBricks.Logging.SqlServer.XunitNet7/ServiceBricks.Logging.SqlServer.XunitNet7.csproj index 81e4d68..ad43c5b 100644 --- a/src/V1/Tests/ServiceBricks.Logging.SqlServer.XunitNet7/ServiceBricks.Logging.SqlServer.XunitNet7.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.SqlServer.XunitNet7/ServiceBricks.Logging.SqlServer.XunitNet7.csproj @@ -30,7 +30,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.SqlServer.XunitNet8/ServiceBricks.Logging.SqlServer.XunitNet8.csproj b/src/V1/Tests/ServiceBricks.Logging.SqlServer.XunitNet8/ServiceBricks.Logging.SqlServer.XunitNet8.csproj index 5d43ca9..8618031 100644 --- a/src/V1/Tests/ServiceBricks.Logging.SqlServer.XunitNet8/ServiceBricks.Logging.SqlServer.XunitNet8.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.SqlServer.XunitNet8/ServiceBricks.Logging.SqlServer.XunitNet8.csproj @@ -32,7 +32,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.Sqlite.XunitNet6/ServiceBricks.Logging.Sqlite.XunitNet6.csproj b/src/V1/Tests/ServiceBricks.Logging.Sqlite.XunitNet6/ServiceBricks.Logging.Sqlite.XunitNet6.csproj index f9a4699..d0103cd 100644 --- a/src/V1/Tests/ServiceBricks.Logging.Sqlite.XunitNet6/ServiceBricks.Logging.Sqlite.XunitNet6.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.Sqlite.XunitNet6/ServiceBricks.Logging.Sqlite.XunitNet6.csproj @@ -31,7 +31,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.Sqlite.XunitNet7/ServiceBricks - Backup.Logging.Sqlite.XunitNet7.csproj b/src/V1/Tests/ServiceBricks.Logging.Sqlite.XunitNet7/ServiceBricks - Backup.Logging.Sqlite.XunitNet7.csproj new file mode 100644 index 0000000..bb63090 --- /dev/null +++ b/src/V1/Tests/ServiceBricks.Logging.Sqlite.XunitNet7/ServiceBricks - Backup.Logging.Sqlite.XunitNet7.csproj @@ -0,0 +1,48 @@ + + + + net7.0 + enable + disable + + false + true + + + + + + + + + + + + Always + + + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/V1/Tests/ServiceBricks.Logging.Sqlite.XunitNet7/ServiceBricks.Logging.Sqlite.XunitNet7.csproj b/src/V1/Tests/ServiceBricks.Logging.Sqlite.XunitNet7/ServiceBricks.Logging.Sqlite.XunitNet7.csproj index 1a115fb..cab96f2 100644 --- a/src/V1/Tests/ServiceBricks.Logging.Sqlite.XunitNet7/ServiceBricks.Logging.Sqlite.XunitNet7.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.Sqlite.XunitNet7/ServiceBricks.Logging.Sqlite.XunitNet7.csproj @@ -30,7 +30,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.Sqlite.XunitNet8/ServiceBricks - Backup.Logging.Sqlite.XunitNet8.csproj b/src/V1/Tests/ServiceBricks.Logging.Sqlite.XunitNet8/ServiceBricks - Backup.Logging.Sqlite.XunitNet8.csproj new file mode 100644 index 0000000..a6a7088 --- /dev/null +++ b/src/V1/Tests/ServiceBricks.Logging.Sqlite.XunitNet8/ServiceBricks - Backup.Logging.Sqlite.XunitNet8.csproj @@ -0,0 +1,50 @@ + + + + net8.0 + enable + disable + + false + true + + + + + + + + + + + + Always + + + + + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/V1/Tests/ServiceBricks.Logging.Sqlite.XunitNet8/ServiceBricks.Logging.Sqlite.XunitNet8.csproj b/src/V1/Tests/ServiceBricks.Logging.Sqlite.XunitNet8/ServiceBricks.Logging.Sqlite.XunitNet8.csproj index 4003152..63a0c6e 100644 --- a/src/V1/Tests/ServiceBricks.Logging.Sqlite.XunitNet8/ServiceBricks.Logging.Sqlite.XunitNet8.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.Sqlite.XunitNet8/ServiceBricks.Logging.Sqlite.XunitNet8.csproj @@ -32,7 +32,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.XunitNet6/ServiceBricks - Backup.Logging.XunitNet6.csproj b/src/V1/Tests/ServiceBricks.Logging.XunitNet6/ServiceBricks - Backup.Logging.XunitNet6.csproj new file mode 100644 index 0000000..1c6abf7 --- /dev/null +++ b/src/V1/Tests/ServiceBricks.Logging.XunitNet6/ServiceBricks - Backup.Logging.XunitNet6.csproj @@ -0,0 +1,45 @@ + + + + net6.0 + enable + disable + + false + true + + + + + + + + + + + + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/V1/Tests/ServiceBricks.Logging.XunitNet6/ServiceBricks.Logging.XunitNet6.csproj b/src/V1/Tests/ServiceBricks.Logging.XunitNet6/ServiceBricks.Logging.XunitNet6.csproj index 309ccb9..d9bcd89 100644 --- a/src/V1/Tests/ServiceBricks.Logging.XunitNet6/ServiceBricks.Logging.XunitNet6.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.XunitNet6/ServiceBricks.Logging.XunitNet6.csproj @@ -17,7 +17,7 @@ - + @@ -27,7 +27,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.XunitNet7/ServiceBricks - Backup.Logging.XunitNet7.csproj b/src/V1/Tests/ServiceBricks.Logging.XunitNet7/ServiceBricks - Backup.Logging.XunitNet7.csproj new file mode 100644 index 0000000..58d41d6 --- /dev/null +++ b/src/V1/Tests/ServiceBricks.Logging.XunitNet7/ServiceBricks - Backup.Logging.XunitNet7.csproj @@ -0,0 +1,45 @@ + + + + net7.0 + enable + disable + + false + true + + + + + + + + + + + + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/V1/Tests/ServiceBricks.Logging.XunitNet7/ServiceBricks.Logging.XunitNet7.csproj b/src/V1/Tests/ServiceBricks.Logging.XunitNet7/ServiceBricks.Logging.XunitNet7.csproj index 848a343..0062535 100644 --- a/src/V1/Tests/ServiceBricks.Logging.XunitNet7/ServiceBricks.Logging.XunitNet7.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.XunitNet7/ServiceBricks.Logging.XunitNet7.csproj @@ -17,7 +17,7 @@ - + @@ -27,7 +27,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/ServiceBricks.Logging.XunitNet8/ServiceBricks - Backup.Logging.XunitNet8.csproj b/src/V1/Tests/ServiceBricks.Logging.XunitNet8/ServiceBricks - Backup.Logging.XunitNet8.csproj new file mode 100644 index 0000000..4ba1bfb --- /dev/null +++ b/src/V1/Tests/ServiceBricks.Logging.XunitNet8/ServiceBricks - Backup.Logging.XunitNet8.csproj @@ -0,0 +1,45 @@ + + + + net8.0 + enable + disable + + false + true + + + + + + + + + + + + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/V1/Tests/ServiceBricks.Logging.XunitNet8/ServiceBricks.Logging.XunitNet8.csproj b/src/V1/Tests/ServiceBricks.Logging.XunitNet8/ServiceBricks.Logging.XunitNet8.csproj index a311c5d..ef387d3 100644 --- a/src/V1/Tests/ServiceBricks.Logging.XunitNet8/ServiceBricks.Logging.XunitNet8.csproj +++ b/src/V1/Tests/ServiceBricks.Logging.XunitNet8/ServiceBricks.Logging.XunitNet8.csproj @@ -17,7 +17,7 @@ - + @@ -27,7 +27,7 @@ - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/V1/Tests/TestFiles/LogMessageApiControllerTest.cs b/src/V1/Tests/TestFiles/LogMessageApiControllerTest.cs index bfb2a72..1a840ed 100644 --- a/src/V1/Tests/TestFiles/LogMessageApiControllerTest.cs +++ b/src/V1/Tests/TestFiles/LogMessageApiControllerTest.cs @@ -1,5 +1,4 @@ using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.DependencyInjection; using ServiceBricks.Logging; namespace ServiceBricks.Xunit diff --git a/src/V1/Tests/TestFiles/LogMessageApiControllerTestAzureDataTables.cs b/src/V1/Tests/TestFiles/LogMessageApiControllerTestAzureDataTables.cs index 1f20711..9fa4b4a 100644 --- a/src/V1/Tests/TestFiles/LogMessageApiControllerTestAzureDataTables.cs +++ b/src/V1/Tests/TestFiles/LogMessageApiControllerTestAzureDataTables.cs @@ -1,5 +1,4 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using ServiceBricks.Logging; namespace ServiceBricks.Xunit.Integration diff --git a/src/V1/Tests/TestFiles/LogMessageApiControllerTestCosmos.cs b/src/V1/Tests/TestFiles/LogMessageApiControllerTestCosmos.cs index 2c29624..9eb9c30 100644 --- a/src/V1/Tests/TestFiles/LogMessageApiControllerTestCosmos.cs +++ b/src/V1/Tests/TestFiles/LogMessageApiControllerTestCosmos.cs @@ -1,5 +1,4 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using ServiceBricks.Logging; namespace ServiceBricks.Xunit.Integration diff --git a/src/V1/Tests/TestFiles/LogMessageApiControllerTestInMemory.cs b/src/V1/Tests/TestFiles/LogMessageApiControllerTestInMemory.cs index 4bd1d60..8785eff 100644 --- a/src/V1/Tests/TestFiles/LogMessageApiControllerTestInMemory.cs +++ b/src/V1/Tests/TestFiles/LogMessageApiControllerTestInMemory.cs @@ -1,5 +1,4 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using ServiceBricks.Logging; namespace ServiceBricks.Xunit diff --git a/src/V1/Tests/TestFiles/LogMessageApiControllerTestMongoDb.cs b/src/V1/Tests/TestFiles/LogMessageApiControllerTestMongoDb.cs index abdc8c7..57e4850 100644 --- a/src/V1/Tests/TestFiles/LogMessageApiControllerTestMongoDb.cs +++ b/src/V1/Tests/TestFiles/LogMessageApiControllerTestMongoDb.cs @@ -1,5 +1,4 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using ServiceBricks.Logging; namespace ServiceBricks.Xunit.Integration diff --git a/src/V1/Tests/TestFiles/LogMessageApiControllerTestPostgres.cs b/src/V1/Tests/TestFiles/LogMessageApiControllerTestPostgres.cs index edf7a77..d661a19 100644 --- a/src/V1/Tests/TestFiles/LogMessageApiControllerTestPostgres.cs +++ b/src/V1/Tests/TestFiles/LogMessageApiControllerTestPostgres.cs @@ -1,5 +1,4 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using ServiceBricks.Logging; namespace ServiceBricks.Xunit.Integration diff --git a/src/V1/Tests/TestFiles/LogMessageApiControllerTestSqlServer.cs b/src/V1/Tests/TestFiles/LogMessageApiControllerTestSqlServer.cs index 3a81a37..9b1caac 100644 --- a/src/V1/Tests/TestFiles/LogMessageApiControllerTestSqlServer.cs +++ b/src/V1/Tests/TestFiles/LogMessageApiControllerTestSqlServer.cs @@ -1,5 +1,4 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using ServiceBricks.Logging; namespace ServiceBricks.Xunit.Integration diff --git a/src/V1/Tests/TestFiles/LogMessageApiControllerTestSqlite.cs b/src/V1/Tests/TestFiles/LogMessageApiControllerTestSqlite.cs index 1c9d882..f9d1222 100644 --- a/src/V1/Tests/TestFiles/LogMessageApiControllerTestSqlite.cs +++ b/src/V1/Tests/TestFiles/LogMessageApiControllerTestSqlite.cs @@ -1,5 +1,4 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using ServiceBricks.Logging; namespace ServiceBricks.Xunit.Integration diff --git a/src/V1/Tests/TestFiles/LogMessageStubApiClientTests.cs b/src/V1/Tests/TestFiles/LogMessageStubApiClientTests.cs index 627decd..1469750 100644 --- a/src/V1/Tests/TestFiles/LogMessageStubApiClientTests.cs +++ b/src/V1/Tests/TestFiles/LogMessageStubApiClientTests.cs @@ -1,13 +1,8 @@ -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using ServiceBricks.Xunit; -using Newtonsoft.Json; -using ServiceQuery; -using Microsoft.AspNetCore.Mvc; -using static ServiceBricks.Xunit.ApiClientTests; using ServiceBricks.Logging; -using Microsoft.Extensions.Configuration; namespace ServiceBricks.Xunit { diff --git a/src/V1/Tests/TestFiles/ObjectTests.cs b/src/V1/Tests/TestFiles/ObjectTests.cs index 99f83e8..8b5d302 100644 --- a/src/V1/Tests/TestFiles/ObjectTests.cs +++ b/src/V1/Tests/TestFiles/ObjectTests.cs @@ -1,12 +1,9 @@ using AutoMapper; -using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using ServiceBricks.Logging; -using ServiceQuery; -using static ServiceBricks.Xunit.BusinessRuleTests; namespace ServiceBricks.Xunit { @@ -179,7 +176,6 @@ await middleware.InvokeAsync( public virtual Task CreateApplicationLogRuleTests() { CreateApplicationLogRule rule = new CreateApplicationLogRule( - SystemManager.ServiceProvider.GetRequiredService(), SystemManager.ServiceProvider.GetRequiredService(), SystemManager.ServiceProvider.GetRequiredService()); @@ -188,7 +184,19 @@ public virtual Task CreateApplicationLogRuleTests() { }); - rule.ExecuteRule(context); + // Execute error rules + var response = rule.ExecuteRule(null); + Assert.True(response.Error); + response = rule.ExecuteRule(new BusinessRuleContext(null)); + Assert.True(response.Error); + response = rule.ExecuteRule(new BusinessRuleContext(new CreateApplicationLogBroadcast(null))); + Assert.True(response.Error); + + // Execute rule + response = rule.ExecuteRule(context); + + // Assert + Assert.True(response.Success); return Task.CompletedTask; } @@ -197,7 +205,6 @@ public virtual Task CreateApplicationLogRuleTests() public virtual async Task CreateApplicationLogRuleTestsAsync() { CreateApplicationLogRule rule = new CreateApplicationLogRule( - SystemManager.ServiceProvider.GetRequiredService(), SystemManager.ServiceProvider.GetRequiredService(), SystemManager.ServiceProvider.GetRequiredService()); @@ -206,7 +213,19 @@ public virtual async Task CreateApplicationLogRuleTestsAsync() { }); - await rule.ExecuteRuleAsync(context); + // Execute error rules + var response = await rule.ExecuteRuleAsync(null); + Assert.True(response.Error); + response = await rule.ExecuteRuleAsync(new BusinessRuleContext(null)); + Assert.True(response.Error); + response = await rule.ExecuteRuleAsync(new BusinessRuleContext(new CreateApplicationLogBroadcast(null))); + Assert.True(response.Error); + + // Execute rule + response = await rule.ExecuteRuleAsync(context); + + // Assert + Assert.True(response.Success); } } } \ No newline at end of file diff --git a/src/V1/Tests/TestFiles/StartupAzureDataTables.cs b/src/V1/Tests/TestFiles/StartupAzureDataTables.cs index 5402ba3..ea08307 100644 --- a/src/V1/Tests/TestFiles/StartupAzureDataTables.cs +++ b/src/V1/Tests/TestFiles/StartupAzureDataTables.cs @@ -28,14 +28,13 @@ public virtual void ConfigureDevelopmentServices(IServiceCollection services) services.AddScoped, LogMessageTestManager>(); services.AddScoped, WebRequestMessageTestManager>(); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app) { base.CustomConfigure(app); app.StartServiceBricks(); - app.StartServiceBricksLoggingAzureDataTables(); } } } \ No newline at end of file diff --git a/src/V1/Tests/TestFiles/StartupCosmos.cs b/src/V1/Tests/TestFiles/StartupCosmos.cs index da81c9b..1c685d1 100644 --- a/src/V1/Tests/TestFiles/StartupCosmos.cs +++ b/src/V1/Tests/TestFiles/StartupCosmos.cs @@ -28,14 +28,13 @@ public virtual void ConfigureDevelopmentServices(IServiceCollection services) services.AddScoped, LogMessageTestManager>(); services.AddScoped, WebRequestMessageTestManager>(); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app) { base.CustomConfigure(app); app.StartServiceBricks(); - app.StartServiceBricksLoggingCosmos(); } } } \ No newline at end of file diff --git a/src/V1/Tests/TestFiles/StartupInMemory.cs b/src/V1/Tests/TestFiles/StartupInMemory.cs index b9ac93a..2028875 100644 --- a/src/V1/Tests/TestFiles/StartupInMemory.cs +++ b/src/V1/Tests/TestFiles/StartupInMemory.cs @@ -28,14 +28,13 @@ public virtual void ConfigureDevelopmentServices(IServiceCollection services) services.AddScoped, LogMessageTestManager>(); services.AddScoped, WebRequestMessageTestManager>(); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app) { base.CustomConfigure(app); app.StartServiceBricks(); - app.StartServiceBricksLoggingInMemory(); } } } \ No newline at end of file diff --git a/src/V1/Tests/TestFiles/StartupMongoDb.cs b/src/V1/Tests/TestFiles/StartupMongoDb.cs index 92fa2f3..5e9fa42 100644 --- a/src/V1/Tests/TestFiles/StartupMongoDb.cs +++ b/src/V1/Tests/TestFiles/StartupMongoDb.cs @@ -28,14 +28,13 @@ public virtual void ConfigureDevelopmentServices(IServiceCollection services) services.AddScoped, LogMessageTestManagerMongoDb>(); services.AddScoped, WebRequestMessageTestManagerMongoDb>(); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app) { base.CustomConfigure(app); app.StartServiceBricks(); - app.StartServiceBricksLoggingMongoDb(); } } } \ No newline at end of file diff --git a/src/V1/Tests/TestFiles/StartupPostgres.cs b/src/V1/Tests/TestFiles/StartupPostgres.cs index d529773..c62255c 100644 --- a/src/V1/Tests/TestFiles/StartupPostgres.cs +++ b/src/V1/Tests/TestFiles/StartupPostgres.cs @@ -28,14 +28,13 @@ public virtual void ConfigureDevelopmentServices(IServiceCollection services) services.AddScoped, LogMessageTestManagerPostgres>(); services.AddScoped, WebRequestMessageTestManagerPostgres>(); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app) { base.CustomConfigure(app); app.StartServiceBricks(); - app.StartServiceBricksLoggingPostgres(); } } } \ No newline at end of file diff --git a/src/V1/Tests/TestFiles/StartupSqlServer.cs b/src/V1/Tests/TestFiles/StartupSqlServer.cs index 833bbff..757d7f8 100644 --- a/src/V1/Tests/TestFiles/StartupSqlServer.cs +++ b/src/V1/Tests/TestFiles/StartupSqlServer.cs @@ -28,14 +28,13 @@ public virtual void ConfigureDevelopmentServices(IServiceCollection services) services.AddScoped, LogMessageTestManager>(); services.AddScoped, WebRequestMessageTestManager>(); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app) { base.CustomConfigure(app); app.StartServiceBricks(); - app.StartServiceBricksLoggingSqlServer(); } } } \ No newline at end of file diff --git a/src/V1/Tests/TestFiles/StartupSqlite.cs b/src/V1/Tests/TestFiles/StartupSqlite.cs index 1e1956f..2278d89 100644 --- a/src/V1/Tests/TestFiles/StartupSqlite.cs +++ b/src/V1/Tests/TestFiles/StartupSqlite.cs @@ -28,14 +28,13 @@ public virtual void ConfigureDevelopmentServices(IServiceCollection services) services.AddScoped, LogMessageTestManager>(); services.AddScoped, WebRequestMessageTestManager>(); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app) { base.CustomConfigure(app); app.StartServiceBricks(); - app.StartServiceBricksLoggingSqlite(); } } } \ No newline at end of file diff --git a/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTest.cs b/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTest.cs index 725912f..093ec33 100644 --- a/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTest.cs +++ b/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTest.cs @@ -1,5 +1,4 @@ using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.DependencyInjection; using ServiceBricks.Logging; namespace ServiceBricks.Xunit diff --git a/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestCosmos.cs b/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestCosmos.cs index c3ad9fa..e78609c 100644 --- a/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestCosmos.cs +++ b/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestCosmos.cs @@ -1,5 +1,4 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using ServiceBricks.Logging; namespace ServiceBricks.Xunit.Integration diff --git a/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestInMemory.cs b/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestInMemory.cs index d1358b3..3f63de5 100644 --- a/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestInMemory.cs +++ b/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestInMemory.cs @@ -1,5 +1,4 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using ServiceBricks.Logging; namespace ServiceBricks.Xunit diff --git a/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestMongoDb.cs b/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestMongoDb.cs index 6a98cfb..cdf5f1b 100644 --- a/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestMongoDb.cs +++ b/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestMongoDb.cs @@ -1,5 +1,4 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using ServiceBricks.Logging; namespace ServiceBricks.Xunit.Integration diff --git a/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestPostgres.cs b/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestPostgres.cs index 77c74f8..e5ac50e 100644 --- a/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestPostgres.cs +++ b/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestPostgres.cs @@ -1,5 +1,4 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using ServiceBricks.Logging; namespace ServiceBricks.Xunit.Integration diff --git a/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestSqlServer.cs b/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestSqlServer.cs index c371809..e9cb982 100644 --- a/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestSqlServer.cs +++ b/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestSqlServer.cs @@ -1,5 +1,4 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using ServiceBricks.Logging; namespace ServiceBricks.Xunit.Integration diff --git a/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestSqlite.cs b/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestSqlite.cs index 2ed043f..b17d86e 100644 --- a/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestSqlite.cs +++ b/src/V1/Tests/TestFiles/WebRequestMessageApiControllerTestSqlite.cs @@ -1,5 +1,4 @@ -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using ServiceBricks.Logging; namespace ServiceBricks.Xunit.Integration diff --git a/src/V1/Tests/TestFiles/WebRequestMessageStubApiClientTests.cs b/src/V1/Tests/TestFiles/WebRequestMessageStubApiClientTests.cs index 0311bce..f9dd084 100644 --- a/src/V1/Tests/TestFiles/WebRequestMessageStubApiClientTests.cs +++ b/src/V1/Tests/TestFiles/WebRequestMessageStubApiClientTests.cs @@ -1,13 +1,8 @@ -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using ServiceBricks.Xunit; -using Newtonsoft.Json; -using ServiceQuery; -using Microsoft.AspNetCore.Mvc; -using static ServiceBricks.Xunit.ApiClientTests; using ServiceBricks.Logging; -using Microsoft.Extensions.Configuration; namespace ServiceBricks.Xunit { diff --git a/src/V1/Tests/TestFiles/client/ClientStartup.cs b/src/V1/Tests/TestFiles/client/ClientStartup.cs index 50a87d4..6fec8cc 100644 --- a/src/V1/Tests/TestFiles/client/ClientStartup.cs +++ b/src/V1/Tests/TestFiles/client/ClientStartup.cs @@ -24,7 +24,7 @@ public virtual void ConfigureDevelopmentServices(IServiceCollection services) services.AddScoped, LogMessageTestManager>(); services.AddScoped, WebRequestMessageTestManager>(); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app) diff --git a/src/V1/Tests/WebAppNet6/Extensions/ServiceCollectionExtensions.cs b/src/V1/Tests/WebAppNet6/Extensions/ServiceCollectionExtensions.cs index 45fba4b..8452c57 100644 --- a/src/V1/Tests/WebAppNet6/Extensions/ServiceCollectionExtensions.cs +++ b/src/V1/Tests/WebAppNet6/Extensions/ServiceCollectionExtensions.cs @@ -10,7 +10,7 @@ public static class ServiceCollectionExtensions public static IServiceCollection AddCustomWebsite(this IServiceCollection services, IConfiguration Configuration) { // Add to module registry - ModuleRegistry.Instance.RegisterItem(typeof(WebAppModule), new WebAppModule()); + ModuleRegistry.Instance.Register(new WebAppModule()); services.AddControllers(); services.AddRazorPages(); diff --git a/src/V1/Tests/WebAppNet6/Model/WebAppModule.cs b/src/V1/Tests/WebAppNet6/Model/WebAppModule.cs index 678f061..0e928d2 100644 --- a/src/V1/Tests/WebAppNet6/Model/WebAppModule.cs +++ b/src/V1/Tests/WebAppNet6/Model/WebAppModule.cs @@ -1,9 +1,8 @@ -using ServiceBricks; -using System.Reflection; +using System.Reflection; namespace WebApp.Model { - public class WebAppModule : IModule + public class WebAppModule : ServiceBricks.Module { public WebAppModule() { @@ -12,11 +11,5 @@ public WebAppModule() typeof(WebAppModule).Assembly }; } - - public List DependentModules { get; set; } - - public List AutomapperAssemblies { get; set; } - - public List ViewAssemblies { get; set; } } } \ No newline at end of file diff --git a/src/V1/Tests/WebAppNet6/StartupAzureDataTables.cs b/src/V1/Tests/WebAppNet6/StartupAzureDataTables.cs index 675f235..072188f 100644 --- a/src/V1/Tests/WebAppNet6/StartupAzureDataTables.cs +++ b/src/V1/Tests/WebAppNet6/StartupAzureDataTables.cs @@ -18,13 +18,12 @@ public virtual void ConfigureServices(IServiceCollection services) services.AddServiceBricks(Configuration); services.AddServiceBricksLoggingAzureDataTables(Configuration); services.AddCustomWebsite(Configuration); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment webHostEnvironment) { app.StartServiceBricks(); - app.StartServiceBricksLoggingAzureDataTables(); app.StartCustomWebsite(webHostEnvironment); var logger = app.ApplicationServices.GetRequiredService>(); logger.LogInformation("Application Started"); diff --git a/src/V1/Tests/WebAppNet6/StartupCosmos.cs b/src/V1/Tests/WebAppNet6/StartupCosmos.cs index 723e705..78f0107 100644 --- a/src/V1/Tests/WebAppNet6/StartupCosmos.cs +++ b/src/V1/Tests/WebAppNet6/StartupCosmos.cs @@ -18,13 +18,12 @@ public virtual void ConfigureServices(IServiceCollection services) services.AddServiceBricks(Configuration); services.AddServiceBricksLoggingCosmos(Configuration); services.AddCustomWebsite(Configuration); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment webHostEnvironment) { app.StartServiceBricks(); - app.StartServiceBricksLoggingCosmos(); app.StartCustomWebsite(webHostEnvironment); var logger = app.ApplicationServices.GetRequiredService>(); logger.LogInformation("Application Started"); diff --git a/src/V1/Tests/WebAppNet6/StartupInMemory.cs b/src/V1/Tests/WebAppNet6/StartupInMemory.cs index 3a66dcd..b945946 100644 --- a/src/V1/Tests/WebAppNet6/StartupInMemory.cs +++ b/src/V1/Tests/WebAppNet6/StartupInMemory.cs @@ -18,13 +18,12 @@ public virtual void ConfigureServices(IServiceCollection services) services.AddServiceBricks(Configuration); services.AddServiceBricksLoggingInMemory(Configuration); services.AddCustomWebsite(Configuration); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment webHostEnvironment) { app.StartServiceBricks(); - app.StartServiceBricksLoggingInMemory(); app.StartCustomWebsite(webHostEnvironment); var logger = app.ApplicationServices.GetRequiredService>(); logger.LogInformation("Application Started"); diff --git a/src/V1/Tests/WebAppNet6/StartupMongoDb.cs b/src/V1/Tests/WebAppNet6/StartupMongoDb.cs index a197741..135792d 100644 --- a/src/V1/Tests/WebAppNet6/StartupMongoDb.cs +++ b/src/V1/Tests/WebAppNet6/StartupMongoDb.cs @@ -18,13 +18,12 @@ public virtual void ConfigureServices(IServiceCollection services) services.AddServiceBricks(Configuration); services.AddServiceBricksLoggingMongoDb(Configuration); services.AddCustomWebsite(Configuration); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment webHostEnvironment) { app.StartServiceBricks(); - app.StartServiceBricksLoggingMongoDb(); app.StartCustomWebsite(webHostEnvironment); var logger = app.ApplicationServices.GetRequiredService>(); logger.LogInformation("Application Started"); diff --git a/src/V1/Tests/WebAppNet6/StartupPostgres.cs b/src/V1/Tests/WebAppNet6/StartupPostgres.cs index d5ae315..30918b2 100644 --- a/src/V1/Tests/WebAppNet6/StartupPostgres.cs +++ b/src/V1/Tests/WebAppNet6/StartupPostgres.cs @@ -18,13 +18,12 @@ public virtual void ConfigureServices(IServiceCollection services) services.AddServiceBricks(Configuration); services.AddServiceBricksLoggingPostgres(Configuration); services.AddCustomWebsite(Configuration); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment webHostEnvironment) { app.StartServiceBricks(); - app.StartServiceBricksLoggingPostgres(); app.StartCustomWebsite(webHostEnvironment); var logger = app.ApplicationServices.GetRequiredService>(); logger.LogInformation("Application Started"); diff --git a/src/V1/Tests/WebAppNet6/StartupSqlServer.cs b/src/V1/Tests/WebAppNet6/StartupSqlServer.cs index 20e2377..67d1548 100644 --- a/src/V1/Tests/WebAppNet6/StartupSqlServer.cs +++ b/src/V1/Tests/WebAppNet6/StartupSqlServer.cs @@ -18,13 +18,12 @@ public virtual void ConfigureServices(IServiceCollection services) services.AddServiceBricks(Configuration); services.AddServiceBricksLoggingSqlServer(Configuration); services.AddCustomWebsite(Configuration); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment webHostEnvironment) { app.StartServiceBricks(); - app.StartServiceBricksLoggingSqlServer(); app.StartCustomWebsite(webHostEnvironment); var logger = app.ApplicationServices.GetRequiredService>(); logger.LogInformation("Application Started"); diff --git a/src/V1/Tests/WebAppNet6/StartupSqlite.cs b/src/V1/Tests/WebAppNet6/StartupSqlite.cs index e281cf9..1cd18ea 100644 --- a/src/V1/Tests/WebAppNet6/StartupSqlite.cs +++ b/src/V1/Tests/WebAppNet6/StartupSqlite.cs @@ -18,13 +18,12 @@ public virtual void ConfigureServices(IServiceCollection services) services.AddServiceBricks(Configuration); services.AddServiceBricksLoggingSqlite(Configuration); services.AddCustomWebsite(Configuration); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment webHostEnvironment) { app.StartServiceBricks(); - app.StartServiceBricksLoggingSqlite(); app.StartCustomWebsite(webHostEnvironment); var logger = app.ApplicationServices.GetRequiredService>(); logger.LogInformation("Application Started"); diff --git a/src/V1/Tests/WebAppNet6/WebAppNet6.csproj b/src/V1/Tests/WebAppNet6/WebAppNet6.csproj index 875e17c..dcfd79a 100644 --- a/src/V1/Tests/WebAppNet6/WebAppNet6.csproj +++ b/src/V1/Tests/WebAppNet6/WebAppNet6.csproj @@ -16,7 +16,7 @@ - + diff --git a/src/V1/Tests/WebAppNet7/Extensions/ServiceCollectionExtensions.cs b/src/V1/Tests/WebAppNet7/Extensions/ServiceCollectionExtensions.cs index 45fba4b..8452c57 100644 --- a/src/V1/Tests/WebAppNet7/Extensions/ServiceCollectionExtensions.cs +++ b/src/V1/Tests/WebAppNet7/Extensions/ServiceCollectionExtensions.cs @@ -10,7 +10,7 @@ public static class ServiceCollectionExtensions public static IServiceCollection AddCustomWebsite(this IServiceCollection services, IConfiguration Configuration) { // Add to module registry - ModuleRegistry.Instance.RegisterItem(typeof(WebAppModule), new WebAppModule()); + ModuleRegistry.Instance.Register(new WebAppModule()); services.AddControllers(); services.AddRazorPages(); diff --git a/src/V1/Tests/WebAppNet7/Model/WebAppModule.cs b/src/V1/Tests/WebAppNet7/Model/WebAppModule.cs index 678f061..0e928d2 100644 --- a/src/V1/Tests/WebAppNet7/Model/WebAppModule.cs +++ b/src/V1/Tests/WebAppNet7/Model/WebAppModule.cs @@ -1,9 +1,8 @@ -using ServiceBricks; -using System.Reflection; +using System.Reflection; namespace WebApp.Model { - public class WebAppModule : IModule + public class WebAppModule : ServiceBricks.Module { public WebAppModule() { @@ -12,11 +11,5 @@ public WebAppModule() typeof(WebAppModule).Assembly }; } - - public List DependentModules { get; set; } - - public List AutomapperAssemblies { get; set; } - - public List ViewAssemblies { get; set; } } } \ No newline at end of file diff --git a/src/V1/Tests/WebAppNet7/StartupAzureDataTables.cs b/src/V1/Tests/WebAppNet7/StartupAzureDataTables.cs index 675f235..072188f 100644 --- a/src/V1/Tests/WebAppNet7/StartupAzureDataTables.cs +++ b/src/V1/Tests/WebAppNet7/StartupAzureDataTables.cs @@ -18,13 +18,12 @@ public virtual void ConfigureServices(IServiceCollection services) services.AddServiceBricks(Configuration); services.AddServiceBricksLoggingAzureDataTables(Configuration); services.AddCustomWebsite(Configuration); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment webHostEnvironment) { app.StartServiceBricks(); - app.StartServiceBricksLoggingAzureDataTables(); app.StartCustomWebsite(webHostEnvironment); var logger = app.ApplicationServices.GetRequiredService>(); logger.LogInformation("Application Started"); diff --git a/src/V1/Tests/WebAppNet7/StartupCosmos.cs b/src/V1/Tests/WebAppNet7/StartupCosmos.cs index 723e705..78f0107 100644 --- a/src/V1/Tests/WebAppNet7/StartupCosmos.cs +++ b/src/V1/Tests/WebAppNet7/StartupCosmos.cs @@ -18,13 +18,12 @@ public virtual void ConfigureServices(IServiceCollection services) services.AddServiceBricks(Configuration); services.AddServiceBricksLoggingCosmos(Configuration); services.AddCustomWebsite(Configuration); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment webHostEnvironment) { app.StartServiceBricks(); - app.StartServiceBricksLoggingCosmos(); app.StartCustomWebsite(webHostEnvironment); var logger = app.ApplicationServices.GetRequiredService>(); logger.LogInformation("Application Started"); diff --git a/src/V1/Tests/WebAppNet7/StartupInMemory.cs b/src/V1/Tests/WebAppNet7/StartupInMemory.cs index 3a66dcd..b945946 100644 --- a/src/V1/Tests/WebAppNet7/StartupInMemory.cs +++ b/src/V1/Tests/WebAppNet7/StartupInMemory.cs @@ -18,13 +18,12 @@ public virtual void ConfigureServices(IServiceCollection services) services.AddServiceBricks(Configuration); services.AddServiceBricksLoggingInMemory(Configuration); services.AddCustomWebsite(Configuration); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment webHostEnvironment) { app.StartServiceBricks(); - app.StartServiceBricksLoggingInMemory(); app.StartCustomWebsite(webHostEnvironment); var logger = app.ApplicationServices.GetRequiredService>(); logger.LogInformation("Application Started"); diff --git a/src/V1/Tests/WebAppNet7/StartupMongoDb.cs b/src/V1/Tests/WebAppNet7/StartupMongoDb.cs index a197741..135792d 100644 --- a/src/V1/Tests/WebAppNet7/StartupMongoDb.cs +++ b/src/V1/Tests/WebAppNet7/StartupMongoDb.cs @@ -18,13 +18,12 @@ public virtual void ConfigureServices(IServiceCollection services) services.AddServiceBricks(Configuration); services.AddServiceBricksLoggingMongoDb(Configuration); services.AddCustomWebsite(Configuration); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment webHostEnvironment) { app.StartServiceBricks(); - app.StartServiceBricksLoggingMongoDb(); app.StartCustomWebsite(webHostEnvironment); var logger = app.ApplicationServices.GetRequiredService>(); logger.LogInformation("Application Started"); diff --git a/src/V1/Tests/WebAppNet7/StartupPostgres.cs b/src/V1/Tests/WebAppNet7/StartupPostgres.cs index d5ae315..30918b2 100644 --- a/src/V1/Tests/WebAppNet7/StartupPostgres.cs +++ b/src/V1/Tests/WebAppNet7/StartupPostgres.cs @@ -18,13 +18,12 @@ public virtual void ConfigureServices(IServiceCollection services) services.AddServiceBricks(Configuration); services.AddServiceBricksLoggingPostgres(Configuration); services.AddCustomWebsite(Configuration); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment webHostEnvironment) { app.StartServiceBricks(); - app.StartServiceBricksLoggingPostgres(); app.StartCustomWebsite(webHostEnvironment); var logger = app.ApplicationServices.GetRequiredService>(); logger.LogInformation("Application Started"); diff --git a/src/V1/Tests/WebAppNet7/StartupSqlServer.cs b/src/V1/Tests/WebAppNet7/StartupSqlServer.cs index 20e2377..67d1548 100644 --- a/src/V1/Tests/WebAppNet7/StartupSqlServer.cs +++ b/src/V1/Tests/WebAppNet7/StartupSqlServer.cs @@ -18,13 +18,12 @@ public virtual void ConfigureServices(IServiceCollection services) services.AddServiceBricks(Configuration); services.AddServiceBricksLoggingSqlServer(Configuration); services.AddCustomWebsite(Configuration); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment webHostEnvironment) { app.StartServiceBricks(); - app.StartServiceBricksLoggingSqlServer(); app.StartCustomWebsite(webHostEnvironment); var logger = app.ApplicationServices.GetRequiredService>(); logger.LogInformation("Application Started"); diff --git a/src/V1/Tests/WebAppNet7/StartupSqlite.cs b/src/V1/Tests/WebAppNet7/StartupSqlite.cs index e281cf9..1cd18ea 100644 --- a/src/V1/Tests/WebAppNet7/StartupSqlite.cs +++ b/src/V1/Tests/WebAppNet7/StartupSqlite.cs @@ -18,13 +18,12 @@ public virtual void ConfigureServices(IServiceCollection services) services.AddServiceBricks(Configuration); services.AddServiceBricksLoggingSqlite(Configuration); services.AddCustomWebsite(Configuration); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment webHostEnvironment) { app.StartServiceBricks(); - app.StartServiceBricksLoggingSqlite(); app.StartCustomWebsite(webHostEnvironment); var logger = app.ApplicationServices.GetRequiredService>(); logger.LogInformation("Application Started"); diff --git a/src/V1/Tests/WebAppNet7/WebAppNet7.csproj b/src/V1/Tests/WebAppNet7/WebAppNet7.csproj index 83a2770..0b59c8e 100644 --- a/src/V1/Tests/WebAppNet7/WebAppNet7.csproj +++ b/src/V1/Tests/WebAppNet7/WebAppNet7.csproj @@ -16,7 +16,7 @@ - + diff --git a/src/V1/Tests/WebAppNet8/Extensions/ServiceCollectionExtensions.cs b/src/V1/Tests/WebAppNet8/Extensions/ServiceCollectionExtensions.cs index 45fba4b..8452c57 100644 --- a/src/V1/Tests/WebAppNet8/Extensions/ServiceCollectionExtensions.cs +++ b/src/V1/Tests/WebAppNet8/Extensions/ServiceCollectionExtensions.cs @@ -10,7 +10,7 @@ public static class ServiceCollectionExtensions public static IServiceCollection AddCustomWebsite(this IServiceCollection services, IConfiguration Configuration) { // Add to module registry - ModuleRegistry.Instance.RegisterItem(typeof(WebAppModule), new WebAppModule()); + ModuleRegistry.Instance.Register(new WebAppModule()); services.AddControllers(); services.AddRazorPages(); diff --git a/src/V1/Tests/WebAppNet8/Model/WebAppModule.cs b/src/V1/Tests/WebAppNet8/Model/WebAppModule.cs index 678f061..0e928d2 100644 --- a/src/V1/Tests/WebAppNet8/Model/WebAppModule.cs +++ b/src/V1/Tests/WebAppNet8/Model/WebAppModule.cs @@ -1,9 +1,8 @@ -using ServiceBricks; -using System.Reflection; +using System.Reflection; namespace WebApp.Model { - public class WebAppModule : IModule + public class WebAppModule : ServiceBricks.Module { public WebAppModule() { @@ -12,11 +11,5 @@ public WebAppModule() typeof(WebAppModule).Assembly }; } - - public List DependentModules { get; set; } - - public List AutomapperAssemblies { get; set; } - - public List ViewAssemblies { get; set; } } } \ No newline at end of file diff --git a/src/V1/Tests/WebAppNet8/StartupAzureDataTables.cs b/src/V1/Tests/WebAppNet8/StartupAzureDataTables.cs index 675f235..072188f 100644 --- a/src/V1/Tests/WebAppNet8/StartupAzureDataTables.cs +++ b/src/V1/Tests/WebAppNet8/StartupAzureDataTables.cs @@ -18,13 +18,12 @@ public virtual void ConfigureServices(IServiceCollection services) services.AddServiceBricks(Configuration); services.AddServiceBricksLoggingAzureDataTables(Configuration); services.AddCustomWebsite(Configuration); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment webHostEnvironment) { app.StartServiceBricks(); - app.StartServiceBricksLoggingAzureDataTables(); app.StartCustomWebsite(webHostEnvironment); var logger = app.ApplicationServices.GetRequiredService>(); logger.LogInformation("Application Started"); diff --git a/src/V1/Tests/WebAppNet8/StartupCosmos.cs b/src/V1/Tests/WebAppNet8/StartupCosmos.cs index 723e705..78f0107 100644 --- a/src/V1/Tests/WebAppNet8/StartupCosmos.cs +++ b/src/V1/Tests/WebAppNet8/StartupCosmos.cs @@ -18,13 +18,12 @@ public virtual void ConfigureServices(IServiceCollection services) services.AddServiceBricks(Configuration); services.AddServiceBricksLoggingCosmos(Configuration); services.AddCustomWebsite(Configuration); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment webHostEnvironment) { app.StartServiceBricks(); - app.StartServiceBricksLoggingCosmos(); app.StartCustomWebsite(webHostEnvironment); var logger = app.ApplicationServices.GetRequiredService>(); logger.LogInformation("Application Started"); diff --git a/src/V1/Tests/WebAppNet8/StartupInMemory.cs b/src/V1/Tests/WebAppNet8/StartupInMemory.cs index 3a66dcd..b945946 100644 --- a/src/V1/Tests/WebAppNet8/StartupInMemory.cs +++ b/src/V1/Tests/WebAppNet8/StartupInMemory.cs @@ -18,13 +18,12 @@ public virtual void ConfigureServices(IServiceCollection services) services.AddServiceBricks(Configuration); services.AddServiceBricksLoggingInMemory(Configuration); services.AddCustomWebsite(Configuration); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment webHostEnvironment) { app.StartServiceBricks(); - app.StartServiceBricksLoggingInMemory(); app.StartCustomWebsite(webHostEnvironment); var logger = app.ApplicationServices.GetRequiredService>(); logger.LogInformation("Application Started"); diff --git a/src/V1/Tests/WebAppNet8/StartupMongoDb.cs b/src/V1/Tests/WebAppNet8/StartupMongoDb.cs index a197741..135792d 100644 --- a/src/V1/Tests/WebAppNet8/StartupMongoDb.cs +++ b/src/V1/Tests/WebAppNet8/StartupMongoDb.cs @@ -18,13 +18,12 @@ public virtual void ConfigureServices(IServiceCollection services) services.AddServiceBricks(Configuration); services.AddServiceBricksLoggingMongoDb(Configuration); services.AddCustomWebsite(Configuration); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment webHostEnvironment) { app.StartServiceBricks(); - app.StartServiceBricksLoggingMongoDb(); app.StartCustomWebsite(webHostEnvironment); var logger = app.ApplicationServices.GetRequiredService>(); logger.LogInformation("Application Started"); diff --git a/src/V1/Tests/WebAppNet8/StartupPostgres.cs b/src/V1/Tests/WebAppNet8/StartupPostgres.cs index d5ae315..30918b2 100644 --- a/src/V1/Tests/WebAppNet8/StartupPostgres.cs +++ b/src/V1/Tests/WebAppNet8/StartupPostgres.cs @@ -18,13 +18,12 @@ public virtual void ConfigureServices(IServiceCollection services) services.AddServiceBricks(Configuration); services.AddServiceBricksLoggingPostgres(Configuration); services.AddCustomWebsite(Configuration); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment webHostEnvironment) { app.StartServiceBricks(); - app.StartServiceBricksLoggingPostgres(); app.StartCustomWebsite(webHostEnvironment); var logger = app.ApplicationServices.GetRequiredService>(); logger.LogInformation("Application Started"); diff --git a/src/V1/Tests/WebAppNet8/StartupSqlServer.cs b/src/V1/Tests/WebAppNet8/StartupSqlServer.cs index 20e2377..67d1548 100644 --- a/src/V1/Tests/WebAppNet8/StartupSqlServer.cs +++ b/src/V1/Tests/WebAppNet8/StartupSqlServer.cs @@ -18,13 +18,12 @@ public virtual void ConfigureServices(IServiceCollection services) services.AddServiceBricks(Configuration); services.AddServiceBricksLoggingSqlServer(Configuration); services.AddCustomWebsite(Configuration); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment webHostEnvironment) { app.StartServiceBricks(); - app.StartServiceBricksLoggingSqlServer(); app.StartCustomWebsite(webHostEnvironment); var logger = app.ApplicationServices.GetRequiredService>(); logger.LogInformation("Application Started"); diff --git a/src/V1/Tests/WebAppNet8/StartupSqlite.cs b/src/V1/Tests/WebAppNet8/StartupSqlite.cs index e281cf9..1cd18ea 100644 --- a/src/V1/Tests/WebAppNet8/StartupSqlite.cs +++ b/src/V1/Tests/WebAppNet8/StartupSqlite.cs @@ -18,13 +18,12 @@ public virtual void ConfigureServices(IServiceCollection services) services.AddServiceBricks(Configuration); services.AddServiceBricksLoggingSqlite(Configuration); services.AddCustomWebsite(Configuration); - services.AddServiceBricksComplete(); + services.AddServiceBricksComplete(Configuration); } public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment webHostEnvironment) { app.StartServiceBricks(); - app.StartServiceBricksLoggingSqlite(); app.StartCustomWebsite(webHostEnvironment); var logger = app.ApplicationServices.GetRequiredService>(); logger.LogInformation("Application Started"); diff --git a/src/V1/Tests/WebAppNet8/WebAppNet8.csproj b/src/V1/Tests/WebAppNet8/WebAppNet8.csproj index 362b941..3946fc9 100644 --- a/src/V1/Tests/WebAppNet8/WebAppNet8.csproj +++ b/src/V1/Tests/WebAppNet8/WebAppNet8.csproj @@ -16,7 +16,7 @@ - +