From a51607852cc15c9e8fafa689d0cb61f6df258bbd Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 2 Mar 2022 19:31:54 +0000 Subject: [PATCH 001/204] * Visual Studio solution file updated from VS 15 (2017) to VS 17 (2022). * Notes added to include features, architecture notes. --- Eisk.WebApi.TemplatePack.sln | 5 +++-- Notes.txt | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 Notes.txt diff --git a/Eisk.WebApi.TemplatePack.sln b/Eisk.WebApi.TemplatePack.sln index 1c103179..97a6c0d3 100644 --- a/Eisk.WebApi.TemplatePack.sln +++ b/Eisk.WebApi.TemplatePack.sln @@ -1,12 +1,13 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26730.8 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.32112.339 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.Core", "Core\Eisk.Core\Eisk.Core.csproj", "{8E6823DD-60AB-4772-AB9C-E5786BEF2B50}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4E93D3D8-EC59-4DE2-A1E1-3F0258277780}" ProjectSection(SolutionItems) = preProject + Notes.txt = Notes.txt .template.config\template.json = .template.config\template.json .template.config\template.vstemplate = .template.config\template.vstemplate EndProjectSection diff --git a/Notes.txt b/Notes.txt new file mode 100644 index 00000000..c5424d33 --- /dev/null +++ b/Notes.txt @@ -0,0 +1,24 @@ +======================================================== +Default set-up + +Api Controller (in memory web) +DomainServices + Unit Tests +DataServices + Integration Tests (in memory db) +======================================================== +Define test strategies +* Api Automated test (RestSharp or postman): minimal +* Domain Service Tests: business logic only (base methods of the domain services should be part of library test) +* Data Service Tests: Infrastructure tests - base tests, custom methods + +======================================================== +Factors + +* In-memory database tests (in CI) +* In-memory web tests (in CI) + +* Database tests (in CD) +* Web UI Tests (in CD) +======================================================== +TODO: +* include instruction for template build and publish +======================================================== \ No newline at end of file From a3c243a7ed1d071990f3221ff7717af9ec26558c Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 8 Mar 2022 15:07:37 +0000 Subject: [PATCH 002/204] Upgraded core library to .NET 6.0. --- .../Eisk.DataServices.Interfaces.csproj | 2 +- .../Eisk.DomainServices.UnitTests.csproj | 2 +- DomainCore/Eisk.DomainServices/Eisk.DomainServices.csproj | 2 +- DomainCore/Eisk.Domains/Eisk.Domains.csproj | 2 +- .../Eisk.DataServices.EFCore.IntegrationTests.Ext.csproj | 2 +- .../Eisk.DataServices.EFCore.IntegrationTests.csproj | 2 +- .../Eisk.DataServices.EFCore.csproj | 2 +- .../Eisk.DomainServices.ComponentTests.EFCore.csproj | 2 +- .../Eisk.EFCore.Setup/Eisk.EFCore.Setup.csproj | 6 +++--- WebApi/Eisk.WebApi/Eisk.WebApi.csproj | 3 +-- 10 files changed, 12 insertions(+), 13 deletions(-) diff --git a/DomainCore/Eisk.DataServices.Interfaces/Eisk.DataServices.Interfaces.csproj b/DomainCore/Eisk.DataServices.Interfaces/Eisk.DataServices.Interfaces.csproj index 84ba9322..e2b6d849 100644 --- a/DomainCore/Eisk.DataServices.Interfaces/Eisk.DataServices.Interfaces.csproj +++ b/DomainCore/Eisk.DataServices.Interfaces/Eisk.DataServices.Interfaces.csproj @@ -1,7 +1,7 @@ - netcoreapp2.0 + net6.0 diff --git a/DomainCore/Eisk.DomainServices.UnitTests/Eisk.DomainServices.UnitTests.csproj b/DomainCore/Eisk.DomainServices.UnitTests/Eisk.DomainServices.UnitTests.csproj index d4cb5f75..77af6d72 100644 --- a/DomainCore/Eisk.DomainServices.UnitTests/Eisk.DomainServices.UnitTests.csproj +++ b/DomainCore/Eisk.DomainServices.UnitTests/Eisk.DomainServices.UnitTests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0 + net6.0 diff --git a/DomainCore/Eisk.DomainServices/Eisk.DomainServices.csproj b/DomainCore/Eisk.DomainServices/Eisk.DomainServices.csproj index 0ff487fd..744fadc1 100644 --- a/DomainCore/Eisk.DomainServices/Eisk.DomainServices.csproj +++ b/DomainCore/Eisk.DomainServices/Eisk.DomainServices.csproj @@ -1,7 +1,7 @@ - netcoreapp2.0 + net6.0 diff --git a/DomainCore/Eisk.Domains/Eisk.Domains.csproj b/DomainCore/Eisk.Domains/Eisk.Domains.csproj index 5766db61..dbc15171 100644 --- a/DomainCore/Eisk.Domains/Eisk.Domains.csproj +++ b/DomainCore/Eisk.Domains/Eisk.Domains.csproj @@ -1,7 +1,7 @@ - netcoreapp2.0 + net6.0 diff --git a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/Eisk.DataServices.EFCore.IntegrationTests.Ext.csproj b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/Eisk.DataServices.EFCore.IntegrationTests.Ext.csproj index f96ba703..33ab725f 100644 --- a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/Eisk.DataServices.EFCore.IntegrationTests.Ext.csproj +++ b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/Eisk.DataServices.EFCore.IntegrationTests.Ext.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0 + net6.0 false diff --git a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/Eisk.DataServices.EFCore.IntegrationTests.csproj b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/Eisk.DataServices.EFCore.IntegrationTests.csproj index f96ba703..33ab725f 100644 --- a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/Eisk.DataServices.EFCore.IntegrationTests.csproj +++ b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/Eisk.DataServices.EFCore.IntegrationTests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0 + net6.0 false diff --git a/Infrastructure.EFCore/Eisk.DataServices.EFCore/Eisk.DataServices.EFCore.csproj b/Infrastructure.EFCore/Eisk.DataServices.EFCore/Eisk.DataServices.EFCore.csproj index 9cdb13f3..aa90495d 100644 --- a/Infrastructure.EFCore/Eisk.DataServices.EFCore/Eisk.DataServices.EFCore.csproj +++ b/Infrastructure.EFCore/Eisk.DataServices.EFCore/Eisk.DataServices.EFCore.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0 + net6.0 diff --git a/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/Eisk.DomainServices.ComponentTests.EFCore.csproj b/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/Eisk.DomainServices.ComponentTests.EFCore.csproj index 79ef495e..b8b34f8a 100644 --- a/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/Eisk.DomainServices.ComponentTests.EFCore.csproj +++ b/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/Eisk.DomainServices.ComponentTests.EFCore.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0 + net6.0 diff --git a/Infrastructure.EFCore/Eisk.EFCore.Setup/Eisk.EFCore.Setup.csproj b/Infrastructure.EFCore/Eisk.EFCore.Setup/Eisk.EFCore.Setup.csproj index 3461a954..355dbce9 100644 --- a/Infrastructure.EFCore/Eisk.EFCore.Setup/Eisk.EFCore.Setup.csproj +++ b/Infrastructure.EFCore/Eisk.EFCore.Setup/Eisk.EFCore.Setup.csproj @@ -1,11 +1,11 @@  - netcoreapp2.0 + net6.0 - - + + diff --git a/WebApi/Eisk.WebApi/Eisk.WebApi.csproj b/WebApi/Eisk.WebApi/Eisk.WebApi.csproj index 2cb8a91e..6c46dc49 100644 --- a/WebApi/Eisk.WebApi/Eisk.WebApi.csproj +++ b/WebApi/Eisk.WebApi/Eisk.WebApi.csproj @@ -1,7 +1,7 @@  - netcoreapp2.0 + net6.0 @@ -12,7 +12,6 @@ - From 395f70d5833f48073fb5723686b85dcf8f706e60 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 8 Mar 2022 15:12:58 +0000 Subject: [PATCH 003/204] Upgraded TemplatePack project to .NET 4.8. --- Eisk.WebApi.TemplatePack/Eisk.WebApi.TemplatePack.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Eisk.WebApi.TemplatePack/Eisk.WebApi.TemplatePack.csproj b/Eisk.WebApi.TemplatePack/Eisk.WebApi.TemplatePack.csproj index 0a6f3df9..73893540 100644 --- a/Eisk.WebApi.TemplatePack/Eisk.WebApi.TemplatePack.csproj +++ b/Eisk.WebApi.TemplatePack/Eisk.WebApi.TemplatePack.csproj @@ -7,6 +7,7 @@ Program $(DevEnvDir)\devenv.exe /rootsuffix Exp + @@ -20,7 +21,7 @@ Properties Eisk.WebApi Eisk.WebApi - v4.6 + v4.8 false false false From 193fe0f0e2c5463540f1d25d4e2d420c882387fc Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 8 Mar 2022 16:51:10 +0000 Subject: [PATCH 004/204] fixed nuget packages issues. --- WebApi/Eisk.WebApi/Eisk.WebApi.csproj | 2 +- WebApi/Eisk.WebApi/Startup.cs | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/WebApi/Eisk.WebApi/Eisk.WebApi.csproj b/WebApi/Eisk.WebApi/Eisk.WebApi.csproj index 6c46dc49..216de2d7 100644 --- a/WebApi/Eisk.WebApi/Eisk.WebApi.csproj +++ b/WebApi/Eisk.WebApi/Eisk.WebApi.csproj @@ -12,7 +12,7 @@ - + diff --git a/WebApi/Eisk.WebApi/Startup.cs b/WebApi/Eisk.WebApi/Startup.cs index fc23e7b4..a8303812 100644 --- a/WebApi/Eisk.WebApi/Startup.cs +++ b/WebApi/Eisk.WebApi/Startup.cs @@ -15,6 +15,9 @@ namespace Eisk.WebApi using DataServices.Interfaces; using DomainServices; using EFCore.Setup; + using Microsoft.AspNetCore.Mvc; + using Microsoft.OpenApi.Models; + using System; public class Startup { @@ -46,22 +49,23 @@ public void ConfigureServices(IServiceCollection services) services.AddScoped(); - services.AddMvc(); + services.AddMvc(option => option.EnableEndpointRouting = false); + // Register the Swagger generator, defining 1 or more Swagger documents services.AddSwaggerGen(c => { - c.SwaggerDoc("v1", new Info + c.SwaggerDoc("v1", new OpenApiInfo { Title = "Eisk.WebApi", Version = "v1.0-preview-1", Description = "EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net core technologies.", - Contact = new Swashbuckle.AspNetCore.Swagger.Contact + Contact = new OpenApiContact { Name = "EISK Web Api", Email = string.Empty, - Url = "https://eisk.github.io/eisk.webapi" + Url = new Uri("https://eisk.github.io/eisk.webapi") } }); }); @@ -88,7 +92,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) c.RoutePrefix = string.Empty; }); - app.UseMvc(); + //app.UseMvc(); } } } From e86b712be4759579bfae779c1972ca85036ec561 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 8 Mar 2022 17:16:44 +0000 Subject: [PATCH 005/204] Upgraded nuget packages --- .../Eisk.DomainServices.UnitTests.csproj | 11 +++++++---- ...sk.DataServices.EFCore.IntegrationTests.Ext.csproj | 9 ++++++--- .../Eisk.DataServices.EFCore.IntegrationTests.csproj | 9 ++++++--- .../Eisk.DomainServices.ComponentTests.EFCore.csproj | 9 ++++++--- .../Eisk.EFCore.Setup/Eisk.EFCore.Setup.csproj | 4 ++-- 5 files changed, 27 insertions(+), 15 deletions(-) diff --git a/DomainCore/Eisk.DomainServices.UnitTests/Eisk.DomainServices.UnitTests.csproj b/DomainCore/Eisk.DomainServices.UnitTests/Eisk.DomainServices.UnitTests.csproj index 77af6d72..1b14413c 100644 --- a/DomainCore/Eisk.DomainServices.UnitTests/Eisk.DomainServices.UnitTests.csproj +++ b/DomainCore/Eisk.DomainServices.UnitTests/Eisk.DomainServices.UnitTests.csproj @@ -5,10 +5,13 @@ - - - - + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/Eisk.DataServices.EFCore.IntegrationTests.Ext.csproj b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/Eisk.DataServices.EFCore.IntegrationTests.Ext.csproj index 33ab725f..d7c63470 100644 --- a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/Eisk.DataServices.EFCore.IntegrationTests.Ext.csproj +++ b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/Eisk.DataServices.EFCore.IntegrationTests.Ext.csproj @@ -7,9 +7,12 @@ - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/Eisk.DataServices.EFCore.IntegrationTests.csproj b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/Eisk.DataServices.EFCore.IntegrationTests.csproj index 33ab725f..d7c63470 100644 --- a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/Eisk.DataServices.EFCore.IntegrationTests.csproj +++ b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/Eisk.DataServices.EFCore.IntegrationTests.csproj @@ -7,9 +7,12 @@ - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/Eisk.DomainServices.ComponentTests.EFCore.csproj b/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/Eisk.DomainServices.ComponentTests.EFCore.csproj index b8b34f8a..e3a051b1 100644 --- a/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/Eisk.DomainServices.ComponentTests.EFCore.csproj +++ b/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/Eisk.DomainServices.ComponentTests.EFCore.csproj @@ -5,9 +5,12 @@ - - - + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + diff --git a/Infrastructure.EFCore/Eisk.EFCore.Setup/Eisk.EFCore.Setup.csproj b/Infrastructure.EFCore/Eisk.EFCore.Setup/Eisk.EFCore.Setup.csproj index 355dbce9..000dbcfa 100644 --- a/Infrastructure.EFCore/Eisk.EFCore.Setup/Eisk.EFCore.Setup.csproj +++ b/Infrastructure.EFCore/Eisk.EFCore.Setup/Eisk.EFCore.Setup.csproj @@ -4,8 +4,8 @@ net6.0 - - + + From 5dcaeb9e03359304112b539f8e3473bd12b9d2e6 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 8 Mar 2022 17:44:28 +0000 Subject: [PATCH 006/204] added second web api project (default) with .net 6.0. --- Eisk.WebApi.TemplatePack.sln | 7 +++ .../Controllers/EmployeesController.cs | 55 ++++++++++++++++++- WebApi/Eisk.WebApi/Program.cs | 45 ++++++++++++++- WebApi/Eisk.WebApi/Startup.cs | 9 ++- .../Controllers/WeatherForecastController.cs | 33 +++++++++++ WebApi/Eisk.WebApi2/Eisk.WebApi2.csproj | 13 +++++ WebApi/Eisk.WebApi2/Program.cs | 25 +++++++++ WebApi/Eisk.WebApi2/WeatherForecast.cs | 13 +++++ .../Eisk.WebApi2/appsettings.Development.json | 8 +++ WebApi/Eisk.WebApi2/appsettings.json | 9 +++ 10 files changed, 209 insertions(+), 8 deletions(-) create mode 100644 WebApi/Eisk.WebApi2/Controllers/WeatherForecastController.cs create mode 100644 WebApi/Eisk.WebApi2/Eisk.WebApi2.csproj create mode 100644 WebApi/Eisk.WebApi2/Program.cs create mode 100644 WebApi/Eisk.WebApi2/WeatherForecast.cs create mode 100644 WebApi/Eisk.WebApi2/appsettings.Development.json create mode 100644 WebApi/Eisk.WebApi2/appsettings.json diff --git a/Eisk.WebApi.TemplatePack.sln b/Eisk.WebApi.TemplatePack.sln index 97a6c0d3..7e23004d 100644 --- a/Eisk.WebApi.TemplatePack.sln +++ b/Eisk.WebApi.TemplatePack.sln @@ -50,6 +50,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DataServices.EFCore.In EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DomainServices.ComponentTests.EFCore", "Infrastructure.EFCore\Eisk.DomainServices.ComponentTests.EFCore\Eisk.DomainServices.ComponentTests.EFCore.csproj", "{CB7B38B4-9AE5-4B86-BC31-CD74F8690D79}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Eisk.WebApi2", "WebApi\Eisk.WebApi2\Eisk.WebApi2.csproj", "{A0B74E35-B472-4F59-9982-D298E4E541CF}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -116,6 +118,10 @@ Global {CB7B38B4-9AE5-4B86-BC31-CD74F8690D79}.Debug|Any CPU.Build.0 = Debug|Any CPU {CB7B38B4-9AE5-4B86-BC31-CD74F8690D79}.Release|Any CPU.ActiveCfg = Release|Any CPU {CB7B38B4-9AE5-4B86-BC31-CD74F8690D79}.Release|Any CPU.Build.0 = Release|Any CPU + {A0B74E35-B472-4F59-9982-D298E4E541CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A0B74E35-B472-4F59-9982-D298E4E541CF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A0B74E35-B472-4F59-9982-D298E4E541CF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A0B74E35-B472-4F59-9982-D298E4E541CF}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -136,6 +142,7 @@ Global {57348807-E087-4B0F-906E-72E4768B693C} = {8D09A735-BB55-4075-9B06-EAAA18F59781} {BB413B48-E598-47C8-AF1B-887203391F8E} = {8D09A735-BB55-4075-9B06-EAAA18F59781} {CB7B38B4-9AE5-4B86-BC31-CD74F8690D79} = {8D09A735-BB55-4075-9B06-EAAA18F59781} + {A0B74E35-B472-4F59-9982-D298E4E541CF} = {9611B3D6-810A-4E98-9166-2DA770E38B81} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4370F72B-9D16-4EBF-8EF5-1F0925FC7CC6} diff --git a/WebApi/Eisk.WebApi/Controllers/EmployeesController.cs b/WebApi/Eisk.WebApi/Controllers/EmployeesController.cs index 86de7260..50d8c8db 100644 --- a/WebApi/Eisk.WebApi/Controllers/EmployeesController.cs +++ b/WebApi/Eisk.WebApi/Controllers/EmployeesController.cs @@ -3,12 +3,63 @@ using Eisk.Core.WebApi; using Domains.Entities; using DomainServices; + using Microsoft.AspNetCore.Mvc; + using System.Collections.Generic; + using System.Threading.Tasks; + using System.Linq; + using System; - public class EmployeesController : WebApiControllerBase + //[ApiController] + //[Route("[controller]")] + //public class EmployeesController : ControllerBase + //{ + // EmployeeDomainService _employeeDomainService; + // public EmployeesController(EmployeeDomainService employeeDomainService) + // { + // _employeeDomainService = employeeDomainService; + // } + + // [HttpGet(Name = "Employees")] + // public IEnumerable Get() + // { + // return _employeeDomainService.GetAll().Result; + // } + //} + + [ApiController] + [Route("[controller]")] + public class WeatherForecastController : ControllerBase { - public EmployeesController(EmployeeDomainService employeeDomainService):base(employeeDomainService) + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"}; + + public WeatherForecastController() { } + + [HttpGet(Name = "GetWeatherForecast")] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateTime.Now.AddDays(index), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = Summaries[Random.Shared.Next(Summaries.Length)] + }) + .ToArray(); + } + } + + public class WeatherForecast + { + public DateTime Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string? Summary { get; set; } } } diff --git a/WebApi/Eisk.WebApi/Program.cs b/WebApi/Eisk.WebApi/Program.cs index baf704e3..e46966a6 100644 --- a/WebApi/Eisk.WebApi/Program.cs +++ b/WebApi/Eisk.WebApi/Program.cs @@ -1,5 +1,10 @@ using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Microsoft.OpenApi.Models; +using System; namespace Eisk.WebApi { @@ -7,7 +12,45 @@ public class Program { public static void Main(string[] args) { - BuildWebHost(args).Run(); + var builder = WebApplication.CreateBuilder(args); + + // Add services to the container. + + builder.Services.AddControllers(); + // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle + builder.Services.AddEndpointsApiExplorer(); + builder.Services.AddSwaggerGen(c => + { + c.SwaggerDoc("v1", new OpenApiInfo + { + Title = "Eisk.WebApi", + Version = "v1.0-preview-1", + Description = "EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net core technologies.", + Contact = new OpenApiContact + { + Name = "EISK Web Api", + Email = string.Empty, + Url = new Uri("https://eisk.github.io/eisk.webapi") + } + }); + }); + + var app = builder.Build(); + + // Configure the HTTP request pipeline. + if (app.Environment.IsDevelopment()) + { + app.UseSwagger(); + app.UseSwaggerUI(); + } + + app.UseHttpsRedirection(); + + app.UseAuthorization(); + + app.MapControllers(); + + app.Run(); } public static IWebHost BuildWebHost(string[] args) => diff --git a/WebApi/Eisk.WebApi/Startup.cs b/WebApi/Eisk.WebApi/Startup.cs index a8303812..bc9cbf54 100644 --- a/WebApi/Eisk.WebApi/Startup.cs +++ b/WebApi/Eisk.WebApi/Startup.cs @@ -33,6 +33,10 @@ public Startup(IHostingEnvironment env, IConfiguration configuration) // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { + services.AddControllers(); + + services.AddEndpointsApiExplorer(); + //generic services services.AddScoped(); @@ -49,9 +53,6 @@ public void ConfigureServices(IServiceCollection services) services.AddScoped(); - services.AddMvc(option => option.EnableEndpointRouting = false); - - // Register the Swagger generator, defining 1 or more Swagger documents services.AddSwaggerGen(c => @@ -91,8 +92,6 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env) c.SwaggerEndpoint("/swagger/v1/swagger.json", "Eisk.WebApi"); c.RoutePrefix = string.Empty; }); - - //app.UseMvc(); } } } diff --git a/WebApi/Eisk.WebApi2/Controllers/WeatherForecastController.cs b/WebApi/Eisk.WebApi2/Controllers/WeatherForecastController.cs new file mode 100644 index 00000000..1e7a7dd4 --- /dev/null +++ b/WebApi/Eisk.WebApi2/Controllers/WeatherForecastController.cs @@ -0,0 +1,33 @@ +using Microsoft.AspNetCore.Mvc; + +namespace Eisk.WebApi2.Controllers +{ + [ApiController] + [Route("[controller]")] + public class WeatherForecastController : ControllerBase + { + private static readonly string[] Summaries = new[] + { + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; + + private readonly ILogger _logger; + + public WeatherForecastController(ILogger logger) + { + _logger = logger; + } + + [HttpGet(Name = "GetWeatherForecast")] + public IEnumerable Get() + { + return Enumerable.Range(1, 5).Select(index => new WeatherForecast + { + Date = DateTime.Now.AddDays(index), + TemperatureC = Random.Shared.Next(-20, 55), + Summary = Summaries[Random.Shared.Next(Summaries.Length)] + }) + .ToArray(); + } + } +} \ No newline at end of file diff --git a/WebApi/Eisk.WebApi2/Eisk.WebApi2.csproj b/WebApi/Eisk.WebApi2/Eisk.WebApi2.csproj new file mode 100644 index 00000000..60bf9ead --- /dev/null +++ b/WebApi/Eisk.WebApi2/Eisk.WebApi2.csproj @@ -0,0 +1,13 @@ + + + + net6.0 + enable + enable + + + + + + + diff --git a/WebApi/Eisk.WebApi2/Program.cs b/WebApi/Eisk.WebApi2/Program.cs new file mode 100644 index 00000000..48863a6d --- /dev/null +++ b/WebApi/Eisk.WebApi2/Program.cs @@ -0,0 +1,25 @@ +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +builder.Services.AddControllers(); +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) +{ + app.UseSwagger(); + app.UseSwaggerUI(); +} + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); diff --git a/WebApi/Eisk.WebApi2/WeatherForecast.cs b/WebApi/Eisk.WebApi2/WeatherForecast.cs new file mode 100644 index 00000000..679b6f45 --- /dev/null +++ b/WebApi/Eisk.WebApi2/WeatherForecast.cs @@ -0,0 +1,13 @@ +namespace Eisk.WebApi2 +{ + public class WeatherForecast + { + public DateTime Date { get; set; } + + public int TemperatureC { get; set; } + + public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); + + public string? Summary { get; set; } + } +} \ No newline at end of file diff --git a/WebApi/Eisk.WebApi2/appsettings.Development.json b/WebApi/Eisk.WebApi2/appsettings.Development.json new file mode 100644 index 00000000..0c208ae9 --- /dev/null +++ b/WebApi/Eisk.WebApi2/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/WebApi/Eisk.WebApi2/appsettings.json b/WebApi/Eisk.WebApi2/appsettings.json new file mode 100644 index 00000000..10f68b8c --- /dev/null +++ b/WebApi/Eisk.WebApi2/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} From 9c34cd02388262cf0aa66b5658b4a4640b8c0d94 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 9 Mar 2022 12:22:29 +0000 Subject: [PATCH 007/204] addeded framework reference for Microsoft.AspNetCore.App in Core library. --- Eisk.WebApi.TemplatePack.sln | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Eisk.WebApi.TemplatePack.sln b/Eisk.WebApi.TemplatePack.sln index 7e23004d..c3c54182 100644 --- a/Eisk.WebApi.TemplatePack.sln +++ b/Eisk.WebApi.TemplatePack.sln @@ -50,7 +50,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DataServices.EFCore.In EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DomainServices.ComponentTests.EFCore", "Infrastructure.EFCore\Eisk.DomainServices.ComponentTests.EFCore\Eisk.DomainServices.ComponentTests.EFCore.csproj", "{CB7B38B4-9AE5-4B86-BC31-CD74F8690D79}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Eisk.WebApi2", "WebApi\Eisk.WebApi2\Eisk.WebApi2.csproj", "{A0B74E35-B472-4F59-9982-D298E4E541CF}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.WebApi2", "WebApi\Eisk.WebApi2\Eisk.WebApi2.csproj", "{8FF598F4-6E2A-4003-A682-6C6EA27FAEEB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -118,10 +118,10 @@ Global {CB7B38B4-9AE5-4B86-BC31-CD74F8690D79}.Debug|Any CPU.Build.0 = Debug|Any CPU {CB7B38B4-9AE5-4B86-BC31-CD74F8690D79}.Release|Any CPU.ActiveCfg = Release|Any CPU {CB7B38B4-9AE5-4B86-BC31-CD74F8690D79}.Release|Any CPU.Build.0 = Release|Any CPU - {A0B74E35-B472-4F59-9982-D298E4E541CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A0B74E35-B472-4F59-9982-D298E4E541CF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A0B74E35-B472-4F59-9982-D298E4E541CF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A0B74E35-B472-4F59-9982-D298E4E541CF}.Release|Any CPU.Build.0 = Release|Any CPU + {8FF598F4-6E2A-4003-A682-6C6EA27FAEEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8FF598F4-6E2A-4003-A682-6C6EA27FAEEB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8FF598F4-6E2A-4003-A682-6C6EA27FAEEB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8FF598F4-6E2A-4003-A682-6C6EA27FAEEB}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -142,7 +142,7 @@ Global {57348807-E087-4B0F-906E-72E4768B693C} = {8D09A735-BB55-4075-9B06-EAAA18F59781} {BB413B48-E598-47C8-AF1B-887203391F8E} = {8D09A735-BB55-4075-9B06-EAAA18F59781} {CB7B38B4-9AE5-4B86-BC31-CD74F8690D79} = {8D09A735-BB55-4075-9B06-EAAA18F59781} - {A0B74E35-B472-4F59-9982-D298E4E541CF} = {9611B3D6-810A-4E98-9166-2DA770E38B81} + {8FF598F4-6E2A-4003-A682-6C6EA27FAEEB} = {9611B3D6-810A-4E98-9166-2DA770E38B81} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4370F72B-9D16-4EBF-8EF5-1F0925FC7CC6} From 11d823020a8bcd18482696119698d1cdbd09558e Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 9 Mar 2022 12:57:20 +0000 Subject: [PATCH 008/204] added employee controller with get method --- .../Controllers/EmployeesController.cs | 28 +++++++++++++++++++ .../Controllers/WeatherForecastController.cs | 4 +-- WebApi/Eisk.WebApi2/Eisk.WebApi2.csproj | 8 ++++++ 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 WebApi/Eisk.WebApi2/Controllers/EmployeesController.cs diff --git a/WebApi/Eisk.WebApi2/Controllers/EmployeesController.cs b/WebApi/Eisk.WebApi2/Controllers/EmployeesController.cs new file mode 100644 index 00000000..c1fb6e68 --- /dev/null +++ b/WebApi/Eisk.WebApi2/Controllers/EmployeesController.cs @@ -0,0 +1,28 @@ +namespace Eisk.WebApi.Controllers +{ + using Eisk.Core.WebApi; + using Domains.Entities; + using DomainServices; + using Microsoft.AspNetCore.Mvc; + using System.Collections.Generic; + using System.Threading.Tasks; + using System.Linq; + using System; + + [ApiController] + [Route("[controller]")] + public class EmployeesController : ControllerBase + { + EmployeeDomainService _employeeDomainService; + public EmployeesController(EmployeeDomainService employeeDomainService) + { + _employeeDomainService = employeeDomainService; + } + + [HttpGet(Name = "Employees")] + public IEnumerable Get() + { + return _employeeDomainService.GetAll().Result; + } + } +} diff --git a/WebApi/Eisk.WebApi2/Controllers/WeatherForecastController.cs b/WebApi/Eisk.WebApi2/Controllers/WeatherForecastController.cs index 1e7a7dd4..132dfc0d 100644 --- a/WebApi/Eisk.WebApi2/Controllers/WeatherForecastController.cs +++ b/WebApi/Eisk.WebApi2/Controllers/WeatherForecastController.cs @@ -8,8 +8,8 @@ public class WeatherForecastController : ControllerBase { private static readonly string[] Summaries = new[] { - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - }; + "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" + }; private readonly ILogger _logger; diff --git a/WebApi/Eisk.WebApi2/Eisk.WebApi2.csproj b/WebApi/Eisk.WebApi2/Eisk.WebApi2.csproj index 60bf9ead..c900c905 100644 --- a/WebApi/Eisk.WebApi2/Eisk.WebApi2.csproj +++ b/WebApi/Eisk.WebApi2/Eisk.WebApi2.csproj @@ -10,4 +10,12 @@ + + + + + + + + From 88aec7b1691a45a3ce27c4121901ffeb9f59fb1f Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 9 Mar 2022 13:31:52 +0000 Subject: [PATCH 009/204] added dependency injection for employee controller --- WebApi/Eisk.WebApi2/Program.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/WebApi/Eisk.WebApi2/Program.cs b/WebApi/Eisk.WebApi2/Program.cs index 48863a6d..4a3aaa46 100644 --- a/WebApi/Eisk.WebApi2/Program.cs +++ b/WebApi/Eisk.WebApi2/Program.cs @@ -1,3 +1,9 @@ +using Eisk.DataServices.EFCore; +using Eisk.DataServices.EFCore.DataContext; +using Eisk.DataServices.Interfaces; +using Eisk.DomainServices; +using Eisk.EFCore.Setup; + var builder = WebApplication.CreateBuilder(args); // Add services to the container. @@ -7,6 +13,12 @@ builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); +//custom services + +builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); + var app = builder.Build(); // Configure the HTTP request pipeline. From 379331e58c6be96fa4a236408311bbe6f9b6d98f Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 9 Mar 2022 13:37:52 +0000 Subject: [PATCH 010/204] included based controller for employee class --- .../Eisk.WebApi2/Controllers/EmployeesController.cs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/WebApi/Eisk.WebApi2/Controllers/EmployeesController.cs b/WebApi/Eisk.WebApi2/Controllers/EmployeesController.cs index c1fb6e68..28de0ff4 100644 --- a/WebApi/Eisk.WebApi2/Controllers/EmployeesController.cs +++ b/WebApi/Eisk.WebApi2/Controllers/EmployeesController.cs @@ -11,18 +11,12 @@ [ApiController] [Route("[controller]")] - public class EmployeesController : ControllerBase + public class EmployeesController : WebApiControllerBase { EmployeeDomainService _employeeDomainService; - public EmployeesController(EmployeeDomainService employeeDomainService) + public EmployeesController(EmployeeDomainService employeeDomainService):base(employeeDomainService) { - _employeeDomainService = employeeDomainService; - } - - [HttpGet(Name = "Employees")] - public IEnumerable Get() - { - return _employeeDomainService.GetAll().Result; + } } } From 6e24b26a1ae4192d5d10b3e6e58eab144cafd49f Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 9 Mar 2022 13:41:43 +0000 Subject: [PATCH 011/204] refactored eisk web project to exclude unnecessary files. --- Eisk.WebApi.TemplatePack.sln | 19 ++-- .../Controllers/EmployeesController.cs | 52 +--------- WebApi/Eisk.WebApi/Eisk.WebApi.csproj | 17 +--- WebApi/Eisk.WebApi/Program.cs | 94 +++++++----------- WebApi/Eisk.WebApi/Startup.cs | 97 ------------------- .../Eisk.WebApi/appsettings.Development.json | 8 +- WebApi/Eisk.WebApi/appsettings.json | 13 +-- .../Controllers/EmployeesController.cs | 22 ----- .../Controllers/WeatherForecastController.cs | 33 ------- WebApi/Eisk.WebApi2/Eisk.WebApi2.csproj | 21 ---- WebApi/Eisk.WebApi2/Program.cs | 37 ------- WebApi/Eisk.WebApi2/WeatherForecast.cs | 13 --- .../Eisk.WebApi2/appsettings.Development.json | 8 -- WebApi/Eisk.WebApi2/appsettings.json | 9 -- 14 files changed, 55 insertions(+), 388 deletions(-) delete mode 100644 WebApi/Eisk.WebApi/Startup.cs delete mode 100644 WebApi/Eisk.WebApi2/Controllers/EmployeesController.cs delete mode 100644 WebApi/Eisk.WebApi2/Controllers/WeatherForecastController.cs delete mode 100644 WebApi/Eisk.WebApi2/Eisk.WebApi2.csproj delete mode 100644 WebApi/Eisk.WebApi2/Program.cs delete mode 100644 WebApi/Eisk.WebApi2/WeatherForecast.cs delete mode 100644 WebApi/Eisk.WebApi2/appsettings.Development.json delete mode 100644 WebApi/Eisk.WebApi2/appsettings.json diff --git a/Eisk.WebApi.TemplatePack.sln b/Eisk.WebApi.TemplatePack.sln index c3c54182..8958529c 100644 --- a/Eisk.WebApi.TemplatePack.sln +++ b/Eisk.WebApi.TemplatePack.sln @@ -22,8 +22,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{CEBF47DF-D EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test.Core", "Test.Core", "{16043213-DF69-4E37-98E1-2C86C410551B}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.WebApi", "WebApi\Eisk.WebApi\Eisk.WebApi.csproj", "{99D535CA-1DE1-459B-8ECC-B4F6936F5142}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebApi", "WebApi", "{9611B3D6-810A-4E98-9166-2DA770E38B81}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastructure", "{8D09A735-BB55-4075-9B06-EAAA18F59781}" @@ -50,7 +48,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DataServices.EFCore.In EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DomainServices.ComponentTests.EFCore", "Infrastructure.EFCore\Eisk.DomainServices.ComponentTests.EFCore\Eisk.DomainServices.ComponentTests.EFCore.csproj", "{CB7B38B4-9AE5-4B86-BC31-CD74F8690D79}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.WebApi2", "WebApi\Eisk.WebApi2\Eisk.WebApi2.csproj", "{8FF598F4-6E2A-4003-A682-6C6EA27FAEEB}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.WebApi", "WebApi\Eisk.WebApi\Eisk.WebApi.csproj", "{B99A94EA-9D76-4C67-88E2-A1814930E8B5}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -74,10 +72,6 @@ Global {DCDCAE0A-4CF7-44CA-96A1-BDD70087D575}.Debug|Any CPU.Build.0 = Debug|Any CPU {DCDCAE0A-4CF7-44CA-96A1-BDD70087D575}.Release|Any CPU.ActiveCfg = Release|Any CPU {DCDCAE0A-4CF7-44CA-96A1-BDD70087D575}.Release|Any CPU.Build.0 = Release|Any CPU - {99D535CA-1DE1-459B-8ECC-B4F6936F5142}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {99D535CA-1DE1-459B-8ECC-B4F6936F5142}.Debug|Any CPU.Build.0 = Debug|Any CPU - {99D535CA-1DE1-459B-8ECC-B4F6936F5142}.Release|Any CPU.ActiveCfg = Release|Any CPU - {99D535CA-1DE1-459B-8ECC-B4F6936F5142}.Release|Any CPU.Build.0 = Release|Any CPU {8824BF10-E351-4F9E-B462-B86F51CA234E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8824BF10-E351-4F9E-B462-B86F51CA234E}.Debug|Any CPU.Build.0 = Debug|Any CPU {8824BF10-E351-4F9E-B462-B86F51CA234E}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -118,10 +112,10 @@ Global {CB7B38B4-9AE5-4B86-BC31-CD74F8690D79}.Debug|Any CPU.Build.0 = Debug|Any CPU {CB7B38B4-9AE5-4B86-BC31-CD74F8690D79}.Release|Any CPU.ActiveCfg = Release|Any CPU {CB7B38B4-9AE5-4B86-BC31-CD74F8690D79}.Release|Any CPU.Build.0 = Release|Any CPU - {8FF598F4-6E2A-4003-A682-6C6EA27FAEEB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8FF598F4-6E2A-4003-A682-6C6EA27FAEEB}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8FF598F4-6E2A-4003-A682-6C6EA27FAEEB}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8FF598F4-6E2A-4003-A682-6C6EA27FAEEB}.Release|Any CPU.Build.0 = Release|Any CPU + {B99A94EA-9D76-4C67-88E2-A1814930E8B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B99A94EA-9D76-4C67-88E2-A1814930E8B5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B99A94EA-9D76-4C67-88E2-A1814930E8B5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B99A94EA-9D76-4C67-88E2-A1814930E8B5}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -132,7 +126,6 @@ Global {1BC9EBFE-A17A-43FB-AB9D-C429CCD8020D} = {CEBF47DF-D79A-4AE0-A857-A51D438E3C39} {DCDCAE0A-4CF7-44CA-96A1-BDD70087D575} = {16043213-DF69-4E37-98E1-2C86C410551B} {16043213-DF69-4E37-98E1-2C86C410551B} = {CEBF47DF-D79A-4AE0-A857-A51D438E3C39} - {99D535CA-1DE1-459B-8ECC-B4F6936F5142} = {9611B3D6-810A-4E98-9166-2DA770E38B81} {EC2CC663-1674-4F39-B3A5-926F3A83094A} = {07B09CE7-77B7-4F0F-9BF1-1CA13B8501D8} {ABA6FD15-BB90-478E-91F1-7A8E5708DCDF} = {07B09CE7-77B7-4F0F-9BF1-1CA13B8501D8} {19C8978D-7873-4306-B498-6D29C2F0013E} = {07B09CE7-77B7-4F0F-9BF1-1CA13B8501D8} @@ -142,7 +135,7 @@ Global {57348807-E087-4B0F-906E-72E4768B693C} = {8D09A735-BB55-4075-9B06-EAAA18F59781} {BB413B48-E598-47C8-AF1B-887203391F8E} = {8D09A735-BB55-4075-9B06-EAAA18F59781} {CB7B38B4-9AE5-4B86-BC31-CD74F8690D79} = {8D09A735-BB55-4075-9B06-EAAA18F59781} - {8FF598F4-6E2A-4003-A682-6C6EA27FAEEB} = {9611B3D6-810A-4E98-9166-2DA770E38B81} + {B99A94EA-9D76-4C67-88E2-A1814930E8B5} = {9611B3D6-810A-4E98-9166-2DA770E38B81} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4370F72B-9D16-4EBF-8EF5-1F0925FC7CC6} diff --git a/WebApi/Eisk.WebApi/Controllers/EmployeesController.cs b/WebApi/Eisk.WebApi/Controllers/EmployeesController.cs index 50d8c8db..3e8d6ae2 100644 --- a/WebApi/Eisk.WebApi/Controllers/EmployeesController.cs +++ b/WebApi/Eisk.WebApi/Controllers/EmployeesController.cs @@ -4,62 +4,14 @@ using Domains.Entities; using DomainServices; using Microsoft.AspNetCore.Mvc; - using System.Collections.Generic; - using System.Threading.Tasks; - using System.Linq; - using System; - - //[ApiController] - //[Route("[controller]")] - //public class EmployeesController : ControllerBase - //{ - // EmployeeDomainService _employeeDomainService; - // public EmployeesController(EmployeeDomainService employeeDomainService) - // { - // _employeeDomainService = employeeDomainService; - // } - - // [HttpGet(Name = "Employees")] - // public IEnumerable Get() - // { - // return _employeeDomainService.GetAll().Result; - // } - //} [ApiController] [Route("[controller]")] - public class WeatherForecastController : ControllerBase + public class EmployeesController : WebApiControllerBase { - private static readonly string[] Summaries = new[] - { - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"}; - - public WeatherForecastController() + public EmployeesController(EmployeeDomainService employeeDomainService):base(employeeDomainService) { } - - [HttpGet(Name = "GetWeatherForecast")] - public IEnumerable Get() - { - return Enumerable.Range(1, 5).Select(index => new WeatherForecast - { - Date = DateTime.Now.AddDays(index), - TemperatureC = Random.Shared.Next(-20, 55), - Summary = Summaries[Random.Shared.Next(Summaries.Length)] - }) - .ToArray(); - } - } - - public class WeatherForecast - { - public DateTime Date { get; set; } - - public int TemperatureC { get; set; } - - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - - public string? Summary { get; set; } } } diff --git a/WebApi/Eisk.WebApi/Eisk.WebApi.csproj b/WebApi/Eisk.WebApi/Eisk.WebApi.csproj index 216de2d7..c900c905 100644 --- a/WebApi/Eisk.WebApi/Eisk.WebApi.csproj +++ b/WebApi/Eisk.WebApi/Eisk.WebApi.csproj @@ -1,22 +1,13 @@ - + net6.0 + enable + enable - - - - - - - - - - - - + diff --git a/WebApi/Eisk.WebApi/Program.cs b/WebApi/Eisk.WebApi/Program.cs index e46966a6..4a3aaa46 100644 --- a/WebApi/Eisk.WebApi/Program.cs +++ b/WebApi/Eisk.WebApi/Program.cs @@ -1,61 +1,37 @@ -using Microsoft.AspNetCore; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using Microsoft.OpenApi.Models; -using System; - -namespace Eisk.WebApi +using Eisk.DataServices.EFCore; +using Eisk.DataServices.EFCore.DataContext; +using Eisk.DataServices.Interfaces; +using Eisk.DomainServices; +using Eisk.EFCore.Setup; + +var builder = WebApplication.CreateBuilder(args); + +// Add services to the container. + +builder.Services.AddControllers(); +// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle +builder.Services.AddEndpointsApiExplorer(); +builder.Services.AddSwaggerGen(); + +//custom services + +builder.Services.AddScoped(); +builder.Services.AddScoped(); +builder.Services.AddScoped(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (app.Environment.IsDevelopment()) { - public class Program - { - public static void Main(string[] args) - { - var builder = WebApplication.CreateBuilder(args); - - // Add services to the container. - - builder.Services.AddControllers(); - // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle - builder.Services.AddEndpointsApiExplorer(); - builder.Services.AddSwaggerGen(c => - { - c.SwaggerDoc("v1", new OpenApiInfo - { - Title = "Eisk.WebApi", - Version = "v1.0-preview-1", - Description = "EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net core technologies.", - Contact = new OpenApiContact - { - Name = "EISK Web Api", - Email = string.Empty, - Url = new Uri("https://eisk.github.io/eisk.webapi") - } - }); - }); - - var app = builder.Build(); - - // Configure the HTTP request pipeline. - if (app.Environment.IsDevelopment()) - { - app.UseSwagger(); - app.UseSwaggerUI(); - } - - app.UseHttpsRedirection(); - - app.UseAuthorization(); - - app.MapControllers(); - - app.Run(); - } - - public static IWebHost BuildWebHost(string[] args) => - WebHost.CreateDefaultBuilder(args) - .UseStartup() - .Build(); - } + app.UseSwagger(); + app.UseSwaggerUI(); } + +app.UseHttpsRedirection(); + +app.UseAuthorization(); + +app.MapControllers(); + +app.Run(); diff --git a/WebApi/Eisk.WebApi/Startup.cs b/WebApi/Eisk.WebApi/Startup.cs deleted file mode 100644 index bc9cbf54..00000000 --- a/WebApi/Eisk.WebApi/Startup.cs +++ /dev/null @@ -1,97 +0,0 @@ -using Eisk.Core.DataService.EFCore; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Swashbuckle.AspNetCore.Swagger; - -namespace Eisk.WebApi -{ - using Core.DataService; - using Core.DomainService; - using Eisk.DataServices.EFCore; - using Eisk.DataServices.EFCore.DataContext; - using DataServices.Interfaces; - using DomainServices; - using EFCore.Setup; - using Microsoft.AspNetCore.Mvc; - using Microsoft.OpenApi.Models; - using System; - - public class Startup - { - public Startup(IHostingEnvironment env, IConfiguration configuration) - { - Configuration = configuration; - - DbContextDataInitializer.Initialize(new InMemoryDbContext()); - } - - public IConfiguration Configuration { get; } - - // This method gets called by the runtime. Use this method to add services to the container. - public void ConfigureServices(IServiceCollection services) - { - services.AddControllers(); - - services.AddEndpointsApiExplorer(); - - //generic services - - services.AddScoped(); - - services.AddScoped(typeof(IEntityDataService<>), typeof(EntityDataService<>)); - - services.AddScoped(typeof(DomainService<,>)); - - //custom services - - services.AddScoped(); - - services.AddScoped(); - - services.AddScoped(); - - // Register the Swagger generator, defining 1 or more Swagger documents - - services.AddSwaggerGen(c => - { - c.SwaggerDoc("v1", new OpenApiInfo - { - Title = "Eisk.WebApi", - Version = "v1.0-preview-1", - Description = "EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net core technologies.", - Contact = new OpenApiContact - { - Name = "EISK Web Api", - Email = string.Empty, - Url = new Uri("https://eisk.github.io/eisk.webapi") - } - }); - }); - - } - - - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env) - { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } - - // Enable middleware to serve generated Swagger as a JSON endpoint. - app.UseSwagger(); - - // Enable middleware to serve swagger-ui (HTML, JS, CSS, etc.), - // specifying the Swagger JSON endpoint. - app.UseSwaggerUI(c => - { - c.SwaggerEndpoint("/swagger/v1/swagger.json", "Eisk.WebApi"); - c.RoutePrefix = string.Empty; - }); - } - } -} diff --git a/WebApi/Eisk.WebApi/appsettings.Development.json b/WebApi/Eisk.WebApi/appsettings.Development.json index fa8ce71a..0c208ae9 100644 --- a/WebApi/Eisk.WebApi/appsettings.Development.json +++ b/WebApi/Eisk.WebApi/appsettings.Development.json @@ -1,10 +1,8 @@ -{ +{ "Logging": { - "IncludeScopes": false, "LogLevel": { - "Default": "Debug", - "System": "Information", - "Microsoft": "Information" + "Default": "Information", + "Microsoft.AspNetCore": "Warning" } } } diff --git a/WebApi/Eisk.WebApi/appsettings.json b/WebApi/Eisk.WebApi/appsettings.json index c85ef4af..10f68b8c 100644 --- a/WebApi/Eisk.WebApi/appsettings.json +++ b/WebApi/Eisk.WebApi/appsettings.json @@ -1,12 +1,9 @@ -{ - "ConnectionStrings": { - "DefaultSqlConnection": "Server=(localdb)\\mssqllocaldb;Database=EiskDb;Trusted_Connection=True;MultipleActiveResultSets=true" - }, - +{ "Logging": { - "IncludeScopes": false, "LogLevel": { - "Default": "Warning" + "Default": "Information", + "Microsoft.AspNetCore": "Warning" } - } + }, + "AllowedHosts": "*" } diff --git a/WebApi/Eisk.WebApi2/Controllers/EmployeesController.cs b/WebApi/Eisk.WebApi2/Controllers/EmployeesController.cs deleted file mode 100644 index 28de0ff4..00000000 --- a/WebApi/Eisk.WebApi2/Controllers/EmployeesController.cs +++ /dev/null @@ -1,22 +0,0 @@ -namespace Eisk.WebApi.Controllers -{ - using Eisk.Core.WebApi; - using Domains.Entities; - using DomainServices; - using Microsoft.AspNetCore.Mvc; - using System.Collections.Generic; - using System.Threading.Tasks; - using System.Linq; - using System; - - [ApiController] - [Route("[controller]")] - public class EmployeesController : WebApiControllerBase - { - EmployeeDomainService _employeeDomainService; - public EmployeesController(EmployeeDomainService employeeDomainService):base(employeeDomainService) - { - - } - } -} diff --git a/WebApi/Eisk.WebApi2/Controllers/WeatherForecastController.cs b/WebApi/Eisk.WebApi2/Controllers/WeatherForecastController.cs deleted file mode 100644 index 132dfc0d..00000000 --- a/WebApi/Eisk.WebApi2/Controllers/WeatherForecastController.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Microsoft.AspNetCore.Mvc; - -namespace Eisk.WebApi2.Controllers -{ - [ApiController] - [Route("[controller]")] - public class WeatherForecastController : ControllerBase - { - private static readonly string[] Summaries = new[] - { - "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" - }; - - private readonly ILogger _logger; - - public WeatherForecastController(ILogger logger) - { - _logger = logger; - } - - [HttpGet(Name = "GetWeatherForecast")] - public IEnumerable Get() - { - return Enumerable.Range(1, 5).Select(index => new WeatherForecast - { - Date = DateTime.Now.AddDays(index), - TemperatureC = Random.Shared.Next(-20, 55), - Summary = Summaries[Random.Shared.Next(Summaries.Length)] - }) - .ToArray(); - } - } -} \ No newline at end of file diff --git a/WebApi/Eisk.WebApi2/Eisk.WebApi2.csproj b/WebApi/Eisk.WebApi2/Eisk.WebApi2.csproj deleted file mode 100644 index c900c905..00000000 --- a/WebApi/Eisk.WebApi2/Eisk.WebApi2.csproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - net6.0 - enable - enable - - - - - - - - - - - - - - - diff --git a/WebApi/Eisk.WebApi2/Program.cs b/WebApi/Eisk.WebApi2/Program.cs deleted file mode 100644 index 4a3aaa46..00000000 --- a/WebApi/Eisk.WebApi2/Program.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Eisk.DataServices.EFCore; -using Eisk.DataServices.EFCore.DataContext; -using Eisk.DataServices.Interfaces; -using Eisk.DomainServices; -using Eisk.EFCore.Setup; - -var builder = WebApplication.CreateBuilder(args); - -// Add services to the container. - -builder.Services.AddControllers(); -// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle -builder.Services.AddEndpointsApiExplorer(); -builder.Services.AddSwaggerGen(); - -//custom services - -builder.Services.AddScoped(); -builder.Services.AddScoped(); -builder.Services.AddScoped(); - -var app = builder.Build(); - -// Configure the HTTP request pipeline. -if (app.Environment.IsDevelopment()) -{ - app.UseSwagger(); - app.UseSwaggerUI(); -} - -app.UseHttpsRedirection(); - -app.UseAuthorization(); - -app.MapControllers(); - -app.Run(); diff --git a/WebApi/Eisk.WebApi2/WeatherForecast.cs b/WebApi/Eisk.WebApi2/WeatherForecast.cs deleted file mode 100644 index 679b6f45..00000000 --- a/WebApi/Eisk.WebApi2/WeatherForecast.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Eisk.WebApi2 -{ - public class WeatherForecast - { - public DateTime Date { get; set; } - - public int TemperatureC { get; set; } - - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); - - public string? Summary { get; set; } - } -} \ No newline at end of file diff --git a/WebApi/Eisk.WebApi2/appsettings.Development.json b/WebApi/Eisk.WebApi2/appsettings.Development.json deleted file mode 100644 index 0c208ae9..00000000 --- a/WebApi/Eisk.WebApi2/appsettings.Development.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - } -} diff --git a/WebApi/Eisk.WebApi2/appsettings.json b/WebApi/Eisk.WebApi2/appsettings.json deleted file mode 100644 index 10f68b8c..00000000 --- a/WebApi/Eisk.WebApi2/appsettings.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "AllowedHosts": "*" -} From aed142b316caeb7908212923f65c7b1fbcfb8c4e Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 9 Mar 2022 13:45:20 +0000 Subject: [PATCH 012/204] addd Swagger OpenAPI Contact details. --- WebApi/Eisk.WebApi/Program.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/WebApi/Eisk.WebApi/Program.cs b/WebApi/Eisk.WebApi/Program.cs index 4a3aaa46..d2a7e444 100644 --- a/WebApi/Eisk.WebApi/Program.cs +++ b/WebApi/Eisk.WebApi/Program.cs @@ -3,6 +3,7 @@ using Eisk.DataServices.Interfaces; using Eisk.DomainServices; using Eisk.EFCore.Setup; +using Microsoft.OpenApi.Models; var builder = WebApplication.CreateBuilder(args); @@ -11,7 +12,21 @@ builder.Services.AddControllers(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); -builder.Services.AddSwaggerGen(); +builder.Services.AddSwaggerGen(c => +{ + c.SwaggerDoc("v1", new OpenApiInfo + { + Title = "Eisk.WebApi", + Version = "v1.1", + Description = "EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net core technologies.", + Contact = new OpenApiContact + { + Name = "EISK Web Api", + Email = string.Empty, + Url = new Uri("https://eisk.github.io/eisk.webapi") + } + }); +}); //custom services From 5b1e6ec57e0ae8f185ad4bad6f463592733ffc5e Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 9 Mar 2022 13:48:16 +0000 Subject: [PATCH 013/204] added test data utility call --- WebApi/Eisk.WebApi/Program.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/WebApi/Eisk.WebApi/Program.cs b/WebApi/Eisk.WebApi/Program.cs index d2a7e444..9a3dc264 100644 --- a/WebApi/Eisk.WebApi/Program.cs +++ b/WebApi/Eisk.WebApi/Program.cs @@ -34,6 +34,8 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); +DbContextDataInitializer.Initialize(new InMemoryDbContext()); + var app = builder.Build(); // Configure the HTTP request pipeline. From dd673b742a7f058575c542ca1adf25317a17f466 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 9 Mar 2022 13:50:50 +0000 Subject: [PATCH 014/204] added additional notes for to do items --- Notes.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Notes.txt b/Notes.txt index c5424d33..8ecc6ab6 100644 --- a/Notes.txt +++ b/Notes.txt @@ -21,4 +21,13 @@ Factors ======================================================== TODO: * include instruction for template build and publish +======================================================== +TODO: + +Code +* added exception handler for controller + +Others +* check better way to handle exception classes +* test post and update methods ======================================================== \ No newline at end of file From 74631c2969052b02a5a535b03a92391c1259fa42 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 9 Mar 2022 16:43:03 +0000 Subject: [PATCH 015/204] added notes and version number to 2.0 --- .../Eisk.WebApi.TemplatePack.csproj | 1 + Eisk.WebApi.TemplatePack/README.txt | 13 +++++++++++++ .../source.extension.vsixmanifest | 2 +- Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj | 2 +- Notes.txt | 7 +++++++ WebApi/Eisk.WebApi/Program.cs | 2 +- 6 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 Eisk.WebApi.TemplatePack/README.txt diff --git a/Eisk.WebApi.TemplatePack/Eisk.WebApi.TemplatePack.csproj b/Eisk.WebApi.TemplatePack/Eisk.WebApi.TemplatePack.csproj index 73893540..f541917d 100644 --- a/Eisk.WebApi.TemplatePack/Eisk.WebApi.TemplatePack.csproj +++ b/Eisk.WebApi.TemplatePack/Eisk.WebApi.TemplatePack.csproj @@ -63,6 +63,7 @@ + true diff --git a/Eisk.WebApi.TemplatePack/README.txt b/Eisk.WebApi.TemplatePack/README.txt new file mode 100644 index 00000000..a2a40dff --- /dev/null +++ b/Eisk.WebApi.TemplatePack/README.txt @@ -0,0 +1,13 @@ +========================================= +Build, Publish and Test Nuget Package (dotnet) + +========================================= +Build, Publish and Test VSIX + +========================================= +Build, Publish and Test Github Release + +========================================= +Build, Publish and Test Github Release + +========================================= \ No newline at end of file diff --git a/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest b/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest index 3032b169..c32e642a 100644 --- a/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest +++ b/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest @@ -1,7 +1,7 @@ - + Eisk.WebApi Project template with simple CRUD to get started ASP.NET Web Api quickly. diff --git a/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj b/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj index b751ffbf..df7df033 100644 --- a/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj +++ b/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj @@ -9,7 +9,7 @@ Ashraf Alam Project template with simple CRUD to get started ASP.NET Web Api quickly. - 1.0.6 + 2.0.0 diff --git a/Notes.txt b/Notes.txt index 8ecc6ab6..d72c571c 100644 --- a/Notes.txt +++ b/Notes.txt @@ -27,6 +27,13 @@ TODO: Code * added exception handler for controller +CI/CD +DONE * Fix github connection +DONE * Install Github App in Azure +IN PROGRESS * Fix CI issue (template) +* Fix CI issue (core) +* Fix CI issue (docs) + Others * check better way to handle exception classes * test post and update methods diff --git a/WebApi/Eisk.WebApi/Program.cs b/WebApi/Eisk.WebApi/Program.cs index 9a3dc264..ef175759 100644 --- a/WebApi/Eisk.WebApi/Program.cs +++ b/WebApi/Eisk.WebApi/Program.cs @@ -17,7 +17,7 @@ c.SwaggerDoc("v1", new OpenApiInfo { Title = "Eisk.WebApi", - Version = "v1.1", + Version = "v2.0", Description = "EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net core technologies.", Contact = new OpenApiContact { From 02fce5fa0e04d735272f6d22e570e5647906bb48 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 9 Mar 2022 16:43:58 +0000 Subject: [PATCH 016/204] updated notes --- Notes.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Notes.txt b/Notes.txt index d72c571c..9dc931c0 100644 --- a/Notes.txt +++ b/Notes.txt @@ -24,15 +24,16 @@ TODO: ======================================================== TODO: -Code -* added exception handler for controller - CI/CD DONE * Fix github connection DONE * Install Github App in Azure IN PROGRESS * Fix CI issue (template) * Fix CI issue (core) * Fix CI issue (docs) +* Run template builder locally + +Code +* added exception handler for controller Others * check better way to handle exception classes From c9ed91afb282328b115ccea9db548646a5e48cd9 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Thu, 10 Mar 2022 16:45:00 +0000 Subject: [PATCH 017/204] added notes --- Notes.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Notes.txt b/Notes.txt index 9dc931c0..144e93ac 100644 --- a/Notes.txt +++ b/Notes.txt @@ -33,7 +33,10 @@ IN PROGRESS * Fix CI issue (template) * Run template builder locally Code +* fix unit tests * added exception handler for controller +* add log functionality +* apply custom business logic Others * check better way to handle exception classes From 7ee78b9cd75919096139bc85e3e229fde2eb6833 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 16 Mar 2022 14:55:44 +0000 Subject: [PATCH 018/204] - updating core reference --- Core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core b/Core index bd729e7c..cc553aad 160000 --- a/Core +++ b/Core @@ -1 +1 @@ -Subproject commit bd729e7c1b801066be71cbaf36fc6008ea926d56 +Subproject commit cc553aadd4ea309fca1f815f53fc8e4ff4abecb2 From d2c089523c88cfbab5b65594559fb0f5657524b6 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 16 Mar 2022 15:31:05 +0000 Subject: [PATCH 019/204] -- updated swagger reference --- WebApi/Eisk.WebApi/Program.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/WebApi/Eisk.WebApi/Program.cs b/WebApi/Eisk.WebApi/Program.cs index ef175759..0a8d1a38 100644 --- a/WebApi/Eisk.WebApi/Program.cs +++ b/WebApi/Eisk.WebApi/Program.cs @@ -42,7 +42,11 @@ if (app.Environment.IsDevelopment()) { app.UseSwagger(); - app.UseSwaggerUI(); + app.UseSwaggerUI(options => + { + options.SwaggerEndpoint("/swagger/v1/swagger.json", "v2"); + options.RoutePrefix = string.Empty; + }); } app.UseHttpsRedirection(); From 6173c9a7a0c997abf32549032d9ee7314b0b6a93 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 22 Mar 2022 18:01:15 +0000 Subject: [PATCH 020/204] Updated notes with CI/CD status --- Notes.txt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Notes.txt b/Notes.txt index 144e93ac..002ad292 100644 --- a/Notes.txt +++ b/Notes.txt @@ -20,25 +20,26 @@ Factors * Web UI Tests (in CD) ======================================================== TODO: -* include instruction for template build and publish -======================================================== -TODO: -CI/CD +CI/CD (Remote) DONE * Fix github connection DONE * Install Github App in Azure -IN PROGRESS * Fix CI issue (template) -* Fix CI issue (core) -* Fix CI issue (docs) +DONE * Fix CI issue (core) +DONE * Fix CI issue (template) +DONE * Fix CI issue (docs) + +Build / packagaing * Run template builder locally +* Run docs locally Code -* fix unit tests +DONE * fix unit tests * added exception handler for controller * add log functionality * apply custom business logic Others +* include instruction for template build and publish * check better way to handle exception classes * test post and update methods ======================================================== \ No newline at end of file From 60154be88f8d86819a4c7107810aba69d8657e21 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 23 Mar 2022 18:55:26 +0000 Subject: [PATCH 021/204] Added notes for modules and documentation roadmap. --- Notes.txt | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 103 insertions(+), 1 deletion(-) diff --git a/Notes.txt b/Notes.txt index 002ad292..c77ac54a 100644 --- a/Notes.txt +++ b/Notes.txt @@ -29,8 +29,8 @@ DONE * Fix CI issue (template) DONE * Fix CI issue (docs) Build / packagaing +DONE * Run docs locally * Run template builder locally -* Run docs locally Code DONE * fix unit tests @@ -39,7 +39,109 @@ DONE * fix unit tests * apply custom business logic Others +* Finalize versioning * include instruction for template build and publish * check better way to handle exception classes * test post and update methods +======================================================== +DOCS + +DONE * Finalize repo structure for docs +* Check versiona archive support in docfx +* Fix home page image issue +* Make automated deployment to home page (io/eisk.docs) +* Place web api home page and content under eisk.webapi/io sub-folder? +* Add blog site +======================================================== +Modules + +Client Side +* React (default) +* React Native +* Blazor + +Web API Layer +* ASP.NET Web API (default) +* Azure Function (http) +* Graph API +* gRPC + +Process Layer +* Azure WebJob +* Azure LogicApp +* Azure Function (Scheduler) +* AWS Lambda + +Domain Layer +* DDD (default) +* CQRS + +Data Service (in-memory) +* Memory: EF/SQLLite In-memory (default) +* Memory: SQL Server +* Memory: Couchbase +* Memory: Redis + +Data Service +* RDBMS: SQL Server +* Key-Value Pair: Azure Table Storage +* Document database: COSMOS +* Graph database: COSMOS (gremline) +* Graph database: Neo4J +* Columnar database: Cassandra + +======================================================== +Repo Dependencies + +- eisk.template (default) + +- eisk.webapi.template (template sub module or main module) +- eisk.webapi (output repo) + +- eisk.domain-services +- eisk.data-services (default) +- eisk.data-services.sql-server +- eisk.data-services.cosmosdb + +- eisk.test-core (default shared across all, can be used as sub-module or main module) +- eisk.core (default shared across all, can be used as sub-module or main module) + +======================================================== +Docs Dependencies + +- eisk.io + * single repo for site + docs, enables sharing common contents across modules + * contains content and rendered pages, in different branch + + - / index page only + + - /eisk + * site contents, can be moved to separate repo as needed + * /eisk/why-eisk + + - /docs + * in future may contain home page + * can be moved to separate repo as needed + + - /docs/eisk (default module) + - /docs/{default module?}/{latest?}/getting-started + - /docs/eisk/{latest?}/getting-started + + - /docs/eisk.webapi + * in future may contain home page for WebAPI + * in future may have sub-module eisk.webapi under docs sub-module (will need to load sub-modules partially as needed under eisk.io, sub-module repo should be renamed as docs-eisk.webapi but should be downloaded as eisk.webapi) + * /docs/eisk.webapi/latest/getting-started + * /docs/eisk.webapi/v1/getting-started (archived) + +- eisk.io/shared-site-resources + * initially can be sub-folder which can be moved to separate repo + + - /assets + * contains common header and footer where applicable + + - /contents + * contains common contents + +- eisk.io/blog (separate repo to contain blog) + ======================================================== \ No newline at end of file From 7ba9cfd00b3aa117071a1fde346e53709d8d2b43 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 23 Mar 2022 19:04:58 +0000 Subject: [PATCH 022/204] updated module names --- Notes.txt | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Notes.txt b/Notes.txt index c77ac54a..387818a4 100644 --- a/Notes.txt +++ b/Notes.txt @@ -61,16 +61,16 @@ Client Side * Blazor Web API Layer -* ASP.NET Web API (default) -* Azure Function (http) -* Graph API -* gRPC +* WebApi - ASP.NET Web API (default) +* WebApi.Azure - Azure Function (http) +* GraphAPI - Graph API +* gRPC - gRPC Process Layer -* Azure WebJob -* Azure LogicApp -* Azure Function (Scheduler) -* AWS Lambda +* Process.AzureWebJob +* Process.AzureLogicApp +* ServerLess.AzureFunction (Scheduler) +* ServerLess.AWSLambda Domain Layer * DDD (default) @@ -95,8 +95,8 @@ Repo Dependencies - eisk.template (default) -- eisk.webapi.template (template sub module or main module) - eisk.webapi (output repo) +- eisk.template.webapi (template sub module or main module) - eisk.domain-services - eisk.data-services (default) @@ -127,11 +127,12 @@ Docs Dependencies - /docs/{default module?}/{latest?}/getting-started - /docs/eisk/{latest?}/getting-started - - /docs/eisk.webapi + - /docs/webapi * in future may contain home page for WebAPI - * in future may have sub-module eisk.webapi under docs sub-module (will need to load sub-modules partially as needed under eisk.io, sub-module repo should be renamed as docs-eisk.webapi but should be downloaded as eisk.webapi) - * /docs/eisk.webapi/latest/getting-started - * /docs/eisk.webapi/v1/getting-started (archived) + * in future may have sub-module webapi under docs sub-module + * will need to load sub-modules partially as needed under eisk.io, sub-module repo should be renamed as docs-webapi but should be downloaded as webapi) + * /docs/webapi/latest/getting-started + * /docs/webapi/v1/getting-started (archived) - eisk.io/shared-site-resources * initially can be sub-folder which can be moved to separate repo From 8d884b9bbaaa216503741bfd3f10d3dfb319c972 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 23 Mar 2022 19:08:05 +0000 Subject: [PATCH 023/204] update --- Notes.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Notes.txt b/Notes.txt index 387818a4..a350c21f 100644 --- a/Notes.txt +++ b/Notes.txt @@ -39,7 +39,9 @@ DONE * fix unit tests * apply custom business logic Others +DONE * Finalize repo structure * Finalize versioning +* Rename eisk.webapi.template to eisk.template * include instruction for template build and publish * check better way to handle exception classes * test post and update methods From cf82f33467c2f09cf5e5f683030db1422d6613cc Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 23 Mar 2022 19:08:24 +0000 Subject: [PATCH 024/204] update --- Notes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Notes.txt b/Notes.txt index a350c21f..8d108584 100644 --- a/Notes.txt +++ b/Notes.txt @@ -40,6 +40,7 @@ DONE * fix unit tests Others DONE * Finalize repo structure +DONE * Finalize doc structure * Finalize versioning * Rename eisk.webapi.template to eisk.template * include instruction for template build and publish From 92a81a2df8f76a934152e75ab07545ae83cf80d5 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 25 Mar 2022 15:52:26 +0000 Subject: [PATCH 025/204] eisk version history added. --- Notes.txt | 52 ++++++---------------------------------------------- 1 file changed, 6 insertions(+), 46 deletions(-) diff --git a/Notes.txt b/Notes.txt index 8d108584..0666f0f6 100644 --- a/Notes.txt +++ b/Notes.txt @@ -47,15 +47,6 @@ DONE * Finalize doc structure * check better way to handle exception classes * test post and update methods ======================================================== -DOCS - -DONE * Finalize repo structure for docs -* Check versiona archive support in docfx -* Fix home page image issue -* Make automated deployment to home page (io/eisk.docs) -* Place web api home page and content under eisk.webapi/io sub-folder? -* Add blog site -======================================================== Modules Client Side @@ -110,42 +101,11 @@ Repo Dependencies - eisk.core (default shared across all, can be used as sub-module or main module) ======================================================== -Docs Dependencies - -- eisk.io - * single repo for site + docs, enables sharing common contents across modules - * contains content and rendered pages, in different branch - - - / index page only - - - /eisk - * site contents, can be moved to separate repo as needed - * /eisk/why-eisk - - - /docs - * in future may contain home page - * can be moved to separate repo as needed - - - /docs/eisk (default module) - - /docs/{default module?}/{latest?}/getting-started - - /docs/eisk/{latest?}/getting-started - - - /docs/webapi - * in future may contain home page for WebAPI - * in future may have sub-module webapi under docs sub-module - * will need to load sub-modules partially as needed under eisk.io, sub-module repo should be renamed as docs-webapi but should be downloaded as webapi) - * /docs/webapi/latest/getting-started - * /docs/webapi/v1/getting-started (archived) - -- eisk.io/shared-site-resources - * initially can be sub-folder which can be moved to separate repo - - - /assets - * contains common header and footer where applicable - - - /contents - * contains common contents - -- eisk.io/blog (separate repo to contain blog) +EISK Version +v5.0 - Web Form Edition .NET 4.0 VS2010, 10.0 +v6.0 - MVC Edition .NET 4.0 VS2012, 11.0 +v7.0 - MVC Edition .NET 4.5.1, VS2013, 12.0.21005.1 - 10.0.40219.1 +v8.0 - Web API Edition .NET Core 2.0, VS2017, 15.0.28307.168 - 10.0.40219.1 +v9.0 - Web API Edition .NET 6.0 VS2022, 17.0.32112.339 - 10.0.40219.1 ======================================================== \ No newline at end of file From 766a7934acb7caac66aaeefc06fbb8dcec4e2cec Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 25 Mar 2022 15:53:08 +0000 Subject: [PATCH 026/204] update --- Notes.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Notes.txt b/Notes.txt index 0666f0f6..9c22717d 100644 --- a/Notes.txt +++ b/Notes.txt @@ -41,7 +41,7 @@ DONE * fix unit tests Others DONE * Finalize repo structure DONE * Finalize doc structure -* Finalize versioning +DONE * Finalize versioning * Rename eisk.webapi.template to eisk.template * include instruction for template build and publish * check better way to handle exception classes From 4f32a6848647a3fccd5a6d665d11d97799cf6972 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 25 Mar 2022 15:59:16 +0000 Subject: [PATCH 027/204] updated EISK version number to 9.0 (EISK v9.0 - Web API Edition .NET 6.0 VS2022, 17.0.32112.339 - 10.0.40219.1) --- Eisk.WebApi.TemplatePack/source.extension.vsixmanifest | 2 +- Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj | 2 +- Notes.txt | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest b/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest index c32e642a..7bef5111 100644 --- a/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest +++ b/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest @@ -1,7 +1,7 @@ - + Eisk.WebApi Project template with simple CRUD to get started ASP.NET Web Api quickly. diff --git a/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj b/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj index df7df033..950fda48 100644 --- a/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj +++ b/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj @@ -9,7 +9,7 @@ Ashraf Alam Project template with simple CRUD to get started ASP.NET Web Api quickly. - 2.0.0 + 9.0.0 diff --git a/Notes.txt b/Notes.txt index 9c22717d..0ad58649 100644 --- a/Notes.txt +++ b/Notes.txt @@ -106,6 +106,11 @@ EISK Version v5.0 - Web Form Edition .NET 4.0 VS2010, 10.0 v6.0 - MVC Edition .NET 4.0 VS2012, 11.0 v7.0 - MVC Edition .NET 4.5.1, VS2013, 12.0.21005.1 - 10.0.40219.1 -v8.0 - Web API Edition .NET Core 2.0, VS2017, 15.0.28307.168 - 10.0.40219.1 +v8.0 - Web API Edition .NET Core 2.0, VS2017, 15.0.28307.168 - 10.0.40219.1 (Core V1.0) v9.0 - Web API Edition .NET 6.0 VS2022, 17.0.32112.339 - 10.0.40219.1 +======================================================== +Update Versions: +* Eisk.WebApi.proj +* source.extension.vsixmanifest + ======================================================== \ No newline at end of file From 33800cfc229134c35d6b4eaba588d58fff2f4093 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 25 Mar 2022 16:04:30 +0000 Subject: [PATCH 028/204] update --- Notes.txt | 7 +++++-- WebApi/Eisk.WebApi/Program.cs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Notes.txt b/Notes.txt index 0ad58649..4733a08a 100644 --- a/Notes.txt +++ b/Notes.txt @@ -110,7 +110,10 @@ v8.0 - Web API Edition .NET Core 2.0, VS2017, 15.0.28307.168 - 10.0.40219.1 (Cor v9.0 - Web API Edition .NET 6.0 VS2022, 17.0.32112.339 - 10.0.40219.1 ======================================================== Update Versions: -* Eisk.WebApi.proj -* source.extension.vsixmanifest +Eisk.WebApi.TemplatePack + * Eisk.WebApi.proj + * source.extension.vsixmanifest +Eisk.WebApi + * Program.cs (for Swagger doc) ======================================================== \ No newline at end of file diff --git a/WebApi/Eisk.WebApi/Program.cs b/WebApi/Eisk.WebApi/Program.cs index 0a8d1a38..d5aa4b6d 100644 --- a/WebApi/Eisk.WebApi/Program.cs +++ b/WebApi/Eisk.WebApi/Program.cs @@ -17,7 +17,7 @@ c.SwaggerDoc("v1", new OpenApiInfo { Title = "Eisk.WebApi", - Version = "v2.0", + Version = "v9.0", Description = "EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net core technologies.", Contact = new OpenApiContact { From ad406a060c708192c554c9ea04a224b23b72ebb6 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 25 Mar 2022 19:28:03 +0000 Subject: [PATCH 029/204] update --- Core | 2 +- Notes.txt | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/Core b/Core index cc553aad..bd729e7c 160000 --- a/Core +++ b/Core @@ -1 +1 @@ -Subproject commit cc553aadd4ea309fca1f815f53fc8e4ff4abecb2 +Subproject commit bd729e7c1b801066be71cbaf36fc6008ea926d56 diff --git a/Notes.txt b/Notes.txt index 4733a08a..9a91467a 100644 --- a/Notes.txt +++ b/Notes.txt @@ -21,13 +21,19 @@ Factors ======================================================== TODO: -CI/CD (Remote) +Fix CI (Remote) DONE * Fix github connection DONE * Install Github App in Azure DONE * Fix CI issue (core) DONE * Fix CI issue (template) DONE * Fix CI issue (docs) +Fix CD (Remote) +DONE * Fix Azure Web (Staging) +DONE * Fix Azure Web (Prod) +DONE * Fix Nuget publish (.new new) +* Fix Github Release + Build / packagaing DONE * Run docs locally * Run template builder locally @@ -116,4 +122,32 @@ Eisk.WebApi.TemplatePack * source.extension.vsixmanifest Eisk.WebApi * Program.cs (for Swagger doc) +======================================================== +Phases + +DONE * Upgrade Template Pack to .NET 6.0 +DONE * Fix CI issues +DONE * Build locally (docs) +DONE * Restructure (docs) - folder structure +DONE * Restructure (docs) - navigations (individual top, top nav, breadcrumbs) +In-progress * Fix CD issues + +* Build locally (template) + +======================================================== +Release Instructions + +CD Contains the following + +Staging (Web/github) +* Web to Azure +* Github Release (edit) - for draft, keeps adding drafts releases. no need to create tags + +Prod (Web/github/Nuget) +* Web to Azure +* Github Release (add) - for non-draft, only published once +* Github Release (edit) +* Published to nuget gallery + + ======================================================== \ No newline at end of file From 5455ff7f8efaa870d34cfe48f1b1717be7c4bd18 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 25 Mar 2022 20:00:36 +0000 Subject: [PATCH 030/204] notes updated --- Notes.txt | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Notes.txt b/Notes.txt index 9a91467a..cddf091c 100644 --- a/Notes.txt +++ b/Notes.txt @@ -130,7 +130,7 @@ DONE * Fix CI issues DONE * Build locally (docs) DONE * Restructure (docs) - folder structure DONE * Restructure (docs) - navigations (individual top, top nav, breadcrumbs) -In-progress * Fix CD issues +DONE * Fix CD issues * Build locally (template) @@ -145,9 +145,8 @@ Staging (Web/github) Prod (Web/github/Nuget) * Web to Azure -* Github Release (add) - for non-draft, only published once +* Github Release (add) - for non-draft, only published once or create tag manually * Github Release (edit) * Published to nuget gallery - ======================================================== \ No newline at end of file From 6cda8763424ec20fdbe631885df96fbb5212259b Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 25 Mar 2022 20:34:48 +0000 Subject: [PATCH 031/204] updated notes --- Notes.txt | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Notes.txt b/Notes.txt index cddf091c..9f0c94c1 100644 --- a/Notes.txt +++ b/Notes.txt @@ -133,6 +133,26 @@ DONE * Restructure (docs) - navigations (individual top, top nav, breadcrumbs) DONE * Fix CD issues * Build locally (template) +* CD to git-repo (as source) + +======================================================== +Release A New Version + +* Update version in code and package +* Build the project in CI + +Releasing the Web Site +* Staging - Web site will be deployed automatically +* Prod - Web site will be deployed automatically if staging is successful + +Releasing in Nuget +* Trigger the DevOps manually (as nuget releases immutable i.e. can't be updated once created) + +Releasing in Github Release +* Create tah in github +* Update version in DevOps release +* Template repo project readme.md will be included automatically in the release notes. +* Respective release as menionted in DevOps rlease will be updated automatically when master branch changed. ======================================================== Release Instructions @@ -141,7 +161,7 @@ CD Contains the following Staging (Web/github) * Web to Azure -* Github Release (edit) - for draft, keeps adding drafts releases. no need to create tags +* Github Release (edit) - for draft, no need to create tags Prod (Web/github/Nuget) * Web to Azure From 97d77867fc7c35bf6da74fd3ebb79099abdeb224 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Sat, 26 Mar 2022 04:05:52 +0000 Subject: [PATCH 032/204] submodule updated --- Core | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core b/Core index bd729e7c..cc553aad 160000 --- a/Core +++ b/Core @@ -1 +1 @@ -Subproject commit bd729e7c1b801066be71cbaf36fc6008ea926d56 +Subproject commit cc553aadd4ea309fca1f815f53fc8e4ff4abecb2 From 2a28589995797af81bee3ef7d232b8a62797d15f Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Sat, 26 Mar 2022 15:13:07 +0000 Subject: [PATCH 033/204] to list updated --- Notes.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Notes.txt b/Notes.txt index 9f0c94c1..0a315dc6 100644 --- a/Notes.txt +++ b/Notes.txt @@ -53,6 +53,16 @@ DONE * Finalize versioning * check better way to handle exception classes * test post and update methods ======================================================== +TODO Next: +* Fix local run (web api) +* Fix deploy to web service +* Publish to git repo and +* Publish git repo to integrate with with git release task + +* build template and document +* identify test strategy, check base tests usability +* exclude non-default files from template +======================================================== Modules Client Side From 2d26ca46f2752fc4bc4fb8ed1fcef799e7b0b20a Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 8 Apr 2022 16:20:06 +0100 Subject: [PATCH 034/204] fixed azure app service deployment issue (due to swagger home page being set only in development environment) --- .gitignore | 1 + Notes.txt | 29 +++++++++++++++++++++++++++-- WebApi/Eisk.WebApi/Program.cs | 16 +++++++--------- 3 files changed, 35 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 9cfdca04..eb7bb686 100644 --- a/.gitignore +++ b/.gitignore @@ -331,3 +331,4 @@ ASALocalRun/ /build/dnn-template-render /build/content /build/content-repo +/WebApi/Eisk.WebApi/Properties/ServiceDependencies/eisk-webapi-1 - Web Deploy/profile.arm.json diff --git a/Notes.txt b/Notes.txt index 0a315dc6..3eff9c25 100644 --- a/Notes.txt +++ b/Notes.txt @@ -54,8 +54,16 @@ DONE * Finalize versioning * test post and update methods ======================================================== TODO Next: -* Fix local run (web api) -* Fix deploy to web service + +DONE * Fix local run (web api) v8 +DONE * Update version specific trigger for CD +* Fix deploy to web service v8 + +DONE * Fix local run (web api) v9 +DONE * Update version specific trigger for CD +DONE * Create new app service for v9 +* Deploy to web service v9 + * Publish to git repo and * Publish git repo to integrate with with git release task @@ -179,4 +187,21 @@ Prod (Web/github/Nuget) * Github Release (edit) * Published to nuget gallery +======================================================== +CD Troubleshoot + +VS2022/.NET 6.0 +* Chaange VS2017 hosting to azure pipeline, + * Resolution: change in the edit release -> app service +* Error on Deployment, + * Resolution: change App Plan from Linux to Windows +* Issue: web api not showing after deployment + * the api json was available, but the issue was due to swagger is not being accessible: https://stackoverflow.com/questions/55658948/asp-net-core-api-get-404-on-azure-app-service-but-works-ok-on-localhost + +VS2017/.NET 2.0 +* Issue: An error occurred while starting the application. .NET Core 4.6.26614.01 X86 v4.0.0.0 Microsoft.AspNetCore.Hosting version 2.0.3-rtm-10026 | Microsoft Windows 10.0.14393 + * Enable detailed errors in azure portal: https://stackoverflow.com/questions/47134657/azure-webapp-asp-net-core-2-error-an-error-occurred-while-starting-the-applicat +* Issue: Could not load file or assembly 'System.Runtime, Version=6.0.0.0 + * In the build use specific .net sdk (2.0.0): https://stackoverflow.com/questions/59474379/failed-to-use-net-sdk-agent-in-azure-devops-build-pipeline + ======================================================== \ No newline at end of file diff --git a/WebApi/Eisk.WebApi/Program.cs b/WebApi/Eisk.WebApi/Program.cs index d5aa4b6d..a84feae1 100644 --- a/WebApi/Eisk.WebApi/Program.cs +++ b/WebApi/Eisk.WebApi/Program.cs @@ -17,7 +17,7 @@ c.SwaggerDoc("v1", new OpenApiInfo { Title = "Eisk.WebApi", - Version = "v9.0", + Version = "v9.0.0", Description = "EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net core technologies.", Contact = new OpenApiContact { @@ -39,15 +39,13 @@ var app = builder.Build(); // Configure the HTTP request pipeline. -if (app.Environment.IsDevelopment()) +app.UseSwagger(); +app.UseSwaggerUI(options => { - app.UseSwagger(); - app.UseSwaggerUI(options => - { - options.SwaggerEndpoint("/swagger/v1/swagger.json", "v2"); - options.RoutePrefix = string.Empty; - }); -} + options.SwaggerEndpoint("/swagger/v1/swagger.json", "v2"); + options.RoutePrefix = string.Empty; +}); + app.UseHttpsRedirection(); From a9a22e101b359955bf95dd6a18c0c08d53e41c9e Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 8 Apr 2022 17:13:42 +0100 Subject: [PATCH 035/204] update --- Notes.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Notes.txt b/Notes.txt index 3eff9c25..8f7dfd12 100644 --- a/Notes.txt +++ b/Notes.txt @@ -52,6 +52,16 @@ DONE * Finalize versioning * include instruction for template build and publish * check better way to handle exception classes * test post and update methods +======================================================== +V9.0.0 (basic only) Release Actions + +CD +* Publish the rendered content to git repo + +Code +* Remove obsolete methods (for .NET 6.0) +* Exclude unused project files (test projects) + ======================================================== TODO Next: @@ -197,6 +207,9 @@ VS2022/.NET 6.0 * Resolution: change App Plan from Linux to Windows * Issue: web api not showing after deployment * the api json was available, but the issue was due to swagger is not being accessible: https://stackoverflow.com/questions/55658948/asp-net-core-api-get-404-on-azure-app-service-but-works-ok-on-localhost +* Issue: App service not being deployed + * Error: Web Deploy cannot modify the file 'Eisk.Core.dll' on the destination because it is locked by an external process. In order to allow the publish operation to succeed, you may need to either restart your application to release the lock, or use the AppOffline rule handler for .Net applications on your next publish attempt. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE. Learn more at: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE. Error count: 1. + * Solution: In Azure DevOps, releas task for app service, set, Use Offline settings as true VS2017/.NET 2.0 * Issue: An error occurred while starting the application. .NET Core 4.6.26614.01 X86 v4.0.0.0 Microsoft.AspNetCore.Hosting version 2.0.3-rtm-10026 | Microsoft Windows 10.0.14393 From 88eebfbb59cab7cd0cd3bb97076a66086f4c1bea Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 8 Apr 2022 18:29:37 +0100 Subject: [PATCH 036/204] updated to 9.0.1 --- Eisk.WebApi.TemplatePack/source.extension.vsixmanifest | 2 +- Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj | 2 +- Notes.txt | 3 ++- WebApi/Eisk.WebApi/Program.cs | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest b/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest index 7bef5111..dc3eaf41 100644 --- a/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest +++ b/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest @@ -1,7 +1,7 @@ - + Eisk.WebApi Project template with simple CRUD to get started ASP.NET Web Api quickly. diff --git a/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj b/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj index 950fda48..8e761540 100644 --- a/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj +++ b/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj @@ -9,7 +9,7 @@ Ashraf Alam Project template with simple CRUD to get started ASP.NET Web Api quickly. - 9.0.0 + 9.0.1 diff --git a/Notes.txt b/Notes.txt index 8f7dfd12..85a13860 100644 --- a/Notes.txt +++ b/Notes.txt @@ -201,7 +201,7 @@ Prod (Web/github/Nuget) CD Troubleshoot VS2022/.NET 6.0 -* Chaange VS2017 hosting to azure pipeline, +* Change VS2017 hosting to azure pipeline, * Resolution: change in the edit release -> app service * Error on Deployment, * Resolution: change App Plan from Linux to Windows @@ -216,5 +216,6 @@ VS2017/.NET 2.0 * Enable detailed errors in azure portal: https://stackoverflow.com/questions/47134657/azure-webapp-asp-net-core-2-error-an-error-occurred-while-starting-the-applicat * Issue: Could not load file or assembly 'System.Runtime, Version=6.0.0.0 * In the build use specific .net sdk (2.0.0): https://stackoverflow.com/questions/59474379/failed-to-use-net-sdk-agent-in-azure-devops-build-pipeline + * Delete and re-create app service with .NET 3.1/2.1 LTS ======================================================== \ No newline at end of file diff --git a/WebApi/Eisk.WebApi/Program.cs b/WebApi/Eisk.WebApi/Program.cs index a84feae1..9f6249a8 100644 --- a/WebApi/Eisk.WebApi/Program.cs +++ b/WebApi/Eisk.WebApi/Program.cs @@ -17,7 +17,7 @@ c.SwaggerDoc("v1", new OpenApiInfo { Title = "Eisk.WebApi", - Version = "v9.0.0", + Version = "v9.0.1", Description = "EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net core technologies.", Contact = new OpenApiContact { From 4d95bf1457beab7a2551a7c89dc71f2c57b72bda Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 8 Apr 2022 19:33:45 +0100 Subject: [PATCH 037/204] notes updated --- Notes.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Notes.txt b/Notes.txt index 85a13860..944faec1 100644 --- a/Notes.txt +++ b/Notes.txt @@ -218,4 +218,10 @@ VS2017/.NET 2.0 * In the build use specific .net sdk (2.0.0): https://stackoverflow.com/questions/59474379/failed-to-use-net-sdk-agent-in-azure-devops-build-pipeline * Delete and re-create app service with .NET 3.1/2.1 LTS -======================================================== \ No newline at end of file +======================================================== + + + + +======================================================== + \ No newline at end of file From f5c7ffe14f2d32e4071c5ebc0848aa23d0f85811 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 11 Apr 2022 14:52:11 +0100 Subject: [PATCH 038/204] structured notes --- Notes.txt | 227 ------------------------------------------------------ 1 file changed, 227 deletions(-) delete mode 100644 Notes.txt diff --git a/Notes.txt b/Notes.txt deleted file mode 100644 index 944faec1..00000000 --- a/Notes.txt +++ /dev/null @@ -1,227 +0,0 @@ -======================================================== -Default set-up - -Api Controller (in memory web) -DomainServices + Unit Tests -DataServices + Integration Tests (in memory db) -======================================================== -Define test strategies -* Api Automated test (RestSharp or postman): minimal -* Domain Service Tests: business logic only (base methods of the domain services should be part of library test) -* Data Service Tests: Infrastructure tests - base tests, custom methods - -======================================================== -Factors - -* In-memory database tests (in CI) -* In-memory web tests (in CI) - -* Database tests (in CD) -* Web UI Tests (in CD) -======================================================== -TODO: - -Fix CI (Remote) -DONE * Fix github connection -DONE * Install Github App in Azure -DONE * Fix CI issue (core) -DONE * Fix CI issue (template) -DONE * Fix CI issue (docs) - -Fix CD (Remote) -DONE * Fix Azure Web (Staging) -DONE * Fix Azure Web (Prod) -DONE * Fix Nuget publish (.new new) -* Fix Github Release - -Build / packagaing -DONE * Run docs locally -* Run template builder locally - -Code -DONE * fix unit tests -* added exception handler for controller -* add log functionality -* apply custom business logic - -Others -DONE * Finalize repo structure -DONE * Finalize doc structure -DONE * Finalize versioning -* Rename eisk.webapi.template to eisk.template -* include instruction for template build and publish -* check better way to handle exception classes -* test post and update methods -======================================================== -V9.0.0 (basic only) Release Actions - -CD -* Publish the rendered content to git repo - -Code -* Remove obsolete methods (for .NET 6.0) -* Exclude unused project files (test projects) - -======================================================== -TODO Next: - -DONE * Fix local run (web api) v8 -DONE * Update version specific trigger for CD -* Fix deploy to web service v8 - -DONE * Fix local run (web api) v9 -DONE * Update version specific trigger for CD -DONE * Create new app service for v9 -* Deploy to web service v9 - -* Publish to git repo and -* Publish git repo to integrate with with git release task - -* build template and document -* identify test strategy, check base tests usability -* exclude non-default files from template -======================================================== -Modules - -Client Side -* React (default) -* React Native -* Blazor - -Web API Layer -* WebApi - ASP.NET Web API (default) -* WebApi.Azure - Azure Function (http) -* GraphAPI - Graph API -* gRPC - gRPC - -Process Layer -* Process.AzureWebJob -* Process.AzureLogicApp -* ServerLess.AzureFunction (Scheduler) -* ServerLess.AWSLambda - -Domain Layer -* DDD (default) -* CQRS - -Data Service (in-memory) -* Memory: EF/SQLLite In-memory (default) -* Memory: SQL Server -* Memory: Couchbase -* Memory: Redis - -Data Service -* RDBMS: SQL Server -* Key-Value Pair: Azure Table Storage -* Document database: COSMOS -* Graph database: COSMOS (gremline) -* Graph database: Neo4J -* Columnar database: Cassandra - -======================================================== -Repo Dependencies - -- eisk.template (default) - -- eisk.webapi (output repo) -- eisk.template.webapi (template sub module or main module) - -- eisk.domain-services -- eisk.data-services (default) -- eisk.data-services.sql-server -- eisk.data-services.cosmosdb - -- eisk.test-core (default shared across all, can be used as sub-module or main module) -- eisk.core (default shared across all, can be used as sub-module or main module) - -======================================================== -EISK Version - -v5.0 - Web Form Edition .NET 4.0 VS2010, 10.0 -v6.0 - MVC Edition .NET 4.0 VS2012, 11.0 -v7.0 - MVC Edition .NET 4.5.1, VS2013, 12.0.21005.1 - 10.0.40219.1 -v8.0 - Web API Edition .NET Core 2.0, VS2017, 15.0.28307.168 - 10.0.40219.1 (Core V1.0) -v9.0 - Web API Edition .NET 6.0 VS2022, 17.0.32112.339 - 10.0.40219.1 -======================================================== -Update Versions: - -Eisk.WebApi.TemplatePack - * Eisk.WebApi.proj - * source.extension.vsixmanifest -Eisk.WebApi - * Program.cs (for Swagger doc) -======================================================== -Phases - -DONE * Upgrade Template Pack to .NET 6.0 -DONE * Fix CI issues -DONE * Build locally (docs) -DONE * Restructure (docs) - folder structure -DONE * Restructure (docs) - navigations (individual top, top nav, breadcrumbs) -DONE * Fix CD issues - -* Build locally (template) -* CD to git-repo (as source) - -======================================================== -Release A New Version - -* Update version in code and package -* Build the project in CI - -Releasing the Web Site -* Staging - Web site will be deployed automatically -* Prod - Web site will be deployed automatically if staging is successful - -Releasing in Nuget -* Trigger the DevOps manually (as nuget releases immutable i.e. can't be updated once created) - -Releasing in Github Release -* Create tah in github -* Update version in DevOps release -* Template repo project readme.md will be included automatically in the release notes. -* Respective release as menionted in DevOps rlease will be updated automatically when master branch changed. - -======================================================== -Release Instructions - -CD Contains the following - -Staging (Web/github) -* Web to Azure -* Github Release (edit) - for draft, no need to create tags - -Prod (Web/github/Nuget) -* Web to Azure -* Github Release (add) - for non-draft, only published once or create tag manually -* Github Release (edit) -* Published to nuget gallery - -======================================================== -CD Troubleshoot - -VS2022/.NET 6.0 -* Change VS2017 hosting to azure pipeline, - * Resolution: change in the edit release -> app service -* Error on Deployment, - * Resolution: change App Plan from Linux to Windows -* Issue: web api not showing after deployment - * the api json was available, but the issue was due to swagger is not being accessible: https://stackoverflow.com/questions/55658948/asp-net-core-api-get-404-on-azure-app-service-but-works-ok-on-localhost -* Issue: App service not being deployed - * Error: Web Deploy cannot modify the file 'Eisk.Core.dll' on the destination because it is locked by an external process. In order to allow the publish operation to succeed, you may need to either restart your application to release the lock, or use the AppOffline rule handler for .Net applications on your next publish attempt. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE. Learn more at: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE. Error count: 1. - * Solution: In Azure DevOps, releas task for app service, set, Use Offline settings as true - -VS2017/.NET 2.0 -* Issue: An error occurred while starting the application. .NET Core 4.6.26614.01 X86 v4.0.0.0 Microsoft.AspNetCore.Hosting version 2.0.3-rtm-10026 | Microsoft Windows 10.0.14393 - * Enable detailed errors in azure portal: https://stackoverflow.com/questions/47134657/azure-webapp-asp-net-core-2-error-an-error-occurred-while-starting-the-applicat -* Issue: Could not load file or assembly 'System.Runtime, Version=6.0.0.0 - * In the build use specific .net sdk (2.0.0): https://stackoverflow.com/questions/59474379/failed-to-use-net-sdk-agent-in-azure-devops-build-pipeline - * Delete and re-create app service with .NET 3.1/2.1 LTS - -======================================================== - - - - -======================================================== - \ No newline at end of file From 10761d691167aadf8ed876986b2ffad0b0b28b39 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 11 Apr 2022 14:52:29 +0100 Subject: [PATCH 039/204] notes restructure --- Eisk.WebApi.TemplatePack.sln | 11 ++++- Notes/Modules.txt | 66 ++++++++++++++++++++++++++++++ Notes/Notes.txt | 7 ++++ Notes/Release-Instructions.txt | 44 ++++++++++++++++++++ Notes/TODO.txt | 73 ++++++++++++++++++++++++++++++++++ Notes/Test-Strategy.txt | 22 ++++++++++ Notes/Troubleshoot.txt | 23 +++++++++++ 7 files changed, 245 insertions(+), 1 deletion(-) create mode 100644 Notes/Modules.txt create mode 100644 Notes/Notes.txt create mode 100644 Notes/Release-Instructions.txt create mode 100644 Notes/TODO.txt create mode 100644 Notes/Test-Strategy.txt create mode 100644 Notes/Troubleshoot.txt diff --git a/Eisk.WebApi.TemplatePack.sln b/Eisk.WebApi.TemplatePack.sln index 8958529c..9043fdc1 100644 --- a/Eisk.WebApi.TemplatePack.sln +++ b/Eisk.WebApi.TemplatePack.sln @@ -7,7 +7,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.Core", "Core\Eisk.Core EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4E93D3D8-EC59-4DE2-A1E1-3F0258277780}" ProjectSection(SolutionItems) = preProject - Notes.txt = Notes.txt .template.config\template.json = .template.config\template.json .template.config\template.vstemplate = .template.config\template.vstemplate EndProjectSection @@ -50,6 +49,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DomainServices.Compone EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.WebApi", "WebApi\Eisk.WebApi\Eisk.WebApi.csproj", "{B99A94EA-9D76-4C67-88E2-A1814930E8B5}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Notes", "Notes", "{ACEB7D4D-4789-49F0-A552-3D7C0A419FB9}" + ProjectSection(SolutionItems) = preProject + Notes\Modules.txt = Notes\Modules.txt + Notes\Notes.txt = Notes\Notes.txt + Notes\Release-Instructions.txt = Notes\Release-Instructions.txt + Notes\Test-Strategy.txt = Notes\Test-Strategy.txt + Notes\TODO.txt = Notes\TODO.txt + Notes\Troubleshoot.txt = Notes\Troubleshoot.txt + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/Notes/Modules.txt b/Notes/Modules.txt new file mode 100644 index 00000000..c701ca2e --- /dev/null +++ b/Notes/Modules.txt @@ -0,0 +1,66 @@ +======================================================== +Core Modules and Releases + +Client Side +* React (default) +* Blazor +* React Native + +Web API Layer +* WebApi - ASP.NET Web API (default) +* WebApi.Azure - Azure Function (http) +* gRPC - gRPC +* GraphAPI - Graph API + +Process Layer +* Process.AzureWebJob +* Process.AzureLogicApp +* ServerLess.AzureFunction (Scheduler) +* ServerLess.AWSLambda + +Domain Layer +* DDD (default) +* CQRS + +Data Service (in-memory) +* Memory: EF In-memory (default?) +* Memory: SQLLite In-memory +* Memory: SQL Server In-memory +* Memory: Couchbase In-memory +* Memory: Redis + +Data Service +* RDBMS: SQL Server (default) +* Key-Value Pair: Azure Table Storage +* Document database: COSMOS +* Document database: Couchbase +* Graph database: COSMOS (gremline) +* Graph database: Neo4J +* Columnar database: Cassandra + +======================================================== +Repo Modules and Dependencies + +- eisk.template (default) + +- eisk.webapi (output repo) +- eisk.template.webapi (template sub module or main module) + +- eisk.domain-services +- eisk.data-services (default) +- eisk.data-services.sql-server +- eisk.data-services.cosmosdb + +- eisk.test-core (default shared across all, can be used as sub-module or main module) +- eisk.core (default shared across all, can be used as sub-module or main module) + +======================================================== +EISK Version History + +v9.0 - Web API Edition .NET 6.0 VS2022, 17.0.32112.339 - 10.0.40219.1 +v8.0 - Web API Edition .NET Core 2.0 VS2017, 15.0.28307.168 - 10.0.40219.1 (Core V1.0) +v7.0 - MVC Edition .NET 4.5.1 VS2013, 12.0.21005.1 - 10.0.40219.1 +v6.0 - MVC Edition .NET 4.0 VS2012, 11.0 +v5.0 - Web Form Edition .NET 4.0 VS2010, 10.0 + +======================================================== diff --git a/Notes/Notes.txt b/Notes/Notes.txt new file mode 100644 index 00000000..4c699d7d --- /dev/null +++ b/Notes/Notes.txt @@ -0,0 +1,7 @@ +======================================================== + + + + +======================================================== + \ No newline at end of file diff --git a/Notes/Release-Instructions.txt b/Notes/Release-Instructions.txt new file mode 100644 index 00000000..67cddf45 --- /dev/null +++ b/Notes/Release-Instructions.txt @@ -0,0 +1,44 @@ +======================================================== +Update a Version: + +Eisk.WebApi.TemplatePack + * Eisk.WebApi.proj + * source.extension.vsixmanifest +Eisk.WebApi + * Program.cs (for Swagger doc) +======================================================== +Release A New Version + +* Update version in code and package +* Build the project in CI + +Releasing the Web Site +* Staging - Web site will be deployed automatically +* Prod - Web site will be deployed automatically if staging is successful + +Releasing in Nuget +* Trigger the DevOps manually (as nuget releases immutable i.e. can't be updated once created) + +Releasing in Github Release +* Create tag in github +* Update version in DevOps release +* Template repo project readme.md will be included automatically in the release notes. +* Respective release as menionted in DevOps rlease will be updated automatically when master branch changed. + +======================================================== +Release Instructions + +CD Contains the following + +Staging (Web/github) +* Web to Azure +* Github Release (edit) - for draft, no need to create tags + +Prod (Web/github/Nuget) +* Web to Azure +* Github Release (add) - for non-draft, only published once or create tag manually +* Github Release (edit) +* Published to nuget gallery + +======================================================== + \ No newline at end of file diff --git a/Notes/TODO.txt b/Notes/TODO.txt new file mode 100644 index 00000000..1a6c4ee3 --- /dev/null +++ b/Notes/TODO.txt @@ -0,0 +1,73 @@ +======================================================== +TODO: Today + +* Check rendered output for template with VS + +* Fix project load issue for rendered content +* Exclude unused project files (test projects) +* Remove obsolete methods (for .NET 6.0) + +* Rename Eisk.DomainServices.ComponentTests.EFCore -> Eisk.DomainServices.ComponentTests? + +======================================================== +TODO: + +Fix CI (Remote) +* Rename eisk.webapi.template to eisk.template +DONE * Fix github connection +DONE * Install Github App in Azure +DONE * Fix CI issue (core) +DONE * Fix CI issue (template) +DONE * Fix CI issue (docs) + +Fix CD (Remote) +* Publish to git repo +* Publish git repo to integrate with with git release task +DONE * Fix Azure Web (Staging) +DONE * Fix Azure Web (Prod) +DONE * Fix Nuget publish (.new new) +DONE * Update version specific trigger for CD +DONE * Update version specific trigger for CD +DONE * Create new app service for v9 +DONE * Deploy to web service v9 +DONE * Fix deploy to web service v8 + +Build / packagaing +DONE * Run docs locally +DONE * Fix local run (web api) v8 +DONE * Fix local run (web api) v9 + +Code +* added exception handler for controller +* add log functionality +* apply custom business logic +DONE * fix unit tests + +Testing +* test post and update methods +* identify test strategy, check base tests usability + +Doc + + +Others +* include instruction for template build and publish +DONE * Finalize repo structure +DONE * Finalize doc structure +DONE * Finalize versioning + +======================================================== +Phases + +DONE * Upgrade Template Pack to .NET 6.0 +DONE * Fix CI issues +DONE * Build locally (docs) +DONE * Restructure (docs) - folder structure +DONE * Restructure (docs) - navigations (individual top, top nav, breadcrumbs) +DONE * Fix CD issues + +* Build locally (template) +* CD to git-repo (as source) + +======================================================== + diff --git a/Notes/Test-Strategy.txt b/Notes/Test-Strategy.txt new file mode 100644 index 00000000..31e33218 --- /dev/null +++ b/Notes/Test-Strategy.txt @@ -0,0 +1,22 @@ +======================================================== +Default set-up + +Api Controller (in memory web) +DomainServices + Unit Tests +DataServices + Integration Tests (in memory db) +======================================================== +Define test strategies +* Api Automated test (RestSharp or postman): minimal +* Domain Service Tests: business logic only (base methods of the domain services should be part of library test) +* Data Service Tests: Infrastructure tests - base tests, custom methods + +======================================================== +Factors + +* In-memory database tests (in CI) +* In-memory web tests (in CI) + +* Database tests (in CD) +* Web UI Tests (in CD) +======================================================== + \ No newline at end of file diff --git a/Notes/Troubleshoot.txt b/Notes/Troubleshoot.txt new file mode 100644 index 00000000..71e89ca6 --- /dev/null +++ b/Notes/Troubleshoot.txt @@ -0,0 +1,23 @@ +======================================================== +CD Troubleshoot + +VS2022/.NET 6.0 +* Change VS2017 hosting to azure pipeline, + * Resolution: change in the edit release -> app service +* Error on Deployment, + * Resolution: change App Plan from Linux to Windows +* Issue: web api not showing after deployment + * the api json was available, but the issue was due to swagger is not being accessible: https://stackoverflow.com/questions/55658948/asp-net-core-api-get-404-on-azure-app-service-but-works-ok-on-localhost +* Issue: App service not being deployed + * Error: Web Deploy cannot modify the file 'Eisk.Core.dll' on the destination because it is locked by an external process. In order to allow the publish operation to succeed, you may need to either restart your application to release the lock, or use the AppOffline rule handler for .Net applications on your next publish attempt. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE. Learn more at: https://go.microsoft.com/fwlink/?LinkId=221672#ERROR_FILE_IN_USE. Error count: 1. + * Solution: In Azure DevOps, releas task for app service, set, Use Offline settings as true + +VS2017/.NET 2.0 +* Issue: An error occurred while starting the application. .NET Core 4.6.26614.01 X86 v4.0.0.0 Microsoft.AspNetCore.Hosting version 2.0.3-rtm-10026 | Microsoft Windows 10.0.14393 + * Enable detailed errors in azure portal: https://stackoverflow.com/questions/47134657/azure-webapp-asp-net-core-2-error-an-error-occurred-while-starting-the-applicat +* Issue: Could not load file or assembly 'System.Runtime, Version=6.0.0.0 + * In the build use specific .net sdk (2.0.0): https://stackoverflow.com/questions/59474379/failed-to-use-net-sdk-agent-in-azure-devops-build-pipeline + * Delete and re-create app service with .NET 3.1/2.1 LTS + +======================================================== + \ No newline at end of file From 0b962531f17e259ac0dc8676de17e4b0b8db8d14 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 11 Apr 2022 16:05:37 +0100 Subject: [PATCH 040/204] updated template configurations to exclude some test projects --- Eisk.WebApi..sln | 95 +++++++++++++++++++ .../template/Eisk.WebApi.proj | 4 + Eisk.WebApi.sln | 89 ----------------- Notes/Notes.txt | 3 +- Notes/TODO.txt | 21 ++-- 5 files changed, 113 insertions(+), 99 deletions(-) create mode 100644 Eisk.WebApi..sln delete mode 100644 Eisk.WebApi.sln diff --git a/Eisk.WebApi..sln b/Eisk.WebApi..sln new file mode 100644 index 00000000..f35bb9a5 --- /dev/null +++ b/Eisk.WebApi..sln @@ -0,0 +1,95 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.32112.339 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.Core", "Core\Eisk.Core\Eisk.Core.csproj", "{8E6823DD-60AB-4772-AB9C-E5786BEF2B50}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.Test.Core", "Core\Eisk.Test.Core\Eisk.Test.Core.csproj", "{642F6C34-DFFF-47FB-8568-621423F95B79}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{CEBF47DF-D79A-4AE0-A857-A51D438E3C39}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Test.Core", "Test.Core", "{16043213-DF69-4E37-98E1-2C86C410551B}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "WebApi", "WebApi", "{9611B3D6-810A-4E98-9166-2DA770E38B81}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastructure", "{8D09A735-BB55-4075-9B06-EAAA18F59781}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DomainCore", "DomainCore", "{07B09CE7-77B7-4F0F-9BF1-1CA13B8501D8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.Domains", "DomainCore\Eisk.Domains\Eisk.Domains.csproj", "{EC2CC663-1674-4F39-B3A5-926F3A83094A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DataServices.Interfaces", "DomainCore\Eisk.DataServices.Interfaces\Eisk.DataServices.Interfaces.csproj", "{ABA6FD15-BB90-478E-91F1-7A8E5708DCDF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DomainServices", "DomainCore\Eisk.DomainServices\Eisk.DomainServices.csproj", "{19C8978D-7873-4306-B498-6D29C2F0013E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DataServices.EFCore", "Infrastructure.EFCore\Eisk.DataServices.EFCore\Eisk.DataServices.EFCore.csproj", "{521DC48B-EE63-41DB-B226-382EE39A3CF8}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.EFCore.Setup", "Infrastructure.EFCore\Eisk.EFCore.Setup\Eisk.EFCore.Setup.csproj", "{5C60F4F8-B7A7-4B14-B476-79E138BAF1F9}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DomainServices.ComponentTests.EFCore", "Infrastructure.EFCore\Eisk.DomainServices.ComponentTests.EFCore\Eisk.DomainServices.ComponentTests.EFCore.csproj", "{CB7B38B4-9AE5-4B86-BC31-CD74F8690D79}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.WebApi", "WebApi\Eisk.WebApi\Eisk.WebApi.csproj", "{B99A94EA-9D76-4C67-88E2-A1814930E8B5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8E6823DD-60AB-4772-AB9C-E5786BEF2B50}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E6823DD-60AB-4772-AB9C-E5786BEF2B50}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E6823DD-60AB-4772-AB9C-E5786BEF2B50}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E6823DD-60AB-4772-AB9C-E5786BEF2B50}.Release|Any CPU.Build.0 = Release|Any CPU + {642F6C34-DFFF-47FB-8568-621423F95B79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {642F6C34-DFFF-47FB-8568-621423F95B79}.Debug|Any CPU.Build.0 = Debug|Any CPU + {642F6C34-DFFF-47FB-8568-621423F95B79}.Release|Any CPU.ActiveCfg = Release|Any CPU + {642F6C34-DFFF-47FB-8568-621423F95B79}.Release|Any CPU.Build.0 = Release|Any CPU + {EC2CC663-1674-4F39-B3A5-926F3A83094A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EC2CC663-1674-4F39-B3A5-926F3A83094A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EC2CC663-1674-4F39-B3A5-926F3A83094A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EC2CC663-1674-4F39-B3A5-926F3A83094A}.Release|Any CPU.Build.0 = Release|Any CPU + {ABA6FD15-BB90-478E-91F1-7A8E5708DCDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ABA6FD15-BB90-478E-91F1-7A8E5708DCDF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ABA6FD15-BB90-478E-91F1-7A8E5708DCDF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ABA6FD15-BB90-478E-91F1-7A8E5708DCDF}.Release|Any CPU.Build.0 = Release|Any CPU + {19C8978D-7873-4306-B498-6D29C2F0013E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19C8978D-7873-4306-B498-6D29C2F0013E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19C8978D-7873-4306-B498-6D29C2F0013E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19C8978D-7873-4306-B498-6D29C2F0013E}.Release|Any CPU.Build.0 = Release|Any CPU + {521DC48B-EE63-41DB-B226-382EE39A3CF8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {521DC48B-EE63-41DB-B226-382EE39A3CF8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {521DC48B-EE63-41DB-B226-382EE39A3CF8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {521DC48B-EE63-41DB-B226-382EE39A3CF8}.Release|Any CPU.Build.0 = Release|Any CPU + {5C60F4F8-B7A7-4B14-B476-79E138BAF1F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5C60F4F8-B7A7-4B14-B476-79E138BAF1F9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5C60F4F8-B7A7-4B14-B476-79E138BAF1F9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5C60F4F8-B7A7-4B14-B476-79E138BAF1F9}.Release|Any CPU.Build.0 = Release|Any CPU + {CB7B38B4-9AE5-4B86-BC31-CD74F8690D79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CB7B38B4-9AE5-4B86-BC31-CD74F8690D79}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CB7B38B4-9AE5-4B86-BC31-CD74F8690D79}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CB7B38B4-9AE5-4B86-BC31-CD74F8690D79}.Release|Any CPU.Build.0 = Release|Any CPU + {B99A94EA-9D76-4C67-88E2-A1814930E8B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B99A94EA-9D76-4C67-88E2-A1814930E8B5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B99A94EA-9D76-4C67-88E2-A1814930E8B5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B99A94EA-9D76-4C67-88E2-A1814930E8B5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {8E6823DD-60AB-4772-AB9C-E5786BEF2B50} = {CEBF47DF-D79A-4AE0-A857-A51D438E3C39} + {642F6C34-DFFF-47FB-8568-621423F95B79} = {16043213-DF69-4E37-98E1-2C86C410551B} + {16043213-DF69-4E37-98E1-2C86C410551B} = {CEBF47DF-D79A-4AE0-A857-A51D438E3C39} + {EC2CC663-1674-4F39-B3A5-926F3A83094A} = {07B09CE7-77B7-4F0F-9BF1-1CA13B8501D8} + {ABA6FD15-BB90-478E-91F1-7A8E5708DCDF} = {07B09CE7-77B7-4F0F-9BF1-1CA13B8501D8} + {19C8978D-7873-4306-B498-6D29C2F0013E} = {07B09CE7-77B7-4F0F-9BF1-1CA13B8501D8} + {521DC48B-EE63-41DB-B226-382EE39A3CF8} = {8D09A735-BB55-4075-9B06-EAAA18F59781} + {5C60F4F8-B7A7-4B14-B476-79E138BAF1F9} = {8D09A735-BB55-4075-9B06-EAAA18F59781} + {CB7B38B4-9AE5-4B86-BC31-CD74F8690D79} = {8D09A735-BB55-4075-9B06-EAAA18F59781} + {B99A94EA-9D76-4C67-88E2-A1814930E8B5} = {9611B3D6-810A-4E98-9166-2DA770E38B81} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4370F72B-9D16-4EBF-8EF5-1F0925FC7CC6} + EndGlobalSection +EndGlobal diff --git a/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj b/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj index 8e761540..fa3a6086 100644 --- a/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj +++ b/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj @@ -26,6 +26,10 @@ + + + + diff --git a/Eisk.WebApi.sln b/Eisk.WebApi.sln deleted file mode 100644 index 056bc68f..00000000 --- a/Eisk.WebApi.sln +++ /dev/null @@ -1,89 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.168 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{5C899B87-C8F5-4175-8D58-8EBBD0DAF2D6}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DomainCore", "DomainCore", "{EBB00523-AA34-473E-869F-F21A1FF49E4A}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Infrastructure", "Infrastructure", "{AB873FBC-C5FF-4186-9C40-1B07B5869061}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.Core", "Core\Eisk.Core\Eisk.Core.csproj", "{DD9E265E-D7AF-4CBD-8316-707608C35920}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.Test.Core", "Core\Eisk.Test.Core\Eisk.Test.Core.csproj", "{32A37BEF-1EEB-4937-B7B1-43DC7C8CFB08}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.Domains", "DomainCore\Eisk.Domains\Eisk.Domains.csproj", "{32AA2C19-860E-4B59-9A14-59E5886433D4}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DataServices.Interfaces", "DomainCore\Eisk.DataServices.Interfaces\Eisk.DataServices.Interfaces.csproj", "{8493028D-21C0-43BC-A382-3390A58133B2}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.WebApi", "WebApi\Eisk.WebApi\Eisk.WebApi.csproj", "{3EB34FF1-B49A-4B99-9147-47A858F18E9E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.EFCore.Setup", "Infrastructure.EFCore\Eisk.EFCore.Setup\Eisk.EFCore.Setup.csproj", "{64004E6C-5178-42AD-B685-7377F4D30F73}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DomainServices", "DomainCore\Eisk.DomainServices\Eisk.DomainServices.csproj", "{51C04044-27E4-422E-9B5F-AB3AD047D07E}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DataServices.EFCore", "Infrastructure.EFCore\Eisk.DataServices.EFCore\Eisk.DataServices.EFCore.csproj", "{5439FE0B-7094-41AE-AFC2-FAA340E5EAE4}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DomainServices.ComponentTests.EFCore", "Infrastructure.EFCore\Eisk.DomainServices.ComponentTests.EFCore\Eisk.DomainServices.ComponentTests.EFCore.csproj", "{927DF350-D0DA-410B-86F1-10A6EE30D15C}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {DD9E265E-D7AF-4CBD-8316-707608C35920}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DD9E265E-D7AF-4CBD-8316-707608C35920}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DD9E265E-D7AF-4CBD-8316-707608C35920}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DD9E265E-D7AF-4CBD-8316-707608C35920}.Release|Any CPU.Build.0 = Release|Any CPU - {32A37BEF-1EEB-4937-B7B1-43DC7C8CFB08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {32A37BEF-1EEB-4937-B7B1-43DC7C8CFB08}.Debug|Any CPU.Build.0 = Debug|Any CPU - {32A37BEF-1EEB-4937-B7B1-43DC7C8CFB08}.Release|Any CPU.ActiveCfg = Release|Any CPU - {32A37BEF-1EEB-4937-B7B1-43DC7C8CFB08}.Release|Any CPU.Build.0 = Release|Any CPU - {32AA2C19-860E-4B59-9A14-59E5886433D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {32AA2C19-860E-4B59-9A14-59E5886433D4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {32AA2C19-860E-4B59-9A14-59E5886433D4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {32AA2C19-860E-4B59-9A14-59E5886433D4}.Release|Any CPU.Build.0 = Release|Any CPU - {8493028D-21C0-43BC-A382-3390A58133B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8493028D-21C0-43BC-A382-3390A58133B2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8493028D-21C0-43BC-A382-3390A58133B2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8493028D-21C0-43BC-A382-3390A58133B2}.Release|Any CPU.Build.0 = Release|Any CPU - {3EB34FF1-B49A-4B99-9147-47A858F18E9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3EB34FF1-B49A-4B99-9147-47A858F18E9E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3EB34FF1-B49A-4B99-9147-47A858F18E9E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3EB34FF1-B49A-4B99-9147-47A858F18E9E}.Release|Any CPU.Build.0 = Release|Any CPU - {64004E6C-5178-42AD-B685-7377F4D30F73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {64004E6C-5178-42AD-B685-7377F4D30F73}.Debug|Any CPU.Build.0 = Debug|Any CPU - {64004E6C-5178-42AD-B685-7377F4D30F73}.Release|Any CPU.ActiveCfg = Release|Any CPU - {64004E6C-5178-42AD-B685-7377F4D30F73}.Release|Any CPU.Build.0 = Release|Any CPU - {51C04044-27E4-422E-9B5F-AB3AD047D07E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {51C04044-27E4-422E-9B5F-AB3AD047D07E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {51C04044-27E4-422E-9B5F-AB3AD047D07E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {51C04044-27E4-422E-9B5F-AB3AD047D07E}.Release|Any CPU.Build.0 = Release|Any CPU - {5439FE0B-7094-41AE-AFC2-FAA340E5EAE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5439FE0B-7094-41AE-AFC2-FAA340E5EAE4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5439FE0B-7094-41AE-AFC2-FAA340E5EAE4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5439FE0B-7094-41AE-AFC2-FAA340E5EAE4}.Release|Any CPU.Build.0 = Release|Any CPU - {927DF350-D0DA-410B-86F1-10A6EE30D15C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {927DF350-D0DA-410B-86F1-10A6EE30D15C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {927DF350-D0DA-410B-86F1-10A6EE30D15C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {927DF350-D0DA-410B-86F1-10A6EE30D15C}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {DD9E265E-D7AF-4CBD-8316-707608C35920} = {5C899B87-C8F5-4175-8D58-8EBBD0DAF2D6} - {32A37BEF-1EEB-4937-B7B1-43DC7C8CFB08} = {5C899B87-C8F5-4175-8D58-8EBBD0DAF2D6} - {32AA2C19-860E-4B59-9A14-59E5886433D4} = {EBB00523-AA34-473E-869F-F21A1FF49E4A} - {8493028D-21C0-43BC-A382-3390A58133B2} = {EBB00523-AA34-473E-869F-F21A1FF49E4A} - {64004E6C-5178-42AD-B685-7377F4D30F73} = {AB873FBC-C5FF-4186-9C40-1B07B5869061} - {51C04044-27E4-422E-9B5F-AB3AD047D07E} = {EBB00523-AA34-473E-869F-F21A1FF49E4A} - {5439FE0B-7094-41AE-AFC2-FAA340E5EAE4} = {AB873FBC-C5FF-4186-9C40-1B07B5869061} - {927DF350-D0DA-410B-86F1-10A6EE30D15C} = {AB873FBC-C5FF-4186-9C40-1B07B5869061} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {32A159D0-95EE-45EA-AB3A-ABC2DAF5FF5D} - EndGlobalSection -EndGlobal diff --git a/Notes/Notes.txt b/Notes/Notes.txt index 4c699d7d..1505092f 100644 --- a/Notes/Notes.txt +++ b/Notes/Notes.txt @@ -1,7 +1,6 @@ ======================================================== - - + ======================================================== \ No newline at end of file diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 1a6c4ee3..497148f1 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -3,8 +3,10 @@ TODO: Today * Check rendered output for template with VS -* Fix project load issue for rendered content -* Exclude unused project files (test projects) +DONE * Fix project load issue for rendered content. issue: long file path +DONE * Exclude unused project files (test projects) +DONE * Exclude unused project files (notes) + * Remove obsolete methods (for .NET 6.0) * Rename Eisk.DomainServices.ComponentTests.EFCore -> Eisk.DomainServices.ComponentTests? @@ -13,15 +15,16 @@ TODO: Today TODO: Fix CI (Remote) -* Rename eisk.webapi.template to eisk.template +R * Rename eisk.webapi.template to eisk.template DONE * Fix github connection DONE * Install Github App in Azure DONE * Fix CI issue (core) DONE * Fix CI issue (template) DONE * Fix CI issue (docs) +DONE * Finalize repo structure Fix CD (Remote) -* Publish to git repo +R * Publish to git repo * Publish git repo to integrate with with git release task DONE * Fix Azure Web (Staging) DONE * Fix Azure Web (Prod) @@ -38,9 +41,10 @@ DONE * Fix local run (web api) v8 DONE * Fix local run (web api) v9 Code +R * apply custom business logic +* explore new .net features * added exception handler for controller * add log functionality -* apply custom business logic DONE * fix unit tests Testing @@ -48,12 +52,13 @@ Testing * identify test strategy, check base tests usability Doc - +R * Doc content writing +R * Create new doc CI +R * Create new doc CD +DONE * Finalize doc structure Others * include instruction for template build and publish -DONE * Finalize repo structure -DONE * Finalize doc structure DONE * Finalize versioning ======================================================== From 3aa3abc3167c59efa16c6778d45ce1be8b3b4e39 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 11 Apr 2022 16:10:21 +0100 Subject: [PATCH 041/204] * rename solution file --- Eisk.WebApi..sln => Eisk.WebApi.sln | 0 Notes/TODO.txt | 11 ++++++----- 2 files changed, 6 insertions(+), 5 deletions(-) rename Eisk.WebApi..sln => Eisk.WebApi.sln (100%) diff --git a/Eisk.WebApi..sln b/Eisk.WebApi.sln similarity index 100% rename from Eisk.WebApi..sln rename to Eisk.WebApi.sln diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 497148f1..448e9650 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -1,16 +1,17 @@ ======================================================== TODO: Today -* Check rendered output for template with VS +* generate template from nuget package +* check rendered output for template with VS +* review template documentations + +* Remove obsolete methods (for .NET 6.0) +* Rename Eisk.DomainServices.ComponentTests.EFCore -> Eisk.DomainServices.ComponentTests? DONE * Fix project load issue for rendered content. issue: long file path DONE * Exclude unused project files (test projects) DONE * Exclude unused project files (notes) -* Remove obsolete methods (for .NET 6.0) - -* Rename Eisk.DomainServices.ComponentTests.EFCore -> Eisk.DomainServices.ComponentTests? - ======================================================== TODO: From 1a2d64ac35d128ecedb027c9c82f833c8835ce9c Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 11 Apr 2022 17:28:21 +0100 Subject: [PATCH 042/204] Updated to IHostEnvironment --- .../EntityFrameworkCoreInitializer.cs | 7 +- Notes/TODO.txt | 67 ++++++++++++------- 2 files changed, 45 insertions(+), 29 deletions(-) diff --git a/Infrastructure.EFCore/Eisk.EFCore.Setup/EntityFrameworkCoreInitializer.cs b/Infrastructure.EFCore/Eisk.EFCore.Setup/EntityFrameworkCoreInitializer.cs index d3b79cb7..43828510 100644 --- a/Infrastructure.EFCore/Eisk.EFCore.Setup/EntityFrameworkCoreInitializer.cs +++ b/Infrastructure.EFCore/Eisk.EFCore.Setup/EntityFrameworkCoreInitializer.cs @@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; namespace Eisk.EFCore.Setup { @@ -15,14 +16,14 @@ public static EntityFrameworkCoreInitializer Factory(IServiceCollection services private readonly IServiceCollection _services; private readonly IConfiguration _configuration; - private readonly IHostingEnvironment _hostingEnvironment; + private readonly IHostEnvironment _hostingEnvironment; public EntityFrameworkCoreInitializer(IServiceCollection services, IConfiguration configuration) { _services = services; _configuration = configuration; IServiceProvider serviceProvider = _services.BuildServiceProvider(); - _hostingEnvironment = serviceProvider.GetService(); + _hostingEnvironment = serviceProvider.GetService(); } public void AddDbContext() @@ -33,7 +34,7 @@ public void AddDbContext() _services.AddScoped(x => new SqlServerDbContext(_configuration)); } - public static void AddSeedDataToDbContext(IHostingEnvironment hostingEnvironment, IConfiguration configuration) + public static void AddSeedDataToDbContext(IHostEnvironment hostingEnvironment, IConfiguration configuration) { if (hostingEnvironment.IsDevelopment()) DbContextDataInitializer.Initialize(new InMemoryDbContext()); diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 448e9650..54878e7f 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -2,51 +2,31 @@ TODO: Today * generate template from nuget package -* check rendered output for template with VS * review template documentations + * check rendered output for template with VS + * check conditional rendering (file) + * check conditional rendering (text) -* Remove obsolete methods (for .NET 6.0) +DONE * Remove obsolete methods (for .NET 6.0) * Rename Eisk.DomainServices.ComponentTests.EFCore -> Eisk.DomainServices.ComponentTests? -DONE * Fix project load issue for rendered content. issue: long file path -DONE * Exclude unused project files (test projects) -DONE * Exclude unused project files (notes) - ======================================================== TODO: Fix CI (Remote) R * Rename eisk.webapi.template to eisk.template -DONE * Fix github connection -DONE * Install Github App in Azure -DONE * Fix CI issue (core) -DONE * Fix CI issue (template) -DONE * Fix CI issue (docs) -DONE * Finalize repo structure Fix CD (Remote) R * Publish to git repo * Publish git repo to integrate with with git release task -DONE * Fix Azure Web (Staging) -DONE * Fix Azure Web (Prod) -DONE * Fix Nuget publish (.new new) -DONE * Update version specific trigger for CD -DONE * Update version specific trigger for CD -DONE * Create new app service for v9 -DONE * Deploy to web service v9 -DONE * Fix deploy to web service v8 Build / packagaing -DONE * Run docs locally -DONE * Fix local run (web api) v8 -DONE * Fix local run (web api) v9 Code R * apply custom business logic * explore new .net features * added exception handler for controller * add log functionality -DONE * fix unit tests Testing * test post and update methods @@ -56,11 +36,9 @@ Doc R * Doc content writing R * Create new doc CI R * Create new doc CD -DONE * Finalize doc structure Others * include instruction for template build and publish -DONE * Finalize versioning ======================================================== Phases @@ -76,4 +54,41 @@ DONE * Fix CD issues * CD to git-repo (as source) ======================================================== +TODO: ARCHIVE + +Fix CI (Remote) +DONE * Fix github connection +DONE * Install Github App in Azure +DONE * Fix CI issue (core) +DONE * Fix CI issue (template) +DONE * Fix CI issue (docs) +DONE * Finalize repo structure + +Fix CD (Remote) +DONE * Fix Azure Web (Staging) +DONE * Fix Azure Web (Prod) +DONE * Fix Nuget publish (.new new) +DONE * Update version specific trigger for CD +DONE * Update version specific trigger for CD +DONE * Create new app service for v9 +DONE * Deploy to web service v9 +DONE * Fix deploy to web service v8 + +Build / packagaing +DONE * Run docs locally +DONE * Fix local run (web api) v8 +DONE * Fix local run (web api) v9 + +Code +DONE * fix unit tests +DONE * Fix project load issue for rendered content. issue: long file path +DONE * Exclude unused project files (test projects) +DONE * Exclude unused project files (notes) + +Doc +DONE * Finalize doc structure + +Others +DONE * Finalize versioning +======================================================== \ No newline at end of file From 48d2912884151c637ba29004321bd42e4cef8d1c Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 11 Apr 2022 17:40:40 +0100 Subject: [PATCH 043/204] updated test strategy --- Notes/Test-Strategy.txt | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/Notes/Test-Strategy.txt b/Notes/Test-Strategy.txt index 31e33218..d90cba32 100644 --- a/Notes/Test-Strategy.txt +++ b/Notes/Test-Strategy.txt @@ -1,22 +1,29 @@ ======================================================== -Default set-up +Test Strategy -Api Controller (in memory web) -DomainServices + Unit Tests -DataServices + Integration Tests (in memory db) -======================================================== -Define test strategies -* Api Automated test (RestSharp or postman): minimal -* Domain Service Tests: business logic only (base methods of the domain services should be part of library test) -* Data Service Tests: Infrastructure tests - base tests, custom methods +Api Controller Tests + * In-memory web tests + * All http codes tests only (200, 404) + * Can be used with build server +Domain Service Tests + * In-memory tests (default): for smaller projects (assumes empty database in each test case) + * Unit tests: for large projects + * Tests only the business rules + * Can be used with build server +Data Service Tests: + * SQL Server integration tests (not included in solution by default) + * Tests all database queries/operations + * To be used in post-deployment (in dev/UAT environment) + * To be used with empty sql server with test seed data (in dev envrionment) + * To be used with existing sql server with test seed data (in UAT envrionment) - smoke tests only ======================================================== Factors * In-memory database tests (in CI) * In-memory web tests (in CI) - * Database tests (in CD) * Web UI Tests (in CD) +* Generic utility base classes ======================================================== \ No newline at end of file From b7a8f1713a94ad38357dbe4f4f7de3829b8967cf Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 11 Apr 2022 17:43:48 +0100 Subject: [PATCH 044/204] added notes for templating --- Notes/Templating.txt | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Notes/Templating.txt diff --git a/Notes/Templating.txt b/Notes/Templating.txt new file mode 100644 index 00000000..18d8d3e6 --- /dev/null +++ b/Notes/Templating.txt @@ -0,0 +1,8 @@ +======================================================== + +======================================================== +References +* https://devblogs.microsoft.com/dotnet/how-to-create-your-own-templates-for-dotnet-new/ +* https://github.com/dotnet/dotnet-template-samples +======================================================== + \ No newline at end of file From 9952ddcbe61014e85a68752cfb4ea4d8ae27f211 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 11 Apr 2022 17:54:32 +0100 Subject: [PATCH 045/204] update --- Eisk.WebApi.TemplatePack.sln | 1 + Notes/TODO.txt | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/Eisk.WebApi.TemplatePack.sln b/Eisk.WebApi.TemplatePack.sln index 9043fdc1..84aa0865 100644 --- a/Eisk.WebApi.TemplatePack.sln +++ b/Eisk.WebApi.TemplatePack.sln @@ -54,6 +54,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Notes", "Notes", "{ACEB7D4D Notes\Modules.txt = Notes\Modules.txt Notes\Notes.txt = Notes\Notes.txt Notes\Release-Instructions.txt = Notes\Release-Instructions.txt + Notes\Templating.txt = Notes\Templating.txt Notes\Test-Strategy.txt = Notes\Test-Strategy.txt Notes\TODO.txt = Notes\TODO.txt Notes\Troubleshoot.txt = Notes\Troubleshoot.txt diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 54878e7f..a2cde1ad 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -85,9 +85,6 @@ DONE * Fix project load issue for rendered content. issue: long file path DONE * Exclude unused project files (test projects) DONE * Exclude unused project files (notes) -Doc -DONE * Finalize doc structure - Others DONE * Finalize versioning From 02d13eb84b0969b2e9afaea00dcc881093c5eba7 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 11 Apr 2022 18:00:57 +0100 Subject: [PATCH 046/204] Version update - v9.0.2 --- WebApi/Eisk.WebApi/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebApi/Eisk.WebApi/Program.cs b/WebApi/Eisk.WebApi/Program.cs index 9f6249a8..78b7248f 100644 --- a/WebApi/Eisk.WebApi/Program.cs +++ b/WebApi/Eisk.WebApi/Program.cs @@ -17,7 +17,7 @@ c.SwaggerDoc("v1", new OpenApiInfo { Title = "Eisk.WebApi", - Version = "v9.0.1", + Version = "v9.0.2", Description = "EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net core technologies.", Contact = new OpenApiContact { From 5831637d3930349d1d3cb05c86b3967415f3c2e5 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 11 Apr 2022 18:56:06 +0100 Subject: [PATCH 047/204] updated default branch to publish in git repo (for V9.0) --- Eisk.WebApi.TemplatePack.sln | 3 +++ Notes/TODO.txt | 2 +- Notes/Test-Strategy.txt | 6 ++++++ build/git-push.sh | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Eisk.WebApi.TemplatePack.sln b/Eisk.WebApi.TemplatePack.sln index 84aa0865..fe82e995 100644 --- a/Eisk.WebApi.TemplatePack.sln +++ b/Eisk.WebApi.TemplatePack.sln @@ -7,6 +7,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.Core", "Core\Eisk.Core EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4E93D3D8-EC59-4DE2-A1E1-3F0258277780}" ProjectSection(SolutionItems) = preProject + build\dnn-install-from-local.cmd = build\dnn-install-from-local.cmd + build\dnn-install-from-remote.cmd = build\dnn-install-from-remote.cmd + build\git-push.sh = build\git-push.sh .template.config\template.json = .template.config\template.json .template.config\template.vstemplate = .template.config\template.vstemplate EndProjectSection diff --git a/Notes/TODO.txt b/Notes/TODO.txt index a2cde1ad..98813de8 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -7,7 +7,6 @@ TODO: Today * check conditional rendering (file) * check conditional rendering (text) -DONE * Remove obsolete methods (for .NET 6.0) * Rename Eisk.DomainServices.ComponentTests.EFCore -> Eisk.DomainServices.ComponentTests? ======================================================== @@ -80,6 +79,7 @@ DONE * Fix local run (web api) v8 DONE * Fix local run (web api) v9 Code +DONE * Remove obsolete methods (for .NET 6.0) DONE * fix unit tests DONE * Fix project load issue for rendered content. issue: long file path DONE * Exclude unused project files (test projects) diff --git a/Notes/Test-Strategy.txt b/Notes/Test-Strategy.txt index d90cba32..fd7142eb 100644 --- a/Notes/Test-Strategy.txt +++ b/Notes/Test-Strategy.txt @@ -17,6 +17,12 @@ Data Service Tests: * To be used with empty sql server with test seed data (in dev envrionment) * To be used with existing sql server with test seed data (in UAT envrionment) - smoke tests only +System Tests: + * Health check + ** to be tested locally, dev, prod + ** Includes db configuration tests + ** Any other external dependencies, like email server, blob storage + ** Can inlcude asp.net core feature, azure feature ======================================================== Factors diff --git a/build/git-push.sh b/build/git-push.sh index 1bf150c7..7c1a5d75 100644 --- a/build/git-push.sh +++ b/build/git-push.sh @@ -4,7 +4,7 @@ ContentTargetGitUserEmail=${3:-joy_csharp@yahoo.com} ContentSrc=${4:-content} -ContentTargetGitBranch=${5:-master} +ContentTargetGitBranch=${5:-V9.0} ContentTargetGitRepoDownloadFolder=${6:-content-repo} SOURCE_DIR=$PWD From 37dc5dc4470a4dd0835f7a78787afe1bc6c4e7a6 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 11 Apr 2022 19:06:42 +0100 Subject: [PATCH 048/204] Updated to v9.0.3 --- Notes/TODO.txt | 3 ++- WebApi/Eisk.WebApi/Program.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 98813de8..5f0d822d 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -16,7 +16,8 @@ Fix CI (Remote) R * Rename eisk.webapi.template to eisk.template Fix CD (Remote) -R * Publish to git repo +DONE * Publish to git repo (V9) +* Publish to git repo (V8) * Publish git repo to integrate with with git release task Build / packagaing diff --git a/WebApi/Eisk.WebApi/Program.cs b/WebApi/Eisk.WebApi/Program.cs index 78b7248f..b573ca2a 100644 --- a/WebApi/Eisk.WebApi/Program.cs +++ b/WebApi/Eisk.WebApi/Program.cs @@ -17,7 +17,7 @@ c.SwaggerDoc("v1", new OpenApiInfo { Title = "Eisk.WebApi", - Version = "v9.0.2", + Version = "v9.0.3", Description = "EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net core technologies.", Contact = new OpenApiContact { From cc5cca3693a321416d0b4d5ad68f8f237865b16f Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 11 Apr 2022 19:24:33 +0100 Subject: [PATCH 049/204] updates --- Notes/TODO.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 5f0d822d..5a0dd418 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -16,8 +16,8 @@ Fix CI (Remote) R * Rename eisk.webapi.template to eisk.template Fix CD (Remote) -DONE * Publish to git repo (V9) -* Publish to git repo (V8) +* Fix publish to git repo (V9) - exclude binaries check-in +* Fix publish to git repo (V8) - exclude binaries check-in * Publish git repo to integrate with with git release task Build / packagaing @@ -65,6 +65,8 @@ DONE * Fix CI issue (docs) DONE * Finalize repo structure Fix CD (Remote) +DONE * Publish to git repo (V9) +DONE * Publish to git repo (V8) DONE * Fix Azure Web (Staging) DONE * Fix Azure Web (Prod) DONE * Fix Nuget publish (.new new) From 5280b43a14d11044a3535bf073a9b81075fb2f52 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 11 Apr 2022 20:39:43 +0100 Subject: [PATCH 050/204] Create .gitignore --- build/content/.gitignore | 334 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 334 insertions(+) create mode 100644 build/content/.gitignore diff --git a/build/content/.gitignore b/build/content/.gitignore new file mode 100644 index 00000000..eb7bb686 --- /dev/null +++ b/build/content/.gitignore @@ -0,0 +1,334 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ +**/Properties/launchSettings.json + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.iobj +*.pch +*.pdb +*.ipdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc + +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config + +# Tabs Studio +*.tss + +# Telerik's JustMock configuration file +*.jmconfig + +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs + +# OpenCover UI analysis results +OpenCover/ + +# Azure Stream Analytics local run output +ASALocalRun/ + +# MSBuild Binary and Structured Log +*.binlog + +# NVidia Nsight GPU debugger configuration file +*.nvuser + +# MFractors (Xamarin productivity tool) working folder +.mfractor/ +/build/dnn-template-render +/build/content +/build/content-repo +/WebApi/Eisk.WebApi/Properties/ServiceDependencies/eisk-webapi-1 - Web Deploy/profile.arm.json From a0794ba77926e4bb0e655be61865fab7e6be409d Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 12 Apr 2022 13:53:42 +0100 Subject: [PATCH 051/204] updated build bash script to copy git ignore. --- build/git-push.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build/git-push.sh b/build/git-push.sh index 7c1a5d75..402acc23 100644 --- a/build/git-push.sh +++ b/build/git-push.sh @@ -24,6 +24,9 @@ git rm -r * echo "Copy documentation into the repo" cp -r $SOURCE_DIR/$ContentSrc/* . +echo "Copy gitignore" +cp ./../.gitignore . + echo "############################# Setting git identity" if [ "$2" != "" ]; then git config user.name $ContentTargetGitUserName From 8b8040750c3d48d31876a67f4b7309a3ed883abc Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 12 Apr 2022 14:12:41 +0100 Subject: [PATCH 052/204] updated build bash scripts --- build/git-bash-echo.sh | 25 +++++++++++++++++++++++++ build/git-push.sh | 4 +++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 build/git-bash-echo.sh diff --git a/build/git-bash-echo.sh b/build/git-bash-echo.sh new file mode 100644 index 00000000..1c832276 --- /dev/null +++ b/build/git-bash-echo.sh @@ -0,0 +1,25 @@ +ContentTargetGitAddress=${1:-https://github.com/EISK/eisk.webapi.git} +echo "############################# ContentTargetGitAddress $ContentTargetGitAddress" + +ContentTargetGitUserName=${2:-AshrafAlam} +echo "############################# ContentTargetGitUserName $ContentTargetGitUserName" + +ContentTargetGitUserEmail=${3:-joy_csharp@yahoo.com} +echo "############################# ContentTargetGitUserEmail $ContentTargetGitUserEmail" + +ContentSrc=${4:-content} +echo "############################# ContentSrc $ContentSrc" + +ContentTargetGitBranch=${5:-V9.0} +echo "############################# ContentTargetGitBranch $ContentTargetGitBranch" + +ContentTargetGitRepoDownloadFolder=${6:-content-repo} +echo "############################# ContentTargetGitRepoDownloadFolder (where content will be pushed) $ContentTargetGitRepoDownloadFolder" + +echo "############################# PWD $PWD" + +SOURCE_DIR=$PWD +echo "############################# SOURCE_DIR $SOURCE_DIR" + +TEMP_REPO_DIR=$PWD/$ContentTargetGitRepoDownloadFolder +echo "############################# TEMP_REPO_DIR $TEMP_REPO_DIR" diff --git a/build/git-push.sh b/build/git-push.sh index 402acc23..a9ea71d2 100644 --- a/build/git-push.sh +++ b/build/git-push.sh @@ -24,8 +24,10 @@ git rm -r * echo "Copy documentation into the repo" cp -r $SOURCE_DIR/$ContentSrc/* . +echo $PWD + echo "Copy gitignore" -cp ./../.gitignore . +cp ./../../.gitignore . echo "############################# Setting git identity" if [ "$2" != "" ]; then From 87460e5f5aa8a87ccd38c8dae7c10c2ff0db3fb0 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 12 Apr 2022 14:18:27 +0100 Subject: [PATCH 053/204] removed content --- build/content/.gitignore | 334 --------------------------------------- 1 file changed, 334 deletions(-) delete mode 100644 build/content/.gitignore diff --git a/build/content/.gitignore b/build/content/.gitignore deleted file mode 100644 index eb7bb686..00000000 --- a/build/content/.gitignore +++ /dev/null @@ -1,334 +0,0 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore - -# User-specific files -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUNIT -*.VisualState.xml -TestResult.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET Core -project.lock.json -project.fragment.lock.json -artifacts/ -**/Properties/launchSettings.json - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_i.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*.log -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# JustCode is a .NET coding add-in -.JustCode - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# JetBrains Rider -.idea/ -*.sln.iml - -# CodeRush -.cr/ - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ -/build/dnn-template-render -/build/content -/build/content-repo -/WebApi/Eisk.WebApi/Properties/ServiceDependencies/eisk-webapi-1 - Web Deploy/profile.arm.json From ee41e015f8c742f77e54cbf9fb941367cdfa433f Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 12 Apr 2022 14:22:11 +0100 Subject: [PATCH 054/204] update --- build/git-bash-echo.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/git-bash-echo.sh b/build/git-bash-echo.sh index 1c832276..395306ef 100644 --- a/build/git-bash-echo.sh +++ b/build/git-bash-echo.sh @@ -1,5 +1,5 @@ ContentTargetGitAddress=${1:-https://github.com/EISK/eisk.webapi.git} -echo "############################# ContentTargetGitAddress $ContentTargetGitAddress" +echo "############################# ContentTargetGitAddress ContentTargetGitAddress" ContentTargetGitUserName=${2:-AshrafAlam} echo "############################# ContentTargetGitUserName $ContentTargetGitUserName" From 2501d72536280c7e5a0ca0577a744e11cfbf2041 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 12 Apr 2022 15:35:51 +0100 Subject: [PATCH 055/204] updated bash script --- Eisk.WebApi.TemplatePack.sln | 1 + build/git-bash-echo.sh | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/Eisk.WebApi.TemplatePack.sln b/Eisk.WebApi.TemplatePack.sln index fe82e995..cc565c4d 100644 --- a/Eisk.WebApi.TemplatePack.sln +++ b/Eisk.WebApi.TemplatePack.sln @@ -9,6 +9,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ProjectSection(SolutionItems) = preProject build\dnn-install-from-local.cmd = build\dnn-install-from-local.cmd build\dnn-install-from-remote.cmd = build\dnn-install-from-remote.cmd + build\git-bash-echo.sh = build\git-bash-echo.sh build\git-push.sh = build\git-push.sh .template.config\template.json = .template.config\template.json .template.config\template.vstemplate = .template.config\template.vstemplate diff --git a/build/git-bash-echo.sh b/build/git-bash-echo.sh index 395306ef..ba5229eb 100644 --- a/build/git-bash-echo.sh +++ b/build/git-bash-echo.sh @@ -1,3 +1,5 @@ +echo "############################# Passed Params (before) 1 - $1, 2 - $2, 3 - $3, 4 - $4, 5 - $5" + ContentTargetGitAddress=${1:-https://github.com/EISK/eisk.webapi.git} echo "############################# ContentTargetGitAddress ContentTargetGitAddress" @@ -23,3 +25,5 @@ echo "############################# SOURCE_DIR $SOURCE_DIR" TEMP_REPO_DIR=$PWD/$ContentTargetGitRepoDownloadFolder echo "############################# TEMP_REPO_DIR $TEMP_REPO_DIR" + +echo "############################# Passed Params (after) 1 - $1, 2 - $2, 3 - $3, 4 - $4, 5 - $5" \ No newline at end of file From 9f67580d47fb63abd4bb274441312fa74f1ccd05 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 12 Apr 2022 15:38:23 +0100 Subject: [PATCH 056/204] updated bash --- build/git-bash-echo.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/git-bash-echo.sh b/build/git-bash-echo.sh index ba5229eb..bbba7fa5 100644 --- a/build/git-bash-echo.sh +++ b/build/git-bash-echo.sh @@ -1,4 +1,4 @@ -echo "############################# Passed Params (before) 1 - $1, 2 - $2, 3 - $3, 4 - $4, 5 - $5" +echo "############################# Passed Params (before) 1 - $1, 2 - $2, 3 - $3, 4 - $4, 5 - $5 6 - $6" ContentTargetGitAddress=${1:-https://github.com/EISK/eisk.webapi.git} echo "############################# ContentTargetGitAddress ContentTargetGitAddress" @@ -26,4 +26,4 @@ echo "############################# SOURCE_DIR $SOURCE_DIR" TEMP_REPO_DIR=$PWD/$ContentTargetGitRepoDownloadFolder echo "############################# TEMP_REPO_DIR $TEMP_REPO_DIR" -echo "############################# Passed Params (after) 1 - $1, 2 - $2, 3 - $3, 4 - $4, 5 - $5" \ No newline at end of file +echo "############################# Passed Params (after) 1 - $1, 2 - $2, 3 - $3, 4 - $4, 5 - $5 6 - $6" \ No newline at end of file From e0e09a63e280c69840aba4b2921831e73cd1adbe Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 12 Apr 2022 15:59:15 +0100 Subject: [PATCH 057/204] bash script updated --- build/git-bash-echo.sh | 4 ++-- build/git-push.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/git-bash-echo.sh b/build/git-bash-echo.sh index bbba7fa5..2edb01f3 100644 --- a/build/git-bash-echo.sh +++ b/build/git-bash-echo.sh @@ -6,7 +6,7 @@ echo "############################# ContentTargetGitAddress ContentTargetGitAddr ContentTargetGitUserName=${2:-AshrafAlam} echo "############################# ContentTargetGitUserName $ContentTargetGitUserName" -ContentTargetGitUserEmail=${3:-joy_csharp@yahoo.com} +ContentTargetGitUserEmail=${3:-joycsc@gmail.com} echo "############################# ContentTargetGitUserEmail $ContentTargetGitUserEmail" ContentSrc=${4:-content} @@ -15,7 +15,7 @@ echo "############################# ContentSrc $ContentSrc" ContentTargetGitBranch=${5:-V9.0} echo "############################# ContentTargetGitBranch $ContentTargetGitBranch" -ContentTargetGitRepoDownloadFolder=${6:-content-repo} +ContentTargetGitRepoDownloadFolder="content-repo" echo "############################# ContentTargetGitRepoDownloadFolder (where content will be pushed) $ContentTargetGitRepoDownloadFolder" echo "############################# PWD $PWD" diff --git a/build/git-push.sh b/build/git-push.sh index a9ea71d2..eda11ea1 100644 --- a/build/git-push.sh +++ b/build/git-push.sh @@ -1,11 +1,11 @@ ContentTargetGitAddress=${1:-https://github.com/EISK/eisk.webapi.git} ContentTargetGitUserName=${2:-AshrafAlam} -ContentTargetGitUserEmail=${3:-joy_csharp@yahoo.com} +ContentTargetGitUserEmail=${3:-joycsc@gmail.com} ContentSrc=${4:-content} ContentTargetGitBranch=${5:-V9.0} -ContentTargetGitRepoDownloadFolder=${6:-content-repo} +ContentTargetGitRepoDownloadFolder="content-repo" SOURCE_DIR=$PWD TEMP_REPO_DIR=$PWD/$ContentTargetGitRepoDownloadFolder From daf8e99373a1461cf358a8067d31d3820606d6e9 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 12 Apr 2022 16:01:28 +0100 Subject: [PATCH 058/204] based script updated to include 'content-branch' as default branch to push content. --- build/git-bash-echo.sh | 2 +- build/git-push.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/git-bash-echo.sh b/build/git-bash-echo.sh index 2edb01f3..f0495bd0 100644 --- a/build/git-bash-echo.sh +++ b/build/git-bash-echo.sh @@ -12,7 +12,7 @@ echo "############################# ContentTargetGitUserEmail $ContentTargetGitU ContentSrc=${4:-content} echo "############################# ContentSrc $ContentSrc" -ContentTargetGitBranch=${5:-V9.0} +ContentTargetGitBranch=${5:-content-branch} echo "############################# ContentTargetGitBranch $ContentTargetGitBranch" ContentTargetGitRepoDownloadFolder="content-repo" diff --git a/build/git-push.sh b/build/git-push.sh index eda11ea1..c24e8bc6 100644 --- a/build/git-push.sh +++ b/build/git-push.sh @@ -4,7 +4,7 @@ ContentTargetGitUserEmail=${3:-joycsc@gmail.com} ContentSrc=${4:-content} -ContentTargetGitBranch=${5:-V9.0} +ContentTargetGitBranch=${5:-content-branch} ContentTargetGitRepoDownloadFolder="content-repo" SOURCE_DIR=$PWD From e5ca4ebeeb1efe33fb7dc1c2f4219eb782ed20e1 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 12 Apr 2022 16:17:27 +0100 Subject: [PATCH 059/204] Version updated to v9.0.4 --- WebApi/Eisk.WebApi/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebApi/Eisk.WebApi/Program.cs b/WebApi/Eisk.WebApi/Program.cs index b573ca2a..ffb1b494 100644 --- a/WebApi/Eisk.WebApi/Program.cs +++ b/WebApi/Eisk.WebApi/Program.cs @@ -17,7 +17,7 @@ c.SwaggerDoc("v1", new OpenApiInfo { Title = "Eisk.WebApi", - Version = "v9.0.3", + Version = "v9.0.4", Description = "EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net core technologies.", Contact = new OpenApiContact { From 439fe07cfbd839259448aebae5fd3858495ced3a Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 12 Apr 2022 16:48:09 +0100 Subject: [PATCH 060/204] Updated task status --- Notes/TODO.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 5a0dd418..48f98fba 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -16,8 +16,6 @@ Fix CI (Remote) R * Rename eisk.webapi.template to eisk.template Fix CD (Remote) -* Fix publish to git repo (V9) - exclude binaries check-in -* Fix publish to git repo (V8) - exclude binaries check-in * Publish git repo to integrate with with git release task Build / packagaing @@ -65,6 +63,8 @@ DONE * Fix CI issue (docs) DONE * Finalize repo structure Fix CD (Remote) +DONE * Fix publish to git repo (V9) - exclude binaries check-in +DONE * Fix publish to git repo (V8) - exclude binaries check-in DONE * Publish to git repo (V9) DONE * Publish to git repo (V8) DONE * Fix Azure Web (Staging) From 5e86b8d746a2a47dedc4ec87ab6aceab3adea4ba Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 12 Apr 2022 16:53:10 +0100 Subject: [PATCH 061/204] update to v9.0.5 --- Eisk.WebApi.TemplatePack/source.extension.vsixmanifest | 2 +- Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj | 2 +- WebApi/Eisk.WebApi/Program.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest b/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest index dc3eaf41..44c1d9f9 100644 --- a/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest +++ b/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest @@ -1,7 +1,7 @@ - + Eisk.WebApi Project template with simple CRUD to get started ASP.NET Web Api quickly. diff --git a/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj b/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj index fa3a6086..c1b3d5f6 100644 --- a/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj +++ b/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj @@ -9,7 +9,7 @@ Ashraf Alam Project template with simple CRUD to get started ASP.NET Web Api quickly. - 9.0.1 + 9.0.5 diff --git a/WebApi/Eisk.WebApi/Program.cs b/WebApi/Eisk.WebApi/Program.cs index ffb1b494..2120588c 100644 --- a/WebApi/Eisk.WebApi/Program.cs +++ b/WebApi/Eisk.WebApi/Program.cs @@ -17,7 +17,7 @@ c.SwaggerDoc("v1", new OpenApiInfo { Title = "Eisk.WebApi", - Version = "v9.0.4", + Version = "v9.0.5", Description = "EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net core technologies.", Contact = new OpenApiContact { From dcacae7b865d1c6f40e049618ae747980a8ecab6 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 12 Apr 2022 18:15:15 +0100 Subject: [PATCH 062/204] updated work status. --- Notes/TODO.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 48f98fba..8c1fc09a 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -16,6 +16,8 @@ Fix CI (Remote) R * Rename eisk.webapi.template to eisk.template Fix CD (Remote) +* Create staging api app service for V8 +* Update CI for Windows-2019 (V8) * Publish git repo to integrate with with git release task Build / packagaing @@ -31,9 +33,8 @@ Testing * identify test strategy, check base tests usability Doc +R * Point new doc under root R * Doc content writing -R * Create new doc CI -R * Create new doc CD Others * include instruction for template build and publish @@ -55,6 +56,7 @@ DONE * Fix CD issues TODO: ARCHIVE Fix CI (Remote) +DONE R * Create new doc CI/CD DONE * Fix github connection DONE * Install Github App in Azure DONE * Fix CI issue (core) @@ -63,6 +65,8 @@ DONE * Fix CI issue (docs) DONE * Finalize repo structure Fix CD (Remote) +DONE * Update CI for Windows-2022 (V9, V8 Docs) +DONE * Update all CD for Windows-2022 DONE * Fix publish to git repo (V9) - exclude binaries check-in DONE * Fix publish to git repo (V8) - exclude binaries check-in DONE * Publish to git repo (V9) From 716a6b7140f01529b446796610a7f3981466119d Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 12 Apr 2022 19:35:02 +0100 Subject: [PATCH 063/204] update --- Notes/TODO.txt | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 8c1fc09a..83b929ad 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -43,14 +43,18 @@ Others Phases DONE * Upgrade Template Pack to .NET 6.0 -DONE * Fix CI issues -DONE * Build locally (docs) -DONE * Restructure (docs) - folder structure -DONE * Restructure (docs) - navigations (individual top, top nav, breadcrumbs) -DONE * Fix CD issues - -* Build locally (template) -* CD to git-repo (as source) +DONE * Complete CI/CD - for V8, nuget, git repo, app service +DONE * Complete CI/CD - for V9 git repo, app service +DONE * Complete CI/CD - for Docs +DONE * Restructure (docs) - build locally, folder structure, navigations (individual top, top nav, breadcrumbs) + +* Custom development (template) - build locally, document process, custom logic implementation +* Doc - initial documenation +* Blog - release post +* Blog - tutorial +* VSIX Release - CD, documentation +* Github Release - CD, documentation +* Doc - advansed documentation documenation ======================================================== TODO: ARCHIVE From 84e33302991c36552b8487c8469fa1c2d44224da Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 13 Apr 2022 01:09:57 +0100 Subject: [PATCH 064/204] Update and rename LICENSE to LICENSE.txt --- LICENSE => LICENSE.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename LICENSE => LICENSE.txt (97%) diff --git a/LICENSE b/LICENSE.txt similarity index 97% rename from LICENSE rename to LICENSE.txt index b085c81b..385621f3 100644 --- a/LICENSE +++ b/LICENSE.txt @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 EISK +Copyright (c) 2022 EISK Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 5b7e0cf8683da5a25dc5627232d504380c5a56a5 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 13 Apr 2022 01:21:36 +0100 Subject: [PATCH 065/204] Update EmployeesController.cs --- WebApi/Eisk.WebApi/Controllers/EmployeesController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebApi/Eisk.WebApi/Controllers/EmployeesController.cs b/WebApi/Eisk.WebApi/Controllers/EmployeesController.cs index 3e8d6ae2..a82ef6fb 100644 --- a/WebApi/Eisk.WebApi/Controllers/EmployeesController.cs +++ b/WebApi/Eisk.WebApi/Controllers/EmployeesController.cs @@ -1,6 +1,6 @@ namespace Eisk.WebApi.Controllers { - using Eisk.Core.WebApi; + using Core.WebApi; using Domains.Entities; using DomainServices; using Microsoft.AspNetCore.Mvc; From cf808290ba1d92459e3d09772dc18712d10b4266 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 13 Apr 2022 15:56:27 +0100 Subject: [PATCH 066/204] included command --- Notes/Commands.txt | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Notes/Commands.txt diff --git a/Notes/Commands.txt b/Notes/Commands.txt new file mode 100644 index 00000000..5a031e40 --- /dev/null +++ b/Notes/Commands.txt @@ -0,0 +1,4 @@ +====================================================== +Refresh sub-module while working in Main template repo + +====================================================== \ No newline at end of file From c7d7ee0a880382103db6c9f9c44b894d3dcd2010 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 13 Apr 2022 16:12:13 +0100 Subject: [PATCH 067/204] updated readme --- README.md | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index f39fa5e7..328a1ebd 100644 --- a/README.md +++ b/README.md @@ -20,22 +20,29 @@ Using a simple table entity 'Employee' it demonstrates all aspect of web develop Here is a simple CRUD use case illustrated in the default template: -* Creating a new employee record -* Read existing employee records -* Update an existing employee record -* Delete existing employee records +* [C]reating a new employee record +* [R]ead existing employee records +* [U]pdate an existing employee record +* [D]elete existing employee records + +### Architecture Overview + +* [Onion Arcitecture](https://jeffreypalermo.com/2008/07/the-onion-architecture-part-1/) +* [Clean Architecture](https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html) +* [Domain Driven Design (DDD)](https://en.wikipedia.org/wiki/Domain-driven_design) ## Core Technology Areas -* ASP.NET Core (Web Api) -* Entity Framework Core -* C# -* Visual Studio -* Azure App Services +* [.NET Framework 6.0](https://devblogs.microsoft.com/dotnet/announcing-net-6/) - The Fastest .NET Yet +* [ASP.NET Core (Web Api)](https://dotnet.microsoft.com/en-us/apps/aspnet/apis) +* [Entity Framework Core](https://docs.microsoft.com/en-us/ef/core/) +* [C#](https://docs.microsoft.com/en-us/dotnet/csharp/) +* [Visual Studio](https://visualstudio.microsoft.com/) +* [Azure App Services](https://azure.microsoft.com/en-gb/services/app-service/#overview) ## System Requirements (Development) -* Visual Studio 2017 ([Free](https://visualstudio.microsoft.com/vs/community/) Community Edition or higher) +* Visual Studio 2022 ([Free](https://visualstudio.microsoft.com/vs/community/) Community Edition or higher) ## QuickStart Guide @@ -58,7 +65,7 @@ Next - you can try some hands-on experience by creating your own api on top of y Utilities and code samples as provided in EISK have intentionally been designed to be self explaining. You may still want to get deeper understanding by exploring the documentations: -* [Live Demo](https://eiskwebapi.azurewebsites.net) +* [Live Demo](https://eisk-webapi.azurewebsites.net) * [Hands-on Walk-through](https://eisk.github.io/eisk.webapi/docs/application-development/handson-walkthrough-create-service-api.html) * [Logical Layer Architecture](https://eisk.github.io/eisk.webapi/docs/architecture/logical-layers.html) * [Technology Stack](https://eisk.github.io/eisk.webapi/docs/technical-reference/technology-stack.html) From bab041b3f5caddb5d6f981dab50d1f86bb6c978e Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 13 Apr 2022 16:16:36 +0100 Subject: [PATCH 068/204] update --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 328a1ebd..f8a74dab 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,5 @@ [![Build status](https://dev.azure.com/EiskOps/Eisk/_apis/build/status/Eisk-WebApi-TemplatePack-CI)](https://dev.azure.com/EiskOps/Eisk/_build/latest?definitionId=3) [![BuitlWithDot.Net shield](https://builtwithdot.net/project/334/eisk/badge)](https://builtwithdot.net/project/334/eisk) -... - # Getting Started with EISK Web Api EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net core technologies. @@ -36,9 +34,8 @@ Here is a simple CRUD use case illustrated in the default template: * [.NET Framework 6.0](https://devblogs.microsoft.com/dotnet/announcing-net-6/) - The Fastest .NET Yet * [ASP.NET Core (Web Api)](https://dotnet.microsoft.com/en-us/apps/aspnet/apis) * [Entity Framework Core](https://docs.microsoft.com/en-us/ef/core/) -* [C#](https://docs.microsoft.com/en-us/dotnet/csharp/) +* [C# Programming Language](https://docs.microsoft.com/en-us/dotnet/csharp/) * [Visual Studio](https://visualstudio.microsoft.com/) -* [Azure App Services](https://azure.microsoft.com/en-gb/services/app-service/#overview) ## System Requirements (Development) From 26230ffc71f66f0a740fc1570cc90d792b5f0541 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 13 Apr 2022 17:08:57 +0100 Subject: [PATCH 069/204] -- added custom methods to support real world test data, --- .../DbContextDataInitializer.cs | 8 +--- .../Eisk.EFCore.Setup.csproj | 1 + .../Eisk.EFCore.Setup/EmployeeDataFactory.cs | 48 +++++++++++++++++++ 3 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 Infrastructure.EFCore/Eisk.EFCore.Setup/EmployeeDataFactory.cs diff --git a/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs b/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs index 5e7bdbba..8e2fce10 100644 --- a/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs +++ b/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs @@ -21,13 +21,7 @@ public static void Initialize(AppDbContext context) } for (int i = 0; i < 10; i++) - context.Employees.Add( - EntityDataFactory.Factory_Entity_Instance( - x => - { - x.Id = 0; - x.ReportsToId = null; - })); + context.Employees.Add(new EmployeeDataFactory().Factory_Entity()); context.SaveChanges(); } diff --git a/Infrastructure.EFCore/Eisk.EFCore.Setup/Eisk.EFCore.Setup.csproj b/Infrastructure.EFCore/Eisk.EFCore.Setup/Eisk.EFCore.Setup.csproj index 000dbcfa..f603cf04 100644 --- a/Infrastructure.EFCore/Eisk.EFCore.Setup/Eisk.EFCore.Setup.csproj +++ b/Infrastructure.EFCore/Eisk.EFCore.Setup/Eisk.EFCore.Setup.csproj @@ -4,6 +4,7 @@ net6.0 + diff --git a/Infrastructure.EFCore/Eisk.EFCore.Setup/EmployeeDataFactory.cs b/Infrastructure.EFCore/Eisk.EFCore.Setup/EmployeeDataFactory.cs new file mode 100644 index 00000000..b8896db4 --- /dev/null +++ b/Infrastructure.EFCore/Eisk.EFCore.Setup/EmployeeDataFactory.cs @@ -0,0 +1,48 @@ +using System; +using AutoFixture; +using Bogus; +using Eisk.Domains.Entities; +using Eisk.Domains.Enums; + +namespace Eisk.Test.Core.DataGen +{ + public class EmployeeDataFactory:EntityDataFactory + { + public override Employee Factory_Entity(Action action = null, Action fixtureAction = null) + { + var employee = base.Factory_Entity(action, fixtureAction); + + var faker = new Faker(); + + employee.Id = 0; + employee.ReportsTo = null; + employee.ReportsToId = null; + employee.Subordinates = null; + + employee.TitleOfCourtesy = faker.PickRandom(); + employee.FirstName = faker.Person.FirstName; + employee.LastName = faker.Person.LastName; + employee.BirthDate = faker.Date.Past(); + + var fakerAddress = faker.Address; + employee.Address = new Domains.ValueObjects.Address + { + AddressLine = fakerAddress.StreetAddress(), + City = fakerAddress.City(), + PostalCode = fakerAddress.ZipCode(), + Region = fakerAddress.State(), + Country = fakerAddress.Country(), + }; + + employee.HireDate = faker.Date.Future(); + employee.Title = null; + employee.Phone = faker.Person.Phone; + employee.Extension = null; + + employee.Photo = null; + employee.Notes = null; + + return employee; + } + } +} From 5fe1dd0a3e9fed52fc4f1209a57f7c42a1b95cb6 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 13 Apr 2022 17:51:06 +0100 Subject: [PATCH 070/204] included sample test data. --- .../IEmployeeDataService.cs | 5 ++-- .../Eisk.Domains.TestData.csproj | 19 +++++++++++++++ .../EmployeeDataFactory.cs | 23 +++++++++++-------- Eisk.WebApi.TemplatePack.sln | 7 ++++++ .../DbContextDataInitializer.cs | 9 ++++---- .../Eisk.EFCore.Setup.csproj | 2 +- 6 files changed, 48 insertions(+), 17 deletions(-) create mode 100644 DomainCore/Eisk.Domains.TestData/Eisk.Domains.TestData.csproj rename {Infrastructure.EFCore/Eisk.EFCore.Setup => DomainCore/Eisk.Domains.TestData}/EmployeeDataFactory.cs (74%) diff --git a/DomainCore/Eisk.DataServices.Interfaces/IEmployeeDataService.cs b/DomainCore/Eisk.DataServices.Interfaces/IEmployeeDataService.cs index 9a8cbf4d..ee5db513 100644 --- a/DomainCore/Eisk.DataServices.Interfaces/IEmployeeDataService.cs +++ b/DomainCore/Eisk.DataServices.Interfaces/IEmployeeDataService.cs @@ -1,10 +1,11 @@ using System.Collections.Generic; -using Eisk.Core.DataService; using System.Threading.Tasks; -using Eisk.Domains.Entities; namespace Eisk.DataServices.Interfaces { + using Core.DataService; + using Domains.Entities; + public interface IEmployeeDataService: IEntityDataService { Task> GetByFirstName(string firstName); diff --git a/DomainCore/Eisk.Domains.TestData/Eisk.Domains.TestData.csproj b/DomainCore/Eisk.Domains.TestData/Eisk.Domains.TestData.csproj new file mode 100644 index 00000000..df4903a0 --- /dev/null +++ b/DomainCore/Eisk.Domains.TestData/Eisk.Domains.TestData.csproj @@ -0,0 +1,19 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + + + diff --git a/Infrastructure.EFCore/Eisk.EFCore.Setup/EmployeeDataFactory.cs b/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs similarity index 74% rename from Infrastructure.EFCore/Eisk.EFCore.Setup/EmployeeDataFactory.cs rename to DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs index b8896db4..1fd5e640 100644 --- a/Infrastructure.EFCore/Eisk.EFCore.Setup/EmployeeDataFactory.cs +++ b/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs @@ -1,17 +1,20 @@ -using System; -using AutoFixture; -using Bogus; -using Eisk.Domains.Entities; -using Eisk.Domains.Enums; +using Bogus; -namespace Eisk.Test.Core.DataGen +namespace Eisk.Domains.TestData { + using Domains.Entities; + using Domains.Enums; + using Test.Core.DataGen; + public class EmployeeDataFactory:EntityDataFactory { - public override Employee Factory_Entity(Action action = null, Action fixtureAction = null) + public Employee Factory_Entity() { - var employee = base.Factory_Entity(action, fixtureAction); + return base.Factory_Entity(AssignEmployee); + } + void AssignEmployee(Employee employee) + { var faker = new Faker(); employee.Id = 0; @@ -40,9 +43,9 @@ public override Employee Factory_Entity(Action action = null, Actionnet6.0 - + From 2ec12309ecb90bd0f477c586949c1f781fba9050 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 13 Apr 2022 17:56:52 +0100 Subject: [PATCH 071/204] updated namespace declaration --- DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs b/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs index 1fd5e640..203ed593 100644 --- a/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs +++ b/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs @@ -2,8 +2,8 @@ namespace Eisk.Domains.TestData { - using Domains.Entities; - using Domains.Enums; + using Entities; + using Enums; using Test.Core.DataGen; public class EmployeeDataFactory:EntityDataFactory @@ -28,7 +28,7 @@ void AssignEmployee(Employee employee) employee.BirthDate = faker.Date.Past(); var fakerAddress = faker.Address; - employee.Address = new Domains.ValueObjects.Address + employee.Address = new ValueObjects.Address { AddressLine = fakerAddress.StreetAddress(), City = fakerAddress.City(), From 0764b37acc4f8b3aa5e54fa61593dfff18c91600 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 13 Apr 2022 18:02:09 +0100 Subject: [PATCH 072/204] included command notes --- Eisk.WebApi.TemplatePack.sln | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Eisk.WebApi.TemplatePack.sln b/Eisk.WebApi.TemplatePack.sln index 46450162..902c29e5 100644 --- a/Eisk.WebApi.TemplatePack.sln +++ b/Eisk.WebApi.TemplatePack.sln @@ -55,6 +55,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.WebApi", "WebApi\Eisk. EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Notes", "Notes", "{ACEB7D4D-4789-49F0-A552-3D7C0A419FB9}" ProjectSection(SolutionItems) = preProject + Notes\Commands.txt = Notes\Commands.txt Notes\Modules.txt = Notes\Modules.txt Notes\Notes.txt = Notes\Notes.txt Notes\Release-Instructions.txt = Notes\Release-Instructions.txt @@ -64,7 +65,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Notes", "Notes", "{ACEB7D4D Notes\Troubleshoot.txt = Notes\Troubleshoot.txt EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Eisk.Domains.TestData", "DomainCore\Eisk.Domains.TestData\Eisk.Domains.TestData.csproj", "{D0227185-3F9D-41B4-9314-C7B3CBC38D6F}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.Domains.TestData", "DomainCore\Eisk.Domains.TestData\Eisk.Domains.TestData.csproj", "{D0227185-3F9D-41B4-9314-C7B3CBC38D6F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution From a80b26a8438e7e7fd3b2c375559495de43cd3fab Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 13 Apr 2022 18:30:54 +0100 Subject: [PATCH 073/204] update --- Notes/TODO.txt | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 83b929ad..1978c590 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -1,14 +1,11 @@ ======================================================== TODO: Today -* generate template from nuget package * review template documentations * check rendered output for template with VS * check conditional rendering (file) * check conditional rendering (text) -* Rename Eisk.DomainServices.ComponentTests.EFCore -> Eisk.DomainServices.ComponentTests? - ======================================================== TODO: @@ -32,12 +29,13 @@ Testing * test post and update methods * identify test strategy, check base tests usability -Doc -R * Point new doc under root -R * Doc content writing +Release Tasks +* Merge V9.0 branch to master +* Publish nuget package to nuget gallery Others * include instruction for template build and publish +* Rename Eisk.DomainServices.ComponentTests.EFCore -> Eisk.DomainServices.ComponentTests? ======================================================== Phases @@ -85,6 +83,7 @@ DONE * Deploy to web service v9 DONE * Fix deploy to web service v8 Build / packagaing +DONE * generate template from nuget package DONE * Run docs locally DONE * Fix local run (web api) v8 DONE * Fix local run (web api) v9 @@ -96,6 +95,12 @@ DONE * Fix project load issue for rendered content. issue: long file path DONE * Exclude unused project files (test projects) DONE * Exclude unused project files (notes) +Testing +DONE * Add test data generator for employee (with meaningful sample data) + +Release Tasks +DONE * Update readme.md + Others DONE * Finalize versioning From 2e65de90390b4b7c8caafb7c3f7c48096b84a27e Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 13 Apr 2022 18:37:24 +0100 Subject: [PATCH 074/204] updated error message for portal code property. --- DomainCore/Eisk.Domains/ValueObjects/Address.cs | 2 +- Notes/TODO.txt | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/DomainCore/Eisk.Domains/ValueObjects/Address.cs b/DomainCore/Eisk.Domains/ValueObjects/Address.cs index f3a282c4..9833f2b4 100644 --- a/DomainCore/Eisk.Domains/ValueObjects/Address.cs +++ b/DomainCore/Eisk.Domains/ValueObjects/Address.cs @@ -16,7 +16,7 @@ public class Address public string Region { get; set; } [StringLength(10)] - [RegularExpression("\\d{1,10}", ErrorMessage = "Not a valid postal code. Please consider upto 10 digit for valid phone format.")] + [RegularExpression("\\d{1,10}", ErrorMessage = "Not a valid postal code. Please consider upto 10 digit for valid postal format.")] [Display(Name = "Postal Code")] public string PostalCode { get; set; } diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 1978c590..f078686b 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -1,6 +1,7 @@ ======================================================== TODO: Today +R * apply custom business logic * review template documentations * check rendered output for template with VS * check conditional rendering (file) @@ -20,20 +21,20 @@ Fix CD (Remote) Build / packagaing Code -R * apply custom business logic -* explore new .net features * added exception handler for controller * add log functionality Testing * test post and update methods * identify test strategy, check base tests usability +* test data service with sql server local instance Release Tasks * Merge V9.0 branch to master * Publish nuget package to nuget gallery Others +* explore new .net features * include instruction for template build and publish * Rename Eisk.DomainServices.ComponentTests.EFCore -> Eisk.DomainServices.ComponentTests? From 40f91bf99069c4d8883f5f118973307828a5ece5 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 13 Apr 2022 18:47:55 +0100 Subject: [PATCH 075/204] update --- Notes/TODO.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Notes/TODO.txt b/Notes/TODO.txt index f078686b..3d089a0d 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -25,6 +25,7 @@ Code * add log functionality Testing +* Include custom entity data factory in entity test base * test post and update methods * identify test strategy, check base tests usability * test data service with sql server local instance From d417c44b2fbfc2534392911c300bbbc0b2fd4792 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 13 Apr 2022 18:57:00 +0100 Subject: [PATCH 076/204] updated web site for api. --- WebApi/Eisk.WebApi/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebApi/Eisk.WebApi/Program.cs b/WebApi/Eisk.WebApi/Program.cs index 2120588c..7ef9ab02 100644 --- a/WebApi/Eisk.WebApi/Program.cs +++ b/WebApi/Eisk.WebApi/Program.cs @@ -23,7 +23,7 @@ { Name = "EISK Web Api", Email = string.Empty, - Url = new Uri("https://eisk.github.io/eisk.webapi") + Url = new Uri("https://eisk.github.io") } }); }); From 31ea6524b5b99a947a17b78af354bd09ad7f6a13 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 13 Apr 2022 20:05:42 +0100 Subject: [PATCH 077/204] entity data factory refactoring (to be continued) --- DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs | 2 +- .../EmployeeDataServiceBaseIntegrationTests.cs | 1 + .../EmployeeDataServiceTests.cs | 3 ++- .../EmployeeDomainServiceComponentTests.cs | 3 ++- Notes/TODO.txt | 3 +++ 5 files changed, 9 insertions(+), 3 deletions(-) diff --git a/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs b/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs index 203ed593..026a02ee 100644 --- a/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs +++ b/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs @@ -8,7 +8,7 @@ namespace Eisk.Domains.TestData public class EmployeeDataFactory:EntityDataFactory { - public Employee Factory_Entity() + public override Employee Factory_Entity(Action action) { return base.Factory_Entity(AssignEmployee); } diff --git a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/EmployeeDataServiceBaseIntegrationTests.cs b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/EmployeeDataServiceBaseIntegrationTests.cs index 3397f32f..d719d84b 100644 --- a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/EmployeeDataServiceBaseIntegrationTests.cs +++ b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/EmployeeDataServiceBaseIntegrationTests.cs @@ -1,5 +1,6 @@ using Eisk.DataServices.Interfaces; using Eisk.Domains.Entities; +using Eisk.Domains.TestData; using Eisk.Test.Core.TestBases; namespace Eisk.DataServices.EFCore.IntegrationTests.Ext diff --git a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/EmployeeDataServiceTests.cs b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/EmployeeDataServiceTests.cs index 37c2a9d3..e6a6405c 100644 --- a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/EmployeeDataServiceTests.cs +++ b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/EmployeeDataServiceTests.cs @@ -4,10 +4,11 @@ namespace Eisk.DataServices.EFCore.IntegrationTests using Eisk.EFCore.Setup; using Domains.Entities; using Test.Core.TestBases; + using Eisk.Domains.TestData; public class EmployeeDataServiceTests: DataServiceBaseIntegrationTests { - public EmployeeDataServiceTests():base (new EmployeeDataService(TestDbContextFactory.CreateDbContext()), x => x.Id) + public EmployeeDataServiceTests():base (new EmployeeDataService(TestDbContextFactory.CreateDbContext()), x => x.Id, new EmployeeDataFactory()) { } diff --git a/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/EmployeeDomainServiceComponentTests.cs b/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/EmployeeDomainServiceComponentTests.cs index 67e62730..3836fc32 100644 --- a/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/EmployeeDomainServiceComponentTests.cs +++ b/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/EmployeeDomainServiceComponentTests.cs @@ -1,5 +1,6 @@ using Eisk.DataServices.EFCore; using Eisk.Domains.Entities; +using Eisk.Domains.TestData; using Eisk.EFCore.Setup; using Eisk.Test.Core.TestBases; @@ -8,7 +9,7 @@ namespace Eisk.DomainServices.ComponentTests.EFCore public class EmployeeDomainServiceComponentTests : DomainServiceBaseComponentTests { public EmployeeDomainServiceComponentTests() : - base(new EmployeeDomainService(Factory_DataService()), x => x.Id) + base(new EmployeeDomainService(Factory_DataService()), x => x.Id, new EmployeeDataFactory()) { } diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 3d089a0d..0c2fa142 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -1,6 +1,9 @@ ======================================================== TODO: Today +* Complete custom data generator implementation +* Check-in submodule + R * apply custom business logic * review template documentations * check rendered output for template with VS From bc1755d0e3d6287213a82391d58b65c733d5eb6a Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Thu, 14 Apr 2022 02:59:04 +0100 Subject: [PATCH 078/204] removed submodule dependencies --- .gitmodules | 3 --- DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs | 4 +++- 2 files changed, 3 insertions(+), 4 deletions(-) delete mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index e08ab148..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "Core"] - path = Core - url = https://github.com/EISK/eisk.core.git diff --git a/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs b/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs index 026a02ee..6e08ada6 100644 --- a/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs +++ b/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs @@ -10,7 +10,9 @@ public class EmployeeDataFactory:EntityDataFactory { public override Employee Factory_Entity(Action action) { - return base.Factory_Entity(AssignEmployee); + var employee = base.Factory_Entity(AssignEmployee); + action(employee); + return employee; } void AssignEmployee(Employee employee) From fa2eda0cdd404e9afbbf0fc4d7ad1599eb2a5c77 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Thu, 14 Apr 2022 03:35:23 +0100 Subject: [PATCH 079/204] * core module removed and code re-added --- Core | 1 - 1 file changed, 1 deletion(-) delete mode 160000 Core diff --git a/Core b/Core deleted file mode 160000 index cc553aad..00000000 --- a/Core +++ /dev/null @@ -1 +0,0 @@ -Subproject commit cc553aadd4ea309fca1f815f53fc8e4ff4abecb2 From eaaeb463ea448dcdae2f6966f2796937fff7a592 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Thu, 14 Apr 2022 03:35:55 +0100 Subject: [PATCH 080/204] core module added --- Core/Eisk.Core.Tests/Eisk.Core.Tests.csproj | 22 ++ Core/Eisk.Core.Tests/UnitTest1.cs | 13 + .../DataService/EFCore/EntityDataService.cs | 51 ++++ .../DataService/IEntityDataService.cs | 14 ++ Core/Eisk.Core/DomainService/DomainService.cs | 101 ++++++++ Core/Eisk.Core/Eisk.Core.csproj | 13 + Core/Eisk.Core/Exceptions/CoreException.cs | 32 +++ Core/Eisk.Core/Exceptions/DomainException.cs | 10 + .../InvalidLookupIdParameterException.cs | 11 + .../Exceptions/NonExistantEntityException.cs | 12 + .../Exceptions/NullInputEntityException.cs | 10 + .../Exceptions/UpdatingIdIsNotSupported.cs | 12 + Core/Eisk.Core/Utils/ExceptionThrower.cs | 14 ++ Core/Eisk.Core/Utils/ExpressionUtil.cs | 36 +++ Core/Eisk.Core/Utils/ObjectExtensions.cs | 13 + Core/Eisk.Core/Utils/UriAttribute.cs | 26 ++ Core/Eisk.Core/WebApi/WebApiControllerBase.cs | 49 ++++ .../Eisk.Test.Core.Tests.csproj | 22 ++ Core/Eisk.Test.Core.Tests/UnitTest1.cs | 13 + .../DataGen/DomainUriGenerator.cs | 67 +++++ .../DataGen/EntityDataFactory.cs | 37 +++ .../DataGen/IntegerValueGenerator.cs | 21 ++ .../Eisk.Test.Core/DataGen/InvalidData/Get.cs | 24 ++ .../InvalidData/InvalidAlphanumeric.cs | 10 + .../DataGen/InvalidData/InvalidEmail.cs | 10 + .../DataGen/InvalidData/InvalidUri.cs | 10 + .../StringWithSpecialCharacters.cs | 7 + .../DataGen/StringAttributeAggregatedRelay.cs | 59 +++++ .../DataGen/StringValueGenerator.cs | 21 ++ Core/Eisk.Test.Core/Eisk.Test.Core.csproj | 17 ++ .../DataServiceBaseIntegrationTests.cs | 238 ++++++++++++++++++ .../DomainServiceBaseComponentTests.cs | 152 +++++++++++ .../TestBases/EntityTestBase.cs | 53 ++++ Core/Eisk.Test.Core/TestBases/IServiceTest.cs | 9 + Core/Eisk.Test.Core/TestBases/TestBase.cs | 25 ++ .../EmployeeDataFactory.cs | 8 +- 36 files changed, 1239 insertions(+), 3 deletions(-) create mode 100644 Core/Eisk.Core.Tests/Eisk.Core.Tests.csproj create mode 100644 Core/Eisk.Core.Tests/UnitTest1.cs create mode 100644 Core/Eisk.Core/DataService/EFCore/EntityDataService.cs create mode 100644 Core/Eisk.Core/DataService/IEntityDataService.cs create mode 100644 Core/Eisk.Core/DomainService/DomainService.cs create mode 100644 Core/Eisk.Core/Eisk.Core.csproj create mode 100644 Core/Eisk.Core/Exceptions/CoreException.cs create mode 100644 Core/Eisk.Core/Exceptions/DomainException.cs create mode 100644 Core/Eisk.Core/Exceptions/InvalidLookupIdParameterException.cs create mode 100644 Core/Eisk.Core/Exceptions/NonExistantEntityException.cs create mode 100644 Core/Eisk.Core/Exceptions/NullInputEntityException.cs create mode 100644 Core/Eisk.Core/Exceptions/UpdatingIdIsNotSupported.cs create mode 100644 Core/Eisk.Core/Utils/ExceptionThrower.cs create mode 100644 Core/Eisk.Core/Utils/ExpressionUtil.cs create mode 100644 Core/Eisk.Core/Utils/ObjectExtensions.cs create mode 100644 Core/Eisk.Core/Utils/UriAttribute.cs create mode 100644 Core/Eisk.Core/WebApi/WebApiControllerBase.cs create mode 100644 Core/Eisk.Test.Core.Tests/Eisk.Test.Core.Tests.csproj create mode 100644 Core/Eisk.Test.Core.Tests/UnitTest1.cs create mode 100644 Core/Eisk.Test.Core/DataGen/DomainUriGenerator.cs create mode 100644 Core/Eisk.Test.Core/DataGen/EntityDataFactory.cs create mode 100644 Core/Eisk.Test.Core/DataGen/IntegerValueGenerator.cs create mode 100644 Core/Eisk.Test.Core/DataGen/InvalidData/Get.cs create mode 100644 Core/Eisk.Test.Core/DataGen/InvalidData/InvalidAlphanumeric.cs create mode 100644 Core/Eisk.Test.Core/DataGen/InvalidData/InvalidEmail.cs create mode 100644 Core/Eisk.Test.Core/DataGen/InvalidData/InvalidUri.cs create mode 100644 Core/Eisk.Test.Core/DataGen/InvalidData/StringWithSpecialCharacters.cs create mode 100644 Core/Eisk.Test.Core/DataGen/StringAttributeAggregatedRelay.cs create mode 100644 Core/Eisk.Test.Core/DataGen/StringValueGenerator.cs create mode 100644 Core/Eisk.Test.Core/Eisk.Test.Core.csproj create mode 100644 Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs create mode 100644 Core/Eisk.Test.Core/TestBases/DomainServiceBaseComponentTests.cs create mode 100644 Core/Eisk.Test.Core/TestBases/EntityTestBase.cs create mode 100644 Core/Eisk.Test.Core/TestBases/IServiceTest.cs create mode 100644 Core/Eisk.Test.Core/TestBases/TestBase.cs diff --git a/Core/Eisk.Core.Tests/Eisk.Core.Tests.csproj b/Core/Eisk.Core.Tests/Eisk.Core.Tests.csproj new file mode 100644 index 00000000..5bdb9bf0 --- /dev/null +++ b/Core/Eisk.Core.Tests/Eisk.Core.Tests.csproj @@ -0,0 +1,22 @@ + + + + net6.0 + + false + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + diff --git a/Core/Eisk.Core.Tests/UnitTest1.cs b/Core/Eisk.Core.Tests/UnitTest1.cs new file mode 100644 index 00000000..924f85f2 --- /dev/null +++ b/Core/Eisk.Core.Tests/UnitTest1.cs @@ -0,0 +1,13 @@ +using Xunit; + +namespace Eisk.Core.Tests +{ + public class UnitTest1 + { + [Fact] + public void Test1() + { + + } + } +} diff --git a/Core/Eisk.Core/DataService/EFCore/EntityDataService.cs b/Core/Eisk.Core/DataService/EFCore/EntityDataService.cs new file mode 100644 index 00000000..69d13c93 --- /dev/null +++ b/Core/Eisk.Core/DataService/EFCore/EntityDataService.cs @@ -0,0 +1,51 @@ +using Microsoft.EntityFrameworkCore; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Eisk.Core.DataService.EFCore +{ + public class EntityDataService : IEntityDataService where TEntity : class, new() + { + protected readonly DbContext DbContext; + + public EntityDataService(DbContext dbContext) + { + DbContext = dbContext; + } + + public virtual async Task GetById(TId id) + { + return await DbContext.Set().FindAsync(id); + } + + public virtual async Task> GetAll() + { + return await DbContext.Set().ToListAsync(); + } + + public virtual async Task Add(TEntity entity) + { + var obj = DbContext.Add(entity); +; + await DbContext.SaveChangesAsync(); + + return obj.Entity; + } + + public virtual async Task Update(TEntity entity) + { + var obj = DbContext.Update(entity); + + await DbContext.SaveChangesAsync(); + + return obj.Entity; + } + + public virtual async Task Delete(TEntity entity) + { + DbContext.Remove(entity); + + await DbContext.SaveChangesAsync(); + } + } +} \ No newline at end of file diff --git a/Core/Eisk.Core/DataService/IEntityDataService.cs b/Core/Eisk.Core/DataService/IEntityDataService.cs new file mode 100644 index 00000000..3eb80251 --- /dev/null +++ b/Core/Eisk.Core/DataService/IEntityDataService.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Eisk.Core.DataService +{ + public interface IEntityDataService where TEntity : class, new() + { + Task GetById(TId id); + Task> GetAll(); + Task Add(TEntity entity); + Task Update(TEntity entity); + Task Delete(TEntity entity); + } +} \ No newline at end of file diff --git a/Core/Eisk.Core/DomainService/DomainService.cs b/Core/Eisk.Core/DomainService/DomainService.cs new file mode 100644 index 00000000..617addf7 --- /dev/null +++ b/Core/Eisk.Core/DomainService/DomainService.cs @@ -0,0 +1,101 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Eisk.Core.Exceptions; + +namespace Eisk.Core.DomainService +{ + using DataService; + using Utils; + + public class DomainService + where TDomain : class, new() + { + readonly IEntityDataService _entityDataService; + + public DomainService(IEntityDataService entityDataService) + { + _entityDataService = entityDataService; + } + + public virtual async Task> GetAll() + { + return await _entityDataService.GetAll(); + } + + public virtual async Task GetById(TId id) + { + if (id.IsNullOrEmpty()) + ThrowExceptionForInvalidLookupIdParameter(); + + var entityInDb = await _entityDataService.GetById(id); + + if (entityInDb == null) + ThrowExceptionForNonExistantEntity(id); + + return entityInDb; + } + + public virtual async Task Add(TDomain entity) + { + return await Add(entity, null); + } + + public virtual async Task Add(TDomain entity, Action preProcessAction, Action postProcessAction = null) + { + if (entity == null) + ThrowExceptionForNullInputEntity(); + + preProcessAction?.Invoke(entity); + + var returnVal = await _entityDataService.Add(entity); + + postProcessAction?.Invoke(returnVal); + + return returnVal; + } + + public virtual async Task Update(TId id, TDomain newEntity) + { + return await Update(id, newEntity, null); + } + + public virtual async Task Update(TId id, TDomain newEntity, Action preProcessAction, Action postProcessAction = null) + { + if (newEntity == null) + ThrowExceptionForNullInputEntity(); + + var oldEntity = await GetById(id); + + preProcessAction?.Invoke(oldEntity, newEntity); + + var returnVal = await _entityDataService.Update(newEntity); + + postProcessAction?.Invoke(returnVal); + + return returnVal; + } + + public virtual async Task Delete(TId id) + { + var entityInDb = await GetById(id); + + await _entityDataService.Delete(entityInDb); + } + + protected virtual void ThrowExceptionForNullInputEntity() + { + throw new NullInputEntityException(); + } + + protected virtual void ThrowExceptionForInvalidLookupIdParameter() + { + throw new InvalidLookupIdParameterException(); + } + + protected virtual void ThrowExceptionForNonExistantEntity(TId idValue) + { + throw new NonExistantEntityException(idValue); + } + } +} \ No newline at end of file diff --git a/Core/Eisk.Core/Eisk.Core.csproj b/Core/Eisk.Core/Eisk.Core.csproj new file mode 100644 index 00000000..56861b2e --- /dev/null +++ b/Core/Eisk.Core/Eisk.Core.csproj @@ -0,0 +1,13 @@ + + + + net6.0 + Library + + + + + + + + diff --git a/Core/Eisk.Core/Exceptions/CoreException.cs b/Core/Eisk.Core/Exceptions/CoreException.cs new file mode 100644 index 00000000..38b9613e --- /dev/null +++ b/Core/Eisk.Core/Exceptions/CoreException.cs @@ -0,0 +1,32 @@ +using System; + +namespace Eisk.Core.Exceptions +{ + public class CoreException : Exception + { + private const string DefaultErrorCode = "APP-ERROR-000"; + + private string _message; + public override string Message => _message ?? (_message = ConvertToSentence(GetType().Name, ErrorCode)); + + private string _errorCode; + + /// + /// Error code helps distringuishing same types of errors in different context. + /// + public string ErrorCode => _errorCode ?? (_errorCode = DefaultErrorCode); + + public CoreException(string message = null, string errorCode = null) + { + _message = message; + _errorCode = errorCode; + } + + //TODO: convert class name to sentence + static string ConvertToSentence(string message, string errorCode) + { + return errorCode + ": " + message; + } + + } +} \ No newline at end of file diff --git a/Core/Eisk.Core/Exceptions/DomainException.cs b/Core/Eisk.Core/Exceptions/DomainException.cs new file mode 100644 index 00000000..23adf447 --- /dev/null +++ b/Core/Eisk.Core/Exceptions/DomainException.cs @@ -0,0 +1,10 @@ +namespace Eisk.Core.Exceptions +{ + public class DomainException: CoreException + { + public DomainException(string message = null, string errorCode = null) : base(message, errorCode) + { + + } + } +} \ No newline at end of file diff --git a/Core/Eisk.Core/Exceptions/InvalidLookupIdParameterException.cs b/Core/Eisk.Core/Exceptions/InvalidLookupIdParameterException.cs new file mode 100644 index 00000000..7e2ec5d5 --- /dev/null +++ b/Core/Eisk.Core/Exceptions/InvalidLookupIdParameterException.cs @@ -0,0 +1,11 @@ +namespace Eisk.Core.Exceptions +{ + public class InvalidLookupIdParameterException: DomainException + { + public InvalidLookupIdParameterException(string paramName = "id") : base( + $"Invalid lookup parameter: {paramName} to find {typeof(TEntity).Name}.", "APP-DATA-ERROR-001") + { + + } + } +} \ No newline at end of file diff --git a/Core/Eisk.Core/Exceptions/NonExistantEntityException.cs b/Core/Eisk.Core/Exceptions/NonExistantEntityException.cs new file mode 100644 index 00000000..095a8e7d --- /dev/null +++ b/Core/Eisk.Core/Exceptions/NonExistantEntityException.cs @@ -0,0 +1,12 @@ +namespace Eisk.Core.Exceptions +{ + public class NonExistantEntityException : DomainException + + { + public NonExistantEntityException(object paramValue, string paramName = "id") : base( + $"No {typeof(TEntity).Name} exists for given id {paramValue} for parameter {paramName}.", "APP-DATA-ERROR-002") + { + + } + } +} \ No newline at end of file diff --git a/Core/Eisk.Core/Exceptions/NullInputEntityException.cs b/Core/Eisk.Core/Exceptions/NullInputEntityException.cs new file mode 100644 index 00000000..99922357 --- /dev/null +++ b/Core/Eisk.Core/Exceptions/NullInputEntityException.cs @@ -0,0 +1,10 @@ +namespace Eisk.Core.Exceptions +{ + public class NullInputEntityException : DomainException + { + public NullInputEntityException() : base("Input object to be created or updated is null.", "APP-DATA-ERROR-003") + { + + } + } +} \ No newline at end of file diff --git a/Core/Eisk.Core/Exceptions/UpdatingIdIsNotSupported.cs b/Core/Eisk.Core/Exceptions/UpdatingIdIsNotSupported.cs new file mode 100644 index 00000000..17f715ef --- /dev/null +++ b/Core/Eisk.Core/Exceptions/UpdatingIdIsNotSupported.cs @@ -0,0 +1,12 @@ +namespace Eisk.Core.Exceptions +{ + public class UpdatingIdIsNotSupported: DomainException + + { + public UpdatingIdIsNotSupported(object paramValue, string paramName = "id") : base( + $"Updating {typeof(TEntity).Name} field {paramName} is not supported. Provided value: {paramValue}.", "APP-DATA-ERROR-004") + { + + } + } +} \ No newline at end of file diff --git a/Core/Eisk.Core/Utils/ExceptionThrower.cs b/Core/Eisk.Core/Utils/ExceptionThrower.cs new file mode 100644 index 00000000..19c52748 --- /dev/null +++ b/Core/Eisk.Core/Utils/ExceptionThrower.cs @@ -0,0 +1,14 @@ +namespace Eisk.Core.Utils +{ + using Exceptions; + + public class ExceptionThrower + { + + public static void Throws() + where T : CoreException, new() + { + throw new T(); + } + } +} \ No newline at end of file diff --git a/Core/Eisk.Core/Utils/ExpressionUtil.cs b/Core/Eisk.Core/Utils/ExpressionUtil.cs new file mode 100644 index 00000000..eb0014aa --- /dev/null +++ b/Core/Eisk.Core/Utils/ExpressionUtil.cs @@ -0,0 +1,36 @@ +using System; +using System.Linq.Expressions; +using System.Reflection; + +namespace Eisk.Core.Utils +{ + using Exceptions; + + public static class ExpressionUtil + { + public static object GetPropertyValue(Expression> expression, TDomain data) + { + if (data == null) + throw new NullInputEntityException(); + + var prop = GetPropertyInfo(expression); + var value = prop.GetValue(data); + return value; + } + + public static void SetPropertyValue(Expression> expression, TDomain data, object value) + { + if (data == null) + throw new NullInputEntityException(); + + var prop = GetPropertyInfo(expression); + prop.SetValue(data, value); + } + + public static PropertyInfo GetPropertyInfo(Expression> expression) + { + var expr = (MemberExpression)expression.Body; + return (PropertyInfo)expr.Member; + } + } +} \ No newline at end of file diff --git a/Core/Eisk.Core/Utils/ObjectExtensions.cs b/Core/Eisk.Core/Utils/ObjectExtensions.cs new file mode 100644 index 00000000..c4e9f8f8 --- /dev/null +++ b/Core/Eisk.Core/Utils/ObjectExtensions.cs @@ -0,0 +1,13 @@ +namespace Eisk.Core.Utils +{ + public static class ObjectExtensions + { + public static bool IsNullOrEmpty(this T value) + { + if (typeof(T) == typeof(string)) + return string.IsNullOrEmpty(value as string); + + return value == null || value.Equals(default(T)); + } + } +} \ No newline at end of file diff --git a/Core/Eisk.Core/Utils/UriAttribute.cs b/Core/Eisk.Core/Utils/UriAttribute.cs new file mode 100644 index 00000000..7815598d --- /dev/null +++ b/Core/Eisk.Core/Utils/UriAttribute.cs @@ -0,0 +1,26 @@ +using System; +using System.ComponentModel.DataAnnotations; + +namespace Eisk.Core.Utils +{ + public class UriAttribute : ValidationAttribute + { + protected override ValidationResult IsValid(object value, ValidationContext validationContext) + { + if (value != null) + { + try + { + // ReSharper disable once ObjectCreationAsStatement + new Uri(value.ToString()); + } + catch (Exception ex) + { + return new ValidationResult(ex.Message); + } + } + return ValidationResult.Success; + } + + } +} \ No newline at end of file diff --git a/Core/Eisk.Core/WebApi/WebApiControllerBase.cs b/Core/Eisk.Core/WebApi/WebApiControllerBase.cs new file mode 100644 index 00000000..32b164ad --- /dev/null +++ b/Core/Eisk.Core/WebApi/WebApiControllerBase.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Eisk.Core.DomainService; +using Microsoft.AspNetCore.Mvc; + +namespace Eisk.Core.WebApi +{ + [ApiController] + [Route("api/[controller]")] + public abstract class WebApiControllerBase: ControllerBase + where TDomain : class, new() + { + protected DomainService DomainService; + protected WebApiControllerBase(DomainService domainService) + { + DomainService = domainService; + } + + [HttpGet] + public virtual async Task> Get() + { + return await DomainService.GetAll(); + } + + [HttpGet("{id}")] + public virtual async Task Get(TId id) + { + return await DomainService.GetById(id); + } + + [HttpPost] + public virtual async Task Post(TDomain domain) + { + await DomainService.Add(domain); + } + + [HttpPut("{id}")] + public virtual async Task Put(TId id, TDomain domain) + { + await DomainService.Update(id, domain); + } + + [HttpDelete("{id}")] + public virtual async Task Delete(TId id) + { + await DomainService.Delete(id); + } + } +} diff --git a/Core/Eisk.Test.Core.Tests/Eisk.Test.Core.Tests.csproj b/Core/Eisk.Test.Core.Tests/Eisk.Test.Core.Tests.csproj new file mode 100644 index 00000000..863e45ad --- /dev/null +++ b/Core/Eisk.Test.Core.Tests/Eisk.Test.Core.Tests.csproj @@ -0,0 +1,22 @@ + + + + net6.0 + + false + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + diff --git a/Core/Eisk.Test.Core.Tests/UnitTest1.cs b/Core/Eisk.Test.Core.Tests/UnitTest1.cs new file mode 100644 index 00000000..9767d276 --- /dev/null +++ b/Core/Eisk.Test.Core.Tests/UnitTest1.cs @@ -0,0 +1,13 @@ +using Xunit; + +namespace Eisk.Test.Core.Tests +{ + public class UnitTest1 + { + [Fact] + public void Test1() + { + //test- update from submodule .. more update + } + } +} diff --git a/Core/Eisk.Test.Core/DataGen/DomainUriGenerator.cs b/Core/Eisk.Test.Core/DataGen/DomainUriGenerator.cs new file mode 100644 index 00000000..8d286883 --- /dev/null +++ b/Core/Eisk.Test.Core/DataGen/DomainUriGenerator.cs @@ -0,0 +1,67 @@ +using System; +using AutoFixture; +using AutoFixture.Kernel; + +namespace Eisk.Test.Core.DataGen +{ + /// + /// Creates new instances. + /// + public class DomainUriGenerator + { + private readonly int _minSize, _maxSize; + private readonly bool _appendPath; + + public DomainUriGenerator(int minSize = 1, int maxSize = int.MaxValue, bool appendPath = true) + { + _minSize = minSize; + _maxSize = maxSize; + _appendPath = appendPath; + } + + /// + /// Creates a new specimen based on a request. + /// + /// The request that describes what to create. + /// A context that can be used to create other specimens. + /// + /// The requested specimen if possible; otherwise a instance. + /// + public object Create(object request, ISpecimenContext context) + { + if (context == null) + { + throw new ArgumentNullException(nameof(context)); + } + + if (!typeof (Uri).Equals(request)) + { +#pragma warning disable 618 + return new NoSpecimen(); +#pragma warning restore 618 + } + + var scheme = context.Resolve(typeof (UriScheme)) as UriScheme; + if (scheme == null) + { +#pragma warning disable 618 + return new NoSpecimen(); +#pragma warning restore 618 + } + + return CreateUri(scheme, context); + } + + private Uri CreateUri(UriScheme scheme, ISpecimenContext context) + { + string suffix = string.Empty; + + ConstrainedStringRequest constrainedStringRequest = new ConstrainedStringRequest(_minSize, _maxSize); + + if (_appendPath) + suffix = "/" + context.Resolve(constrainedStringRequest); + + return new Uri(scheme + "://google.com/" + suffix);//TODO: support maxsize constraint + } + } +} \ No newline at end of file diff --git a/Core/Eisk.Test.Core/DataGen/EntityDataFactory.cs b/Core/Eisk.Test.Core/DataGen/EntityDataFactory.cs new file mode 100644 index 00000000..4c5562a2 --- /dev/null +++ b/Core/Eisk.Test.Core/DataGen/EntityDataFactory.cs @@ -0,0 +1,37 @@ +using System; +using AutoFixture; +using AutoFixture.DataAnnotations; + +namespace Eisk.Test.Core.DataGen +{ + public class EntityDataFactory + { + public virtual TEntity Factory_Entity(Action action = null) + { + var fixture = Factory_Fixture(); + + var obj = fixture.Create(); + + action?.Invoke(obj); + + return obj; + } + + private Fixture Factory_Fixture() + { + Fixture fixture = new Fixture(); + + fixture.Behaviors.Remove(new ThrowingRecursionBehavior()); + + fixture.Behaviors.Add(new OmitOnRecursionBehavior()); + + fixture.Customize(new NoDataAnnotationsCustomization()); + + fixture.Customizations.Add(new RangeAttributeRelay()); + + //fixture.Customizations.Add(new StringAttributeAggregatedRelay()); + + return fixture; + } + } +} diff --git a/Core/Eisk.Test.Core/DataGen/IntegerValueGenerator.cs b/Core/Eisk.Test.Core/DataGen/IntegerValueGenerator.cs new file mode 100644 index 00000000..1bd37e77 --- /dev/null +++ b/Core/Eisk.Test.Core/DataGen/IntegerValueGenerator.cs @@ -0,0 +1,21 @@ +using System; + +namespace Eisk.Test.Core.DataGen +{ + public class IntegerValueGenerator + { + private readonly int _maxValue; + + public IntegerValueGenerator(int maxValue = Int32.MaxValue) + { + _maxValue = maxValue; + } + + public int Value() + { + return new Random().Next(1,_maxValue); + } + + public static int RandomInt => new IntegerValueGenerator().Value(); + } +} \ No newline at end of file diff --git a/Core/Eisk.Test.Core/DataGen/InvalidData/Get.cs b/Core/Eisk.Test.Core/DataGen/InvalidData/Get.cs new file mode 100644 index 00000000..dd5fa0cd --- /dev/null +++ b/Core/Eisk.Test.Core/DataGen/InvalidData/Get.cs @@ -0,0 +1,24 @@ +namespace Eisk.Test.Core.DataGen.InvalidData +{ + public class Get + { + private readonly bool _generateUniqueValue; + + public Get(bool generateUniqueValue) + { + _generateUniqueValue = generateUniqueValue; + } + + public static Get Unique => new Get(true); + + public static Get Plain => new Get(false); + + public string InvalidEmail => new InvalidEmail(_generateUniqueValue).ToString(); + + public string InvalidUri => new InvalidUri(_generateUniqueValue).ToString(); + + public string InvalidAlphanumeric => new InvalidAlphanumeric(_generateUniqueValue).ToString(); + + public string StringWithSpecialCharacters => new StringWithSpecialCharacters(_generateUniqueValue).ToString(); + } +} diff --git a/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidAlphanumeric.cs b/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidAlphanumeric.cs new file mode 100644 index 00000000..c5bf50f2 --- /dev/null +++ b/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidAlphanumeric.cs @@ -0,0 +1,10 @@ +namespace Eisk.Test.Core.DataGen.InvalidData +{ + public class InvalidAlphanumeric : StringValueGenerator + { + public InvalidAlphanumeric(bool generateUniqueValue = true, string value = "invalid_alphanumeric") : base(generateUniqueValue, value) + { + + } + } +} \ No newline at end of file diff --git a/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidEmail.cs b/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidEmail.cs new file mode 100644 index 00000000..27484a11 --- /dev/null +++ b/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidEmail.cs @@ -0,0 +1,10 @@ +namespace Eisk.Test.Core.DataGen.InvalidData +{ + public class InvalidEmail : StringValueGenerator + { + public InvalidEmail(bool generateUniqueValue = true, string value = "invalid_email") : base(generateUniqueValue, value) + { + + } + } +} \ No newline at end of file diff --git a/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidUri.cs b/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidUri.cs new file mode 100644 index 00000000..96c8d551 --- /dev/null +++ b/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidUri.cs @@ -0,0 +1,10 @@ +namespace Eisk.Test.Core.DataGen.InvalidData +{ + public class InvalidUri : StringValueGenerator + { + public InvalidUri(bool generateUniqueValue = true, string value = "invalid_uri") : base(generateUniqueValue, value) + { + + } + } +} \ No newline at end of file diff --git a/Core/Eisk.Test.Core/DataGen/InvalidData/StringWithSpecialCharacters.cs b/Core/Eisk.Test.Core/DataGen/InvalidData/StringWithSpecialCharacters.cs new file mode 100644 index 00000000..3dd635ab --- /dev/null +++ b/Core/Eisk.Test.Core/DataGen/InvalidData/StringWithSpecialCharacters.cs @@ -0,0 +1,7 @@ +namespace Eisk.Test.Core.DataGen.InvalidData +{ + public class StringWithSpecialCharacters:StringValueGenerator + { + public StringWithSpecialCharacters(bool generateUniqueValie = true, string value = "@@@@###%%%_string_with_special_characters") : base(generateUniqueValie, value) { } + } +} \ No newline at end of file diff --git a/Core/Eisk.Test.Core/DataGen/StringAttributeAggregatedRelay.cs b/Core/Eisk.Test.Core/DataGen/StringAttributeAggregatedRelay.cs new file mode 100644 index 00000000..fc4def53 --- /dev/null +++ b/Core/Eisk.Test.Core/DataGen/StringAttributeAggregatedRelay.cs @@ -0,0 +1,59 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.Linq; +using System.Reflection; +using AutoFixture.Kernel; +using Eisk.Core.Utils; + +namespace Eisk.Test.Core.DataGen +{ + public class StringAttributeAggregatedRelay : ISpecimenBuilder + { + public object Create(object request, ISpecimenContext context) + { + +#pragma warning disable 618 + object result = new NoSpecimen(); +#pragma warning restore 618 + + var pi = request as PropertyInfo; + + if (pi != null) + { + if (pi.PropertyType == typeof(string)) + { + if (Attribute.IsDefined(pi, typeof(StringLengthAttribute))) + { + var stringLengthAttribute = ((ICustomAttributeProvider)request). + GetCustomAttributes(typeof(StringLengthAttribute), true) + .Cast().Single(); + + return Attribute.IsDefined(pi, typeof(UrlAttribute)) || Attribute.IsDefined(pi, typeof(UriAttribute)) + ? GetGeneratedUri(context, stringLengthAttribute.MinimumLength, + stringLengthAttribute.MaximumLength) + : context.Resolve(new ConstrainedStringRequest( + stringLengthAttribute.MinimumLength, + stringLengthAttribute.MaximumLength)); + } + + if (Attribute.IsDefined(pi, typeof(UrlAttribute))) + { + return GetGeneratedUri(context); + } + } + + return result; + } + + return result; + } + + private string GetGeneratedUri(ISpecimenContext context, int minLength = 1, int maxLength = int.MaxValue) + { + var generatedUri = new DomainUriGenerator(minLength, maxLength) + .Create(typeof(Uri), context); + return generatedUri.ToString(); + } + + } +} \ No newline at end of file diff --git a/Core/Eisk.Test.Core/DataGen/StringValueGenerator.cs b/Core/Eisk.Test.Core/DataGen/StringValueGenerator.cs new file mode 100644 index 00000000..d4591889 --- /dev/null +++ b/Core/Eisk.Test.Core/DataGen/StringValueGenerator.cs @@ -0,0 +1,21 @@ +using System; + +namespace Eisk.Test.Core.DataGen +{ + public class StringValueGenerator + { + private readonly string _seedValue; + private readonly bool _generateUniqueValue; + + public StringValueGenerator(bool generateUniqueValue, string seedValue) + { + _seedValue = seedValue; + _generateUniqueValue = generateUniqueValue; + } + + public override string ToString() + { + return !_generateUniqueValue ? _seedValue : _seedValue + "_" + Guid.NewGuid(); + } + } +} \ No newline at end of file diff --git a/Core/Eisk.Test.Core/Eisk.Test.Core.csproj b/Core/Eisk.Test.Core/Eisk.Test.Core.csproj new file mode 100644 index 00000000..5780595d --- /dev/null +++ b/Core/Eisk.Test.Core/Eisk.Test.Core.csproj @@ -0,0 +1,17 @@ + + + + net6.0 + + + + + + + + + + + + + diff --git a/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs b/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs new file mode 100644 index 00000000..26b610fe --- /dev/null +++ b/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs @@ -0,0 +1,238 @@ +using System; +using System.Linq.Expressions; +using System.Threading.Tasks; +using Eisk.Core.DataService; +using Eisk.Test.Core.DataGen; +using Xunit; + +namespace Eisk.Test.Core.TestBases +{ + public abstract class DataServiceBaseIntegrationTests : EntityTestBase, + IServiceTest> + where TEntity : class, new() + { + private readonly IEntityDataService _dataService; + + protected DataServiceBaseIntegrationTests(IEntityDataService dataService, Expression> idExpression, EntityDataFactory entityDataFactory = null) + :base(idExpression, entityDataFactory) + { + _dataService = dataService; + } + + + public virtual IEntityDataService GetServiceInstance(Action action = null) + { + action?.Invoke(); + + return _dataService; + } + + protected virtual async Task CreateTestEntityToStore(TEntity testEntity) + { + //might pass for sql lite, but fail for sql server + //SetIdValueToEntity(testEntity, 100);//TODO: support for generic + await _dataService.Add(testEntity); + } + + [Fact] + public virtual async Task Add_ValidDomainPassed_ShouldReturnDomainAfterCreation() + { + //Arrange + var inputEntity = Factory_Entity(); + //might pass for sql lite, but fail for sql server + SetIdValueToEntity(inputEntity, 100);//TODO: support for generic + var dataService = GetServiceInstance(); + + //Act + var returnedEntity = await dataService.Add(inputEntity); + + //Assert + Assert.NotNull(returnedEntity); + Assert.NotEqual(default(TId), GetIdValueFromEntity(returnedEntity)); + } + + [Fact] + public virtual async Task Add_ValidDomainWithRandomIdPassed_ShouldReturnDomainAfterCreation() + { + //Arrange + var inputEntity = Factory_Entity(); + //might pass for sql lite, but fail for sql server + SetIdValueToEntity(inputEntity, 100);//TODO: support for generic + var dataService = GetServiceInstance(); + + //Act + var returnedEntity = await dataService.Add(inputEntity); + + //Assert + Assert.NotNull(returnedEntity); + Assert.NotEqual(default(TId), GetIdValueFromEntity(returnedEntity)); + } + + [Fact] + public virtual async Task Add_NullDomainPassed_ShouldThrowArgumentNullException() + { + //Arrange + var dataService = GetServiceInstance(); + TEntity invalidNullDomain = null; + + //Act and Assert + await Assert.ThrowsAsync(() => dataService.Add(invalidNullDomain)); + + } + + [Fact] + public virtual async Task GetById_ValidIdPassed_ShouldReturnResult() + { + //Arrange + var domain = Factory_Entity(); + var dataService = GetServiceInstance(async () => + { + await CreateTestEntityToStore(domain); + }); + + var idValue = GetIdValueFromEntity(domain); + + //Act + var returnedEntity = await dataService.GetById(idValue); + + //Assert + Assert.NotNull(returnedEntity); + Assert.Equal(idValue, GetIdValueFromEntity(returnedEntity)); + } + + [Fact] + public virtual async Task GetById_EmptyIdPassed_ShouldReturnNull() + { + //Arrange + var dataService = GetServiceInstance(); + + //Act + var returnedEntity = await dataService.GetById(default(TId)); + + //Assert + Assert.Null(returnedEntity); + + } + + [Fact] + public virtual async Task GetById_InvalidIdPassed_ShouldReturnNull() + { + //Arrange + var dataService = GetServiceInstance(); + + //Act + var returnedEntity = await dataService.GetById(100);//TODO: make it generic random + + //Assert + Assert.Null(returnedEntity); + + } + + [Fact] + public virtual async Task Update_ValidDomainPassed_ShouldReturnDomain() + { + //Arrange + var inputEntity = Factory_Entity(); + var dataService = GetServiceInstance(async () => + { + await CreateTestEntityToStore(inputEntity); + }); + + //Act + var returnedEntity = await dataService.Update(inputEntity); + + //Assert + Assert.NotNull(returnedEntity); + Assert.Equal(GetIdValueFromEntity(inputEntity), GetIdValueFromEntity(returnedEntity)); + + } + + [Fact] + public virtual async Task Update_ValidDomainWithEmptyIdPassed_ShouldCreateDomain() + { + //Arrange + var inputEntity = Factory_Entity(); + var dataService = GetServiceInstance(); + + //Act + var returnedEntity = await dataService.Update(inputEntity);//may not be supported in all data providers + + //Assert + Assert.NotNull(returnedEntity); + Assert.NotEqual(default(TId), GetIdValueFromEntity(returnedEntity)); + + } + + [Fact] + public virtual async Task Update_ValidDomainWithRandomIdPassed_ShouldThrowException() + { + //Arrange + var entityWithRandomId = Factory_Entity(); + SetIdValueToEntity(entityWithRandomId, 100);//TODO: support generic + var dataService = GetServiceInstance(); + + //Act + var ex = await Record.ExceptionAsync(async () => await dataService.Update(entityWithRandomId)); + + //Assert + Assert.NotNull(ex); + } + + [Fact] + public virtual async Task Update_NullDomainPassed_ShouldThrowArgumentNullException() + { + //Arrange + var dataService = GetServiceInstance(); + TEntity invalidNullDomain = null; + + //Act and Assert + await Assert.ThrowsAsync(() => dataService.Update(invalidNullDomain)); + + } + + [Fact] + public virtual async Task Delete_DomainWithValidIdPassed_ShouldDeleteSuccessfully() + { + //Arrange + var inputEntity = Factory_Entity(); + var dataService = GetServiceInstance(async () => await CreateTestEntityToStore(inputEntity)); + var idValue = GetIdValueFromEntity(inputEntity); + + //Act + await dataService.Delete(inputEntity); + + //Assert + var returnObject = await dataService.GetById(idValue); + Assert.Null(returnObject); + } + + [Fact] + public virtual async Task Delete_DomainWithEmptyIdPassed_ShouldThrowException() + { + //Arrange + var inputEntity = Factory_Entity(); + var dataService = GetServiceInstance(); + + //Act + var returnedException = await Record.ExceptionAsync(() => dataService.Delete(inputEntity)); + + //Assert + Assert.NotNull(returnedException); + } + + [Fact] + public virtual async Task Delete_DomainWithRandomIdPassed_ShouldThrowException() + { + //Arrange + var inputEntity = Factory_Entity(); + SetIdValueToEntity(inputEntity, 100);//TODO: support generic + var dataService = GetServiceInstance(); + + //Act + var ex = await Record.ExceptionAsync(() => dataService.Delete(inputEntity)); + + //Assert + Assert.NotNull(ex); + } + } +} diff --git a/Core/Eisk.Test.Core/TestBases/DomainServiceBaseComponentTests.cs b/Core/Eisk.Test.Core/TestBases/DomainServiceBaseComponentTests.cs new file mode 100644 index 00000000..55f0592c --- /dev/null +++ b/Core/Eisk.Test.Core/TestBases/DomainServiceBaseComponentTests.cs @@ -0,0 +1,152 @@ +using System; +using System.Linq.Expressions; +using System.Threading.Tasks; +using Eisk.Core.DomainService; +using Eisk.Core.Exceptions; +using Eisk.Test.Core.DataGen; +using Xunit; + +namespace Eisk.Test.Core.TestBases +{ + public abstract class DomainServiceBaseComponentTests : EntityTestBase, + IServiceTest> + where TEntity : class, new() + { + private readonly DomainService _domainService; + + protected DomainServiceBaseComponentTests(DomainService domainService, + Expression> idExpression, EntityDataFactory entityDataFactory) :base(idExpression, entityDataFactory) + { + _domainService = domainService; + } + + public virtual DomainService GetServiceInstance(Action action = null) + { + action?.Invoke(); + + return _domainService; + } + + protected virtual async Task CreateTestEntityToStore(TEntity testEntity) + { + await _domainService.Add(testEntity); + } + + [Fact] + public virtual async Task Add_ValidDomainPassed_ShouldReturnDomainAfterCreation() + { + //Arrange + var inputEntity = Factory_Entity(); + var domainService = GetServiceInstance(); + + //Act + var returnedEntity = await domainService.Add(inputEntity); + + //Assert + Assert.NotNull(returnedEntity); + Assert.NotEqual(default(TId), GetIdValueFromEntity(returnedEntity)); + } + + [Fact] + public virtual async Task Add_NullDomainPassed_ShouldThrowArgumentNullException() + { + //Arrange + var domainService = GetServiceInstance(); + TEntity invalidNullDomain = null; + + //Act and Assert + await Assert.ThrowsAsync>(() => domainService.Add(invalidNullDomain)); + + } + + [Fact] + public virtual async Task GetById_ValidIdPassed_ShouldReturnResult() + { + //Arrange + var domain = Factory_Entity(); + var domainService = GetServiceInstance(async () => + { + await CreateTestEntityToStore(domain); + }); + + var idValue = GetIdValueFromEntity(domain); + + //Act + var returnedEntity = await domainService.GetById(idValue); + + //Assert + Assert.NotNull(returnedEntity); + Assert.Equal(idValue, GetIdValueFromEntity(returnedEntity)); + } + + [Fact] + public virtual async Task GetById_EmptyIdPassed_ShouldThrowException() + { + //Arrange + var domainService = GetServiceInstance(); + var emptyIdValue = default(TId); + + //Act + Assert + await Assert.ThrowsAsync>(() => domainService.GetById(emptyIdValue)); + + } + + [Fact] + public virtual async Task Update_ValidDomainPassed_ShouldReturnDomain() + { + //Arrange + var inputEntity = Factory_Entity(); + var domainService = GetServiceInstance(async () => + { + await CreateTestEntityToStore(inputEntity); + }); + var idValue = GetIdValueFromEntity(inputEntity); + + //Act + var returnedEntity = await domainService.Update(idValue, inputEntity); + + //Assert + Assert.NotNull(returnedEntity); + Assert.Equal(GetIdValueFromEntity(inputEntity), GetIdValueFromEntity(returnedEntity)); + + } + + [Fact] + public virtual async Task Update_EmptyIdPassed_ShouldThrowException() + { + //Arrange + var domainService = GetServiceInstance(); + var emptyIdValue = default(TId); + TEntity dummayObject = Factory_Entity(); + + //Act + Assert + await Assert.ThrowsAsync>(() => domainService.Update(emptyIdValue, dummayObject)); + + } + + [Fact] + public virtual async Task Delete_DomainWithValidIdPassed_ShouldDeleteSuccessfully() + { + //Arrange + var inputEntity = Factory_Entity(); + var domainService = GetServiceInstance(async () => await CreateTestEntityToStore(inputEntity)); + var idValue = GetIdValueFromEntity(inputEntity); + + //Act + Assert + await domainService.Delete(idValue); + + } + + [Fact] + public virtual async Task Delete_DomainWithEmptyIdPassed_ShouldThrowException() + { + //Arrange + var domainService = GetServiceInstance(); + var emptyIdValue = default(TId); + + //Act + Assert + await Assert.ThrowsAsync>(() => domainService.Delete(emptyIdValue)); + + } + } +} diff --git a/Core/Eisk.Test.Core/TestBases/EntityTestBase.cs b/Core/Eisk.Test.Core/TestBases/EntityTestBase.cs new file mode 100644 index 00000000..53cad975 --- /dev/null +++ b/Core/Eisk.Test.Core/TestBases/EntityTestBase.cs @@ -0,0 +1,53 @@ +using System; +using System.Linq.Expressions; +using Eisk.Core.Utils; +using Eisk.Test.Core.DataGen; + +namespace Eisk.Test.Core.TestBases +{ + public abstract class EntityTestBase : TestBase + where TEntity : class, new() + { + protected readonly Expression> DbIdExpression; + + EntityDataFactory _entityDataFactory; + protected EntityDataFactory EntityDataFactory + { + get + { + if (_entityDataFactory == null) + _entityDataFactory = new EntityDataFactory(); + + return _entityDataFactory; ; + } + } + + protected EntityTestBase(Expression> idExpression, EntityDataFactory entityDataFactory = null) + { + DbIdExpression = idExpression; + _entityDataFactory = entityDataFactory; + } + + protected virtual TEntity Factory_Entity(Action action = null, bool setIdWithDefault = true) + { + var entity = EntityDataFactory.Factory_Entity(action); + + if (setIdWithDefault) + SetIdValueToEntity(entity, default(TId)); + + action?.Invoke(entity); + + return entity; + } + + protected TId GetIdValueFromEntity(TEntity entity) + { + return (TId)ExpressionUtil.GetPropertyValue(DbIdExpression, entity); + } + + protected void SetIdValueToEntity(TEntity entity, object value) + { + ExpressionUtil.SetPropertyValue(DbIdExpression, entity, value); + } + } +} \ No newline at end of file diff --git a/Core/Eisk.Test.Core/TestBases/IServiceTest.cs b/Core/Eisk.Test.Core/TestBases/IServiceTest.cs new file mode 100644 index 00000000..d0d16ee1 --- /dev/null +++ b/Core/Eisk.Test.Core/TestBases/IServiceTest.cs @@ -0,0 +1,9 @@ +using System; + +namespace Eisk.Test.Core.TestBases +{ + public interface IServiceTest + { + TService GetServiceInstance(Action action = null); + } +} diff --git a/Core/Eisk.Test.Core/TestBases/TestBase.cs b/Core/Eisk.Test.Core/TestBases/TestBase.cs new file mode 100644 index 00000000..f6eacc86 --- /dev/null +++ b/Core/Eisk.Test.Core/TestBases/TestBase.cs @@ -0,0 +1,25 @@ +using System; +using Xunit; + +namespace Eisk.Test.Core.TestBases +{ + using DataGen; + using Eisk.Core.Exceptions; + + public abstract class TestBase + { + protected static void ExpectException(Action action, + TException expectedException) + where TException : CoreException + { + //Act + var actualException = Assert.Throws(action); + + //Assert + Assert.NotNull(actualException); + Assert.Equal(expectedException.Message, actualException.Message); + Assert.Equal(expectedException.ErrorCode, actualException.ErrorCode); + } + + } +} \ No newline at end of file diff --git a/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs b/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs index 6e08ada6..80318af4 100644 --- a/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs +++ b/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs @@ -4,14 +4,16 @@ namespace Eisk.Domains.TestData { using Entities; using Enums; + using System; using Test.Core.DataGen; public class EmployeeDataFactory:EntityDataFactory { - public override Employee Factory_Entity(Action action) + public override Employee Factory_Entity(Action? action = null) { - var employee = base.Factory_Entity(AssignEmployee); - action(employee); + var employee = base.Factory_Entity(action); + AssignEmployee(employee); + action?.Invoke(employee);//TODO: to be refactored return employee; } From 8515346e439bc0b1c51a7ac464ea734e835cf388 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Thu, 14 Apr 2022 13:46:08 +0100 Subject: [PATCH 081/204] update employee sample data generator with right order of methods. --- .../Eisk.Domains.TestData/EmployeeDataFactory.cs | 11 ++++++++--- Notes/TODO.txt | 9 ++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs b/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs index 80318af4..1e5ba2a5 100644 --- a/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs +++ b/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs @@ -11,9 +11,14 @@ public class EmployeeDataFactory:EntityDataFactory { public override Employee Factory_Entity(Action? action = null) { - var employee = base.Factory_Entity(action); - AssignEmployee(employee); - action?.Invoke(employee);//TODO: to be refactored + var employee = base.Factory_Entity( e => + { + AssignEmployee(e); + + //supporting custom overrides from user + action?.Invoke(e); + }); + return employee; } diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 0c2fa142..ff69b9dd 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -1,8 +1,12 @@ ======================================================== TODO: Today -* Complete custom data generator implementation -* Check-in submodule +DONE * Remove sub-module +DONE * Complete custom data generator implementation +* Apply rules logic in custom data generator +* Test string size implementor +* Test data service with sql server local instance +* Re-visit exception classes R * apply custom business logic * review template documentations @@ -31,7 +35,6 @@ Testing * Include custom entity data factory in entity test base * test post and update methods * identify test strategy, check base tests usability -* test data service with sql server local instance Release Tasks * Merge V9.0 branch to master From 5151fb03cbbec13414cf44757cc5c01732514781 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Thu, 14 Apr 2022 14:24:12 +0100 Subject: [PATCH 082/204] refactored data generators. --- Core/Eisk.Test.Core/DataGen/EntityDataFactory.cs | 2 +- .../DataGen/{ => FieldGenerators}/DomainUriGenerator.cs | 2 +- .../{ => FieldGenerators}/IntegerValueGenerator.cs | 2 +- .../{ => FieldGenerators}/StringValueGenerator.cs | 2 +- .../DataGen/InvalidData/InvalidAlphanumeric.cs | 2 ++ Core/Eisk.Test.Core/DataGen/InvalidData/InvalidEmail.cs | 2 ++ Core/Eisk.Test.Core/DataGen/InvalidData/InvalidUri.cs | 2 ++ .../DataGen/InvalidData/StringWithSpecialCharacters.cs | 2 ++ .../DataGen/StringAttributeAggregatedRelay.cs | 1 + DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs | 4 ++-- Notes/TODO.txt | 9 +++++---- 11 files changed, 20 insertions(+), 10 deletions(-) rename Core/Eisk.Test.Core/DataGen/{ => FieldGenerators}/DomainUriGenerator.cs (97%) rename Core/Eisk.Test.Core/DataGen/{ => FieldGenerators}/IntegerValueGenerator.cs (89%) rename Core/Eisk.Test.Core/DataGen/{ => FieldGenerators}/StringValueGenerator.cs (91%) diff --git a/Core/Eisk.Test.Core/DataGen/EntityDataFactory.cs b/Core/Eisk.Test.Core/DataGen/EntityDataFactory.cs index 4c5562a2..ffbaa369 100644 --- a/Core/Eisk.Test.Core/DataGen/EntityDataFactory.cs +++ b/Core/Eisk.Test.Core/DataGen/EntityDataFactory.cs @@ -29,7 +29,7 @@ private Fixture Factory_Fixture() fixture.Customizations.Add(new RangeAttributeRelay()); - //fixture.Customizations.Add(new StringAttributeAggregatedRelay()); + fixture.Customizations.Add(new StringAttributeAggregatedRelay()); return fixture; } diff --git a/Core/Eisk.Test.Core/DataGen/DomainUriGenerator.cs b/Core/Eisk.Test.Core/DataGen/FieldGenerators/DomainUriGenerator.cs similarity index 97% rename from Core/Eisk.Test.Core/DataGen/DomainUriGenerator.cs rename to Core/Eisk.Test.Core/DataGen/FieldGenerators/DomainUriGenerator.cs index 8d286883..46430340 100644 --- a/Core/Eisk.Test.Core/DataGen/DomainUriGenerator.cs +++ b/Core/Eisk.Test.Core/DataGen/FieldGenerators/DomainUriGenerator.cs @@ -2,7 +2,7 @@ using AutoFixture; using AutoFixture.Kernel; -namespace Eisk.Test.Core.DataGen +namespace Eisk.Test.Core.DataGen.FieldGenerators { /// /// Creates new instances. diff --git a/Core/Eisk.Test.Core/DataGen/IntegerValueGenerator.cs b/Core/Eisk.Test.Core/DataGen/FieldGenerators/IntegerValueGenerator.cs similarity index 89% rename from Core/Eisk.Test.Core/DataGen/IntegerValueGenerator.cs rename to Core/Eisk.Test.Core/DataGen/FieldGenerators/IntegerValueGenerator.cs index 1bd37e77..2643fb69 100644 --- a/Core/Eisk.Test.Core/DataGen/IntegerValueGenerator.cs +++ b/Core/Eisk.Test.Core/DataGen/FieldGenerators/IntegerValueGenerator.cs @@ -1,6 +1,6 @@ using System; -namespace Eisk.Test.Core.DataGen +namespace Eisk.Test.Core.DataGen.FieldGenerators { public class IntegerValueGenerator { diff --git a/Core/Eisk.Test.Core/DataGen/StringValueGenerator.cs b/Core/Eisk.Test.Core/DataGen/FieldGenerators/StringValueGenerator.cs similarity index 91% rename from Core/Eisk.Test.Core/DataGen/StringValueGenerator.cs rename to Core/Eisk.Test.Core/DataGen/FieldGenerators/StringValueGenerator.cs index d4591889..8c45043b 100644 --- a/Core/Eisk.Test.Core/DataGen/StringValueGenerator.cs +++ b/Core/Eisk.Test.Core/DataGen/FieldGenerators/StringValueGenerator.cs @@ -1,6 +1,6 @@ using System; -namespace Eisk.Test.Core.DataGen +namespace Eisk.Test.Core.DataGen.FieldGenerators { public class StringValueGenerator { diff --git a/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidAlphanumeric.cs b/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidAlphanumeric.cs index c5bf50f2..0aa75912 100644 --- a/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidAlphanumeric.cs +++ b/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidAlphanumeric.cs @@ -1,5 +1,7 @@ namespace Eisk.Test.Core.DataGen.InvalidData { + using FieldGenerators; + public class InvalidAlphanumeric : StringValueGenerator { public InvalidAlphanumeric(bool generateUniqueValue = true, string value = "invalid_alphanumeric") : base(generateUniqueValue, value) diff --git a/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidEmail.cs b/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidEmail.cs index 27484a11..71f75b98 100644 --- a/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidEmail.cs +++ b/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidEmail.cs @@ -1,5 +1,7 @@ namespace Eisk.Test.Core.DataGen.InvalidData { + using FieldGenerators; + public class InvalidEmail : StringValueGenerator { public InvalidEmail(bool generateUniqueValue = true, string value = "invalid_email") : base(generateUniqueValue, value) diff --git a/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidUri.cs b/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidUri.cs index 96c8d551..332f9ab0 100644 --- a/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidUri.cs +++ b/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidUri.cs @@ -1,5 +1,7 @@ namespace Eisk.Test.Core.DataGen.InvalidData { + using FieldGenerators; + public class InvalidUri : StringValueGenerator { public InvalidUri(bool generateUniqueValue = true, string value = "invalid_uri") : base(generateUniqueValue, value) diff --git a/Core/Eisk.Test.Core/DataGen/InvalidData/StringWithSpecialCharacters.cs b/Core/Eisk.Test.Core/DataGen/InvalidData/StringWithSpecialCharacters.cs index 3dd635ab..b5f24255 100644 --- a/Core/Eisk.Test.Core/DataGen/InvalidData/StringWithSpecialCharacters.cs +++ b/Core/Eisk.Test.Core/DataGen/InvalidData/StringWithSpecialCharacters.cs @@ -1,5 +1,7 @@ namespace Eisk.Test.Core.DataGen.InvalidData { + using FieldGenerators; + public class StringWithSpecialCharacters:StringValueGenerator { public StringWithSpecialCharacters(bool generateUniqueValie = true, string value = "@@@@###%%%_string_with_special_characters") : base(generateUniqueValie, value) { } diff --git a/Core/Eisk.Test.Core/DataGen/StringAttributeAggregatedRelay.cs b/Core/Eisk.Test.Core/DataGen/StringAttributeAggregatedRelay.cs index fc4def53..45dfbd03 100644 --- a/Core/Eisk.Test.Core/DataGen/StringAttributeAggregatedRelay.cs +++ b/Core/Eisk.Test.Core/DataGen/StringAttributeAggregatedRelay.cs @@ -4,6 +4,7 @@ using System.Reflection; using AutoFixture.Kernel; using Eisk.Core.Utils; +using Eisk.Test.Core.DataGen.FieldGenerators; namespace Eisk.Test.Core.DataGen { diff --git a/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs b/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs index 1e5ba2a5..c8aef430 100644 --- a/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs +++ b/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs @@ -25,7 +25,7 @@ public override Employee Factory_Entity(Action? action = null) void AssignEmployee(Employee employee) { var faker = new Faker(); - + employee.Id = 0; employee.ReportsTo = null; employee.ReportsToId = null; @@ -49,7 +49,7 @@ void AssignEmployee(Employee employee) employee.HireDate = faker.Date.Future(); employee.Title = null; employee.Phone = faker.Person.Phone; - employee.Extension = null; + //employee.Extension = null; employee.Photo = null; diff --git a/Notes/TODO.txt b/Notes/TODO.txt index ff69b9dd..fa0afb54 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -1,10 +1,6 @@ ======================================================== TODO: Today -DONE * Remove sub-module -DONE * Complete custom data generator implementation -* Apply rules logic in custom data generator -* Test string size implementor * Test data service with sql server local instance * Re-visit exception classes @@ -14,6 +10,11 @@ R * apply custom business logic * check conditional rendering (file) * check conditional rendering (text) +DONE * Remove sub-module +DONE * Complete custom data generator implementation +DONE * Test string size implementor +N/A * Apply rules logic in custom data generator + ======================================================== TODO: From 282ff35ea8931d26306489949c43e456b862ced3 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Thu, 14 Apr 2022 15:45:46 +0100 Subject: [PATCH 083/204] status updated --- Notes/TODO.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Notes/TODO.txt b/Notes/TODO.txt index fa0afb54..e3fc9a05 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -4,7 +4,10 @@ TODO: Today * Test data service with sql server local instance * Re-visit exception classes -R * apply custom business logic +* apply custom business logic +* Add field for email +* Add field for URL + * review template documentations * check rendered output for template with VS * check conditional rendering (file) From 2ba99806c7f22caf20faccd152b1f6ba6bf214b1 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Thu, 14 Apr 2022 15:58:38 +0100 Subject: [PATCH 084/204] Business Rules Note added. --- Eisk.WebApi.TemplatePack.sln | 1 + Notes/Business-Rules.txt | 17 +++++++++++++++++ Notes/TODO.txt | 5 ++++- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 Notes/Business-Rules.txt diff --git a/Eisk.WebApi.TemplatePack.sln b/Eisk.WebApi.TemplatePack.sln index 902c29e5..12966006 100644 --- a/Eisk.WebApi.TemplatePack.sln +++ b/Eisk.WebApi.TemplatePack.sln @@ -55,6 +55,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.WebApi", "WebApi\Eisk. EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Notes", "Notes", "{ACEB7D4D-4789-49F0-A552-3D7C0A419FB9}" ProjectSection(SolutionItems) = preProject + Notes\Business-Rules.txt = Notes\Business-Rules.txt Notes\Commands.txt = Notes\Commands.txt Notes\Modules.txt = Notes\Modules.txt Notes\Notes.txt = Notes\Notes.txt diff --git a/Notes/Business-Rules.txt b/Notes/Business-Rules.txt new file mode 100644 index 00000000..5d365390 --- /dev/null +++ b/Notes/Business-Rules.txt @@ -0,0 +1,17 @@ +======================================================== +Business Rules +======================================================== +* Single Field Level (Property) + * Length + * Regular Expression (phone, email) +* Single Field Level (Logic) + * Birthday should not be future date + * Employee must be 18 years old +* Multiple Field Level + * HireDate should be later than Birthday +* DB Check on Same Table + * Email should be unique +* DB Check on Foreign Key Table + * An employee can have atmost 10 reports +======================================================== + \ No newline at end of file diff --git a/Notes/TODO.txt b/Notes/TODO.txt index e3fc9a05..1fe972fe 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -1,12 +1,15 @@ ======================================================== TODO: Today +* Investigate with length field is not causing issue when saving * Test data service with sql server local instance * Re-visit exception classes -* apply custom business logic +* Apply custom business logic * Add field for email * Add field for URL +* Include view model example +* Firing exception when field constraint (i.e. length) is not applied * review template documentations * check rendered output for template with VS From 83075155cfc3d23ec2bc38b7dbab6897f2a6a11f Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Thu, 14 Apr 2022 16:29:04 +0100 Subject: [PATCH 085/204] updated notes --- Eisk.WebApi.TemplatePack.sln | 3 +-- Notes/Commands.txt | 4 ---- Notes/Set-up.txt | 40 ++++++++++++++++++++++++++++++++++++ Notes/Templating.txt | 8 -------- 4 files changed, 41 insertions(+), 14 deletions(-) delete mode 100644 Notes/Commands.txt create mode 100644 Notes/Set-up.txt delete mode 100644 Notes/Templating.txt diff --git a/Eisk.WebApi.TemplatePack.sln b/Eisk.WebApi.TemplatePack.sln index 12966006..54ae0b09 100644 --- a/Eisk.WebApi.TemplatePack.sln +++ b/Eisk.WebApi.TemplatePack.sln @@ -56,11 +56,10 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Notes", "Notes", "{ACEB7D4D-4789-49F0-A552-3D7C0A419FB9}" ProjectSection(SolutionItems) = preProject Notes\Business-Rules.txt = Notes\Business-Rules.txt - Notes\Commands.txt = Notes\Commands.txt Notes\Modules.txt = Notes\Modules.txt Notes\Notes.txt = Notes\Notes.txt Notes\Release-Instructions.txt = Notes\Release-Instructions.txt - Notes\Templating.txt = Notes\Templating.txt + Notes\Set-up.txt = Notes\Set-up.txt Notes\Test-Strategy.txt = Notes\Test-Strategy.txt Notes\TODO.txt = Notes\TODO.txt Notes\Troubleshoot.txt = Notes\Troubleshoot.txt diff --git a/Notes/Commands.txt b/Notes/Commands.txt deleted file mode 100644 index 5a031e40..00000000 --- a/Notes/Commands.txt +++ /dev/null @@ -1,4 +0,0 @@ -====================================================== -Refresh sub-module while working in Main template repo - -====================================================== \ No newline at end of file diff --git a/Notes/Set-up.txt b/Notes/Set-up.txt new file mode 100644 index 00000000..2f16bdc8 --- /dev/null +++ b/Notes/Set-up.txt @@ -0,0 +1,40 @@ +====================================================== +Template +====================================================== +* Debugging template creation +* Render template locally + * Run /build/dnn-install-from-local.cmd + + +References +* https://devblogs.microsoft.com/dotnet/how-to-create-your-own-templates-for-dotnet-new/ +* https://github.com/dotnet/dotnet-template-samples + +====================================================== +SQL Server +====================================================== +Setting up Local DB in local environment + +* You would like to know the version of your SQL Server LocalDB instance. + * Open "Command Prompt" + * Type line "sqllocaldb info" and check the name. By default, it will show "MSSQLLocalDB". + * Type line "sqllocaldb info MSSQLLocalDB" + * If the version is "12.0.4100.1", LocalDB instance is in 2014 version. If the version if "13.1.4100.0" is in 2016 version. + +* Starting LocalDB + * sqllocaldb start MSSQLLocalDB + +* Connect with SQL Server Management Studio + * Server name: (localdb)\mssqllocaldb + +* Installing +* Deploying database schema +* Set connection string + +====================================================== +ASP.NET / Web Server +====================================================== + +* Turn off development mode for ASP.NET + +======================================================== \ No newline at end of file diff --git a/Notes/Templating.txt b/Notes/Templating.txt deleted file mode 100644 index 18d8d3e6..00000000 --- a/Notes/Templating.txt +++ /dev/null @@ -1,8 +0,0 @@ -======================================================== - -======================================================== -References -* https://devblogs.microsoft.com/dotnet/how-to-create-your-own-templates-for-dotnet-new/ -* https://github.com/dotnet/dotnet-template-samples -======================================================== - \ No newline at end of file From 9eb800e971a85848fc8812c19694e86467808171 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Thu, 14 Apr 2022 17:50:36 +0100 Subject: [PATCH 086/204] * integration tests for SQL Server added. --- .../DataServiceBaseIntegrationTests.cs | 8 ----- .../Eisk.Domains/BaseEntities/Person.cs | 6 ++-- .../Eisk.Domains/ValueObjects/Address.cs | 6 ++-- .../EmployeeDataServiceTests.cs | 31 ++++++++++++++----- .../DbContextDataInitializer.cs | 2 +- .../Eisk.EFCore.Setup/TestDbContextFactory.cs | 5 +++ Notes/TODO.txt | 3 +- 7 files changed, 38 insertions(+), 23 deletions(-) diff --git a/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs b/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs index 26b610fe..0be7bb7b 100644 --- a/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs +++ b/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs @@ -29,8 +29,6 @@ public virtual IEntityDataService GetServiceInstance(Action action = nu protected virtual async Task CreateTestEntityToStore(TEntity testEntity) { - //might pass for sql lite, but fail for sql server - //SetIdValueToEntity(testEntity, 100);//TODO: support for generic await _dataService.Add(testEntity); } @@ -39,8 +37,6 @@ public virtual async Task Add_ValidDomainPassed_ShouldReturnDomainAfterCreation( { //Arrange var inputEntity = Factory_Entity(); - //might pass for sql lite, but fail for sql server - SetIdValueToEntity(inputEntity, 100);//TODO: support for generic var dataService = GetServiceInstance(); //Act @@ -56,8 +52,6 @@ public virtual async Task Add_ValidDomainWithRandomIdPassed_ShouldReturnDomainAf { //Arrange var inputEntity = Factory_Entity(); - //might pass for sql lite, but fail for sql server - SetIdValueToEntity(inputEntity, 100);//TODO: support for generic var dataService = GetServiceInstance(); //Act @@ -168,7 +162,6 @@ public virtual async Task Update_ValidDomainWithRandomIdPassed_ShouldThrowExcept { //Arrange var entityWithRandomId = Factory_Entity(); - SetIdValueToEntity(entityWithRandomId, 100);//TODO: support generic var dataService = GetServiceInstance(); //Act @@ -225,7 +218,6 @@ public virtual async Task Delete_DomainWithRandomIdPassed_ShouldThrowException() { //Arrange var inputEntity = Factory_Entity(); - SetIdValueToEntity(inputEntity, 100);//TODO: support generic var dataService = GetServiceInstance(); //Act diff --git a/DomainCore/Eisk.Domains/BaseEntities/Person.cs b/DomainCore/Eisk.Domains/BaseEntities/Person.cs index 3cb37e88..ed0fc345 100644 --- a/DomainCore/Eisk.Domains/BaseEntities/Person.cs +++ b/DomainCore/Eisk.Domains/BaseEntities/Person.cs @@ -18,12 +18,12 @@ public class Person public TitleOfCourtesy? TitleOfCourtesy { get; set; } [Required(ErrorMessage = "First name required.")] - [StringLength(15)] + [StringLength(25)] [Display(Name = "First Name")] public string FirstName { get; set; } [Required(ErrorMessage = "Last name required.")] - [StringLength(20)] + [StringLength(25)] [Display(Name = "Last Name")] public string LastName { get; set; } @@ -33,7 +33,7 @@ public class Person public Address Address { get; set; } [Required(ErrorMessage = "Phone required")] - [StringLength(15)] + [StringLength(20)] public string Phone { get; set; } [StringLength(4)] diff --git a/DomainCore/Eisk.Domains/ValueObjects/Address.cs b/DomainCore/Eisk.Domains/ValueObjects/Address.cs index 9833f2b4..5eb5eeb5 100644 --- a/DomainCore/Eisk.Domains/ValueObjects/Address.cs +++ b/DomainCore/Eisk.Domains/ValueObjects/Address.cs @@ -9,10 +9,10 @@ public class Address [Display(Name = "Address line")] public string AddressLine { get; set; } - [StringLength(15)] + [StringLength(25)] public string City { get; set; } - [StringLength(15)] + [StringLength(25)] public string Region { get; set; } [StringLength(10)] @@ -21,7 +21,7 @@ public class Address public string PostalCode { get; set; } [Required(ErrorMessage = "Country required.")] - [StringLength(15)] + [StringLength(25)] public string Country { get; set; } } diff --git a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/EmployeeDataServiceTests.cs b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/EmployeeDataServiceTests.cs index e6a6405c..0bd7d3ed 100644 --- a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/EmployeeDataServiceTests.cs +++ b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/EmployeeDataServiceTests.cs @@ -1,16 +1,33 @@ +using Eisk.EFCore.Setup; +using Eisk.Domains.Entities; +using Eisk.Test.Core.TestBases; +using Eisk.Domains.TestData; +using Eisk.DataServices.EFCore.DataContext; +using System; +using Xunit; namespace Eisk.DataServices.EFCore.IntegrationTests { - using Eisk.EFCore.Setup; - using Domains.Entities; - using Test.Core.TestBases; - using Eisk.Domains.TestData; - - public class EmployeeDataServiceTests: DataServiceBaseIntegrationTests + public class DatabaseFixture : IDisposable { - public EmployeeDataServiceTests():base (new EmployeeDataService(TestDbContextFactory.CreateDbContext()), x => x.Id, new EmployeeDataFactory()) + public DatabaseFixture() + { + var db = TestDbContextFactory.CreateSqlServerDbContext(); + DbContextDataInitializer.Initialize(db); + } + + public void Dispose() { + // ... clean up test data from the database ... + } + + } + public class EmployeeDataServiceTests: DataServiceBaseIntegrationTests, IClassFixture + { + public EmployeeDataServiceTests(): base(new EmployeeDataService(TestDbContextFactory.CreateSqlServerDbContext()), x => x.Id, new EmployeeDataFactory()) + { + } } diff --git a/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs b/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs index 404e5eb9..82930051 100644 --- a/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs +++ b/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs @@ -21,7 +21,7 @@ public static void Initialize(AppDbContext context) var employeeDataFactory = new EmployeeDataFactory(); - for (int i = 0; i < 10; i++) + for (int i = 0; i < 1; i++) context.Employees.Add(employeeDataFactory.Factory_Entity()); context.SaveChanges(); diff --git a/Infrastructure.EFCore/Eisk.EFCore.Setup/TestDbContextFactory.cs b/Infrastructure.EFCore/Eisk.EFCore.Setup/TestDbContextFactory.cs index 31c990fa..0d00fa9f 100644 --- a/Infrastructure.EFCore/Eisk.EFCore.Setup/TestDbContextFactory.cs +++ b/Infrastructure.EFCore/Eisk.EFCore.Setup/TestDbContextFactory.cs @@ -8,5 +8,10 @@ public static AppDbContext CreateDbContext() { return new InMemoryDbContext(true); } + + public static AppDbContext CreateSqlServerDbContext() + { + return new SqlServerDbContext("Server=(localdb)\\mssqllocaldb;Database=eisk;Trusted_Connection=True;MultipleActiveResultSets=true"); + } } } \ No newline at end of file diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 1fe972fe..482be126 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -1,8 +1,9 @@ ======================================================== TODO: Today -* Investigate with length field is not causing issue when saving * Test data service with sql server local instance + +* Investigate with length field is not causing issue when saving * Re-visit exception classes * Apply custom business logic From 5af1991c39def712172eb24f36301e6258f389e4 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Thu, 14 Apr 2022 18:43:05 +0100 Subject: [PATCH 087/204] integration tests updated --- .../DataServiceBaseIntegrationTests.cs | 31 +++++++++---------- .../DbContextDataInitializer.cs | 7 ++++- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs b/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs index 0be7bb7b..331cc834 100644 --- a/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs +++ b/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs @@ -1,8 +1,10 @@ using System; +using System.Data.SqlClient; using System.Linq.Expressions; using System.Threading.Tasks; using Eisk.Core.DataService; using Eisk.Test.Core.DataGen; +using Microsoft.EntityFrameworkCore; using Xunit; namespace Eisk.Test.Core.TestBases @@ -48,18 +50,15 @@ public virtual async Task Add_ValidDomainPassed_ShouldReturnDomainAfterCreation( } [Fact] - public virtual async Task Add_ValidDomainWithRandomIdPassed_ShouldReturnDomainAfterCreation() + public virtual async Task Add_ValidDomainWithRandomIdPassed_ShouldThrowException() { //Arrange var inputEntity = Factory_Entity(); + SetIdValueToEntity(inputEntity, 1000); var dataService = GetServiceInstance(); - //Act - var returnedEntity = await dataService.Add(inputEntity); - //Assert - Assert.NotNull(returnedEntity); - Assert.NotEqual(default(TId), GetIdValueFromEntity(returnedEntity)); + await Assert.ThrowsAsync(() => dataService.Add(inputEntity)); } [Fact] @@ -79,10 +78,8 @@ public virtual async Task GetById_ValidIdPassed_ShouldReturnResult() { //Arrange var domain = Factory_Entity(); - var dataService = GetServiceInstance(async () => - { - await CreateTestEntityToStore(domain); - }); + var dataService = GetServiceInstance(); + await CreateTestEntityToStore(domain); var idValue = GetIdValueFromEntity(domain); @@ -127,10 +124,8 @@ public virtual async Task Update_ValidDomainPassed_ShouldReturnDomain() { //Arrange var inputEntity = Factory_Entity(); - var dataService = GetServiceInstance(async () => - { - await CreateTestEntityToStore(inputEntity); - }); + var dataService = GetServiceInstance(); + await CreateTestEntityToStore(inputEntity); //Act var returnedEntity = await dataService.Update(inputEntity); @@ -162,6 +157,8 @@ public virtual async Task Update_ValidDomainWithRandomIdPassed_ShouldThrowExcept { //Arrange var entityWithRandomId = Factory_Entity(); + SetIdValueToEntity(entityWithRandomId, 1000); + var dataService = GetServiceInstance(); //Act @@ -188,7 +185,8 @@ public virtual async Task Delete_DomainWithValidIdPassed_ShouldDeleteSuccessfull { //Arrange var inputEntity = Factory_Entity(); - var dataService = GetServiceInstance(async () => await CreateTestEntityToStore(inputEntity)); + var dataService = GetServiceInstance(); + await CreateTestEntityToStore(inputEntity); var idValue = GetIdValueFromEntity(inputEntity); //Act @@ -218,8 +216,9 @@ public virtual async Task Delete_DomainWithRandomIdPassed_ShouldThrowException() { //Arrange var inputEntity = Factory_Entity(); + SetIdValueToEntity(inputEntity, 1000); var dataService = GetServiceInstance(); - + //Act var ex = await Record.ExceptionAsync(() => dataService.Delete(inputEntity)); diff --git a/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs b/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs index 82930051..75affa97 100644 --- a/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs +++ b/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs @@ -4,6 +4,8 @@ namespace Eisk.EFCore.Setup { using DataServices.EFCore.DataContext; using Domains.TestData; + using Eisk.Domains.Entities; + using System.Collections.Generic; public static class DbContextDataInitializer { @@ -20,11 +22,14 @@ public static void Initialize(AppDbContext context) } var employeeDataFactory = new EmployeeDataFactory(); + var testEmployees = new List(); for (int i = 0; i < 1; i++) - context.Employees.Add(employeeDataFactory.Factory_Entity()); + testEmployees.Add(employeeDataFactory.Factory_Entity()); + context.Employees.AddRange(testEmployees); context.SaveChanges(); + } } } \ No newline at end of file From 1c018b5f9c376f92e785d5aa1217b9e4da6763da Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Thu, 14 Apr 2022 18:53:23 +0100 Subject: [PATCH 088/204] integration tests added. --- .../DataServiceBaseIntegrationTests.cs | 11 ++++----- .../TestBases/EntityTestBase.cs | 9 +++++++ .../Eisk.Domains/BaseEntities/Person.cs | 2 +- .../DatabaseFixture.cs | 20 ++++++++++++++++ .../EmployeeDataServiceTests.cs | 24 ++++--------------- .../DbContextDataInitializer.cs | 2 +- 6 files changed, 39 insertions(+), 29 deletions(-) create mode 100644 Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/DatabaseFixture.cs diff --git a/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs b/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs index 331cc834..82a2cbb0 100644 --- a/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs +++ b/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs @@ -53,12 +53,11 @@ public virtual async Task Add_ValidDomainPassed_ShouldReturnDomainAfterCreation( public virtual async Task Add_ValidDomainWithRandomIdPassed_ShouldThrowException() { //Arrange - var inputEntity = Factory_Entity(); - SetIdValueToEntity(inputEntity, 1000); + var inputEntityWithRandomId = Factory_EntityWithRandomId(); var dataService = GetServiceInstance(); //Assert - await Assert.ThrowsAsync(() => dataService.Add(inputEntity)); + await Assert.ThrowsAsync(() => dataService.Add(inputEntityWithRandomId)); } [Fact] @@ -156,8 +155,7 @@ public virtual async Task Update_ValidDomainWithEmptyIdPassed_ShouldCreateDomain public virtual async Task Update_ValidDomainWithRandomIdPassed_ShouldThrowException() { //Arrange - var entityWithRandomId = Factory_Entity(); - SetIdValueToEntity(entityWithRandomId, 1000); + var entityWithRandomId = Factory_EntityWithRandomId(); var dataService = GetServiceInstance(); @@ -215,8 +213,7 @@ public virtual async Task Delete_DomainWithEmptyIdPassed_ShouldThrowException() public virtual async Task Delete_DomainWithRandomIdPassed_ShouldThrowException() { //Arrange - var inputEntity = Factory_Entity(); - SetIdValueToEntity(inputEntity, 1000); + var inputEntity = Factory_EntityWithRandomId(); var dataService = GetServiceInstance(); //Act diff --git a/Core/Eisk.Test.Core/TestBases/EntityTestBase.cs b/Core/Eisk.Test.Core/TestBases/EntityTestBase.cs index 53cad975..67ebf1db 100644 --- a/Core/Eisk.Test.Core/TestBases/EntityTestBase.cs +++ b/Core/Eisk.Test.Core/TestBases/EntityTestBase.cs @@ -40,6 +40,15 @@ protected virtual TEntity Factory_Entity(Action action = null, bool set return entity; } + protected virtual TEntity Factory_EntityWithRandomId(Action action = null) + { + var entity = Factory_Entity(action, false); + + SetIdValueToEntity(entity, 1000);//TODO: to be randomize + + return entity; + } + protected TId GetIdValueFromEntity(TEntity entity) { return (TId)ExpressionUtil.GetPropertyValue(DbIdExpression, entity); diff --git a/DomainCore/Eisk.Domains/BaseEntities/Person.cs b/DomainCore/Eisk.Domains/BaseEntities/Person.cs index ed0fc345..bf1e3a72 100644 --- a/DomainCore/Eisk.Domains/BaseEntities/Person.cs +++ b/DomainCore/Eisk.Domains/BaseEntities/Person.cs @@ -33,7 +33,7 @@ public class Person public Address Address { get; set; } [Required(ErrorMessage = "Phone required")] - [StringLength(20)] + [StringLength(25)] public string Phone { get; set; } [StringLength(4)] diff --git a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/DatabaseFixture.cs b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/DatabaseFixture.cs new file mode 100644 index 00000000..6ce6e977 --- /dev/null +++ b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/DatabaseFixture.cs @@ -0,0 +1,20 @@ +using Eisk.EFCore.Setup; +using System; + +namespace Eisk.DataServices.EFCore.IntegrationTests +{ + public class DatabaseFixture : IDisposable + { + public DatabaseFixture() + { + var db = TestDbContextFactory.CreateSqlServerDbContext(); + DbContextDataInitializer.Initialize(db); + } + + public void Dispose() + { + // ... clean up test data from the database ... + } + + } +} diff --git a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/EmployeeDataServiceTests.cs b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/EmployeeDataServiceTests.cs index 0bd7d3ed..78088071 100644 --- a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/EmployeeDataServiceTests.cs +++ b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/EmployeeDataServiceTests.cs @@ -1,27 +1,11 @@ -using Eisk.EFCore.Setup; -using Eisk.Domains.Entities; -using Eisk.Test.Core.TestBases; -using Eisk.Domains.TestData; -using Eisk.DataServices.EFCore.DataContext; -using System; using Xunit; namespace Eisk.DataServices.EFCore.IntegrationTests { - public class DatabaseFixture : IDisposable - { - public DatabaseFixture() - { - var db = TestDbContextFactory.CreateSqlServerDbContext(); - DbContextDataInitializer.Initialize(db); - } - - public void Dispose() - { - // ... clean up test data from the database ... - } - - } + using Domains.Entities; + using Test.Core.TestBases; + using Domains.TestData; + using Eisk.EFCore.Setup; public class EmployeeDataServiceTests: DataServiceBaseIntegrationTests, IClassFixture { diff --git a/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs b/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs index 75affa97..2b560a96 100644 --- a/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs +++ b/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs @@ -24,7 +24,7 @@ public static void Initialize(AppDbContext context) var employeeDataFactory = new EmployeeDataFactory(); var testEmployees = new List(); - for (int i = 0; i < 1; i++) + for (int i = 0; i < 100; i++) testEmployees.Add(employeeDataFactory.Factory_Entity()); context.Employees.AddRange(testEmployees); From 080b6c635f2a64f22bfce4bc25cc1af6ac07cf76 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Thu, 14 Apr 2022 19:04:59 +0100 Subject: [PATCH 089/204] updated integratetion test --- .../TestBases/DataServiceBaseIntegrationTests.cs | 11 +++++------ Core/Eisk.Test.Core/TestBases/EntityTestBase.cs | 3 ++- DomainCore/Eisk.Domains/BaseEntities/Person.cs | 6 +++--- DomainCore/Eisk.Domains/ValueObjects/Address.cs | 10 +++++----- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs b/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs index 82a2cbb0..b36296d8 100644 --- a/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs +++ b/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs @@ -1,10 +1,9 @@ -using System; -using System.Data.SqlClient; -using System.Linq.Expressions; -using System.Threading.Tasks; -using Eisk.Core.DataService; +using Eisk.Core.DataService; using Eisk.Test.Core.DataGen; using Microsoft.EntityFrameworkCore; +using System; +using System.Linq.Expressions; +using System.Threading.Tasks; using Xunit; namespace Eisk.Test.Core.TestBases @@ -111,7 +110,7 @@ public virtual async Task GetById_InvalidIdPassed_ShouldReturnNull() var dataService = GetServiceInstance(); //Act - var returnedEntity = await dataService.GetById(100);//TODO: make it generic random + var returnedEntity = await dataService.GetById(RANDOM_ID);//TODO: make it generic random //Assert Assert.Null(returnedEntity); diff --git a/Core/Eisk.Test.Core/TestBases/EntityTestBase.cs b/Core/Eisk.Test.Core/TestBases/EntityTestBase.cs index 67ebf1db..cc9e1544 100644 --- a/Core/Eisk.Test.Core/TestBases/EntityTestBase.cs +++ b/Core/Eisk.Test.Core/TestBases/EntityTestBase.cs @@ -22,6 +22,7 @@ protected EntityDataFactory EntityDataFactory } } + protected const int RANDOM_ID = 10000; protected EntityTestBase(Expression> idExpression, EntityDataFactory entityDataFactory = null) { DbIdExpression = idExpression; @@ -44,7 +45,7 @@ protected virtual TEntity Factory_EntityWithRandomId(Action action = nu { var entity = Factory_Entity(action, false); - SetIdValueToEntity(entity, 1000);//TODO: to be randomize + SetIdValueToEntity(entity, RANDOM_ID);//TODO: to be randomize return entity; } diff --git a/DomainCore/Eisk.Domains/BaseEntities/Person.cs b/DomainCore/Eisk.Domains/BaseEntities/Person.cs index bf1e3a72..a07cd112 100644 --- a/DomainCore/Eisk.Domains/BaseEntities/Person.cs +++ b/DomainCore/Eisk.Domains/BaseEntities/Person.cs @@ -18,12 +18,12 @@ public class Person public TitleOfCourtesy? TitleOfCourtesy { get; set; } [Required(ErrorMessage = "First name required.")] - [StringLength(25)] + [StringLength(50)] [Display(Name = "First Name")] public string FirstName { get; set; } [Required(ErrorMessage = "Last name required.")] - [StringLength(25)] + [StringLength(50)] [Display(Name = "Last Name")] public string LastName { get; set; } @@ -33,7 +33,7 @@ public class Person public Address Address { get; set; } [Required(ErrorMessage = "Phone required")] - [StringLength(25)] + [StringLength(50)] public string Phone { get; set; } [StringLength(4)] diff --git a/DomainCore/Eisk.Domains/ValueObjects/Address.cs b/DomainCore/Eisk.Domains/ValueObjects/Address.cs index 5eb5eeb5..d1ada424 100644 --- a/DomainCore/Eisk.Domains/ValueObjects/Address.cs +++ b/DomainCore/Eisk.Domains/ValueObjects/Address.cs @@ -9,19 +9,19 @@ public class Address [Display(Name = "Address line")] public string AddressLine { get; set; } - [StringLength(25)] + [StringLength(50)] public string City { get; set; } - [StringLength(25)] + [StringLength(50)] public string Region { get; set; } - [StringLength(10)] - [RegularExpression("\\d{1,10}", ErrorMessage = "Not a valid postal code. Please consider upto 10 digit for valid postal format.")] + [StringLength(50)] + [RegularExpression("\\d{1,50}", ErrorMessage = "Not a valid postal code. Please consider upto 10 digit for valid postal format.")] [Display(Name = "Postal Code")] public string PostalCode { get; set; } [Required(ErrorMessage = "Country required.")] - [StringLength(25)] + [StringLength(50)] public string Country { get; set; } } From 5661d1400053c5c83f4dd1f482ff563494af5b88 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Thu, 14 Apr 2022 19:23:51 +0100 Subject: [PATCH 090/204] -- integration tests added --- ...EmployeeDataServiceBaseIntegrationTests.cs | 16 ------------- .../EmployeeDataServiceTests.cs | 13 ---------- .../EmployeeDataServiceTestsWithInMemoryDb.cs | 24 +++++++++++++++++++ .../EmployeeDataServiceTests.cs | 18 -------------- .../EmployeeDataServiceTestsWithSqlServer.cs | 18 ++++++++++++++ .../EmployeeDomainServiceComponentTests.cs | 6 ++--- .../Eisk.EFCore.Setup/TestDbContextFactory.cs | 2 +- Notes/TODO.txt | 4 ++-- 8 files changed, 48 insertions(+), 53 deletions(-) delete mode 100644 Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/EmployeeDataServiceBaseIntegrationTests.cs delete mode 100644 Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/EmployeeDataServiceTests.cs create mode 100644 Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/EmployeeDataServiceTestsWithInMemoryDb.cs delete mode 100644 Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/EmployeeDataServiceTests.cs create mode 100644 Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/EmployeeDataServiceTestsWithSqlServer.cs diff --git a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/EmployeeDataServiceBaseIntegrationTests.cs b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/EmployeeDataServiceBaseIntegrationTests.cs deleted file mode 100644 index d719d84b..00000000 --- a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/EmployeeDataServiceBaseIntegrationTests.cs +++ /dev/null @@ -1,16 +0,0 @@ -using Eisk.DataServices.Interfaces; -using Eisk.Domains.Entities; -using Eisk.Domains.TestData; -using Eisk.Test.Core.TestBases; - -namespace Eisk.DataServices.EFCore.IntegrationTests.Ext -{ - public abstract class EmployeeDataServiceBaseIntegrationTests : DataServiceBaseIntegrationTests - { - protected EmployeeDataServiceBaseIntegrationTests(IEmployeeDataService employeeDataService) :base (employeeDataService, x => x.Id) - { - - } - - } -} diff --git a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/EmployeeDataServiceTests.cs b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/EmployeeDataServiceTests.cs deleted file mode 100644 index aff1f2d5..00000000 --- a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/EmployeeDataServiceTests.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Eisk.DataServices.EFCore.IntegrationTests.Ext -{ - using Eisk.EFCore.Setup; - - public class EmployeeDataServiceTests: EmployeeDataServiceBaseIntegrationTests - { - public EmployeeDataServiceTests():base (new EmployeeDataService(TestDbContextFactory.CreateDbContext())) - { - - } - - } -} diff --git a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/EmployeeDataServiceTestsWithInMemoryDb.cs b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/EmployeeDataServiceTestsWithInMemoryDb.cs new file mode 100644 index 00000000..eb817985 --- /dev/null +++ b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/EmployeeDataServiceTestsWithInMemoryDb.cs @@ -0,0 +1,24 @@ +namespace Eisk.DataServices.EFCore.IntegrationTests +{ + using Domains.Entities; + using Test.Core.TestBases; + using Domains.TestData; + using Eisk.EFCore.Setup; + using System.Threading.Tasks; + + public class EmployeeDataServiceTestsWithInMemoryDb : DataServiceBaseIntegrationTests + { + public EmployeeDataServiceTestsWithInMemoryDb() : base(new EmployeeDataService(TestDbContextFactory.CreateInMemoryDbContext()), x => x.Id, new EmployeeDataFactory()) + { + + } + + public override async Task Add_ValidDomainWithRandomIdPassed_ShouldThrowException() + { + await Task.Run(() => { + //no op method for in-memory + }); + } + + } +} diff --git a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/EmployeeDataServiceTests.cs b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/EmployeeDataServiceTests.cs deleted file mode 100644 index 78088071..00000000 --- a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/EmployeeDataServiceTests.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Xunit; - -namespace Eisk.DataServices.EFCore.IntegrationTests -{ - using Domains.Entities; - using Test.Core.TestBases; - using Domains.TestData; - using Eisk.EFCore.Setup; - - public class EmployeeDataServiceTests: DataServiceBaseIntegrationTests, IClassFixture - { - public EmployeeDataServiceTests(): base(new EmployeeDataService(TestDbContextFactory.CreateSqlServerDbContext()), x => x.Id, new EmployeeDataFactory()) - { - - } - - } -} diff --git a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/EmployeeDataServiceTestsWithSqlServer.cs b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/EmployeeDataServiceTestsWithSqlServer.cs new file mode 100644 index 00000000..c23d8a19 --- /dev/null +++ b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/EmployeeDataServiceTestsWithSqlServer.cs @@ -0,0 +1,18 @@ +using Xunit; + +namespace Eisk.DataServices.EFCore.IntegrationTests +{ + using Domains.Entities; + using Test.Core.TestBases; + using Domains.TestData; + using Eisk.EFCore.Setup; + + public class EmployeeDataServiceTestsWithSqlServer: DataServiceBaseIntegrationTests, IClassFixture + { + public EmployeeDataServiceTestsWithSqlServer(): base(new EmployeeDataService(TestDbContextFactory.CreateSqlServerDbContext()), x => x.Id, new EmployeeDataFactory()) + { + + } + + } +} diff --git a/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/EmployeeDomainServiceComponentTests.cs b/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/EmployeeDomainServiceComponentTests.cs index 3836fc32..e41c8fa4 100644 --- a/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/EmployeeDomainServiceComponentTests.cs +++ b/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/EmployeeDomainServiceComponentTests.cs @@ -6,9 +6,9 @@ namespace Eisk.DomainServices.ComponentTests.EFCore { - public class EmployeeDomainServiceComponentTests : DomainServiceBaseComponentTests + public class EmployeeDataServiceTestsWithSqlServer : DomainServiceBaseComponentTests { - public EmployeeDomainServiceComponentTests() : + public EmployeeDataServiceTestsWithSqlServer() : base(new EmployeeDomainService(Factory_DataService()), x => x.Id, new EmployeeDataFactory()) { @@ -16,7 +16,7 @@ public EmployeeDomainServiceComponentTests() : static EmployeeDataService Factory_DataService() { - EmployeeDataService employeeDataService = new EmployeeDataService(TestDbContextFactory.CreateDbContext()); + EmployeeDataService employeeDataService = new EmployeeDataService(TestDbContextFactory.CreateInMemoryDbContext()); return employeeDataService; } diff --git a/Infrastructure.EFCore/Eisk.EFCore.Setup/TestDbContextFactory.cs b/Infrastructure.EFCore/Eisk.EFCore.Setup/TestDbContextFactory.cs index 0d00fa9f..19974048 100644 --- a/Infrastructure.EFCore/Eisk.EFCore.Setup/TestDbContextFactory.cs +++ b/Infrastructure.EFCore/Eisk.EFCore.Setup/TestDbContextFactory.cs @@ -4,7 +4,7 @@ namespace Eisk.EFCore.Setup { public static class TestDbContextFactory { - public static AppDbContext CreateDbContext() + public static AppDbContext CreateInMemoryDbContext() { return new InMemoryDbContext(true); } diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 482be126..00daa965 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -1,9 +1,7 @@ ======================================================== TODO: Today -* Test data service with sql server local instance -* Investigate with length field is not causing issue when saving * Re-visit exception classes * Apply custom business logic @@ -17,6 +15,8 @@ TODO: Today * check conditional rendering (file) * check conditional rendering (text) +DONE * Investigate with length field is not causing issue when saving (for in-memory db constraints not applied) +DONE * Test data service with sql server local instance DONE * Remove sub-module DONE * Complete custom data generator implementation DONE * Test string size implementor From bc29be3b25c278c78a4e1b87194d00f7f7a2fce2 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Thu, 14 Apr 2022 19:33:54 +0100 Subject: [PATCH 091/204] updated integration tests. --- DomainCore/Eisk.Domains/ValueObjects/Address.cs | 12 ++++++------ .../EmployeeDataServiceTestsWithInMemoryDb.cs | 3 +-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/DomainCore/Eisk.Domains/ValueObjects/Address.cs b/DomainCore/Eisk.Domains/ValueObjects/Address.cs index d1ada424..ef8affdb 100644 --- a/DomainCore/Eisk.Domains/ValueObjects/Address.cs +++ b/DomainCore/Eisk.Domains/ValueObjects/Address.cs @@ -4,24 +4,24 @@ namespace Eisk.Domains.ValueObjects { public class Address { - [StringLength(60)] + [StringLength(80)] [Required(ErrorMessage = "Address line required.")] [Display(Name = "Address line")] public string AddressLine { get; set; } - [StringLength(50)] + [StringLength(80)] public string City { get; set; } - [StringLength(50)] + [StringLength(80)] public string Region { get; set; } - [StringLength(50)] - [RegularExpression("\\d{1,50}", ErrorMessage = "Not a valid postal code. Please consider upto 10 digit for valid postal format.")] + [StringLength(80)] + [RegularExpression("\\d{1,80}", ErrorMessage = "Not a valid postal code. Please consider upto 10 digit for valid postal format.")] [Display(Name = "Postal Code")] public string PostalCode { get; set; } [Required(ErrorMessage = "Country required.")] - [StringLength(50)] + [StringLength(80)] public string Country { get; set; } } diff --git a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/EmployeeDataServiceTestsWithInMemoryDb.cs b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/EmployeeDataServiceTestsWithInMemoryDb.cs index eb817985..ea698367 100644 --- a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/EmployeeDataServiceTestsWithInMemoryDb.cs +++ b/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/EmployeeDataServiceTestsWithInMemoryDb.cs @@ -2,13 +2,12 @@ namespace Eisk.DataServices.EFCore.IntegrationTests { using Domains.Entities; using Test.Core.TestBases; - using Domains.TestData; using Eisk.EFCore.Setup; using System.Threading.Tasks; public class EmployeeDataServiceTestsWithInMemoryDb : DataServiceBaseIntegrationTests { - public EmployeeDataServiceTestsWithInMemoryDb() : base(new EmployeeDataService(TestDbContextFactory.CreateInMemoryDbContext()), x => x.Id, new EmployeeDataFactory()) + public EmployeeDataServiceTestsWithInMemoryDb() : base(new EmployeeDataService(TestDbContextFactory.CreateInMemoryDbContext()), x => x.Id) { } From 18415492f87264736dcd326e3311c2f3409f15f7 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Thu, 14 Apr 2022 20:42:23 +0100 Subject: [PATCH 092/204] integration tests refactored --- .../Eisk.DataServices.EFCore.IntegrationTests.Ext.csproj | 0 .../EmployeeDataServiceTestsWithInMemoryDb.cs | 0 .../DatabaseFixture.cs | 0 .../Eisk.DataServices.EFCore.IntegrationTests.csproj | 0 .../EmployeeDataServiceTestsWithSqlServer.cs | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename Infrastructure.EFCore/{Eisk.DataServices.EFCore.IntegrationTests.Ext => Eisk.DataServices.IntegrationTests.EFCore.InMemory}/Eisk.DataServices.EFCore.IntegrationTests.Ext.csproj (100%) rename Infrastructure.EFCore/{Eisk.DataServices.EFCore.IntegrationTests.Ext => Eisk.DataServices.IntegrationTests.EFCore.InMemory}/EmployeeDataServiceTestsWithInMemoryDb.cs (100%) rename Infrastructure.EFCore/{Eisk.DataServices.EFCore.IntegrationTests => Eisk.DataServices.IntegrationTests.EFCore.SqlServer}/DatabaseFixture.cs (100%) rename Infrastructure.EFCore/{Eisk.DataServices.EFCore.IntegrationTests => Eisk.DataServices.IntegrationTests.EFCore.SqlServer}/Eisk.DataServices.EFCore.IntegrationTests.csproj (100%) rename Infrastructure.EFCore/{Eisk.DataServices.EFCore.IntegrationTests => Eisk.DataServices.IntegrationTests.EFCore.SqlServer}/EmployeeDataServiceTestsWithSqlServer.cs (100%) diff --git a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/Eisk.DataServices.EFCore.IntegrationTests.Ext.csproj b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.InMemory/Eisk.DataServices.EFCore.IntegrationTests.Ext.csproj similarity index 100% rename from Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/Eisk.DataServices.EFCore.IntegrationTests.Ext.csproj rename to Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.InMemory/Eisk.DataServices.EFCore.IntegrationTests.Ext.csproj diff --git a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/EmployeeDataServiceTestsWithInMemoryDb.cs b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.InMemory/EmployeeDataServiceTestsWithInMemoryDb.cs similarity index 100% rename from Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests.Ext/EmployeeDataServiceTestsWithInMemoryDb.cs rename to Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.InMemory/EmployeeDataServiceTestsWithInMemoryDb.cs diff --git a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/DatabaseFixture.cs b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/DatabaseFixture.cs similarity index 100% rename from Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/DatabaseFixture.cs rename to Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/DatabaseFixture.cs diff --git a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/Eisk.DataServices.EFCore.IntegrationTests.csproj b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/Eisk.DataServices.EFCore.IntegrationTests.csproj similarity index 100% rename from Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/Eisk.DataServices.EFCore.IntegrationTests.csproj rename to Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/Eisk.DataServices.EFCore.IntegrationTests.csproj diff --git a/Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/EmployeeDataServiceTestsWithSqlServer.cs b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/EmployeeDataServiceTestsWithSqlServer.cs similarity index 100% rename from Infrastructure.EFCore/Eisk.DataServices.EFCore.IntegrationTests/EmployeeDataServiceTestsWithSqlServer.cs rename to Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/EmployeeDataServiceTestsWithSqlServer.cs From 00d9e687d5c6fef08d1ba5e00d170bcbef445513 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Thu, 14 Apr 2022 20:42:37 +0100 Subject: [PATCH 093/204] integration tests refactored --- .../DataServiceBaseIntegrationTests.cs | 11 ------ ...ataServiceSqlServerBaseIntegrationTests.cs | 35 +++++++++++++++++++ Eisk.WebApi.TemplatePack.sln | 28 +++++++-------- .../template/Eisk.WebApi.proj | 2 +- Eisk.WebApi.sln | 7 ++++ ...s.IntegrationTests.EFCore.InMemory.csproj} | 0 .../EmployeeDataServiceTestsWithInMemoryDb.cs | 11 ++---- .../DatabaseFixture.cs | 2 +- ....IntegrationTests.EFCore.SqlServer.csproj} | 0 .../EmployeeDataServiceTestsWithSqlServer.cs | 5 +-- 10 files changed, 63 insertions(+), 38 deletions(-) create mode 100644 Core/Eisk.Test.Core/TestBases/DataServiceSqlServerBaseIntegrationTests.cs rename Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.InMemory/{Eisk.DataServices.EFCore.IntegrationTests.Ext.csproj => Eisk.DataServices.IntegrationTests.EFCore.InMemory.csproj} (100%) rename Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/{Eisk.DataServices.EFCore.IntegrationTests.csproj => Eisk.DataServices.IntegrationTests.EFCore.SqlServer.csproj} (100%) diff --git a/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs b/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs index b36296d8..59b5d760 100644 --- a/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs +++ b/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs @@ -48,17 +48,6 @@ public virtual async Task Add_ValidDomainPassed_ShouldReturnDomainAfterCreation( Assert.NotEqual(default(TId), GetIdValueFromEntity(returnedEntity)); } - [Fact] - public virtual async Task Add_ValidDomainWithRandomIdPassed_ShouldThrowException() - { - //Arrange - var inputEntityWithRandomId = Factory_EntityWithRandomId(); - var dataService = GetServiceInstance(); - - //Assert - await Assert.ThrowsAsync(() => dataService.Add(inputEntityWithRandomId)); - } - [Fact] public virtual async Task Add_NullDomainPassed_ShouldThrowArgumentNullException() { diff --git a/Core/Eisk.Test.Core/TestBases/DataServiceSqlServerBaseIntegrationTests.cs b/Core/Eisk.Test.Core/TestBases/DataServiceSqlServerBaseIntegrationTests.cs new file mode 100644 index 00000000..3b948900 --- /dev/null +++ b/Core/Eisk.Test.Core/TestBases/DataServiceSqlServerBaseIntegrationTests.cs @@ -0,0 +1,35 @@ +using Eisk.Core.DataService; +using Eisk.Test.Core.DataGen; +using Microsoft.EntityFrameworkCore; +using System; +using System.Linq.Expressions; +using System.Threading.Tasks; +using Xunit; + +namespace Eisk.Test.Core.TestBases +{ + public abstract class DataServiceSqlServerBaseIntegrationTests : DataServiceBaseIntegrationTests, + IServiceTest> + where TEntity : class, new() + { + private readonly IEntityDataService _dataService; + + protected DataServiceSqlServerBaseIntegrationTests(IEntityDataService dataService, Expression> idExpression, EntityDataFactory entityDataFactory = null) + :base(dataService, idExpression, entityDataFactory) + { + _dataService = dataService; + } + + + [Fact] + public virtual async Task Add_ValidDomainWithRandomIdPassed_ShouldThrowException() + { + //Arrange + var inputEntityWithRandomId = Factory_EntityWithRandomId(); + var dataService = GetServiceInstance(); + + //Assert + await Assert.ThrowsAsync(() => dataService.Add(inputEntityWithRandomId)); + } + } +} diff --git a/Eisk.WebApi.TemplatePack.sln b/Eisk.WebApi.TemplatePack.sln index 54ae0b09..cfb8cfc9 100644 --- a/Eisk.WebApi.TemplatePack.sln +++ b/Eisk.WebApi.TemplatePack.sln @@ -45,10 +45,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DataServices.EFCore", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.EFCore.Setup", "Infrastructure.EFCore\Eisk.EFCore.Setup\Eisk.EFCore.Setup.csproj", "{5C60F4F8-B7A7-4B14-B476-79E138BAF1F9}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DataServices.EFCore.IntegrationTests", "Infrastructure.EFCore\Eisk.DataServices.EFCore.IntegrationTests\Eisk.DataServices.EFCore.IntegrationTests.csproj", "{57348807-E087-4B0F-906E-72E4768B693C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DataServices.EFCore.IntegrationTests.Ext", "Infrastructure.EFCore\Eisk.DataServices.EFCore.IntegrationTests.Ext\Eisk.DataServices.EFCore.IntegrationTests.Ext.csproj", "{BB413B48-E598-47C8-AF1B-887203391F8E}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DomainServices.ComponentTests.EFCore", "Infrastructure.EFCore\Eisk.DomainServices.ComponentTests.EFCore\Eisk.DomainServices.ComponentTests.EFCore.csproj", "{CB7B38B4-9AE5-4B86-BC31-CD74F8690D79}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.WebApi", "WebApi\Eisk.WebApi\Eisk.WebApi.csproj", "{B99A94EA-9D76-4C67-88E2-A1814930E8B5}" @@ -67,6 +63,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Notes", "Notes", "{ACEB7D4D EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.Domains.TestData", "DomainCore\Eisk.Domains.TestData\Eisk.Domains.TestData.csproj", "{D0227185-3F9D-41B4-9314-C7B3CBC38D6F}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DataServices.IntegrationTests.EFCore.InMemory", "Infrastructure.EFCore\Eisk.DataServices.IntegrationTests.EFCore.InMemory\Eisk.DataServices.IntegrationTests.EFCore.InMemory.csproj", "{6FDA83B9-3E99-47AB-B232-E161C817BD1D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DataServices.IntegrationTests.EFCore.SqlServer", "Infrastructure.EFCore\Eisk.DataServices.IntegrationTests.EFCore.SqlServer\Eisk.DataServices.IntegrationTests.EFCore.SqlServer.csproj", "{BE2F6BCA-1D2F-45E5-BD93-F23DA0293931}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -117,14 +117,6 @@ Global {5C60F4F8-B7A7-4B14-B476-79E138BAF1F9}.Debug|Any CPU.Build.0 = Debug|Any CPU {5C60F4F8-B7A7-4B14-B476-79E138BAF1F9}.Release|Any CPU.ActiveCfg = Release|Any CPU {5C60F4F8-B7A7-4B14-B476-79E138BAF1F9}.Release|Any CPU.Build.0 = Release|Any CPU - {57348807-E087-4B0F-906E-72E4768B693C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {57348807-E087-4B0F-906E-72E4768B693C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {57348807-E087-4B0F-906E-72E4768B693C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {57348807-E087-4B0F-906E-72E4768B693C}.Release|Any CPU.Build.0 = Release|Any CPU - {BB413B48-E598-47C8-AF1B-887203391F8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BB413B48-E598-47C8-AF1B-887203391F8E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BB413B48-E598-47C8-AF1B-887203391F8E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BB413B48-E598-47C8-AF1B-887203391F8E}.Release|Any CPU.Build.0 = Release|Any CPU {CB7B38B4-9AE5-4B86-BC31-CD74F8690D79}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CB7B38B4-9AE5-4B86-BC31-CD74F8690D79}.Debug|Any CPU.Build.0 = Debug|Any CPU {CB7B38B4-9AE5-4B86-BC31-CD74F8690D79}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -137,6 +129,14 @@ Global {D0227185-3F9D-41B4-9314-C7B3CBC38D6F}.Debug|Any CPU.Build.0 = Debug|Any CPU {D0227185-3F9D-41B4-9314-C7B3CBC38D6F}.Release|Any CPU.ActiveCfg = Release|Any CPU {D0227185-3F9D-41B4-9314-C7B3CBC38D6F}.Release|Any CPU.Build.0 = Release|Any CPU + {6FDA83B9-3E99-47AB-B232-E161C817BD1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6FDA83B9-3E99-47AB-B232-E161C817BD1D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6FDA83B9-3E99-47AB-B232-E161C817BD1D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6FDA83B9-3E99-47AB-B232-E161C817BD1D}.Release|Any CPU.Build.0 = Release|Any CPU + {BE2F6BCA-1D2F-45E5-BD93-F23DA0293931}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BE2F6BCA-1D2F-45E5-BD93-F23DA0293931}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BE2F6BCA-1D2F-45E5-BD93-F23DA0293931}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BE2F6BCA-1D2F-45E5-BD93-F23DA0293931}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -153,11 +153,11 @@ Global {77414DF8-79D7-4879-AEA6-EAA237639F67} = {07B09CE7-77B7-4F0F-9BF1-1CA13B8501D8} {521DC48B-EE63-41DB-B226-382EE39A3CF8} = {8D09A735-BB55-4075-9B06-EAAA18F59781} {5C60F4F8-B7A7-4B14-B476-79E138BAF1F9} = {8D09A735-BB55-4075-9B06-EAAA18F59781} - {57348807-E087-4B0F-906E-72E4768B693C} = {8D09A735-BB55-4075-9B06-EAAA18F59781} - {BB413B48-E598-47C8-AF1B-887203391F8E} = {8D09A735-BB55-4075-9B06-EAAA18F59781} {CB7B38B4-9AE5-4B86-BC31-CD74F8690D79} = {8D09A735-BB55-4075-9B06-EAAA18F59781} {B99A94EA-9D76-4C67-88E2-A1814930E8B5} = {9611B3D6-810A-4E98-9166-2DA770E38B81} {D0227185-3F9D-41B4-9314-C7B3CBC38D6F} = {07B09CE7-77B7-4F0F-9BF1-1CA13B8501D8} + {6FDA83B9-3E99-47AB-B232-E161C817BD1D} = {8D09A735-BB55-4075-9B06-EAAA18F59781} + {BE2F6BCA-1D2F-45E5-BD93-F23DA0293931} = {8D09A735-BB55-4075-9B06-EAAA18F59781} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4370F72B-9D16-4EBF-8EF5-1F0925FC7CC6} diff --git a/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj b/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj index c1b3d5f6..b881b3b6 100644 --- a/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj +++ b/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj @@ -26,7 +26,7 @@ - + diff --git a/Eisk.WebApi.sln b/Eisk.WebApi.sln index f35bb9a5..6acee948 100644 --- a/Eisk.WebApi.sln +++ b/Eisk.WebApi.sln @@ -31,6 +31,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DomainServices.Compone EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.WebApi", "WebApi\Eisk.WebApi\Eisk.WebApi.csproj", "{B99A94EA-9D76-4C67-88E2-A1814930E8B5}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.Domains.TestData", "DomainCore\Eisk.Domains.TestData\Eisk.Domains.TestData.csproj", "{E2893FF6-17A0-4C27-9109-12705F62815E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -73,6 +75,10 @@ Global {B99A94EA-9D76-4C67-88E2-A1814930E8B5}.Debug|Any CPU.Build.0 = Debug|Any CPU {B99A94EA-9D76-4C67-88E2-A1814930E8B5}.Release|Any CPU.ActiveCfg = Release|Any CPU {B99A94EA-9D76-4C67-88E2-A1814930E8B5}.Release|Any CPU.Build.0 = Release|Any CPU + {E2893FF6-17A0-4C27-9109-12705F62815E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E2893FF6-17A0-4C27-9109-12705F62815E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E2893FF6-17A0-4C27-9109-12705F62815E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E2893FF6-17A0-4C27-9109-12705F62815E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -88,6 +94,7 @@ Global {5C60F4F8-B7A7-4B14-B476-79E138BAF1F9} = {8D09A735-BB55-4075-9B06-EAAA18F59781} {CB7B38B4-9AE5-4B86-BC31-CD74F8690D79} = {8D09A735-BB55-4075-9B06-EAAA18F59781} {B99A94EA-9D76-4C67-88E2-A1814930E8B5} = {9611B3D6-810A-4E98-9166-2DA770E38B81} + {E2893FF6-17A0-4C27-9109-12705F62815E} = {07B09CE7-77B7-4F0F-9BF1-1CA13B8501D8} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4370F72B-9D16-4EBF-8EF5-1F0925FC7CC6} diff --git a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.InMemory/Eisk.DataServices.EFCore.IntegrationTests.Ext.csproj b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.InMemory/Eisk.DataServices.IntegrationTests.EFCore.InMemory.csproj similarity index 100% rename from Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.InMemory/Eisk.DataServices.EFCore.IntegrationTests.Ext.csproj rename to Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.InMemory/Eisk.DataServices.IntegrationTests.EFCore.InMemory.csproj diff --git a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.InMemory/EmployeeDataServiceTestsWithInMemoryDb.cs b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.InMemory/EmployeeDataServiceTestsWithInMemoryDb.cs index ea698367..7bca927a 100644 --- a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.InMemory/EmployeeDataServiceTestsWithInMemoryDb.cs +++ b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.InMemory/EmployeeDataServiceTestsWithInMemoryDb.cs @@ -1,9 +1,9 @@ -namespace Eisk.DataServices.EFCore.IntegrationTests +namespace Eisk.DataServices.IntegrationTests.EFCore.InMemory { using Domains.Entities; using Test.Core.TestBases; using Eisk.EFCore.Setup; - using System.Threading.Tasks; + using Eisk.DataServices.EFCore; public class EmployeeDataServiceTestsWithInMemoryDb : DataServiceBaseIntegrationTests { @@ -12,12 +12,5 @@ public EmployeeDataServiceTestsWithInMemoryDb() : base(new EmployeeDataService(T } - public override async Task Add_ValidDomainWithRandomIdPassed_ShouldThrowException() - { - await Task.Run(() => { - //no op method for in-memory - }); - } - } } diff --git a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/DatabaseFixture.cs b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/DatabaseFixture.cs index 6ce6e977..2bd660af 100644 --- a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/DatabaseFixture.cs +++ b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/DatabaseFixture.cs @@ -1,7 +1,7 @@ using Eisk.EFCore.Setup; using System; -namespace Eisk.DataServices.EFCore.IntegrationTests +namespace Eisk.DataServices.IntegrationTests.EFCore.SqlServer { public class DatabaseFixture : IDisposable { diff --git a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/Eisk.DataServices.EFCore.IntegrationTests.csproj b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/Eisk.DataServices.IntegrationTests.EFCore.SqlServer.csproj similarity index 100% rename from Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/Eisk.DataServices.EFCore.IntegrationTests.csproj rename to Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/Eisk.DataServices.IntegrationTests.EFCore.SqlServer.csproj diff --git a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/EmployeeDataServiceTestsWithSqlServer.cs b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/EmployeeDataServiceTestsWithSqlServer.cs index c23d8a19..50c03c97 100644 --- a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/EmployeeDataServiceTestsWithSqlServer.cs +++ b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/EmployeeDataServiceTestsWithSqlServer.cs @@ -1,13 +1,14 @@ using Xunit; -namespace Eisk.DataServices.EFCore.IntegrationTests +namespace Eisk.DataServices.IntegrationTests.EFCore.SqlServer { using Domains.Entities; using Test.Core.TestBases; using Domains.TestData; using Eisk.EFCore.Setup; + using Eisk.DataServices.EFCore; - public class EmployeeDataServiceTestsWithSqlServer: DataServiceBaseIntegrationTests, IClassFixture + public class EmployeeDataServiceTestsWithSqlServer: DataServiceSqlServerBaseIntegrationTests, IClassFixture { public EmployeeDataServiceTestsWithSqlServer(): base(new EmployeeDataService(TestDbContextFactory.CreateSqlServerDbContext()), x => x.Id, new EmployeeDataFactory()) { From b46932ba6cd4de2ddadcf8a22d7763aad3ea6fc2 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Thu, 14 Apr 2022 20:49:02 +0100 Subject: [PATCH 094/204] updated integration tests --- .../EmployeeDomainServiceComponentTests.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/EmployeeDomainServiceComponentTests.cs b/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/EmployeeDomainServiceComponentTests.cs index e41c8fa4..00992ba0 100644 --- a/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/EmployeeDomainServiceComponentTests.cs +++ b/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/EmployeeDomainServiceComponentTests.cs @@ -6,9 +6,9 @@ namespace Eisk.DomainServices.ComponentTests.EFCore { - public class EmployeeDataServiceTestsWithSqlServer : DomainServiceBaseComponentTests + public class EmployeeDomainServiceComponentTests : DomainServiceBaseComponentTests { - public EmployeeDataServiceTestsWithSqlServer() : + public EmployeeDomainServiceComponentTests() : base(new EmployeeDomainService(Factory_DataService()), x => x.Id, new EmployeeDataFactory()) { From 54252e0549b58dd265d29a56753ac8dbe65a8ff8 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Thu, 14 Apr 2022 20:56:39 +0100 Subject: [PATCH 095/204] including data services integration tests. --- Eisk.WebApi.TemplatePack.sln | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Eisk.WebApi.TemplatePack.sln b/Eisk.WebApi.TemplatePack.sln index cfb8cfc9..d9e85de4 100644 --- a/Eisk.WebApi.TemplatePack.sln +++ b/Eisk.WebApi.TemplatePack.sln @@ -65,8 +65,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.Domains.TestData", "Do EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DataServices.IntegrationTests.EFCore.InMemory", "Infrastructure.EFCore\Eisk.DataServices.IntegrationTests.EFCore.InMemory\Eisk.DataServices.IntegrationTests.EFCore.InMemory.csproj", "{6FDA83B9-3E99-47AB-B232-E161C817BD1D}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DataServices.IntegrationTests.EFCore.SqlServer", "Infrastructure.EFCore\Eisk.DataServices.IntegrationTests.EFCore.SqlServer\Eisk.DataServices.IntegrationTests.EFCore.SqlServer.csproj", "{BE2F6BCA-1D2F-45E5-BD93-F23DA0293931}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -133,10 +131,6 @@ Global {6FDA83B9-3E99-47AB-B232-E161C817BD1D}.Debug|Any CPU.Build.0 = Debug|Any CPU {6FDA83B9-3E99-47AB-B232-E161C817BD1D}.Release|Any CPU.ActiveCfg = Release|Any CPU {6FDA83B9-3E99-47AB-B232-E161C817BD1D}.Release|Any CPU.Build.0 = Release|Any CPU - {BE2F6BCA-1D2F-45E5-BD93-F23DA0293931}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BE2F6BCA-1D2F-45E5-BD93-F23DA0293931}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BE2F6BCA-1D2F-45E5-BD93-F23DA0293931}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BE2F6BCA-1D2F-45E5-BD93-F23DA0293931}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -157,7 +151,6 @@ Global {B99A94EA-9D76-4C67-88E2-A1814930E8B5} = {9611B3D6-810A-4E98-9166-2DA770E38B81} {D0227185-3F9D-41B4-9314-C7B3CBC38D6F} = {07B09CE7-77B7-4F0F-9BF1-1CA13B8501D8} {6FDA83B9-3E99-47AB-B232-E161C817BD1D} = {8D09A735-BB55-4075-9B06-EAAA18F59781} - {BE2F6BCA-1D2F-45E5-BD93-F23DA0293931} = {8D09A735-BB55-4075-9B06-EAAA18F59781} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4370F72B-9D16-4EBF-8EF5-1F0925FC7CC6} From 5bad416040c34dfd68ce445259bb01b93e050a7f Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Thu, 14 Apr 2022 21:04:52 +0100 Subject: [PATCH 096/204] including sql server tests --- Eisk.WebApi.TemplatePack.sln | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Eisk.WebApi.TemplatePack.sln b/Eisk.WebApi.TemplatePack.sln index d9e85de4..4ec874c3 100644 --- a/Eisk.WebApi.TemplatePack.sln +++ b/Eisk.WebApi.TemplatePack.sln @@ -65,6 +65,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.Domains.TestData", "Do EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DataServices.IntegrationTests.EFCore.InMemory", "Infrastructure.EFCore\Eisk.DataServices.IntegrationTests.EFCore.InMemory\Eisk.DataServices.IntegrationTests.EFCore.InMemory.csproj", "{6FDA83B9-3E99-47AB-B232-E161C817BD1D}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DataServices.IntegrationTests.EFCore.SqlServer", "Infrastructure.EFCore\Eisk.DataServices.IntegrationTests.EFCore.SqlServer\Eisk.DataServices.IntegrationTests.EFCore.SqlServer.csproj", "{1502582C-70E8-492E-8366-D85699C405E2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -131,6 +133,10 @@ Global {6FDA83B9-3E99-47AB-B232-E161C817BD1D}.Debug|Any CPU.Build.0 = Debug|Any CPU {6FDA83B9-3E99-47AB-B232-E161C817BD1D}.Release|Any CPU.ActiveCfg = Release|Any CPU {6FDA83B9-3E99-47AB-B232-E161C817BD1D}.Release|Any CPU.Build.0 = Release|Any CPU + {1502582C-70E8-492E-8366-D85699C405E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1502582C-70E8-492E-8366-D85699C405E2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1502582C-70E8-492E-8366-D85699C405E2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1502582C-70E8-492E-8366-D85699C405E2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -151,6 +157,7 @@ Global {B99A94EA-9D76-4C67-88E2-A1814930E8B5} = {9611B3D6-810A-4E98-9166-2DA770E38B81} {D0227185-3F9D-41B4-9314-C7B3CBC38D6F} = {07B09CE7-77B7-4F0F-9BF1-1CA13B8501D8} {6FDA83B9-3E99-47AB-B232-E161C817BD1D} = {8D09A735-BB55-4075-9B06-EAAA18F59781} + {1502582C-70E8-492E-8366-D85699C405E2} = {8D09A735-BB55-4075-9B06-EAAA18F59781} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {4370F72B-9D16-4EBF-8EF5-1F0925FC7CC6} From 76df451d21676ac9de8b496a083f98fe5274e5c5 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 15 Apr 2022 02:12:31 +0100 Subject: [PATCH 097/204] added title and extention in entity data generator --- DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs | 5 +++-- DomainCore/Eisk.Domains/Entities/Employee.cs | 2 +- Notes/TODO.txt | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs b/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs index c8aef430..4140b035 100644 --- a/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs +++ b/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs @@ -22,6 +22,7 @@ public override Employee Factory_Entity(Action? action = null) return employee; } + string[] _jobTitles = new string[] { "Vice President", "Director", "Manager", "Executive", "Sales Executive", "Management Trainee" }; void AssignEmployee(Employee employee) { var faker = new Faker(); @@ -47,9 +48,9 @@ void AssignEmployee(Employee employee) }; employee.HireDate = faker.Date.Future(); - employee.Title = null; + employee.Title = faker.PickRandomParam(_jobTitles); employee.Phone = faker.Person.Phone; - //employee.Extension = null; + employee.Extension = faker.Person.Random.Number(0,999).ToString("000"); employee.Photo = null; diff --git a/DomainCore/Eisk.Domains/Entities/Employee.cs b/DomainCore/Eisk.Domains/Entities/Employee.cs index bf0d7f7c..75b475d1 100644 --- a/DomainCore/Eisk.Domains/Entities/Employee.cs +++ b/DomainCore/Eisk.Domains/Entities/Employee.cs @@ -10,7 +10,7 @@ namespace Eisk.Domains.Entities [Table("Employees")] public class Employee : Person { - [StringLength(5)] + [StringLength(20)] public string Title { get; set; } [Display(Name = "Hire Date")] diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 00daa965..93546701 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -1,7 +1,6 @@ ======================================================== TODO: Today - * Re-visit exception classes * Apply custom business logic @@ -15,6 +14,7 @@ TODO: Today * check conditional rendering (file) * check conditional rendering (text) +DONE * Apply title, extension in entity data generator DONE * Investigate with length field is not causing issue when saving (for in-memory db constraints not applied) DONE * Test data service with sql server local instance DONE * Remove sub-module From 06cd221e87a69c4bb920be137b6a1b78cbc6b3af Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 15 Apr 2022 15:28:55 +0100 Subject: [PATCH 098/204] Update Notes.txt --- Notes/Notes.txt | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Notes/Notes.txt b/Notes/Notes.txt index 1505092f..d8df8937 100644 --- a/Notes/Notes.txt +++ b/Notes/Notes.txt @@ -1,6 +1,18 @@ ======================================================== +Reasons to consider testing base integration tests +Sql Server (in-memory) +- To verify if the ORM data model is not breaking (unsupported binding) +- To verify if the ORM is working as expected (may not be needed if ORM documentation is available) +Sql Server (generated from ORM) +- To verify if the ORM data model is not breaking (unsupported binding) +- To verify if the ORM is working as expected (may not be needed if ORM documentation is available) +- To verify if the valid test data working (column size) + +Sql Server (live environment) +- To check if the schema is same (can be achieved via schema comparison tool) +- To check if the functionality is working as expected even if schema is not identical ======================================================== - \ No newline at end of file + From 314be3a4fe82f152c915194e1b98e5c99e02b57c Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 15 Apr 2022 15:32:26 +0100 Subject: [PATCH 099/204] Update TODO.txt --- Notes/TODO.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 93546701..d70b497d 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -40,9 +40,11 @@ Code * add log functionality Testing -* Include custom entity data factory in entity test base +DONE * Include custom entity data factory in entity test base * test post and update methods * identify test strategy, check base tests usability +* In-memory web tests +* Perform post deployment health check Release Tasks * Merge V9.0 branch to master @@ -120,4 +122,4 @@ DONE * Update readme.md Others DONE * Finalize versioning -======================================================== \ No newline at end of file +======================================================== From b3eada8b87df604b61b450177fb8ca76790b7f56 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 15 Apr 2022 15:33:42 +0100 Subject: [PATCH 100/204] Update Notes.txt --- Notes/Notes.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Notes/Notes.txt b/Notes/Notes.txt index d8df8937..25b578c7 100644 --- a/Notes/Notes.txt +++ b/Notes/Notes.txt @@ -12,7 +12,7 @@ Sql Server (generated from ORM) Sql Server (live environment) - To check if the schema is same (can be achieved via schema comparison tool) -- To check if the functionality is working as expected even if schema is not identical +- To check if the functionality is working as expected even if schema and database version is not identical ======================================================== From 4a2156aaec6ee5536ba52b231541afcd99efc651 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 15 Apr 2022 15:35:05 +0100 Subject: [PATCH 101/204] Update Notes.txt --- Notes/Notes.txt | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/Notes/Notes.txt b/Notes/Notes.txt index 25b578c7..8b137891 100644 --- a/Notes/Notes.txt +++ b/Notes/Notes.txt @@ -1,18 +1 @@ -======================================================== -Reasons to consider testing base integration tests -Sql Server (in-memory) -- To verify if the ORM data model is not breaking (unsupported binding) -- To verify if the ORM is working as expected (may not be needed if ORM documentation is available) - -Sql Server (generated from ORM) -- To verify if the ORM data model is not breaking (unsupported binding) -- To verify if the ORM is working as expected (may not be needed if ORM documentation is available) -- To verify if the valid test data working (column size) - -Sql Server (live environment) -- To check if the schema is same (can be achieved via schema comparison tool) -- To check if the functionality is working as expected even if schema and database version is not identical - -======================================================== - From 11181cde94320915ecaa562cdb60c4bda152e5b1 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 15 Apr 2022 15:36:17 +0100 Subject: [PATCH 102/204] Update Test-Strategy.txt --- Notes/Test-Strategy.txt | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Notes/Test-Strategy.txt b/Notes/Test-Strategy.txt index fd7142eb..edf14df5 100644 --- a/Notes/Test-Strategy.txt +++ b/Notes/Test-Strategy.txt @@ -23,6 +23,24 @@ System Tests: ** Includes db configuration tests ** Any other external dependencies, like email server, blob storage ** Can inlcude asp.net core feature, azure feature + +======================================================== +Reasons to consider testing base integration tests + +Sql Server (in-memory) +- To verify if the ORM data model is not breaking (unsupported binding) +- To verify if the ORM is working as expected (may not be needed if ORM documentation is available) + +Sql Server (generated from ORM) +- To verify if the ORM data model is not breaking (unsupported binding) +- To verify if the ORM is working as expected (may not be needed if ORM documentation is available) +- To verify if the valid test data working (column size) + +Sql Server (live environment) +- To check if the schema is same (can be achieved via schema comparison tool) +- To check if the functionality is working as expected even if schema and database version is not identical + +======================================================== ======================================================== Factors @@ -32,4 +50,4 @@ Factors * Web UI Tests (in CD) * Generic utility base classes ======================================================== - \ No newline at end of file + From e9aa7576c43a78db642a0fbcad6c4134887607eb Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 15 Apr 2022 17:21:17 +0100 Subject: [PATCH 103/204] Update Test-Strategy.txt --- Notes/Test-Strategy.txt | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/Notes/Test-Strategy.txt b/Notes/Test-Strategy.txt index edf14df5..a34269ca 100644 --- a/Notes/Test-Strategy.txt +++ b/Notes/Test-Strategy.txt @@ -23,7 +23,6 @@ System Tests: ** Includes db configuration tests ** Any other external dependencies, like email server, blob storage ** Can inlcude asp.net core feature, azure feature - ======================================================== Reasons to consider testing base integration tests @@ -42,6 +41,24 @@ Sql Server (live environment) ======================================================== ======================================================== +Testing ORM functionality in test core + +- Single entity crud + +- p: Create/Create: primary and foreign tables together +- p: Update/Create: exiting primary, create new fk row +- p: Update/Remove: existing primary, remove existing fk row +- p: Update/Update: updating pk and fk rows +- p: Remove/Remove: deleting pk willl remove all fk +- p: Remove/Update: deleting pk will update reference in fk only (no other update in fk table) +- p: Read/Read (eager): loading pk will load all fk +- p: Read/Read (lazy): loading pk will not not fk until property called + +- the above behaviour is when saving pk and its impact on fk +- need to check the impact for the same behaviours on pk when fk is being saved + +- Difference between fk property and fk object +=====≈======== Factors * In-memory database tests (in CI) From b3a97b176afac8c7a8fef9ac6c973090e9082731 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 19 Apr 2022 16:13:11 +0100 Subject: [PATCH 104/204] updated to do --- Notes/TODO.txt | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 93546701..676d7040 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -14,12 +14,6 @@ TODO: Today * check conditional rendering (file) * check conditional rendering (text) -DONE * Apply title, extension in entity data generator -DONE * Investigate with length field is not causing issue when saving (for in-memory db constraints not applied) -DONE * Test data service with sql server local instance -DONE * Remove sub-module -DONE * Complete custom data generator implementation -DONE * Test string size implementor N/A * Apply rules logic in custom data generator ======================================================== @@ -29,28 +23,33 @@ Fix CI (Remote) R * Rename eisk.webapi.template to eisk.template Fix CD (Remote) -* Create staging api app service for V8 -* Update CI for Windows-2019 (V8) * Publish git repo to integrate with with git release task +* Publish to VS Gallery +* Create staging api app service for V8 Build / packagaing Code -* added exception handler for controller -* add log functionality +* Added exception handler for controller +* Add log functionality +* Integrate azure insight Testing -* Include custom entity data factory in entity test base -* test post and update methods -* identify test strategy, check base tests usability +* Sql server integration tests: load from config +* Create postman based test file (for template only) +* Test post and update methods +* Include ORM tests +* Identify test strategy, check base tests usability Release Tasks * Merge V9.0 branch to master * Publish nuget package to nuget gallery +* Publish documentation (soft release) +* Publish to VS Gallery Others -* explore new .net features -* include instruction for template build and publish +* Explore new .net features +* Include instruction for template build and publish * Rename Eisk.DomainServices.ComponentTests.EFCore -> Eisk.DomainServices.ComponentTests? ======================================================== @@ -68,7 +67,7 @@ DONE * Restructure (docs) - build locally, folder structure, navigations (indivi * Blog - tutorial * VSIX Release - CD, documentation * Github Release - CD, documentation -* Doc - advansed documentation documenation +* Doc - advansed documentation ======================================================== TODO: ARCHIVE @@ -105,6 +104,9 @@ DONE * Fix local run (web api) v8 DONE * Fix local run (web api) v9 Code +DONE * Remove sub-module +DONE * Apply title, extension in entity data generator +DONE * Investigate with length field is not causing issue when saving (for in-memory db constraints not applied) DONE * Remove obsolete methods (for .NET 6.0) DONE * fix unit tests DONE * Fix project load issue for rendered content. issue: long file path @@ -112,6 +114,10 @@ DONE * Exclude unused project files (test projects) DONE * Exclude unused project files (notes) Testing +DONE * Test data service with sql server local instance +DONE * Complete custom data generator implementation +DONE * Test string size implementor +DONE * Include custom entity data factory in entity test base DONE * Add test data generator for employee (with meaningful sample data) Release Tasks From 49bf8ff85d10c8980ece6daeed3a06ccaf497472 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 19 Apr 2022 16:25:59 +0100 Subject: [PATCH 105/204] improved test data factory to support custom data implementation on top of automatic data generator. --- .../DataGen/EntityCustomDataFactory.cs | 22 +++++++++++++++++++ .../EmployeeDataFactory.cs | 18 ++------------- 2 files changed, 24 insertions(+), 16 deletions(-) create mode 100644 Core/Eisk.Test.Core/DataGen/EntityCustomDataFactory.cs diff --git a/Core/Eisk.Test.Core/DataGen/EntityCustomDataFactory.cs b/Core/Eisk.Test.Core/DataGen/EntityCustomDataFactory.cs new file mode 100644 index 00000000..44be70b5 --- /dev/null +++ b/Core/Eisk.Test.Core/DataGen/EntityCustomDataFactory.cs @@ -0,0 +1,22 @@ +using System; + +namespace Eisk.Test.Core.DataGen +{ + public abstract class EntityCustomDataFactory :EntityDataFactory + { + public override TEntity Factory_Entity(Action? action = null) + { + var employee = base.Factory_Entity(e => + { + AssignEntity(e); + + //supporting custom overrides from user + action?.Invoke(e); + }); + + return employee; + } + + protected abstract void AssignEntity(TEntity e); + } +} diff --git a/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs b/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs index 4140b035..ffabc4ff 100644 --- a/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs +++ b/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs @@ -4,26 +4,12 @@ namespace Eisk.Domains.TestData { using Entities; using Enums; - using System; using Test.Core.DataGen; - public class EmployeeDataFactory:EntityDataFactory + public class EmployeeDataFactory:EntityCustomDataFactory { - public override Employee Factory_Entity(Action? action = null) - { - var employee = base.Factory_Entity( e => - { - AssignEmployee(e); - - //supporting custom overrides from user - action?.Invoke(e); - }); - - return employee; - } - string[] _jobTitles = new string[] { "Vice President", "Director", "Manager", "Executive", "Sales Executive", "Management Trainee" }; - void AssignEmployee(Employee employee) + protected override void AssignEntity(Employee employee) { var faker = new Faker(); From cf8f03328810178fda597148b2b5c43ef9c4b64f Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 19 Apr 2022 16:29:23 +0100 Subject: [PATCH 106/204] refactoring --- Core/Eisk.Test.Core/DataGen/EntityCustomDataFactory.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/Eisk.Test.Core/DataGen/EntityCustomDataFactory.cs b/Core/Eisk.Test.Core/DataGen/EntityCustomDataFactory.cs index 44be70b5..ac88207a 100644 --- a/Core/Eisk.Test.Core/DataGen/EntityCustomDataFactory.cs +++ b/Core/Eisk.Test.Core/DataGen/EntityCustomDataFactory.cs @@ -6,7 +6,7 @@ public abstract class EntityCustomDataFactory :EntityDataFactory? action = null) { - var employee = base.Factory_Entity(e => + var entity = base.Factory_Entity(e => { AssignEntity(e); @@ -14,7 +14,7 @@ public override TEntity Factory_Entity(Action? action = null) action?.Invoke(e); }); - return employee; + return entity; } protected abstract void AssignEntity(TEntity e); From c33c6b91be0fa7989db03759916afe55bd148845 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 19 Apr 2022 16:40:54 +0100 Subject: [PATCH 107/204] update --- Notes/TODO.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 3638c489..4dad538c 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -114,6 +114,7 @@ DONE * Exclude unused project files (test projects) DONE * Exclude unused project files (notes) Testing +DONE * Refactor entity test data generator as an abstract class DONE * Test data service with sql server local instance DONE * Complete custom data generator implementation DONE * Test string size implementor From 81a0df0682fd75883d95c557042f4c92cda2e0f4 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 19 Apr 2022 17:07:18 +0100 Subject: [PATCH 108/204] entity data factories refactored. --- .../DataFactories/EntityCustomDataFactory.cs | 21 + .../DataFactories/EntityDataFactory.cs | 36 ++ .../DataGen/EntityCustomDataFactory.cs | 22 - .../DataGen/EntityDataFactory.cs | 37 -- .../Eisk.Test.Core/DataGen/InvalidData/Get.cs | 29 +- .../InvalidData/InvalidAlphanumeric.cs | 15 +- .../DataGen/InvalidData/InvalidEmail.cs | 15 +- .../DataGen/InvalidData/InvalidUri.cs | 15 +- .../StringWithSpecialCharacters.cs | 15 +- .../DataGen/StringAttributeAggregatedRelay.cs | 67 ++- .../DataServiceBaseIntegrationTests.cs | 406 +++++++++--------- ...ataServiceSqlServerBaseIntegrationTests.cs | 41 +- .../DomainServiceBaseComponentTests.cs | 229 +++++----- .../TestBases/EntityTestBase.cs | 85 ++-- Core/Eisk.Test.Core/TestBases/IServiceTest.cs | 9 +- Core/Eisk.Test.Core/TestBases/TestBase.cs | 34 +- .../EmployeeDataFactory.cs | 77 ++-- 17 files changed, 568 insertions(+), 585 deletions(-) create mode 100644 Core/Eisk.Test.Core/DataGen/DataFactories/EntityCustomDataFactory.cs create mode 100644 Core/Eisk.Test.Core/DataGen/DataFactories/EntityDataFactory.cs delete mode 100644 Core/Eisk.Test.Core/DataGen/EntityCustomDataFactory.cs delete mode 100644 Core/Eisk.Test.Core/DataGen/EntityDataFactory.cs diff --git a/Core/Eisk.Test.Core/DataGen/DataFactories/EntityCustomDataFactory.cs b/Core/Eisk.Test.Core/DataGen/DataFactories/EntityCustomDataFactory.cs new file mode 100644 index 00000000..0f10d475 --- /dev/null +++ b/Core/Eisk.Test.Core/DataGen/DataFactories/EntityCustomDataFactory.cs @@ -0,0 +1,21 @@ +using System; + +namespace Eisk.Test.Core.DataGen.DataFactories; + +public abstract class EntityDomainDataFactory : EntityDataFactory +{ + public override TEntity Factory_Entity(Action action = null) + { + var entity = base.Factory_Entity(e => + { + AssignDomainData(e); + + //supporting custom overrides from user + action?.Invoke(e); + }); + + return entity; + } + + protected abstract void AssignDomainData(TEntity e); +} diff --git a/Core/Eisk.Test.Core/DataGen/DataFactories/EntityDataFactory.cs b/Core/Eisk.Test.Core/DataGen/DataFactories/EntityDataFactory.cs new file mode 100644 index 00000000..35cbec2f --- /dev/null +++ b/Core/Eisk.Test.Core/DataGen/DataFactories/EntityDataFactory.cs @@ -0,0 +1,36 @@ +using System; +using AutoFixture; +using AutoFixture.DataAnnotations; + +namespace Eisk.Test.Core.DataGen.DataFactories; + +public class EntityDataFactory +{ + public virtual TEntity Factory_Entity(Action action = null) + { + var fixture = Factory_Fixture(); + + var obj = fixture.Create(); + + action?.Invoke(obj); + + return obj; + } + + private Fixture Factory_Fixture() + { + Fixture fixture = new Fixture(); + + fixture.Behaviors.Remove(new ThrowingRecursionBehavior()); + + fixture.Behaviors.Add(new OmitOnRecursionBehavior()); + + fixture.Customize(new NoDataAnnotationsCustomization()); + + fixture.Customizations.Add(new RangeAttributeRelay()); + + fixture.Customizations.Add(new StringAttributeAggregatedRelay()); + + return fixture; + } +} diff --git a/Core/Eisk.Test.Core/DataGen/EntityCustomDataFactory.cs b/Core/Eisk.Test.Core/DataGen/EntityCustomDataFactory.cs deleted file mode 100644 index ac88207a..00000000 --- a/Core/Eisk.Test.Core/DataGen/EntityCustomDataFactory.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; - -namespace Eisk.Test.Core.DataGen -{ - public abstract class EntityCustomDataFactory :EntityDataFactory - { - public override TEntity Factory_Entity(Action? action = null) - { - var entity = base.Factory_Entity(e => - { - AssignEntity(e); - - //supporting custom overrides from user - action?.Invoke(e); - }); - - return entity; - } - - protected abstract void AssignEntity(TEntity e); - } -} diff --git a/Core/Eisk.Test.Core/DataGen/EntityDataFactory.cs b/Core/Eisk.Test.Core/DataGen/EntityDataFactory.cs deleted file mode 100644 index ffbaa369..00000000 --- a/Core/Eisk.Test.Core/DataGen/EntityDataFactory.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using AutoFixture; -using AutoFixture.DataAnnotations; - -namespace Eisk.Test.Core.DataGen -{ - public class EntityDataFactory - { - public virtual TEntity Factory_Entity(Action action = null) - { - var fixture = Factory_Fixture(); - - var obj = fixture.Create(); - - action?.Invoke(obj); - - return obj; - } - - private Fixture Factory_Fixture() - { - Fixture fixture = new Fixture(); - - fixture.Behaviors.Remove(new ThrowingRecursionBehavior()); - - fixture.Behaviors.Add(new OmitOnRecursionBehavior()); - - fixture.Customize(new NoDataAnnotationsCustomization()); - - fixture.Customizations.Add(new RangeAttributeRelay()); - - fixture.Customizations.Add(new StringAttributeAggregatedRelay()); - - return fixture; - } - } -} diff --git a/Core/Eisk.Test.Core/DataGen/InvalidData/Get.cs b/Core/Eisk.Test.Core/DataGen/InvalidData/Get.cs index dd5fa0cd..ae4d515d 100644 --- a/Core/Eisk.Test.Core/DataGen/InvalidData/Get.cs +++ b/Core/Eisk.Test.Core/DataGen/InvalidData/Get.cs @@ -1,24 +1,23 @@ -namespace Eisk.Test.Core.DataGen.InvalidData +namespace Eisk.Test.Core.DataGen.InvalidData; + +public class Get { - public class Get - { - private readonly bool _generateUniqueValue; + private readonly bool _generateUniqueValue; - public Get(bool generateUniqueValue) - { - _generateUniqueValue = generateUniqueValue; - } + public Get(bool generateUniqueValue) + { + _generateUniqueValue = generateUniqueValue; + } - public static Get Unique => new Get(true); + public static Get Unique => new Get(true); - public static Get Plain => new Get(false); + public static Get Plain => new Get(false); - public string InvalidEmail => new InvalidEmail(_generateUniqueValue).ToString(); + public string InvalidEmail => new InvalidEmail(_generateUniqueValue).ToString(); - public string InvalidUri => new InvalidUri(_generateUniqueValue).ToString(); + public string InvalidUri => new InvalidUri(_generateUniqueValue).ToString(); - public string InvalidAlphanumeric => new InvalidAlphanumeric(_generateUniqueValue).ToString(); + public string InvalidAlphanumeric => new InvalidAlphanumeric(_generateUniqueValue).ToString(); - public string StringWithSpecialCharacters => new StringWithSpecialCharacters(_generateUniqueValue).ToString(); - } + public string StringWithSpecialCharacters => new StringWithSpecialCharacters(_generateUniqueValue).ToString(); } diff --git a/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidAlphanumeric.cs b/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidAlphanumeric.cs index 0aa75912..53902b4c 100644 --- a/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidAlphanumeric.cs +++ b/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidAlphanumeric.cs @@ -1,12 +1,11 @@ -namespace Eisk.Test.Core.DataGen.InvalidData -{ - using FieldGenerators; +namespace Eisk.Test.Core.DataGen.InvalidData; + +using FieldGenerators; - public class InvalidAlphanumeric : StringValueGenerator +public class InvalidAlphanumeric : StringValueGenerator +{ + public InvalidAlphanumeric(bool generateUniqueValue = true, string value = "invalid_alphanumeric") : base(generateUniqueValue, value) { - public InvalidAlphanumeric(bool generateUniqueValue = true, string value = "invalid_alphanumeric") : base(generateUniqueValue, value) - { - } } -} \ No newline at end of file +} diff --git a/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidEmail.cs b/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidEmail.cs index 71f75b98..f53ea96e 100644 --- a/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidEmail.cs +++ b/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidEmail.cs @@ -1,12 +1,11 @@ -namespace Eisk.Test.Core.DataGen.InvalidData -{ - using FieldGenerators; +namespace Eisk.Test.Core.DataGen.InvalidData; + +using FieldGenerators; - public class InvalidEmail : StringValueGenerator +public class InvalidEmail : StringValueGenerator +{ + public InvalidEmail(bool generateUniqueValue = true, string value = "invalid_email") : base(generateUniqueValue, value) { - public InvalidEmail(bool generateUniqueValue = true, string value = "invalid_email") : base(generateUniqueValue, value) - { - } } -} \ No newline at end of file +} diff --git a/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidUri.cs b/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidUri.cs index 332f9ab0..b76deb26 100644 --- a/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidUri.cs +++ b/Core/Eisk.Test.Core/DataGen/InvalidData/InvalidUri.cs @@ -1,12 +1,11 @@ -namespace Eisk.Test.Core.DataGen.InvalidData -{ - using FieldGenerators; +namespace Eisk.Test.Core.DataGen.InvalidData; + +using FieldGenerators; - public class InvalidUri : StringValueGenerator +public class InvalidUri : StringValueGenerator +{ + public InvalidUri(bool generateUniqueValue = true, string value = "invalid_uri") : base(generateUniqueValue, value) { - public InvalidUri(bool generateUniqueValue = true, string value = "invalid_uri") : base(generateUniqueValue, value) - { - } } -} \ No newline at end of file +} diff --git a/Core/Eisk.Test.Core/DataGen/InvalidData/StringWithSpecialCharacters.cs b/Core/Eisk.Test.Core/DataGen/InvalidData/StringWithSpecialCharacters.cs index b5f24255..629d92c1 100644 --- a/Core/Eisk.Test.Core/DataGen/InvalidData/StringWithSpecialCharacters.cs +++ b/Core/Eisk.Test.Core/DataGen/InvalidData/StringWithSpecialCharacters.cs @@ -1,9 +1,8 @@ -namespace Eisk.Test.Core.DataGen.InvalidData -{ - using FieldGenerators; +namespace Eisk.Test.Core.DataGen.InvalidData; + +using FieldGenerators; - public class StringWithSpecialCharacters:StringValueGenerator - { - public StringWithSpecialCharacters(bool generateUniqueValie = true, string value = "@@@@###%%%_string_with_special_characters") : base(generateUniqueValie, value) { } - } -} \ No newline at end of file +public class StringWithSpecialCharacters:StringValueGenerator +{ + public StringWithSpecialCharacters(bool generateUniqueValie = true, string value = "@@@@###%%%_string_with_special_characters") : base(generateUniqueValie, value) { } +} diff --git a/Core/Eisk.Test.Core/DataGen/StringAttributeAggregatedRelay.cs b/Core/Eisk.Test.Core/DataGen/StringAttributeAggregatedRelay.cs index 45dfbd03..92b328e6 100644 --- a/Core/Eisk.Test.Core/DataGen/StringAttributeAggregatedRelay.cs +++ b/Core/Eisk.Test.Core/DataGen/StringAttributeAggregatedRelay.cs @@ -6,55 +6,54 @@ using Eisk.Core.Utils; using Eisk.Test.Core.DataGen.FieldGenerators; -namespace Eisk.Test.Core.DataGen +namespace Eisk.Test.Core.DataGen; + +public class StringAttributeAggregatedRelay : ISpecimenBuilder { - public class StringAttributeAggregatedRelay : ISpecimenBuilder + public object Create(object request, ISpecimenContext context) { - public object Create(object request, ISpecimenContext context) - { #pragma warning disable 618 - object result = new NoSpecimen(); + object result = new NoSpecimen(); #pragma warning restore 618 - var pi = request as PropertyInfo; + var pi = request as PropertyInfo; - if (pi != null) + if (pi != null) + { + if (pi.PropertyType == typeof(string)) { - if (pi.PropertyType == typeof(string)) + if (Attribute.IsDefined(pi, typeof(StringLengthAttribute))) { - if (Attribute.IsDefined(pi, typeof(StringLengthAttribute))) - { - var stringLengthAttribute = ((ICustomAttributeProvider)request). - GetCustomAttributes(typeof(StringLengthAttribute), true) - .Cast().Single(); - - return Attribute.IsDefined(pi, typeof(UrlAttribute)) || Attribute.IsDefined(pi, typeof(UriAttribute)) - ? GetGeneratedUri(context, stringLengthAttribute.MinimumLength, - stringLengthAttribute.MaximumLength) - : context.Resolve(new ConstrainedStringRequest( - stringLengthAttribute.MinimumLength, - stringLengthAttribute.MaximumLength)); - } - - if (Attribute.IsDefined(pi, typeof(UrlAttribute))) - { - return GetGeneratedUri(context); - } + var stringLengthAttribute = ((ICustomAttributeProvider)request). + GetCustomAttributes(typeof(StringLengthAttribute), true) + .Cast().Single(); + + return Attribute.IsDefined(pi, typeof(UrlAttribute)) || Attribute.IsDefined(pi, typeof(UriAttribute)) + ? GetGeneratedUri(context, stringLengthAttribute.MinimumLength, + stringLengthAttribute.MaximumLength) + : context.Resolve(new ConstrainedStringRequest( + stringLengthAttribute.MinimumLength, + stringLengthAttribute.MaximumLength)); } - return result; + if (Attribute.IsDefined(pi, typeof(UrlAttribute))) + { + return GetGeneratedUri(context); + } } return result; } - private string GetGeneratedUri(ISpecimenContext context, int minLength = 1, int maxLength = int.MaxValue) - { - var generatedUri = new DomainUriGenerator(minLength, maxLength) - .Create(typeof(Uri), context); - return generatedUri.ToString(); - } + return result; + } + private string GetGeneratedUri(ISpecimenContext context, int minLength = 1, int maxLength = int.MaxValue) + { + var generatedUri = new DomainUriGenerator(minLength, maxLength) + .Create(typeof(Uri), context); + return generatedUri.ToString(); } -} \ No newline at end of file + +} diff --git a/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs b/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs index 59b5d760..1aebf5bb 100644 --- a/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs +++ b/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs @@ -1,214 +1,212 @@ using Eisk.Core.DataService; -using Eisk.Test.Core.DataGen; -using Microsoft.EntityFrameworkCore; +using Eisk.Test.Core.DataGen.DataFactories; using System; using System.Linq.Expressions; using System.Threading.Tasks; using Xunit; -namespace Eisk.Test.Core.TestBases +namespace Eisk.Test.Core.TestBases; + +public abstract class DataServiceBaseIntegrationTests : EntityTestBase, + IServiceTest> + where TEntity : class, new() { - public abstract class DataServiceBaseIntegrationTests : EntityTestBase, - IServiceTest> - where TEntity : class, new() + private readonly IEntityDataService _dataService; + + protected DataServiceBaseIntegrationTests(IEntityDataService dataService, Expression> idExpression, EntityDataFactory entityDataFactory = null) + :base(idExpression, entityDataFactory) + { + _dataService = dataService; + } + + + public virtual IEntityDataService GetServiceInstance(Action action = null) + { + action?.Invoke(); + + return _dataService; + } + + protected virtual async Task CreateTestEntityToStore(TEntity testEntity) + { + await _dataService.Add(testEntity); + } + + [Fact] + public virtual async Task Add_ValidDomainPassed_ShouldReturnDomainAfterCreation() + { + //Arrange + var inputEntity = Factory_Entity(); + var dataService = GetServiceInstance(); + + //Act + var returnedEntity = await dataService.Add(inputEntity); + + //Assert + Assert.NotNull(returnedEntity); + Assert.NotEqual(default(TId), GetIdValueFromEntity(returnedEntity)); + } + + [Fact] + public virtual async Task Add_NullDomainPassed_ShouldThrowArgumentNullException() + { + //Arrange + var dataService = GetServiceInstance(); + TEntity invalidNullDomain = null; + + //Act and Assert + await Assert.ThrowsAsync(() => dataService.Add(invalidNullDomain)); + + } + + [Fact] + public virtual async Task GetById_ValidIdPassed_ShouldReturnResult() + { + //Arrange + var domain = Factory_Entity(); + var dataService = GetServiceInstance(); + await CreateTestEntityToStore(domain); + + var idValue = GetIdValueFromEntity(domain); + + //Act + var returnedEntity = await dataService.GetById(idValue); + + //Assert + Assert.NotNull(returnedEntity); + Assert.Equal(idValue, GetIdValueFromEntity(returnedEntity)); + } + + [Fact] + public virtual async Task GetById_EmptyIdPassed_ShouldReturnNull() + { + //Arrange + var dataService = GetServiceInstance(); + + //Act + var returnedEntity = await dataService.GetById(default(TId)); + + //Assert + Assert.Null(returnedEntity); + + } + + [Fact] + public virtual async Task GetById_InvalidIdPassed_ShouldReturnNull() + { + //Arrange + var dataService = GetServiceInstance(); + + //Act + var returnedEntity = await dataService.GetById(RANDOM_ID);//TODO: make it generic random + + //Assert + Assert.Null(returnedEntity); + + } + + [Fact] + public virtual async Task Update_ValidDomainPassed_ShouldReturnDomain() + { + //Arrange + var inputEntity = Factory_Entity(); + var dataService = GetServiceInstance(); + await CreateTestEntityToStore(inputEntity); + + //Act + var returnedEntity = await dataService.Update(inputEntity); + + //Assert + Assert.NotNull(returnedEntity); + Assert.Equal(GetIdValueFromEntity(inputEntity), GetIdValueFromEntity(returnedEntity)); + + } + + [Fact] + public virtual async Task Update_ValidDomainWithEmptyIdPassed_ShouldCreateDomain() + { + //Arrange + var inputEntity = Factory_Entity(); + var dataService = GetServiceInstance(); + + //Act + var returnedEntity = await dataService.Update(inputEntity);//may not be supported in all data providers + + //Assert + Assert.NotNull(returnedEntity); + Assert.NotEqual(default(TId), GetIdValueFromEntity(returnedEntity)); + + } + + [Fact] + public virtual async Task Update_ValidDomainWithRandomIdPassed_ShouldThrowException() + { + //Arrange + var entityWithRandomId = Factory_EntityWithRandomId(); + + var dataService = GetServiceInstance(); + + //Act + var ex = await Record.ExceptionAsync(async () => await dataService.Update(entityWithRandomId)); + + //Assert + Assert.NotNull(ex); + } + + [Fact] + public virtual async Task Update_NullDomainPassed_ShouldThrowArgumentNullException() + { + //Arrange + var dataService = GetServiceInstance(); + TEntity invalidNullDomain = null; + + //Act and Assert + await Assert.ThrowsAsync(() => dataService.Update(invalidNullDomain)); + + } + + [Fact] + public virtual async Task Delete_DomainWithValidIdPassed_ShouldDeleteSuccessfully() + { + //Arrange + var inputEntity = Factory_Entity(); + var dataService = GetServiceInstance(); + await CreateTestEntityToStore(inputEntity); + var idValue = GetIdValueFromEntity(inputEntity); + + //Act + await dataService.Delete(inputEntity); + + //Assert + var returnObject = await dataService.GetById(idValue); + Assert.Null(returnObject); + } + + [Fact] + public virtual async Task Delete_DomainWithEmptyIdPassed_ShouldThrowException() + { + //Arrange + var inputEntity = Factory_Entity(); + var dataService = GetServiceInstance(); + + //Act + var returnedException = await Record.ExceptionAsync(() => dataService.Delete(inputEntity)); + + //Assert + Assert.NotNull(returnedException); + } + + [Fact] + public virtual async Task Delete_DomainWithRandomIdPassed_ShouldThrowException() { - private readonly IEntityDataService _dataService; - - protected DataServiceBaseIntegrationTests(IEntityDataService dataService, Expression> idExpression, EntityDataFactory entityDataFactory = null) - :base(idExpression, entityDataFactory) - { - _dataService = dataService; - } - - - public virtual IEntityDataService GetServiceInstance(Action action = null) - { - action?.Invoke(); - - return _dataService; - } - - protected virtual async Task CreateTestEntityToStore(TEntity testEntity) - { - await _dataService.Add(testEntity); - } - - [Fact] - public virtual async Task Add_ValidDomainPassed_ShouldReturnDomainAfterCreation() - { - //Arrange - var inputEntity = Factory_Entity(); - var dataService = GetServiceInstance(); - - //Act - var returnedEntity = await dataService.Add(inputEntity); - - //Assert - Assert.NotNull(returnedEntity); - Assert.NotEqual(default(TId), GetIdValueFromEntity(returnedEntity)); - } - - [Fact] - public virtual async Task Add_NullDomainPassed_ShouldThrowArgumentNullException() - { - //Arrange - var dataService = GetServiceInstance(); - TEntity invalidNullDomain = null; - - //Act and Assert - await Assert.ThrowsAsync(() => dataService.Add(invalidNullDomain)); - - } - - [Fact] - public virtual async Task GetById_ValidIdPassed_ShouldReturnResult() - { - //Arrange - var domain = Factory_Entity(); - var dataService = GetServiceInstance(); - await CreateTestEntityToStore(domain); - - var idValue = GetIdValueFromEntity(domain); - - //Act - var returnedEntity = await dataService.GetById(idValue); - - //Assert - Assert.NotNull(returnedEntity); - Assert.Equal(idValue, GetIdValueFromEntity(returnedEntity)); - } - - [Fact] - public virtual async Task GetById_EmptyIdPassed_ShouldReturnNull() - { - //Arrange - var dataService = GetServiceInstance(); - - //Act - var returnedEntity = await dataService.GetById(default(TId)); - - //Assert - Assert.Null(returnedEntity); - - } - - [Fact] - public virtual async Task GetById_InvalidIdPassed_ShouldReturnNull() - { - //Arrange - var dataService = GetServiceInstance(); - - //Act - var returnedEntity = await dataService.GetById(RANDOM_ID);//TODO: make it generic random - - //Assert - Assert.Null(returnedEntity); - - } - - [Fact] - public virtual async Task Update_ValidDomainPassed_ShouldReturnDomain() - { - //Arrange - var inputEntity = Factory_Entity(); - var dataService = GetServiceInstance(); - await CreateTestEntityToStore(inputEntity); - - //Act - var returnedEntity = await dataService.Update(inputEntity); - - //Assert - Assert.NotNull(returnedEntity); - Assert.Equal(GetIdValueFromEntity(inputEntity), GetIdValueFromEntity(returnedEntity)); - - } - - [Fact] - public virtual async Task Update_ValidDomainWithEmptyIdPassed_ShouldCreateDomain() - { - //Arrange - var inputEntity = Factory_Entity(); - var dataService = GetServiceInstance(); - - //Act - var returnedEntity = await dataService.Update(inputEntity);//may not be supported in all data providers - - //Assert - Assert.NotNull(returnedEntity); - Assert.NotEqual(default(TId), GetIdValueFromEntity(returnedEntity)); - - } - - [Fact] - public virtual async Task Update_ValidDomainWithRandomIdPassed_ShouldThrowException() - { - //Arrange - var entityWithRandomId = Factory_EntityWithRandomId(); - - var dataService = GetServiceInstance(); - - //Act - var ex = await Record.ExceptionAsync(async () => await dataService.Update(entityWithRandomId)); - - //Assert - Assert.NotNull(ex); - } - - [Fact] - public virtual async Task Update_NullDomainPassed_ShouldThrowArgumentNullException() - { - //Arrange - var dataService = GetServiceInstance(); - TEntity invalidNullDomain = null; - - //Act and Assert - await Assert.ThrowsAsync(() => dataService.Update(invalidNullDomain)); - - } - - [Fact] - public virtual async Task Delete_DomainWithValidIdPassed_ShouldDeleteSuccessfully() - { - //Arrange - var inputEntity = Factory_Entity(); - var dataService = GetServiceInstance(); - await CreateTestEntityToStore(inputEntity); - var idValue = GetIdValueFromEntity(inputEntity); - - //Act - await dataService.Delete(inputEntity); - - //Assert - var returnObject = await dataService.GetById(idValue); - Assert.Null(returnObject); - } - - [Fact] - public virtual async Task Delete_DomainWithEmptyIdPassed_ShouldThrowException() - { - //Arrange - var inputEntity = Factory_Entity(); - var dataService = GetServiceInstance(); - - //Act - var returnedException = await Record.ExceptionAsync(() => dataService.Delete(inputEntity)); - - //Assert - Assert.NotNull(returnedException); - } - - [Fact] - public virtual async Task Delete_DomainWithRandomIdPassed_ShouldThrowException() - { - //Arrange - var inputEntity = Factory_EntityWithRandomId(); - var dataService = GetServiceInstance(); - - //Act - var ex = await Record.ExceptionAsync(() => dataService.Delete(inputEntity)); - - //Assert - Assert.NotNull(ex); - } + //Arrange + var inputEntity = Factory_EntityWithRandomId(); + var dataService = GetServiceInstance(); + + //Act + var ex = await Record.ExceptionAsync(() => dataService.Delete(inputEntity)); + + //Assert + Assert.NotNull(ex); } } diff --git a/Core/Eisk.Test.Core/TestBases/DataServiceSqlServerBaseIntegrationTests.cs b/Core/Eisk.Test.Core/TestBases/DataServiceSqlServerBaseIntegrationTests.cs index 3b948900..236ab8be 100644 --- a/Core/Eisk.Test.Core/TestBases/DataServiceSqlServerBaseIntegrationTests.cs +++ b/Core/Eisk.Test.Core/TestBases/DataServiceSqlServerBaseIntegrationTests.cs @@ -1,35 +1,34 @@ using Eisk.Core.DataService; -using Eisk.Test.Core.DataGen; +using Eisk.Test.Core.DataGen.DataFactories; using Microsoft.EntityFrameworkCore; using System; using System.Linq.Expressions; using System.Threading.Tasks; using Xunit; -namespace Eisk.Test.Core.TestBases +namespace Eisk.Test.Core.TestBases; + +public abstract class DataServiceSqlServerBaseIntegrationTests : DataServiceBaseIntegrationTests, + IServiceTest> + where TEntity : class, new() { - public abstract class DataServiceSqlServerBaseIntegrationTests : DataServiceBaseIntegrationTests, - IServiceTest> - where TEntity : class, new() - { - private readonly IEntityDataService _dataService; + private readonly IEntityDataService _dataService; - protected DataServiceSqlServerBaseIntegrationTests(IEntityDataService dataService, Expression> idExpression, EntityDataFactory entityDataFactory = null) - :base(dataService, idExpression, entityDataFactory) - { - _dataService = dataService; - } + protected DataServiceSqlServerBaseIntegrationTests(IEntityDataService dataService, Expression> idExpression, EntityDataFactory entityDataFactory = null) + :base(dataService, idExpression, entityDataFactory) + { + _dataService = dataService; + } - [Fact] - public virtual async Task Add_ValidDomainWithRandomIdPassed_ShouldThrowException() - { - //Arrange - var inputEntityWithRandomId = Factory_EntityWithRandomId(); - var dataService = GetServiceInstance(); + [Fact] + public virtual async Task Add_ValidDomainWithRandomIdPassed_ShouldThrowException() + { + //Arrange + var inputEntityWithRandomId = Factory_EntityWithRandomId(); + var dataService = GetServiceInstance(); - //Assert - await Assert.ThrowsAsync(() => dataService.Add(inputEntityWithRandomId)); - } + //Assert + await Assert.ThrowsAsync(() => dataService.Add(inputEntityWithRandomId)); } } diff --git a/Core/Eisk.Test.Core/TestBases/DomainServiceBaseComponentTests.cs b/Core/Eisk.Test.Core/TestBases/DomainServiceBaseComponentTests.cs index 55f0592c..778ca7fc 100644 --- a/Core/Eisk.Test.Core/TestBases/DomainServiceBaseComponentTests.cs +++ b/Core/Eisk.Test.Core/TestBases/DomainServiceBaseComponentTests.cs @@ -3,150 +3,149 @@ using System.Threading.Tasks; using Eisk.Core.DomainService; using Eisk.Core.Exceptions; -using Eisk.Test.Core.DataGen; +using Eisk.Test.Core.DataGen.DataFactories; using Xunit; -namespace Eisk.Test.Core.TestBases +namespace Eisk.Test.Core.TestBases; + +public abstract class DomainServiceBaseComponentTests : EntityTestBase, + IServiceTest> + where TEntity : class, new() { - public abstract class DomainServiceBaseComponentTests : EntityTestBase, - IServiceTest> - where TEntity : class, new() - { - private readonly DomainService _domainService; + private readonly DomainService _domainService; - protected DomainServiceBaseComponentTests(DomainService domainService, - Expression> idExpression, EntityDataFactory entityDataFactory) :base(idExpression, entityDataFactory) - { - _domainService = domainService; - } + protected DomainServiceBaseComponentTests(DomainService domainService, + Expression> idExpression, EntityDataFactory entityDataFactory) :base(idExpression, entityDataFactory) + { + _domainService = domainService; + } - public virtual DomainService GetServiceInstance(Action action = null) - { - action?.Invoke(); + public virtual DomainService GetServiceInstance(Action action = null) + { + action?.Invoke(); - return _domainService; - } + return _domainService; + } - protected virtual async Task CreateTestEntityToStore(TEntity testEntity) - { - await _domainService.Add(testEntity); - } + protected virtual async Task CreateTestEntityToStore(TEntity testEntity) + { + await _domainService.Add(testEntity); + } - [Fact] - public virtual async Task Add_ValidDomainPassed_ShouldReturnDomainAfterCreation() - { - //Arrange - var inputEntity = Factory_Entity(); - var domainService = GetServiceInstance(); + [Fact] + public virtual async Task Add_ValidDomainPassed_ShouldReturnDomainAfterCreation() + { + //Arrange + var inputEntity = Factory_Entity(); + var domainService = GetServiceInstance(); - //Act - var returnedEntity = await domainService.Add(inputEntity); + //Act + var returnedEntity = await domainService.Add(inputEntity); - //Assert - Assert.NotNull(returnedEntity); - Assert.NotEqual(default(TId), GetIdValueFromEntity(returnedEntity)); - } + //Assert + Assert.NotNull(returnedEntity); + Assert.NotEqual(default(TId), GetIdValueFromEntity(returnedEntity)); + } - [Fact] - public virtual async Task Add_NullDomainPassed_ShouldThrowArgumentNullException() - { - //Arrange - var domainService = GetServiceInstance(); - TEntity invalidNullDomain = null; + [Fact] + public virtual async Task Add_NullDomainPassed_ShouldThrowArgumentNullException() + { + //Arrange + var domainService = GetServiceInstance(); + TEntity invalidNullDomain = null; - //Act and Assert - await Assert.ThrowsAsync>(() => domainService.Add(invalidNullDomain)); + //Act and Assert + await Assert.ThrowsAsync>(() => domainService.Add(invalidNullDomain)); - } + } - [Fact] - public virtual async Task GetById_ValidIdPassed_ShouldReturnResult() + [Fact] + public virtual async Task GetById_ValidIdPassed_ShouldReturnResult() + { + //Arrange + var domain = Factory_Entity(); + var domainService = GetServiceInstance(async () => { - //Arrange - var domain = Factory_Entity(); - var domainService = GetServiceInstance(async () => - { - await CreateTestEntityToStore(domain); - }); + await CreateTestEntityToStore(domain); + }); - var idValue = GetIdValueFromEntity(domain); + var idValue = GetIdValueFromEntity(domain); - //Act - var returnedEntity = await domainService.GetById(idValue); + //Act + var returnedEntity = await domainService.GetById(idValue); - //Assert - Assert.NotNull(returnedEntity); - Assert.Equal(idValue, GetIdValueFromEntity(returnedEntity)); - } + //Assert + Assert.NotNull(returnedEntity); + Assert.Equal(idValue, GetIdValueFromEntity(returnedEntity)); + } - [Fact] - public virtual async Task GetById_EmptyIdPassed_ShouldThrowException() - { - //Arrange - var domainService = GetServiceInstance(); - var emptyIdValue = default(TId); + [Fact] + public virtual async Task GetById_EmptyIdPassed_ShouldThrowException() + { + //Arrange + var domainService = GetServiceInstance(); + var emptyIdValue = default(TId); - //Act + Assert - await Assert.ThrowsAsync>(() => domainService.GetById(emptyIdValue)); + //Act + Assert + await Assert.ThrowsAsync>(() => domainService.GetById(emptyIdValue)); - } + } - [Fact] - public virtual async Task Update_ValidDomainPassed_ShouldReturnDomain() + [Fact] + public virtual async Task Update_ValidDomainPassed_ShouldReturnDomain() + { + //Arrange + var inputEntity = Factory_Entity(); + var domainService = GetServiceInstance(async () => { - //Arrange - var inputEntity = Factory_Entity(); - var domainService = GetServiceInstance(async () => - { - await CreateTestEntityToStore(inputEntity); - }); - var idValue = GetIdValueFromEntity(inputEntity); + await CreateTestEntityToStore(inputEntity); + }); + var idValue = GetIdValueFromEntity(inputEntity); - //Act - var returnedEntity = await domainService.Update(idValue, inputEntity); + //Act + var returnedEntity = await domainService.Update(idValue, inputEntity); - //Assert - Assert.NotNull(returnedEntity); - Assert.Equal(GetIdValueFromEntity(inputEntity), GetIdValueFromEntity(returnedEntity)); + //Assert + Assert.NotNull(returnedEntity); + Assert.Equal(GetIdValueFromEntity(inputEntity), GetIdValueFromEntity(returnedEntity)); - } + } - [Fact] - public virtual async Task Update_EmptyIdPassed_ShouldThrowException() - { - //Arrange - var domainService = GetServiceInstance(); - var emptyIdValue = default(TId); - TEntity dummayObject = Factory_Entity(); + [Fact] + public virtual async Task Update_EmptyIdPassed_ShouldThrowException() + { + //Arrange + var domainService = GetServiceInstance(); + var emptyIdValue = default(TId); + TEntity dummayObject = Factory_Entity(); - //Act + Assert - await Assert.ThrowsAsync>(() => domainService.Update(emptyIdValue, dummayObject)); + //Act + Assert + await Assert.ThrowsAsync>(() => domainService.Update(emptyIdValue, dummayObject)); - } + } - [Fact] - public virtual async Task Delete_DomainWithValidIdPassed_ShouldDeleteSuccessfully() - { - //Arrange - var inputEntity = Factory_Entity(); - var domainService = GetServiceInstance(async () => await CreateTestEntityToStore(inputEntity)); - var idValue = GetIdValueFromEntity(inputEntity); - - //Act + Assert - await domainService.Delete(idValue); - - } - - [Fact] - public virtual async Task Delete_DomainWithEmptyIdPassed_ShouldThrowException() - { - //Arrange - var domainService = GetServiceInstance(); - var emptyIdValue = default(TId); - - //Act + Assert - await Assert.ThrowsAsync>(() => domainService.Delete(emptyIdValue)); - - } + [Fact] + public virtual async Task Delete_DomainWithValidIdPassed_ShouldDeleteSuccessfully() + { + //Arrange + var inputEntity = Factory_Entity(); + var domainService = GetServiceInstance(async () => await CreateTestEntityToStore(inputEntity)); + var idValue = GetIdValueFromEntity(inputEntity); + + //Act + Assert + await domainService.Delete(idValue); + + } + + [Fact] + public virtual async Task Delete_DomainWithEmptyIdPassed_ShouldThrowException() + { + //Arrange + var domainService = GetServiceInstance(); + var emptyIdValue = default(TId); + + //Act + Assert + await Assert.ThrowsAsync>(() => domainService.Delete(emptyIdValue)); + } } diff --git a/Core/Eisk.Test.Core/TestBases/EntityTestBase.cs b/Core/Eisk.Test.Core/TestBases/EntityTestBase.cs index cc9e1544..71df86ab 100644 --- a/Core/Eisk.Test.Core/TestBases/EntityTestBase.cs +++ b/Core/Eisk.Test.Core/TestBases/EntityTestBase.cs @@ -1,63 +1,62 @@ using System; using System.Linq.Expressions; using Eisk.Core.Utils; -using Eisk.Test.Core.DataGen; +using Eisk.Test.Core.DataGen.DataFactories; -namespace Eisk.Test.Core.TestBases +namespace Eisk.Test.Core.TestBases; + +public abstract class EntityTestBase : TestBase + where TEntity : class, new() { - public abstract class EntityTestBase : TestBase - where TEntity : class, new() + protected readonly Expression> DbIdExpression; + + EntityDataFactory _entityDataFactory; + protected EntityDataFactory EntityDataFactory { - protected readonly Expression> DbIdExpression; - - EntityDataFactory _entityDataFactory; - protected EntityDataFactory EntityDataFactory + get { - get - { - if (_entityDataFactory == null) - _entityDataFactory = new EntityDataFactory(); + if (_entityDataFactory == null) + _entityDataFactory = new EntityDataFactory(); - return _entityDataFactory; ; - } + return _entityDataFactory; ; } + } - protected const int RANDOM_ID = 10000; - protected EntityTestBase(Expression> idExpression, EntityDataFactory entityDataFactory = null) - { - DbIdExpression = idExpression; - _entityDataFactory = entityDataFactory; - } + protected const int RANDOM_ID = 10000; + protected EntityTestBase(Expression> idExpression, EntityDataFactory entityDataFactory = null) + { + DbIdExpression = idExpression; + _entityDataFactory = entityDataFactory; + } - protected virtual TEntity Factory_Entity(Action action = null, bool setIdWithDefault = true) - { - var entity = EntityDataFactory.Factory_Entity(action); + protected virtual TEntity Factory_Entity(Action action = null, bool setIdWithDefault = true) + { + var entity = EntityDataFactory.Factory_Entity(action); - if (setIdWithDefault) - SetIdValueToEntity(entity, default(TId)); + if (setIdWithDefault) + SetIdValueToEntity(entity, default(TId)); - action?.Invoke(entity); + action?.Invoke(entity); - return entity; - } + return entity; + } - protected virtual TEntity Factory_EntityWithRandomId(Action action = null) - { - var entity = Factory_Entity(action, false); + protected virtual TEntity Factory_EntityWithRandomId(Action action = null) + { + var entity = Factory_Entity(action, false); - SetIdValueToEntity(entity, RANDOM_ID);//TODO: to be randomize + SetIdValueToEntity(entity, RANDOM_ID);//TODO: to be randomize - return entity; - } + return entity; + } - protected TId GetIdValueFromEntity(TEntity entity) - { - return (TId)ExpressionUtil.GetPropertyValue(DbIdExpression, entity); - } + protected TId GetIdValueFromEntity(TEntity entity) + { + return (TId)ExpressionUtil.GetPropertyValue(DbIdExpression, entity); + } - protected void SetIdValueToEntity(TEntity entity, object value) - { - ExpressionUtil.SetPropertyValue(DbIdExpression, entity, value); - } + protected void SetIdValueToEntity(TEntity entity, object value) + { + ExpressionUtil.SetPropertyValue(DbIdExpression, entity, value); } -} \ No newline at end of file +} diff --git a/Core/Eisk.Test.Core/TestBases/IServiceTest.cs b/Core/Eisk.Test.Core/TestBases/IServiceTest.cs index d0d16ee1..ef475bef 100644 --- a/Core/Eisk.Test.Core/TestBases/IServiceTest.cs +++ b/Core/Eisk.Test.Core/TestBases/IServiceTest.cs @@ -1,9 +1,8 @@ using System; -namespace Eisk.Test.Core.TestBases +namespace Eisk.Test.Core.TestBases; + +public interface IServiceTest { - public interface IServiceTest - { - TService GetServiceInstance(Action action = null); - } + TService GetServiceInstance(Action action = null); } diff --git a/Core/Eisk.Test.Core/TestBases/TestBase.cs b/Core/Eisk.Test.Core/TestBases/TestBase.cs index f6eacc86..e14b62b5 100644 --- a/Core/Eisk.Test.Core/TestBases/TestBase.cs +++ b/Core/Eisk.Test.Core/TestBases/TestBase.cs @@ -1,25 +1,23 @@ using System; using Xunit; -namespace Eisk.Test.Core.TestBases -{ - using DataGen; - using Eisk.Core.Exceptions; +namespace Eisk.Test.Core.TestBases; + +using Eisk.Core.Exceptions; - public abstract class TestBase +public abstract class TestBase +{ + protected static void ExpectException(Action action, + TException expectedException) + where TException : CoreException { - protected static void ExpectException(Action action, - TException expectedException) - where TException : CoreException - { - //Act - var actualException = Assert.Throws(action); + //Act + var actualException = Assert.Throws(action); - //Assert - Assert.NotNull(actualException); - Assert.Equal(expectedException.Message, actualException.Message); - Assert.Equal(expectedException.ErrorCode, actualException.ErrorCode); - } - + //Assert + Assert.NotNull(actualException); + Assert.Equal(expectedException.Message, actualException.Message); + Assert.Equal(expectedException.ErrorCode, actualException.ErrorCode); } -} \ No newline at end of file + +} diff --git a/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs b/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs index ffabc4ff..5ebe59da 100644 --- a/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs +++ b/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs @@ -1,47 +1,46 @@ using Bogus; -namespace Eisk.Domains.TestData -{ - using Entities; - using Enums; - using Test.Core.DataGen; +namespace Eisk.Domains.TestData; + +using Eisk.Test.Core.DataGen.DataFactories; +using Entities; +using Enums; - public class EmployeeDataFactory:EntityCustomDataFactory +public class EmployeeDataFactory:EntityDomainDataFactory +{ + string[] _jobTitles = new string[] { "Vice President", "Director", "Manager", "Executive", "Sales Executive", "Management Trainee" }; + protected override void AssignDomainData(Employee employee) { - string[] _jobTitles = new string[] { "Vice President", "Director", "Manager", "Executive", "Sales Executive", "Management Trainee" }; - protected override void AssignEntity(Employee employee) + var faker = new Faker(); + + employee.Id = 0; + employee.ReportsTo = null; + employee.ReportsToId = null; + employee.Subordinates = null; + + employee.TitleOfCourtesy = faker.PickRandom(); + employee.FirstName = faker.Person.FirstName; + employee.LastName = faker.Person.LastName; + employee.BirthDate = faker.Date.Past(); + + var fakerAddress = faker.Address; + employee.Address = new ValueObjects.Address { - var faker = new Faker(); - - employee.Id = 0; - employee.ReportsTo = null; - employee.ReportsToId = null; - employee.Subordinates = null; - - employee.TitleOfCourtesy = faker.PickRandom(); - employee.FirstName = faker.Person.FirstName; - employee.LastName = faker.Person.LastName; - employee.BirthDate = faker.Date.Past(); - - var fakerAddress = faker.Address; - employee.Address = new ValueObjects.Address - { - AddressLine = fakerAddress.StreetAddress(), - City = fakerAddress.City(), - PostalCode = fakerAddress.ZipCode(), - Region = fakerAddress.State(), - Country = fakerAddress.Country(), - }; - - employee.HireDate = faker.Date.Future(); - employee.Title = faker.PickRandomParam(_jobTitles); - employee.Phone = faker.Person.Phone; - employee.Extension = faker.Person.Random.Number(0,999).ToString("000"); - - employee.Photo = null; - - //employee.Notes: to be auto-generated by the underlying framework - } + AddressLine = fakerAddress.StreetAddress(), + City = fakerAddress.City(), + PostalCode = fakerAddress.ZipCode(), + Region = fakerAddress.State(), + Country = fakerAddress.Country(), + }; + employee.HireDate = faker.Date.Future(); + employee.Title = faker.PickRandomParam(_jobTitles); + employee.Phone = faker.Person.Phone; + employee.Extension = faker.Person.Random.Number(0,999).ToString("000"); + + employee.Photo = null; + + //employee.Notes: to be auto-generated by the underlying framework } + } From f4da88951fc3ab7d676954eb26720d591e4687d5 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 19 Apr 2022 17:15:39 +0100 Subject: [PATCH 109/204] Convert to file scope namespace --- Core/Eisk.Core.Tests/UnitTest1.cs | 13 +- .../DataService/EFCore/EntityDataService.cs | 73 +++++----- .../DataService/IEntityDataService.cs | 19 ++- Core/Eisk.Core/DomainService/DomainService.cs | 137 +++++++++--------- Core/Eisk.Core/Exceptions/CoreException.cs | 45 +++--- Core/Eisk.Core/Exceptions/DomainException.cs | 11 +- .../InvalidLookupIdParameterException.cs | 13 +- .../Exceptions/NonExistantEntityException.cs | 17 +-- .../Exceptions/NullInputEntityException.cs | 13 +- .../Exceptions/UpdatingIdIsNotSupported.cs | 17 +-- Core/Eisk.Core/Utils/ExceptionThrower.cs | 19 ++- Core/Eisk.Core/Utils/ExpressionUtil.cs | 49 +++---- Core/Eisk.Core/Utils/ObjectExtensions.cs | 17 +-- Core/Eisk.Core/Utils/UriAttribute.cs | 31 ++-- Core/Eisk.Core/WebApi/WebApiControllerBase.cs | 69 +++++---- Core/Eisk.Test.Core.Tests/UnitTest1.cs | 13 +- .../IEmployeeDataService.cs | 17 +-- .../EmployeeDomainServiceUnitTests.cs | 49 +++---- .../EmployeeDomainService.cs | 33 ++--- .../Eisk.Domains/BaseEntities/Person.cs | 67 +++++---- DomainCore/Eisk.Domains/Entities/Employee.cs | 33 ++--- .../Eisk.Domains/Enums/TitleOfCourtesy.cs | 11 +- .../Eisk.Domains/ValueObjects/Address.cs | 41 +++--- .../EmployeeDataService.cs | 29 ++-- .../EmployeeDataServiceTestsWithInMemoryDb.cs | 21 ++- .../DatabaseFixture.cs | 23 ++- .../EmployeeDataServiceTestsWithSqlServer.cs | 25 ++-- .../EmployeeDomainServiceComponentTests.cs | 23 ++- .../DbContextDataInitializer.cs | 47 +++--- .../EntityFrameworkCoreInitializer.cs | 61 ++++---- .../Eisk.EFCore.Setup/InMemoryDbContext.cs | 27 ++-- .../Eisk.EFCore.Setup/SqlServerDbContext.cs | 31 ++-- .../Eisk.EFCore.Setup/TestDbContextFactory.cs | 21 ++- Notes/TODO.txt | 5 +- .../Controllers/EmployeesController.cs | 25 ++-- 35 files changed, 557 insertions(+), 588 deletions(-) diff --git a/Core/Eisk.Core.Tests/UnitTest1.cs b/Core/Eisk.Core.Tests/UnitTest1.cs index 924f85f2..b87a7605 100644 --- a/Core/Eisk.Core.Tests/UnitTest1.cs +++ b/Core/Eisk.Core.Tests/UnitTest1.cs @@ -1,13 +1,12 @@ using Xunit; -namespace Eisk.Core.Tests +namespace Eisk.Core.Tests; + +public class UnitTest1 { - public class UnitTest1 + [Fact] + public void Test1() { - [Fact] - public void Test1() - { - - } + } } diff --git a/Core/Eisk.Core/DataService/EFCore/EntityDataService.cs b/Core/Eisk.Core/DataService/EFCore/EntityDataService.cs index 69d13c93..226c4bb1 100644 --- a/Core/Eisk.Core/DataService/EFCore/EntityDataService.cs +++ b/Core/Eisk.Core/DataService/EFCore/EntityDataService.cs @@ -2,50 +2,49 @@ using System.Collections.Generic; using System.Threading.Tasks; -namespace Eisk.Core.DataService.EFCore +namespace Eisk.Core.DataService.EFCore; + +public class EntityDataService : IEntityDataService where TEntity : class, new() { - public class EntityDataService : IEntityDataService where TEntity : class, new() + protected readonly DbContext DbContext; + + public EntityDataService(DbContext dbContext) + { + DbContext = dbContext; + } + + public virtual async Task GetById(TId id) + { + return await DbContext.Set().FindAsync(id); + } + + public virtual async Task> GetAll() { - protected readonly DbContext DbContext; - - public EntityDataService(DbContext dbContext) - { - DbContext = dbContext; - } - - public virtual async Task GetById(TId id) - { - return await DbContext.Set().FindAsync(id); - } - - public virtual async Task> GetAll() - { - return await DbContext.Set().ToListAsync(); - } - - public virtual async Task Add(TEntity entity) - { - var obj = DbContext.Add(entity); + return await DbContext.Set().ToListAsync(); + } + + public virtual async Task Add(TEntity entity) + { + var obj = DbContext.Add(entity); ; - await DbContext.SaveChangesAsync(); + await DbContext.SaveChangesAsync(); - return obj.Entity; - } + return obj.Entity; + } - public virtual async Task Update(TEntity entity) - { - var obj = DbContext.Update(entity); + public virtual async Task Update(TEntity entity) + { + var obj = DbContext.Update(entity); - await DbContext.SaveChangesAsync(); + await DbContext.SaveChangesAsync(); - return obj.Entity; - } + return obj.Entity; + } - public virtual async Task Delete(TEntity entity) - { - DbContext.Remove(entity); + public virtual async Task Delete(TEntity entity) + { + DbContext.Remove(entity); - await DbContext.SaveChangesAsync(); - } + await DbContext.SaveChangesAsync(); } -} \ No newline at end of file +} diff --git a/Core/Eisk.Core/DataService/IEntityDataService.cs b/Core/Eisk.Core/DataService/IEntityDataService.cs index 3eb80251..250d5234 100644 --- a/Core/Eisk.Core/DataService/IEntityDataService.cs +++ b/Core/Eisk.Core/DataService/IEntityDataService.cs @@ -1,14 +1,13 @@ using System.Collections.Generic; using System.Threading.Tasks; -namespace Eisk.Core.DataService +namespace Eisk.Core.DataService; + +public interface IEntityDataService where TEntity : class, new() { - public interface IEntityDataService where TEntity : class, new() - { - Task GetById(TId id); - Task> GetAll(); - Task Add(TEntity entity); - Task Update(TEntity entity); - Task Delete(TEntity entity); - } -} \ No newline at end of file + Task GetById(TId id); + Task> GetAll(); + Task Add(TEntity entity); + Task Update(TEntity entity); + Task Delete(TEntity entity); +} diff --git a/Core/Eisk.Core/DomainService/DomainService.cs b/Core/Eisk.Core/DomainService/DomainService.cs index 617addf7..01de2bce 100644 --- a/Core/Eisk.Core/DomainService/DomainService.cs +++ b/Core/Eisk.Core/DomainService/DomainService.cs @@ -3,99 +3,98 @@ using System.Threading.Tasks; using Eisk.Core.Exceptions; -namespace Eisk.Core.DomainService +namespace Eisk.Core.DomainService; + +using DataService; +using Utils; + +public class DomainService + where TDomain : class, new() { - using DataService; - using Utils; + readonly IEntityDataService _entityDataService; - public class DomainService - where TDomain : class, new() + public DomainService(IEntityDataService entityDataService) { - readonly IEntityDataService _entityDataService; - - public DomainService(IEntityDataService entityDataService) - { - _entityDataService = entityDataService; - } + _entityDataService = entityDataService; + } - public virtual async Task> GetAll() - { - return await _entityDataService.GetAll(); - } + public virtual async Task> GetAll() + { + return await _entityDataService.GetAll(); + } - public virtual async Task GetById(TId id) - { - if (id.IsNullOrEmpty()) - ThrowExceptionForInvalidLookupIdParameter(); + public virtual async Task GetById(TId id) + { + if (id.IsNullOrEmpty()) + ThrowExceptionForInvalidLookupIdParameter(); - var entityInDb = await _entityDataService.GetById(id); + var entityInDb = await _entityDataService.GetById(id); - if (entityInDb == null) - ThrowExceptionForNonExistantEntity(id); + if (entityInDb == null) + ThrowExceptionForNonExistantEntity(id); - return entityInDb; - } + return entityInDb; + } - public virtual async Task Add(TDomain entity) - { - return await Add(entity, null); - } + public virtual async Task Add(TDomain entity) + { + return await Add(entity, null); + } - public virtual async Task Add(TDomain entity, Action preProcessAction, Action postProcessAction = null) - { - if (entity == null) - ThrowExceptionForNullInputEntity(); + public virtual async Task Add(TDomain entity, Action preProcessAction, Action postProcessAction = null) + { + if (entity == null) + ThrowExceptionForNullInputEntity(); - preProcessAction?.Invoke(entity); + preProcessAction?.Invoke(entity); - var returnVal = await _entityDataService.Add(entity); + var returnVal = await _entityDataService.Add(entity); - postProcessAction?.Invoke(returnVal); + postProcessAction?.Invoke(returnVal); - return returnVal; - } + return returnVal; + } - public virtual async Task Update(TId id, TDomain newEntity) - { - return await Update(id, newEntity, null); - } + public virtual async Task Update(TId id, TDomain newEntity) + { + return await Update(id, newEntity, null); + } - public virtual async Task Update(TId id, TDomain newEntity, Action preProcessAction, Action postProcessAction = null) - { - if (newEntity == null) - ThrowExceptionForNullInputEntity(); + public virtual async Task Update(TId id, TDomain newEntity, Action preProcessAction, Action postProcessAction = null) + { + if (newEntity == null) + ThrowExceptionForNullInputEntity(); - var oldEntity = await GetById(id); + var oldEntity = await GetById(id); - preProcessAction?.Invoke(oldEntity, newEntity); + preProcessAction?.Invoke(oldEntity, newEntity); - var returnVal = await _entityDataService.Update(newEntity); + var returnVal = await _entityDataService.Update(newEntity); - postProcessAction?.Invoke(returnVal); + postProcessAction?.Invoke(returnVal); - return returnVal; - } + return returnVal; + } - public virtual async Task Delete(TId id) - { - var entityInDb = await GetById(id); + public virtual async Task Delete(TId id) + { + var entityInDb = await GetById(id); - await _entityDataService.Delete(entityInDb); - } + await _entityDataService.Delete(entityInDb); + } - protected virtual void ThrowExceptionForNullInputEntity() - { - throw new NullInputEntityException(); - } + protected virtual void ThrowExceptionForNullInputEntity() + { + throw new NullInputEntityException(); + } - protected virtual void ThrowExceptionForInvalidLookupIdParameter() - { - throw new InvalidLookupIdParameterException(); - } + protected virtual void ThrowExceptionForInvalidLookupIdParameter() + { + throw new InvalidLookupIdParameterException(); + } - protected virtual void ThrowExceptionForNonExistantEntity(TId idValue) - { - throw new NonExistantEntityException(idValue); - } + protected virtual void ThrowExceptionForNonExistantEntity(TId idValue) + { + throw new NonExistantEntityException(idValue); } -} \ No newline at end of file +} diff --git a/Core/Eisk.Core/Exceptions/CoreException.cs b/Core/Eisk.Core/Exceptions/CoreException.cs index 38b9613e..87ae1cf5 100644 --- a/Core/Eisk.Core/Exceptions/CoreException.cs +++ b/Core/Eisk.Core/Exceptions/CoreException.cs @@ -1,32 +1,31 @@ using System; -namespace Eisk.Core.Exceptions -{ - public class CoreException : Exception - { - private const string DefaultErrorCode = "APP-ERROR-000"; +namespace Eisk.Core.Exceptions; - private string _message; - public override string Message => _message ?? (_message = ConvertToSentence(GetType().Name, ErrorCode)); +public class CoreException : Exception +{ + private const string DefaultErrorCode = "APP-ERROR-000"; - private string _errorCode; + private string _message; + public override string Message => _message ?? (_message = ConvertToSentence(GetType().Name, ErrorCode)); - /// - /// Error code helps distringuishing same types of errors in different context. - /// - public string ErrorCode => _errorCode ?? (_errorCode = DefaultErrorCode); + private string _errorCode; - public CoreException(string message = null, string errorCode = null) - { - _message = message; - _errorCode = errorCode; - } + /// + /// Error code helps distringuishing same types of errors in different context. + /// + public string ErrorCode => _errorCode ?? (_errorCode = DefaultErrorCode); - //TODO: convert class name to sentence - static string ConvertToSentence(string message, string errorCode) - { - return errorCode + ": " + message; - } + public CoreException(string message = null, string errorCode = null) + { + _message = message; + _errorCode = errorCode; + } + //TODO: convert class name to sentence + static string ConvertToSentence(string message, string errorCode) + { + return errorCode + ": " + message; } -} \ No newline at end of file + +} diff --git a/Core/Eisk.Core/Exceptions/DomainException.cs b/Core/Eisk.Core/Exceptions/DomainException.cs index 23adf447..cd3fe99c 100644 --- a/Core/Eisk.Core/Exceptions/DomainException.cs +++ b/Core/Eisk.Core/Exceptions/DomainException.cs @@ -1,10 +1,9 @@ -namespace Eisk.Core.Exceptions +namespace Eisk.Core.Exceptions; + +public class DomainException: CoreException { - public class DomainException: CoreException + public DomainException(string message = null, string errorCode = null) : base(message, errorCode) { - public DomainException(string message = null, string errorCode = null) : base(message, errorCode) - { - } } -} \ No newline at end of file +} diff --git a/Core/Eisk.Core/Exceptions/InvalidLookupIdParameterException.cs b/Core/Eisk.Core/Exceptions/InvalidLookupIdParameterException.cs index 7e2ec5d5..f8384541 100644 --- a/Core/Eisk.Core/Exceptions/InvalidLookupIdParameterException.cs +++ b/Core/Eisk.Core/Exceptions/InvalidLookupIdParameterException.cs @@ -1,11 +1,10 @@ -namespace Eisk.Core.Exceptions +namespace Eisk.Core.Exceptions; + +public class InvalidLookupIdParameterException: DomainException { - public class InvalidLookupIdParameterException: DomainException + public InvalidLookupIdParameterException(string paramName = "id") : base( + $"Invalid lookup parameter: {paramName} to find {typeof(TEntity).Name}.", "APP-DATA-ERROR-001") { - public InvalidLookupIdParameterException(string paramName = "id") : base( - $"Invalid lookup parameter: {paramName} to find {typeof(TEntity).Name}.", "APP-DATA-ERROR-001") - { - } } -} \ No newline at end of file +} diff --git a/Core/Eisk.Core/Exceptions/NonExistantEntityException.cs b/Core/Eisk.Core/Exceptions/NonExistantEntityException.cs index 095a8e7d..bbf92497 100644 --- a/Core/Eisk.Core/Exceptions/NonExistantEntityException.cs +++ b/Core/Eisk.Core/Exceptions/NonExistantEntityException.cs @@ -1,12 +1,11 @@ -namespace Eisk.Core.Exceptions -{ - public class NonExistantEntityException : DomainException +namespace Eisk.Core.Exceptions; + +public class NonExistantEntityException : DomainException +{ + public NonExistantEntityException(object paramValue, string paramName = "id") : base( + $"No {typeof(TEntity).Name} exists for given id {paramValue} for parameter {paramName}.", "APP-DATA-ERROR-002") { - public NonExistantEntityException(object paramValue, string paramName = "id") : base( - $"No {typeof(TEntity).Name} exists for given id {paramValue} for parameter {paramName}.", "APP-DATA-ERROR-002") - { - - } + } -} \ No newline at end of file +} diff --git a/Core/Eisk.Core/Exceptions/NullInputEntityException.cs b/Core/Eisk.Core/Exceptions/NullInputEntityException.cs index 99922357..dc95ac48 100644 --- a/Core/Eisk.Core/Exceptions/NullInputEntityException.cs +++ b/Core/Eisk.Core/Exceptions/NullInputEntityException.cs @@ -1,10 +1,9 @@ -namespace Eisk.Core.Exceptions +namespace Eisk.Core.Exceptions; + +public class NullInputEntityException : DomainException { - public class NullInputEntityException : DomainException + public NullInputEntityException() : base("Input object to be created or updated is null.", "APP-DATA-ERROR-003") { - public NullInputEntityException() : base("Input object to be created or updated is null.", "APP-DATA-ERROR-003") - { - - } + } -} \ No newline at end of file +} diff --git a/Core/Eisk.Core/Exceptions/UpdatingIdIsNotSupported.cs b/Core/Eisk.Core/Exceptions/UpdatingIdIsNotSupported.cs index 17f715ef..f694842a 100644 --- a/Core/Eisk.Core/Exceptions/UpdatingIdIsNotSupported.cs +++ b/Core/Eisk.Core/Exceptions/UpdatingIdIsNotSupported.cs @@ -1,12 +1,11 @@ -namespace Eisk.Core.Exceptions -{ - public class UpdatingIdIsNotSupported: DomainException +namespace Eisk.Core.Exceptions; + +public class UpdatingIdIsNotSupported: DomainException +{ + public UpdatingIdIsNotSupported(object paramValue, string paramName = "id") : base( + $"Updating {typeof(TEntity).Name} field {paramName} is not supported. Provided value: {paramValue}.", "APP-DATA-ERROR-004") { - public UpdatingIdIsNotSupported(object paramValue, string paramName = "id") : base( - $"Updating {typeof(TEntity).Name} field {paramName} is not supported. Provided value: {paramValue}.", "APP-DATA-ERROR-004") - { - - } + } -} \ No newline at end of file +} diff --git a/Core/Eisk.Core/Utils/ExceptionThrower.cs b/Core/Eisk.Core/Utils/ExceptionThrower.cs index 19c52748..930bbab0 100644 --- a/Core/Eisk.Core/Utils/ExceptionThrower.cs +++ b/Core/Eisk.Core/Utils/ExceptionThrower.cs @@ -1,14 +1,13 @@ -namespace Eisk.Core.Utils +namespace Eisk.Core.Utils; + +using Exceptions; + +public class ExceptionThrower { - using Exceptions; - public class ExceptionThrower + public static void Throws() + where T : CoreException, new() { - - public static void Throws() - where T : CoreException, new() - { - throw new T(); - } + throw new T(); } -} \ No newline at end of file +} diff --git a/Core/Eisk.Core/Utils/ExpressionUtil.cs b/Core/Eisk.Core/Utils/ExpressionUtil.cs index eb0014aa..7feb8b64 100644 --- a/Core/Eisk.Core/Utils/ExpressionUtil.cs +++ b/Core/Eisk.Core/Utils/ExpressionUtil.cs @@ -2,35 +2,34 @@ using System.Linq.Expressions; using System.Reflection; -namespace Eisk.Core.Utils -{ - using Exceptions; +namespace Eisk.Core.Utils; + +using Exceptions; - public static class ExpressionUtil +public static class ExpressionUtil +{ + public static object GetPropertyValue(Expression> expression, TDomain data) { - public static object GetPropertyValue(Expression> expression, TDomain data) - { - if (data == null) - throw new NullInputEntityException(); + if (data == null) + throw new NullInputEntityException(); - var prop = GetPropertyInfo(expression); - var value = prop.GetValue(data); - return value; - } + var prop = GetPropertyInfo(expression); + var value = prop.GetValue(data); + return value; + } - public static void SetPropertyValue(Expression> expression, TDomain data, object value) - { - if (data == null) - throw new NullInputEntityException(); + public static void SetPropertyValue(Expression> expression, TDomain data, object value) + { + if (data == null) + throw new NullInputEntityException(); - var prop = GetPropertyInfo(expression); - prop.SetValue(data, value); - } + var prop = GetPropertyInfo(expression); + prop.SetValue(data, value); + } - public static PropertyInfo GetPropertyInfo(Expression> expression) - { - var expr = (MemberExpression)expression.Body; - return (PropertyInfo)expr.Member; - } + public static PropertyInfo GetPropertyInfo(Expression> expression) + { + var expr = (MemberExpression)expression.Body; + return (PropertyInfo)expr.Member; } -} \ No newline at end of file +} diff --git a/Core/Eisk.Core/Utils/ObjectExtensions.cs b/Core/Eisk.Core/Utils/ObjectExtensions.cs index c4e9f8f8..61acfc65 100644 --- a/Core/Eisk.Core/Utils/ObjectExtensions.cs +++ b/Core/Eisk.Core/Utils/ObjectExtensions.cs @@ -1,13 +1,12 @@ -namespace Eisk.Core.Utils +namespace Eisk.Core.Utils; + +public static class ObjectExtensions { - public static class ObjectExtensions + public static bool IsNullOrEmpty(this T value) { - public static bool IsNullOrEmpty(this T value) - { - if (typeof(T) == typeof(string)) - return string.IsNullOrEmpty(value as string); + if (typeof(T) == typeof(string)) + return string.IsNullOrEmpty(value as string); - return value == null || value.Equals(default(T)); - } + return value == null || value.Equals(default(T)); } -} \ No newline at end of file +} diff --git a/Core/Eisk.Core/Utils/UriAttribute.cs b/Core/Eisk.Core/Utils/UriAttribute.cs index 7815598d..7e426317 100644 --- a/Core/Eisk.Core/Utils/UriAttribute.cs +++ b/Core/Eisk.Core/Utils/UriAttribute.cs @@ -1,26 +1,25 @@ using System; using System.ComponentModel.DataAnnotations; -namespace Eisk.Core.Utils +namespace Eisk.Core.Utils; + +public class UriAttribute : ValidationAttribute { - public class UriAttribute : ValidationAttribute + protected override ValidationResult IsValid(object value, ValidationContext validationContext) { - protected override ValidationResult IsValid(object value, ValidationContext validationContext) + if (value != null) { - if (value != null) + try + { + // ReSharper disable once ObjectCreationAsStatement + new Uri(value.ToString()); + } + catch (Exception ex) { - try - { - // ReSharper disable once ObjectCreationAsStatement - new Uri(value.ToString()); - } - catch (Exception ex) - { - return new ValidationResult(ex.Message); - } + return new ValidationResult(ex.Message); } - return ValidationResult.Success; } - + return ValidationResult.Success; } -} \ No newline at end of file + +} diff --git a/Core/Eisk.Core/WebApi/WebApiControllerBase.cs b/Core/Eisk.Core/WebApi/WebApiControllerBase.cs index 32b164ad..87d842b2 100644 --- a/Core/Eisk.Core/WebApi/WebApiControllerBase.cs +++ b/Core/Eisk.Core/WebApi/WebApiControllerBase.cs @@ -3,47 +3,46 @@ using Eisk.Core.DomainService; using Microsoft.AspNetCore.Mvc; -namespace Eisk.Core.WebApi +namespace Eisk.Core.WebApi; + +[ApiController] +[Route("api/[controller]")] +public abstract class WebApiControllerBase: ControllerBase + where TDomain : class, new() { - [ApiController] - [Route("api/[controller]")] - public abstract class WebApiControllerBase: ControllerBase - where TDomain : class, new() + protected DomainService DomainService; + protected WebApiControllerBase(DomainService domainService) { - protected DomainService DomainService; - protected WebApiControllerBase(DomainService domainService) - { - DomainService = domainService; - } + DomainService = domainService; + } - [HttpGet] - public virtual async Task> Get() - { - return await DomainService.GetAll(); - } + [HttpGet] + public virtual async Task> Get() + { + return await DomainService.GetAll(); + } - [HttpGet("{id}")] - public virtual async Task Get(TId id) - { - return await DomainService.GetById(id); - } + [HttpGet("{id}")] + public virtual async Task Get(TId id) + { + return await DomainService.GetById(id); + } - [HttpPost] - public virtual async Task Post(TDomain domain) - { - await DomainService.Add(domain); - } + [HttpPost] + public virtual async Task Post(TDomain domain) + { + await DomainService.Add(domain); + } - [HttpPut("{id}")] - public virtual async Task Put(TId id, TDomain domain) - { - await DomainService.Update(id, domain); - } + [HttpPut("{id}")] + public virtual async Task Put(TId id, TDomain domain) + { + await DomainService.Update(id, domain); + } - [HttpDelete("{id}")] - public virtual async Task Delete(TId id) - { - await DomainService.Delete(id); - } + [HttpDelete("{id}")] + public virtual async Task Delete(TId id) + { + await DomainService.Delete(id); } } diff --git a/Core/Eisk.Test.Core.Tests/UnitTest1.cs b/Core/Eisk.Test.Core.Tests/UnitTest1.cs index 9767d276..de1fb87d 100644 --- a/Core/Eisk.Test.Core.Tests/UnitTest1.cs +++ b/Core/Eisk.Test.Core.Tests/UnitTest1.cs @@ -1,13 +1,12 @@ using Xunit; -namespace Eisk.Test.Core.Tests +namespace Eisk.Test.Core.Tests; + +public class UnitTest1 { - public class UnitTest1 + [Fact] + public void Test1() { - [Fact] - public void Test1() - { - //test- update from submodule .. more update - } + //test- update from submodule .. more update } } diff --git a/DomainCore/Eisk.DataServices.Interfaces/IEmployeeDataService.cs b/DomainCore/Eisk.DataServices.Interfaces/IEmployeeDataService.cs index ee5db513..cff67c85 100644 --- a/DomainCore/Eisk.DataServices.Interfaces/IEmployeeDataService.cs +++ b/DomainCore/Eisk.DataServices.Interfaces/IEmployeeDataService.cs @@ -1,14 +1,13 @@ using System.Collections.Generic; using System.Threading.Tasks; -namespace Eisk.DataServices.Interfaces -{ - using Core.DataService; - using Domains.Entities; +namespace Eisk.DataServices.Interfaces; + +using Core.DataService; +using Domains.Entities; - public interface IEmployeeDataService: IEntityDataService - { - Task> GetByFirstName(string firstName); +public interface IEmployeeDataService: IEntityDataService +{ + Task> GetByFirstName(string firstName); - } -} \ No newline at end of file +} diff --git a/DomainCore/Eisk.DomainServices.UnitTests/EmployeeDomainServiceUnitTests.cs b/DomainCore/Eisk.DomainServices.UnitTests/EmployeeDomainServiceUnitTests.cs index cc530c43..3c1bb52c 100644 --- a/DomainCore/Eisk.DomainServices.UnitTests/EmployeeDomainServiceUnitTests.cs +++ b/DomainCore/Eisk.DomainServices.UnitTests/EmployeeDomainServiceUnitTests.cs @@ -2,39 +2,38 @@ using System.Threading.Tasks; using Xunit; -namespace Eisk.DomainServices.UnitTests +namespace Eisk.DomainServices.UnitTests; + +using Core.Exceptions; +using DataServices.Interfaces; +using Domains.Entities; + +public class EmployeeDomainServiceUnitTests { - using Core.Exceptions; - using DataServices.Interfaces; - using Domains.Entities; + #region Helpers - public class EmployeeDomainServiceUnitTests + static Mock Factory_DataService() { - #region Helpers + Mock employeeDataServiceMock = new Mock(); - static Mock Factory_DataService() - { - Mock employeeDataServiceMock = new Mock(); - - return employeeDataServiceMock; - } + return employeeDataServiceMock; + } - static EmployeeDomainService Factory_DomainService() - { - return new EmployeeDomainService(Factory_DataService().Object) ; - } + static EmployeeDomainService Factory_DomainService() + { + return new EmployeeDomainService(Factory_DataService().Object) ; + } - #endregion + #endregion - [Fact] - public async Task Add_NullEmployeePassed_ShouldThrowExceptionAsync() - { - //Act + Assert - var error = await Assert.ThrowsAsync>(testCode: () => Factory_DomainService().Add(null)); + [Fact] + public async Task Add_NullEmployeePassed_ShouldThrowExceptionAsync() + { + //Act + Assert + var error = await Assert.ThrowsAsync>(testCode: () => Factory_DomainService().Add(null)); - //Assert - Assert.Equal("Input object to be created or updated is null.", error.Message); + //Assert + Assert.Equal("Input object to be created or updated is null.", error.Message); - } } } diff --git a/DomainCore/Eisk.DomainServices/EmployeeDomainService.cs b/DomainCore/Eisk.DomainServices/EmployeeDomainService.cs index 1df6f3c4..9df81695 100644 --- a/DomainCore/Eisk.DomainServices/EmployeeDomainService.cs +++ b/DomainCore/Eisk.DomainServices/EmployeeDomainService.cs @@ -1,24 +1,23 @@ using System.Collections.Generic; using System.Threading.Tasks; -namespace Eisk.DomainServices -{ - using Core.DomainService; - using DataServices.Interfaces; - using Domains.Entities; +namespace Eisk.DomainServices; - public class EmployeeDomainService : DomainService - { - private readonly IEmployeeDataService _employeeDataService; +using Core.DomainService; +using DataServices.Interfaces; +using Domains.Entities; - public EmployeeDomainService(IEmployeeDataService employeeDataService) : base(employeeDataService) - { - _employeeDataService = employeeDataService; - } +public class EmployeeDomainService : DomainService +{ + private readonly IEmployeeDataService _employeeDataService; - public virtual async Task> GetByFirstName(string firstName) - { - return await _employeeDataService.GetByFirstName(firstName); - } + public EmployeeDomainService(IEmployeeDataService employeeDataService) : base(employeeDataService) + { + _employeeDataService = employeeDataService; + } + public virtual async Task> GetByFirstName(string firstName) + { + return await _employeeDataService.GetByFirstName(firstName); } -} \ No newline at end of file + +} diff --git a/DomainCore/Eisk.Domains/BaseEntities/Person.cs b/DomainCore/Eisk.Domains/BaseEntities/Person.cs index a07cd112..b05507e3 100644 --- a/DomainCore/Eisk.Domains/BaseEntities/Person.cs +++ b/DomainCore/Eisk.Domains/BaseEntities/Person.cs @@ -3,48 +3,47 @@ using System.ComponentModel.DataAnnotations.Schema; using Eisk.Domains.Enums; -namespace Eisk.Domains.BaseEntities -{ - using ValueObjects; +namespace Eisk.Domains.BaseEntities; + +using ValueObjects; - public class Person - { - [Key] - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - public int Id { get; set; } +public class Person +{ + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int Id { get; set; } - [Display(Name = "Title of Courtesy")] - [StringLength(10)] - public TitleOfCourtesy? TitleOfCourtesy { get; set; } + [Display(Name = "Title of Courtesy")] + [StringLength(10)] + public TitleOfCourtesy? TitleOfCourtesy { get; set; } - [Required(ErrorMessage = "First name required.")] - [StringLength(50)] - [Display(Name = "First Name")] - public string FirstName { get; set; } + [Required(ErrorMessage = "First name required.")] + [StringLength(50)] + [Display(Name = "First Name")] + public string FirstName { get; set; } - [Required(ErrorMessage = "Last name required.")] - [StringLength(50)] - [Display(Name = "Last Name")] - public string LastName { get; set; } + [Required(ErrorMessage = "Last name required.")] + [StringLength(50)] + [Display(Name = "Last Name")] + public string LastName { get; set; } - [Display(Name = "Birth Date")] - public DateTime? BirthDate { get; set; } + [Display(Name = "Birth Date")] + public DateTime? BirthDate { get; set; } - public Address Address { get; set; } + public Address Address { get; set; } - [Required(ErrorMessage = "Phone required")] - [StringLength(50)] - public string Phone { get; set; } + [Required(ErrorMessage = "Phone required")] + [StringLength(50)] + public string Phone { get; set; } - [StringLength(4)] - public string Extension { get; set; } + [StringLength(4)] + public string Extension { get; set; } - [DataType(DataType.MultilineText)] - [Column(TypeName = "ntext")] - public string Notes { get; set; } + [DataType(DataType.MultilineText)] + [Column(TypeName = "ntext")] + public string Notes { get; set; } - [Column(TypeName = "image")] - public byte[] Photo { get; set; } + [Column(TypeName = "image")] + public byte[] Photo { get; set; } - } -} \ No newline at end of file +} diff --git a/DomainCore/Eisk.Domains/Entities/Employee.cs b/DomainCore/Eisk.Domains/Entities/Employee.cs index 75b475d1..41cf1779 100644 --- a/DomainCore/Eisk.Domains/Entities/Employee.cs +++ b/DomainCore/Eisk.Domains/Entities/Employee.cs @@ -3,26 +3,25 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -namespace Eisk.Domains.Entities -{ - using BaseEntities; +namespace Eisk.Domains.Entities; + +using BaseEntities; - [Table("Employees")] - public class Employee : Person - { - [StringLength(20)] - public string Title { get; set; } +[Table("Employees")] +public class Employee : Person +{ + [StringLength(20)] + public string Title { get; set; } - [Display(Name = "Hire Date")] - public DateTime HireDate { get; set; } + [Display(Name = "Hire Date")] + public DateTime HireDate { get; set; } - [Display(Name = "Supervisor")] - public int? ReportsToId { get; set; } + [Display(Name = "Supervisor")] + public int? ReportsToId { get; set; } - [ForeignKey("ReportsToId")] - public Employee ReportsTo { get; set; } + [ForeignKey("ReportsToId")] + public Employee ReportsTo { get; set; } - public virtual IList Subordinates { get; set; } + public virtual IList Subordinates { get; set; } - } -} \ No newline at end of file +} diff --git a/DomainCore/Eisk.Domains/Enums/TitleOfCourtesy.cs b/DomainCore/Eisk.Domains/Enums/TitleOfCourtesy.cs index e9bbc535..640bacc6 100644 --- a/DomainCore/Eisk.Domains/Enums/TitleOfCourtesy.cs +++ b/DomainCore/Eisk.Domains/Enums/TitleOfCourtesy.cs @@ -1,7 +1,6 @@ -namespace Eisk.Domains.Enums +namespace Eisk.Domains.Enums; + +public enum TitleOfCourtesy { - public enum TitleOfCourtesy - { - Mr, Dr, Mrs, Ms - } -} \ No newline at end of file + Mr, Dr, Mrs, Ms +} diff --git a/DomainCore/Eisk.Domains/ValueObjects/Address.cs b/DomainCore/Eisk.Domains/ValueObjects/Address.cs index ef8affdb..1c777989 100644 --- a/DomainCore/Eisk.Domains/ValueObjects/Address.cs +++ b/DomainCore/Eisk.Domains/ValueObjects/Address.cs @@ -1,28 +1,27 @@ using System.ComponentModel.DataAnnotations; -namespace Eisk.Domains.ValueObjects +namespace Eisk.Domains.ValueObjects; + +public class Address { - public class Address - { - [StringLength(80)] - [Required(ErrorMessage = "Address line required.")] - [Display(Name = "Address line")] - public string AddressLine { get; set; } + [StringLength(80)] + [Required(ErrorMessage = "Address line required.")] + [Display(Name = "Address line")] + public string AddressLine { get; set; } - [StringLength(80)] - public string City { get; set; } + [StringLength(80)] + public string City { get; set; } - [StringLength(80)] - public string Region { get; set; } + [StringLength(80)] + public string Region { get; set; } - [StringLength(80)] - [RegularExpression("\\d{1,80}", ErrorMessage = "Not a valid postal code. Please consider upto 10 digit for valid postal format.")] - [Display(Name = "Postal Code")] - public string PostalCode { get; set; } + [StringLength(80)] + [RegularExpression("\\d{1,80}", ErrorMessage = "Not a valid postal code. Please consider upto 10 digit for valid postal format.")] + [Display(Name = "Postal Code")] + public string PostalCode { get; set; } - [Required(ErrorMessage = "Country required.")] - [StringLength(80)] - public string Country { get; set; } - - } -} \ No newline at end of file + [Required(ErrorMessage = "Country required.")] + [StringLength(80)] + public string Country { get; set; } + +} diff --git a/Infrastructure.EFCore/Eisk.DataServices.EFCore/EmployeeDataService.cs b/Infrastructure.EFCore/Eisk.DataServices.EFCore/EmployeeDataService.cs index b830f0de..9a33ef14 100644 --- a/Infrastructure.EFCore/Eisk.DataServices.EFCore/EmployeeDataService.cs +++ b/Infrastructure.EFCore/Eisk.DataServices.EFCore/EmployeeDataService.cs @@ -4,23 +4,22 @@ using Eisk.Core.DataService.EFCore; using Microsoft.EntityFrameworkCore; -namespace Eisk.DataServices.EFCore -{ - using DataContext; - using Interfaces; - using Domains.Entities; +namespace Eisk.DataServices.EFCore; - public class EmployeeDataService : EntityDataService, IEmployeeDataService - { - public EmployeeDataService(AppDbContext dbContext) : base(dbContext) - { +using DataContext; +using Interfaces; +using Domains.Entities; - } +public class EmployeeDataService : EntityDataService, IEmployeeDataService +{ + public EmployeeDataService(AppDbContext dbContext) : base(dbContext) + { - public virtual async Task> GetByFirstName(string firstName) - { - return await DbContext.Set().Where(x => x.FirstName.Contains(firstName)).ToListAsync(); - } + } + public virtual async Task> GetByFirstName(string firstName) + { + return await DbContext.Set().Where(x => x.FirstName.Contains(firstName)).ToListAsync(); } -} \ No newline at end of file + +} diff --git a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.InMemory/EmployeeDataServiceTestsWithInMemoryDb.cs b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.InMemory/EmployeeDataServiceTestsWithInMemoryDb.cs index 7bca927a..94eac026 100644 --- a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.InMemory/EmployeeDataServiceTestsWithInMemoryDb.cs +++ b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.InMemory/EmployeeDataServiceTestsWithInMemoryDb.cs @@ -1,16 +1,15 @@ -namespace Eisk.DataServices.IntegrationTests.EFCore.InMemory -{ - using Domains.Entities; - using Test.Core.TestBases; - using Eisk.EFCore.Setup; - using Eisk.DataServices.EFCore; +namespace Eisk.DataServices.IntegrationTests.EFCore.InMemory; - public class EmployeeDataServiceTestsWithInMemoryDb : DataServiceBaseIntegrationTests - { - public EmployeeDataServiceTestsWithInMemoryDb() : base(new EmployeeDataService(TestDbContextFactory.CreateInMemoryDbContext()), x => x.Id) - { +using Domains.Entities; +using Test.Core.TestBases; +using Eisk.EFCore.Setup; +using Eisk.DataServices.EFCore; - } +public class EmployeeDataServiceTestsWithInMemoryDb : DataServiceBaseIntegrationTests +{ + public EmployeeDataServiceTestsWithInMemoryDb() : base(new EmployeeDataService(TestDbContextFactory.CreateInMemoryDbContext()), x => x.Id) + { } + } diff --git a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/DatabaseFixture.cs b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/DatabaseFixture.cs index 2bd660af..19bd4337 100644 --- a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/DatabaseFixture.cs +++ b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/DatabaseFixture.cs @@ -1,20 +1,19 @@ using Eisk.EFCore.Setup; using System; -namespace Eisk.DataServices.IntegrationTests.EFCore.SqlServer +namespace Eisk.DataServices.IntegrationTests.EFCore.SqlServer; + +public class DatabaseFixture : IDisposable { - public class DatabaseFixture : IDisposable + public DatabaseFixture() { - public DatabaseFixture() - { - var db = TestDbContextFactory.CreateSqlServerDbContext(); - DbContextDataInitializer.Initialize(db); - } + var db = TestDbContextFactory.CreateSqlServerDbContext(); + DbContextDataInitializer.Initialize(db); + } - public void Dispose() - { - // ... clean up test data from the database ... - } - + public void Dispose() + { + // ... clean up test data from the database ... } + } diff --git a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/EmployeeDataServiceTestsWithSqlServer.cs b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/EmployeeDataServiceTestsWithSqlServer.cs index 50c03c97..44da0e79 100644 --- a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/EmployeeDataServiceTestsWithSqlServer.cs +++ b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/EmployeeDataServiceTestsWithSqlServer.cs @@ -1,19 +1,18 @@ using Xunit; -namespace Eisk.DataServices.IntegrationTests.EFCore.SqlServer -{ - using Domains.Entities; - using Test.Core.TestBases; - using Domains.TestData; - using Eisk.EFCore.Setup; - using Eisk.DataServices.EFCore; +namespace Eisk.DataServices.IntegrationTests.EFCore.SqlServer; - public class EmployeeDataServiceTestsWithSqlServer: DataServiceSqlServerBaseIntegrationTests, IClassFixture - { - public EmployeeDataServiceTestsWithSqlServer(): base(new EmployeeDataService(TestDbContextFactory.CreateSqlServerDbContext()), x => x.Id, new EmployeeDataFactory()) - { - - } +using Domains.Entities; +using Test.Core.TestBases; +using Domains.TestData; +using Eisk.EFCore.Setup; +using Eisk.DataServices.EFCore; +public class EmployeeDataServiceTestsWithSqlServer: DataServiceSqlServerBaseIntegrationTests, IClassFixture +{ + public EmployeeDataServiceTestsWithSqlServer(): base(new EmployeeDataService(TestDbContextFactory.CreateSqlServerDbContext()), x => x.Id, new EmployeeDataFactory()) + { + } + } diff --git a/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/EmployeeDomainServiceComponentTests.cs b/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/EmployeeDomainServiceComponentTests.cs index 00992ba0..52e8ddd2 100644 --- a/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/EmployeeDomainServiceComponentTests.cs +++ b/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/EmployeeDomainServiceComponentTests.cs @@ -4,21 +4,20 @@ using Eisk.EFCore.Setup; using Eisk.Test.Core.TestBases; -namespace Eisk.DomainServices.ComponentTests.EFCore +namespace Eisk.DomainServices.ComponentTests.EFCore; + +public class EmployeeDomainServiceComponentTests : DomainServiceBaseComponentTests { - public class EmployeeDomainServiceComponentTests : DomainServiceBaseComponentTests + public EmployeeDomainServiceComponentTests() : + base(new EmployeeDomainService(Factory_DataService()), x => x.Id, new EmployeeDataFactory()) { - public EmployeeDomainServiceComponentTests() : - base(new EmployeeDomainService(Factory_DataService()), x => x.Id, new EmployeeDataFactory()) - { - - } + + } - static EmployeeDataService Factory_DataService() - { - EmployeeDataService employeeDataService = new EmployeeDataService(TestDbContextFactory.CreateInMemoryDbContext()); + static EmployeeDataService Factory_DataService() + { + EmployeeDataService employeeDataService = new EmployeeDataService(TestDbContextFactory.CreateInMemoryDbContext()); - return employeeDataService; - } + return employeeDataService; } } diff --git a/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs b/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs index 2b560a96..5b1f1007 100644 --- a/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs +++ b/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs @@ -1,35 +1,34 @@ using System.Linq; -namespace Eisk.EFCore.Setup -{ - using DataServices.EFCore.DataContext; - using Domains.TestData; - using Eisk.Domains.Entities; - using System.Collections.Generic; +namespace Eisk.EFCore.Setup; + +using DataServices.EFCore.DataContext; +using Domains.TestData; +using Eisk.Domains.Entities; +using System.Collections.Generic; - public static class DbContextDataInitializer +public static class DbContextDataInitializer +{ + public static void Initialize(AppDbContext context) { - public static void Initialize(AppDbContext context) - { - context.Database.EnsureDeleted(); + context.Database.EnsureDeleted(); - context.Database.EnsureCreated(); + context.Database.EnsureCreated(); - // Look for any data available. - if (context.Employees.Any()) - { - return; // DB has been seeded - } + // Look for any data available. + if (context.Employees.Any()) + { + return; // DB has been seeded + } - var employeeDataFactory = new EmployeeDataFactory(); - var testEmployees = new List(); + var employeeDataFactory = new EmployeeDataFactory(); + var testEmployees = new List(); - for (int i = 0; i < 100; i++) - testEmployees.Add(employeeDataFactory.Factory_Entity()); + for (int i = 0; i < 100; i++) + testEmployees.Add(employeeDataFactory.Factory_Entity()); - context.Employees.AddRange(testEmployees); - context.SaveChanges(); + context.Employees.AddRange(testEmployees); + context.SaveChanges(); - } } -} \ No newline at end of file +} diff --git a/Infrastructure.EFCore/Eisk.EFCore.Setup/EntityFrameworkCoreInitializer.cs b/Infrastructure.EFCore/Eisk.EFCore.Setup/EntityFrameworkCoreInitializer.cs index 43828510..cb76f30d 100644 --- a/Infrastructure.EFCore/Eisk.EFCore.Setup/EntityFrameworkCoreInitializer.cs +++ b/Infrastructure.EFCore/Eisk.EFCore.Setup/EntityFrameworkCoreInitializer.cs @@ -5,42 +5,41 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -namespace Eisk.EFCore.Setup +namespace Eisk.EFCore.Setup; + +public class EntityFrameworkCoreInitializer { - public class EntityFrameworkCoreInitializer + public static EntityFrameworkCoreInitializer Factory(IServiceCollection services, IConfiguration configuration) { - public static EntityFrameworkCoreInitializer Factory(IServiceCollection services, IConfiguration configuration) - { - return new EntityFrameworkCoreInitializer(services, configuration); - } + return new EntityFrameworkCoreInitializer(services, configuration); + } - private readonly IServiceCollection _services; - private readonly IConfiguration _configuration; - private readonly IHostEnvironment _hostingEnvironment; - public EntityFrameworkCoreInitializer(IServiceCollection services, IConfiguration configuration) - { - _services = services; - _configuration = configuration; + private readonly IServiceCollection _services; + private readonly IConfiguration _configuration; + private readonly IHostEnvironment _hostingEnvironment; + public EntityFrameworkCoreInitializer(IServiceCollection services, IConfiguration configuration) + { + _services = services; + _configuration = configuration; - IServiceProvider serviceProvider = _services.BuildServiceProvider(); - _hostingEnvironment = serviceProvider.GetService(); - } + IServiceProvider serviceProvider = _services.BuildServiceProvider(); + _hostingEnvironment = serviceProvider.GetService(); + } - public void AddDbContext() - { - if (_hostingEnvironment.IsDevelopment()) - _services.AddScoped(); - else - _services.AddScoped(x => new SqlServerDbContext(_configuration)); - } + public void AddDbContext() + { + if (_hostingEnvironment.IsDevelopment()) + _services.AddScoped(); + else + _services.AddScoped(x => new SqlServerDbContext(_configuration)); + } - public static void AddSeedDataToDbContext(IHostEnvironment hostingEnvironment, IConfiguration configuration) - { - if (hostingEnvironment.IsDevelopment()) - DbContextDataInitializer.Initialize(new InMemoryDbContext()); - else - DbContextDataInitializer.Initialize(new SqlServerDbContext(configuration)); + public static void AddSeedDataToDbContext(IHostEnvironment hostingEnvironment, IConfiguration configuration) + { + if (hostingEnvironment.IsDevelopment()) + DbContextDataInitializer.Initialize(new InMemoryDbContext()); + else + DbContextDataInitializer.Initialize(new SqlServerDbContext(configuration)); - } } -} \ No newline at end of file +} diff --git a/Infrastructure.EFCore/Eisk.EFCore.Setup/InMemoryDbContext.cs b/Infrastructure.EFCore/Eisk.EFCore.Setup/InMemoryDbContext.cs index e960107e..606794c8 100644 --- a/Infrastructure.EFCore/Eisk.EFCore.Setup/InMemoryDbContext.cs +++ b/Infrastructure.EFCore/Eisk.EFCore.Setup/InMemoryDbContext.cs @@ -2,21 +2,20 @@ using Eisk.DataServices.EFCore.DataContext; using Microsoft.EntityFrameworkCore; -namespace Eisk.EFCore.Setup +namespace Eisk.EFCore.Setup; + +public class InMemoryDbContext : AppDbContext { - public class InMemoryDbContext : AppDbContext + private readonly bool _uniqueDbName; + public InMemoryDbContext(bool uniqueDbName = false) : base(new DbContextOptionsBuilder().Options) + { + _uniqueDbName = uniqueDbName; + } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { - private readonly bool _uniqueDbName; - public InMemoryDbContext(bool uniqueDbName = false) : base(new DbContextOptionsBuilder().Options) - { - _uniqueDbName = uniqueDbName; - } - - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - { - var dbName = "Eisk" + (_uniqueDbName ? Guid.NewGuid().ToString() : string.Empty); + var dbName = "Eisk" + (_uniqueDbName ? Guid.NewGuid().ToString() : string.Empty); - optionsBuilder.UseInMemoryDatabase(dbName); - } + optionsBuilder.UseInMemoryDatabase(dbName); } -} \ No newline at end of file +} diff --git a/Infrastructure.EFCore/Eisk.EFCore.Setup/SqlServerDbContext.cs b/Infrastructure.EFCore/Eisk.EFCore.Setup/SqlServerDbContext.cs index dc6337eb..594a6f28 100644 --- a/Infrastructure.EFCore/Eisk.EFCore.Setup/SqlServerDbContext.cs +++ b/Infrastructure.EFCore/Eisk.EFCore.Setup/SqlServerDbContext.cs @@ -3,24 +3,23 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; -namespace Eisk.EFCore.Setup +namespace Eisk.EFCore.Setup; + +public class SqlServerDbContext : AppDbContext { - public class SqlServerDbContext : AppDbContext - { - public SqlServerDbContext(IConfiguration configuration) : this(configuration.GetConnectionString("DefaultSqlConnection")) { } + public SqlServerDbContext(IConfiguration configuration) : this(configuration.GetConnectionString("DefaultSqlConnection")) { } - private readonly string _connectionString; - public SqlServerDbContext(string connectionString = null) : base(new DbContextOptionsBuilder().Options) - { - if (string.IsNullOrEmpty(connectionString)) - throw new ArgumentNullException(nameof(connectionString)); + private readonly string _connectionString; + public SqlServerDbContext(string connectionString = null) : base(new DbContextOptionsBuilder().Options) + { + if (string.IsNullOrEmpty(connectionString)) + throw new ArgumentNullException(nameof(connectionString)); - _connectionString = connectionString; - } + _connectionString = connectionString; + } - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - { - optionsBuilder.UseSqlServer(_connectionString); - } + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + optionsBuilder.UseSqlServer(_connectionString); } -} \ No newline at end of file +} diff --git a/Infrastructure.EFCore/Eisk.EFCore.Setup/TestDbContextFactory.cs b/Infrastructure.EFCore/Eisk.EFCore.Setup/TestDbContextFactory.cs index 19974048..9a7f233c 100644 --- a/Infrastructure.EFCore/Eisk.EFCore.Setup/TestDbContextFactory.cs +++ b/Infrastructure.EFCore/Eisk.EFCore.Setup/TestDbContextFactory.cs @@ -1,17 +1,16 @@ using Eisk.DataServices.EFCore.DataContext; -namespace Eisk.EFCore.Setup +namespace Eisk.EFCore.Setup; + +public static class TestDbContextFactory { - public static class TestDbContextFactory + public static AppDbContext CreateInMemoryDbContext() { - public static AppDbContext CreateInMemoryDbContext() - { - return new InMemoryDbContext(true); - } + return new InMemoryDbContext(true); + } - public static AppDbContext CreateSqlServerDbContext() - { - return new SqlServerDbContext("Server=(localdb)\\mssqllocaldb;Database=eisk;Trusted_Connection=True;MultipleActiveResultSets=true"); - } + public static AppDbContext CreateSqlServerDbContext() + { + return new SqlServerDbContext("Server=(localdb)\\mssqllocaldb;Database=eisk;Trusted_Connection=True;MultipleActiveResultSets=true"); } -} \ No newline at end of file +} diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 4dad538c..52a912aa 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -35,6 +35,7 @@ Code * Integrate azure insight Testing +* Set db fixture with assesbmly set-up * Sql server integration tests: load from config * Create postman based test file (for template only) * Test post and update methods @@ -104,16 +105,18 @@ DONE * Fix local run (web api) v8 DONE * Fix local run (web api) v9 Code -DONE * Remove sub-module +DONE * Convert to file scope namespace DONE * Apply title, extension in entity data generator DONE * Investigate with length field is not causing issue when saving (for in-memory db constraints not applied) DONE * Remove obsolete methods (for .NET 6.0) DONE * fix unit tests +DONE * Remove sub-module DONE * Fix project load issue for rendered content. issue: long file path DONE * Exclude unused project files (test projects) DONE * Exclude unused project files (notes) Testing +DONE * Refactor entity data generator with domain DONE * Refactor entity test data generator as an abstract class DONE * Test data service with sql server local instance DONE * Complete custom data generator implementation diff --git a/WebApi/Eisk.WebApi/Controllers/EmployeesController.cs b/WebApi/Eisk.WebApi/Controllers/EmployeesController.cs index a82ef6fb..84adba9b 100644 --- a/WebApi/Eisk.WebApi/Controllers/EmployeesController.cs +++ b/WebApi/Eisk.WebApi/Controllers/EmployeesController.cs @@ -1,17 +1,16 @@ -namespace Eisk.WebApi.Controllers -{ - using Core.WebApi; - using Domains.Entities; - using DomainServices; - using Microsoft.AspNetCore.Mvc; +namespace Eisk.WebApi.Controllers; + +using Core.WebApi; +using Domains.Entities; +using DomainServices; +using Microsoft.AspNetCore.Mvc; - [ApiController] - [Route("[controller]")] - public class EmployeesController : WebApiControllerBase +[ApiController] +[Route("[controller]")] +public class EmployeesController : WebApiControllerBase +{ + public EmployeesController(EmployeeDomainService employeeDomainService):base(employeeDomainService) { - public EmployeesController(EmployeeDomainService employeeDomainService):base(employeeDomainService) - { - - } + } } From 4c35d17f899956664dce9848329678c1617f4787 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 19 Apr 2022 17:16:43 +0100 Subject: [PATCH 110/204] File name updated: EntityDomainDataFactory --- .../{EntityCustomDataFactory.cs => EntityDomainDataFactory.cs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Core/Eisk.Test.Core/DataGen/DataFactories/{EntityCustomDataFactory.cs => EntityDomainDataFactory.cs} (100%) diff --git a/Core/Eisk.Test.Core/DataGen/DataFactories/EntityCustomDataFactory.cs b/Core/Eisk.Test.Core/DataGen/DataFactories/EntityDomainDataFactory.cs similarity index 100% rename from Core/Eisk.Test.Core/DataGen/DataFactories/EntityCustomDataFactory.cs rename to Core/Eisk.Test.Core/DataGen/DataFactories/EntityDomainDataFactory.cs From dd343a25c0e4343a25e81c53278e927cab8f763a Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 19 Apr 2022 17:20:48 +0100 Subject: [PATCH 111/204] Database set-yp method refactored --- .../{DatabaseFixture.cs => DatabaseSetup.cs} | 4 ++-- .../EmployeeDataServiceTestsWithSqlServer.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/{DatabaseFixture.cs => DatabaseSetup.cs} (82%) diff --git a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/DatabaseFixture.cs b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/DatabaseSetup.cs similarity index 82% rename from Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/DatabaseFixture.cs rename to Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/DatabaseSetup.cs index 19bd4337..6863d094 100644 --- a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/DatabaseFixture.cs +++ b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/DatabaseSetup.cs @@ -3,9 +3,9 @@ namespace Eisk.DataServices.IntegrationTests.EFCore.SqlServer; -public class DatabaseFixture : IDisposable +public class DatabaseSetup : IDisposable { - public DatabaseFixture() + public DatabaseSetup() { var db = TestDbContextFactory.CreateSqlServerDbContext(); DbContextDataInitializer.Initialize(db); diff --git a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/EmployeeDataServiceTestsWithSqlServer.cs b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/EmployeeDataServiceTestsWithSqlServer.cs index 44da0e79..bc1001f1 100644 --- a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/EmployeeDataServiceTestsWithSqlServer.cs +++ b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/EmployeeDataServiceTestsWithSqlServer.cs @@ -8,7 +8,7 @@ namespace Eisk.DataServices.IntegrationTests.EFCore.SqlServer; using Eisk.EFCore.Setup; using Eisk.DataServices.EFCore; -public class EmployeeDataServiceTestsWithSqlServer: DataServiceSqlServerBaseIntegrationTests, IClassFixture +public class EmployeeDataServiceTestsWithSqlServer: DataServiceSqlServerBaseIntegrationTests, IClassFixture { public EmployeeDataServiceTestsWithSqlServer(): base(new EmployeeDataService(TestDbContextFactory.CreateSqlServerDbContext()), x => x.Id, new EmployeeDataFactory()) { From e6236fbee4d7a701a94b3b6500f7ae336d348038 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 19 Apr 2022 17:32:24 +0100 Subject: [PATCH 112/204] remove unused reference --- .../TestBases/DataServiceSqlServerBaseIntegrationTests.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Core/Eisk.Test.Core/TestBases/DataServiceSqlServerBaseIntegrationTests.cs b/Core/Eisk.Test.Core/TestBases/DataServiceSqlServerBaseIntegrationTests.cs index 236ab8be..ebd3a5cb 100644 --- a/Core/Eisk.Test.Core/TestBases/DataServiceSqlServerBaseIntegrationTests.cs +++ b/Core/Eisk.Test.Core/TestBases/DataServiceSqlServerBaseIntegrationTests.cs @@ -12,8 +12,6 @@ public abstract class DataServiceSqlServerBaseIntegrationTests : D IServiceTest> where TEntity : class, new() { - private readonly IEntityDataService _dataService; - protected DataServiceSqlServerBaseIntegrationTests(IEntityDataService dataService, Expression> idExpression, EntityDataFactory entityDataFactory = null) :base(dataService, idExpression, entityDataFactory) { From 56bc43b6c882007f56874c0f125f6f91bc2c8dc8 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 19 Apr 2022 17:34:08 +0100 Subject: [PATCH 113/204] remove unused reference --- .../TestBases/DataServiceSqlServerBaseIntegrationTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/Eisk.Test.Core/TestBases/DataServiceSqlServerBaseIntegrationTests.cs b/Core/Eisk.Test.Core/TestBases/DataServiceSqlServerBaseIntegrationTests.cs index ebd3a5cb..bfe82ae5 100644 --- a/Core/Eisk.Test.Core/TestBases/DataServiceSqlServerBaseIntegrationTests.cs +++ b/Core/Eisk.Test.Core/TestBases/DataServiceSqlServerBaseIntegrationTests.cs @@ -15,7 +15,7 @@ public abstract class DataServiceSqlServerBaseIntegrationTests : D protected DataServiceSqlServerBaseIntegrationTests(IEntityDataService dataService, Expression> idExpression, EntityDataFactory entityDataFactory = null) :base(dataService, idExpression, entityDataFactory) { - _dataService = dataService; + } From 5d1cc0d6f69a9499d3d9de3b2856354f2be43195 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 19 Apr 2022 17:36:11 +0100 Subject: [PATCH 114/204] todo updated --- Notes/TODO.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 52a912aa..49b7448f 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -31,6 +31,7 @@ Build / packagaing Code * Added exception handler for controller +* Implement http error on exception for controller * Add log functionality * Integrate azure insight From c0e4d76b47e0473628f7b36937399d541c4d0ae0 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 19 Apr 2022 17:40:21 +0100 Subject: [PATCH 115/204] removed unused class refactored the number of data records to be generated --- .../DbContextDataInitializer.cs | 2 +- .../EntityFrameworkCoreInitializer.cs | 45 ------------------- 2 files changed, 1 insertion(+), 46 deletions(-) delete mode 100644 Infrastructure.EFCore/Eisk.EFCore.Setup/EntityFrameworkCoreInitializer.cs diff --git a/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs b/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs index 5b1f1007..deb4d3a5 100644 --- a/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs +++ b/Infrastructure.EFCore/Eisk.EFCore.Setup/DbContextDataInitializer.cs @@ -24,7 +24,7 @@ public static void Initialize(AppDbContext context) var employeeDataFactory = new EmployeeDataFactory(); var testEmployees = new List(); - for (int i = 0; i < 100; i++) + for (int i = 0; i < 10; i++) testEmployees.Add(employeeDataFactory.Factory_Entity()); context.Employees.AddRange(testEmployees); diff --git a/Infrastructure.EFCore/Eisk.EFCore.Setup/EntityFrameworkCoreInitializer.cs b/Infrastructure.EFCore/Eisk.EFCore.Setup/EntityFrameworkCoreInitializer.cs deleted file mode 100644 index cb76f30d..00000000 --- a/Infrastructure.EFCore/Eisk.EFCore.Setup/EntityFrameworkCoreInitializer.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using Eisk.DataServices.EFCore.DataContext; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; - -namespace Eisk.EFCore.Setup; - -public class EntityFrameworkCoreInitializer -{ - public static EntityFrameworkCoreInitializer Factory(IServiceCollection services, IConfiguration configuration) - { - return new EntityFrameworkCoreInitializer(services, configuration); - } - - private readonly IServiceCollection _services; - private readonly IConfiguration _configuration; - private readonly IHostEnvironment _hostingEnvironment; - public EntityFrameworkCoreInitializer(IServiceCollection services, IConfiguration configuration) - { - _services = services; - _configuration = configuration; - - IServiceProvider serviceProvider = _services.BuildServiceProvider(); - _hostingEnvironment = serviceProvider.GetService(); - } - - public void AddDbContext() - { - if (_hostingEnvironment.IsDevelopment()) - _services.AddScoped(); - else - _services.AddScoped(x => new SqlServerDbContext(_configuration)); - } - - public static void AddSeedDataToDbContext(IHostEnvironment hostingEnvironment, IConfiguration configuration) - { - if (hostingEnvironment.IsDevelopment()) - DbContextDataInitializer.Initialize(new InMemoryDbContext()); - else - DbContextDataInitializer.Initialize(new SqlServerDbContext(configuration)); - - } -} From e938be900c94d1f5c9e592f395a70d35ac652ff7 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 19 Apr 2022 18:03:23 +0100 Subject: [PATCH 116/204] update --- Notes/TODO.txt | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 49b7448f..4ab01546 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -3,12 +3,6 @@ TODO: Today * Re-visit exception classes -* Apply custom business logic -* Add field for email -* Add field for URL -* Include view model example -* Firing exception when field constraint (i.e. length) is not applied - * review template documentations * check rendered output for template with VS * check conditional rendering (file) @@ -20,9 +14,11 @@ N/A * Apply rules logic in custom data generator TODO: Fix CI (Remote) + R * Rename eisk.webapi.template to eisk.template Fix CD (Remote) + * Publish git repo to integrate with with git release task * Publish to VS Gallery * Create staging api app service for V8 @@ -30,26 +26,41 @@ Fix CD (Remote) Build / packagaing Code -* Added exception handler for controller -* Implement http error on exception for controller -* Add log functionality -* Integrate azure insight + +R * Custom logic + * Apply custom business logic + * Add field for email + * Add field for URL +R * Error handling + * Added exception handler for controller + * Implement http error on exception for controller + * Firing exception when field constraint (i.e. length) is not applied +* Log + * Add log functionality + * Integrate azure insight + +* Include view model example Testing + * Set db fixture with assesbmly set-up * Sql server integration tests: load from config +* Add web tests * Create postman based test file (for template only) * Test post and update methods * Include ORM tests * Identify test strategy, check base tests usability Release Tasks + * Merge V9.0 branch to master * Publish nuget package to nuget gallery * Publish documentation (soft release) + * Publish to VS Gallery Others + * Explore new .net features * Include instruction for template build and publish * Rename Eisk.DomainServices.ComponentTests.EFCore -> Eisk.DomainServices.ComponentTests? From 9113b143d8476389a63fd56b2cbbd0608750e5ef Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 19 Apr 2022 18:10:06 +0100 Subject: [PATCH 117/204] converted to file scope namespace --- .../FieldGenerators/DomainUriGenerator.cs | 87 +++++++++---------- .../FieldGenerators/IntegerValueGenerator.cs | 29 +++---- .../FieldGenerators/StringValueGenerator.cs | 29 +++---- 3 files changed, 71 insertions(+), 74 deletions(-) diff --git a/Core/Eisk.Test.Core/DataGen/FieldGenerators/DomainUriGenerator.cs b/Core/Eisk.Test.Core/DataGen/FieldGenerators/DomainUriGenerator.cs index 46430340..172b9755 100644 --- a/Core/Eisk.Test.Core/DataGen/FieldGenerators/DomainUriGenerator.cs +++ b/Core/Eisk.Test.Core/DataGen/FieldGenerators/DomainUriGenerator.cs @@ -2,66 +2,65 @@ using AutoFixture; using AutoFixture.Kernel; -namespace Eisk.Test.Core.DataGen.FieldGenerators +namespace Eisk.Test.Core.DataGen.FieldGenerators; + +/// +/// Creates new instances. +/// +public class DomainUriGenerator { + private readonly int _minSize, _maxSize; + private readonly bool _appendPath; + + public DomainUriGenerator(int minSize = 1, int maxSize = int.MaxValue, bool appendPath = true) + { + _minSize = minSize; + _maxSize = maxSize; + _appendPath = appendPath; + } + /// - /// Creates new instances. + /// Creates a new specimen based on a request. /// - public class DomainUriGenerator + /// The request that describes what to create. + /// A context that can be used to create other specimens. + /// + /// The requested specimen if possible; otherwise a instance. + /// + public object Create(object request, ISpecimenContext context) { - private readonly int _minSize, _maxSize; - private readonly bool _appendPath; - - public DomainUriGenerator(int minSize = 1, int maxSize = int.MaxValue, bool appendPath = true) + if (context == null) { - _minSize = minSize; - _maxSize = maxSize; - _appendPath = appendPath; + throw new ArgumentNullException(nameof(context)); } - /// - /// Creates a new specimen based on a request. - /// - /// The request that describes what to create. - /// A context that can be used to create other specimens. - /// - /// The requested specimen if possible; otherwise a instance. - /// - public object Create(object request, ISpecimenContext context) + if (!typeof(Uri).Equals(request)) { - if (context == null) - { - throw new ArgumentNullException(nameof(context)); - } - - if (!typeof (Uri).Equals(request)) - { #pragma warning disable 618 - return new NoSpecimen(); + return new NoSpecimen(); #pragma warning restore 618 - } + } - var scheme = context.Resolve(typeof (UriScheme)) as UriScheme; - if (scheme == null) - { + var scheme = context.Resolve(typeof(UriScheme)) as UriScheme; + if (scheme == null) + { #pragma warning disable 618 - return new NoSpecimen(); + return new NoSpecimen(); #pragma warning restore 618 - } - - return CreateUri(scheme, context); } - private Uri CreateUri(UriScheme scheme, ISpecimenContext context) - { - string suffix = string.Empty; + return CreateUri(scheme, context); + } - ConstrainedStringRequest constrainedStringRequest = new ConstrainedStringRequest(_minSize, _maxSize); + private Uri CreateUri(UriScheme scheme, ISpecimenContext context) + { + string suffix = string.Empty; - if (_appendPath) - suffix = "/" + context.Resolve(constrainedStringRequest); + ConstrainedStringRequest constrainedStringRequest = new ConstrainedStringRequest(_minSize, _maxSize); - return new Uri(scheme + "://google.com/" + suffix);//TODO: support maxsize constraint - } + if (_appendPath) + suffix = "/" + context.Resolve(constrainedStringRequest); + + return new Uri(scheme + "://google.com/" + suffix);//TODO: support maxsize constraint } -} \ No newline at end of file +} diff --git a/Core/Eisk.Test.Core/DataGen/FieldGenerators/IntegerValueGenerator.cs b/Core/Eisk.Test.Core/DataGen/FieldGenerators/IntegerValueGenerator.cs index 2643fb69..82f661a1 100644 --- a/Core/Eisk.Test.Core/DataGen/FieldGenerators/IntegerValueGenerator.cs +++ b/Core/Eisk.Test.Core/DataGen/FieldGenerators/IntegerValueGenerator.cs @@ -1,21 +1,20 @@ using System; -namespace Eisk.Test.Core.DataGen.FieldGenerators -{ - public class IntegerValueGenerator - { - private readonly int _maxValue; +namespace Eisk.Test.Core.DataGen.FieldGenerators; - public IntegerValueGenerator(int maxValue = Int32.MaxValue) - { - _maxValue = maxValue; - } +public class IntegerValueGenerator +{ + private readonly int _maxValue; - public int Value() - { - return new Random().Next(1,_maxValue); - } + public IntegerValueGenerator(int maxValue = Int32.MaxValue) + { + _maxValue = maxValue; + } - public static int RandomInt => new IntegerValueGenerator().Value(); + public int Value() + { + return new Random().Next(1,_maxValue); } -} \ No newline at end of file + + public static int RandomInt => new IntegerValueGenerator().Value(); +} diff --git a/Core/Eisk.Test.Core/DataGen/FieldGenerators/StringValueGenerator.cs b/Core/Eisk.Test.Core/DataGen/FieldGenerators/StringValueGenerator.cs index 8c45043b..3b0a9685 100644 --- a/Core/Eisk.Test.Core/DataGen/FieldGenerators/StringValueGenerator.cs +++ b/Core/Eisk.Test.Core/DataGen/FieldGenerators/StringValueGenerator.cs @@ -1,21 +1,20 @@ using System; -namespace Eisk.Test.Core.DataGen.FieldGenerators +namespace Eisk.Test.Core.DataGen.FieldGenerators; + +public class StringValueGenerator { - public class StringValueGenerator - { - private readonly string _seedValue; - private readonly bool _generateUniqueValue; + private readonly string _seedValue; + private readonly bool _generateUniqueValue; - public StringValueGenerator(bool generateUniqueValue, string seedValue) - { - _seedValue = seedValue; - _generateUniqueValue = generateUniqueValue; - } + public StringValueGenerator(bool generateUniqueValue, string seedValue) + { + _seedValue = seedValue; + _generateUniqueValue = generateUniqueValue; + } - public override string ToString() - { - return !_generateUniqueValue ? _seedValue : _seedValue + "_" + Guid.NewGuid(); - } + public override string ToString() + { + return !_generateUniqueValue ? _seedValue : _seedValue + "_" + Guid.NewGuid(); } -} \ No newline at end of file +} From dfe0bdb207d2c331b2b30b7995bdb900c1bd4bdd Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 19 Apr 2022 18:19:54 +0100 Subject: [PATCH 118/204] code cleanup (profile 1) --- Core/Eisk.Core.Tests/UnitTest1.cs | 2 +- .../DataService/EFCore/EntityDataService.cs | 2 +- Core/Eisk.Core/DomainService/DomainService.cs | 4 ++-- Core/Eisk.Core/Exceptions/DomainException.cs | 2 +- .../InvalidLookupIdParameterException.cs | 2 +- .../Exceptions/NonExistantEntityException.cs | 2 +- .../Exceptions/NullInputEntityException.cs | 4 ++-- .../Exceptions/UpdatingIdIsNotSupported.cs | 4 ++-- Core/Eisk.Core/WebApi/WebApiControllerBase.cs | 10 +++++----- Core/Eisk.Test.Core.Tests/UnitTest1.cs | 2 +- .../DataGen/DataFactories/EntityDataFactory.cs | 4 ++-- .../DataGen/FieldGenerators/DomainUriGenerator.cs | 4 ++-- .../FieldGenerators/IntegerValueGenerator.cs | 2 +- .../InvalidData/StringWithSpecialCharacters.cs | 2 +- .../DataGen/StringAttributeAggregatedRelay.cs | 8 ++++---- .../TestBases/DataServiceBaseIntegrationTests.cs | 14 +++++++------- .../DataServiceSqlServerBaseIntegrationTests.cs | 4 ++-- .../TestBases/DomainServiceBaseComponentTests.cs | 14 +++++++------- Core/Eisk.Test.Core/TestBases/EntityTestBase.cs | 10 +++++----- Core/Eisk.Test.Core/TestBases/TestBase.cs | 2 +- .../IEmployeeDataService.cs | 2 +- .../EmployeeDomainServiceUnitTests.cs | 4 ++-- .../Eisk.Domains.TestData/EmployeeDataFactory.cs | 6 +++--- DomainCore/Eisk.Domains/BaseEntities/Person.cs | 4 ++-- DomainCore/Eisk.Domains/ValueObjects/Address.cs | 2 +- .../EmployeeDataService.cs | 6 +++--- .../EmployeeDataServiceTestsWithInMemoryDb.cs | 4 ++-- .../DatabaseSetup.cs | 2 +- .../EmployeeDataServiceTestsWithSqlServer.cs | 10 +++++----- .../EmployeeDomainServiceComponentTests.cs | 2 +- .../Eisk.EFCore.Setup/InMemoryDbContext.cs | 6 +++--- .../Eisk.EFCore.Setup/SqlServerDbContext.cs | 4 ++-- .../Eisk.WebApi/Controllers/EmployeesController.cs | 4 ++-- 33 files changed, 77 insertions(+), 77 deletions(-) diff --git a/Core/Eisk.Core.Tests/UnitTest1.cs b/Core/Eisk.Core.Tests/UnitTest1.cs index b87a7605..a7d0ffcf 100644 --- a/Core/Eisk.Core.Tests/UnitTest1.cs +++ b/Core/Eisk.Core.Tests/UnitTest1.cs @@ -7,6 +7,6 @@ public class UnitTest1 [Fact] public void Test1() { - + } } diff --git a/Core/Eisk.Core/DataService/EFCore/EntityDataService.cs b/Core/Eisk.Core/DataService/EFCore/EntityDataService.cs index 226c4bb1..27545e5b 100644 --- a/Core/Eisk.Core/DataService/EFCore/EntityDataService.cs +++ b/Core/Eisk.Core/DataService/EFCore/EntityDataService.cs @@ -26,7 +26,7 @@ public virtual async Task> GetAll() public virtual async Task Add(TEntity entity) { var obj = DbContext.Add(entity); -; + ; await DbContext.SaveChangesAsync(); return obj.Entity; diff --git a/Core/Eisk.Core/DomainService/DomainService.cs b/Core/Eisk.Core/DomainService/DomainService.cs index 01de2bce..accf6e0c 100644 --- a/Core/Eisk.Core/DomainService/DomainService.cs +++ b/Core/Eisk.Core/DomainService/DomainService.cs @@ -1,7 +1,7 @@ -using System; +using Eisk.Core.Exceptions; +using System; using System.Collections.Generic; using System.Threading.Tasks; -using Eisk.Core.Exceptions; namespace Eisk.Core.DomainService; diff --git a/Core/Eisk.Core/Exceptions/DomainException.cs b/Core/Eisk.Core/Exceptions/DomainException.cs index cd3fe99c..fae600ba 100644 --- a/Core/Eisk.Core/Exceptions/DomainException.cs +++ b/Core/Eisk.Core/Exceptions/DomainException.cs @@ -1,6 +1,6 @@ namespace Eisk.Core.Exceptions; -public class DomainException: CoreException +public class DomainException : CoreException { public DomainException(string message = null, string errorCode = null) : base(message, errorCode) { diff --git a/Core/Eisk.Core/Exceptions/InvalidLookupIdParameterException.cs b/Core/Eisk.Core/Exceptions/InvalidLookupIdParameterException.cs index f8384541..77f6e54d 100644 --- a/Core/Eisk.Core/Exceptions/InvalidLookupIdParameterException.cs +++ b/Core/Eisk.Core/Exceptions/InvalidLookupIdParameterException.cs @@ -1,6 +1,6 @@ namespace Eisk.Core.Exceptions; -public class InvalidLookupIdParameterException: DomainException +public class InvalidLookupIdParameterException : DomainException { public InvalidLookupIdParameterException(string paramName = "id") : base( $"Invalid lookup parameter: {paramName} to find {typeof(TEntity).Name}.", "APP-DATA-ERROR-001") diff --git a/Core/Eisk.Core/Exceptions/NonExistantEntityException.cs b/Core/Eisk.Core/Exceptions/NonExistantEntityException.cs index bbf92497..37e76f25 100644 --- a/Core/Eisk.Core/Exceptions/NonExistantEntityException.cs +++ b/Core/Eisk.Core/Exceptions/NonExistantEntityException.cs @@ -6,6 +6,6 @@ public class NonExistantEntityException : DomainException public NonExistantEntityException(object paramValue, string paramName = "id") : base( $"No {typeof(TEntity).Name} exists for given id {paramValue} for parameter {paramName}.", "APP-DATA-ERROR-002") { - + } } diff --git a/Core/Eisk.Core/Exceptions/NullInputEntityException.cs b/Core/Eisk.Core/Exceptions/NullInputEntityException.cs index dc95ac48..796c5062 100644 --- a/Core/Eisk.Core/Exceptions/NullInputEntityException.cs +++ b/Core/Eisk.Core/Exceptions/NullInputEntityException.cs @@ -1,9 +1,9 @@ namespace Eisk.Core.Exceptions; -public class NullInputEntityException : DomainException +public class NullInputEntityException : DomainException { public NullInputEntityException() : base("Input object to be created or updated is null.", "APP-DATA-ERROR-003") { - + } } diff --git a/Core/Eisk.Core/Exceptions/UpdatingIdIsNotSupported.cs b/Core/Eisk.Core/Exceptions/UpdatingIdIsNotSupported.cs index f694842a..98676b78 100644 --- a/Core/Eisk.Core/Exceptions/UpdatingIdIsNotSupported.cs +++ b/Core/Eisk.Core/Exceptions/UpdatingIdIsNotSupported.cs @@ -1,11 +1,11 @@ namespace Eisk.Core.Exceptions; -public class UpdatingIdIsNotSupported: DomainException +public class UpdatingIdIsNotSupported : DomainException { public UpdatingIdIsNotSupported(object paramValue, string paramName = "id") : base( $"Updating {typeof(TEntity).Name} field {paramName} is not supported. Provided value: {paramValue}.", "APP-DATA-ERROR-004") { - + } } diff --git a/Core/Eisk.Core/WebApi/WebApiControllerBase.cs b/Core/Eisk.Core/WebApi/WebApiControllerBase.cs index 87d842b2..d605a1ba 100644 --- a/Core/Eisk.Core/WebApi/WebApiControllerBase.cs +++ b/Core/Eisk.Core/WebApi/WebApiControllerBase.cs @@ -1,16 +1,16 @@ -using System.Collections.Generic; -using System.Threading.Tasks; -using Eisk.Core.DomainService; +using Eisk.Core.DomainService; using Microsoft.AspNetCore.Mvc; +using System.Collections.Generic; +using System.Threading.Tasks; namespace Eisk.Core.WebApi; [ApiController] [Route("api/[controller]")] -public abstract class WebApiControllerBase: ControllerBase +public abstract class WebApiControllerBase : ControllerBase where TDomain : class, new() { - protected DomainService DomainService; + protected DomainService DomainService; protected WebApiControllerBase(DomainService domainService) { DomainService = domainService; diff --git a/Core/Eisk.Test.Core.Tests/UnitTest1.cs b/Core/Eisk.Test.Core.Tests/UnitTest1.cs index de1fb87d..6f77f38c 100644 --- a/Core/Eisk.Test.Core.Tests/UnitTest1.cs +++ b/Core/Eisk.Test.Core.Tests/UnitTest1.cs @@ -7,6 +7,6 @@ public class UnitTest1 [Fact] public void Test1() { - //test- update from submodule .. more update + //test- update from submodule .. more update } } diff --git a/Core/Eisk.Test.Core/DataGen/DataFactories/EntityDataFactory.cs b/Core/Eisk.Test.Core/DataGen/DataFactories/EntityDataFactory.cs index 35cbec2f..06d5cf2a 100644 --- a/Core/Eisk.Test.Core/DataGen/DataFactories/EntityDataFactory.cs +++ b/Core/Eisk.Test.Core/DataGen/DataFactories/EntityDataFactory.cs @@ -1,6 +1,6 @@ -using System; -using AutoFixture; +using AutoFixture; using AutoFixture.DataAnnotations; +using System; namespace Eisk.Test.Core.DataGen.DataFactories; diff --git a/Core/Eisk.Test.Core/DataGen/FieldGenerators/DomainUriGenerator.cs b/Core/Eisk.Test.Core/DataGen/FieldGenerators/DomainUriGenerator.cs index 172b9755..7ea3f1fa 100644 --- a/Core/Eisk.Test.Core/DataGen/FieldGenerators/DomainUriGenerator.cs +++ b/Core/Eisk.Test.Core/DataGen/FieldGenerators/DomainUriGenerator.cs @@ -1,6 +1,6 @@ -using System; -using AutoFixture; +using AutoFixture; using AutoFixture.Kernel; +using System; namespace Eisk.Test.Core.DataGen.FieldGenerators; diff --git a/Core/Eisk.Test.Core/DataGen/FieldGenerators/IntegerValueGenerator.cs b/Core/Eisk.Test.Core/DataGen/FieldGenerators/IntegerValueGenerator.cs index 82f661a1..9ca5c984 100644 --- a/Core/Eisk.Test.Core/DataGen/FieldGenerators/IntegerValueGenerator.cs +++ b/Core/Eisk.Test.Core/DataGen/FieldGenerators/IntegerValueGenerator.cs @@ -13,7 +13,7 @@ public IntegerValueGenerator(int maxValue = Int32.MaxValue) public int Value() { - return new Random().Next(1,_maxValue); + return new Random().Next(1, _maxValue); } public static int RandomInt => new IntegerValueGenerator().Value(); diff --git a/Core/Eisk.Test.Core/DataGen/InvalidData/StringWithSpecialCharacters.cs b/Core/Eisk.Test.Core/DataGen/InvalidData/StringWithSpecialCharacters.cs index 629d92c1..6e66dec9 100644 --- a/Core/Eisk.Test.Core/DataGen/InvalidData/StringWithSpecialCharacters.cs +++ b/Core/Eisk.Test.Core/DataGen/InvalidData/StringWithSpecialCharacters.cs @@ -2,7 +2,7 @@ namespace Eisk.Test.Core.DataGen.InvalidData; using FieldGenerators; -public class StringWithSpecialCharacters:StringValueGenerator +public class StringWithSpecialCharacters : StringValueGenerator { public StringWithSpecialCharacters(bool generateUniqueValie = true, string value = "@@@@###%%%_string_with_special_characters") : base(generateUniqueValie, value) { } } diff --git a/Core/Eisk.Test.Core/DataGen/StringAttributeAggregatedRelay.cs b/Core/Eisk.Test.Core/DataGen/StringAttributeAggregatedRelay.cs index 92b328e6..638bb178 100644 --- a/Core/Eisk.Test.Core/DataGen/StringAttributeAggregatedRelay.cs +++ b/Core/Eisk.Test.Core/DataGen/StringAttributeAggregatedRelay.cs @@ -1,10 +1,10 @@ -using System; +using AutoFixture.Kernel; +using Eisk.Core.Utils; +using Eisk.Test.Core.DataGen.FieldGenerators; +using System; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Reflection; -using AutoFixture.Kernel; -using Eisk.Core.Utils; -using Eisk.Test.Core.DataGen.FieldGenerators; namespace Eisk.Test.Core.DataGen; diff --git a/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs b/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs index 1aebf5bb..42527221 100644 --- a/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs +++ b/Core/Eisk.Test.Core/TestBases/DataServiceBaseIntegrationTests.cs @@ -14,7 +14,7 @@ public abstract class DataServiceBaseIntegrationTests : EntityTest private readonly IEntityDataService _dataService; protected DataServiceBaseIntegrationTests(IEntityDataService dataService, Expression> idExpression, EntityDataFactory entityDataFactory = null) - :base(idExpression, entityDataFactory) + : base(idExpression, entityDataFactory) { _dataService = dataService; } @@ -68,7 +68,7 @@ public virtual async Task GetById_ValidIdPassed_ShouldReturnResult() await CreateTestEntityToStore(domain); var idValue = GetIdValueFromEntity(domain); - + //Act var returnedEntity = await dataService.GetById(idValue); @@ -82,13 +82,13 @@ public virtual async Task GetById_EmptyIdPassed_ShouldReturnNull() { //Arrange var dataService = GetServiceInstance(); - + //Act var returnedEntity = await dataService.GetById(default(TId)); //Assert Assert.Null(returnedEntity); - + } [Fact] @@ -143,7 +143,7 @@ public virtual async Task Update_ValidDomainWithRandomIdPassed_ShouldThrowExcept { //Arrange var entityWithRandomId = Factory_EntityWithRandomId(); - + var dataService = GetServiceInstance(); //Act @@ -188,7 +188,7 @@ public virtual async Task Delete_DomainWithEmptyIdPassed_ShouldThrowException() //Arrange var inputEntity = Factory_Entity(); var dataService = GetServiceInstance(); - + //Act var returnedException = await Record.ExceptionAsync(() => dataService.Delete(inputEntity)); @@ -202,7 +202,7 @@ public virtual async Task Delete_DomainWithRandomIdPassed_ShouldThrowException() //Arrange var inputEntity = Factory_EntityWithRandomId(); var dataService = GetServiceInstance(); - + //Act var ex = await Record.ExceptionAsync(() => dataService.Delete(inputEntity)); diff --git a/Core/Eisk.Test.Core/TestBases/DataServiceSqlServerBaseIntegrationTests.cs b/Core/Eisk.Test.Core/TestBases/DataServiceSqlServerBaseIntegrationTests.cs index bfe82ae5..a46ffaf1 100644 --- a/Core/Eisk.Test.Core/TestBases/DataServiceSqlServerBaseIntegrationTests.cs +++ b/Core/Eisk.Test.Core/TestBases/DataServiceSqlServerBaseIntegrationTests.cs @@ -13,9 +13,9 @@ public abstract class DataServiceSqlServerBaseIntegrationTests : D where TEntity : class, new() { protected DataServiceSqlServerBaseIntegrationTests(IEntityDataService dataService, Expression> idExpression, EntityDataFactory entityDataFactory = null) - :base(dataService, idExpression, entityDataFactory) + : base(dataService, idExpression, entityDataFactory) { - + } diff --git a/Core/Eisk.Test.Core/TestBases/DomainServiceBaseComponentTests.cs b/Core/Eisk.Test.Core/TestBases/DomainServiceBaseComponentTests.cs index 778ca7fc..3c503311 100644 --- a/Core/Eisk.Test.Core/TestBases/DomainServiceBaseComponentTests.cs +++ b/Core/Eisk.Test.Core/TestBases/DomainServiceBaseComponentTests.cs @@ -1,9 +1,9 @@ -using System; -using System.Linq.Expressions; -using System.Threading.Tasks; -using Eisk.Core.DomainService; +using Eisk.Core.DomainService; using Eisk.Core.Exceptions; using Eisk.Test.Core.DataGen.DataFactories; +using System; +using System.Linq.Expressions; +using System.Threading.Tasks; using Xunit; namespace Eisk.Test.Core.TestBases; @@ -15,7 +15,7 @@ public abstract class DomainServiceBaseComponentTests : EntityTest private readonly DomainService _domainService; protected DomainServiceBaseComponentTests(DomainService domainService, - Expression> idExpression, EntityDataFactory entityDataFactory) :base(idExpression, entityDataFactory) + Expression> idExpression, EntityDataFactory entityDataFactory) : base(idExpression, entityDataFactory) { _domainService = domainService; } @@ -134,7 +134,7 @@ public virtual async Task Delete_DomainWithValidIdPassed_ShouldDeleteSuccessfull //Act + Assert await domainService.Delete(idValue); - + } [Fact] @@ -146,6 +146,6 @@ public virtual async Task Delete_DomainWithEmptyIdPassed_ShouldThrowException() //Act + Assert await Assert.ThrowsAsync>(() => domainService.Delete(emptyIdValue)); - + } } diff --git a/Core/Eisk.Test.Core/TestBases/EntityTestBase.cs b/Core/Eisk.Test.Core/TestBases/EntityTestBase.cs index 71df86ab..25c709ce 100644 --- a/Core/Eisk.Test.Core/TestBases/EntityTestBase.cs +++ b/Core/Eisk.Test.Core/TestBases/EntityTestBase.cs @@ -1,7 +1,7 @@ -using System; -using System.Linq.Expressions; -using Eisk.Core.Utils; +using Eisk.Core.Utils; using Eisk.Test.Core.DataGen.DataFactories; +using System; +using System.Linq.Expressions; namespace Eisk.Test.Core.TestBases; @@ -9,13 +9,13 @@ public abstract class EntityTestBase : TestBase where TEntity : class, new() { protected readonly Expression> DbIdExpression; - + EntityDataFactory _entityDataFactory; protected EntityDataFactory EntityDataFactory { get { - if (_entityDataFactory == null) + if (_entityDataFactory == null) _entityDataFactory = new EntityDataFactory(); return _entityDataFactory; ; diff --git a/Core/Eisk.Test.Core/TestBases/TestBase.cs b/Core/Eisk.Test.Core/TestBases/TestBase.cs index e14b62b5..770fdf85 100644 --- a/Core/Eisk.Test.Core/TestBases/TestBase.cs +++ b/Core/Eisk.Test.Core/TestBases/TestBase.cs @@ -19,5 +19,5 @@ protected static void ExpectException(Action action, Assert.Equal(expectedException.Message, actualException.Message); Assert.Equal(expectedException.ErrorCode, actualException.ErrorCode); } - + } diff --git a/DomainCore/Eisk.DataServices.Interfaces/IEmployeeDataService.cs b/DomainCore/Eisk.DataServices.Interfaces/IEmployeeDataService.cs index cff67c85..ae50e883 100644 --- a/DomainCore/Eisk.DataServices.Interfaces/IEmployeeDataService.cs +++ b/DomainCore/Eisk.DataServices.Interfaces/IEmployeeDataService.cs @@ -6,7 +6,7 @@ namespace Eisk.DataServices.Interfaces; using Core.DataService; using Domains.Entities; -public interface IEmployeeDataService: IEntityDataService +public interface IEmployeeDataService : IEntityDataService { Task> GetByFirstName(string firstName); diff --git a/DomainCore/Eisk.DomainServices.UnitTests/EmployeeDomainServiceUnitTests.cs b/DomainCore/Eisk.DomainServices.UnitTests/EmployeeDomainServiceUnitTests.cs index 3c1bb52c..c4d0c43b 100644 --- a/DomainCore/Eisk.DomainServices.UnitTests/EmployeeDomainServiceUnitTests.cs +++ b/DomainCore/Eisk.DomainServices.UnitTests/EmployeeDomainServiceUnitTests.cs @@ -21,7 +21,7 @@ static Mock Factory_DataService() static EmployeeDomainService Factory_DomainService() { - return new EmployeeDomainService(Factory_DataService().Object) ; + return new EmployeeDomainService(Factory_DataService().Object); } #endregion @@ -30,7 +30,7 @@ static EmployeeDomainService Factory_DomainService() public async Task Add_NullEmployeePassed_ShouldThrowExceptionAsync() { //Act + Assert - var error = await Assert.ThrowsAsync>(testCode: () => Factory_DomainService().Add(null)); + var error = await Assert.ThrowsAsync>(testCode: () => Factory_DomainService().Add(null)); //Assert Assert.Equal("Input object to be created or updated is null.", error.Message); diff --git a/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs b/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs index 5ebe59da..f1ec5748 100644 --- a/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs +++ b/DomainCore/Eisk.Domains.TestData/EmployeeDataFactory.cs @@ -6,13 +6,13 @@ namespace Eisk.Domains.TestData; using Entities; using Enums; -public class EmployeeDataFactory:EntityDomainDataFactory +public class EmployeeDataFactory : EntityDomainDataFactory { string[] _jobTitles = new string[] { "Vice President", "Director", "Manager", "Executive", "Sales Executive", "Management Trainee" }; protected override void AssignDomainData(Employee employee) { var faker = new Faker(); - + employee.Id = 0; employee.ReportsTo = null; employee.ReportsToId = null; @@ -36,7 +36,7 @@ protected override void AssignDomainData(Employee employee) employee.HireDate = faker.Date.Future(); employee.Title = faker.PickRandomParam(_jobTitles); employee.Phone = faker.Person.Phone; - employee.Extension = faker.Person.Random.Number(0,999).ToString("000"); + employee.Extension = faker.Person.Random.Number(0, 999).ToString("000"); employee.Photo = null; diff --git a/DomainCore/Eisk.Domains/BaseEntities/Person.cs b/DomainCore/Eisk.Domains/BaseEntities/Person.cs index b05507e3..1a235b75 100644 --- a/DomainCore/Eisk.Domains/BaseEntities/Person.cs +++ b/DomainCore/Eisk.Domains/BaseEntities/Person.cs @@ -1,7 +1,7 @@ -using System; +using Eisk.Domains.Enums; +using System; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using Eisk.Domains.Enums; namespace Eisk.Domains.BaseEntities; diff --git a/DomainCore/Eisk.Domains/ValueObjects/Address.cs b/DomainCore/Eisk.Domains/ValueObjects/Address.cs index 1c777989..257c7882 100644 --- a/DomainCore/Eisk.Domains/ValueObjects/Address.cs +++ b/DomainCore/Eisk.Domains/ValueObjects/Address.cs @@ -23,5 +23,5 @@ public class Address [Required(ErrorMessage = "Country required.")] [StringLength(80)] public string Country { get; set; } - + } diff --git a/Infrastructure.EFCore/Eisk.DataServices.EFCore/EmployeeDataService.cs b/Infrastructure.EFCore/Eisk.DataServices.EFCore/EmployeeDataService.cs index 9a33ef14..976dfb8a 100644 --- a/Infrastructure.EFCore/Eisk.DataServices.EFCore/EmployeeDataService.cs +++ b/Infrastructure.EFCore/Eisk.DataServices.EFCore/EmployeeDataService.cs @@ -1,14 +1,14 @@ +using Eisk.Core.DataService.EFCore; +using Microsoft.EntityFrameworkCore; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Eisk.Core.DataService.EFCore; -using Microsoft.EntityFrameworkCore; namespace Eisk.DataServices.EFCore; using DataContext; -using Interfaces; using Domains.Entities; +using Interfaces; public class EmployeeDataService : EntityDataService, IEmployeeDataService { diff --git a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.InMemory/EmployeeDataServiceTestsWithInMemoryDb.cs b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.InMemory/EmployeeDataServiceTestsWithInMemoryDb.cs index 94eac026..97a716c2 100644 --- a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.InMemory/EmployeeDataServiceTestsWithInMemoryDb.cs +++ b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.InMemory/EmployeeDataServiceTestsWithInMemoryDb.cs @@ -1,9 +1,9 @@ namespace Eisk.DataServices.IntegrationTests.EFCore.InMemory; using Domains.Entities; -using Test.Core.TestBases; -using Eisk.EFCore.Setup; using Eisk.DataServices.EFCore; +using Eisk.EFCore.Setup; +using Test.Core.TestBases; public class EmployeeDataServiceTestsWithInMemoryDb : DataServiceBaseIntegrationTests { diff --git a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/DatabaseSetup.cs b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/DatabaseSetup.cs index 6863d094..bc1f0be6 100644 --- a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/DatabaseSetup.cs +++ b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/DatabaseSetup.cs @@ -15,5 +15,5 @@ public void Dispose() { // ... clean up test data from the database ... } - + } diff --git a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/EmployeeDataServiceTestsWithSqlServer.cs b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/EmployeeDataServiceTestsWithSqlServer.cs index bc1001f1..421513e4 100644 --- a/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/EmployeeDataServiceTestsWithSqlServer.cs +++ b/Infrastructure.EFCore/Eisk.DataServices.IntegrationTests.EFCore.SqlServer/EmployeeDataServiceTestsWithSqlServer.cs @@ -3,16 +3,16 @@ namespace Eisk.DataServices.IntegrationTests.EFCore.SqlServer; using Domains.Entities; -using Test.Core.TestBases; using Domains.TestData; -using Eisk.EFCore.Setup; using Eisk.DataServices.EFCore; +using Eisk.EFCore.Setup; +using Test.Core.TestBases; -public class EmployeeDataServiceTestsWithSqlServer: DataServiceSqlServerBaseIntegrationTests, IClassFixture +public class EmployeeDataServiceTestsWithSqlServer : DataServiceSqlServerBaseIntegrationTests, IClassFixture { - public EmployeeDataServiceTestsWithSqlServer(): base(new EmployeeDataService(TestDbContextFactory.CreateSqlServerDbContext()), x => x.Id, new EmployeeDataFactory()) + public EmployeeDataServiceTestsWithSqlServer() : base(new EmployeeDataService(TestDbContextFactory.CreateSqlServerDbContext()), x => x.Id, new EmployeeDataFactory()) { - + } } diff --git a/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/EmployeeDomainServiceComponentTests.cs b/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/EmployeeDomainServiceComponentTests.cs index 52e8ddd2..7a0581d8 100644 --- a/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/EmployeeDomainServiceComponentTests.cs +++ b/Infrastructure.EFCore/Eisk.DomainServices.ComponentTests.EFCore/EmployeeDomainServiceComponentTests.cs @@ -11,7 +11,7 @@ public class EmployeeDomainServiceComponentTests : DomainServiceBaseComponentTes public EmployeeDomainServiceComponentTests() : base(new EmployeeDomainService(Factory_DataService()), x => x.Id, new EmployeeDataFactory()) { - + } static EmployeeDataService Factory_DataService() diff --git a/Infrastructure.EFCore/Eisk.EFCore.Setup/InMemoryDbContext.cs b/Infrastructure.EFCore/Eisk.EFCore.Setup/InMemoryDbContext.cs index 606794c8..64915def 100644 --- a/Infrastructure.EFCore/Eisk.EFCore.Setup/InMemoryDbContext.cs +++ b/Infrastructure.EFCore/Eisk.EFCore.Setup/InMemoryDbContext.cs @@ -1,6 +1,6 @@ -using System; -using Eisk.DataServices.EFCore.DataContext; +using Eisk.DataServices.EFCore.DataContext; using Microsoft.EntityFrameworkCore; +using System; namespace Eisk.EFCore.Setup; @@ -11,7 +11,7 @@ public InMemoryDbContext(bool uniqueDbName = false) : base(new DbContextOptionsB { _uniqueDbName = uniqueDbName; } - + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { var dbName = "Eisk" + (_uniqueDbName ? Guid.NewGuid().ToString() : string.Empty); diff --git a/Infrastructure.EFCore/Eisk.EFCore.Setup/SqlServerDbContext.cs b/Infrastructure.EFCore/Eisk.EFCore.Setup/SqlServerDbContext.cs index 594a6f28..c987eca3 100644 --- a/Infrastructure.EFCore/Eisk.EFCore.Setup/SqlServerDbContext.cs +++ b/Infrastructure.EFCore/Eisk.EFCore.Setup/SqlServerDbContext.cs @@ -1,7 +1,7 @@ -using System; -using Eisk.DataServices.EFCore.DataContext; +using Eisk.DataServices.EFCore.DataContext; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; +using System; namespace Eisk.EFCore.Setup; diff --git a/WebApi/Eisk.WebApi/Controllers/EmployeesController.cs b/WebApi/Eisk.WebApi/Controllers/EmployeesController.cs index 84adba9b..b4cf12e8 100644 --- a/WebApi/Eisk.WebApi/Controllers/EmployeesController.cs +++ b/WebApi/Eisk.WebApi/Controllers/EmployeesController.cs @@ -9,8 +9,8 @@ [Route("[controller]")] public class EmployeesController : WebApiControllerBase { - public EmployeesController(EmployeeDomainService employeeDomainService):base(employeeDomainService) + public EmployeesController(EmployeeDomainService employeeDomainService) : base(employeeDomainService) { - + } } From 235acb0848fb3443edbf1b127192f028bb5eefef Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 19 Apr 2022 18:46:36 +0100 Subject: [PATCH 119/204] removed unused semicolon --- Core/Eisk.Core/DataService/EFCore/EntityDataService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/Eisk.Core/DataService/EFCore/EntityDataService.cs b/Core/Eisk.Core/DataService/EFCore/EntityDataService.cs index 27545e5b..f5f11392 100644 --- a/Core/Eisk.Core/DataService/EFCore/EntityDataService.cs +++ b/Core/Eisk.Core/DataService/EFCore/EntityDataService.cs @@ -26,7 +26,7 @@ public virtual async Task> GetAll() public virtual async Task Add(TEntity entity) { var obj = DbContext.Add(entity); - ; + await DbContext.SaveChangesAsync(); return obj.Entity; From 3a2bbca08f63d19307de05cafd00071d949646ad Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 19 Apr 2022 18:51:17 +0100 Subject: [PATCH 120/204] todo updated --- Notes/TODO.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 4ab01546..8c5a9085 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -16,6 +16,7 @@ TODO: Fix CI (Remote) R * Rename eisk.webapi.template to eisk.template +* Convert generated template CI to Yml Fix CD (Remote) From d09fb0e130abdb9eac4d5f4af56d07424c97731e Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Thu, 21 Apr 2022 15:39:31 +0100 Subject: [PATCH 121/204] todo updated --- Notes/TODO.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 8c5a9085..6fb53ecc 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -15,7 +15,7 @@ TODO: Fix CI (Remote) -R * Rename eisk.webapi.template to eisk.template +* Rename eisk.webapi.template to eisk.template * Convert generated template CI to Yml Fix CD (Remote) @@ -44,9 +44,9 @@ R * Error handling Testing +R * Add web tests * Set db fixture with assesbmly set-up * Sql server integration tests: load from config -* Add web tests * Create postman based test file (for template only) * Test post and update methods * Include ORM tests From 1d8ed457cc59ece4e8095021760ef6a9ee44d0bb Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 01:04:24 +0100 Subject: [PATCH 122/204] Update Notes.txt --- Notes/Notes.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Notes/Notes.txt b/Notes/Notes.txt index 8b137891..da9bd061 100644 --- a/Notes/Notes.txt +++ b/Notes/Notes.txt @@ -1 +1,23 @@ +======== +Samples Use Cases +* Empty (no domain) + +Single Entity +* Minimal code domain crud - Web controller base, with generic domain and data service +* All base classes (no custom method) +* All base classes (with custom method) +* No base classes (with custom method) + +Multiple Entities +* 1:m +* m:1 +* m:m + +Query features +* Raw text query +* Aggregate query (count, sum) +* Stored procedure +* Db function +* View +======== From 436fd4cb0581a0e212314b62f9ebe24350c57ea9 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 01:08:36 +0100 Subject: [PATCH 123/204] Update Notes.txt --- Notes/Notes.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Notes/Notes.txt b/Notes/Notes.txt index da9bd061..0354b897 100644 --- a/Notes/Notes.txt +++ b/Notes/Notes.txt @@ -8,6 +8,8 @@ Single Entity * All base classes (with custom method) * No base classes (with custom method) +* On demand base classes (create and get only?) + Multiple Entities * 1:m * m:1 From 188348ed6f98de7992fd9ec23c142207699c1df0 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 01:10:24 +0100 Subject: [PATCH 124/204] Update Notes.txt --- Notes/Notes.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Notes/Notes.txt b/Notes/Notes.txt index 0354b897..e7157a3b 100644 --- a/Notes/Notes.txt +++ b/Notes/Notes.txt @@ -8,7 +8,7 @@ Single Entity * All base classes (with custom method) * No base classes (with custom method) -* On demand base classes (create and get only?) +* On demand base classes (create and get only?) - using service utility class as property instead of using as base class Multiple Entities * 1:m From af3d1b52daef2b2990f7406a4bd4de29f3cc76e7 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 01:11:44 +0100 Subject: [PATCH 125/204] Update Notes.txt --- Notes/Notes.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Notes/Notes.txt b/Notes/Notes.txt index e7157a3b..413e8211 100644 --- a/Notes/Notes.txt +++ b/Notes/Notes.txt @@ -3,11 +3,13 @@ Samples Use Cases * Empty (no domain) Single Entity + * Minimal code domain crud - Web controller base, with generic domain and data service + * All base classes (no custom method) * All base classes (with custom method) -* No base classes (with custom method) +* No base classes (with custom method) * On demand base classes (create and get only?) - using service utility class as property instead of using as base class Multiple Entities From 3c471abea7f2391ff69df8d6486e2e9ef3bd2d8c Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 01:13:31 +0100 Subject: [PATCH 126/204] Update Notes.txt --- Notes/Notes.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Notes/Notes.txt b/Notes/Notes.txt index 413e8211..6999ba99 100644 --- a/Notes/Notes.txt +++ b/Notes/Notes.txt @@ -1,5 +1,6 @@ ======== -Samples Use Cases +Samples Use Cases (platform agonistic) + * Empty (no domain) Single Entity @@ -17,7 +18,7 @@ Multiple Entities * m:1 * m:m -Query features +Query Features * Raw text query * Aggregate query (count, sum) * Stored procedure From f0afa6374a4cdda5be5e72e1981a737013d22dc1 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 01:15:43 +0100 Subject: [PATCH 127/204] Rename Notes/Notes.txt to Entity-Use-Cases.txt --- Notes/Notes.txt => Entity-Use-Cases.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Notes/Notes.txt => Entity-Use-Cases.txt (100%) diff --git a/Notes/Notes.txt b/Entity-Use-Cases.txt similarity index 100% rename from Notes/Notes.txt rename to Entity-Use-Cases.txt From e206c17199bdfef9f2e8b19a795dca8d4f76869d Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 01:17:00 +0100 Subject: [PATCH 128/204] Rename Entity-Use-Cases.txt to Notes/Entity-Use-Cases.txt --- Entity-Use-Cases.txt => Notes/Entity-Use-Cases.txt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Entity-Use-Cases.txt => Notes/Entity-Use-Cases.txt (100%) diff --git a/Entity-Use-Cases.txt b/Notes/Entity-Use-Cases.txt similarity index 100% rename from Entity-Use-Cases.txt rename to Notes/Entity-Use-Cases.txt From 9384024a86d8319cf56f514563d7258d365f720a Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 01:17:58 +0100 Subject: [PATCH 129/204] Rename Entity-Use-Cases.txt to Entity-Samples.txt --- Notes/{Entity-Use-Cases.txt => Entity-Samples.txt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Notes/{Entity-Use-Cases.txt => Entity-Samples.txt} (100%) diff --git a/Notes/Entity-Use-Cases.txt b/Notes/Entity-Samples.txt similarity index 100% rename from Notes/Entity-Use-Cases.txt rename to Notes/Entity-Samples.txt From 7620784433a5d1d9f10c29261705b05674531bb1 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 01:29:27 +0100 Subject: [PATCH 130/204] Update Entity-Samples.txt --- Notes/Entity-Samples.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Notes/Entity-Samples.txt b/Notes/Entity-Samples.txt index 6999ba99..09c19767 100644 --- a/Notes/Entity-Samples.txt +++ b/Notes/Entity-Samples.txt @@ -10,7 +10,7 @@ Single Entity * All base classes (no custom method) * All base classes (with custom method) -* No base classes (with custom method) +* No base classes (with custom method and crud) * On demand base classes (create and get only?) - using service utility class as property instead of using as base class Multiple Entities From 8a6c9b6e58e930c7a31dcacbd007dc9ee651eaac Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 01:30:23 +0100 Subject: [PATCH 131/204] Update Entity-Samples.txt --- Notes/Entity-Samples.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Notes/Entity-Samples.txt b/Notes/Entity-Samples.txt index 09c19767..481f6678 100644 --- a/Notes/Entity-Samples.txt +++ b/Notes/Entity-Samples.txt @@ -8,10 +8,10 @@ Single Entity * Minimal code domain crud - Web controller base, with generic domain and data service * All base classes (no custom method) -* All base classes (with custom method) +* All base classes (with custom crud methods) * No base classes (with custom method and crud) -* On demand base classes (create and get only?) - using service utility class as property instead of using as base class +* No base classes (create and get only?) - using service utility class as property instead of using as base class Multiple Entities * 1:m From 6801c00aaca438db2fee436a4ba7fdc0e05da004 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 01:50:03 +0100 Subject: [PATCH 132/204] Update Entity-Samples.txt --- Notes/Entity-Samples.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Notes/Entity-Samples.txt b/Notes/Entity-Samples.txt index 481f6678..1b19af86 100644 --- a/Notes/Entity-Samples.txt +++ b/Notes/Entity-Samples.txt @@ -1,6 +1,11 @@ ======== Samples Use Cases (platform agonistic) +* Different samples for same employee entity to illustrate how to use eisk differently as per design choices. +* The respective sample will be loaded as provided in the optional parameter when creating project from template. +* A default sample will be loaded when no option is provided. +======== + * Empty (no domain) Single Entity From 00b5fcf3229fd32c51cfc5b6c1a09126e623183b Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 02:04:10 +0100 Subject: [PATCH 133/204] Update Entity-Samples.txt --- Notes/Entity-Samples.txt | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/Notes/Entity-Samples.txt b/Notes/Entity-Samples.txt index 1b19af86..6a11ed3c 100644 --- a/Notes/Entity-Samples.txt +++ b/Notes/Entity-Samples.txt @@ -8,22 +8,36 @@ Samples Use Cases (platform agonistic) * Empty (no domain) -Single Entity +Single Entity (Base Classes) * Minimal code domain crud - Web controller base, with generic domain and data service -* All base classes (no custom method) -* All base classes (with custom crud methods) +* All base classes (no custom rules) +* All base classes (with custom rules) -* No base classes (with custom method and crud) -* No base classes (create and get only?) - using service utility class as property instead of using as base class +Single Entity (No Base Classes) +- using service utility class as property instead of using as base class + +* No base classes (with no custom rules and partial crud) - for instance create and get only +* No base classes (with custom rules and partial crud) - for instance create and get only +* No base classes (with custom rules and all crud) + +View Model (Base Classes) + +* With base classes, single view model, no custom rules +* With base classes, single view model, with custom rules + +* With base classes, editor + view model, no custom rules +* With base classes, editor + view model, with custom rules Multiple Entities + * 1:m * m:1 * m:m Query Features + * Raw text query * Aggregate query (count, sum) * Stored procedure From 7c39e167db64f88966f60c6bcc0f7479fa4036fd Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 02:06:32 +0100 Subject: [PATCH 134/204] Update Entity-Samples.txt --- Notes/Entity-Samples.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Notes/Entity-Samples.txt b/Notes/Entity-Samples.txt index 6a11ed3c..dfc73fc3 100644 --- a/Notes/Entity-Samples.txt +++ b/Notes/Entity-Samples.txt @@ -30,6 +30,14 @@ View Model (Base Classes) * With base classes, editor + view model, no custom rules * With base classes, editor + view model, with custom rules +View Model (With out Base Classes) + +* With out base classes, single view model, no custom rules +* With out base classes, single view model, with custom rules + +* With out base classes, editor + view model, no custom rules +* With out base classes, editor + view model, with custom rules + Multiple Entities * 1:m From f2ec59c9f597a80c2531bd025863a31891afcab0 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 02:09:17 +0100 Subject: [PATCH 135/204] Update Entity-Samples.txt --- Notes/Entity-Samples.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Notes/Entity-Samples.txt b/Notes/Entity-Samples.txt index dfc73fc3..bc23c6b9 100644 --- a/Notes/Entity-Samples.txt +++ b/Notes/Entity-Samples.txt @@ -20,6 +20,8 @@ Single Entity (No Base Classes) * No base classes (with no custom rules and partial crud) - for instance create and get only * No base classes (with custom rules and partial crud) - for instance create and get only + +* No base classes (with no custom rules and all crud) * No base classes (with custom rules and all crud) View Model (Base Classes) From f1e9d4ffb364d2a77dc1759b68c5fa6d9ebc5570 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 03:28:38 +0100 Subject: [PATCH 136/204] Update Modules.txt --- Notes/Modules.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Notes/Modules.txt b/Notes/Modules.txt index c701ca2e..c1635425 100644 --- a/Notes/Modules.txt +++ b/Notes/Modules.txt @@ -22,14 +22,22 @@ Domain Layer * DDD (default) * CQRS -Data Service (in-memory) +Data Service Layer Interface +* Persistence ignorant interface + +Data Access Layer +* Entity Framework +* Dapper +* NHibernate + +Data Storage (in-memory) * Memory: EF In-memory (default?) * Memory: SQLLite In-memory * Memory: SQL Server In-memory * Memory: Couchbase In-memory * Memory: Redis -Data Service +Data Storage * RDBMS: SQL Server (default) * Key-Value Pair: Azure Table Storage * Document database: COSMOS From 7a9ae7d4f85c5b0fea2262572af0eb4da477479e Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 03:31:48 +0100 Subject: [PATCH 137/204] Update Entity-Samples.txt --- Notes/Entity-Samples.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Notes/Entity-Samples.txt b/Notes/Entity-Samples.txt index bc23c6b9..7304081f 100644 --- a/Notes/Entity-Samples.txt +++ b/Notes/Entity-Samples.txt @@ -13,7 +13,7 @@ Single Entity (Base Classes) * Minimal code domain crud - Web controller base, with generic domain and data service * All base classes (no custom rules) -* All base classes (with custom rules) +* (default) All base classes (with custom rules) Single Entity (No Base Classes) - using service utility class as property instead of using as base class From d77a00200796c0fcd7fe6a94ae3b2bf74755f01f Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 03:33:55 +0100 Subject: [PATCH 138/204] Update Modules.txt --- Notes/Modules.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Notes/Modules.txt b/Notes/Modules.txt index c1635425..c4979d70 100644 --- a/Notes/Modules.txt +++ b/Notes/Modules.txt @@ -15,7 +15,7 @@ Web API Layer Process Layer * Process.AzureWebJob * Process.AzureLogicApp -* ServerLess.AzureFunction (Scheduler) +* ServerLess.AzureFunction (Scheduler) (default) * ServerLess.AWSLambda Domain Layer @@ -26,12 +26,12 @@ Data Service Layer Interface * Persistence ignorant interface Data Access Layer -* Entity Framework +* Entity Framework (default) * Dapper * NHibernate Data Storage (in-memory) -* Memory: EF In-memory (default?) +* Memory: EF In-memory (default) * Memory: SQLLite In-memory * Memory: SQL Server In-memory * Memory: Couchbase In-memory From ca1839501c4e8d843bb4e997daca6661a294e936 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 04:25:35 +0100 Subject: [PATCH 139/204] Create template-features.txt --- Notes/template-features.txt | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Notes/template-features.txt diff --git a/Notes/template-features.txt b/Notes/template-features.txt new file mode 100644 index 00000000..d060565f --- /dev/null +++ b/Notes/template-features.txt @@ -0,0 +1,11 @@ +* Web API base classes with supported in-memory web tests +* Swagger support +* Exception handling classes and filters + +* Domain Service base classes with supported base component tests with in-memory databases +* Data Service base classes with supported base integration tests with sql server databases + +* Meaningful test data generators + +* DevOps pipeline to build and run tests +* DevOps pipeline to deploy in azure app services From 199319270eb2de97d4766af9e49cd0c1c503e566 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 04:25:56 +0100 Subject: [PATCH 140/204] Rename template-features.txt to Template-Features.txt --- Notes/{template-features.txt => Template-Features.txt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Notes/{template-features.txt => Template-Features.txt} (100%) diff --git a/Notes/template-features.txt b/Notes/Template-Features.txt similarity index 100% rename from Notes/template-features.txt rename to Notes/Template-Features.txt From dd6253991b2012a6ec894dd311eae08f96ea7e70 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 04:29:04 +0100 Subject: [PATCH 141/204] Update Template-Features.txt --- Notes/Template-Features.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Notes/Template-Features.txt b/Notes/Template-Features.txt index d060565f..054bdb72 100644 --- a/Notes/Template-Features.txt +++ b/Notes/Template-Features.txt @@ -2,7 +2,10 @@ * Swagger support * Exception handling classes and filters +* Domain class example with property attribute, inheritance, value object and enumeration support + * Domain Service base classes with supported base component tests with in-memory databases + * Data Service base classes with supported base integration tests with sql server databases * Meaningful test data generators From 6c47dc75d726edddf2db62eabd6feca2141fda6a Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 18:14:38 +0100 Subject: [PATCH 142/204] Update Program.cs --- WebApi/Eisk.WebApi/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebApi/Eisk.WebApi/Program.cs b/WebApi/Eisk.WebApi/Program.cs index 7ef9ab02..4cf2b5ee 100644 --- a/WebApi/Eisk.WebApi/Program.cs +++ b/WebApi/Eisk.WebApi/Program.cs @@ -17,7 +17,7 @@ c.SwaggerDoc("v1", new OpenApiInfo { Title = "Eisk.WebApi", - Version = "v9.0.5", + Version = "v9.0.6", Description = "EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net core technologies.", Contact = new OpenApiContact { From 1d2909ded05f899ccdbffd2ec9c868441ef4b783 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 23:38:19 +0100 Subject: [PATCH 143/204] Update Modules.txt --- Notes/Modules.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Notes/Modules.txt b/Notes/Modules.txt index c4979d70..a24f031d 100644 --- a/Notes/Modules.txt +++ b/Notes/Modules.txt @@ -46,6 +46,16 @@ Data Storage * Graph database: Neo4J * Columnar database: Cassandra +DevOps +* AzureDevOps +* Github Actions + +Hosting +* Azure App Services +* AWS +* Docker +* Kubernetes + ======================================================== Repo Modules and Dependencies From 88345c0045ac622aebbca40e55cd68296280dc48 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 23:41:02 +0100 Subject: [PATCH 144/204] Update Business-Rules.txt --- Notes/Business-Rules.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Notes/Business-Rules.txt b/Notes/Business-Rules.txt index 5d365390..e901bf59 100644 --- a/Notes/Business-Rules.txt +++ b/Notes/Business-Rules.txt @@ -2,6 +2,7 @@ Business Rules ======================================================== * Single Field Level (Property) + * Required * Length * Regular Expression (phone, email) * Single Field Level (Logic) @@ -14,4 +15,4 @@ Business Rules * DB Check on Foreign Key Table * An employee can have atmost 10 reports ======================================================== - \ No newline at end of file + From 3dede9a7f83d35c111908272a6a2b5b8bb557ae1 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Fri, 22 Apr 2022 23:50:53 +0100 Subject: [PATCH 145/204] Update Modules.txt --- Notes/Modules.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Notes/Modules.txt b/Notes/Modules.txt index a24f031d..f89c0938 100644 --- a/Notes/Modules.txt +++ b/Notes/Modules.txt @@ -46,6 +46,12 @@ Data Storage * Graph database: Neo4J * Columnar database: Cassandra +Authentication +* ASP.NET Identity +* Azure AD b2c +* Azure AD +* Auth 0 + DevOps * AzureDevOps * Github Actions From 4123a254ba806394d0d12a83888a231daddf90b0 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Sat, 23 Apr 2022 00:09:37 +0100 Subject: [PATCH 146/204] Update Modules.txt --- Notes/Modules.txt | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/Notes/Modules.txt b/Notes/Modules.txt index f89c0938..5a6a08e3 100644 --- a/Notes/Modules.txt +++ b/Notes/Modules.txt @@ -19,7 +19,8 @@ Process Layer * ServerLess.AWSLambda Domain Layer -* DDD (default) +* Onion Architecture (default) +* DDD * CQRS Data Service Layer Interface @@ -46,15 +47,25 @@ Data Storage * Graph database: Neo4J * Columnar database: Cassandra +=========================================== +Cross Cutting Concerns and Services + Authentication -* ASP.NET Identity -* Azure AD b2c +* Azure AD B2C * Azure AD -* Auth 0 +* Identity Server +* ASP.NET Identity +* Auth0 -DevOps -* AzureDevOps -* Github Actions +Messagging +* Azure Storage Queue +* Azure Service Bus +* AWS Simple Queue Service + +Logging +* Log4Net +* SeriLog +* Azure Insight Hosting * Azure App Services @@ -62,6 +73,10 @@ Hosting * Docker * Kubernetes +DevOps +* AzureDevOps +* Github Actions + ======================================================== Repo Modules and Dependencies From b1e3cb3524927fba66448a9f890732625eeca6e7 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Sat, 23 Apr 2022 00:20:17 +0100 Subject: [PATCH 147/204] Update Modules.txt --- Notes/Modules.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Notes/Modules.txt b/Notes/Modules.txt index 5a6a08e3..875a3fe5 100644 --- a/Notes/Modules.txt +++ b/Notes/Modules.txt @@ -76,6 +76,7 @@ Hosting DevOps * AzureDevOps * Github Actions +* Vercel ======================================================== Repo Modules and Dependencies From e264946f17ba68c04c822e374b9d1b8ba9725cc7 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Sat, 23 Apr 2022 00:21:32 +0100 Subject: [PATCH 148/204] Update Modules.txt --- Notes/Modules.txt | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Notes/Modules.txt b/Notes/Modules.txt index 875a3fe5..0888d08a 100644 --- a/Notes/Modules.txt +++ b/Notes/Modules.txt @@ -12,12 +12,6 @@ Web API Layer * gRPC - gRPC * GraphAPI - Graph API -Process Layer -* Process.AzureWebJob -* Process.AzureLogicApp -* ServerLess.AzureFunction (Scheduler) (default) -* ServerLess.AWSLambda - Domain Layer * Onion Architecture (default) * DDD @@ -57,16 +51,22 @@ Authentication * ASP.NET Identity * Auth0 -Messagging -* Azure Storage Queue -* Azure Service Bus -* AWS Simple Queue Service - Logging * Log4Net * SeriLog * Azure Insight +Backgeound Process +* Process.AzureWebJob +* Process.AzureLogicApp +* ServerLess.AzureFunction (Scheduler) (default) +* ServerLess.AWSLambda + +Messagging +* Azure Storage Queue +* Azure Service Bus +* AWS Simple Queue Service + Hosting * Azure App Services * AWS From fcaf635c74af0f50b56406655d415ddeb1efa28f Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Sat, 23 Apr 2022 00:23:29 +0100 Subject: [PATCH 149/204] Update Modules.txt --- Notes/Modules.txt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Notes/Modules.txt b/Notes/Modules.txt index 0888d08a..3078ca4a 100644 --- a/Notes/Modules.txt +++ b/Notes/Modules.txt @@ -29,8 +29,6 @@ Data Storage (in-memory) * Memory: EF In-memory (default) * Memory: SQLLite In-memory * Memory: SQL Server In-memory -* Memory: Couchbase In-memory -* Memory: Redis Data Storage * RDBMS: SQL Server (default) @@ -56,6 +54,10 @@ Logging * SeriLog * Azure Insight +Caching +* Memory: Couchbase +* Memory: Redis + Backgeound Process * Process.AzureWebJob * Process.AzureLogicApp From 343f52cf70d6a340c622e9e7ff44e440c32827f2 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Sat, 23 Apr 2022 01:25:49 +0100 Subject: [PATCH 150/204] Update Modules.txt --- Notes/Modules.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Notes/Modules.txt b/Notes/Modules.txt index 3078ca4a..87b4913a 100644 --- a/Notes/Modules.txt +++ b/Notes/Modules.txt @@ -28,7 +28,6 @@ Data Access Layer Data Storage (in-memory) * Memory: EF In-memory (default) * Memory: SQLLite In-memory -* Memory: SQL Server In-memory Data Storage * RDBMS: SQL Server (default) @@ -55,8 +54,9 @@ Logging * Azure Insight Caching -* Memory: Couchbase -* Memory: Redis +* Redis +* Couchbase +* SQL Server In-memory Backgeound Process * Process.AzureWebJob From 86fd6d66da1a9676757ab8864ddfaab83177ab76 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Sat, 23 Apr 2022 01:42:46 +0100 Subject: [PATCH 151/204] Update Entity-Samples.txt --- Notes/Entity-Samples.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Notes/Entity-Samples.txt b/Notes/Entity-Samples.txt index 7304081f..6e8ad32c 100644 --- a/Notes/Entity-Samples.txt +++ b/Notes/Entity-Samples.txt @@ -40,6 +40,13 @@ View Model (With out Base Classes) * With out base classes, editor + view model, no custom rules * With out base classes, editor + view model, with custom rules +Search, Filtering, Sortng, Paging + +* Search +* Filtering +* Paging +* Sorting + Multiple Entities * 1:m From 1e0b163fc06f96c652c9bff2d26d1c0a6fcb14f5 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Sat, 23 Apr 2022 01:43:45 +0100 Subject: [PATCH 152/204] Update Modules.txt --- Notes/Modules.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Notes/Modules.txt b/Notes/Modules.txt index 87b4913a..bf02d58b 100644 --- a/Notes/Modules.txt +++ b/Notes/Modules.txt @@ -58,6 +58,9 @@ Caching * Couchbase * SQL Server In-memory +Search +* Azure Search + Backgeound Process * Process.AzureWebJob * Process.AzureLogicApp From f2c8003eb16c10bf96fd63af8b511ce3b3fedbb1 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Sat, 23 Apr 2022 02:09:33 +0100 Subject: [PATCH 153/204] Update Release-Instructions.txt --- Notes/Release-Instructions.txt | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/Notes/Release-Instructions.txt b/Notes/Release-Instructions.txt index 67cddf45..8d298a7c 100644 --- a/Notes/Release-Instructions.txt +++ b/Notes/Release-Instructions.txt @@ -9,21 +9,35 @@ Eisk.WebApi ======================================================== Release A New Version +Release Prep * Update version in code and package * Build the project in CI -Releasing the Web Site -* Staging - Web site will be deployed automatically -* Prod - Web site will be deployed automatically if staging is successful +Releasing the Web Site (semi-manual) +* Release will be created automatically +* Staging - will be deployed automatically +* Prod - Web site needs to be deployed manually -Releasing in Nuget -* Trigger the DevOps manually (as nuget releases immutable i.e. can't be updated once created) +Releasing in Nuget (semi-manual) +* Trigger will create release automatically +* Release needs to be deployed by manual trigger (as nuget releases immutable i.e. canreleasepdated once created) -Releasing in Github Release +Releasing to VS Gallery (semi-manual) +* Release will be created automatically +* Deploy need to be triggered manually + +Releasing in git repo (semi-manual) +* Cd will deploy the changes in version branch, +* version branch needs to be merged manually + +Releasing in Github Release (manual) +* ** Merge the repo master branch (mentioned above) ** * Create tag in github * Update version in DevOps release -* Template repo project readme.md will be included automatically in the release notes. -* Respective release as menionted in DevOps rlease will be updated automatically when master branch changed. +* Release needs be created manually as master branch is merged +* Trigger deploy manually + * Template repo project readme.md will be included automatically in the release notes. + * Respective release as menionted in DevOps rlease will be updated automatically when master branch changed. ======================================================== Release Instructions @@ -41,4 +55,4 @@ Prod (Web/github/Nuget) * Published to nuget gallery ======================================================== - \ No newline at end of file + From 2b8bf5a3dac5e6809edd8620ea07150066d9644d Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Sat, 23 Apr 2022 02:11:55 +0100 Subject: [PATCH 154/204] Update Release-Instructions.txt --- Notes/Release-Instructions.txt | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/Notes/Release-Instructions.txt b/Notes/Release-Instructions.txt index 8d298a7c..748ab38a 100644 --- a/Notes/Release-Instructions.txt +++ b/Notes/Release-Instructions.txt @@ -40,19 +40,3 @@ Releasing in Github Release (manual) * Respective release as menionted in DevOps rlease will be updated automatically when master branch changed. ======================================================== -Release Instructions - -CD Contains the following - -Staging (Web/github) -* Web to Azure -* Github Release (edit) - for draft, no need to create tags - -Prod (Web/github/Nuget) -* Web to Azure -* Github Release (add) - for non-draft, only published once or create tag manually -* Github Release (edit) -* Published to nuget gallery - -======================================================== - From a89d7dcf24a844f89860a8d0b91ba70428b2926d Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Sat, 23 Apr 2022 02:29:29 +0100 Subject: [PATCH 155/204] Update Release-Instructions.txt --- Notes/Release-Instructions.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Notes/Release-Instructions.txt b/Notes/Release-Instructions.txt index 748ab38a..3ac972a5 100644 --- a/Notes/Release-Instructions.txt +++ b/Notes/Release-Instructions.txt @@ -18,18 +18,19 @@ Releasing the Web Site (semi-manual) * Staging - will be deployed automatically * Prod - Web site needs to be deployed manually +Releasing in git repo (semi-manual) +* Release will be created automatically +* Cd will deploy the changes in version branch automatically +* Version branch needs to be merged manually + Releasing in Nuget (semi-manual) -* Trigger will create release automatically +* Release will be created automatically * Release needs to be deployed by manual trigger (as nuget releases immutable i.e. canreleasepdated once created) Releasing to VS Gallery (semi-manual) * Release will be created automatically * Deploy need to be triggered manually -Releasing in git repo (semi-manual) -* Cd will deploy the changes in version branch, -* version branch needs to be merged manually - Releasing in Github Release (manual) * ** Merge the repo master branch (mentioned above) ** * Create tag in github From 3b42c79a658e89eed0db6e70686fa67191896433 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Sat, 23 Apr 2022 02:30:20 +0100 Subject: [PATCH 156/204] Rename Set-up.txt to Dev-Set-up.txt --- Notes/{Set-up.txt => Dev-Set-up.txt} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename Notes/{Set-up.txt => Dev-Set-up.txt} (95%) diff --git a/Notes/Set-up.txt b/Notes/Dev-Set-up.txt similarity index 95% rename from Notes/Set-up.txt rename to Notes/Dev-Set-up.txt index 2f16bdc8..9438b157 100644 --- a/Notes/Set-up.txt +++ b/Notes/Dev-Set-up.txt @@ -37,4 +37,4 @@ ASP.NET / Web Server * Turn off development mode for ASP.NET -======================================================== \ No newline at end of file +======================================================== From 11520eef89430626ad17491e49fd1f19de56c591 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Sat, 23 Apr 2022 02:31:37 +0100 Subject: [PATCH 157/204] Update and rename Template-Features.txt to Eisk-Features.txt --- Notes/{Template-Features.txt => Eisk-Features.txt} | 6 ++++++ 1 file changed, 6 insertions(+) rename Notes/{Template-Features.txt => Eisk-Features.txt} (91%) diff --git a/Notes/Template-Features.txt b/Notes/Eisk-Features.txt similarity index 91% rename from Notes/Template-Features.txt rename to Notes/Eisk-Features.txt index 054bdb72..d1e2ada3 100644 --- a/Notes/Template-Features.txt +++ b/Notes/Eisk-Features.txt @@ -1,3 +1,9 @@ +User Stories + +* To be added + +Project Features + * Web API base classes with supported in-memory web tests * Swagger support * Exception handling classes and filters From 16e92602fc16b2d1563ab0e87e352736cfe31774 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Sun, 24 Apr 2022 18:49:13 +0100 Subject: [PATCH 158/204] Update Modules.txt --- Notes/Modules.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Notes/Modules.txt b/Notes/Modules.txt index bf02d58b..c4d4ff5a 100644 --- a/Notes/Modules.txt +++ b/Notes/Modules.txt @@ -13,7 +13,7 @@ Web API Layer * GraphAPI - Graph API Domain Layer -* Onion Architecture (default) +* Clean Architecture (default) * DDD * CQRS From 89d5a62f581b2d0fb9286ece88f9f42dbea39701 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 25 Apr 2022 14:52:34 +0100 Subject: [PATCH 159/204] update --- Eisk.WebApi.TemplatePack.sln | 5 +++-- Notes/TODO.txt | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Eisk.WebApi.TemplatePack.sln b/Eisk.WebApi.TemplatePack.sln index 4ec874c3..1789750c 100644 --- a/Eisk.WebApi.TemplatePack.sln +++ b/Eisk.WebApi.TemplatePack.sln @@ -52,10 +52,11 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Notes", "Notes", "{ACEB7D4D-4789-49F0-A552-3D7C0A419FB9}" ProjectSection(SolutionItems) = preProject Notes\Business-Rules.txt = Notes\Business-Rules.txt + Notes\Dev-Set-up.txt = Notes\Dev-Set-up.txt + Notes\Eisk-Features.txt = Notes\Eisk-Features.txt + Notes\Entity-Samples.txt = Notes\Entity-Samples.txt Notes\Modules.txt = Notes\Modules.txt - Notes\Notes.txt = Notes\Notes.txt Notes\Release-Instructions.txt = Notes\Release-Instructions.txt - Notes\Set-up.txt = Notes\Set-up.txt Notes\Test-Strategy.txt = Notes\Test-Strategy.txt Notes\TODO.txt = Notes\TODO.txt Notes\Troubleshoot.txt = Notes\Troubleshoot.txt diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 6fb53ecc..e991ed98 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -45,6 +45,8 @@ R * Error handling Testing R * Add web tests + * Employee web tests + * Web test base class * Set db fixture with assesbmly set-up * Sql server integration tests: load from config * Create postman based test file (for template only) From 22b1bf0e073562b413d2f112a6779e1e3cf46bea Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 25 Apr 2022 16:11:39 +0100 Subject: [PATCH 160/204] First official release - 9.0.7 --- .../source.extension.vsixmanifest | 2 +- .../template/Eisk.WebApi.proj | 2 +- README.md | 20 +++++++++---------- WebApi/Eisk.WebApi/Program.cs | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest b/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest index 44c1d9f9..611c778b 100644 --- a/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest +++ b/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest @@ -1,7 +1,7 @@ - + Eisk.WebApi Project template with simple CRUD to get started ASP.NET Web Api quickly. diff --git a/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj b/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj index b881b3b6..3d550d59 100644 --- a/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj +++ b/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj @@ -9,7 +9,7 @@ Ashraf Alam Project template with simple CRUD to get started ASP.NET Web Api quickly. - 9.0.5 + 9.0.7 diff --git a/README.md b/README.md index f8a74dab..80ea9cf4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ [![Build status](https://dev.azure.com/EiskOps/Eisk/_apis/build/status/Eisk-WebApi-TemplatePack-CI)](https://dev.azure.com/EiskOps/Eisk/_build/latest?definitionId=3) [![BuitlWithDot.Net shield](https://builtwithdot.net/project/334/eisk/badge)](https://builtwithdot.net/project/334/eisk) +[![Build status](https://dev.azure.com/EiskOps/Eisk/_apis/build/status/Eisk-WebApi-TemplatePack-CI)](https://dev.azure.com/EiskOps/Eisk/_build/latest?definitionId=3) [![BuitlWithDot.Net shield](https://builtwithdot.net/project/334/eisk/badge)](https://builtwithdot.net/project/334/eisk) + # Getting Started with EISK Web Api EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net core technologies. @@ -25,17 +27,15 @@ Here is a simple CRUD use case illustrated in the default template: ### Architecture Overview -* [Onion Arcitecture](https://jeffreypalermo.com/2008/07/the-onion-architecture-part-1/) -* [Clean Architecture](https://blog.cleancoder.com/uncle-bob/2012/08/13/the-clean-architecture.html) -* [Domain Driven Design (DDD)](https://en.wikipedia.org/wiki/Domain-driven_design) +* Clean Architecture ## Core Technology Areas * [.NET Framework 6.0](https://devblogs.microsoft.com/dotnet/announcing-net-6/) - The Fastest .NET Yet -* [ASP.NET Core (Web Api)](https://dotnet.microsoft.com/en-us/apps/aspnet/apis) -* [Entity Framework Core](https://docs.microsoft.com/en-us/ef/core/) -* [C# Programming Language](https://docs.microsoft.com/en-us/dotnet/csharp/) -* [Visual Studio](https://visualstudio.microsoft.com/) +* ASP.NET Core (Web Api) +* Entity Framework Core +* C# Programming Language +* Visual Studio ## System Requirements (Development) @@ -63,6 +63,6 @@ Next - you can try some hands-on experience by creating your own api on top of y Utilities and code samples as provided in EISK have intentionally been designed to be self explaining. You may still want to get deeper understanding by exploring the documentations: * [Live Demo](https://eisk-webapi.azurewebsites.net) -* [Hands-on Walk-through](https://eisk.github.io/eisk.webapi/docs/application-development/handson-walkthrough-create-service-api.html) -* [Logical Layer Architecture](https://eisk.github.io/eisk.webapi/docs/architecture/logical-layers.html) -* [Technology Stack](https://eisk.github.io/eisk.webapi/docs/technical-reference/technology-stack.html) +* [Hands-on Walk-through](https://eisk.github.io/docs/webapi/application-development/handson-walkthrough-create-service-api.html) +* [Logical Layer Architecture](https://eisk.github.io/docs/webapi/architecture/logical-layers.html) +* [Technology Stack](https://eisk.github.io/docs/webapi/technical-reference/technology-stack.html) diff --git a/WebApi/Eisk.WebApi/Program.cs b/WebApi/Eisk.WebApi/Program.cs index 4cf2b5ee..007cb05b 100644 --- a/WebApi/Eisk.WebApi/Program.cs +++ b/WebApi/Eisk.WebApi/Program.cs @@ -17,7 +17,7 @@ c.SwaggerDoc("v1", new OpenApiInfo { Title = "Eisk.WebApi", - Version = "v9.0.6", + Version = "v9.0.7", Description = "EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net core technologies.", Contact = new OpenApiContact { From 0eba7a83d519f0d6cd139a784624841fd27b38f4 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 25 Apr 2022 16:12:19 +0100 Subject: [PATCH 161/204] Update solution --- Eisk.WebApi.TemplatePack.sln | 1 + 1 file changed, 1 insertion(+) diff --git a/Eisk.WebApi.TemplatePack.sln b/Eisk.WebApi.TemplatePack.sln index 1789750c..8583b515 100644 --- a/Eisk.WebApi.TemplatePack.sln +++ b/Eisk.WebApi.TemplatePack.sln @@ -11,6 +11,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution build\dnn-install-from-remote.cmd = build\dnn-install-from-remote.cmd build\git-bash-echo.sh = build\git-bash-echo.sh build\git-push.sh = build\git-push.sh + README.md = README.md .template.config\template.json = .template.config\template.json .template.config\template.vstemplate = .template.config\template.vstemplate EndProjectSection From 5d3af472179264f27e3d2c431a4a828a6685a2ed Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 25 Apr 2022 16:32:05 +0100 Subject: [PATCH 162/204] updated read me --- README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.md b/README.md index 80ea9cf4..7ff66ffa 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,3 @@ -[![Build status](https://dev.azure.com/EiskOps/Eisk/_apis/build/status/Eisk-WebApi-TemplatePack-CI)](https://dev.azure.com/EiskOps/Eisk/_build/latest?definitionId=3) [![BuitlWithDot.Net shield](https://builtwithdot.net/project/334/eisk/badge)](https://builtwithdot.net/project/334/eisk) - -[![Build status](https://dev.azure.com/EiskOps/Eisk/_apis/build/status/Eisk-WebApi-TemplatePack-CI)](https://dev.azure.com/EiskOps/Eisk/_build/latest?definitionId=3) [![BuitlWithDot.Net shield](https://builtwithdot.net/project/334/eisk/badge)](https://builtwithdot.net/project/334/eisk) - -# Getting Started with EISK Web Api - EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net core technologies. With an optional set of customizable utility classes, samples and tools, it lets you creating new web api straight away without wide technical experience or learning curve. From edac2df2ab18ea871a12260f9c24a5e8cdd29336 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 25 Apr 2022 17:10:54 +0100 Subject: [PATCH 163/204] updated readme to include instructions for older versions. --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 7ff66ffa..80bc549e 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,10 @@ Once the contents are available, just open the created solution, select "Eisk.We That's it! +## How About Old Versions? + +If you want to continue using one of the older versions of EISK, check the [releases](https://github.com/EISK/eisk.webapi/releases) page for specific instructions to install and use older versions of EISK. + ## What's Next? After running the created project successfully, you'll get an understanding about how the sample use case has been used to explore cutting edge technologies for building a web api. From 2afa6787fc2aa9889c99e3df8875e5f8ddc65f8f Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 25 Apr 2022 17:16:06 +0100 Subject: [PATCH 164/204] updated to do notes --- Notes/TODO.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Notes/TODO.txt b/Notes/TODO.txt index e991ed98..95f85019 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -56,11 +56,12 @@ R * Add web tests Release Tasks -* Merge V9.0 branch to master -* Publish nuget package to nuget gallery -* Publish documentation (soft release) +DONE * Merge V9.0 branch to master +DONE * Publish nuget package to nuget gallery +DONE * Publish documentation (soft release) * Publish to VS Gallery +* Experiement tag, release and branch (what happens when branch is deleted after release is created?) Others From 692aeb784a10b228de7f79ccf70080da9376885c Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 25 Apr 2022 17:41:52 +0100 Subject: [PATCH 165/204] read me updated --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 80bc549e..045cf39d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +[![Build status](https://dev.azure.com/EiskOps/Eisk/_apis/build/status/Eisk-WebApi-TemplatePack-CI)](https://dev.azure.com/EiskOps/Eisk/_build/latest?definitionId=3) [![BuitlWithDot.Net shield](https://builtwithdot.net/project/334/eisk/badge)](https://builtwithdot.net/project/334/eisk) + +... + EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net core technologies. With an optional set of customizable utility classes, samples and tools, it lets you creating new web api straight away without wide technical experience or learning curve. From 742ff307fa1d23004551369932001a1345ffee6b Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 25 Apr 2022 17:46:56 +0100 Subject: [PATCH 166/204] updated readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 045cf39d..00b1275c 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ Once the contents are available, just open the created solution, select "Eisk.We That's it! -## How About Old Versions? +### How About Old Versions? If you want to continue using one of the older versions of EISK, check the [releases](https://github.com/EISK/eisk.webapi/releases) page for specific instructions to install and use older versions of EISK. From 14be3ea0bdf6f2408af8a68f8c79103e9e053661 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 25 Apr 2022 23:23:55 +0100 Subject: [PATCH 167/204] Declayed generic services for dependency injection --- WebApi/Eisk.WebApi/Program.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/WebApi/Eisk.WebApi/Program.cs b/WebApi/Eisk.WebApi/Program.cs index 007cb05b..1f4b5963 100644 --- a/WebApi/Eisk.WebApi/Program.cs +++ b/WebApi/Eisk.WebApi/Program.cs @@ -28,6 +28,11 @@ }); }); +//generic services + +builder.Services.AddScoped(typeof(IEntityDataService<>), typeof(EntityDataService<>)); +builder.Services.AddScoped(typeof(DomainService<,>)); + //custom services builder.Services.AddScoped(); From e51a2c122f9729553645525e6684f9940057a045 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 25 Apr 2022 23:24:37 +0100 Subject: [PATCH 168/204] Updated to v9.0.8 --- WebApi/Eisk.WebApi/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebApi/Eisk.WebApi/Program.cs b/WebApi/Eisk.WebApi/Program.cs index 1f4b5963..eeb00445 100644 --- a/WebApi/Eisk.WebApi/Program.cs +++ b/WebApi/Eisk.WebApi/Program.cs @@ -17,7 +17,7 @@ c.SwaggerDoc("v1", new OpenApiInfo { Title = "Eisk.WebApi", - Version = "v9.0.7", + Version = "v9.0.8", Description = "EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net core technologies.", Contact = new OpenApiContact { From 918bdbc6329751b5e5ef9cb025a825604ad5dbbe Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Mon, 25 Apr 2022 23:41:05 +0100 Subject: [PATCH 169/204] updated namespace for services. --- WebApi/Eisk.WebApi/Program.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/WebApi/Eisk.WebApi/Program.cs b/WebApi/Eisk.WebApi/Program.cs index eeb00445..f333f9c4 100644 --- a/WebApi/Eisk.WebApi/Program.cs +++ b/WebApi/Eisk.WebApi/Program.cs @@ -1,3 +1,6 @@ +using Eisk.Core.DataService; +using Eisk.Core.DataService.EFCore; +using Eisk.Core.DomainService; using Eisk.DataServices.EFCore; using Eisk.DataServices.EFCore.DataContext; using Eisk.DataServices.Interfaces; From 0bb7a08241fb998f52f666ff55a8cc408a9d629e Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 00:01:57 +0100 Subject: [PATCH 170/204] updated nuget packache to v9.0.8 --- Eisk.WebApi.TemplatePack/source.extension.vsixmanifest | 2 +- Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest b/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest index 611c778b..e4f03c1e 100644 --- a/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest +++ b/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest @@ -1,7 +1,7 @@ - + Eisk.WebApi Project template with simple CRUD to get started ASP.NET Web Api quickly. diff --git a/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj b/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj index 3d550d59..ee45436b 100644 --- a/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj +++ b/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj @@ -9,7 +9,7 @@ Ashraf Alam Project template with simple CRUD to get started ASP.NET Web Api quickly. - 9.0.7 + 9.0.8 From c556e2b178c53c673d29eeeba2e286fc22eee653 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 02:35:38 +0100 Subject: [PATCH 171/204] Updated version in swagger to 9.0.9 --- WebApi/Eisk.WebApi/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WebApi/Eisk.WebApi/Program.cs b/WebApi/Eisk.WebApi/Program.cs index f333f9c4..c809e1fc 100644 --- a/WebApi/Eisk.WebApi/Program.cs +++ b/WebApi/Eisk.WebApi/Program.cs @@ -20,7 +20,7 @@ c.SwaggerDoc("v1", new OpenApiInfo { Title = "Eisk.WebApi", - Version = "v9.0.8", + Version = "v9.0.9", Description = "EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net core technologies.", Contact = new OpenApiContact { From 54409f991163a38677fcb806d3e016007d0025c7 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 02:36:29 +0100 Subject: [PATCH 172/204] Updating version in proj to 9.0.9 --- Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj b/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj index ee45436b..cb778162 100644 --- a/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj +++ b/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj @@ -9,7 +9,7 @@ Ashraf Alam Project template with simple CRUD to get started ASP.NET Web Api quickly. - 9.0.8 + 9.0.9 From 95602e540b4d259e6f9e174183b81ba0f063ef72 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 02:37:25 +0100 Subject: [PATCH 173/204] Updating version to menifest to 9.0.9 --- Eisk.WebApi.TemplatePack/source.extension.vsixmanifest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest b/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest index e4f03c1e..81a4eab9 100644 --- a/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest +++ b/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest @@ -1,7 +1,7 @@ - + Eisk.WebApi Project template with simple CRUD to get started ASP.NET Web Api quickly. From 152b0838d15e0f0bfea3914a4dba2788e7e9b9f1 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 15:28:55 +0100 Subject: [PATCH 174/204] Included nuget downloads badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 00b1275c..746ee352 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build status](https://dev.azure.com/EiskOps/Eisk/_apis/build/status/Eisk-WebApi-TemplatePack-CI)](https://dev.azure.com/EiskOps/Eisk/_build/latest?definitionId=3) [![BuitlWithDot.Net shield](https://builtwithdot.net/project/334/eisk/badge)](https://builtwithdot.net/project/334/eisk) +[![NuGet Badge](https://buildstats.info/nuget/Eisk.WebApi)](https://www.nuget.org/packages/Eisk.WebApi/) [![BuitlWithDot.Net shield](https://builtwithdot.net/project/334/eisk/badge)](https://builtwithdot.net/project/334/eisk) [![Build status](https://dev.azure.com/EiskOps/Eisk/_apis/build/status/Eisk-WebApi-TemplatePack-CI)](https://dev.azure.com/EiskOps/Eisk/_build/latest?definitionId=3) ... From 3e3ecb1ba45ab1d46eae37e8caf783c65ef8f1c2 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 16:42:40 +0100 Subject: [PATCH 175/204] updated to do list --- Notes/TODO.txt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 95f85019..a031be65 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -1,6 +1,10 @@ ======================================================== TODO: Today +DONE * Include nuge badge +* Include github badge +* Include support help for stackoverflow + * Re-visit exception classes * review template documentations @@ -13,14 +17,14 @@ N/A * Apply rules logic in custom data generator ======================================================== TODO: -Fix CI (Remote) +CI (Remote) * Rename eisk.webapi.template to eisk.template * Convert generated template CI to Yml -Fix CD (Remote) +CD (Remote) -* Publish git repo to integrate with with git release task +DONE * Integrate with with git release task * Publish to VS Gallery * Create staging api app service for V8 @@ -36,7 +40,7 @@ R * Error handling * Added exception handler for controller * Implement http error on exception for controller * Firing exception when field constraint (i.e. length) is not applied -* Log +R * Log * Add log functionality * Integrate azure insight @@ -61,7 +65,7 @@ DONE * Publish nuget package to nuget gallery DONE * Publish documentation (soft release) * Publish to VS Gallery -* Experiement tag, release and branch (what happens when branch is deleted after release is created?) +DONE * Experiement tag, release and branch (what happens when branch is deleted after release is created?) Others From 6f1ee6da3d629662687dc62029b3687121cb4ec4 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 16:51:53 +0100 Subject: [PATCH 176/204] updated to do and solution --- Eisk.WebApi.TemplatePack.sln | 7 ++++++- Notes/TODO.txt | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Eisk.WebApi.TemplatePack.sln b/Eisk.WebApi.TemplatePack.sln index 8583b515..31df8ec3 100644 --- a/Eisk.WebApi.TemplatePack.sln +++ b/Eisk.WebApi.TemplatePack.sln @@ -5,7 +5,7 @@ VisualStudioVersion = 17.0.32112.339 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.Core", "Core\Eisk.Core\Eisk.Core.csproj", "{8E6823DD-60AB-4772-AB9C-E5786BEF2B50}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4E93D3D8-EC59-4DE2-A1E1-3F0258277780}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{4E93D3D8-EC59-4DE2-A1E1-3F0258277780}" ProjectSection(SolutionItems) = preProject build\dnn-install-from-local.cmd = build\dnn-install-from-local.cmd build\dnn-install-from-remote.cmd = build\dnn-install-from-remote.cmd @@ -69,6 +69,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DataServices.Integrati EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Eisk.DataServices.IntegrationTests.EFCore.SqlServer", "Infrastructure.EFCore\Eisk.DataServices.IntegrationTests.EFCore.SqlServer\Eisk.DataServices.IntegrationTests.EFCore.SqlServer.csproj", "{1502582C-70E8-492E-8366-D85699C405E2}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{D6C07FAD-F2A3-4C45-83C4-219E4EC79384}" + ProjectSection(SolutionItems) = preProject + README.md = README.md + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/Notes/TODO.txt b/Notes/TODO.txt index a031be65..5e8b8e75 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -4,9 +4,9 @@ TODO: Today DONE * Include nuge badge * Include github badge * Include support help for stackoverflow +* Include readme for nuget package * Re-visit exception classes - * review template documentations * check rendered output for template with VS * check conditional rendering (file) From 4883dfca3f34c83b1fd523194c3b4b5e2cdce633 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 17:18:01 +0100 Subject: [PATCH 177/204] updated badge order --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 746ee352..a7069465 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![NuGet Badge](https://buildstats.info/nuget/Eisk.WebApi)](https://www.nuget.org/packages/Eisk.WebApi/) [![BuitlWithDot.Net shield](https://builtwithdot.net/project/334/eisk/badge)](https://builtwithdot.net/project/334/eisk) [![Build status](https://dev.azure.com/EiskOps/Eisk/_apis/build/status/Eisk-WebApi-TemplatePack-CI)](https://dev.azure.com/EiskOps/Eisk/_build/latest?definitionId=3) +[![NuGet Badge](https://buildstats.info/nuget/Eisk.WebApi)](https://www.nuget.org/packages/Eisk.WebApi/) [![Build status](https://dev.azure.com/EiskOps/Eisk/_apis/build/status/Eisk-WebApi-TemplatePack-CI)](https://dev.azure.com/EiskOps/Eisk/_build/latest?definitionId=3) [![BuitlWithDot.Net shield](https://builtwithdot.net/project/334/eisk/badge)](https://builtwithdot.net/project/334/eisk) ... From a5325b0a3a6b0d124dbb445c364fa95dc7d7f709 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 17:59:18 +0100 Subject: [PATCH 178/204] updated readme and notes --- Eisk.WebApi.TemplatePack.sln | 1 - Notes/TODO.txt | 1 + README.md | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/Eisk.WebApi.TemplatePack.sln b/Eisk.WebApi.TemplatePack.sln index 31df8ec3..45a8032a 100644 --- a/Eisk.WebApi.TemplatePack.sln +++ b/Eisk.WebApi.TemplatePack.sln @@ -11,7 +11,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{4E93D3D8 build\dnn-install-from-remote.cmd = build\dnn-install-from-remote.cmd build\git-bash-echo.sh = build\git-bash-echo.sh build\git-push.sh = build\git-push.sh - README.md = README.md .template.config\template.json = .template.config\template.json .template.config\template.vstemplate = .template.config\template.vstemplate EndProjectSection diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 5e8b8e75..8136db1d 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -3,6 +3,7 @@ TODO: Today DONE * Include nuge badge * Include github badge +* Include uptime robot badge * Include support help for stackoverflow * Include readme for nuget package diff --git a/README.md b/README.md index a7069465..3852f0ab 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,6 @@ Here is a simple CRUD use case illustrated in the default template: * ASP.NET Core (Web Api) * Entity Framework Core * C# Programming Language -* Visual Studio ## System Requirements (Development) From 63c32e55a40b1632411095f567311861fb11acc6 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 18:11:39 +0100 Subject: [PATCH 179/204] read me updated --- README.md | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 3852f0ab..ed282024 100644 --- a/README.md +++ b/README.md @@ -12,9 +12,9 @@ If you like or are using this project to learn or start your solution, please gi ![eisk web api](https://github.com/EISK/eisk/blob/master/eisk-webapi-small.png) -## Sample Use Case +## Simple Use Case -Using a simple table entity 'Employee' it demonstrates all aspect of web development including layered architecture following DDD, micro service, unit and integration tests, building and deploying in cloud environment. +Using a simple table entity 'Employee' it demonstrates all aspect of web development including layered architecture following clean architecture, micro-service patterns, unit and integration tests, building and deploying in cloud environment. Here is a simple CRUD use case illustrated in the default template: @@ -23,16 +23,23 @@ Here is a simple CRUD use case illustrated in the default template: * [U]pdate an existing employee record * [D]elete existing employee records -### Architecture Overview +## Project Features -* Clean Architecture +* Clean Architecture based implementation (clean separation bewteen domain model, domain service and insfrastructure layers) +* Swagger based Web API documentation +* Base classes for common CRUD functionalities (where applicable) for logical layers +* Base classes for common test scenarios +* Support for database integration tests with both in-memory database and SQL server +* Test data generator with meaningful, real-world data -## Core Technology Areas +## Core Technologies * [.NET Framework 6.0](https://devblogs.microsoft.com/dotnet/announcing-net-6/) - The Fastest .NET Yet -* ASP.NET Core (Web Api) -* Entity Framework Core -* C# Programming Language +* ASP.NET 6.0 (Web Api) +* Entity Framework Core 6.0 +* C# 10.0 +* Sql Server (optional) +* Azure DevOps Pipelines and App Service (optional) ## System Requirements (Development) @@ -67,3 +74,7 @@ Utilities and code samples as provided in EISK have intentionally been designed * [Hands-on Walk-through](https://eisk.github.io/docs/webapi/application-development/handson-walkthrough-create-service-api.html) * [Logical Layer Architecture](https://eisk.github.io/docs/webapi/architecture/logical-layers.html) * [Technology Stack](https://eisk.github.io/docs/webapi/technical-reference/technology-stack.html) + +## Questions? + +Should you have any questions or need any help to implement new cool features, you can [ask](https://stackoverflow.com/questions/ask?tags=eisk,webapi,asp.net-core&title=In%20EISK,%20How%20Do%20We%20..) in StackOverflow community with tag [eisk](https://stackoverflow.com/questions/tagged/eisk) and get prompt response. From 9157740760958be25ef21fe38616ed9a99a63a73 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 18:16:09 +0100 Subject: [PATCH 180/204] update --- Notes/TODO.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 8136db1d..5238b47d 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -2,9 +2,9 @@ TODO: Today DONE * Include nuge badge +DONE * Include support help for stackoverflow * Include github badge * Include uptime robot badge -* Include support help for stackoverflow * Include readme for nuget package * Re-visit exception classes From 26cb3b074271a9b0433fb9aea9b58133ef50fbd4 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 18:26:00 +0100 Subject: [PATCH 181/204] updated readme --- Notes/TODO.txt | 1 + README.md | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 5238b47d..e215df9d 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -3,6 +3,7 @@ TODO: Today DONE * Include nuge badge DONE * Include support help for stackoverflow +* Update git repo as template * Include github badge * Include uptime robot badge * Include readme for nuget package diff --git a/README.md b/README.md index ed282024..e47ecec8 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Here is a simple CRUD use case illustrated in the default template: ## Project Features -* Clean Architecture based implementation (clean separation bewteen domain model, domain service and insfrastructure layers) +* Clean Architecture based implementation * Swagger based Web API documentation * Base classes for common CRUD functionalities (where applicable) for logical layers * Base classes for common test scenarios From bb0f42739450e65e3dbae4dab04f8ad322c27a91 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 18:38:26 +0100 Subject: [PATCH 182/204] updated read me --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e47ecec8..96f4f40c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ... -EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net core technologies. +EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net based technologies. With an optional set of customizable utility classes, samples and tools, it lets you creating new web api straight away without wide technical experience or learning curve. @@ -26,9 +26,9 @@ Here is a simple CRUD use case illustrated in the default template: ## Project Features * Clean Architecture based implementation -* Swagger based Web API documentation -* Base classes for common CRUD functionalities (where applicable) for logical layers -* Base classes for common test scenarios +* Swagger/OpenAPI based Web API specification +* Base classes for common CRUD functionalities for logical layers (where applicable) +* Base classes for common test scenarios (component tests, integration tests) * Support for database integration tests with both in-memory database and SQL server * Test data generator with meaningful, real-world data From 05a7e25c8d9474181d12ec841268bbb8a9bcb137 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 18:42:20 +0100 Subject: [PATCH 183/204] update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 96f4f40c..32c496c5 100644 --- a/README.md +++ b/README.md @@ -28,9 +28,9 @@ Here is a simple CRUD use case illustrated in the default template: * Clean Architecture based implementation * Swagger/OpenAPI based Web API specification * Base classes for common CRUD functionalities for logical layers (where applicable) +* Utility classes to generate real-world test data * Base classes for common test scenarios (component tests, integration tests) * Support for database integration tests with both in-memory database and SQL server -* Test data generator with meaningful, real-world data ## Core Technologies From 5af7b6adec00d8a1f8f29a01c788d59be3635c0f Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 19:03:32 +0100 Subject: [PATCH 184/204] updated notes and release instruction --- Notes/Release-Instructions.txt | 18 ++++++++++++++---- Notes/TODO.txt | 1 + 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Notes/Release-Instructions.txt b/Notes/Release-Instructions.txt index 3ac972a5..ee9b4345 100644 --- a/Notes/Release-Instructions.txt +++ b/Notes/Release-Instructions.txt @@ -31,13 +31,23 @@ Releasing to VS Gallery (semi-manual) * Release will be created automatically * Deploy need to be triggered manually -Releasing in Github Release (manual) +Releasing in Github Release (manual) - Create Tag * ** Merge the repo master branch (mentioned above) ** * Create tag in github +* Create release in github from the created tag * Update version in DevOps release -* Release needs be created manually as master branch is merged -* Trigger deploy manually +* Create release and trigger deploy manually * Template repo project readme.md will be included automatically in the release notes. - * Respective release as menionted in DevOps rlease will be updated automatically when master branch changed. + * Respective release assests as menionted in DevOps rlease will be updated automatically when master branch changed. + +Releasing in Github Release (manual) - Update Tag in Existing Release +* Go to the corresponding release +* Create a new tag from the release page (based on target commit) +* Update version in DevOps release +* Create release and trigger deploy manually + +Releasing in Github Release (manual) - Update Content +* Relase Created Automatically +* Trigger deploy manually (it doesn't update the source in the release, but updates the contents (notes, binaries in release page) ======================================================== diff --git a/Notes/TODO.txt b/Notes/TODO.txt index e215df9d..9fb8c78b 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -7,6 +7,7 @@ DONE * Include support help for stackoverflow * Include github badge * Include uptime robot badge * Include readme for nuget package +* Fix nuget package warnings * Re-visit exception classes * review template documentations From f1f4baa952596f67c0edad74e97d9d7c0fa7bdcd Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 19:09:57 +0100 Subject: [PATCH 185/204] update todo --- Notes/TODO.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Notes/TODO.txt b/Notes/TODO.txt index 9fb8c78b..e467a5e5 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -3,7 +3,9 @@ TODO: Today DONE * Include nuge badge DONE * Include support help for stackoverflow -* Update git repo as template +DONE * Update git repo as template + +* Update project image in read me * Include github badge * Include uptime robot badge * Include readme for nuget package From 3ae47fff0014007e8ccb213724530bb6578a78e9 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 19:13:32 +0100 Subject: [PATCH 186/204] updated todo --- Notes/TODO.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Notes/TODO.txt b/Notes/TODO.txt index e467a5e5..45fe14d7 100644 --- a/Notes/TODO.txt +++ b/Notes/TODO.txt @@ -4,6 +4,7 @@ TODO: Today DONE * Include nuge badge DONE * Include support help for stackoverflow DONE * Update git repo as template +DONE N/A * Apply rules logic in custom data generator * Update project image in read me * Include github badge @@ -17,8 +18,6 @@ DONE * Update git repo as template * check conditional rendering (file) * check conditional rendering (text) -N/A * Apply rules logic in custom data generator - ======================================================== TODO: From 85e3fbac5837183bcb899399b40357355d226686 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 20:21:05 +0100 Subject: [PATCH 187/204] updated readme --- README.md | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 32c496c5..d6fd773f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ [![NuGet Badge](https://buildstats.info/nuget/Eisk.WebApi)](https://www.nuget.org/packages/Eisk.WebApi/) [![Build status](https://dev.azure.com/EiskOps/Eisk/_apis/build/status/Eisk-WebApi-TemplatePack-CI)](https://dev.azure.com/EiskOps/Eisk/_build/latest?definitionId=3) [![BuitlWithDot.Net shield](https://builtwithdot.net/project/334/eisk/badge)](https://builtwithdot.net/project/334/eisk) - ... EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net based technologies. @@ -12,38 +11,39 @@ If you like or are using this project to learn or start your solution, please gi ![eisk web api](https://github.com/EISK/eisk/blob/master/eisk-webapi-small.png) -## Simple Use Case +## Core Technologies -Using a simple table entity 'Employee' it demonstrates all aspect of web development including layered architecture following clean architecture, micro-service patterns, unit and integration tests, building and deploying in cloud environment. +* [.NET Framework 6.0](https://devblogs.microsoft.com/dotnet/announcing-net-6/) - The Fastest .NET Yet +* ASP.NET 6.0 (Web Api) +* Entity Framework Core 6.0 +* C# 10.0 +* Sql Server (optional) +* Azure DevOps Pipelines and App Service (optional) -Here is a simple CRUD use case illustrated in the default template: +### System Requirements (Development) -* [C]reating a new employee record -* [R]ead existing employee records -* [U]pdate an existing employee record -* [D]elete existing employee records +* Visual Studio 2022 ([Free](https://visualstudio.microsoft.com/vs/community/) Community Edition or higher) + +## Projects Features -## Project Features +EISK provides framework and utilitiy claases with regard to various aspects of web development along with clean architecture, micro-service patterns, unit and integration tests, building and deploying in cloud environment. Features include: -* Clean Architecture based implementation +* Cloud-aware RESTful API * Swagger/OpenAPI based Web API specification +* Clean Architecture based implementation * Base classes for common CRUD functionalities for logical layers (where applicable) * Utility classes to generate real-world test data * Base classes for common test scenarios (component tests, integration tests) * Support for database integration tests with both in-memory database and SQL server -## Core Technologies - -* [.NET Framework 6.0](https://devblogs.microsoft.com/dotnet/announcing-net-6/) - The Fastest .NET Yet -* ASP.NET 6.0 (Web Api) -* Entity Framework Core 6.0 -* C# 10.0 -* Sql Server (optional) -* Azure DevOps Pipelines and App Service (optional) +## Use Case Sample -## System Requirements (Development) +Using a simple data entity 'Employee', EISK shows how we can build scalable web api's easily along with addressing real-world domain and business use cases, including: -* Visual Studio 2022 ([Free](https://visualstudio.microsoft.com/vs/community/) Community Edition or higher) +* [C]reating a new employee record +* [R]ead existing employee records +* [U]pdate an existing employee record +* [D]elete an existing employee record ## QuickStart Guide From aae34d3ba7aedff4768bb70ae98dec628bf1d9af Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 20:22:08 +0100 Subject: [PATCH 188/204] update readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d6fd773f..b81c87e1 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ If you like or are using this project to learn or start your solution, please gi ## Projects Features -EISK provides framework and utilitiy claases with regard to various aspects of web development along with clean architecture, micro-service patterns, unit and integration tests, building and deploying in cloud environment. Features include: +EISK provides utilitiy classes with regard to various aspects of web development along with clean architecture, micro-service patterns, unit and integration tests, building and deploying in cloud environment. Features include: * Cloud-aware RESTful API * Swagger/OpenAPI based Web API specification From c2c4d26a79c39f69eae8d1fceca6c4fe239ab4e0 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 20:29:19 +0100 Subject: [PATCH 189/204] update --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index b81c87e1..6ae24f8e 100644 --- a/README.md +++ b/README.md @@ -13,18 +13,14 @@ If you like or are using this project to learn or start your solution, please gi ## Core Technologies -* [.NET Framework 6.0](https://devblogs.microsoft.com/dotnet/announcing-net-6/) - The Fastest .NET Yet -* ASP.NET 6.0 (Web Api) -* Entity Framework Core 6.0 -* C# 10.0 -* Sql Server (optional) -* Azure DevOps Pipelines and App Service (optional) +* Platform: [.NET Framework 6.0](https://devblogs.microsoft.com/dotnet/announcing-net-6/) - The Fastest .NET Yet +* Web Framework: ASP.NET Web API +* ORM Framework: Entity Framework +* Programming Language: C# +* Database: Sql Server (optional) +* Build and Deployment: Azure DevOps Pipelines / App Service (optional) -### System Requirements (Development) - -* Visual Studio 2022 ([Free](https://visualstudio.microsoft.com/vs/community/) Community Edition or higher) - -## Projects Features +## Technical Features EISK provides utilitiy classes with regard to various aspects of web development along with clean architecture, micro-service patterns, unit and integration tests, building and deploying in cloud environment. Features include: @@ -45,6 +41,10 @@ Using a simple data entity 'Employee', EISK shows how we can build scalable web * [U]pdate an existing employee record * [D]elete an existing employee record +## System Requirements (Development) + +* Visual Studio 2022 ([Free](https://visualstudio.microsoft.com/vs/community/) Community Edition or higher) + ## QuickStart Guide Getting started with EISK Web Api is pretty easy. From a998b5ec38aecedeed0f7b005a4fef9427da007a Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 20:38:29 +0100 Subject: [PATCH 190/204] updated v9.0.10 --- Eisk.WebApi.TemplatePack/source.extension.vsixmanifest | 2 +- Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj | 2 +- README.md | 4 +++- WebApi/Eisk.WebApi/Program.cs | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest b/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest index 81a4eab9..590ea622 100644 --- a/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest +++ b/Eisk.WebApi.TemplatePack/source.extension.vsixmanifest @@ -1,7 +1,7 @@ - + Eisk.WebApi Project template with simple CRUD to get started ASP.NET Web Api quickly. diff --git a/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj b/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj index cb778162..9fc14561 100644 --- a/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj +++ b/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj @@ -9,7 +9,7 @@ Ashraf Alam Project template with simple CRUD to get started ASP.NET Web Api quickly. - 9.0.9 + v9.0.10 diff --git a/README.md b/README.md index 6ae24f8e..23f2e3d1 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,9 @@ If you like or are using this project to learn or start your solution, please gi ## Technical Features -EISK provides utilitiy classes with regard to various aspects of web development along with clean architecture, micro-service patterns, unit and integration tests, building and deploying in cloud environment. Features include: +EISK provides code and tools for various aspects of web development, along with unit and integration tests, building and deploying in cloud environment. + +Technical features available in EISK include: * Cloud-aware RESTful API * Swagger/OpenAPI based Web API specification diff --git a/WebApi/Eisk.WebApi/Program.cs b/WebApi/Eisk.WebApi/Program.cs index c809e1fc..75841567 100644 --- a/WebApi/Eisk.WebApi/Program.cs +++ b/WebApi/Eisk.WebApi/Program.cs @@ -20,7 +20,7 @@ c.SwaggerDoc("v1", new OpenApiInfo { Title = "Eisk.WebApi", - Version = "v9.0.9", + Version = "v9.0.10", Description = "EISK makes it easy to write scalable and secured web api on top of Microsoft's new cutting edge .net core technologies.", Contact = new OpenApiContact { From 5f476e5c4ca79cbc28a43369b2c258147a4367b0 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 20:42:33 +0100 Subject: [PATCH 191/204] updated to v9.0.10 --- Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj b/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj index 9fc14561..8d8522b3 100644 --- a/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj +++ b/Eisk.WebApi.TemplatePack/template/Eisk.WebApi.proj @@ -9,7 +9,7 @@ Ashraf Alam Project template with simple CRUD to get started ASP.NET Web Api quickly. - v9.0.10 + 9.0.10 From 9ef2122feb66820f3bb8f75506bc648669ad5f46 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 21:42:55 +0100 Subject: [PATCH 192/204] Update README.md --- README.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 23f2e3d1..a5ed292f 100644 --- a/README.md +++ b/README.md @@ -20,13 +20,22 @@ If you like or are using this project to learn or start your solution, please gi * Database: Sql Server (optional) * Build and Deployment: Azure DevOps Pipelines / App Service (optional) +## Use Case Sample + +Using a simple data entity 'Employee', EISK shows how we can build scalable web api's easily along with addressing real-world domain and business use cases, including: + +* [C]reating a new employee record +* [R]ead existing employee records +* [U]pdate an existing employee record +* [D]elete an existing employee record + ## Technical Features -EISK provides code and tools for various aspects of web development, along with unit and integration tests, building and deploying in cloud environment. +EISK provides reusable utility classes and tools for various aspects of web development, along with unit and integration tests, building and deploying in cloud environment. Technical features available in EISK include: -* Cloud-aware RESTful API +* Visual Studio project template that includes project structure to build modern cloud-aware RESTful APIs * Swagger/OpenAPI based Web API specification * Clean Architecture based implementation * Base classes for common CRUD functionalities for logical layers (where applicable) @@ -34,15 +43,6 @@ Technical features available in EISK include: * Base classes for common test scenarios (component tests, integration tests) * Support for database integration tests with both in-memory database and SQL server -## Use Case Sample - -Using a simple data entity 'Employee', EISK shows how we can build scalable web api's easily along with addressing real-world domain and business use cases, including: - -* [C]reating a new employee record -* [R]ead existing employee records -* [U]pdate an existing employee record -* [D]elete an existing employee record - ## System Requirements (Development) * Visual Studio 2022 ([Free](https://visualstudio.microsoft.com/vs/community/) Community Edition or higher) From 6b59bf0d0f41c9b104d6528d83b05f6852d3b298 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 21:45:31 +0100 Subject: [PATCH 193/204] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a5ed292f..0a1bff9b 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ If you like or are using this project to learn or start your solution, please gi * Database: Sql Server (optional) * Build and Deployment: Azure DevOps Pipelines / App Service (optional) -## Use Case Sample +## Simple Use Case Using a simple data entity 'Employee', EISK shows how we can build scalable web api's easily along with addressing real-world domain and business use cases, including: From 1b058c38192fdb516a494c7aa3f499e408ace88e Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Tue, 26 Apr 2022 21:47:27 +0100 Subject: [PATCH 194/204] Update README.md --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 0a1bff9b..b3688864 100644 --- a/README.md +++ b/README.md @@ -11,15 +11,6 @@ If you like or are using this project to learn or start your solution, please gi ![eisk web api](https://github.com/EISK/eisk/blob/master/eisk-webapi-small.png) -## Core Technologies - -* Platform: [.NET Framework 6.0](https://devblogs.microsoft.com/dotnet/announcing-net-6/) - The Fastest .NET Yet -* Web Framework: ASP.NET Web API -* ORM Framework: Entity Framework -* Programming Language: C# -* Database: Sql Server (optional) -* Build and Deployment: Azure DevOps Pipelines / App Service (optional) - ## Simple Use Case Using a simple data entity 'Employee', EISK shows how we can build scalable web api's easily along with addressing real-world domain and business use cases, including: @@ -43,7 +34,16 @@ Technical features available in EISK include: * Base classes for common test scenarios (component tests, integration tests) * Support for database integration tests with both in-memory database and SQL server -## System Requirements (Development) +## Core Technologies + +* Platform: [.NET Framework 6.0](https://devblogs.microsoft.com/dotnet/announcing-net-6/) - The Fastest .NET Yet +* Web Framework: ASP.NET Web API +* ORM Framework: Entity Framework +* Programming Language: C# +* Database: Sql Server (optional) +* Build and Deployment: Azure DevOps Pipelines / App Service (optional) + +### System Requirements (Development) * Visual Studio 2022 ([Free](https://visualstudio.microsoft.com/vs/community/) Community Edition or higher) From db9a3d6eea1e3d9937e63bcb21ff4c5e1267cd71 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 27 Apr 2022 00:40:59 +0100 Subject: [PATCH 195/204] Update project description --- README.md | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index b3688864..f66b84da 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,20 @@ If you like or are using this project to learn or start your solution, please gi ![eisk web api](https://github.com/EISK/eisk/blob/master/eisk-webapi-small.png) -## Simple Use Case +## EISK Features + +You can build your own RESTful web api using EISK's Visual Studio project template. It includes project structure and all utility classes mentioned below to build modern cloud-aware RESTful APIs. + +Technical features available in EISK include: + +* **Swagger/OpenAPI** based RESTful Web API, including resuable base classes +* **Clean Architecture** based implementation +* Base classes for **common CRUD functionalities** for logical layers (where applicable) +* Utility classes to generate **real-world test data** +* Base classes for **common test scenarios** (component tests, integration tests) +* Support for **database integration tests** with both in-memory database and SQL server + +### Simple Use Case Using a simple data entity 'Employee', EISK shows how we can build scalable web api's easily along with addressing real-world domain and business use cases, including: @@ -20,20 +33,6 @@ Using a simple data entity 'Employee', EISK shows how we can build scalable web * [U]pdate an existing employee record * [D]elete an existing employee record -## Technical Features - -EISK provides reusable utility classes and tools for various aspects of web development, along with unit and integration tests, building and deploying in cloud environment. - -Technical features available in EISK include: - -* Visual Studio project template that includes project structure to build modern cloud-aware RESTful APIs -* Swagger/OpenAPI based Web API specification -* Clean Architecture based implementation -* Base classes for common CRUD functionalities for logical layers (where applicable) -* Utility classes to generate real-world test data -* Base classes for common test scenarios (component tests, integration tests) -* Support for database integration tests with both in-memory database and SQL server - ## Core Technologies * Platform: [.NET Framework 6.0](https://devblogs.microsoft.com/dotnet/announcing-net-6/) - The Fastest .NET Yet From 2a7f17a1cc0d6a73fe77420b4617d3b8514573cd Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 27 Apr 2022 00:44:08 +0100 Subject: [PATCH 196/204] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f66b84da..08ed6acb 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ If you like or are using this project to learn or start your solution, please gi ## EISK Features -You can build your own RESTful web api using EISK's Visual Studio project template. It includes project structure and all utility classes mentioned below to build modern cloud-aware RESTful APIs. +You can build your own RESTful web api using EISK's Visual Studio and ASP.NET Web API project template. The template includes (but not limited to), project structure and all utility classes mentioned below to enable building modern cloud-aware RESTful APIs. Technical features available in EISK include: From 382757f4778886827ccb4f5665409eb1cf5825e6 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 27 Apr 2022 01:09:46 +0100 Subject: [PATCH 197/204] Update README.md --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 08ed6acb..1d8ebb49 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,16 @@ If you like or are using this project to learn or start your solution, please gi ![eisk web api](https://github.com/EISK/eisk/blob/master/eisk-webapi-small.png) -## EISK Features +## Simple Use Case + +Using a simple data entity 'Employee', EISK shows how we can build scalable web api's easily along with addressing real-world domain and business use cases, including: + +* [C]reating a new employee record +* [R]ead existing employee records +* [U]pdate an existing employee record +* [D]elete an existing employee record + +## Developer Features You can build your own RESTful web api using EISK's Visual Studio and ASP.NET Web API project template. The template includes (but not limited to), project structure and all utility classes mentioned below to enable building modern cloud-aware RESTful APIs. @@ -24,15 +33,6 @@ Technical features available in EISK include: * Base classes for **common test scenarios** (component tests, integration tests) * Support for **database integration tests** with both in-memory database and SQL server -### Simple Use Case - -Using a simple data entity 'Employee', EISK shows how we can build scalable web api's easily along with addressing real-world domain and business use cases, including: - -* [C]reating a new employee record -* [R]ead existing employee records -* [U]pdate an existing employee record -* [D]elete an existing employee record - ## Core Technologies * Platform: [.NET Framework 6.0](https://devblogs.microsoft.com/dotnet/announcing-net-6/) - The Fastest .NET Yet From c3b6bbef266f9d6d0937089582b8942a222e8f7f Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 27 Apr 2022 02:08:14 +0100 Subject: [PATCH 198/204] Update README.md --- README.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 1d8ebb49..c1b8088b 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,20 @@ If you like or are using this project to learn or start your solution, please gi ![eisk web api](https://github.com/EISK/eisk/blob/master/eisk-webapi-small.png) -## Simple Use Case +## Core Technologies + +* Platform: [.NET Framework 6.0](https://devblogs.microsoft.com/dotnet/announcing-net-6/) - The Fastest .NET Yet +* Web Framework: ASP.NET Web API +* ORM Framework: Entity Framework +* Programming Language: C# +* Database: Sql Server (optional) +* Build and Deployment: Azure DevOps Pipelines / App Service (optional) + +### System Requirements (Development) + +* Visual Studio 2022 ([Free](https://visualstudio.microsoft.com/vs/community/) Community Edition or higher) + +## Sample Use Case Using a simple data entity 'Employee', EISK shows how we can build scalable web api's easily along with addressing real-world domain and business use cases, including: @@ -20,7 +33,7 @@ Using a simple data entity 'Employee', EISK shows how we can build scalable web * [U]pdate an existing employee record * [D]elete an existing employee record -## Developer Features +## Dev Features You can build your own RESTful web api using EISK's Visual Studio and ASP.NET Web API project template. The template includes (but not limited to), project structure and all utility classes mentioned below to enable building modern cloud-aware RESTful APIs. @@ -33,19 +46,6 @@ Technical features available in EISK include: * Base classes for **common test scenarios** (component tests, integration tests) * Support for **database integration tests** with both in-memory database and SQL server -## Core Technologies - -* Platform: [.NET Framework 6.0](https://devblogs.microsoft.com/dotnet/announcing-net-6/) - The Fastest .NET Yet -* Web Framework: ASP.NET Web API -* ORM Framework: Entity Framework -* Programming Language: C# -* Database: Sql Server (optional) -* Build and Deployment: Azure DevOps Pipelines / App Service (optional) - -### System Requirements (Development) - -* Visual Studio 2022 ([Free](https://visualstudio.microsoft.com/vs/community/) Community Edition or higher) - ## QuickStart Guide Getting started with EISK Web Api is pretty easy. From c4d9121526376b3466b39aace07dfc5b50292741 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 27 Apr 2022 02:24:17 +0100 Subject: [PATCH 199/204] Update README.md --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c1b8088b..7bd09540 100644 --- a/README.md +++ b/README.md @@ -17,12 +17,6 @@ If you like or are using this project to learn or start your solution, please gi * Web Framework: ASP.NET Web API * ORM Framework: Entity Framework * Programming Language: C# -* Database: Sql Server (optional) -* Build and Deployment: Azure DevOps Pipelines / App Service (optional) - -### System Requirements (Development) - -* Visual Studio 2022 ([Free](https://visualstudio.microsoft.com/vs/community/) Community Edition or higher) ## Sample Use Case @@ -48,6 +42,12 @@ Technical features available in EISK include: ## QuickStart Guide +### System Requirements (Development) + +* Visual Studio 2022 ([Free](https://visualstudio.microsoft.com/vs/community/) Community Edition or higher) + +### Getting Started + Getting started with EISK Web Api is pretty easy. You can either [clone](https://github.com/EISK/eisk.webapi.git) from github or simply run the following `dotnet new` command in command prompt to create a new project from EISK: From 78409afa373c4308d66f4e3c208bf0ca788f3d96 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 27 Apr 2022 02:28:38 +0100 Subject: [PATCH 200/204] Update README.md --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7bd09540..f02e79cd 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ If you like or are using this project to learn or start your solution, please gi ## Core Technologies -* Platform: [.NET Framework 6.0](https://devblogs.microsoft.com/dotnet/announcing-net-6/) - The Fastest .NET Yet +* Platform: [.NET Framework 6.0](https://devblogs.microsoft.com/dotnet/announcing-net-6/) - The Fastest .NET Yet! * Web Framework: ASP.NET Web API * ORM Framework: Entity Framework * Programming Language: C# @@ -42,12 +42,10 @@ Technical features available in EISK include: ## QuickStart Guide -### System Requirements (Development) +Before installing EISK, all you need to have the following Visual Studio version installed. * Visual Studio 2022 ([Free](https://visualstudio.microsoft.com/vs/community/) Community Edition or higher) -### Getting Started - Getting started with EISK Web Api is pretty easy. You can either [clone](https://github.com/EISK/eisk.webapi.git) from github or simply run the following `dotnet new` command in command prompt to create a new project from EISK: @@ -59,7 +57,7 @@ Once the contents are available, just open the created solution, select "Eisk.We That's it! -### How About Old Versions? +### How about Old Versions? If you want to continue using one of the older versions of EISK, check the [releases](https://github.com/EISK/eisk.webapi/releases) page for specific instructions to install and use older versions of EISK. From 21f2672526a4b99b2190c2b0ccd70029c98d8c56 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 27 Apr 2022 02:47:39 +0100 Subject: [PATCH 201/204] Update README.md --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f02e79cd..d308f63d 100644 --- a/README.md +++ b/README.md @@ -33,12 +33,11 @@ You can build your own RESTful web api using EISK's Visual Studio and ASP.NET We Technical features available in EISK include: -* **Swagger/OpenAPI** based RESTful Web API, including resuable base classes * **Clean Architecture** based implementation -* Base classes for **common CRUD functionalities** for logical layers (where applicable) -* Utility classes to generate **real-world test data** -* Base classes for **common test scenarios** (component tests, integration tests) -* Support for **database integration tests** with both in-memory database and SQL server +* **Swagger/OpenAPI** based RESTful Web API, including resuable base classes +* **Base classes** for common CRUD functionalities and testing for logical layers (i.e. controller, domain, data layers) +* **Utility classes** to generate real-world test data +* Support for database integration tests with both in-memory database and SQL server ## QuickStart Guide From b45b018822d9c935e2b4e236ad4e56bb7eca89c7 Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 27 Apr 2022 02:51:30 +0100 Subject: [PATCH 202/204] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d308f63d..c7f5077a 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,9 @@ Using a simple data entity 'Employee', EISK shows how we can build scalable web ## Dev Features -You can build your own RESTful web api using EISK's Visual Studio and ASP.NET Web API project template. The template includes (but not limited to), project structure and all utility classes mentioned below to enable building modern cloud-aware RESTful APIs. +You can build your own RESTful web api using EISK's Visual Studio and ASP.NET Web API project template. -Technical features available in EISK include: +The template includes (but not limited to), project structure and all utility classes mentioned below to enable building modern cloud-aware RESTful APIs. * **Clean Architecture** based implementation * **Swagger/OpenAPI** based RESTful Web API, including resuable base classes From 323f2a7f79ed40ac2d9d75c48c6d7d4cb129ccaa Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 27 Apr 2022 03:14:57 +0100 Subject: [PATCH 203/204] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c7f5077a..584ee6e0 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,8 @@ Using a simple data entity 'Employee', EISK shows how we can build scalable web * [U]pdate an existing employee record * [D]elete an existing employee record +Check the [Live Demo](https://eisk-webapi.azurewebsites.net) to see the use case implementation in action. + ## Dev Features You can build your own RESTful web api using EISK's Visual Studio and ASP.NET Web API project template. @@ -56,7 +58,7 @@ Once the contents are available, just open the created solution, select "Eisk.We That's it! -### How about Old Versions? +### How About Old Versions? If you want to continue using one of the older versions of EISK, check the [releases](https://github.com/EISK/eisk.webapi/releases) page for specific instructions to install and use older versions of EISK. From 5cef9585cb907d017c5aa520d5d718db59f00a3b Mon Sep 17 00:00:00 2001 From: Ashraf Alam Date: Wed, 27 Apr 2022 03:18:30 +0100 Subject: [PATCH 204/204] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 584ee6e0..4d94bcd6 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,6 @@ With an optional set of customizable utility classes, samples and tools, it lets If you like or are using this project to learn or start your solution, please give it a [star](https://github.com/EISK/eisk.webapi). Thanks! -![eisk web api](https://github.com/EISK/eisk/blob/master/eisk-webapi-small.png) - ## Core Technologies * Platform: [.NET Framework 6.0](https://devblogs.microsoft.com/dotnet/announcing-net-6/) - The Fastest .NET Yet! @@ -27,6 +25,8 @@ Using a simple data entity 'Employee', EISK shows how we can build scalable web * [U]pdate an existing employee record * [D]elete an existing employee record +![eisk web api](https://github.com/EISK/eisk/blob/master/eisk-webapi-small.png) + Check the [Live Demo](https://eisk-webapi.azurewebsites.net) to see the use case implementation in action. ## Dev Features