From fe08ffe4583d3451f02ceacb8ac889be5aa2e23e Mon Sep 17 00:00:00 2001 From: Halil ibrahim Kalkan Date: Mon, 21 Jan 2019 15:33:11 +0300 Subject: [PATCH] Product service initially completed. --- .gitignore | 1 + ...ctory.cs => AuthServerDbContextFactory.cs} | 0 .../BackendAdminApp.Host.csproj | 2 + .../BackendAdminAppHostModule.cs | 3 + .../Controllers/TestController.cs | 31 +++++++ .../BackendAdminApp.Host/appsettings.json | 5 +- .../ConsoleClientDemo/ClientDemoService.cs | 86 +++++++++++++++---- .../ConsoleClientDemo.csproj | 1 + .../ConsoleClientDemoModule.cs | 6 +- .../ConsoleClientDemo/appsettings.json | 7 +- .../Controllers/HomeController.cs | 13 +++ .../AuthServerDbContextFactory.cs | 29 +++++++ .../ProductServiceMigrationDbContext.cs | 23 +++++ .../20190121115908_Initial.Designer.cs | 71 +++++++++++++++ .../Migrations/20190121115908_Initial.cs | 48 +++++++++++ ...tServiceMigrationDbContextModelSnapshot.cs | 69 +++++++++++++++ .../ProductService.Host.csproj | 4 + .../ProductService.Host/appsettings.json | 4 +- .../ProductManagementConsts.cs | 2 +- ...agementDbContextModelCreatingExtensions.cs | 2 + .../ProductManagementHttpApiClientModule.cs | 0 21 files changed, 381 insertions(+), 26 deletions(-) rename samples/MicroserviceDemo/applications/authserver/AuthServer.Host/EntityFrameworkCore/{MyProjectNameMigrationsDbContextFactory.cs => AuthServerDbContextFactory.cs} (100%) create mode 100644 samples/MicroserviceDemo/applications/backend/BackendAdminApp.Host/Controllers/TestController.cs create mode 100644 samples/MicroserviceDemo/microservices/product/ProductService.Host/Controllers/HomeController.cs create mode 100644 samples/MicroserviceDemo/microservices/product/ProductService.Host/EntityFrameworkCore/AuthServerDbContextFactory.cs create mode 100644 samples/MicroserviceDemo/microservices/product/ProductService.Host/EntityFrameworkCore/ProductServiceMigrationDbContext.cs create mode 100644 samples/MicroserviceDemo/microservices/product/ProductService.Host/Migrations/20190121115908_Initial.Designer.cs create mode 100644 samples/MicroserviceDemo/microservices/product/ProductService.Host/Migrations/20190121115908_Initial.cs create mode 100644 samples/MicroserviceDemo/microservices/product/ProductService.Host/Migrations/ProductServiceMigrationDbContextModelSnapshot.cs rename samples/MicroserviceDemo/modules/product/src/ProductManagement.HttpApi.Client/{MyCompanyName => }/ProductManagement/ProductManagementHttpApiClientModule.cs (100%) diff --git a/.gitignore b/.gitignore index 440d5e7ec0..961ace0bec 100644 --- a/.gitignore +++ b/.gitignore @@ -288,3 +288,4 @@ templates/mvc/src/MyCompanyName\.MyProjectName\.Web/package-lock\.json samples/MicroserviceDemo/applications/authserver/AuthServer.Host/Logs/logs.txt samples/MicroserviceDemo/microservices/identity/IdentityService.Host/Logs/logs.txt samples/MicroserviceDemo/applications/backend/BackendAdminApp.Host/Logs/logs.txt +samples/MicroserviceDemo/microservices/product/ProductService.Host/Logs/logs.txt diff --git a/samples/MicroserviceDemo/applications/authserver/AuthServer.Host/EntityFrameworkCore/MyProjectNameMigrationsDbContextFactory.cs b/samples/MicroserviceDemo/applications/authserver/AuthServer.Host/EntityFrameworkCore/AuthServerDbContextFactory.cs similarity index 100% rename from samples/MicroserviceDemo/applications/authserver/AuthServer.Host/EntityFrameworkCore/MyProjectNameMigrationsDbContextFactory.cs rename to samples/MicroserviceDemo/applications/authserver/AuthServer.Host/EntityFrameworkCore/AuthServerDbContextFactory.cs diff --git a/samples/MicroserviceDemo/applications/backend/BackendAdminApp.Host/BackendAdminApp.Host.csproj b/samples/MicroserviceDemo/applications/backend/BackendAdminApp.Host/BackendAdminApp.Host.csproj index 329b1f5a87..8609841c95 100644 --- a/samples/MicroserviceDemo/applications/backend/BackendAdminApp.Host/BackendAdminApp.Host.csproj +++ b/samples/MicroserviceDemo/applications/backend/BackendAdminApp.Host/BackendAdminApp.Host.csproj @@ -27,6 +27,8 @@ + + diff --git a/samples/MicroserviceDemo/applications/backend/BackendAdminApp.Host/BackendAdminAppHostModule.cs b/samples/MicroserviceDemo/applications/backend/BackendAdminApp.Host/BackendAdminAppHostModule.cs index c54eafc0dd..544b747a3c 100644 --- a/samples/MicroserviceDemo/applications/backend/BackendAdminApp.Host/BackendAdminAppHostModule.cs +++ b/samples/MicroserviceDemo/applications/backend/BackendAdminApp.Host/BackendAdminAppHostModule.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.IdentityModel.Protocols.OpenIdConnect; +using ProductManagement; using Swashbuckle.AspNetCore.Swagger; using Volo.Abp; using Volo.Abp.AspNetCore.Authentication.OAuth; @@ -23,6 +24,8 @@ namespace BackendAdminApp.Host typeof(AbpHttpClientIdentityModelModule), typeof(AbpIdentityHttpApiClientModule), typeof(AbpIdentityWebModule), + typeof(ProductManagementHttpApiClientModule), + typeof(ProductManagementWebModule), typeof(AbpAspNetCoreMvcUiBasicThemeModule) )] public class BackendAdminAppHostModule : AbpModule diff --git a/samples/MicroserviceDemo/applications/backend/BackendAdminApp.Host/Controllers/TestController.cs b/samples/MicroserviceDemo/applications/backend/BackendAdminApp.Host/Controllers/TestController.cs new file mode 100644 index 0000000000..bd51996add --- /dev/null +++ b/samples/MicroserviceDemo/applications/backend/BackendAdminApp.Host/Controllers/TestController.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.Json; + +namespace BackendAdminApp.Host.Controllers +{ + public class TestController : AbpController + { + private readonly IJsonSerializer _jsonSerializer; + + public TestController(IJsonSerializer jsonSerializer) + { + _jsonSerializer = jsonSerializer; + } + + [HttpGet] + public async Task Index() + { + var newLine = Environment.NewLine + Environment.NewLine; + + return Content( + "Claims: " + User.Claims.Select(c => $"{c.Type} = {c.Value}").JoinAsString(" | ") + newLine + + "CurrentUser: " + _jsonSerializer.Serialize(CurrentUser) + newLine + ); + } + } +} diff --git a/samples/MicroserviceDemo/applications/backend/BackendAdminApp.Host/appsettings.json b/samples/MicroserviceDemo/applications/backend/BackendAdminApp.Host/appsettings.json index f591f70860..1d974b7937 100644 --- a/samples/MicroserviceDemo/applications/backend/BackendAdminApp.Host/appsettings.json +++ b/samples/MicroserviceDemo/applications/backend/BackendAdminApp.Host/appsettings.json @@ -1,8 +1,11 @@ { "RemoteServices": { - "Default": { + "AbpIdentity": { "BaseUrl": "http://localhost:63568/" }, + "ProductManagement": { + "BaseUrl": "http://localhost:60244/" + }, "AbpMvcClient": { "BaseUrl": "http://localhost:63568/" } diff --git a/samples/MicroserviceDemo/applications/consoleclient/ConsoleClientDemo/ClientDemoService.cs b/samples/MicroserviceDemo/applications/consoleclient/ConsoleClientDemo/ClientDemoService.cs index 3e817663d0..7525d7fb66 100644 --- a/samples/MicroserviceDemo/applications/consoleclient/ConsoleClientDemo/ClientDemoService.cs +++ b/samples/MicroserviceDemo/applications/consoleclient/ConsoleClientDemo/ClientDemoService.cs @@ -1,4 +1,5 @@ -using System; +using ProductManagement; +using System; using System.Net.Http; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; @@ -10,20 +11,24 @@ namespace ConsoleClientDemo public class ClientDemoService : ITransientDependency { private readonly IIdentityUserAppService _userAppService; + private readonly IProductAppService _productAppService; private readonly IIdentityModelHttpClientAuthenticator _authenticator; public ClientDemoService( IIdentityUserAppService userAppService, + IProductAppService productAppService, IIdentityModelHttpClientAuthenticator authenticator) { _userAppService = userAppService; _authenticator = authenticator; + _productAppService = productAppService; } public async Task RunAsync() { await TestWithHttpClient(); await TestIdentityService(); + await TestProductService(); } /// @@ -32,23 +37,31 @@ namespace ConsoleClientDemo /// private async Task TestWithHttpClient() { - Console.WriteLine("*** TestWithHttpClient ***"); + Console.WriteLine(); + Console.WriteLine("*** TestWithHttpClient ************************************"); - using (var client = new HttpClient()) + try { - await _authenticator.AuthenticateAsync(client); - - var response = await client.GetAsync("http://localhost:63568/Test"); - if (!response.IsSuccessStatusCode) - { - Console.WriteLine(response.StatusCode); - } - else + using (var client = new HttpClient()) { - var content = await response.Content.ReadAsStringAsync(); - Console.WriteLine(content); + await _authenticator.AuthenticateAsync(client); + + var response = await client.GetAsync("http://localhost:63568/Test"); + if (!response.IsSuccessStatusCode) + { + Console.WriteLine(response.StatusCode); + } + else + { + var content = await response.Content.ReadAsStringAsync(); + Console.WriteLine(content); + } } } + catch (Exception e) + { + Console.WriteLine(e); + } } /// @@ -60,14 +73,51 @@ namespace ConsoleClientDemo /// private async Task TestIdentityService() { - var output = await _userAppService.GetListAsync(new GetIdentityUsersInput()); + Console.WriteLine(); + Console.WriteLine("*** TestIdentityService ************************************"); + + try + { + var output = await _userAppService.GetListAsync(new GetIdentityUsersInput()); - Console.WriteLine("*** TestIdentityService ***"); - Console.WriteLine("Total user count: " + output.TotalCount); + Console.WriteLine("Total user count: " + output.TotalCount); - foreach (var user in output.Items) + foreach (var user in output.Items) + { + Console.WriteLine($"- UserName={user.UserName}, Email={user.Email}, Name={user.Name}, Surname={user.Surname}"); + } + } + catch (Exception e) + { + Console.WriteLine(e); + } + } + + /// + /// Shows how to use application service interfaces (IProductAppService in this sample) + /// to call a remote service which is possible by the dynamic http client proxy system. + /// No need to use IIdentityModelHttpClientAuthenticator since the dynamic http client proxy + /// system internally uses it. You just inject a service (IProductAppService) + /// and call a method (GetListAsync) like a local method. + /// + private async Task TestProductService() + { + Console.WriteLine(); + Console.WriteLine("*** TestProductService ************************************"); + + try + { + var output = await _productAppService.GetListAsync(); + Console.WriteLine("Total product count: " + output.Items.Count); + + foreach (var product in output.Items) + { + Console.WriteLine($"- Code={product.Code}, Name={product.Name}, Price={product.Price}, StockCount={product.StockCount}"); + } + } + catch (Exception e) { - Console.WriteLine($"- UserName={user.UserName}, Email={user.Email}, Name={user.Name}, Surname={user.Surname}"); + Console.WriteLine(e); } } } diff --git a/samples/MicroserviceDemo/applications/consoleclient/ConsoleClientDemo/ConsoleClientDemo.csproj b/samples/MicroserviceDemo/applications/consoleclient/ConsoleClientDemo/ConsoleClientDemo.csproj index b440dd8c0c..b3a5a1ef83 100644 --- a/samples/MicroserviceDemo/applications/consoleclient/ConsoleClientDemo/ConsoleClientDemo.csproj +++ b/samples/MicroserviceDemo/applications/consoleclient/ConsoleClientDemo/ConsoleClientDemo.csproj @@ -14,6 +14,7 @@ + diff --git a/samples/MicroserviceDemo/applications/consoleclient/ConsoleClientDemo/ConsoleClientDemoModule.cs b/samples/MicroserviceDemo/applications/consoleclient/ConsoleClientDemo/ConsoleClientDemoModule.cs index 10bc6e9d4a..b5e0e46faa 100644 --- a/samples/MicroserviceDemo/applications/consoleclient/ConsoleClientDemo/ConsoleClientDemoModule.cs +++ b/samples/MicroserviceDemo/applications/consoleclient/ConsoleClientDemo/ConsoleClientDemoModule.cs @@ -1,4 +1,5 @@ -using Volo.Abp.Autofac; +using ProductManagement; +using Volo.Abp.Autofac; using Volo.Abp.Http.Client.IdentityModel; using Volo.Abp.Identity; using Volo.Abp.Modularity; @@ -8,7 +9,8 @@ namespace ConsoleClientDemo [DependsOn( typeof(AbpAutofacModule), typeof(AbpHttpClientIdentityModelModule), - typeof(AbpIdentityHttpApiClientModule) + typeof(AbpIdentityHttpApiClientModule), + typeof(ProductManagementHttpApiClientModule) )] public class ConsoleClientDemoModule : AbpModule { diff --git a/samples/MicroserviceDemo/applications/consoleclient/ConsoleClientDemo/appsettings.json b/samples/MicroserviceDemo/applications/consoleclient/ConsoleClientDemo/appsettings.json index c95b0318a8..b1f3ecaf98 100644 --- a/samples/MicroserviceDemo/applications/consoleclient/ConsoleClientDemo/appsettings.json +++ b/samples/MicroserviceDemo/applications/consoleclient/ConsoleClientDemo/appsettings.json @@ -1,7 +1,10 @@ { "RemoteServices": { - "Default": { + "AbpIdentity": { "BaseUrl": "http://localhost:63568/" + }, + "ProductManagement": { + "BaseUrl": "http://localhost:60244/" } }, "IdentityClients": { @@ -12,7 +15,7 @@ "UserName": "admin", "UserPassword": "1q2w3E*", "Authority": "http://localhost:64999", - "Scope": "IdentityService" + "Scope": "IdentityService ProductService" } } } \ No newline at end of file diff --git a/samples/MicroserviceDemo/microservices/product/ProductService.Host/Controllers/HomeController.cs b/samples/MicroserviceDemo/microservices/product/ProductService.Host/Controllers/HomeController.cs new file mode 100644 index 0000000000..8d28ce4295 --- /dev/null +++ b/samples/MicroserviceDemo/microservices/product/ProductService.Host/Controllers/HomeController.cs @@ -0,0 +1,13 @@ +using Microsoft.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc; + +namespace ProductService.Host.Controllers +{ + public class HomeController : AbpController + { + public ActionResult Index() + { + return Redirect("/swagger"); + } + } +} diff --git a/samples/MicroserviceDemo/microservices/product/ProductService.Host/EntityFrameworkCore/AuthServerDbContextFactory.cs b/samples/MicroserviceDemo/microservices/product/ProductService.Host/EntityFrameworkCore/AuthServerDbContextFactory.cs new file mode 100644 index 0000000000..279bc1079c --- /dev/null +++ b/samples/MicroserviceDemo/microservices/product/ProductService.Host/EntityFrameworkCore/AuthServerDbContextFactory.cs @@ -0,0 +1,29 @@ +using System.IO; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Design; +using Microsoft.Extensions.Configuration; + +namespace ProductService.Host.EntityFrameworkCore +{ + public class ProductServiceMigrationDbContextFactory : IDesignTimeDbContextFactory + { + public ProductServiceMigrationDbContext CreateDbContext(string[] args) + { + var configuration = BuildConfiguration(); + + var builder = new DbContextOptionsBuilder() + .UseSqlServer(configuration.GetConnectionString("ProductManagement")); + + return new ProductServiceMigrationDbContext(builder.Options); + } + + private static IConfigurationRoot BuildConfiguration() + { + var builder = new ConfigurationBuilder() + .SetBasePath(Directory.GetCurrentDirectory()) + .AddJsonFile("appsettings.json", optional: false); + + return builder.Build(); + } + } +} diff --git a/samples/MicroserviceDemo/microservices/product/ProductService.Host/EntityFrameworkCore/ProductServiceMigrationDbContext.cs b/samples/MicroserviceDemo/microservices/product/ProductService.Host/EntityFrameworkCore/ProductServiceMigrationDbContext.cs new file mode 100644 index 0000000000..fd506163e2 --- /dev/null +++ b/samples/MicroserviceDemo/microservices/product/ProductService.Host/EntityFrameworkCore/ProductServiceMigrationDbContext.cs @@ -0,0 +1,23 @@ +using Microsoft.EntityFrameworkCore; +using ProductManagement.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; + +namespace ProductService.Host.EntityFrameworkCore +{ + public class ProductServiceMigrationDbContext : AbpDbContext + { + public ProductServiceMigrationDbContext( + DbContextOptions options + ) : base(options) + { + + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + base.OnModelCreating(modelBuilder); + + modelBuilder.ConfigureProductManagement(); + } + } +} diff --git a/samples/MicroserviceDemo/microservices/product/ProductService.Host/Migrations/20190121115908_Initial.Designer.cs b/samples/MicroserviceDemo/microservices/product/ProductService.Host/Migrations/20190121115908_Initial.Designer.cs new file mode 100644 index 0000000000..4e613b0da7 --- /dev/null +++ b/samples/MicroserviceDemo/microservices/product/ProductService.Host/Migrations/20190121115908_Initial.Designer.cs @@ -0,0 +1,71 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using ProductService.Host.EntityFrameworkCore; + +namespace ProductService.Host.Migrations +{ + [DbContext(typeof(ProductServiceMigrationDbContext))] + [Migration("20190121115908_Initial")] + partial class Initial + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.2.0-rtm-35687") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("ProductManagement.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Code") + .IsRequired() + .HasMaxLength(32); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256); + + b.Property("Price"); + + b.Property("StockCount"); + + b.HasKey("Id"); + + b.HasIndex("Code"); + + b.HasIndex("Name"); + + b.ToTable("PmProducts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/samples/MicroserviceDemo/microservices/product/ProductService.Host/Migrations/20190121115908_Initial.cs b/samples/MicroserviceDemo/microservices/product/ProductService.Host/Migrations/20190121115908_Initial.cs new file mode 100644 index 0000000000..f66fb70eca --- /dev/null +++ b/samples/MicroserviceDemo/microservices/product/ProductService.Host/Migrations/20190121115908_Initial.cs @@ -0,0 +1,48 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace ProductService.Host.Migrations +{ + public partial class Initial : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "PmProducts", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + Code = table.Column(maxLength: 32, nullable: false), + Name = table.Column(maxLength: 256, nullable: false), + Price = table.Column(nullable: false), + StockCount = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_PmProducts", x => x.Id); + }); + + migrationBuilder.CreateIndex( + name: "IX_PmProducts_Code", + table: "PmProducts", + column: "Code"); + + migrationBuilder.CreateIndex( + name: "IX_PmProducts_Name", + table: "PmProducts", + column: "Name"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "PmProducts"); + } + } +} diff --git a/samples/MicroserviceDemo/microservices/product/ProductService.Host/Migrations/ProductServiceMigrationDbContextModelSnapshot.cs b/samples/MicroserviceDemo/microservices/product/ProductService.Host/Migrations/ProductServiceMigrationDbContextModelSnapshot.cs new file mode 100644 index 0000000000..5bc9669fb0 --- /dev/null +++ b/samples/MicroserviceDemo/microservices/product/ProductService.Host/Migrations/ProductServiceMigrationDbContextModelSnapshot.cs @@ -0,0 +1,69 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using ProductService.Host.EntityFrameworkCore; + +namespace ProductService.Host.Migrations +{ + [DbContext(typeof(ProductServiceMigrationDbContext))] + partial class ProductServiceMigrationDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.2.0-rtm-35687") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("ProductManagement.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Code") + .IsRequired() + .HasMaxLength(32); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnName("CreatorId"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(256); + + b.Property("Price"); + + b.Property("StockCount"); + + b.HasKey("Id"); + + b.HasIndex("Code"); + + b.HasIndex("Name"); + + b.ToTable("PmProducts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/samples/MicroserviceDemo/microservices/product/ProductService.Host/ProductService.Host.csproj b/samples/MicroserviceDemo/microservices/product/ProductService.Host/ProductService.Host.csproj index 7c4b669ef7..09fc13ba0b 100644 --- a/samples/MicroserviceDemo/microservices/product/ProductService.Host/ProductService.Host.csproj +++ b/samples/MicroserviceDemo/microservices/product/ProductService.Host/ProductService.Host.csproj @@ -37,4 +37,8 @@ + + + + diff --git a/samples/MicroserviceDemo/microservices/product/ProductService.Host/appsettings.json b/samples/MicroserviceDemo/microservices/product/ProductService.Host/appsettings.json index 3235e37aa7..d2bd2c33bd 100644 --- a/samples/MicroserviceDemo/microservices/product/ProductService.Host/appsettings.json +++ b/samples/MicroserviceDemo/microservices/product/ProductService.Host/appsettings.json @@ -1,6 +1,6 @@ { "ConnectionStrings": { - "Default": "Server=localhost;Database=MsDemo_Product;Trusted_Connection=True;MultipleActiveResultSets=true", + "Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true", "ProductManagement": "Server=localhost;Database=MsDemo_ProductManagement;Trusted_Connection=True;MultipleActiveResultSets=true" }, "Logging": { @@ -9,4 +9,4 @@ } }, "AllowedHosts": "*" -} +} \ No newline at end of file diff --git a/samples/MicroserviceDemo/modules/product/src/ProductManagement.Domain/ProductManagement/ProductManagementConsts.cs b/samples/MicroserviceDemo/modules/product/src/ProductManagement.Domain/ProductManagement/ProductManagementConsts.cs index 4db4ce710e..dc1bdb5950 100644 --- a/samples/MicroserviceDemo/modules/product/src/ProductManagement.Domain/ProductManagement/ProductManagementConsts.cs +++ b/samples/MicroserviceDemo/modules/product/src/ProductManagement.Domain/ProductManagement/ProductManagementConsts.cs @@ -2,7 +2,7 @@ { public static class ProductManagementConsts { - public const string DefaultDbTablePrefix = "ProductManagement"; + public const string DefaultDbTablePrefix = "Pm"; public const string DefaultDbSchema = null; } diff --git a/samples/MicroserviceDemo/modules/product/src/ProductManagement.EntityFrameworkCore/ProductManagement/EntityFrameworkCore/ProductManagementDbContextModelCreatingExtensions.cs b/samples/MicroserviceDemo/modules/product/src/ProductManagement.EntityFrameworkCore/ProductManagement/EntityFrameworkCore/ProductManagementDbContextModelCreatingExtensions.cs index 2adf0c4f71..8a12ad11a8 100644 --- a/samples/MicroserviceDemo/modules/product/src/ProductManagement.EntityFrameworkCore/ProductManagement/EntityFrameworkCore/ProductManagementDbContextModelCreatingExtensions.cs +++ b/samples/MicroserviceDemo/modules/product/src/ProductManagement.EntityFrameworkCore/ProductManagement/EntityFrameworkCore/ProductManagementDbContextModelCreatingExtensions.cs @@ -21,6 +21,8 @@ namespace ProductManagement.EntityFrameworkCore { b.ToTable(options.TablePrefix + "Products", options.Schema); + b.ConfigureConcurrencyStamp(); + b.ConfigureExtraProperties(); b.ConfigureAudited(); b.Property(x => x.Code).IsRequired().HasMaxLength(ProductConsts.MaxCodeLength); diff --git a/samples/MicroserviceDemo/modules/product/src/ProductManagement.HttpApi.Client/MyCompanyName/ProductManagement/ProductManagementHttpApiClientModule.cs b/samples/MicroserviceDemo/modules/product/src/ProductManagement.HttpApi.Client/ProductManagement/ProductManagementHttpApiClientModule.cs similarity index 100% rename from samples/MicroserviceDemo/modules/product/src/ProductManagement.HttpApi.Client/MyCompanyName/ProductManagement/ProductManagementHttpApiClientModule.cs rename to samples/MicroserviceDemo/modules/product/src/ProductManagement.HttpApi.Client/ProductManagement/ProductManagementHttpApiClientModule.cs