diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json new file mode 100644 index 0000000..c8ac17c --- /dev/null +++ b/.config/dotnet-tools.json @@ -0,0 +1,13 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-outdated-tool": { + "version": "4.6.4", + "commands": [ + "dotnet-outdated" + ], + "rollForward": false + } + } +} \ No newline at end of file diff --git a/README.md b/README.md index 6b76c4c..aade3b8 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,8 @@ - [The Goals of This Project](#the-goals-of-this-project) - [Technologies - Libraries](#technologies---libraries) - [Structure of Project](#structure-of-project) +- [Development Setup](#development_setup) + - [Dotnet Tool Packages](#dotnet_tool_packages) - [How to Run](#how-to-run) - [Docker Compose](#docker-compose) @@ -21,7 +23,7 @@ - :sparkle: Using `Domain Driven Design (DDD)` for implementing `business processes` and `validation rules`. - :sparkle: Adopting `CQRS` implementation with the `MediatR` library for better separation of `write` and `read` operations. - :sparkle: Implementing `MediatR` to `reduce coupling` and provide support for managing `cross-cutting concerns` within `pipelines`, including `validation` and `transaction handling` for the application. -- :sparkle: Using `SqlServer` as our `relational database` management system at the database level. +- :sparkle: Using `Postgres` as our `relational database` management system at the database level. - :sparkle: Incorporating `Unit Testing`, `Integration Testing`, and `End To End Testing` for testing level to ensure the `robustness` and `reliability` of the application. - :sparkle: Utilizing `Fluent Validation` and a `Validation Pipeline Behaviour` on top of `MediatR` to validate requests and responses and ensure `data integrity`. - :sparkle: Using `Minimal API` for all endpoints to create a `lightweight` and `streamlined` API. @@ -29,7 +31,7 @@ ## Technologies - Libraries -- ✔️ **[`.NET 7`](https://dotnet.microsoft.com/download)** - .NET Framework and .NET Core, including ASP.NET and ASP.NET Core +- ✔️ **[`.NET 8`](https://dotnet.microsoft.com/download)** - .NET Framework and .NET Core, including ASP.NET and ASP.NET Core - ✔️ **[`MVC Versioning API`](https://github.com/microsoft/aspnet-api-versioning)** - Set of libraries which add service API versioning to ASP.NET Web API, OData with ASP.NET Web API, and ASP.NET Core - ✔️ **[`EF Core`](https://github.com/dotnet/efcore)** - Modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations - ✔️ **[`MediatR`](https://github.com/jbogard/MediatR)** - Simple, unambitious mediator implementation in .NET. @@ -68,6 +70,18 @@ With `CQRS`, we can `reduce coupling` between layers and tune down specific meth Overall, by using the `REPR` pattern and `CQRS` with the `Mediator` pattern, we can create a `better-structured` and more `maintainable` application, with improved `separation of concerns`. +## Development Setup + +### Dotnet Tool Packages +For installing our requirement package with .NET cli tools, we need to install `dotnet tool manifest`. +```bash +dotnet new tool-manifest +``` +And after that we can restore our dotnet tool packages with .NET cli tools from `.config` folder and `dotnet-tools.json` file. +``` +dotnet tool restore +``` + ## How to Run ### Docker Compose diff --git a/deployments/docker-compose/docker-compose.yml b/deployments/docker-compose/docker-compose.yml index be51598..bb39afa 100644 --- a/deployments/docker-compose/docker-compose.yml +++ b/deployments/docker-compose/docker-compose.yml @@ -1,17 +1,24 @@ version: "3.3" services: - ###################################################### - # SqlServer - ###################################################### - sql: - container_name: sql - image: mcr.microsoft.com/mssql/server - ports: - - "1433:1433" - environment: - SA_PASSWORD: "Password@1234" - ACCEPT_EULA: "Y" + ####################################################### + # Postgres + ###################################################### + postgres: + image: postgres:latest + container_name: postgres + restart: unless-stopped + ports: + - '5432:5432' + environment: + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres + command: + - "postgres" + - "-c" + - "wal_level=logical" + - "-c" + - "max_prepared_transactions=10" ####################################################### diff --git a/global.json b/global.json new file mode 100644 index 0000000..0c6b103 --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "version": "8.0.303", + "rollForward": "latestFeature" + } + } \ No newline at end of file diff --git a/src/BuildingBlocks/BuildingBlocks.csproj b/src/BuildingBlocks/BuildingBlocks.csproj index 004ee41..8d12339 100644 --- a/src/BuildingBlocks/BuildingBlocks.csproj +++ b/src/BuildingBlocks/BuildingBlocks.csproj @@ -1,73 +1,73 @@ - net7.0 + net8.0 enable - - - - - - - + + + + + + - + - - + + - - - + + + + - - + + - - - - - - - - - + + + + + + + + - - + + - - - - + + + + - + - - - + + + - - + + + - + - + - - - - - + + + + + diff --git a/src/BuildingBlocks/EFCore/Extensions.cs b/src/BuildingBlocks/EFCore/Extensions.cs index 42b884a..3f5c07a 100644 --- a/src/BuildingBlocks/EFCore/Extensions.cs +++ b/src/BuildingBlocks/EFCore/Extensions.cs @@ -20,15 +20,17 @@ public static IServiceCollection AddCustomDbContext( this IServiceCollection services) where TContext : DbContext, IDbContext { - services.AddValidateOptions(); + AppContext.SetSwitch("Npgsql.EnableLegacyTimestampBehavior", true); + + services.AddValidateOptions(); services.AddDbContext((sp, options) => { - var postgresOptions = sp.GetRequiredService(); + var postgresOptions = sp.GetRequiredService(); Guard.Against.Null(options, nameof(postgresOptions)); - options.UseSqlServer(postgresOptions?.ConnectionString, + options.UseNpgsql(postgresOptions?.ConnectionString, dbOptions => { dbOptions.MigrationsAssembly(typeof(TContext).Assembly.GetName().Name); diff --git a/src/BuildingBlocks/EFCore/SqlOptions.cs b/src/BuildingBlocks/EFCore/PostgresOptions.cs similarity index 75% rename from src/BuildingBlocks/EFCore/SqlOptions.cs rename to src/BuildingBlocks/EFCore/PostgresOptions.cs index 3beb8ea..aeaf85a 100644 --- a/src/BuildingBlocks/EFCore/SqlOptions.cs +++ b/src/BuildingBlocks/EFCore/PostgresOptions.cs @@ -1,6 +1,6 @@ namespace BuildingBlocks.EFCore; -public class SqlOptions +public class PostgresOptions { public string ConnectionString { get; set; } } diff --git a/src/BuildingBlocks/TestBase/TestBase.cs b/src/BuildingBlocks/TestBase/TestBase.cs index 6ebe14a..cc6572e 100644 --- a/src/BuildingBlocks/TestBase/TestBase.cs +++ b/src/BuildingBlocks/TestBase/TestBase.cs @@ -20,9 +20,9 @@ namespace BuildingBlocks.TestBase; -using System.Globalization; using Microsoft.Data.SqlClient; -using Testcontainers.MsSql; +using Npgsql; +using Testcontainers.PostgreSql; public class TestFixture : IAsyncLifetime where TEntryPoint : class @@ -31,14 +31,13 @@ public class TestFixture : IAsyncLifetime private static int Timeout => 120; // Second private ITestHarness TestHarness => ServiceProvider?.GetTestHarness(); private Action TestRegistrationServices { get; set; } - private MsSqlContainer MsSqlTestContainer; + private PostgreSqlContainer _postgreSqlContainer; public HttpClient HttpClient => _factory?.CreateClient(); public IServiceProvider ServiceProvider => _factory?.Services; public IConfiguration Configuration => _factory?.Services.GetRequiredService(); public ILogger Logger { get; set; } - protected TestFixture() { _factory = new WebApplicationFactory() @@ -177,21 +176,21 @@ private static async Task WaitUntilConditionMet(Func> condition private async Task StartTestContainerAsync() { - MsSqlTestContainer = TestContainers.MsSqlTestContainer(); + _postgreSqlContainer = TestContainers.PostgresTestContainer(); - await MsSqlTestContainer.StartAsync(); + await _postgreSqlContainer.StartAsync(); } private async Task StopTestContainerAsync() { - await MsSqlTestContainer.StopAsync(); + await _postgreSqlContainer.StopAsync(); } private void AddCustomAppSettings(IConfigurationBuilder configuration) { configuration.AddInMemoryCollection(new KeyValuePair[] { - new("SqlOptions:ConnectionString", MsSqlTestContainer.GetConnectionString()), + new("PostgresOptions:ConnectionString", _postgreSqlContainer.GetConnectionString()), }); } @@ -334,7 +333,7 @@ public class TestFixtureCore : IAsyncLifetime where TEntryPoint : class { private Respawner _reSpawnerDefaultDb; - private SqlConnection DefaultDbConnection { get; set; } + private NpgsqlConnection _defaultDbConnection; public TestFixtureCore(TestFixture integrationTestFixture, ITestOutputHelper outputHelper) { @@ -348,35 +347,35 @@ public TestFixtureCore(TestFixture integrationTestFixture, ITestOut public async Task InitializeAsync() { - await InitSqlAsync(); + await InitDatabaseAsync(); } public async Task DisposeAsync() { - await ResetSqlAsync(); + await ResetDatabaseAsync(); } - private async Task InitSqlAsync() + private async Task InitDatabaseAsync() { - var sqlOptions = Fixture.ServiceProvider.GetService(); + var postgresOptions = Fixture.ServiceProvider.GetService(); - if (!string.IsNullOrEmpty(sqlOptions?.ConnectionString)) + if (!string.IsNullOrEmpty(postgresOptions?.ConnectionString)) { - DefaultDbConnection = new SqlConnection(sqlOptions.ConnectionString); - await DefaultDbConnection.OpenAsync(); + _defaultDbConnection = new NpgsqlConnection(postgresOptions.ConnectionString); + await _defaultDbConnection.OpenAsync(); - _reSpawnerDefaultDb = await Respawner.CreateAsync(DefaultDbConnection, - new RespawnerOptions { DbAdapter = DbAdapter.SqlServer }); + _reSpawnerDefaultDb = await Respawner.CreateAsync(_defaultDbConnection, + new RespawnerOptions { DbAdapter = DbAdapter.Postgres }); await SeedDataAsync(); } } - private async Task ResetSqlAsync() + private async Task ResetDatabaseAsync() { - if (DefaultDbConnection is not null) + if (_defaultDbConnection is not null) { - await _reSpawnerDefaultDb.ResetAsync(DefaultDbConnection); + await _reSpawnerDefaultDb.ResetAsync(_defaultDbConnection); } } diff --git a/src/BuildingBlocks/TestBase/TestContainers.cs b/src/BuildingBlocks/TestBase/TestContainers.cs index 67edf53..e737276 100644 --- a/src/BuildingBlocks/TestBase/TestContainers.cs +++ b/src/BuildingBlocks/TestBase/TestContainers.cs @@ -1,39 +1,42 @@ namespace BuildingBlocks.TestBase; -using Testcontainers.MsSql; +using Testcontainers.PostgreSql; using Web; public static class TestContainers { - public static MsSqlContainerOptions MsSqlContainerConfiguration { get;} + public static PostgresContainerOptions PostgresContainerConfiguration { get; } static TestContainers() { var configuration = ConfigurationHelper.GetConfiguration(); - MsSqlContainerConfiguration = configuration.GetOptions(nameof(MsSqlContainerOptions)); + PostgresContainerConfiguration = + configuration.GetOptions(nameof(PostgresContainerOptions)); } - public static MsSqlContainer MsSqlTestContainer() + public static PostgreSqlContainer PostgresTestContainer() { - var baseBuilder = new MsSqlBuilder() - .WithPassword(MsSqlContainerConfiguration.Password) + var baseBuilder = new PostgreSqlBuilder() + .WithUsername(PostgresContainerConfiguration.UserName) + .WithPassword(PostgresContainerConfiguration.Password) .WithLabel("Key", "Value"); var builder = baseBuilder - .WithImage(MsSqlContainerConfiguration.ImageName) - .WithName(MsSqlContainerConfiguration.Name) - .WithPortBinding(MsSqlContainerConfiguration.Port, true) + .WithImage(PostgresContainerConfiguration.ImageName) + .WithName(PostgresContainerConfiguration.Name) + .WithCommand(new string[2] { "-c", "max_prepared_transactions=10" }) + .WithPortBinding(PostgresContainerConfiguration.Port, true) .Build(); return builder; } - public sealed class MsSqlContainerOptions + public sealed class PostgresContainerOptions { - public string Name { get; set; } = "msSql_" + Guid.NewGuid().ToString("D"); - public int Port { get; set; } = 1433; - public string ImageName { get; set; } = "mcr.microsoft.com/mssql/server"; + public string Name { get; set; } = "postgreSql_" + Guid.NewGuid().ToString("D"); + public int Port { get; set; } = 5432; + public string ImageName { get; set; } = "postgres:latest"; public string UserName { get; set; } = Guid.NewGuid().ToString("D"); public string Password { get; set; } = Guid.NewGuid().ToString("D"); } diff --git a/src/ECommerce.Api/ECommerce.Api.csproj b/src/ECommerce.Api/ECommerce.Api.csproj index b32548e..8b10add 100644 --- a/src/ECommerce.Api/ECommerce.Api.csproj +++ b/src/ECommerce.Api/ECommerce.Api.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable diff --git a/src/ECommerce.Api/appsettings.docker.json b/src/ECommerce.Api/appsettings.docker.json index e35354f..9523df3 100644 --- a/src/ECommerce.Api/appsettings.docker.json +++ b/src/ECommerce.Api/appsettings.docker.json @@ -1,5 +1,5 @@ { - "SqlOptions": { - "ConnectionString": "Server=sql;Database=EcommerceDB;User ID=sa;Password=Password@1234;TrustServerCertificate=True" + "PostgresOptions": { + "ConnectionString": "Server=postgres;Port=5432;Database=ecommerce_db;User Id=postgres;Password=postgres;Include Error Detail=true" } } diff --git a/src/ECommerce.Api/appsettings.json b/src/ECommerce.Api/appsettings.json index d446214..baa2e47 100644 --- a/src/ECommerce.Api/appsettings.json +++ b/src/ECommerce.Api/appsettings.json @@ -6,8 +6,8 @@ "Level": "information", "LogTemplate": "{Timestamp:HH:mm:ss} [{Level:u4}] {Message:lj}{NewLine}{Exception}" }, - "SqlOptions": { - "ConnectionString": "Server=.\\sqlexpress;Database=EcommerceDB;Trusted_Connection=True;MultipleActiveResultSets=true;TrustServerCertificate=True" + "PostgresOptions": { + "ConnectionString": "Server=localhost;Port=5432;Database=ecommerce_db;User Id=postgres;Password=postgres;Include Error Detail=true" }, "AllowedHosts": "*" } diff --git a/src/ECommerce/Data/DesignTimeDbContextFactory.cs b/src/ECommerce/Data/DesignTimeDbContextFactory.cs index 81792f3..75cc584 100644 --- a/src/ECommerce/Data/DesignTimeDbContextFactory.cs +++ b/src/ECommerce/Data/DesignTimeDbContextFactory.cs @@ -9,8 +9,7 @@ public ECommerceDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder(); - builder.UseSqlServer( - "Server=.\\sqlexpress;Database=EcommerceDB;Trusted_Connection=True;MultipleActiveResultSets=true;TrustServerCertificate=True"); + builder.UseNpgsql("Server=localhost;Port=5432;Database=ecommerce_db;User Id=postgres;Password=postgres;Include Error Detail=true"); return new ECommerceDbContext(builder.Options); } } diff --git a/src/ECommerce/ECommerce.csproj b/src/ECommerce/ECommerce.csproj index 8761a50..dae3417 100644 --- a/src/ECommerce/ECommerce.csproj +++ b/src/ECommerce/ECommerce.csproj @@ -1,12 +1,12 @@ - net7.0 + net8.0 enable - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/ECommerce/Data/Migrations/20230505144008_Init.Designer.cs b/src/ECommerce/Migrations/20240822130156_Init.Designer.cs similarity index 82% rename from src/ECommerce/Data/Migrations/20230505144008_Init.Designer.cs rename to src/ECommerce/Migrations/20240822130156_Init.Designer.cs index 708fdce..4a1ad84 100644 --- a/src/ECommerce/Data/Migrations/20230505144008_Init.Designer.cs +++ b/src/ECommerce/Migrations/20240822130156_Init.Designer.cs @@ -3,16 +3,16 @@ using ECommerce.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable -namespace ECommerce.Data.Migrations +namespace ECommerce.Migrations { [DbContext(typeof(ECommerceDbContext))] - [Migration("20230505144008_Init")] + [Migration("20240822130156_Init")] partial class Init { /// @@ -20,27 +20,27 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "7.0.2") - .HasAnnotation("Relational:MaxIdentifierLength", 128); + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 63); - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("ECommerce.Categories.Models.Category", b => { b.Property("Id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("CreatedAt") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("CreatedBy") .HasColumnType("bigint"); b.Property("IsDeleted") - .HasColumnType("bit"); + .HasColumnType("boolean"); b.Property("LastModified") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("LastModifiedBy") .HasColumnType("bigint"); @@ -57,19 +57,19 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("ECommerce.Customers.Models.Customer", b => { b.Property("Id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("CreatedAt") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("CreatedBy") .HasColumnType("bigint"); b.Property("IsDeleted") - .HasColumnType("bit"); + .HasColumnType("boolean"); b.Property("LastModified") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("LastModifiedBy") .HasColumnType("bigint"); @@ -86,19 +86,19 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("ECommerce.Inventories.Models.Inventory", b => { b.Property("Id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("CreatedAt") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("CreatedBy") .HasColumnType("bigint"); b.Property("IsDeleted") - .HasColumnType("bit"); + .HasColumnType("boolean"); b.Property("LastModified") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("LastModifiedBy") .HasColumnType("bigint"); @@ -115,33 +115,33 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("ECommerce.Inventories.Models.InventoryItems", b => { b.Property("Id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("CreatedAt") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("CreatedBy") .HasColumnType("bigint"); b.Property("InventoryId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("IsDeleted") - .HasColumnType("bit"); + .HasColumnType("boolean"); b.Property("LastModified") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("LastModifiedBy") .HasColumnType("bigint"); b.Property("ProductId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") + .HasColumnType("text") .HasDefaultValue("InStock"); b.Property("Version") @@ -160,22 +160,22 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("ECommerce.Orders.Models.Order", b => { b.Property("Id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("CreatedAt") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("CreatedBy") .HasColumnType("bigint"); b.Property("CustomerId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("IsDeleted") - .HasColumnType("bit"); + .HasColumnType("boolean"); b.Property("LastModified") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("LastModifiedBy") .HasColumnType("bigint"); @@ -183,7 +183,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") + .HasColumnType("text") .HasDefaultValue("Pending"); b.Property("Version") @@ -200,28 +200,28 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("ECommerce.Orders.Models.OrderItem", b => { b.Property("Id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("CreatedAt") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("CreatedBy") .HasColumnType("bigint"); b.Property("IsDeleted") - .HasColumnType("bit"); + .HasColumnType("boolean"); b.Property("LastModified") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("LastModifiedBy") .HasColumnType("bigint"); b.Property("OrderId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("ProductId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("Version") .IsConcurrencyToken() @@ -239,25 +239,25 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) modelBuilder.Entity("ECommerce.Products.Models.Product", b => { b.Property("Id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("CategoryId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("CreatedAt") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("CreatedBy") .HasColumnType("bigint"); b.Property("IsBreakable") - .HasColumnType("bit"); + .HasColumnType("boolean"); b.Property("IsDeleted") - .HasColumnType("bit"); + .HasColumnType("boolean"); b.Property("LastModified") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("LastModifiedBy") .HasColumnType("bigint"); @@ -278,12 +278,12 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Categories.ValueObjects.Name", "Name", b1 => { b1.Property("CategoryId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .IsRequired() .HasMaxLength(50) - .HasColumnType("nvarchar(50)") + .HasColumnType("character varying(50)") .HasColumnName("Name"); b1.HasKey("CategoryId"); @@ -302,11 +302,11 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Customers.ValueObjects.Address", "Address", b1 => { b1.Property("CustomerId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .IsRequired() - .HasColumnType("nvarchar(max)") + .HasColumnType("text") .HasColumnName("Address"); b1.HasKey("CustomerId"); @@ -320,11 +320,11 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Customers.ValueObjects.Mobile", "Mobile", b1 => { b1.Property("CustomerId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .IsRequired() - .HasColumnType("nvarchar(max)") + .HasColumnType("text") .HasColumnName("Mobile"); b1.HasKey("CustomerId"); @@ -338,11 +338,11 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Customers.ValueObjects.Name", "Name", b1 => { b1.Property("CustomerId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .IsRequired() - .HasColumnType("nvarchar(max)") + .HasColumnType("text") .HasColumnName("Name"); b1.HasKey("CustomerId"); @@ -365,12 +365,12 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Inventories.ValueObjects.Name", "Name", b1 => { b1.Property("InventoryId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .IsRequired() .HasMaxLength(50) - .HasColumnType("nvarchar(50)") + .HasColumnType("character varying(50)") .HasColumnName("Name"); b1.HasKey("InventoryId"); @@ -397,11 +397,11 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Inventories.ValueObjects.Quantity", "Quantity", b1 => { b1.Property("InventoryItemsId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .HasMaxLength(20) - .HasColumnType("int") + .HasColumnType("integer") .HasColumnName("Quantity"); b1.HasKey("InventoryItemsId"); @@ -428,10 +428,10 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Orders.ValueObjects.OrderDate", "OrderDate", b1 => { b1.Property("OrderId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") - .HasColumnType("datetime2") + .HasColumnType("timestamp with time zone") .HasColumnName("OrderDate"); b1.HasKey("OrderId"); @@ -445,7 +445,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Orders.ValueObjects.TotalPrice", "TotalPrice", b1 => { b1.Property("OrderId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .HasColumnType("decimal(18,2)") @@ -479,10 +479,10 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Orders.ValueObjects.Quantity", "Quantity", b1 => { b1.Property("OrderItemId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") - .HasColumnType("int") + .HasColumnType("integer") .HasColumnName("Quantity"); b1.HasKey("OrderItemId"); @@ -509,12 +509,12 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Products.ValueObjects.Barcode", "Barcode", b1 => { b1.Property("ProductId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .IsRequired() .HasMaxLength(20) - .HasColumnType("nvarchar(20)") + .HasColumnType("character varying(20)") .HasColumnName("Barcode"); b1.HasKey("ProductId"); @@ -528,12 +528,12 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Products.ValueObjects.Description", "Description", b1 => { b1.Property("ProductId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .IsRequired() .HasMaxLength(200) - .HasColumnType("nvarchar(200)") + .HasColumnType("character varying(200)") .HasColumnName("Description"); b1.HasKey("ProductId"); @@ -547,12 +547,12 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Products.ValueObjects.Name", "Name", b1 => { b1.Property("ProductId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .IsRequired() .HasMaxLength(50) - .HasColumnType("nvarchar(50)") + .HasColumnType("character varying(50)") .HasColumnName("Name"); b1.HasKey("ProductId"); @@ -566,7 +566,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Products.ValueObjects.NetPrice", "NetPrice", b1 => { b1.Property("ProductId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .HasColumnType("decimal(18,2)") @@ -583,7 +583,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Products.ValueObjects.Price", "Price", b1 => { b1.Property("ProductId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .HasColumnType("decimal(18,2)") @@ -600,7 +600,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Products.ValueObjects.ProfitMargin", "ProfitMargin", b1 => { b1.Property("ProductId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .HasColumnType("decimal(18,2)") diff --git a/src/ECommerce/Data/Migrations/20230505144008_Init.cs b/src/ECommerce/Migrations/20240822130156_Init.cs similarity index 64% rename from src/ECommerce/Data/Migrations/20230505144008_Init.cs rename to src/ECommerce/Migrations/20240822130156_Init.cs index 45ed428..c3e8a48 100644 --- a/src/ECommerce/Data/Migrations/20230505144008_Init.cs +++ b/src/ECommerce/Migrations/20240822130156_Init.cs @@ -3,7 +3,7 @@ #nullable disable -namespace ECommerce.Data.Migrations +namespace ECommerce.Migrations { /// public partial class Init : Migration @@ -15,13 +15,13 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "Category", columns: table => new { - Id = table.Column(type: "uniqueidentifier", nullable: false), - Name = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), - CreatedAt = table.Column(type: "datetime2", nullable: true), + Id = table.Column(type: "uuid", nullable: false), + Name = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: true), CreatedBy = table.Column(type: "bigint", nullable: true), - LastModified = table.Column(type: "datetime2", nullable: true), + LastModified = table.Column(type: "timestamp with time zone", nullable: true), LastModifiedBy = table.Column(type: "bigint", nullable: true), - IsDeleted = table.Column(type: "bit", nullable: false), + IsDeleted = table.Column(type: "boolean", nullable: false), Version = table.Column(type: "bigint", nullable: false) }, constraints: table => @@ -33,15 +33,15 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "Customer", columns: table => new { - Id = table.Column(type: "uniqueidentifier", nullable: false), - Name = table.Column(type: "nvarchar(max)", nullable: true), - Mobile = table.Column(type: "nvarchar(max)", nullable: true), - Address = table.Column(type: "nvarchar(max)", nullable: true), - CreatedAt = table.Column(type: "datetime2", nullable: true), + Id = table.Column(type: "uuid", nullable: false), + Name = table.Column(type: "text", nullable: true), + Mobile = table.Column(type: "text", nullable: true), + Address = table.Column(type: "text", nullable: true), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: true), CreatedBy = table.Column(type: "bigint", nullable: true), - LastModified = table.Column(type: "datetime2", nullable: true), + LastModified = table.Column(type: "timestamp with time zone", nullable: true), LastModifiedBy = table.Column(type: "bigint", nullable: true), - IsDeleted = table.Column(type: "bit", nullable: false), + IsDeleted = table.Column(type: "boolean", nullable: false), Version = table.Column(type: "bigint", nullable: false) }, constraints: table => @@ -53,13 +53,13 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "Inventory", columns: table => new { - Id = table.Column(type: "uniqueidentifier", nullable: false), - Name = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), - CreatedAt = table.Column(type: "datetime2", nullable: true), + Id = table.Column(type: "uuid", nullable: false), + Name = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: true), CreatedBy = table.Column(type: "bigint", nullable: true), - LastModified = table.Column(type: "datetime2", nullable: true), + LastModified = table.Column(type: "timestamp with time zone", nullable: true), LastModifiedBy = table.Column(type: "bigint", nullable: true), - IsDeleted = table.Column(type: "bit", nullable: false), + IsDeleted = table.Column(type: "boolean", nullable: false), Version = table.Column(type: "bigint", nullable: false) }, constraints: table => @@ -71,20 +71,20 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "Product", columns: table => new { - Id = table.Column(type: "uniqueidentifier", nullable: false), - Name = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), - Barcode = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), - Description = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), - CategoryId = table.Column(type: "uniqueidentifier", nullable: true), - IsBreakable = table.Column(type: "bit", nullable: false), - Price = table.Column(type: "decimal(18,2)", nullable: true), - NetPrice = table.Column(type: "decimal(18,2)", nullable: true), - ProfitMargin = table.Column(type: "decimal(18,2)", nullable: true), - CreatedAt = table.Column(type: "datetime2", nullable: true), + Id = table.Column(type: "uuid", nullable: false), + Name = table.Column(type: "character varying(50)", maxLength: 50, nullable: true), + Barcode = table.Column(type: "character varying(20)", maxLength: 20, nullable: true), + Description = table.Column(type: "character varying(200)", maxLength: 200, nullable: true), + CategoryId = table.Column(type: "uuid", nullable: true), + IsBreakable = table.Column(type: "boolean", nullable: false), + Price = table.Column(type: "numeric(18,2)", nullable: true), + NetPrice = table.Column(type: "numeric(18,2)", nullable: true), + ProfitMargin = table.Column(type: "numeric(18,2)", nullable: true), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: true), CreatedBy = table.Column(type: "bigint", nullable: true), - LastModified = table.Column(type: "datetime2", nullable: true), + LastModified = table.Column(type: "timestamp with time zone", nullable: true), LastModifiedBy = table.Column(type: "bigint", nullable: true), - IsDeleted = table.Column(type: "bit", nullable: false), + IsDeleted = table.Column(type: "boolean", nullable: false), Version = table.Column(type: "bigint", nullable: false) }, constraints: table => @@ -101,16 +101,16 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "Order", columns: table => new { - Id = table.Column(type: "uniqueidentifier", nullable: false), - CustomerId = table.Column(type: "uniqueidentifier", nullable: true), - Status = table.Column(type: "nvarchar(max)", nullable: false, defaultValue: "Pending"), - TotalPrice = table.Column(type: "decimal(18,2)", nullable: true), - OrderDate = table.Column(type: "datetime2", nullable: true), - CreatedAt = table.Column(type: "datetime2", nullable: true), + Id = table.Column(type: "uuid", nullable: false), + CustomerId = table.Column(type: "uuid", nullable: true), + Status = table.Column(type: "text", nullable: false, defaultValue: "Pending"), + TotalPrice = table.Column(type: "numeric(18,2)", nullable: true), + OrderDate = table.Column(type: "timestamp with time zone", nullable: true), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: true), CreatedBy = table.Column(type: "bigint", nullable: true), - LastModified = table.Column(type: "datetime2", nullable: true), + LastModified = table.Column(type: "timestamp with time zone", nullable: true), LastModifiedBy = table.Column(type: "bigint", nullable: true), - IsDeleted = table.Column(type: "bit", nullable: false), + IsDeleted = table.Column(type: "boolean", nullable: false), Version = table.Column(type: "bigint", nullable: false) }, constraints: table => @@ -127,16 +127,16 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "InventoryItems", columns: table => new { - Id = table.Column(type: "uniqueidentifier", nullable: false), - InventoryId = table.Column(type: "uniqueidentifier", nullable: true), - ProductId = table.Column(type: "uniqueidentifier", nullable: true), - Quantity = table.Column(type: "int", maxLength: 20, nullable: true), - Status = table.Column(type: "nvarchar(max)", nullable: false, defaultValue: "InStock"), - CreatedAt = table.Column(type: "datetime2", nullable: true), + Id = table.Column(type: "uuid", nullable: false), + InventoryId = table.Column(type: "uuid", nullable: true), + ProductId = table.Column(type: "uuid", nullable: true), + Quantity = table.Column(type: "integer", maxLength: 20, nullable: true), + Status = table.Column(type: "text", nullable: false, defaultValue: "InStock"), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: true), CreatedBy = table.Column(type: "bigint", nullable: true), - LastModified = table.Column(type: "datetime2", nullable: true), + LastModified = table.Column(type: "timestamp with time zone", nullable: true), LastModifiedBy = table.Column(type: "bigint", nullable: true), - IsDeleted = table.Column(type: "bit", nullable: false), + IsDeleted = table.Column(type: "boolean", nullable: false), Version = table.Column(type: "bigint", nullable: false) }, constraints: table => @@ -158,15 +158,15 @@ protected override void Up(MigrationBuilder migrationBuilder) name: "OrderItem", columns: table => new { - Id = table.Column(type: "uniqueidentifier", nullable: false), - ProductId = table.Column(type: "uniqueidentifier", nullable: true), - OrderId = table.Column(type: "uniqueidentifier", nullable: true), - Quantity = table.Column(type: "int", nullable: true), - CreatedAt = table.Column(type: "datetime2", nullable: true), + Id = table.Column(type: "uuid", nullable: false), + ProductId = table.Column(type: "uuid", nullable: true), + OrderId = table.Column(type: "uuid", nullable: true), + Quantity = table.Column(type: "integer", nullable: true), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: true), CreatedBy = table.Column(type: "bigint", nullable: true), - LastModified = table.Column(type: "datetime2", nullable: true), + LastModified = table.Column(type: "timestamp with time zone", nullable: true), LastModifiedBy = table.Column(type: "bigint", nullable: true), - IsDeleted = table.Column(type: "bit", nullable: false), + IsDeleted = table.Column(type: "boolean", nullable: false), Version = table.Column(type: "bigint", nullable: false) }, constraints: table => diff --git a/src/ECommerce/Data/Migrations/ECommerceDbContextModelSnapshot.cs b/src/ECommerce/Migrations/ECommerceDbContextModelSnapshot.cs similarity index 82% rename from src/ECommerce/Data/Migrations/ECommerceDbContextModelSnapshot.cs rename to src/ECommerce/Migrations/ECommerceDbContextModelSnapshot.cs index 6cd9e57..6d0c995 100644 --- a/src/ECommerce/Data/Migrations/ECommerceDbContextModelSnapshot.cs +++ b/src/ECommerce/Migrations/ECommerceDbContextModelSnapshot.cs @@ -3,12 +3,12 @@ using ECommerce.Data; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable -namespace ECommerce.Data.Migrations +namespace ECommerce.Migrations { [DbContext(typeof(ECommerceDbContext))] partial class ECommerceDbContextModelSnapshot : ModelSnapshot @@ -17,27 +17,27 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "7.0.2") - .HasAnnotation("Relational:MaxIdentifierLength", 128); + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 63); - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("ECommerce.Categories.Models.Category", b => { b.Property("Id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("CreatedAt") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("CreatedBy") .HasColumnType("bigint"); b.Property("IsDeleted") - .HasColumnType("bit"); + .HasColumnType("boolean"); b.Property("LastModified") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("LastModifiedBy") .HasColumnType("bigint"); @@ -54,19 +54,19 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("ECommerce.Customers.Models.Customer", b => { b.Property("Id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("CreatedAt") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("CreatedBy") .HasColumnType("bigint"); b.Property("IsDeleted") - .HasColumnType("bit"); + .HasColumnType("boolean"); b.Property("LastModified") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("LastModifiedBy") .HasColumnType("bigint"); @@ -83,19 +83,19 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("ECommerce.Inventories.Models.Inventory", b => { b.Property("Id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("CreatedAt") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("CreatedBy") .HasColumnType("bigint"); b.Property("IsDeleted") - .HasColumnType("bit"); + .HasColumnType("boolean"); b.Property("LastModified") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("LastModifiedBy") .HasColumnType("bigint"); @@ -112,33 +112,33 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("ECommerce.Inventories.Models.InventoryItems", b => { b.Property("Id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("CreatedAt") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("CreatedBy") .HasColumnType("bigint"); b.Property("InventoryId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("IsDeleted") - .HasColumnType("bit"); + .HasColumnType("boolean"); b.Property("LastModified") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("LastModifiedBy") .HasColumnType("bigint"); b.Property("ProductId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") + .HasColumnType("text") .HasDefaultValue("InStock"); b.Property("Version") @@ -157,22 +157,22 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("ECommerce.Orders.Models.Order", b => { b.Property("Id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("CreatedAt") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("CreatedBy") .HasColumnType("bigint"); b.Property("CustomerId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("IsDeleted") - .HasColumnType("bit"); + .HasColumnType("boolean"); b.Property("LastModified") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("LastModifiedBy") .HasColumnType("bigint"); @@ -180,7 +180,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("Status") .IsRequired() .ValueGeneratedOnAdd() - .HasColumnType("nvarchar(max)") + .HasColumnType("text") .HasDefaultValue("Pending"); b.Property("Version") @@ -197,28 +197,28 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("ECommerce.Orders.Models.OrderItem", b => { b.Property("Id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("CreatedAt") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("CreatedBy") .HasColumnType("bigint"); b.Property("IsDeleted") - .HasColumnType("bit"); + .HasColumnType("boolean"); b.Property("LastModified") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("LastModifiedBy") .HasColumnType("bigint"); b.Property("OrderId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("ProductId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("Version") .IsConcurrencyToken() @@ -236,25 +236,25 @@ protected override void BuildModel(ModelBuilder modelBuilder) modelBuilder.Entity("ECommerce.Products.Models.Product", b => { b.Property("Id") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("CategoryId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b.Property("CreatedAt") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("CreatedBy") .HasColumnType("bigint"); b.Property("IsBreakable") - .HasColumnType("bit"); + .HasColumnType("boolean"); b.Property("IsDeleted") - .HasColumnType("bit"); + .HasColumnType("boolean"); b.Property("LastModified") - .HasColumnType("datetime2"); + .HasColumnType("timestamp with time zone"); b.Property("LastModifiedBy") .HasColumnType("bigint"); @@ -275,12 +275,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Categories.ValueObjects.Name", "Name", b1 => { b1.Property("CategoryId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .IsRequired() .HasMaxLength(50) - .HasColumnType("nvarchar(50)") + .HasColumnType("character varying(50)") .HasColumnName("Name"); b1.HasKey("CategoryId"); @@ -299,11 +299,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Customers.ValueObjects.Address", "Address", b1 => { b1.Property("CustomerId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .IsRequired() - .HasColumnType("nvarchar(max)") + .HasColumnType("text") .HasColumnName("Address"); b1.HasKey("CustomerId"); @@ -317,11 +317,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Customers.ValueObjects.Mobile", "Mobile", b1 => { b1.Property("CustomerId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .IsRequired() - .HasColumnType("nvarchar(max)") + .HasColumnType("text") .HasColumnName("Mobile"); b1.HasKey("CustomerId"); @@ -335,11 +335,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Customers.ValueObjects.Name", "Name", b1 => { b1.Property("CustomerId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .IsRequired() - .HasColumnType("nvarchar(max)") + .HasColumnType("text") .HasColumnName("Name"); b1.HasKey("CustomerId"); @@ -362,12 +362,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Inventories.ValueObjects.Name", "Name", b1 => { b1.Property("InventoryId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .IsRequired() .HasMaxLength(50) - .HasColumnType("nvarchar(50)") + .HasColumnType("character varying(50)") .HasColumnName("Name"); b1.HasKey("InventoryId"); @@ -394,11 +394,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Inventories.ValueObjects.Quantity", "Quantity", b1 => { b1.Property("InventoryItemsId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .HasMaxLength(20) - .HasColumnType("int") + .HasColumnType("integer") .HasColumnName("Quantity"); b1.HasKey("InventoryItemsId"); @@ -425,10 +425,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Orders.ValueObjects.OrderDate", "OrderDate", b1 => { b1.Property("OrderId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") - .HasColumnType("datetime2") + .HasColumnType("timestamp with time zone") .HasColumnName("OrderDate"); b1.HasKey("OrderId"); @@ -442,7 +442,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Orders.ValueObjects.TotalPrice", "TotalPrice", b1 => { b1.Property("OrderId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .HasColumnType("decimal(18,2)") @@ -476,10 +476,10 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Orders.ValueObjects.Quantity", "Quantity", b1 => { b1.Property("OrderItemId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") - .HasColumnType("int") + .HasColumnType("integer") .HasColumnName("Quantity"); b1.HasKey("OrderItemId"); @@ -506,12 +506,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Products.ValueObjects.Barcode", "Barcode", b1 => { b1.Property("ProductId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .IsRequired() .HasMaxLength(20) - .HasColumnType("nvarchar(20)") + .HasColumnType("character varying(20)") .HasColumnName("Barcode"); b1.HasKey("ProductId"); @@ -525,12 +525,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Products.ValueObjects.Description", "Description", b1 => { b1.Property("ProductId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .IsRequired() .HasMaxLength(200) - .HasColumnType("nvarchar(200)") + .HasColumnType("character varying(200)") .HasColumnName("Description"); b1.HasKey("ProductId"); @@ -544,12 +544,12 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Products.ValueObjects.Name", "Name", b1 => { b1.Property("ProductId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .IsRequired() .HasMaxLength(50) - .HasColumnType("nvarchar(50)") + .HasColumnType("character varying(50)") .HasColumnName("Name"); b1.HasKey("ProductId"); @@ -563,7 +563,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Products.ValueObjects.NetPrice", "NetPrice", b1 => { b1.Property("ProductId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .HasColumnType("decimal(18,2)") @@ -580,7 +580,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Products.ValueObjects.Price", "Price", b1 => { b1.Property("ProductId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .HasColumnType("decimal(18,2)") @@ -597,7 +597,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.OwnsOne("ECommerce.Products.ValueObjects.ProfitMargin", "ProfitMargin", b1 => { b1.Property("ProductId") - .HasColumnType("uniqueidentifier"); + .HasColumnType("uuid"); b1.Property("Value") .HasColumnType("decimal(18,2)") diff --git a/tests/EndToEnd.Test/EndToEnd.Test.csproj b/tests/EndToEnd.Test/EndToEnd.Test.csproj index 45a06cf..1f6f6fa 100644 --- a/tests/EndToEnd.Test/EndToEnd.Test.csproj +++ b/tests/EndToEnd.Test/EndToEnd.Test.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable @@ -15,13 +15,13 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/Integration.Test/Integration.Test.csproj b/tests/Integration.Test/Integration.Test.csproj index 45a06cf..1f6f6fa 100644 --- a/tests/Integration.Test/Integration.Test.csproj +++ b/tests/Integration.Test/Integration.Test.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable @@ -15,13 +15,13 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/Unit.Test/Unit.Test.csproj b/tests/Unit.Test/Unit.Test.csproj index 45a06cf..1f6f6fa 100644 --- a/tests/Unit.Test/Unit.Test.csproj +++ b/tests/Unit.Test/Unit.Test.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable @@ -15,13 +15,13 @@ - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all