当前位置: 首页 > news >正文

餐饮网站开发背景网站备案授权书怎么填写

餐饮网站开发背景,网站备案授权书怎么填写,网站制作公,wordpress导航栏字体简介在之前的《ABP vNext微服务架构详细教程》系列中#xff0c;我们已经构建了完整的微服务架构实例#xff0c;但是在开发过程中#xff0c;我们会发现每个基础服务都包含10个类库#xff0c;这是给予DDD四层架构下ABP的实现方案#xff0c;但是实际使用中我们会发现我们已经构建了完整的微服务架构实例但是在开发过程中我们会发现每个基础服务都包含10个类库这是给予DDD四层架构下ABP的实现方案但是实际使用中我们会发现随着微服务的增多类库数量的确太过庞大了。而当时受到ABP vNext版本的限制并没有一个快速生成精简应用框架的方式。到了ABP vNext 5.3版本之后官方添加了新的模板——单层应用模板用于解决微服务架构单个项目类库过多的问题也给了我们可以快速构建精简的微服务项目的入口。这一篇我就基于单层应用模板对《ABP vNext微服务架构详细教程》系列原有微服务框架基础上进行简化在ABP vNext单层模板上进一步精简的同时提出一套在微服务架构下单层应用的最佳实践方案。此篇内容过长我会分多节讲述请一定阅读到最后。架构介绍在之前的文章编写时ABP vNext版本为5.1.1只有5.3.0之后版本才支持单页应用目前最新正式版版本为5.3.4这里我们单层模板以5.3.4版本为例。通过ABP CLI命令我们可以创建一个简单的单层应用模板项目。这里的单层是针对类库来说的也就是只有一层类库但是类库内部依旧包含着DDD下所有的元素只是按文件夹划分并且没有明确的分层界限。到当前版本为止ABP通过官方CLI命令创建的项目是必须包含用户角色权限信息管理和身份认证服务的项目。可以理解为过去应用模板的单层形式但实际在微服务架构下我们需要进行进一步的调整。对于整个微服务项目的总体架构和服务分层我们依旧沿用之前《ABP vNext微服务架构详细教程》中的设计详见https://mp.weixin.qq.com/s/uDGwxbEhBv15RdMlflb7LA在聚合服务层和基础服务层业务服务中我们使用单层模板为基础构建我们的服务。包含以下内容主服务WebAPI启动项也是ABP单层模板下生成的项目包含过去Domain、Application、EntityFramworkCore、HttpApi、HttpApi.Host项目的内容契约层当我们在聚合服务层依赖基础服务层时我们肯定只是希望依赖基础服务中接口声明而非实现所以将过去项目中的Application.Contracts和Domain.Shared两个类库中的内容从单层模板主项目抽离出来就是一个必须的工作。在这里我们将其放在契约层中动态客户端代理在之前的基础服务中包含一个特殊的类库HttpApi.Client。它是对基础服务层动态客户端代理的封装和配置它依赖于Application.Contracts项目在当前服务中我们依旧希望把它单独保留下来以便于聚合服务实现HTTP调用。这里基础服务层需要包含以上三个项目而聚合服务层目前没有提供动态客户端代理的需求所以可以只包含主服务和契约层。虽然从技术角度聚合服务中契约层也不是必须单独拿出来但是从架构一致性和扩展性角度我依旧推荐将契约单独存放。聚合服务层和基础服务层业务服务依赖关系如下图在整个微服务架构中身份管理基础服务比较特殊由于我们的授权中心依赖身份管理服务的EntityFrameworkCore如果采用单层架构则发现EntityFrameworkCore项目必须独立出来而EntityFrameworkCore依赖于Domain层则Domain层也需要独立此时我们发现这个项目已经违背了单层应用的初衷。所以身份管理的基础服务我们依旧采用之前的方式来构建。另外身份认证服务和网关本身就是单类库项目也不需要做调整。框架搭建1基础服务层基础服务我们命名为NotificationManager通过以下ABP CLI命令我们可以构建基础服务的主服务这里我们选择无UI模板MySQL数据库abp new Demo.NotificationManager -t app-nolayers -u none -dbms mysql将该服务添加至主解决方案service/notificationmanger解决方案文件夹下并在同目录下分别创建契约层类库 Demo.NotificationManager.Contracts 和动态客户端代理类库 Demo.NotificationManager.Client 。创建后结果如下图由于我们没有使用多语言所以直接将主项目中Localization文件夹所有内容删除。这里我打算使用另一种对象映射框架所以删除主项目中的ObjectMapping文件夹如果准备继续使用AutoMapper框架则保留该文件夹。移除主项目中Services文件夹中的Dtos子文件夹DTO不存放在该项目中而是在契约层。由于我们这边不涉及前端所以删除wwwroot文件夹和package.json文件。删除主服务Data文件夹下的IdentityServerDataSeedContributor.cs文件。删除后主服务项目结构如下编辑主项目的Demo.NotificationManager.csproj文件删除从  ItemGroup PackageReference IncludeVolo.Abp.Account.Application Version5.3.4 /  到  PackageReference IncludeMicrosoft.Extensions.FileProviders.Embedded Version6.0.5 / /ItemGroup 的所有引用及AutoMapper引用保留如下内容Project SdkMicrosoft.NET.Sdk.WebPropertyGroupTargetFrameworknet6.0/TargetFrameworkImplicitUsingsenable/ImplicitUsingsGenerateEmbeddedFilesManifesttrue/GenerateEmbeddedFilesManifest/PropertyGroupItemGroupPackageReference IncludeSerilog.AspNetCore Version5.0.0 /PackageReference IncludeSerilog.Sinks.Async Version1.5.0 //ItemGroupItemGroupPackageReference IncludeVolo.Abp.AspNetCore.Mvc Version5.3.4 /PackageReference IncludeVolo.Abp.Autofac Version5.3.4 /PackageReference IncludeVolo.Abp.Swashbuckle Version5.3.4 /PackageReference IncludeVolo.Abp.AspNetCore.Authentication.JwtBearer Version5.3.4 /PackageReference IncludeVolo.Abp.AspNetCore.Serilog Version5.3.4 /PackageReference IncludeVolo.Abp.EntityFrameworkCore.MySQL Version5.3.4 //ItemGroupItemGroupPackageReference IncludeMicrosoft.Extensions.FileProviders.Embedded Version6.0.5 //ItemGroupItemGroupPackageReference IncludeMicrosoft.EntityFrameworkCore.Tools Version6.0.5IncludeAssetsruntime; build; native; contentfiles; analyzers/IncludeAssetsPrivateAssetscompile; contentFiles; build; buildMultitargeting; buildTransitive; analyzers; native/PrivateAssets/PackageReference/ItemGroupItemGroupCompile RemoveLogs\** /Content RemoveLogs\** /EmbeddedResource RemoveLogs\** /None RemoveLogs\** //ItemGroupItemGroupProjectReference Include..\Demo.NotificationManager.Contracts\Demo.NotificationManager.Contracts.csproj //ItemGroup /Project删除主服务Data文件夹下NotificationManagerDbContext类中所有报错的行保留如下内容using Demo.NotificationManager.Entities.Notifications; using Microsoft.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;namespace Demo.NotificationManager.Data;public class NotificationManagerDbContext : AbpDbContextNotificationManagerDbContext { public NotificationManagerDbContext(DbContextOptionsNotificationManagerDbContext options): base(options){}protected override void OnModelCreating(ModelBuilder builder){base.OnModelCreating(builder);} }修改Data文件夹下NotificationManagerDbMigrationService类改为以下代码这里因为我们没使用多租户和初始化数据所以我移除了相关内容using System.Diagnostics; using System.Runtime.InteropServices; using Microsoft.Extensions.Logging.Abstractions; using Volo.Abp.Data; using Volo.Abp.DependencyInjection; using Volo.Abp.MultiTenancy;namespace Demo.NotificationManager.Data;public class NotificationManagerDbMigrationService : ITransientDependency {public ILoggerNotificationManagerDbMigrationService Logger { get; set; }private readonly IDataSeeder _dataSeeder;private readonly NotificationManagerEFCoreDbSchemaMigrator _dbSchemaMigrator;private readonly ICurrentTenant _currentTenant;public NotificationManagerDbMigrationService(IDataSeeder dataSeeder,NotificationManagerEFCoreDbSchemaMigrator dbSchemaMigrator,ICurrentTenant currentTenant){_dataSeeder dataSeeder;_dbSchemaMigrator dbSchemaMigrator;_currentTenant currentTenant;Logger NullLoggerNotificationManagerDbMigrationService.Instance;}public async Task MigrateAsync(){var initialMigrationAdded AddInitialMigrationIfNotExist();if (initialMigrationAdded){return;}Logger.LogInformation(Started database migrations...);await MigrateDatabaseSchemaAsync();Logger.LogInformation(Successfully completed all database migrations.);Logger.LogInformation(You can safely end this process...);}private async Task MigrateDatabaseSchemaAsync(){await _dbSchemaMigrator.MigrateAsync();}private bool AddInitialMigrationIfNotExist(){try{if (!DbMigrationsProjectExists()){return false;}}catch (Exception){return false;}try{if (!MigrationsFolderExists()){AddInitialMigration();return true;}else{return false;}}catch (Exception e){Logger.LogWarning(Couldnt determinate if any migrations exist : e.Message);return false;}}private bool DbMigrationsProjectExists(){return Directory.Exists(GetEntityFrameworkCoreProjectFolderPath());}private bool MigrationsFolderExists(){var dbMigrationsProjectFolder GetEntityFrameworkCoreProjectFolderPath();return Directory.Exists(Path.Combine(dbMigrationsProjectFolder, Migrations));}private void AddInitialMigration(){Logger.LogInformation(Creating initial migration...);string argumentPrefix;string fileName;if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || RuntimeInformation.IsOSPlatform(OSPlatform.Linux)){argumentPrefix -c;fileName /bin/bash;}else{argumentPrefix /C;fileName cmd.exe;}var procStartInfo new ProcessStartInfo(fileName,${argumentPrefix} \abp create-migration-and-run-migrator \{GetEntityFrameworkCoreProjectFolderPath()}\ --nolayers\);try{Process.Start(procStartInfo);}catch (Exception){throw new Exception(Couldnt run ABP CLI...);}}private string GetEntityFrameworkCoreProjectFolderPath(){var slnDirectoryPath GetSolutionDirectoryPath();if (slnDirectoryPath null){throw new Exception(Solution folder not found!);}return Path.Combine(slnDirectoryPath, Demo.NotificationManager);}private string GetSolutionDirectoryPath(){var currentDirectory new DirectoryInfo(Directory.GetCurrentDirectory());while (Directory.GetParent(currentDirectory.FullName) ! null){currentDirectory Directory.GetParent(currentDirectory.FullName);if (Directory.GetFiles(currentDirectory.FullName).FirstOrDefault(f f.EndsWith(.sln)) ! null){return currentDirectory.FullName;}}return null;} }将主服务模块类修改为以下内容using Demo.NotificationManager.Contracts; using Microsoft.OpenApi.Models; using Demo.NotificationManager.Data; using Volo.Abp; using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.Autofac; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.MySQL; using Volo.Abp.Modularity; using Volo.Abp.Swashbuckle; using Volo.Abp.VirtualFileSystem;namespace Demo.NotificationManager;[DependsOn(// ABP Framework packagestypeof(AbpAspNetCoreMvcModule),typeof(AbpAutofacModule),typeof(AbpEntityFrameworkCoreMySQLModule),typeof(AbpSwashbuckleModule),typeof(AbpAspNetCoreSerilogModule),typeof(NotificationManagerContractsModule) )] public class NotificationManagerModule : AbpModule {#region 私有方法#region 配置虚拟文件private void ConfigureVirtualFiles(IWebHostEnvironment hostingEnvironment){ConfigureAbpVirtualFileSystemOptions(options {options.FileSets.AddEmbeddedNotificationManagerModule();if (hostingEnvironment.IsDevelopment()){/* Using physical files in development, so we dont need to recompile on changes */options.FileSets.ReplaceEmbeddedByPhysicalNotificationManagerModule(hostingEnvironment.ContentRootPath);}});}#endregion#region 配置动态webapiprivate void ConfigureAutoApiControllers(){ConfigureAbpAspNetCoreMvcOptions(options {options.ConventionalControllers.Create(typeof(NotificationManagerModule).Assembly);});}#endregion#region 配置swaggerprivate void ConfigureSwagger(IServiceCollection services){services.AddAbpSwaggerGen(options {options.SwaggerDoc(v1, new OpenApiInfo { Title NotificationManager API, Version v1 });options.DocInclusionPredicate((docName, description) true);options.CustomSchemaIds(type type.FullName);});}#endregion#region 设置EFprivate void ConfigureEfCore(ServiceConfigurationContext context){context.Services.AddAbpDbContextNotificationManagerDbContext(options {/* You can remove includeAllEntities: true to create* default repositories only for aggregate roots* Documentation: https://docs.abp.io/en/abp/latest/Entity-Framework-Core#add-default-repositories*/options.AddDefaultRepositories(includeAllEntities: true);});ConfigureAbpDbContextOptions(options {options.Configure(configurationContext {configurationContext.UseMySQL();});});}#endregion#endregionpublic override void ConfigureServices(ServiceConfigurationContext context){var hostingEnvironment context.Services.GetHostingEnvironment();var configuration context.Services.GetConfiguration();ConfigureSwagger(context.Services);ConfigureAutoApiControllers();ConfigureVirtualFiles(hostingEnvironment);ConfigureEfCore(context);}public override void OnApplicationInitialization(ApplicationInitializationContext context){var app context.GetApplicationBuilder();var env context.GetEnvironment();if (env.IsDevelopment()){app.UseDeveloperExceptionPage();}app.UseAbpRequestLocalization();app.UseCorrelationId();app.UseStaticFiles();app.UseRouting();app.UseCors();app.UseUnitOfWork();app.UseSwagger();app.UseAbpSwaggerUI(options {options.SwaggerEndpoint(/swagger/v1/swagger.json, NotificationManager API);});app.UseAuditing();app.UseAbpSerilogEnrichers();app.UseConfiguredEndpoints();} } 在主服务中的appsettings.json中删除额外配置项保留如下内容{ConnectionStrings: {Default: Serverlocalhost;Port3306;DatabaseNotificationManager;Uidroot;Pwd123456;},urls: http://*:5005 }删除契约层中的Class1.cs,并添加模块类NotificationManagerContractsModule如下using Volo.Abp.Application; using Volo.Abp.Modularity;namespace Demo.NotificationManager.Contracts;[DependsOn(typeof(AbpDddApplicationContractsModule) )] public class NotificationManagerContractsModule : AbpModule {}在契约层添加NotificationManagerRemoteServiceConsts类如下namespace Demo.NotificationManager.Contracts;public class NotificationManagerRemoteServiceConsts {public const string RemoteServiceName NitificationManager;public const string ModuleName nitificationManager; }删除动态客户端代理层的Class1.cs文件添加模块类NotificationManagerClientModule如下using Demo.Abp.Extension; using Demo.NotificationManager.Contracts; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.Modularity; using Volo.Abp.Timing; using Volo.Abp.VirtualFileSystem;namespace Demo.NotificationManager.Client;public class NotificationManagerClientModule : AbpModule {public override void ConfigureServices(ServiceConfigurationContext context){context.Services.AddTransientAddHeaderHandler();context.Services.AddHttpClient(NotificationManagerRemoteServiceConsts.RemoteServiceName).AddHttpMessageHandlerAddHeaderHandler();context.Services.AddHttpClientProxies(typeof(NotificationManagerContractsModule).Assembly,NotificationManagerRemoteServiceConsts.RemoteServiceName);ConfigureAbpVirtualFileSystemOptions(options {options.FileSets.AddEmbeddedNotificationManagerClientModule();});ConfigureAbpClockOptions(options { options.Kind DateTimeKind.Local; });} }完成以上修改后运行项目并用浏览器访问http://localhost:5005可出现Swagger页面则基础服务配置成功。未完待续关注我获得更多精彩
http://www.zqtcl.cn/news/919320/

相关文章:

  • 公司网站建设方案江门建设建筑网站
  • 网站是生成静态好还是动态好怎么找到域名做的那个网站
  • 婚纱网站页面设计上海商地网站建设公司
  • 模板手机网站建设多少钱百度搜索词排名
  • 怎么学做网站住房和城乡建设部网站一级建造师
  • 政务公开网惠州seo推广公司
  • 建设英文商城网站网站开发工具选择
  • 沈阳市浑南区城乡建设局网站淄博哪里有网站建设平台
  • 做不锈钢管网站口碑好的定制网站建设提供商
  • 做网站推广销售wordpress 随机页面
  • 陈坤做直播在哪个网站如何在建设银行网站预约纪念币
  • 如何做网站么新网站一天做多少外链
  • 用家用路由器ip做网站营销策略方案
  • 学历教育网站建设网页前端是什么
  • 相同网站名网站县区分站点建设
  • 医疗器械网站建设方案南京网站制作系统
  • 小网站托管费用企查宝企业查询
  • 专门做特卖的网站是什么外国炫酷网站网址
  • 学习网站的建设wordpress批量拿shell
  • 中企动力做的网站推软件
  • 北京财优化沧州seo公司
  • 收到网站代码后怎么做啥是东莞网站优化推广
  • 重庆商城网站开发网站建设中英版
  • 免费企业网站开发给酒吧做网站
  • 想用自己电脑做服务器做个网站吗网站制作工作室哪家比较好
  • 这样建立网站vs2008做网站
  • 做网站创业故事好看大方的企业网站源码.net
  • 做家常菜哪个网站最好香蜜湖附近网站建设
  • 网站index.php被修改seo网络推广经理招聘
  • 南京做网站联系南京乐识网站建设培训福州