From f2837cacb4288954f0546318c60da3c9a17bea57 Mon Sep 17 00:00:00 2001 From: Galip Tolga Erdem Date: Mon, 28 Jun 2021 15:02:11 +0300 Subject: [PATCH] Initial commit Added Shared Localization,Hosting,AspnetCore with default AuthServer --- EShopOnAbp.sln | 48 ++++++ apps/auth-server/EShopOnAbp.AuthServer.sln | 23 +++ .../EShopOnAbp.AuthServer.csproj | 26 ++++ .../EShopOnAbpAuthServerModule.cs | 145 ++++++++++++++++++ .../src/EShopOnAbp.AuthServer/Program.cs | 46 ++++++ .../Properties/launchSettings.json | 28 ++++ .../src/EShopOnAbp.AuthServer/Startup.cs | 19 +++ .../appsettings.Development.json | 9 ++ .../EShopOnAbp.AuthServer/appsettings.json | 40 +++++ ...ShopOnAbp.Shared.Hosting.AspNetCore.csproj | 18 +++ ...EShopOnAbpSharedHostingAspNetCoreModule.cs | 16 ++ .../SerilogConfigurationHelper.cs | 38 +++++ .../EShopOnAbp.Shared.Hosting.csproj | 20 +++ .../EShopOnAbpSharedHostingModule.cs | 51 ++++++ .../EShopOnAbp.Shared.Localization.csproj | 23 +++ .../EShopOnAbpSharedLocalizationModule.cs | 34 ++++ .../Localization/EShopOnAbp/ar.json | 7 + .../Localization/EShopOnAbp/de-DE.json | 5 + .../Localization/EShopOnAbp/en.json | 7 + .../Localization/EShopOnAbp/es.json | 5 + .../Localization/EShopOnAbp/fi.json | 7 + .../Localization/EShopOnAbp/fr.json | 7 + .../Localization/EShopOnAbp/hi.json | 7 + .../Localization/EShopOnAbp/it.json | 7 + .../Localization/EShopOnAbp/sl.json | 5 + .../Localization/EShopOnAbp/tr.json | 7 + .../Localization/EShopOnAbp/zh-Hans.json | 5 + .../Localization/EShopOnAbpResource.cs | 10 ++ 28 files changed, 663 insertions(+) create mode 100644 EShopOnAbp.sln create mode 100644 apps/auth-server/EShopOnAbp.AuthServer.sln create mode 100644 apps/auth-server/src/EShopOnAbp.AuthServer/EShopOnAbp.AuthServer.csproj create mode 100644 apps/auth-server/src/EShopOnAbp.AuthServer/EShopOnAbpAuthServerModule.cs create mode 100644 apps/auth-server/src/EShopOnAbp.AuthServer/Program.cs create mode 100644 apps/auth-server/src/EShopOnAbp.AuthServer/Properties/launchSettings.json create mode 100644 apps/auth-server/src/EShopOnAbp.AuthServer/Startup.cs create mode 100644 apps/auth-server/src/EShopOnAbp.AuthServer/appsettings.Development.json create mode 100644 apps/auth-server/src/EShopOnAbp.AuthServer/appsettings.json create mode 100644 shared/EShopOnAbp.Shared.Hosting.AspNetCore/EShopOnAbp.Shared.Hosting.AspNetCore.csproj create mode 100644 shared/EShopOnAbp.Shared.Hosting.AspNetCore/EShopOnAbpSharedHostingAspNetCoreModule.cs create mode 100644 shared/EShopOnAbp.Shared.Hosting.AspNetCore/SerilogConfigurationHelper.cs create mode 100644 shared/EShopOnAbp.Shared.Hosting/EShopOnAbp.Shared.Hosting.csproj create mode 100644 shared/EShopOnAbp.Shared.Hosting/EShopOnAbpSharedHostingModule.cs create mode 100644 shared/EShopOnAbp.Shared.Localization/EShopOnAbp.Shared.Localization.csproj create mode 100644 shared/EShopOnAbp.Shared.Localization/EShopOnAbpSharedLocalizationModule.cs create mode 100644 shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/ar.json create mode 100644 shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/de-DE.json create mode 100644 shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/en.json create mode 100644 shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/es.json create mode 100644 shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/fi.json create mode 100644 shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/fr.json create mode 100644 shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/hi.json create mode 100644 shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/it.json create mode 100644 shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/sl.json create mode 100644 shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/tr.json create mode 100644 shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/zh-Hans.json create mode 100644 shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbpResource.cs diff --git a/EShopOnAbp.sln b/EShopOnAbp.sln new file mode 100644 index 00000000..188ee00b --- /dev/null +++ b/EShopOnAbp.sln @@ -0,0 +1,48 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "apps", "apps", "{866DB6CC-FEA8-4CC2-A2E4-143537D197B6}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gateways", "gateways", "{1484E912-DCF3-4568-A72C-4C7622104DB8}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "services", "services", "{F415FFFD-E52D-4EBE-98DC-067C1EFFFFE3}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "shared", "shared", "{B8B59303-2178-459B-91A8-DF353044E090}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EShopOnAbp.AuthServer", "apps\auth-server\src\EShopOnAbp.AuthServer\EShopOnAbp.AuthServer.csproj", "{09F9A583-778D-4940-83B0-958C5D4E6D52}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EShopOnAbp.Shared.Hosting", "shared\EShopOnAbp.Shared.Hosting\EShopOnAbp.Shared.Hosting.csproj", "{B473B411-0B14-47A9-B4BB-9F0F4E884C87}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EShopOnAbp.Shared.Hosting.AspNetCore", "shared\EShopOnAbp.Shared.Hosting.AspNetCore\EShopOnAbp.Shared.Hosting.AspNetCore.csproj", "{6FCB66AF-6044-478D-B2A0-90F7E555C152}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EShopOnAbp.Shared.Localization", "shared\EShopOnAbp.Shared.Localization\EShopOnAbp.Shared.Localization.csproj", "{2B608875-8226-44E4-B93A-D475E11A7B80}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {09F9A583-778D-4940-83B0-958C5D4E6D52} = {866DB6CC-FEA8-4CC2-A2E4-143537D197B6} + {B473B411-0B14-47A9-B4BB-9F0F4E884C87} = {B8B59303-2178-459B-91A8-DF353044E090} + {6FCB66AF-6044-478D-B2A0-90F7E555C152} = {B8B59303-2178-459B-91A8-DF353044E090} + {2B608875-8226-44E4-B93A-D475E11A7B80} = {B8B59303-2178-459B-91A8-DF353044E090} + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {09F9A583-778D-4940-83B0-958C5D4E6D52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {09F9A583-778D-4940-83B0-958C5D4E6D52}.Debug|Any CPU.Build.0 = Debug|Any CPU + {09F9A583-778D-4940-83B0-958C5D4E6D52}.Release|Any CPU.ActiveCfg = Release|Any CPU + {09F9A583-778D-4940-83B0-958C5D4E6D52}.Release|Any CPU.Build.0 = Release|Any CPU + {B473B411-0B14-47A9-B4BB-9F0F4E884C87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B473B411-0B14-47A9-B4BB-9F0F4E884C87}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B473B411-0B14-47A9-B4BB-9F0F4E884C87}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B473B411-0B14-47A9-B4BB-9F0F4E884C87}.Release|Any CPU.Build.0 = Release|Any CPU + {6FCB66AF-6044-478D-B2A0-90F7E555C152}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6FCB66AF-6044-478D-B2A0-90F7E555C152}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6FCB66AF-6044-478D-B2A0-90F7E555C152}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6FCB66AF-6044-478D-B2A0-90F7E555C152}.Release|Any CPU.Build.0 = Release|Any CPU + {2B608875-8226-44E4-B93A-D475E11A7B80}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2B608875-8226-44E4-B93A-D475E11A7B80}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2B608875-8226-44E4-B93A-D475E11A7B80}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2B608875-8226-44E4-B93A-D475E11A7B80}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/apps/auth-server/EShopOnAbp.AuthServer.sln b/apps/auth-server/EShopOnAbp.AuthServer.sln new file mode 100644 index 00000000..ca232902 --- /dev/null +++ b/apps/auth-server/EShopOnAbp.AuthServer.sln @@ -0,0 +1,23 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AuthServer", "src\EShopOnAbp.AuthServer\EShopOnAbp.AuthServer.csproj", "{D3689DAD-F573-444F-9200-7B468F67FAA8}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{4A589F57-8AD7-4156-9B52-6464A4A6ABD2}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{32416675-3364-4F9F-AC2F-23747B5D946A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D3689DAD-F573-444F-9200-7B468F67FAA8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D3689DAD-F573-444F-9200-7B468F67FAA8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D3689DAD-F573-444F-9200-7B468F67FAA8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D3689DAD-F573-444F-9200-7B468F67FAA8}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {D3689DAD-F573-444F-9200-7B468F67FAA8} = {4A589F57-8AD7-4156-9B52-6464A4A6ABD2} + EndGlobalSection +EndGlobal diff --git a/apps/auth-server/src/EShopOnAbp.AuthServer/EShopOnAbp.AuthServer.csproj b/apps/auth-server/src/EShopOnAbp.AuthServer/EShopOnAbp.AuthServer.csproj new file mode 100644 index 00000000..b154c828 --- /dev/null +++ b/apps/auth-server/src/EShopOnAbp.AuthServer/EShopOnAbp.AuthServer.csproj @@ -0,0 +1,26 @@ + + + + net5.0 + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/auth-server/src/EShopOnAbp.AuthServer/EShopOnAbpAuthServerModule.cs b/apps/auth-server/src/EShopOnAbp.AuthServer/EShopOnAbpAuthServerModule.cs new file mode 100644 index 00000000..88b401c4 --- /dev/null +++ b/apps/auth-server/src/EShopOnAbp.AuthServer/EShopOnAbpAuthServerModule.cs @@ -0,0 +1,145 @@ +using System; +using System.IO; +using System.Linq; +using EShopOnAbp.Shared.Hosting.AspNetCore; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Cors; +using Microsoft.AspNetCore.DataProtection; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; +using Microsoft.Extensions.Hosting; +using StackExchange.Redis; +using Volo.Abp; +using Volo.Abp.Account; +using Volo.Abp.Account.Web; +using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; +using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; +using Volo.Abp.Auditing; +using Volo.Abp.BackgroundJobs.RabbitMQ; +using Volo.Abp.Caching; +using Volo.Abp.Caching.StackExchangeRedis; +using Volo.Abp.Emailing; +using Volo.Abp.EventBus.RabbitMq; +using Volo.Abp.Modularity; +using Volo.Abp.MultiTenancy; +using Volo.Abp.UI.Navigation.Urls; +using Volo.Abp.VirtualFileSystem; + +namespace EShopOnAbp.AuthServer +{ + [DependsOn( + typeof(AbpCachingStackExchangeRedisModule), + typeof(AbpEventBusRabbitMqModule), + typeof(AbpBackgroundJobsRabbitMqModule), + typeof(AbpAspNetCoreMvcUiBasicThemeModule), + typeof(AbpAccountWebIdentityServerModule), + typeof(AbpAccountApplicationModule), + typeof(EShopOnAbpSharedHostingAspNetCoreModule), + typeof(EShopOnAbpSharedLocalizationModule) + // typeof(AdministrationServiceEntityFrameworkCoreModule), + // typeof(IdentityServiceEntityFrameworkCoreModule), + // typeof(SaasServiceEntityFrameworkCoreModule), + + )] + public class EShopOnAbpAuthServerModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + var hostingEnvironment = context.Services.GetHostingEnvironment(); + var configuration = context.Services.GetConfiguration(); + + Configure(options => + { + options.IsEnabled = true; + }); + + Configure(options => + { + options.ApplicationName = "AuthServer"; + }); + + Configure(options => + { + options.Applications["MVC"].RootUrl = configuration["App:SelfUrl"]; + options.RedirectAllowedUrls.AddRange(configuration["App:RedirectAllowedUrls"].Split(',')); + }); + + Configure(options => + { + options.KeyPrefix = "EShopOnAbp:"; + }); + + var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); + context.Services + .AddDataProtection() + .PersistKeysToStackExchangeRedis(redis, "EShopOnAbp-Protection-Keys"); + + context.Services.AddCors(options => + { + options.AddDefaultPolicy(builder => + { + builder + .WithOrigins( + configuration["App:CorsOrigins"] + .Split(",", StringSplitOptions.RemoveEmptyEntries) + .Select(o => o.Trim().RemovePostFix("/")) + .ToArray() + ) + .WithAbpExposedHeaders() + .SetIsOriginAllowedToAllowWildcardSubdomains() + .AllowAnyHeader() + .AllowAnyMethod() + .AllowCredentials(); + }); + }); + +#if DEBUG + context.Services.Replace(ServiceDescriptor.Singleton()); +#endif + + if (hostingEnvironment.IsDevelopment()) + { + Configure(options => + { + options.FileSets.ReplaceEmbeddedByPhysical(Path.Combine(hostingEnvironment.ContentRootPath, + $"..{Path.DirectorySeparatorChar}..{Path.DirectorySeparatorChar}..{Path.DirectorySeparatorChar}..{Path.DirectorySeparatorChar}shared{Path.DirectorySeparatorChar}EShopOnAbp.Shared.Localization")); + }); + } + } + + public override void OnApplicationInitialization(ApplicationInitializationContext context) + { + var app = context.GetApplicationBuilder(); + var env = context.GetEnvironment(); + + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + + app.UseAbpRequestLocalization(); + + if (!env.IsDevelopment()) + { + app.UseErrorPage(); + } + + app.UseCorrelationId(); + app.UseStaticFiles(); + app.UseRouting(); + app.UseCors(); + // app.UseHttpMetrics(); + app.UseAuthentication(); + app.UseMultiTenancy(); + app.UseAbpSerilogEnrichers(); + app.UseUnitOfWork(); + app.UseIdentityServer(); + app.UseAuthorization(); + app.UseAuditing(); + app.UseConfiguredEndpoints(endpoints => + { + // endpoints.MapMetrics(); + }); + } + } +} \ No newline at end of file diff --git a/apps/auth-server/src/EShopOnAbp.AuthServer/Program.cs b/apps/auth-server/src/EShopOnAbp.AuthServer/Program.cs new file mode 100644 index 00000000..31a4291a --- /dev/null +++ b/apps/auth-server/src/EShopOnAbp.AuthServer/Program.cs @@ -0,0 +1,46 @@ +using System; +using System.Threading.Tasks; +using EShopOnAbp.Shared.Hosting.AspNetCore; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Hosting; +using Serilog; + +namespace EShopOnAbp.AuthServer +{ + public class Program + { + public static async Task Main(string[] args) + { + var assemblyName = typeof(Program).Assembly.GetName().Name; + + SerilogConfigurationHelper.Configure(assemblyName); + + try + { + Log.Information($"Starting {assemblyName}."); + await CreateHostBuilder(args).Build().RunAsync(); + return 0; + } + catch (Exception ex) + { + Log.Fatal(ex, $"{assemblyName} terminated unexpectedly!"); + return 1; + } + finally + { + Log.CloseAndFlush(); + } + } + + internal static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureAppConfiguration(build => + { + build.AddJsonFile("appsettings.secrets.json", optional: true); + }) + .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); }) + .UseAutofac() + .UseSerilog(); + } +} \ No newline at end of file diff --git a/apps/auth-server/src/EShopOnAbp.AuthServer/Properties/launchSettings.json b/apps/auth-server/src/EShopOnAbp.AuthServer/Properties/launchSettings.json new file mode 100644 index 00000000..1bd11195 --- /dev/null +++ b/apps/auth-server/src/EShopOnAbp.AuthServer/Properties/launchSettings.json @@ -0,0 +1,28 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "https://localhost:44330", + "sslPort": 44330 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "AuthServer": { + "commandName": "Project", + "dotnetRunMessages": "true", + "launchBrowser": true, + "applicationUrl": "https://localhost:44330", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/apps/auth-server/src/EShopOnAbp.AuthServer/Startup.cs b/apps/auth-server/src/EShopOnAbp.AuthServer/Startup.cs new file mode 100644 index 00000000..f20bcf34 --- /dev/null +++ b/apps/auth-server/src/EShopOnAbp.AuthServer/Startup.cs @@ -0,0 +1,19 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.DependencyInjection; + +namespace EShopOnAbp.AuthServer +{ + public class Startup + { + public void ConfigureServices(IServiceCollection services) + { + services.AddApplication(); + } + + public void Configure(IApplicationBuilder app, IWebHostEnvironment env) + { + app.InitializeApplication(); + } + } +} \ No newline at end of file diff --git a/apps/auth-server/src/EShopOnAbp.AuthServer/appsettings.Development.json b/apps/auth-server/src/EShopOnAbp.AuthServer/appsettings.Development.json new file mode 100644 index 00000000..70734009 --- /dev/null +++ b/apps/auth-server/src/EShopOnAbp.AuthServer/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + } +} diff --git a/apps/auth-server/src/EShopOnAbp.AuthServer/appsettings.json b/apps/auth-server/src/EShopOnAbp.AuthServer/appsettings.json new file mode 100644 index 00000000..f70bb6d7 --- /dev/null +++ b/apps/auth-server/src/EShopOnAbp.AuthServer/appsettings.json @@ -0,0 +1,40 @@ +{ + "App": { + "SelfUrl": "https://localhost:44330", + "CorsOrigins": "https://*.EShopOnAbp.com,http://localhost:4200,https://localhost:44307,https://localhost:44302,https://localhost:44325,https://localhost:44353", + "RedirectAllowedUrls": "http://localhost:4200,https://localhost:44307" + }, + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*", + "ConnectionStrings": { + "IdentityService": "Server=localhost,1434;Database=MyProjectName_Identity;User Id=sa;password=myPassw0rd;MultipleActiveResultSets=true", + "AdministrationService": "Server=localhost,1434;Database=MyProjectName_Administration;User Id=sa;password=myPassw0rd;MultipleActiveResultSets=true", + "SaasService": "Server=localhost,1434;Database=MyProjectName_Saas;User Id=sa;password=myPassw0rd;MultipleActiveResultSets=true" + }, + "StringEncryption": { + "DefaultPassPhrase": "gsKnGZ041HLL4IM8" + }, + "Redis": { + "Configuration": "localhost:6379" + }, + "RabbitMQ": { + "Connections": { + "Default": { + "HostName": "localhost" + } + }, + "EventBus": { + "ClientName": "EShopOnAbp_AuthServer", + "ExchangeName": "EShopOnAbp" + } + }, + "ElasticSearch": { + "Url": "http://localhost:9200" + } +} diff --git a/shared/EShopOnAbp.Shared.Hosting.AspNetCore/EShopOnAbp.Shared.Hosting.AspNetCore.csproj b/shared/EShopOnAbp.Shared.Hosting.AspNetCore/EShopOnAbp.Shared.Hosting.AspNetCore.csproj new file mode 100644 index 00000000..3de4b0cc --- /dev/null +++ b/shared/EShopOnAbp.Shared.Hosting.AspNetCore/EShopOnAbp.Shared.Hosting.AspNetCore.csproj @@ -0,0 +1,18 @@ + + + + net5.0 + EShopOnAbp.Shared.Hosting.AspNetCore + + + + + + + + + + + + + diff --git a/shared/EShopOnAbp.Shared.Hosting.AspNetCore/EShopOnAbpSharedHostingAspNetCoreModule.cs b/shared/EShopOnAbp.Shared.Hosting.AspNetCore/EShopOnAbpSharedHostingAspNetCoreModule.cs new file mode 100644 index 00000000..5457a486 --- /dev/null +++ b/shared/EShopOnAbp.Shared.Hosting.AspNetCore/EShopOnAbpSharedHostingAspNetCoreModule.cs @@ -0,0 +1,16 @@ +using Volo.Abp.AspNetCore.Serilog; +using Volo.Abp.Modularity; + +namespace EShopOnAbp.Shared.Hosting.AspNetCore +{ + [DependsOn( + typeof(EShopOnAbpSharedHostingModule), + typeof(AbpAspNetCoreSerilogModule) + )] + public class EShopOnAbpSharedHostingAspNetCoreModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + } + } +} \ No newline at end of file diff --git a/shared/EShopOnAbp.Shared.Hosting.AspNetCore/SerilogConfigurationHelper.cs b/shared/EShopOnAbp.Shared.Hosting.AspNetCore/SerilogConfigurationHelper.cs new file mode 100644 index 00000000..5240ca67 --- /dev/null +++ b/shared/EShopOnAbp.Shared.Hosting.AspNetCore/SerilogConfigurationHelper.cs @@ -0,0 +1,38 @@ +using Serilog; +using Serilog.Events; + +namespace EShopOnAbp.Shared.Hosting.AspNetCore +{ + public static class SerilogConfigurationHelper + { + public static void Configure(string applicationName) + { + // var configuration = new ConfigurationBuilder() + // .SetBasePath(Directory.GetCurrentDirectory()) + // .AddJsonFile("appsettings.json") + // .AddEnvironmentVariables() + // .Build(); + + Log.Logger = new LoggerConfiguration() +#if DEBUG + .MinimumLevel.Debug() +#else + .MinimumLevel.Information() +#endif + .MinimumLevel.Override("Microsoft", LogEventLevel.Information) + .MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning) + .Enrich.FromLogContext() + .Enrich.WithProperty("Application", $"{applicationName}") + .WriteTo.Async(c => c.File("Logs/logs.txt")) + // .WriteTo.Elasticsearch( + // new ElasticsearchSinkOptions(new Uri(configuration["ElasticSearch:Url"])) + // { + // AutoRegisterTemplate = true, + // AutoRegisterTemplateVersion = AutoRegisterTemplateVersion.ESv6, + // IndexFormat = "MyProjectName-log-{0:yyyy.MM}" + // }) + .WriteTo.Async(c => c.Console()) + .CreateLogger(); + } + } +} \ No newline at end of file diff --git a/shared/EShopOnAbp.Shared.Hosting/EShopOnAbp.Shared.Hosting.csproj b/shared/EShopOnAbp.Shared.Hosting/EShopOnAbp.Shared.Hosting.csproj new file mode 100644 index 00000000..d7797f5f --- /dev/null +++ b/shared/EShopOnAbp.Shared.Hosting/EShopOnAbp.Shared.Hosting.csproj @@ -0,0 +1,20 @@ + + + + netstandard2.0 + EShopOnAbp.Shared.Hosting + + + + + + + + + + + + + + + diff --git a/shared/EShopOnAbp.Shared.Hosting/EShopOnAbpSharedHostingModule.cs b/shared/EShopOnAbp.Shared.Hosting/EShopOnAbpSharedHostingModule.cs new file mode 100644 index 00000000..dba0c7c5 --- /dev/null +++ b/shared/EShopOnAbp.Shared.Hosting/EShopOnAbpSharedHostingModule.cs @@ -0,0 +1,51 @@ +using Volo.Abp.Autofac; +using Volo.Abp.Data; +using Volo.Abp.Modularity; + +namespace EShopOnAbp.Shared.Hosting +{ + [DependsOn( + typeof(AbpAutofacModule), + typeof(AbpDataModule) + )] + public class EShopOnAbpSharedHostingModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + ConfigureDatabaseConnections(); + } + private void ConfigureDatabaseConnections() + { + Configure(options => + { + // options.Databases.Configure("SaasService", database => + // { + // database.MappedConnections.Add("Saas"); + // database.IsUsedByTenants = false; + // }); + // + // options.Databases.Configure("AdministrationService", database => + // { + // database.MappedConnections.Add("AbpAuditLogging"); + // database.MappedConnections.Add("AbpPermissionManagement"); + // database.MappedConnections.Add("AbpSettingManagement"); + // database.MappedConnections.Add("AbpFeatureManagement"); + // database.MappedConnections.Add("AbpLanguageManagement"); + // database.MappedConnections.Add("TextTemplateManagement"); + // database.MappedConnections.Add("AbpBlobStoring"); + // }); + // + // options.Databases.Configure("IdentityService", database => + // { + // database.MappedConnections.Add("AbpIdentity"); + // database.MappedConnections.Add("AbpIdentityServer"); + // }); + // + // options.Databases.Configure("ProductService", database => + // { + // database.MappedConnections.Add("ProductService"); + // }); + }); + } + } +} \ No newline at end of file diff --git a/shared/EShopOnAbp.Shared.Localization/EShopOnAbp.Shared.Localization.csproj b/shared/EShopOnAbp.Shared.Localization/EShopOnAbp.Shared.Localization.csproj new file mode 100644 index 00000000..b35e5e6f --- /dev/null +++ b/shared/EShopOnAbp.Shared.Localization/EShopOnAbp.Shared.Localization.csproj @@ -0,0 +1,23 @@ + + + + net5.0 + true + EShopOnAbp + + + + + + + + + + + + + + + + + diff --git a/shared/EShopOnAbp.Shared.Localization/EShopOnAbpSharedLocalizationModule.cs b/shared/EShopOnAbp.Shared.Localization/EShopOnAbpSharedLocalizationModule.cs new file mode 100644 index 00000000..56e1743b --- /dev/null +++ b/shared/EShopOnAbp.Shared.Localization/EShopOnAbpSharedLocalizationModule.cs @@ -0,0 +1,34 @@ +using EShopOnAbp.Localization; +using Volo.Abp.Localization; +using Volo.Abp.Modularity; +using Volo.Abp.Validation; +using Volo.Abp.Validation.Localization; +using Volo.Abp.VirtualFileSystem; + +namespace EShopOnAbp +{ + [DependsOn( + typeof(AbpValidationModule) + )] + public class EShopOnAbpSharedLocalizationModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + options.FileSets.AddEmbedded(); + }); + + Configure(options => + { + options.Resources + .Add("en") + .AddBaseTypes( + typeof(AbpValidationResource) + ).AddVirtualJson("/Localization/EShopOnAbp"); + + options.DefaultResourceType = typeof(EShopOnAbpResource); + }); + } + } +} \ No newline at end of file diff --git a/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/ar.json b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/ar.json new file mode 100644 index 00000000..2c95fc8f --- /dev/null +++ b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/ar.json @@ -0,0 +1,7 @@ +{ + "culture": "ar", + "texts": { + "Menu:Home": "منزل، بيت", + "Login": "تسجيل الدخول" + } +} \ No newline at end of file diff --git a/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/de-DE.json b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/de-DE.json new file mode 100644 index 00000000..e7a17f95 --- /dev/null +++ b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/de-DE.json @@ -0,0 +1,5 @@ +{ + "culture": "de-DE", + "texts": { + } +} diff --git a/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/en.json b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/en.json new file mode 100644 index 00000000..63ec83ce --- /dev/null +++ b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/en.json @@ -0,0 +1,7 @@ +{ + "culture": "en", + "texts": { + "Menu:Home": "Home", + "Login": "Login" + } +} diff --git a/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/es.json b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/es.json new file mode 100644 index 00000000..40b4240a --- /dev/null +++ b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/es.json @@ -0,0 +1,5 @@ +{ + "culture": "es", + "texts": { + } +} diff --git a/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/fi.json b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/fi.json new file mode 100644 index 00000000..8f4d7100 --- /dev/null +++ b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/fi.json @@ -0,0 +1,7 @@ +{ + "culture": "fi", + "texts": { + "Menu:Home": "Koti", + "Login": "Kirjaudu sisään" + } +} \ No newline at end of file diff --git a/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/fr.json b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/fr.json new file mode 100644 index 00000000..06d9c1bc --- /dev/null +++ b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/fr.json @@ -0,0 +1,7 @@ +{ + "culture": "fr", + "texts": { + "Menu:Home": "Acceuil", + "Login": "Connexion" + } +} \ No newline at end of file diff --git a/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/hi.json b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/hi.json new file mode 100644 index 00000000..98c2b004 --- /dev/null +++ b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/hi.json @@ -0,0 +1,7 @@ +{ + "culture": "hi", + "texts": { + "Menu:Home": "घर", + "Login": "लॉग इन करें" + } +} \ No newline at end of file diff --git a/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/it.json b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/it.json new file mode 100644 index 00000000..3d81d3cb --- /dev/null +++ b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/it.json @@ -0,0 +1,7 @@ +{ + "culture": "it", + "texts": { + "Menu:Home": "Home", + "Login": "Login" + } +} \ No newline at end of file diff --git a/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/sl.json b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/sl.json new file mode 100644 index 00000000..103359cb --- /dev/null +++ b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/sl.json @@ -0,0 +1,5 @@ +{ + "culture": "sl", + "texts": { + } +} diff --git a/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/tr.json b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/tr.json new file mode 100644 index 00000000..8450b569 --- /dev/null +++ b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/tr.json @@ -0,0 +1,7 @@ +{ + "culture": "tr", + "texts": { + "Menu:Home": "Ana Sayfa", + "Login": "Giriş" + } +} diff --git a/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/zh-Hans.json b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/zh-Hans.json new file mode 100644 index 00000000..df56786e --- /dev/null +++ b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbp/zh-Hans.json @@ -0,0 +1,5 @@ +{ + "culture": "zh-Hans", + "texts": { + } +} diff --git a/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbpResource.cs b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbpResource.cs new file mode 100644 index 00000000..77f41c8c --- /dev/null +++ b/shared/EShopOnAbp.Shared.Localization/Localization/EShopOnAbpResource.cs @@ -0,0 +1,10 @@ +using Volo.Abp.Localization; + +namespace EShopOnAbp.Localization +{ + [LocalizationResourceName("EShopOnAbp")] + public class EShopOnAbpResource + { + + } +}