From 7a7fd33efbf5a4416069500ae079d481ca87f2fe Mon Sep 17 00:00:00 2001 From: Alper Ebicoglu Date: Tue, 2 Apr 2019 15:49:49 +0300 Subject: [PATCH 1/2] closes abpframework/abp#942 --- .../Controllers/ErrorController.cs | 127 ++++++++++++++++++ .../Controllers/HomeController.cs | 3 +- .../app/Volo.DocsTestApp/DocsTestAppModule.cs | 5 +- .../app/Volo.DocsTestApp/Pages/Index.cshtml | 4 +- .../docs/src/Volo.Docs.Web/DocsWebModule.cs | 2 + .../Pages/Documents/Project/Index.cshtml.cs | 10 +- 6 files changed, 143 insertions(+), 8 deletions(-) create mode 100644 modules/docs/app/Volo.DocsTestApp/Controllers/ErrorController.cs diff --git a/modules/docs/app/Volo.DocsTestApp/Controllers/ErrorController.cs b/modules/docs/app/Volo.DocsTestApp/Controllers/ErrorController.cs new file mode 100644 index 0000000000..943a3a85f2 --- /dev/null +++ b/modules/docs/app/Volo.DocsTestApp/Controllers/ErrorController.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using System.Net; +using Microsoft.AspNetCore.Diagnostics; +using Microsoft.AspNetCore.Mvc; +using Serilog; +using Volo.Abp.AspNetCore.Mvc; + +namespace Volo.DocsTestApp.Controllers +{ + public class ErrorController : AbpController + { + [Route("error/{statusCode}")] + [HttpGet] + public IActionResult Index(int statusCode = 0) + { + var statusFeature = HttpContext.Features.Get(); + if (statusFeature != null) + { + Log.Warning("Handled {0} error for URL: {1}", statusCode, statusFeature.OriginalPath); + } + + var isValidStatusCode = Enum.IsDefined(typeof(HttpStatusCode), statusCode); + if (!isValidStatusCode) + { + statusCode = (int)HttpStatusCode.BadRequest; + } + + return new ContentResult + { + ContentType = System.Net.Mime.MediaTypeNames.Text.Html, + StatusCode = statusCode, + Content = string.Format(HtmlBody, _errorMessages.ContainsKey(statusCode) + ? _errorMessages[statusCode] + : "Looks like something went wrong!") + }; + } + + private const string HtmlBody = "
{0}
Go to home page
"; + + /*For more ASCII arts http://patorjk.com/software/taag/#p=display&h=0&f=Big&t=400*/ + private readonly Dictionary _errorMessages = new Dictionary + { + { + 400, @" + _ _ ___ ___ + | || | / _ \ / _ \ + | || |_ | | | | | | | | + |__ _| | | | | | | | | + | | | |_| | | |_| | + |_| \___/ \___/ + +You've sent a bad request!" + }, + { + 401, @" + _ _ ___ __ + | || | / _ \ /_ | + | || |_ | | | | | | + |__ _| | | | | | | + | | | |_| | | | + |_| \___/ |_| + +Authorization required!" + }, + { + 403, + @" + _ _ ___ ____ + | || | / _ \ |___ \ + | || |_ | | | | __) | + |__ _| | | | | |__ < + | | | |_| | ___) | + |_| \___/ |____/ + +This is a forbidden area!" + }, + { + 404, @" + _ _ ___ _ _ + | || | / _ \ | || | + | || |_ | | | | | || |_ + |__ _| | | | | |__ _| + | | | |_| | | | + |_| \___/ |_| + +We can't find the page you're looking for..." + }, + { + 500, + @" + _____ ___ ___ + | ____| / _ \ / _ \ + | |__ | | | | | | | | + |___ \ | | | | | | | | + ___) | | |_| | | |_| | + |____/ \___/ \___/ + +Houston, we have a problem. Internal server error!" + }, + { + 502, + @" + _____ ___ ___ + | ____| / _ \ |__ \ + | |__ | | | | ) | + |___ \ | | | | / / + ___) | | |_| | / /_ + |____/ \___/ |____| + +Ooops! Our server is experiencing a mild case of the hiccups." + }, + { + 503, + @" + _____ ___ ____ + | ____| / _ \ |___ \ + | |__ | | | | __) | + |___ \ | | | | |__ < + ___) | | |_| | ___) | + |____/ \___/ |____/ + +Looks like we're having some server issues." + } + }; + } +} diff --git a/modules/docs/app/Volo.DocsTestApp/Controllers/HomeController.cs b/modules/docs/app/Volo.DocsTestApp/Controllers/HomeController.cs index a80cc2dfeb..0750e72b20 100644 --- a/modules/docs/app/Volo.DocsTestApp/Controllers/HomeController.cs +++ b/modules/docs/app/Volo.DocsTestApp/Controllers/HomeController.cs @@ -1,5 +1,4 @@ -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Mvc; namespace Volo.DocsTestApp.Controllers { diff --git a/modules/docs/app/Volo.DocsTestApp/DocsTestAppModule.cs b/modules/docs/app/Volo.DocsTestApp/DocsTestAppModule.cs index 9e25b70345..275eb0f713 100644 --- a/modules/docs/app/Volo.DocsTestApp/DocsTestAppModule.cs +++ b/modules/docs/app/Volo.DocsTestApp/DocsTestAppModule.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Diagnostics; using System.Globalization; using System.IO; using Microsoft.AspNetCore.Builder; @@ -108,7 +109,7 @@ namespace Volo.DocsTestApp app.UseDeveloperExceptionPage(); app.UseVirtualFiles(); - + app.UseSwagger(); app.UseSwaggerUI(options => { @@ -118,6 +119,8 @@ namespace Volo.DocsTestApp app.UseAuthentication(); app.UseRequestLocalization(app.ApplicationServices.GetRequiredService>().Value); + + app.UseStatusCodePagesWithReExecute("/error/{0}"); app.UseMvc(routes => { diff --git a/modules/docs/app/Volo.DocsTestApp/Pages/Index.cshtml b/modules/docs/app/Volo.DocsTestApp/Pages/Index.cshtml index f47edcbd98..ca46c1b442 100644 --- a/modules/docs/app/Volo.DocsTestApp/Pages/Index.cshtml +++ b/modules/docs/app/Volo.DocsTestApp/Pages/Index.cshtml @@ -1,4 +1,4 @@ @page @model Volo.DocsTestApp.Pages.IndexModel -

Welcome to the Docs demo application.

-Go to Docs \ No newline at end of file +

Welcome to the Docs Demo!

+Go to documents... \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Web/DocsWebModule.cs b/modules/docs/src/Volo.Docs.Web/DocsWebModule.cs index 689b9ec929..89301265ea 100644 --- a/modules/docs/src/Volo.Docs.Web/DocsWebModule.cs +++ b/modules/docs/src/Volo.Docs.Web/DocsWebModule.cs @@ -38,6 +38,8 @@ namespace Volo.Docs Configure(options => { //TODO: Make configurable! + options.Conventions.AddPageRoute("/Documents/Project/Index", "documents/{projectName}"); + options.Conventions.AddPageRoute("/Documents/Project/Index", "documents/{projectName}/{version}/{*documentName}"); }); diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs index a80aeb474c..378903d121 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs @@ -42,8 +42,8 @@ namespace Volo.Docs.Pages.Documents.Project private readonly IProjectAppService _projectAppService; public IndexModel( - IDocumentAppService documentAppService, - IDocumentToHtmlConverterFactory documentToHtmlConverterFactory, + IDocumentAppService documentAppService, + IDocumentToHtmlConverterFactory documentToHtmlConverterFactory, IProjectAppService projectAppService) { _documentAppService = documentAppService; @@ -80,6 +80,10 @@ namespace Volo.Docs.Pages.Documents.Project private async Task SetVersionAsync() { //TODO: Needs refactoring + if (string.IsNullOrWhiteSpace(Version)) + { + Version = DocsAppConsts.Latest; + } var output = await _projectAppService.GetVersionsAsync(Project.ShortName); var versions = output.Items @@ -142,7 +146,7 @@ namespace Volo.Docs.Pages.Documents.Project Navigation.ConvertItems(); } - + public string CreateVersionLink(VersionInfoViewModel latestVersion, string version, string documentName = null) { if (latestVersion == null || latestVersion.Version == version) From 6893ba762f0427c81c842a866a3e90191e287e42 Mon Sep 17 00:00:00 2001 From: Halil ibrahim Kalkan Date: Tue, 2 Apr 2019 16:16:49 +0300 Subject: [PATCH 2/2] Resolved #950: Add tenant management module to the MVC startup template. --- ...mpanyName.MyProjectName.Application.csproj | 1 + .../MyProjectNameApplicationModule.cs | 8 +- .../MyCompanyName.MyProjectName.Domain.csproj | 1 + .../MyProjectNameDomainModule.cs | 10 ++- .../MyProjectNameMigrationsDbContext.cs | 2 + ....cs => 20190402131334_Initial.Designer.cs} | 77 ++++++++++++++++++- ...9_Initial.cs => 20190402131334_Initial.cs} | 54 +++++++++++++ ...ectNameMigrationsDbContextModelSnapshot.cs | 75 ++++++++++++++++++ ...me.EntityFrameworkCore.DbMigrations.csproj | 4 + .../MyProjectNameEntityFrameworkCoreModule.cs | 4 +- ...e.MyProjectName.EntityFrameworkCore.csproj | 1 + .../MongoDb/MyProjectNameMongoDbModule.cs | 4 +- ...MyCompanyName.MyProjectName.MongoDB.csproj | 1 + .../MyCompanyName.MyProjectName.Web.csproj | 1 + .../MyProjectNameWebModule.cs | 5 +- 15 files changed, 239 insertions(+), 9 deletions(-) rename templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/{20190320072839_Initial.Designer.cs => 20190402131334_Initial.Designer.cs} (89%) rename templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/{20190320072839_Initial.cs => 20190402131334_Initial.cs} (90%) diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.Application/MyCompanyName.MyProjectName.Application.csproj b/templates/mvc/src/MyCompanyName.MyProjectName.Application/MyCompanyName.MyProjectName.Application.csproj index f774c93818..56ba7e68ae 100644 --- a/templates/mvc/src/MyCompanyName.MyProjectName.Application/MyCompanyName.MyProjectName.Application.csproj +++ b/templates/mvc/src/MyCompanyName.MyProjectName.Application/MyCompanyName.MyProjectName.Application.csproj @@ -11,6 +11,7 @@ + diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.Application/MyProjectNameApplicationModule.cs b/templates/mvc/src/MyCompanyName.MyProjectName.Application/MyProjectNameApplicationModule.cs index c23175b956..3373432a4c 100644 --- a/templates/mvc/src/MyCompanyName.MyProjectName.Application/MyProjectNameApplicationModule.cs +++ b/templates/mvc/src/MyCompanyName.MyProjectName.Application/MyProjectNameApplicationModule.cs @@ -1,16 +1,16 @@ -using MyCompanyName.MyProjectName.Permissions; -using Volo.Abp.Authorization.Permissions; -using Volo.Abp.AutoMapper; +using Volo.Abp.AutoMapper; using Volo.Abp.Identity; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement; +using Volo.Abp.TenantManagement; namespace MyCompanyName.MyProjectName { [DependsOn( typeof(MyProjectNameDomainModule), typeof(AbpIdentityApplicationModule), - typeof(AbpPermissionManagementApplicationModule) + typeof(AbpPermissionManagementApplicationModule), + typeof(AbpTenantManagementApplicationModule) )] public class MyProjectNameApplicationModule : AbpModule { diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.Domain/MyCompanyName.MyProjectName.Domain.csproj b/templates/mvc/src/MyCompanyName.MyProjectName.Domain/MyCompanyName.MyProjectName.Domain.csproj index 32d5d55698..0b829f04d8 100644 --- a/templates/mvc/src/MyCompanyName.MyProjectName.Domain/MyCompanyName.MyProjectName.Domain.csproj +++ b/templates/mvc/src/MyCompanyName.MyProjectName.Domain/MyCompanyName.MyProjectName.Domain.csproj @@ -12,6 +12,7 @@ + diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.Domain/MyProjectNameDomainModule.cs b/templates/mvc/src/MyCompanyName.MyProjectName.Domain/MyProjectNameDomainModule.cs index 5fca840175..9717644f7a 100644 --- a/templates/mvc/src/MyCompanyName.MyProjectName.Domain/MyProjectNameDomainModule.cs +++ b/templates/mvc/src/MyCompanyName.MyProjectName.Domain/MyProjectNameDomainModule.cs @@ -6,7 +6,9 @@ using Volo.Abp.Identity; using Volo.Abp.Localization; using Volo.Abp.Localization.Resources.AbpValidation; using Volo.Abp.Modularity; +using Volo.Abp.MultiTenancy; using Volo.Abp.PermissionManagement.Identity; +using Volo.Abp.TenantManagement; using Volo.Abp.VirtualFileSystem; namespace MyCompanyName.MyProjectName @@ -16,7 +18,8 @@ namespace MyCompanyName.MyProjectName typeof(AbpPermissionManagementDomainIdentityModule), typeof(AbpAuditingModule), typeof(BackgroundJobsDomainModule), - typeof(AbpAuditLoggingDomainModule) + typeof(AbpAuditLoggingDomainModule), + typeof(AbpTenantManagementDomainModule) )] public class MyProjectNameDomainModule : AbpModule { @@ -34,6 +37,11 @@ namespace MyCompanyName.MyProjectName .AddBaseTypes(typeof(AbpValidationResource)) .AddVirtualJson("/Localization/MyProjectName"); }); + + Configure(options => + { + options.IsEnabled = true; + }); } } } diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/MyProjectNameMigrationsDbContext.cs b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/MyProjectNameMigrationsDbContext.cs index 5fe35526b0..446e6b6ba4 100644 --- a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/MyProjectNameMigrationsDbContext.cs +++ b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/MyProjectNameMigrationsDbContext.cs @@ -6,6 +6,7 @@ using Volo.Abp.Identity; using Volo.Abp.Identity.EntityFrameworkCore; using Volo.Abp.PermissionManagement.EntityFrameworkCore; using Volo.Abp.SettingManagement.EntityFrameworkCore; +using Volo.Abp.TenantManagement.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.EntityFrameworkCore { @@ -28,6 +29,7 @@ namespace MyCompanyName.MyProjectName.EntityFrameworkCore builder.ConfigureBackgroundJobs(); builder.ConfigureAuditLogging(); builder.ConfigureIdentity(); + builder.ConfigureTenantManagement(); /* Configure customizations for entities from the modules included */ diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190320072839_Initial.Designer.cs b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190402131334_Initial.Designer.cs similarity index 89% rename from templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190320072839_Initial.Designer.cs rename to templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190402131334_Initial.Designer.cs index b25ddbee04..4244444813 100644 --- a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190320072839_Initial.Designer.cs +++ b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190402131334_Initial.Designer.cs @@ -10,7 +10,7 @@ using MyCompanyName.MyProjectName.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(MyProjectNameMigrationsDbContext))] - [Migration("20190320072839_Initial")] + [Migration("20190402131334_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -84,6 +84,8 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("TenantId") .HasColumnName("TenantId"); + b.Property("TenantName"); + b.Property("Url") .HasColumnName("Url") .HasMaxLength(256); @@ -163,6 +165,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnName("EntityId") .HasMaxLength(128); + b.Property("EntityTenantId"); + b.Property("EntityTypeFullName") .IsRequired() .HasColumnName("EntityTypeFullName") @@ -611,6 +615,69 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpSettings"); }); + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpTenants"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.Property("TenantId"); + + b.Property("Name") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasMaxLength(1024); + + b.HasKey("TenantId", "Name"); + + b.ToTable("AbpTenantConnectionStrings"); + }); + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => { b.HasOne("Volo.Abp.AuditLogging.AuditLog") @@ -679,6 +746,14 @@ namespace MyCompanyName.MyProjectName.Migrations .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.HasOne("Volo.Abp.TenantManagement.Tenant") + .WithMany("ConnectionStrings") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade); + }); #pragma warning restore 612, 618 } } diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190320072839_Initial.cs b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190402131334_Initial.cs similarity index 90% rename from templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190320072839_Initial.cs rename to templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190402131334_Initial.cs index 8f177b29fb..dcba749aed 100644 --- a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190320072839_Initial.cs +++ b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190402131334_Initial.cs @@ -18,6 +18,7 @@ namespace MyCompanyName.MyProjectName.Migrations UserId = table.Column(nullable: true), UserName = table.Column(maxLength: 256, nullable: true), TenantId = table.Column(nullable: true), + TenantName = table.Column(nullable: true), ImpersonatorUserId = table.Column(nullable: true), ImpersonatorTenantId = table.Column(nullable: true), ExecutionTime = table.Column(nullable: false), @@ -128,6 +129,27 @@ namespace MyCompanyName.MyProjectName.Migrations table.PrimaryKey("PK_AbpSettings", x => x.Id); }); + migrationBuilder.CreateTable( + name: "AbpTenants", + 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), + IsDeleted = table.Column(nullable: false, defaultValue: false), + DeleterId = table.Column(nullable: true), + DeletionTime = table.Column(nullable: true), + Name = table.Column(maxLength: 64, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpTenants", x => x.Id); + }); + migrationBuilder.CreateTable( name: "AbpUsers", columns: table => new @@ -198,6 +220,7 @@ namespace MyCompanyName.MyProjectName.Migrations TenantId = table.Column(nullable: true), ChangeTime = table.Column(nullable: false), ChangeType = table.Column(nullable: false), + EntityTenantId = table.Column(nullable: true), EntityId = table.Column(maxLength: 128, nullable: false), EntityTypeFullName = table.Column(maxLength: 128, nullable: false), ExtraProperties = table.Column(nullable: true) @@ -234,6 +257,25 @@ namespace MyCompanyName.MyProjectName.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "AbpTenantConnectionStrings", + columns: table => new + { + TenantId = table.Column(nullable: false), + Name = table.Column(maxLength: 64, nullable: false), + Value = table.Column(maxLength: 1024, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpTenantConnectionStrings", x => new { x.TenantId, x.Name }); + table.ForeignKey( + name: "FK_AbpTenantConnectionStrings_AbpTenants_TenantId", + column: x => x.TenantId, + principalTable: "AbpTenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateTable( name: "AbpUserClaims", columns: table => new @@ -405,6 +447,12 @@ namespace MyCompanyName.MyProjectName.Migrations table: "AbpSettings", columns: new[] { "Name", "ProviderName", "ProviderKey" }); + migrationBuilder.CreateIndex( + name: "IX_AbpTenants_Name", + table: "AbpTenants", + column: "Name", + unique: true); + migrationBuilder.CreateIndex( name: "IX_AbpUserClaims_UserId", table: "AbpUserClaims", @@ -464,6 +512,9 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "AbpSettings"); + migrationBuilder.DropTable( + name: "AbpTenantConnectionStrings"); + migrationBuilder.DropTable( name: "AbpUserClaims"); @@ -479,6 +530,9 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "AbpEntityChanges"); + migrationBuilder.DropTable( + name: "AbpTenants"); + migrationBuilder.DropTable( name: "AbpRoles"); diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs index 43def4fbad..f6136bdfbd 100644 --- a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs +++ b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs @@ -82,6 +82,8 @@ namespace MyCompanyName.MyProjectName.Migrations b.Property("TenantId") .HasColumnName("TenantId"); + b.Property("TenantName"); + b.Property("Url") .HasColumnName("Url") .HasMaxLength(256); @@ -161,6 +163,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnName("EntityId") .HasMaxLength(128); + b.Property("EntityTenantId"); + b.Property("EntityTypeFullName") .IsRequired() .HasColumnName("EntityTypeFullName") @@ -609,6 +613,69 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpSettings"); }); + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp"); + + b.Property("CreationTime") + .HasColumnName("CreationTime"); + + b.Property("CreatorId") + .HasColumnName("CreatorId"); + + b.Property("DeleterId") + .HasColumnName("DeleterId"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(64); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpTenants"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.Property("TenantId"); + + b.Property("Name") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasMaxLength(1024); + + b.HasKey("TenantId", "Name"); + + b.ToTable("AbpTenantConnectionStrings"); + }); + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => { b.HasOne("Volo.Abp.AuditLogging.AuditLog") @@ -677,6 +744,14 @@ namespace MyCompanyName.MyProjectName.Migrations .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Cascade); }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.HasOne("Volo.Abp.TenantManagement.Tenant") + .WithMany("ConnectionStrings") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade); + }); #pragma warning restore 612, 618 } } diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations.csproj b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations.csproj index b38b78dbd2..773870d3de 100644 --- a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations.csproj +++ b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations.csproj @@ -7,6 +7,10 @@ MyCompanyName.MyProjectName + + + + diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameEntityFrameworkCoreModule.cs b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameEntityFrameworkCoreModule.cs index efd0a9204f..4cc9a0a379 100644 --- a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameEntityFrameworkCoreModule.cs +++ b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameEntityFrameworkCoreModule.cs @@ -6,6 +6,7 @@ using Volo.Abp.Identity.EntityFrameworkCore; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement.EntityFrameworkCore; using Volo.Abp.SettingManagement.EntityFrameworkCore; +using Volo.Abp.TenantManagement.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.EntityFrameworkCore { @@ -16,7 +17,8 @@ namespace MyCompanyName.MyProjectName.EntityFrameworkCore typeof(AbpSettingManagementEntityFrameworkCoreModule), typeof(AbpEntityFrameworkCoreSqlServerModule), typeof(BackgroundJobsEntityFrameworkCoreModule), - typeof(AbpAuditLoggingEntityFrameworkCoreModule) + typeof(AbpAuditLoggingEntityFrameworkCoreModule), + typeof(AbpTenantManagementEntityFrameworkCoreModule) )] public class MyProjectNameEntityFrameworkCoreModule : AbpModule { diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/MyCompanyName.MyProjectName.EntityFrameworkCore.csproj b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/MyCompanyName.MyProjectName.EntityFrameworkCore.csproj index 30b78df34e..2776aebb0e 100644 --- a/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/MyCompanyName.MyProjectName.EntityFrameworkCore.csproj +++ b/templates/mvc/src/MyCompanyName.MyProjectName.EntityFrameworkCore/MyCompanyName.MyProjectName.EntityFrameworkCore.csproj @@ -14,6 +14,7 @@ + diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.MongoDB/MongoDb/MyProjectNameMongoDbModule.cs b/templates/mvc/src/MyCompanyName.MyProjectName.MongoDB/MongoDb/MyProjectNameMongoDbModule.cs index 17bccd4f17..e16cb6238f 100644 --- a/templates/mvc/src/MyCompanyName.MyProjectName.MongoDB/MongoDb/MyProjectNameMongoDbModule.cs +++ b/templates/mvc/src/MyCompanyName.MyProjectName.MongoDB/MongoDb/MyProjectNameMongoDbModule.cs @@ -5,6 +5,7 @@ using Volo.Abp.Identity.MongoDB; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement.MongoDB; using Volo.Abp.SettingManagement.MongoDB; +using Volo.Abp.TenantManagement.MongoDb; namespace MyCompanyName.MyProjectName.MongoDb { @@ -13,7 +14,8 @@ namespace MyCompanyName.MyProjectName.MongoDb typeof(AbpSettingManagementMongoDbModule), typeof(AbpIdentityMongoDbModule), typeof(BackgroundJobsMongoDbModule), - typeof(AbpAuditLoggingMongoDbModule) + typeof(AbpAuditLoggingMongoDbModule), + typeof(AbpTenantManagementMongoDbModule) )] public class MyProjectNameMongoDbModule : AbpModule { diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.MongoDB/MyCompanyName.MyProjectName.MongoDB.csproj b/templates/mvc/src/MyCompanyName.MyProjectName.MongoDB/MyCompanyName.MyProjectName.MongoDB.csproj index ece0fd1b4d..01e5c837a4 100644 --- a/templates/mvc/src/MyCompanyName.MyProjectName.MongoDB/MyCompanyName.MyProjectName.MongoDB.csproj +++ b/templates/mvc/src/MyCompanyName.MyProjectName.MongoDB/MyCompanyName.MyProjectName.MongoDB.csproj @@ -14,6 +14,7 @@ + diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj b/templates/mvc/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj index f3e67ec343..6866fb16c0 100644 --- a/templates/mvc/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj +++ b/templates/mvc/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj @@ -34,6 +34,7 @@ + diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs b/templates/mvc/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs index 08ccecdf38..97357b8ceb 100644 --- a/templates/mvc/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs +++ b/templates/mvc/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs @@ -34,6 +34,8 @@ using Volo.Abp.VirtualFileSystem; using Volo.Abp.PermissionManagement; // using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.TenantManagement.Web; + // namespace MyCompanyName.MyProjectName @@ -44,7 +46,8 @@ namespace MyCompanyName.MyProjectName typeof(AbpAutofacModule), typeof(AbpIdentityWebModule), typeof(AbpAccountWebModule), - typeof(AbpAspNetCoreMvcUiBasicThemeModule) + typeof(AbpAspNetCoreMvcUiBasicThemeModule), + typeof(AbpTenantManagementWebModule) )] public class MyProjectNameWebModule : AbpModule {