From 92486177a8ac70a951f45252e06ccadb6f7e3181 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Fri, 20 Sep 2019 15:55:18 +0300 Subject: [PATCH 01/62] source code download --- .../Volo/Abp/Cli/AbpCliCoreModule.cs | 1 + .../Volo/Abp/Cli/Commands/GetSourceCommand.cs | 157 ++++++++++++++++++ .../Volo/Abp/Cli/Commands/NewCommand.cs | 8 +- ...mplateStore.cs => AbpIoSourceCodeStore.cs} | 40 +++-- .../ProjectBuilding/Building/ModuleInfo.cs | 11 ++ .../ModuleProjectBuildPipelineBuilder.cs | 18 ++ .../Building/ProjectBuildContext.cs | 9 +- .../Steps/NugetReferenceReplaceStep.cs | 2 +- ...=> TemplateProjectBuildPipelineBuilder.cs} | 2 +- .../ProjectBuilding/IModuleInfoProvider.cs | 13 ++ ...{ITemplateStore.cs => ISourceCodeStore.cs} | 3 +- .../Cli/ProjectBuilding/ModuleInfoProvider.cs | 58 +++++++ .../ProjectBuilding/ModuleProjectBuilder.cs | 110 ++++++++++++ .../Cli/ProjectBuilding/SourceCodeTypes.cs | 13 ++ ...ctBuilder.cs => TemplateProjectBuilder.cs} | 20 ++- 15 files changed, 428 insertions(+), 37 deletions(-) create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs rename framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/{AbpIoTemplateStore.cs => AbpIoSourceCodeStore.cs} (71%) create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleInfo.cs create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleProjectBuildPipelineBuilder.cs rename framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/{ProjectBuildPipelineBuilder.cs => TemplateProjectBuildPipelineBuilder.cs} (94%) create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/IModuleInfoProvider.cs rename framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/{ITemplateStore.cs => ISourceCodeStore.cs} (78%) create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleInfoProvider.cs create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/SourceCodeTypes.cs rename framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/{ProjectBuilder.cs => TemplateProjectBuilder.cs} (90%) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs index 11e2e23a98..b51ef5fb2d 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/AbpCliCoreModule.cs @@ -27,6 +27,7 @@ namespace Volo.Abp.Cli { options.Commands["help"] = typeof(HelpCommand); options.Commands["new"] = typeof(NewCommand); + options.Commands["get-source"] = typeof(GetSourceCommand); options.Commands["update"] = typeof(UpdateCommand); options.Commands["add-package"] = typeof(AddPackageCommand); options.Commands["add-module"] = typeof(AddModuleCommand); diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs new file mode 100644 index 0000000000..54711fbc31 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs @@ -0,0 +1,157 @@ +using System; +using System.IO; +using System.Text; +using System.Threading.Tasks; +using ICSharpCode.SharpZipLib.Core; +using ICSharpCode.SharpZipLib.Zip; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Volo.Abp.Cli.Args; +using Volo.Abp.Cli.ProjectBuilding; +using Volo.Abp.Cli.ProjectBuilding.Building; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.Cli.Commands +{ + public class GetSourceCommand : IConsoleCommand, ITransientDependency + { + public ModuleProjectBuilder ModuleProjectBuilder { get; } + + public ILogger Logger { get; set; } + + public GetSourceCommand(ModuleProjectBuilder moduleProjectBuilder) + { + ModuleProjectBuilder = moduleProjectBuilder; + Logger = NullLogger.Instance; + } + + public async Task ExecuteAsync(CommandLineArgs commandLineArgs) + { + if (commandLineArgs.Target == null) + { + throw new CliUsageException( + "Module name is missing!" + + Environment.NewLine + Environment.NewLine + + GetUsageInfo() + ); + } + + Logger.LogInformation("Downloading source code of " + commandLineArgs.Target); + + var version = commandLineArgs.Options.GetOrNull(Options.Version.Short, Options.Version.Long); + if (version != null) + { + Logger.LogInformation("Version: " + version); + } + + var outputFolder = commandLineArgs.Options.GetOrNull(Options.OutputFolder.Short, Options.OutputFolder.Long); + if (outputFolder != null) + { + if (!Directory.Exists(outputFolder)) + { + Directory.CreateDirectory(outputFolder); + } + + outputFolder = Path.GetFullPath(outputFolder); + } + else + { + outputFolder = Directory.GetCurrentDirectory(); + } + + Logger.LogInformation("Output folder: " + outputFolder); + + commandLineArgs.Options.Add(CliConsts.Command, commandLineArgs.Command); + + var result = await ModuleProjectBuilder.BuildAsync( + new ProjectBuildArgs( + SolutionName.Parse(commandLineArgs.Target), + commandLineArgs.Target, + version, + DatabaseProvider.NotSpecified, + UiFramework.NotSpecified, + commandLineArgs.Options + ) + ); + + using (var templateFileStream = new MemoryStream(result.ZipContent)) + { + using (var zipInputStream = new ZipInputStream(templateFileStream)) + { + var zipEntry = zipInputStream.GetNextEntry(); + while (zipEntry != null) + { + var fullZipToPath = Path.Combine(outputFolder, zipEntry.Name); + var directoryName = Path.GetDirectoryName(fullZipToPath); + + if (!string.IsNullOrEmpty(directoryName)) + { + Directory.CreateDirectory(directoryName); + } + + var fileName = Path.GetFileName(fullZipToPath); + if (fileName.Length == 0) + { + zipEntry = zipInputStream.GetNextEntry(); + continue; + } + + var buffer = new byte[4096]; // 4K is optimum + using (var streamWriter = File.Create(fullZipToPath)) + { + StreamUtils.Copy(zipInputStream, streamWriter, buffer); + } + + zipEntry = zipInputStream.GetNextEntry(); + } + } + } + + Logger.LogInformation($"'{commandLineArgs.Target}' has been successfully downloaded to '{outputFolder}'"); + } + + public string GetUsageInfo() + { + var sb = new StringBuilder(); + + sb.AppendLine(""); + sb.AppendLine("Usage:"); + sb.AppendLine(""); + sb.AppendLine(" abp get-source [options]"); + sb.AppendLine(""); + sb.AppendLine("Options:"); + sb.AppendLine(""); + sb.AppendLine("-o|--output-folder (default: current folder)"); + sb.AppendLine("-v|--version (default: latest version)"); + sb.AppendLine(""); + sb.AppendLine("Examples:"); + sb.AppendLine(""); + sb.AppendLine(" abp get-source Volo.Blogging"); + sb.AppendLine(" abp get-source Volo.Blogging -o d:\\my-project"); + sb.AppendLine(""); + sb.AppendLine("See the documentation for more info: https://docs.abp.io/en/abp/latest/CLI"); + + return sb.ToString(); + } + + public string GetShortDescription() + { + return "Downloads the source code of the specified module."; + } + + public static class Options + { + public static class OutputFolder + { + public const string Short = "o"; + public const string Long = "output-folder"; + } + + public static class Version + { + public const string Short = "v"; + public const string Long = "version"; + } + } + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs index 6921f8e4d8..d8d9395554 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs @@ -17,11 +17,11 @@ namespace Volo.Abp.Cli.Commands { public ILogger Logger { get; set; } - protected ProjectBuilder ProjectBuilder { get; } + protected TemplateProjectBuilder TemplateProjectBuilder { get; } - public NewCommand(ProjectBuilder projectBuilder) + public NewCommand(TemplateProjectBuilder templateProjectBuilder) { - ProjectBuilder = projectBuilder; + TemplateProjectBuilder = templateProjectBuilder; Logger = NullLogger.Instance; } @@ -83,7 +83,7 @@ namespace Volo.Abp.Cli.Commands commandLineArgs.Options.Add(CliConsts.Command, commandLineArgs.Command); - var result = await ProjectBuilder.BuildAsync( + var result = await TemplateProjectBuilder.BuildAsync( new ProjectBuildArgs( SolutionName.Parse(commandLineArgs.Target), template, diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoTemplateStore.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs similarity index 71% rename from framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoTemplateStore.cs rename to framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs index 21f868e73f..6fde8db9e3 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoTemplateStore.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs @@ -15,9 +15,9 @@ using Volo.Abp.Threading; namespace Volo.Abp.Cli.ProjectBuilding { - public class AbpIoTemplateStore : ITemplateStore, ITransientDependency + public class AbpIoSourceCodeStore : ISourceCodeStore, ITransientDependency { - public ILogger Logger { get; set; } + public ILogger Logger { get; set; } protected CliOptions Options { get; } @@ -25,7 +25,7 @@ namespace Volo.Abp.Cli.ProjectBuilding protected ICancellationTokenProvider CancellationTokenProvider { get; } - public AbpIoTemplateStore( + public AbpIoSourceCodeStore( IOptions options, IJsonSerializer jsonSerializer, ICancellationTokenProvider cancellationTokenProvider) @@ -34,14 +34,15 @@ namespace Volo.Abp.Cli.ProjectBuilding CancellationTokenProvider = cancellationTokenProvider; Options = options.Value; - Logger = NullLogger.Instance; + Logger = NullLogger.Instance; } public async Task GetAsync( string name, + string type, string version = null) { - var latestVersion = await GetLatestTemplateVersionAsync(name); + var latestVersion = await GetLatestSourceCodeVersionAsync(name, type); if (version == null) { version = latestVersion; @@ -52,16 +53,17 @@ namespace Volo.Abp.Cli.ProjectBuilding var localCacheFile = Path.Combine(CliPaths.TemplateCache, name + "-" + version + ".zip"); if (Options.CacheTemplates && File.Exists(localCacheFile)) { - Logger.LogInformation("Using cached template: " + name + ", version: " + version); + Logger.LogInformation("Using cached " + type + ": " + name + ", version: " + version); return new TemplateFile(File.ReadAllBytes(localCacheFile), version, latestVersion); } - Logger.LogInformation("Downloading template: " + name + ", version: " + version); + Logger.LogInformation("Downloading " + type + ": " + name + ", version: " + version); - var fileContent = await DownloadTemplateFileContentAsync( - new TemplateDownloadInputDto + var fileContent = await DownloadSourceCodeContentAsync( + new SourceCodeDownloadInputDto { Name = name, + Type = type, Version = version } ); @@ -74,14 +76,14 @@ namespace Volo.Abp.Cli.ProjectBuilding return new TemplateFile(fileContent, version, latestVersion); } - private async Task GetLatestTemplateVersionAsync(string name) + private async Task GetLatestSourceCodeVersionAsync(string name, string type) { - var postData = JsonSerializer.Serialize(new GetLatestTemplateVersionDto { Name = name }); + var postData = JsonSerializer.Serialize(new GetLatestSourceCodeVersionDto { Name = name }); using (var client = new CliHttpClient()) { var responseMessage = await client.PostAsync( - $"{CliUrls.WwwAbpIo}api/download/template/get-version/", + $"{CliUrls.WwwAbpIo}api/download/{type}/get-version/", new StringContent(postData, Encoding.UTF8, MimeTypes.Application.Json), CancellationTokenProvider.Token ); @@ -92,18 +94,18 @@ namespace Volo.Abp.Cli.ProjectBuilding } var result = await responseMessage.Content.ReadAsStringAsync(); - return JsonSerializer.Deserialize(result).Version; + return JsonSerializer.Deserialize(result).Version; } } - private async Task DownloadTemplateFileContentAsync(TemplateDownloadInputDto input) + private async Task DownloadSourceCodeContentAsync(SourceCodeDownloadInputDto input) { var postData = JsonSerializer.Serialize(input); using (var client = new CliHttpClient(TimeSpan.FromMinutes(10))) { var responseMessage = await client.PostAsync( - $"{CliUrls.WwwAbpIo}api/download/template/", + $"{CliUrls.WwwAbpIo}api/download/{input.Type}/", new StringContent(postData, Encoding.UTF8, MimeTypes.Application.Json), CancellationTokenProvider.Token ); @@ -117,19 +119,21 @@ namespace Volo.Abp.Cli.ProjectBuilding } } - public class TemplateDownloadInputDto + public class SourceCodeDownloadInputDto { public string Name { get; set; } public string Version { get; set; } + + public string Type { get; set; } } - public class GetLatestTemplateVersionDto + public class GetLatestSourceCodeVersionDto { public string Name { get; set; } } - public class GetLatestTemplateVersionResultDto + public class GetLatestSourceCodeVersionResultDto { public string Version { get; set; } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleInfo.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleInfo.cs new file mode 100644 index 0000000000..dfeabf6aed --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleInfo.cs @@ -0,0 +1,11 @@ +namespace Volo.Abp.Cli.ProjectBuilding.Building +{ + public class ModuleInfo + { + public string Name { get; set; } + + public string Namespace { get; set; } + + public string DocumentUrl { get; set; } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleProjectBuildPipelineBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleProjectBuildPipelineBuilder.cs new file mode 100644 index 0000000000..3a5fcee77b --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleProjectBuildPipelineBuilder.cs @@ -0,0 +1,18 @@ +using Volo.Abp.Cli.ProjectBuilding.Building.Steps; + +namespace Volo.Abp.Cli.ProjectBuilding.Building +{ + public static class ModuleProjectBuildPipelineBuilder + { + public static ProjectBuildPipeline Build(ProjectBuildContext context) + { + var pipeline = new ProjectBuildPipeline(context); + + pipeline.Steps.Add(new FileEntryListReadStep()); + pipeline.Steps.Add(new NugetReferenceReplaceStep()); + pipeline.Steps.Add(new CreateProjectResultZipStep()); + + return pipeline; + } + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ProjectBuildContext.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ProjectBuildContext.cs index 1ea040022f..8b5522165f 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ProjectBuildContext.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ProjectBuildContext.cs @@ -11,19 +11,22 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building [NotNull] public ProjectBuildArgs BuildArgs { get; } - [NotNull] public TemplateInfo Template { get; } + public ModuleInfo Module { get; } + public FileEntryList Files { get; set; } public ProjectResult Result { get; set; } public ProjectBuildContext( - [NotNull] TemplateInfo template, + TemplateInfo template, + ModuleInfo module, [NotNull] TemplateFile templateFile, [NotNull] ProjectBuildArgs buildArgs) { - Template = Check.NotNull(template, nameof(template)); + Template = template; + Module = module; TemplateFile = Check.NotNull(templateFile, nameof(templateFile)); BuildArgs = Check.NotNull(buildArgs, nameof(buildArgs)); diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/NugetReferenceReplaceStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/NugetReferenceReplaceStep.cs index cb790ba91f..7d08ed7ff6 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/NugetReferenceReplaceStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/NugetReferenceReplaceStep.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps new NugetReferenceReplacer( context.Files, - "MyCompanyName.MyProjectName", + context.Module?.Namespace ?? "MyCompanyName.MyProjectName", nugetPackageVersion ).Run(); } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ProjectBuildPipelineBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs similarity index 94% rename from framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ProjectBuildPipelineBuilder.cs rename to framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs index 49cb44d13a..7ff1f5a38a 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ProjectBuildPipelineBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs @@ -3,7 +3,7 @@ using Volo.Abp.Cli.ProjectBuilding.Templates.App; namespace Volo.Abp.Cli.ProjectBuilding.Building { - public static class ProjectBuildPipelineBuilder + public static class TemplateProjectBuildPipelineBuilder { public static ProjectBuildPipeline Build(ProjectBuildContext context) { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/IModuleInfoProvider.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/IModuleInfoProvider.cs new file mode 100644 index 0000000000..7e490a78d2 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/IModuleInfoProvider.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using Volo.Abp.Cli.ProjectBuilding.Building; + +namespace Volo.Abp.Cli.ProjectBuilding +{ + public interface IModuleInfoProvider + { + Task GetAsync(string name); + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ITemplateStore.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ISourceCodeStore.cs similarity index 78% rename from framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ITemplateStore.cs rename to framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ISourceCodeStore.cs index 728d4d4a51..4d1ed7aa0c 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ITemplateStore.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ISourceCodeStore.cs @@ -3,10 +3,11 @@ using JetBrains.Annotations; namespace Volo.Abp.Cli.ProjectBuilding { - public interface ITemplateStore + public interface ISourceCodeStore { Task GetAsync( string name, + string type, [CanBeNull] string version = null ); } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleInfoProvider.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleInfoProvider.cs new file mode 100644 index 0000000000..b13cf262c9 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleInfoProvider.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.Json; +using Volo.Abp.Cli.Http; +using Volo.Abp.Cli.ProjectBuilding.Building; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Http; +using Volo.Abp.Threading; + +namespace Volo.Abp.Cli.ProjectBuilding +{ + public class ModuleInfoProvider: IModuleInfoProvider, ITransientDependency + { + public IJsonSerializer JsonSerializer { get; } + public ICancellationTokenProvider CancellationTokenProvider { get; } + + public ModuleInfoProvider(IJsonSerializer jsonSerializer, ICancellationTokenProvider cancellationTokenProvider) + { + JsonSerializer = jsonSerializer; + CancellationTokenProvider = cancellationTokenProvider; + } + + public async Task GetAsync(string name) + { + var moduleList = await GetModuleListAsync(); + + var module = moduleList.FirstOrDefault(m => m.Name == name); + + if (module == null) + { + throw new Exception("Module not found!"); + } + + return module; + } + + private async Task> GetModuleListAsync() + { + using (var client = new CliHttpClient()) + { + var responseMessage = await client.GetAsync( + $"{CliUrls.WwwAbpIo}api/download/modules/", + CancellationTokenProvider.Token + ); + + if (!responseMessage.IsSuccessStatusCode) + { + throw new Exception("Remote server returns error! HTTP status code: " + responseMessage.StatusCode); + } + + var result = await responseMessage.Content.ReadAsStringAsync(); + return JsonSerializer.Deserialize>(result); + } + } + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs new file mode 100644 index 0000000000..c527375a70 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs @@ -0,0 +1,110 @@ +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Microsoft.Extensions.Options; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.Cli.Commands; +using Volo.Abp.Cli.Licensing; +using Volo.Abp.Cli.ProjectBuilding.Analyticses; +using Volo.Abp.Cli.ProjectBuilding.Building; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Json; + +namespace Volo.Abp.Cli.ProjectBuilding +{ + public class ModuleProjectBuilder : IProjectBuilder, ITransientDependency + { + public ILogger Logger { get; set; } + + protected ISourceCodeStore SourceCodeStore { get; } + protected IModuleInfoProvider ModuleInfoProvider { get; } + protected ICliAnalyticsCollect CliAnalyticsCollect { get; } + protected CliOptions Options { get; } + protected IJsonSerializer JsonSerializer { get; } + protected IApiKeyService ApiKeyService { get; } + + public ModuleProjectBuilder(ISourceCodeStore sourceCodeStore, + IModuleInfoProvider moduleInfoProvider, + ICliAnalyticsCollect cliAnalyticsCollect, + IOptions options, + IJsonSerializer jsonSerializer, + IApiKeyService apiKeyService) + { + SourceCodeStore = sourceCodeStore; + ModuleInfoProvider = moduleInfoProvider; + CliAnalyticsCollect = cliAnalyticsCollect; + Options = options.Value; + JsonSerializer = jsonSerializer; + ApiKeyService = apiKeyService; + + Logger = NullLogger.Instance; + } + + public async Task BuildAsync(ProjectBuildArgs args) + { + var moduleInfo = await GetModuleInfoAsync(args); + + var templateFile = await SourceCodeStore.GetAsync( + args.TemplateName, + SourceCodeTypes.Module, + args.Version + ); + + var apiKeyResult = await ApiKeyService.GetApiKeyOrNullAsync(); + if (apiKeyResult?.ApiKey != null) + { + args.ExtraProperties["api-key"] = apiKeyResult.ApiKey; + } + + if (apiKeyResult?.LicenseCode != null) + { + args.ExtraProperties["license-code"] = apiKeyResult.LicenseCode; + } + + var context = new ProjectBuildContext( + null, + moduleInfo, + templateFile, + args + ); + + ModuleProjectBuildPipelineBuilder.Build(context).Execute(); + + if (!moduleInfo.DocumentUrl.IsNullOrEmpty()) + { + Logger.LogInformation("Check out the documents at " + moduleInfo.DocumentUrl); + } + + // Exclude unwanted or known options. + var options = args.ExtraProperties + .Where(x => !x.Key.Equals(CliConsts.Command, StringComparison.InvariantCultureIgnoreCase)) + .Where(x => !x.Key.Equals(NewCommand.Options.OutputFolder.Long, StringComparison.InvariantCultureIgnoreCase) && + !x.Key.Equals(NewCommand.Options.OutputFolder.Short, StringComparison.InvariantCultureIgnoreCase)) + .Where(x => !x.Key.Equals(NewCommand.Options.Version.Long, StringComparison.InvariantCultureIgnoreCase) && + !x.Key.Equals(NewCommand.Options.Version.Short, StringComparison.InvariantCultureIgnoreCase)) + .Select(x => x.Key).ToList(); + + await CliAnalyticsCollect.CollectAsync(new CliAnalyticsCollectInputDto + { + Tool = Options.ToolName, + Command = args.ExtraProperties.ContainsKey(CliConsts.Command) ? args.ExtraProperties[CliConsts.Command] : "", + DatabaseProvider = null, + IsTiered = false, + UiFramework = null, + Options = JsonSerializer.Serialize(options), + ProjectName = null, + TemplateName = args.TemplateName, + TemplateVersion = templateFile.Version + }); + + return new ProjectBuildResult(context.Result.ZipContent, args.TemplateName); + } + + private async Task GetModuleInfoAsync(ProjectBuildArgs args) + { + return await ModuleInfoProvider.GetAsync(args.TemplateName); + } + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/SourceCodeTypes.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/SourceCodeTypes.cs new file mode 100644 index 0000000000..9b2d21cc8d --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/SourceCodeTypes.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Volo.Abp.Cli.ProjectBuilding +{ + public static class SourceCodeTypes + { + public const string Template = "template"; + + public const string Module = "module"; + } +} diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs similarity index 90% rename from framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuilder.cs rename to framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs index 6c9b6fa145..1031b965e0 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ProjectBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs @@ -14,32 +14,32 @@ using Volo.Abp.Json; namespace Volo.Abp.Cli.ProjectBuilding { - public class ProjectBuilder : IProjectBuilder, ITransientDependency + public class TemplateProjectBuilder : IProjectBuilder, ITransientDependency { - public ILogger Logger { get; set; } + public ILogger Logger { get; set; } - protected ITemplateStore TemplateStore { get; } + protected ISourceCodeStore SourceCodeStore { get; } protected ITemplateInfoProvider TemplateInfoProvider { get; } protected ICliAnalyticsCollect CliAnalyticsCollect { get; } protected CliOptions Options { get; } protected IJsonSerializer JsonSerializer { get; } protected IApiKeyService ApiKeyService { get; } - public ProjectBuilder(ITemplateStore templateStore, + public TemplateProjectBuilder(ISourceCodeStore sourceCodeStore, ITemplateInfoProvider templateInfoProvider, ICliAnalyticsCollect cliAnalyticsCollect, IOptions options, IJsonSerializer jsonSerializer, IApiKeyService apiKeyService) { - TemplateStore = templateStore; + SourceCodeStore = sourceCodeStore; TemplateInfoProvider = templateInfoProvider; CliAnalyticsCollect = cliAnalyticsCollect; Options = options.Value; JsonSerializer = jsonSerializer; ApiKeyService = apiKeyService; - Logger = NullLogger.Instance; + Logger = NullLogger.Instance; } public async Task BuildAsync(ProjectBuildArgs args) @@ -48,11 +48,12 @@ namespace Volo.Abp.Cli.ProjectBuilding NormalizeArgs(args, templateInfo); - var templateFile = await TemplateStore.GetAsync( + var templateFile = await SourceCodeStore.GetAsync( args.TemplateName, + SourceCodeTypes.Template, args.Version ); - + var apiKeyResult = await ApiKeyService.GetApiKeyOrNullAsync(); if (apiKeyResult?.ApiKey != null) { @@ -66,11 +67,12 @@ namespace Volo.Abp.Cli.ProjectBuilding var context = new ProjectBuildContext( templateInfo, + null, templateFile, args ); - ProjectBuildPipelineBuilder.Build(context).Execute(); + TemplateProjectBuildPipelineBuilder.Build(context).Execute(); if (!templateInfo.DocumentUrl.IsNullOrEmpty()) { From 4e63a7b8311a53b4ad14b31f59f9112e7bf0889b Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Mon, 30 Sep 2019 09:23:33 +0300 Subject: [PATCH 02/62] removed unused using statements --- .../Volo/Abp/Cli/Commands/UpdateCommand.cs | 3 --- .../Volo/Abp/Cli/Licensing/IApiKeyService.cs | 3 +-- .../Volo/Abp/Cli/ProjectBuilding/IModuleInfoProvider.cs | 5 +---- .../Volo/Abp/Cli/ProjectBuilding/ModuleInfoProvider.cs | 1 - .../Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs | 1 - .../Volo/Abp/Cli/ProjectBuilding/SourceCodeTypes.cs | 6 +----- .../Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs | 1 - .../ProjectBuilding/Templates/Module/ModuleTemplateBase.cs | 4 +--- .../Abp/Cli/ProjectModification/EfCoreMigrationAdder.cs | 1 - .../Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs | 1 - .../Abp/Cli/ProjectModification/PackageJsonFileFinder.cs | 1 - 11 files changed, 4 insertions(+), 23 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs index aa1c1501b5..742d327c1c 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; @@ -7,13 +6,11 @@ using System.Threading.Tasks; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; -using Newtonsoft.Json; using Volo.Abp.Cli.Args; using Volo.Abp.Cli.ProjectBuilding.Analyticses; using Volo.Abp.Cli.ProjectModification; using Volo.Abp.DependencyInjection; using Volo.Abp.Json; -using Volo.Abp.Threading; namespace Volo.Abp.Cli.Commands { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/IApiKeyService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/IApiKeyService.cs index 0fb8058c61..23ff81555a 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/IApiKeyService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/IApiKeyService.cs @@ -1,5 +1,4 @@ -using System.Net; -using System.Threading.Tasks; +using System.Threading.Tasks; namespace Volo.Abp.Cli.Licensing { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/IModuleInfoProvider.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/IModuleInfoProvider.cs index 7e490a78d2..bb8d0d72cb 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/IModuleInfoProvider.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/IModuleInfoProvider.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; +using System.Threading.Tasks; using Volo.Abp.Cli.ProjectBuilding.Building; namespace Volo.Abp.Cli.ProjectBuilding diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleInfoProvider.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleInfoProvider.cs index b13cf262c9..e82d4478b7 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleInfoProvider.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleInfoProvider.cs @@ -6,7 +6,6 @@ using Volo.Abp.Json; using Volo.Abp.Cli.Http; using Volo.Abp.Cli.ProjectBuilding.Building; using Volo.Abp.DependencyInjection; -using Volo.Abp.Http; using Volo.Abp.Threading; namespace Volo.Abp.Cli.ProjectBuilding diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs index c527375a70..d7d31c81af 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs @@ -2,7 +2,6 @@ using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; using System; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Volo.Abp.Cli.Commands; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/SourceCodeTypes.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/SourceCodeTypes.cs index 9b2d21cc8d..5f7ad58ef7 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/SourceCodeTypes.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/SourceCodeTypes.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace Volo.Abp.Cli.ProjectBuilding +namespace Volo.Abp.Cli.ProjectBuilding { public static class SourceCodeTypes { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs index 1031b965e0..e1248b32f0 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs @@ -2,7 +2,6 @@ using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; using System; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Volo.Abp.Cli.Commands; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs index 2d308d9219..904ac77d87 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; +using System.Collections.Generic; using JetBrains.Annotations; using Volo.Abp.Cli.ProjectBuilding.Building; using Volo.Abp.Cli.ProjectBuilding.Building.Steps; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationAdder.cs index cc4d3f74a9..1c8727852b 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationAdder.cs @@ -1,5 +1,4 @@ using System; -using System.Diagnostics; using System.IO; using Volo.Abp.Cli.Utils; using Volo.Abp.DependencyInjection; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs index fd6f5be5d1..419b52f7fe 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NpmPackagesUpdater.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Text; using System.Threading; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackageJsonFileFinder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackageJsonFileFinder.cs index b3138e1f87..65aaf44a59 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackageJsonFileFinder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/PackageJsonFileFinder.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Text; using Volo.Abp.DependencyInjection; namespace Volo.Abp.Cli.ProjectModification From 5eb24b0f75d153c56cf70eab85d1b6ac65d1d9db Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Mon, 30 Sep 2019 09:24:50 +0300 Subject: [PATCH 03/62] Update ModuleTemplateBase.cs --- .../Templates/Module/ModuleTemplateBase.cs | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs index 904ac77d87..09b75ac0e2 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs @@ -25,22 +25,24 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.Module private void DeleteUnrelatedProjects(ProjectBuildContext context, List steps) { - if (context.BuildArgs.ExtraProperties.ContainsKey("no-ui")) + if (!context.BuildArgs.ExtraProperties.ContainsKey("no-ui")) { - steps.Add(new RemoveProjectFromSolutionStep( - "MyCompanyName.MyProjectName.Web" - )); - - steps.Add(new RemoveProjectFromSolutionStep( - "MyCompanyName.MyProjectName.Web.Host", - projectFolderPath: "/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host" - )); - - steps.Add(new RemoveProjectFromSolutionStep( - "MyCompanyName.MyProjectName.Web.Unified", - projectFolderPath: "/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified" - )); + return; } + + steps.Add(new RemoveProjectFromSolutionStep( + "MyCompanyName.MyProjectName.Web" + )); + + steps.Add(new RemoveProjectFromSolutionStep( + "MyCompanyName.MyProjectName.Web.Host", + projectFolderPath: "/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host" + )); + + steps.Add(new RemoveProjectFromSolutionStep( + "MyCompanyName.MyProjectName.Web.Unified", + projectFolderPath: "/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified" + )); } private void RandomizeSslPorts(ProjectBuildContext context, List steps) From 11e246f7e8f590c1278cb7fb19e308a51d001b45 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Wed, 9 Oct 2019 14:21:48 +0300 Subject: [PATCH 04/62] feat: remove all karma and jasmine files and install the jest --- npm/ng-packs/apps/dev-app/karma.conf.js | 32 ------------ npm/ng-packs/apps/dev-app/src/test.ts | 14 ----- npm/ng-packs/apps/dev-app/tsconfig.app.json | 52 +++++++++---------- npm/ng-packs/apps/dev-app/tsconfig.spec.json | 4 +- npm/ng-packs/package.json | 17 +++--- .../packages/account-config/karma.conf.js | 32 ------------ .../packages/account-config/src/test.ts | 21 -------- .../account-config/tsconfig.spec.json | 14 ++--- npm/ng-packs/packages/account/karma.conf.js | 32 ------------ npm/ng-packs/packages/account/src/test.ts | 21 -------- .../packages/account/tsconfig.spec.json | 14 ++--- npm/ng-packs/packages/core/karma.conf.js | 32 ------------ .../core/src/lib/services/rest.service.ts | 7 +-- .../core/src/lib/tests/config.plugin.spec.ts | 10 ++-- .../tests/dynamic-layout.component.spec.ts | 4 +- .../src/lib/tests/locale.provider.spec.ts | 2 +- .../lib/tests/localization.service.spec.ts | 2 +- .../core/src/lib/tests/rest.service.spec.ts | 22 ++++++++ .../lib/tests/router-outlet.component.spec.ts | 3 +- npm/ng-packs/packages/core/src/test.ts | 21 -------- npm/ng-packs/packages/core/tsconfig.spec.json | 10 ++-- .../packages/feature-management/karma.conf.js | 32 ------------ .../packages/feature-management/src/test.ts | 21 -------- .../feature-management/tsconfig.spec.json | 14 ++--- .../packages/identity-config/karma.conf.js | 32 ------------ .../packages/identity-config/src/test.ts | 21 -------- .../identity-config/tsconfig.spec.json | 14 ++--- npm/ng-packs/packages/identity/karma.conf.js | 32 ------------ npm/ng-packs/packages/identity/src/test.ts | 21 -------- .../packages/identity/tsconfig.spec.json | 14 ++--- .../permission-management/karma.conf.js | 32 ------------ .../permission-management/src/test.ts | 21 -------- .../permission-management/tsconfig.spec.json | 14 ++--- .../setting-management-config/karma.conf.js | 32 ------------ .../setting-management-config/src/test.ts | 21 -------- .../tsconfig.spec.json | 14 ++--- .../packages/setting-management/karma.conf.js | 32 ------------ .../packages/setting-management/src/test.ts | 21 -------- .../setting-management/tsconfig.spec.json | 14 ++--- .../tenant-management-config/karma.conf.js | 32 ------------ .../tenant-management-config/src/test.ts | 21 -------- .../tsconfig.spec.json | 14 ++--- .../packages/tenant-management/karma.conf.js | 32 ------------ .../packages/tenant-management/src/test.ts | 21 -------- .../tenant-management/tsconfig.spec.json | 14 ++--- .../packages/theme-basic/karma.conf.js | 32 ------------ npm/ng-packs/packages/theme-basic/src/test.ts | 21 -------- .../packages/theme-basic/tsconfig.spec.json | 14 ++--- .../packages/theme-shared/karma.conf.js | 32 ------------ .../src/lib/tests/button.component.spec.ts | 2 +- .../src/lib/tests/error.handler.spec.ts | 10 ++-- .../packages/theme-shared/src/test.ts | 21 -------- .../packages/theme-shared/tsconfig.spec.json | 14 ++--- npm/ng-packs/setupJest.ts | 1 + 54 files changed, 121 insertions(+), 928 deletions(-) delete mode 100644 npm/ng-packs/apps/dev-app/karma.conf.js delete mode 100644 npm/ng-packs/apps/dev-app/src/test.ts delete mode 100644 npm/ng-packs/packages/account-config/karma.conf.js delete mode 100644 npm/ng-packs/packages/account-config/src/test.ts delete mode 100644 npm/ng-packs/packages/account/karma.conf.js delete mode 100644 npm/ng-packs/packages/account/src/test.ts delete mode 100644 npm/ng-packs/packages/core/karma.conf.js create mode 100644 npm/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts delete mode 100644 npm/ng-packs/packages/core/src/test.ts delete mode 100644 npm/ng-packs/packages/feature-management/karma.conf.js delete mode 100644 npm/ng-packs/packages/feature-management/src/test.ts delete mode 100644 npm/ng-packs/packages/identity-config/karma.conf.js delete mode 100644 npm/ng-packs/packages/identity-config/src/test.ts delete mode 100644 npm/ng-packs/packages/identity/karma.conf.js delete mode 100644 npm/ng-packs/packages/identity/src/test.ts delete mode 100644 npm/ng-packs/packages/permission-management/karma.conf.js delete mode 100644 npm/ng-packs/packages/permission-management/src/test.ts delete mode 100644 npm/ng-packs/packages/setting-management-config/karma.conf.js delete mode 100644 npm/ng-packs/packages/setting-management-config/src/test.ts delete mode 100644 npm/ng-packs/packages/setting-management/karma.conf.js delete mode 100644 npm/ng-packs/packages/setting-management/src/test.ts delete mode 100644 npm/ng-packs/packages/tenant-management-config/karma.conf.js delete mode 100644 npm/ng-packs/packages/tenant-management-config/src/test.ts delete mode 100644 npm/ng-packs/packages/tenant-management/karma.conf.js delete mode 100644 npm/ng-packs/packages/tenant-management/src/test.ts delete mode 100644 npm/ng-packs/packages/theme-basic/karma.conf.js delete mode 100644 npm/ng-packs/packages/theme-basic/src/test.ts delete mode 100644 npm/ng-packs/packages/theme-shared/karma.conf.js delete mode 100644 npm/ng-packs/packages/theme-shared/src/test.ts create mode 100644 npm/ng-packs/setupJest.ts diff --git a/npm/ng-packs/apps/dev-app/karma.conf.js b/npm/ng-packs/apps/dev-app/karma.conf.js deleted file mode 100644 index 54492af159..0000000000 --- a/npm/ng-packs/apps/dev-app/karma.conf.js +++ /dev/null @@ -1,32 +0,0 @@ -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html - -module.exports = function(config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage-istanbul-reporter'), - require('@angular-devkit/build-angular/plugins/karma'), - ], - client: { - clearContext: false, // leave Jasmine Spec Runner output visible in browser - }, - coverageIstanbulReporter: { - dir: require('path').join(__dirname, '../../coverage/dev-app'), - reports: ['html', 'lcovonly', 'text-summary'], - fixWebpackSourcePaths: true, - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'], - singleRun: false, - restartOnFileChange: true, - }); -}; diff --git a/npm/ng-packs/apps/dev-app/src/test.ts b/npm/ng-packs/apps/dev-app/src/test.ts deleted file mode 100644 index da9049dc63..0000000000 --- a/npm/ng-packs/apps/dev-app/src/test.ts +++ /dev/null @@ -1,14 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -import 'zone.js/dist/zone-testing'; -import { getTestBed } from '@angular/core/testing'; -import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; - -declare const require: any; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting()); -// Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); -// And load the modules. -context.keys().map(context); diff --git a/npm/ng-packs/apps/dev-app/tsconfig.app.json b/npm/ng-packs/apps/dev-app/tsconfig.app.json index cc22d70d1c..6570e8f04a 100644 --- a/npm/ng-packs/apps/dev-app/tsconfig.app.json +++ b/npm/ng-packs/apps/dev-app/tsconfig.app.json @@ -4,32 +4,32 @@ "outDir": "../../out-tsc/app", "types": [], "paths": { - "@abp/ng.core": ["packages/core/src/public-api.ts"], - "@abp/ng.core/*": ["packages/core/src/lib/*"], - // "@abp/ng.theme.shared": ["packages/theme-shared/src/public-api.ts"], - // "@abp/ng.theme.shared/*": ["packages/theme-shared/src/lib/*"], - "@abp/ng.theme.basic": ["packages/theme-basic/src/public-api.ts"], - "@abp/ng.theme.basic/*": ["packages/theme-basic/src/lib/*"], - "@abp/ng.account": ["packages/account/src/public-api.ts"], - "@abp/ng.account/*": ["packages/account/src/lib/*"], - "@abp/ng.account.config": ["packages/account-config/src/public-api.ts"], - "@abp/ng.account.config/*": ["packages/account-config/src/lib/*"], - "@abp/ng.identity": ["packages/identity/src/public-api.ts"], - "@abp/ng.identity/*": ["packages/identity/src/lib/*"], - "@abp/ng.identity.config": ["packages/identity-config/src/public-api.ts"], - "@abp/ng.identity.config/*": ["packages/identity-config/src/lib/*"], - "@abp/ng.tenant-management": ["packages/tenant-management/src/public-api.ts"], - "@abp/ng.tenant-management/*": ["packages/tenant-management/src/lib/*"], - "@abp/ng.tenant-management.config": ["packages/tenant-management-config/src/public-api.ts"], - "@abp/ng.tenant-management.config/*": ["packages/tenant-management-config/src/lib/*"], - "@abp/ng.setting-management": ["packages/setting-management/src/public-api.ts"], - "@abp/ng.setting-management/*": ["packages/setting-management/src/lib/*"], - "@abp/ng.setting-management.config": ["packages/setting-management-config/src/public-api.ts"], - "@abp/ng.setting-management.config/*": ["packages/setting-management-config/src/lib/*"], - "@abp/ng.permission-management": ["packages/permission-management/src/public-api.ts"], - "@abp/ng.permission-management/*": ["packages/permission-management/src/lib/*"], - "@abp/ng.feature-management": ["packages/feature-management/src/public-api.ts"], - "@abp/ng.feature-management/*": ["packages/feature-management/src/lib/*"] + // "@abp/ng.core": ["packages/core/src/public-api.ts"], + // "@abp/ng.core/*": ["packages/core/src/lib/*"], + // // "@abp/ng.theme.shared": ["packages/theme-shared/src/public-api.ts"], + // // "@abp/ng.theme.shared/*": ["packages/theme-shared/src/lib/*"], + // "@abp/ng.theme.basic": ["packages/theme-basic/src/public-api.ts"], + // "@abp/ng.theme.basic/*": ["packages/theme-basic/src/lib/*"], + // "@abp/ng.account": ["packages/account/src/public-api.ts"], + // "@abp/ng.account/*": ["packages/account/src/lib/*"], + // "@abp/ng.account.config": ["packages/account-config/src/public-api.ts"], + // "@abp/ng.account.config/*": ["packages/account-config/src/lib/*"], + // "@abp/ng.identity": ["packages/identity/src/public-api.ts"], + // "@abp/ng.identity/*": ["packages/identity/src/lib/*"], + // "@abp/ng.identity.config": ["packages/identity-config/src/public-api.ts"], + // "@abp/ng.identity.config/*": ["packages/identity-config/src/lib/*"], + // "@abp/ng.tenant-management": ["packages/tenant-management/src/public-api.ts"], + // "@abp/ng.tenant-management/*": ["packages/tenant-management/src/lib/*"], + // "@abp/ng.tenant-management.config": ["packages/tenant-management-config/src/public-api.ts"], + // "@abp/ng.tenant-management.config/*": ["packages/tenant-management-config/src/lib/*"], + // "@abp/ng.setting-management": ["packages/setting-management/src/public-api.ts"], + // "@abp/ng.setting-management/*": ["packages/setting-management/src/lib/*"], + // "@abp/ng.setting-management.config": ["packages/setting-management-config/src/public-api.ts"], + // "@abp/ng.setting-management.config/*": ["packages/setting-management-config/src/lib/*"], + // "@abp/ng.permission-management": ["packages/permission-management/src/public-api.ts"], + // "@abp/ng.permission-management/*": ["packages/permission-management/src/lib/*"], + // "@abp/ng.feature-management": ["packages/feature-management/src/public-api.ts"], + // "@abp/ng.feature-management/*": ["packages/feature-management/src/lib/*"] } }, "files": ["src/main.ts", "src/polyfills.ts"], diff --git a/npm/ng-packs/apps/dev-app/tsconfig.spec.json b/npm/ng-packs/apps/dev-app/tsconfig.spec.json index 8eec07d40a..e487d98612 100644 --- a/npm/ng-packs/apps/dev-app/tsconfig.spec.json +++ b/npm/ng-packs/apps/dev-app/tsconfig.spec.json @@ -2,8 +2,8 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "../../out-tsc/spec", - "types": ["jasmine", "node"] + "types": ["node", "jest"] }, - "files": ["src/test.ts", "src/polyfills.ts"], + "files": ["src/polyfills.ts"], "include": ["src/**/*.spec.ts", "src/**/*.d.ts"] } diff --git a/npm/ng-packs/package.json b/npm/ng-packs/package.json index 5e4a254863..3eba277234 100644 --- a/npm/ng-packs/package.json +++ b/npm/ng-packs/package.json @@ -2,6 +2,7 @@ "scripts": { "start": "ng serve dev-app", "ng": "ng", + "test": "jest", "symlink": "symlink", "abpng": "abpng", "commit": "git-cz && node scripts/push.js", @@ -33,8 +34,7 @@ "@ngxs/router-plugin": "^3.5.1", "@ngxs/storage-plugin": "^3.5.1", "@ngxs/store": "^3.5.1", - "@types/jasmine": "~3.3.8", - "@types/jasminewd2": "~2.0.3", + "@types/jest": "^24.0.18", "@types/node": "~8.9.4", "angular-oauth2-oidc": "^8.0.1", "bootstrap": "^4.3.1", @@ -43,15 +43,10 @@ "cz-conventional-changelog": "3.0.2", "font-awesome": "^4.7.0", "husky": "^3.0.7", - "jasmine-core": "~3.4.0", - "jasmine-spec-reporter": "~4.2.1", + "jest": "^24.9.0", + "jest-preset-angular": "^7.1.1", "just-clone": "3.1.0", "just-compare": "^1.3.0", - "karma": "~4.1.0", - "karma-chrome-launcher": "~2.2.0", - "karma-coverage-istanbul-reporter": "~2.0.1", - "karma-jasmine": "~2.0.1", - "karma-jasmine-html-reporter": "^1.4.0", "lint-staged": "^9.4.0", "ng-packagr": "^5.5.0", "ngx-perfect-scrollbar": "^8.0.0", @@ -92,5 +87,9 @@ "tslint --fix", "git add" ] + }, + "jest": { + "preset": "jest-preset-angular", + "setupTestFrameworkScriptFile": "/setupJest.ts" } } diff --git a/npm/ng-packs/packages/account-config/karma.conf.js b/npm/ng-packs/packages/account-config/karma.conf.js deleted file mode 100644 index e74978b4ca..0000000000 --- a/npm/ng-packs/packages/account-config/karma.conf.js +++ /dev/null @@ -1,32 +0,0 @@ -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html - -module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage-istanbul-reporter'), - require('@angular-devkit/build-angular/plugins/karma') - ], - client: { - clearContext: false // leave Jasmine Spec Runner output visible in browser - }, - coverageIstanbulReporter: { - dir: require('path').join(__dirname, '../../coverage/account-config'), - reports: ['html', 'lcovonly', 'text-summary'], - fixWebpackSourcePaths: true - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'], - singleRun: false, - restartOnFileChange: true - }); -}; diff --git a/npm/ng-packs/packages/account-config/src/test.ts b/npm/ng-packs/packages/account-config/src/test.ts deleted file mode 100644 index 978c64fb83..0000000000 --- a/npm/ng-packs/packages/account-config/src/test.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -import 'zone.js/dist/zone'; -import 'zone.js/dist/zone-testing'; -import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; - -declare const require: any; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); -// Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); -// And load the modules. -context.keys().map(context); diff --git a/npm/ng-packs/packages/account-config/tsconfig.spec.json b/npm/ng-packs/packages/account-config/tsconfig.spec.json index 16da33db07..ebce9b9fdb 100644 --- a/npm/ng-packs/packages/account-config/tsconfig.spec.json +++ b/npm/ng-packs/packages/account-config/tsconfig.spec.json @@ -2,16 +2,8 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "../../out-tsc/spec", - "types": [ - "jasmine", - "node" - ] + "types": ["node", "jest"] }, - "files": [ - "src/test.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] + "files": [], + "include": ["**/*.spec.ts", "**/*.d.ts"] } diff --git a/npm/ng-packs/packages/account/karma.conf.js b/npm/ng-packs/packages/account/karma.conf.js deleted file mode 100644 index ccfa764753..0000000000 --- a/npm/ng-packs/packages/account/karma.conf.js +++ /dev/null @@ -1,32 +0,0 @@ -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html - -module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage-istanbul-reporter'), - require('@angular-devkit/build-angular/plugins/karma') - ], - client: { - clearContext: false // leave Jasmine Spec Runner output visible in browser - }, - coverageIstanbulReporter: { - dir: require('path').join(__dirname, '../../coverage/account'), - reports: ['html', 'lcovonly'], - fixWebpackSourcePaths: true - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'], - singleRun: false, - restartOnFileChange: true - }); -}; diff --git a/npm/ng-packs/packages/account/src/test.ts b/npm/ng-packs/packages/account/src/test.ts deleted file mode 100644 index 978c64fb83..0000000000 --- a/npm/ng-packs/packages/account/src/test.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -import 'zone.js/dist/zone'; -import 'zone.js/dist/zone-testing'; -import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; - -declare const require: any; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); -// Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); -// And load the modules. -context.keys().map(context); diff --git a/npm/ng-packs/packages/account/tsconfig.spec.json b/npm/ng-packs/packages/account/tsconfig.spec.json index 16da33db07..ebce9b9fdb 100644 --- a/npm/ng-packs/packages/account/tsconfig.spec.json +++ b/npm/ng-packs/packages/account/tsconfig.spec.json @@ -2,16 +2,8 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "../../out-tsc/spec", - "types": [ - "jasmine", - "node" - ] + "types": ["node", "jest"] }, - "files": [ - "src/test.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] + "files": [], + "include": ["**/*.spec.ts", "**/*.d.ts"] } diff --git a/npm/ng-packs/packages/core/karma.conf.js b/npm/ng-packs/packages/core/karma.conf.js deleted file mode 100644 index 46e0cb1d0a..0000000000 --- a/npm/ng-packs/packages/core/karma.conf.js +++ /dev/null @@ -1,32 +0,0 @@ -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html - -module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage-istanbul-reporter'), - require('@angular-devkit/build-angular/plugins/karma') - ], - client: { - clearContext: false // leave Jasmine Spec Runner output visible in browser - }, - coverageIstanbulReporter: { - dir: require('path').join(__dirname, '../../coverage/core'), - reports: ['html', 'lcovonly'], - fixWebpackSourcePaths: true - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'], - singleRun: false, - restartOnFileChange: true - }); -}; diff --git a/npm/ng-packs/packages/core/src/lib/services/rest.service.ts b/npm/ng-packs/packages/core/src/lib/services/rest.service.ts index 611b208b35..e3c99bac2c 100644 --- a/npm/ng-packs/packages/core/src/lib/services/rest.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/rest.service.ts @@ -2,7 +2,7 @@ import { HttpClient, HttpRequest } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { Store } from '@ngxs/store'; import { Observable, throwError } from 'rxjs'; -import { catchError, take } from 'rxjs/operators'; +import { catchError, take, tap } from 'rxjs/operators'; import { RestOccurError } from '../actions/rest.actions'; import { Rest } from '../models/rest'; import { ConfigState } from '../states/config.state'; @@ -21,10 +21,11 @@ export class RestService { request(request: HttpRequest | Rest.Request, config: Rest.Config = {}, api?: string): Observable { const { observe = Rest.Observe.Body, skipHandleError } = config; - const url = api || this.store.selectSnapshot(ConfigState.getApiUrl()) + request.url; + const url = (api || this.store.selectSnapshot(ConfigState.getApiUrl())) + request.url; const { method, ...options } = request; + return this.http.request(method, url, { observe, ...options } as any).pipe( - observe === Rest.Observe.Body ? take(1) : null, + observe === Rest.Observe.Body ? take(1) : tap(), catchError(err => { if (skipHandleError) { return throwError(err); diff --git a/npm/ng-packs/packages/core/src/lib/tests/config.plugin.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/config.plugin.spec.ts index 293dd4bf79..da851a5369 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/config.plugin.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/config.plugin.spec.ts @@ -1,14 +1,14 @@ import { RouterTestingModule } from '@angular/router/testing'; -import { createServiceFactory, SpectatorService } from '@ngneat/spectator'; -import { NGXS_PLUGINS, NgxsModule, InitState, Store } from '@ngxs/store'; +import { createServiceFactory, SpectatorService } from '@ngneat/spectator/jest'; +import { NgxsModule, NGXS_PLUGINS, Store } from '@ngxs/store'; import { environment } from '../../../../../apps/dev-app/src/environments/environment'; import { LAYOUTS } from '../../../../theme-basic/src/public-api'; -import { ABP } from '../models'; -import { ConfigPlugin, NGXS_CONFIG_PLUGIN_OPTIONS } from '../plugins'; import { RouterOutletComponent } from '../components'; -import { ConfigState } from '../states'; import { CoreModule } from '../core.module'; import { eLayoutType } from '../enums/common'; +import { ABP } from '../models'; +import { ConfigPlugin, NGXS_CONFIG_PLUGIN_OPTIONS } from '../plugins'; +import { ConfigState } from '../states'; import { addAbpRoutes } from '../utils'; addAbpRoutes([ diff --git a/npm/ng-packs/packages/core/src/lib/tests/dynamic-layout.component.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/dynamic-layout.component.spec.ts index bfd2762760..e752829eb2 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/dynamic-layout.component.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/dynamic-layout.component.spec.ts @@ -1,13 +1,13 @@ import { Component } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; -import { createRoutingFactory, SpectatorRouting, SpyObject } from '@ngneat/spectator'; +import { createRoutingFactory, SpectatorRouting, SpyObject } from '@ngneat/spectator/jest'; import { NgxsModule, Store } from '@ngxs/store'; import { OAuthService } from 'angular-oauth2-oidc'; import { NgxsResetPluginModule, StateOverwrite } from 'ngxs-reset-plugin'; import { LAYOUTS, ThemeBasicModule } from '../../../../theme-basic/src/public-api'; import { eLayoutType } from '../enums'; import { ABP } from '../models'; -import { RouterOutletComponent, CoreModule, DynamicLayoutComponent, ConfigState } from '@abp/ng.core'; +import { RouterOutletComponent, CoreModule, DynamicLayoutComponent, ConfigState } from '../../public-api'; import { ThemeSharedModule } from '../../../../theme-shared/src/public-api'; import { MessageService } from 'primeng/components/common/messageservice'; diff --git a/npm/ng-packs/packages/core/src/lib/tests/locale.provider.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/locale.provider.spec.ts index e82e89d4a0..3ff3516c6e 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/locale.provider.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/locale.provider.spec.ts @@ -1,5 +1,5 @@ import { Component, LOCALE_ID } from '@angular/core'; -import { createRoutingFactory, SpectatorHost, SpectatorRouting } from '@ngneat/spectator'; +import { createRoutingFactory, SpectatorHost, SpectatorRouting } from '@ngneat/spectator/jest'; import { LocalizationService } from '../services'; import { LocaleProvider, LocaleId } from '../providers'; import localesMapping from '../constants/different-locales'; diff --git a/npm/ng-packs/packages/core/src/lib/tests/localization.service.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/localization.service.spec.ts index 8c0dbebb40..7f613543d6 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/localization.service.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/localization.service.spec.ts @@ -1,5 +1,5 @@ import { Router } from '@angular/router'; -import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spectator'; +import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spectator/jest'; import { Store } from '@ngxs/store'; import { Observable, of } from 'rxjs'; import { LocalizationService } from '../services/localization.service'; diff --git a/npm/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts new file mode 100644 index 0000000000..db37d673ae --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts @@ -0,0 +1,22 @@ +import { createHttpFactory, HttpMethod, SpectatorHttp, SpyObject } from '@ngneat/spectator/jest'; +import { RestService } from '../services/rest.service'; +import { Store } from '@ngxs/store'; + +describe('HttpClient testing', () => { + let spectator: SpectatorHttp; + let store: SpyObject; + const api = 'https://abp.io'; + + const createHttp = createHttpFactory({ dataService: RestService, mocks: [Store] }); + + beforeEach(() => { + spectator = createHttp(); + store = spectator.get(Store); + store.selectSnapshot.andReturn(api); + }); + + it('should send a GET request with params', () => { + spectator.service.request({ method: HttpMethod.GET, url: '/test', params: { id: 1 } }).subscribe(); + spectator.expectOne(api + '/test?id=1', HttpMethod.GET); + }); +}); diff --git a/npm/ng-packs/packages/core/src/lib/tests/router-outlet.component.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/router-outlet.component.spec.ts index 6707432c03..b7e79b9c08 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/router-outlet.component.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/router-outlet.component.spec.ts @@ -1,4 +1,4 @@ -import { Spectator, createComponentFactory, createHostFactory } from '@ngneat/spectator'; +import { Spectator, createComponentFactory, createHostFactory } from '@ngneat/spectator/jest'; import { RouterTestingModule } from '@angular/router/testing'; import { RouterOutletComponent } from '../components/router-outlet.component'; @@ -8,7 +8,6 @@ describe('RouterOutletComponent', () => { it('should have a router-outlet element', () => { spectator = createHost(''); - console.log((spectator.debugElement.nativeElement as HTMLElement).children); expect((spectator.debugElement.nativeElement as HTMLElement).children.length).toBe(1); expect((spectator.debugElement.nativeElement as HTMLElement).children[0].tagName).toBe('ROUTER-OUTLET'); }); diff --git a/npm/ng-packs/packages/core/src/test.ts b/npm/ng-packs/packages/core/src/test.ts deleted file mode 100644 index 978c64fb83..0000000000 --- a/npm/ng-packs/packages/core/src/test.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -import 'zone.js/dist/zone'; -import 'zone.js/dist/zone-testing'; -import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; - -declare const require: any; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); -// Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); -// And load the modules. -context.keys().map(context); diff --git a/npm/ng-packs/packages/core/tsconfig.spec.json b/npm/ng-packs/packages/core/tsconfig.spec.json index b86d4b4cce..cd178e12ee 100644 --- a/npm/ng-packs/packages/core/tsconfig.spec.json +++ b/npm/ng-packs/packages/core/tsconfig.spec.json @@ -2,12 +2,10 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "../../out-tsc/spec", - "types": ["jasmine", "node"], - "paths": { - "@abp/ng.core": ["packages/core/src/public-api.ts"], - "@abp/ng.core/*": ["packages/core/src/lib/*"] - } + "types": ["node", "jest"], + "emitDecoratorMetadata": true, + "esModuleInterop": true }, - "files": ["src/test.ts"], + "files": [], "include": ["**/*.spec.ts", "**/*.d.ts"] } diff --git a/npm/ng-packs/packages/feature-management/karma.conf.js b/npm/ng-packs/packages/feature-management/karma.conf.js deleted file mode 100644 index 65f905a52e..0000000000 --- a/npm/ng-packs/packages/feature-management/karma.conf.js +++ /dev/null @@ -1,32 +0,0 @@ -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html - -module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage-istanbul-reporter'), - require('@angular-devkit/build-angular/plugins/karma') - ], - client: { - clearContext: false // leave Jasmine Spec Runner output visible in browser - }, - coverageIstanbulReporter: { - dir: require('path').join(__dirname, '../../coverage/feature-management'), - reports: ['html', 'lcovonly', 'text-summary'], - fixWebpackSourcePaths: true - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'], - singleRun: false, - restartOnFileChange: true - }); -}; diff --git a/npm/ng-packs/packages/feature-management/src/test.ts b/npm/ng-packs/packages/feature-management/src/test.ts deleted file mode 100644 index 978c64fb83..0000000000 --- a/npm/ng-packs/packages/feature-management/src/test.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -import 'zone.js/dist/zone'; -import 'zone.js/dist/zone-testing'; -import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; - -declare const require: any; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); -// Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); -// And load the modules. -context.keys().map(context); diff --git a/npm/ng-packs/packages/feature-management/tsconfig.spec.json b/npm/ng-packs/packages/feature-management/tsconfig.spec.json index 16da33db07..ebce9b9fdb 100644 --- a/npm/ng-packs/packages/feature-management/tsconfig.spec.json +++ b/npm/ng-packs/packages/feature-management/tsconfig.spec.json @@ -2,16 +2,8 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "../../out-tsc/spec", - "types": [ - "jasmine", - "node" - ] + "types": ["node", "jest"] }, - "files": [ - "src/test.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] + "files": [], + "include": ["**/*.spec.ts", "**/*.d.ts"] } diff --git a/npm/ng-packs/packages/identity-config/karma.conf.js b/npm/ng-packs/packages/identity-config/karma.conf.js deleted file mode 100644 index 47f6e498d2..0000000000 --- a/npm/ng-packs/packages/identity-config/karma.conf.js +++ /dev/null @@ -1,32 +0,0 @@ -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html - -module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage-istanbul-reporter'), - require('@angular-devkit/build-angular/plugins/karma') - ], - client: { - clearContext: false // leave Jasmine Spec Runner output visible in browser - }, - coverageIstanbulReporter: { - dir: require('path').join(__dirname, '../../coverage/identity-config'), - reports: ['html', 'lcovonly', 'text-summary'], - fixWebpackSourcePaths: true - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'], - singleRun: false, - restartOnFileChange: true - }); -}; diff --git a/npm/ng-packs/packages/identity-config/src/test.ts b/npm/ng-packs/packages/identity-config/src/test.ts deleted file mode 100644 index 978c64fb83..0000000000 --- a/npm/ng-packs/packages/identity-config/src/test.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -import 'zone.js/dist/zone'; -import 'zone.js/dist/zone-testing'; -import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; - -declare const require: any; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); -// Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); -// And load the modules. -context.keys().map(context); diff --git a/npm/ng-packs/packages/identity-config/tsconfig.spec.json b/npm/ng-packs/packages/identity-config/tsconfig.spec.json index 16da33db07..ebce9b9fdb 100644 --- a/npm/ng-packs/packages/identity-config/tsconfig.spec.json +++ b/npm/ng-packs/packages/identity-config/tsconfig.spec.json @@ -2,16 +2,8 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "../../out-tsc/spec", - "types": [ - "jasmine", - "node" - ] + "types": ["node", "jest"] }, - "files": [ - "src/test.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] + "files": [], + "include": ["**/*.spec.ts", "**/*.d.ts"] } diff --git a/npm/ng-packs/packages/identity/karma.conf.js b/npm/ng-packs/packages/identity/karma.conf.js deleted file mode 100644 index 96fe6c9293..0000000000 --- a/npm/ng-packs/packages/identity/karma.conf.js +++ /dev/null @@ -1,32 +0,0 @@ -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html - -module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage-istanbul-reporter'), - require('@angular-devkit/build-angular/plugins/karma') - ], - client: { - clearContext: false // leave Jasmine Spec Runner output visible in browser - }, - coverageIstanbulReporter: { - dir: require('path').join(__dirname, '../../coverage/identity'), - reports: ['html', 'lcovonly'], - fixWebpackSourcePaths: true - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'], - singleRun: false, - restartOnFileChange: true - }); -}; diff --git a/npm/ng-packs/packages/identity/src/test.ts b/npm/ng-packs/packages/identity/src/test.ts deleted file mode 100644 index 978c64fb83..0000000000 --- a/npm/ng-packs/packages/identity/src/test.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -import 'zone.js/dist/zone'; -import 'zone.js/dist/zone-testing'; -import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; - -declare const require: any; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); -// Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); -// And load the modules. -context.keys().map(context); diff --git a/npm/ng-packs/packages/identity/tsconfig.spec.json b/npm/ng-packs/packages/identity/tsconfig.spec.json index 16da33db07..ebce9b9fdb 100644 --- a/npm/ng-packs/packages/identity/tsconfig.spec.json +++ b/npm/ng-packs/packages/identity/tsconfig.spec.json @@ -2,16 +2,8 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "../../out-tsc/spec", - "types": [ - "jasmine", - "node" - ] + "types": ["node", "jest"] }, - "files": [ - "src/test.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] + "files": [], + "include": ["**/*.spec.ts", "**/*.d.ts"] } diff --git a/npm/ng-packs/packages/permission-management/karma.conf.js b/npm/ng-packs/packages/permission-management/karma.conf.js deleted file mode 100644 index 9bbd5907ef..0000000000 --- a/npm/ng-packs/packages/permission-management/karma.conf.js +++ /dev/null @@ -1,32 +0,0 @@ -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html - -module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage-istanbul-reporter'), - require('@angular-devkit/build-angular/plugins/karma') - ], - client: { - clearContext: false // leave Jasmine Spec Runner output visible in browser - }, - coverageIstanbulReporter: { - dir: require('path').join(__dirname, '../../coverage/permission-management'), - reports: ['html', 'lcovonly'], - fixWebpackSourcePaths: true - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'], - singleRun: false, - restartOnFileChange: true - }); -}; diff --git a/npm/ng-packs/packages/permission-management/src/test.ts b/npm/ng-packs/packages/permission-management/src/test.ts deleted file mode 100644 index 978c64fb83..0000000000 --- a/npm/ng-packs/packages/permission-management/src/test.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -import 'zone.js/dist/zone'; -import 'zone.js/dist/zone-testing'; -import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; - -declare const require: any; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); -// Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); -// And load the modules. -context.keys().map(context); diff --git a/npm/ng-packs/packages/permission-management/tsconfig.spec.json b/npm/ng-packs/packages/permission-management/tsconfig.spec.json index 16da33db07..ebce9b9fdb 100644 --- a/npm/ng-packs/packages/permission-management/tsconfig.spec.json +++ b/npm/ng-packs/packages/permission-management/tsconfig.spec.json @@ -2,16 +2,8 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "../../out-tsc/spec", - "types": [ - "jasmine", - "node" - ] + "types": ["node", "jest"] }, - "files": [ - "src/test.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] + "files": [], + "include": ["**/*.spec.ts", "**/*.d.ts"] } diff --git a/npm/ng-packs/packages/setting-management-config/karma.conf.js b/npm/ng-packs/packages/setting-management-config/karma.conf.js deleted file mode 100644 index 7ff4863cb0..0000000000 --- a/npm/ng-packs/packages/setting-management-config/karma.conf.js +++ /dev/null @@ -1,32 +0,0 @@ -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html - -module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage-istanbul-reporter'), - require('@angular-devkit/build-angular/plugins/karma') - ], - client: { - clearContext: false // leave Jasmine Spec Runner output visible in browser - }, - coverageIstanbulReporter: { - dir: require('path').join(__dirname, '../../coverage/setting-management-config'), - reports: ['html', 'lcovonly', 'text-summary'], - fixWebpackSourcePaths: true - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'], - singleRun: false, - restartOnFileChange: true - }); -}; diff --git a/npm/ng-packs/packages/setting-management-config/src/test.ts b/npm/ng-packs/packages/setting-management-config/src/test.ts deleted file mode 100644 index 978c64fb83..0000000000 --- a/npm/ng-packs/packages/setting-management-config/src/test.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -import 'zone.js/dist/zone'; -import 'zone.js/dist/zone-testing'; -import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; - -declare const require: any; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); -// Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); -// And load the modules. -context.keys().map(context); diff --git a/npm/ng-packs/packages/setting-management-config/tsconfig.spec.json b/npm/ng-packs/packages/setting-management-config/tsconfig.spec.json index 16da33db07..ebce9b9fdb 100644 --- a/npm/ng-packs/packages/setting-management-config/tsconfig.spec.json +++ b/npm/ng-packs/packages/setting-management-config/tsconfig.spec.json @@ -2,16 +2,8 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "../../out-tsc/spec", - "types": [ - "jasmine", - "node" - ] + "types": ["node", "jest"] }, - "files": [ - "src/test.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] + "files": [], + "include": ["**/*.spec.ts", "**/*.d.ts"] } diff --git a/npm/ng-packs/packages/setting-management/karma.conf.js b/npm/ng-packs/packages/setting-management/karma.conf.js deleted file mode 100644 index 51ccc0578d..0000000000 --- a/npm/ng-packs/packages/setting-management/karma.conf.js +++ /dev/null @@ -1,32 +0,0 @@ -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html - -module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage-istanbul-reporter'), - require('@angular-devkit/build-angular/plugins/karma') - ], - client: { - clearContext: false // leave Jasmine Spec Runner output visible in browser - }, - coverageIstanbulReporter: { - dir: require('path').join(__dirname, '../../coverage/setting-management'), - reports: ['html', 'lcovonly', 'text-summary'], - fixWebpackSourcePaths: true - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'], - singleRun: false, - restartOnFileChange: true - }); -}; diff --git a/npm/ng-packs/packages/setting-management/src/test.ts b/npm/ng-packs/packages/setting-management/src/test.ts deleted file mode 100644 index 978c64fb83..0000000000 --- a/npm/ng-packs/packages/setting-management/src/test.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -import 'zone.js/dist/zone'; -import 'zone.js/dist/zone-testing'; -import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; - -declare const require: any; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); -// Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); -// And load the modules. -context.keys().map(context); diff --git a/npm/ng-packs/packages/setting-management/tsconfig.spec.json b/npm/ng-packs/packages/setting-management/tsconfig.spec.json index 16da33db07..ebce9b9fdb 100644 --- a/npm/ng-packs/packages/setting-management/tsconfig.spec.json +++ b/npm/ng-packs/packages/setting-management/tsconfig.spec.json @@ -2,16 +2,8 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "../../out-tsc/spec", - "types": [ - "jasmine", - "node" - ] + "types": ["node", "jest"] }, - "files": [ - "src/test.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] + "files": [], + "include": ["**/*.spec.ts", "**/*.d.ts"] } diff --git a/npm/ng-packs/packages/tenant-management-config/karma.conf.js b/npm/ng-packs/packages/tenant-management-config/karma.conf.js deleted file mode 100644 index 850929cc06..0000000000 --- a/npm/ng-packs/packages/tenant-management-config/karma.conf.js +++ /dev/null @@ -1,32 +0,0 @@ -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html - -module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage-istanbul-reporter'), - require('@angular-devkit/build-angular/plugins/karma') - ], - client: { - clearContext: false // leave Jasmine Spec Runner output visible in browser - }, - coverageIstanbulReporter: { - dir: require('path').join(__dirname, '../../coverage/tenant-management-config'), - reports: ['html', 'lcovonly', 'text-summary'], - fixWebpackSourcePaths: true - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'], - singleRun: false, - restartOnFileChange: true - }); -}; diff --git a/npm/ng-packs/packages/tenant-management-config/src/test.ts b/npm/ng-packs/packages/tenant-management-config/src/test.ts deleted file mode 100644 index 978c64fb83..0000000000 --- a/npm/ng-packs/packages/tenant-management-config/src/test.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -import 'zone.js/dist/zone'; -import 'zone.js/dist/zone-testing'; -import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; - -declare const require: any; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); -// Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); -// And load the modules. -context.keys().map(context); diff --git a/npm/ng-packs/packages/tenant-management-config/tsconfig.spec.json b/npm/ng-packs/packages/tenant-management-config/tsconfig.spec.json index 16da33db07..ebce9b9fdb 100644 --- a/npm/ng-packs/packages/tenant-management-config/tsconfig.spec.json +++ b/npm/ng-packs/packages/tenant-management-config/tsconfig.spec.json @@ -2,16 +2,8 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "../../out-tsc/spec", - "types": [ - "jasmine", - "node" - ] + "types": ["node", "jest"] }, - "files": [ - "src/test.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] + "files": [], + "include": ["**/*.spec.ts", "**/*.d.ts"] } diff --git a/npm/ng-packs/packages/tenant-management/karma.conf.js b/npm/ng-packs/packages/tenant-management/karma.conf.js deleted file mode 100644 index eb6cfa24b4..0000000000 --- a/npm/ng-packs/packages/tenant-management/karma.conf.js +++ /dev/null @@ -1,32 +0,0 @@ -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html - -module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage-istanbul-reporter'), - require('@angular-devkit/build-angular/plugins/karma') - ], - client: { - clearContext: false // leave Jasmine Spec Runner output visible in browser - }, - coverageIstanbulReporter: { - dir: require('path').join(__dirname, '../../coverage/tenant-management'), - reports: ['html', 'lcovonly', 'text-summary'], - fixWebpackSourcePaths: true - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'], - singleRun: false, - restartOnFileChange: true - }); -}; diff --git a/npm/ng-packs/packages/tenant-management/src/test.ts b/npm/ng-packs/packages/tenant-management/src/test.ts deleted file mode 100644 index 978c64fb83..0000000000 --- a/npm/ng-packs/packages/tenant-management/src/test.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -import 'zone.js/dist/zone'; -import 'zone.js/dist/zone-testing'; -import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; - -declare const require: any; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); -// Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); -// And load the modules. -context.keys().map(context); diff --git a/npm/ng-packs/packages/tenant-management/tsconfig.spec.json b/npm/ng-packs/packages/tenant-management/tsconfig.spec.json index 16da33db07..ebce9b9fdb 100644 --- a/npm/ng-packs/packages/tenant-management/tsconfig.spec.json +++ b/npm/ng-packs/packages/tenant-management/tsconfig.spec.json @@ -2,16 +2,8 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "../../out-tsc/spec", - "types": [ - "jasmine", - "node" - ] + "types": ["node", "jest"] }, - "files": [ - "src/test.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] + "files": [], + "include": ["**/*.spec.ts", "**/*.d.ts"] } diff --git a/npm/ng-packs/packages/theme-basic/karma.conf.js b/npm/ng-packs/packages/theme-basic/karma.conf.js deleted file mode 100644 index e04be0a193..0000000000 --- a/npm/ng-packs/packages/theme-basic/karma.conf.js +++ /dev/null @@ -1,32 +0,0 @@ -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html - -module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage-istanbul-reporter'), - require('@angular-devkit/build-angular/plugins/karma') - ], - client: { - clearContext: false // leave Jasmine Spec Runner output visible in browser - }, - coverageIstanbulReporter: { - dir: require('path').join(__dirname, '../../coverage/theme-basic'), - reports: ['html', 'lcovonly'], - fixWebpackSourcePaths: true - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'], - singleRun: false, - restartOnFileChange: true - }); -}; diff --git a/npm/ng-packs/packages/theme-basic/src/test.ts b/npm/ng-packs/packages/theme-basic/src/test.ts deleted file mode 100644 index 978c64fb83..0000000000 --- a/npm/ng-packs/packages/theme-basic/src/test.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -import 'zone.js/dist/zone'; -import 'zone.js/dist/zone-testing'; -import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; - -declare const require: any; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); -// Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); -// And load the modules. -context.keys().map(context); diff --git a/npm/ng-packs/packages/theme-basic/tsconfig.spec.json b/npm/ng-packs/packages/theme-basic/tsconfig.spec.json index 16da33db07..ebce9b9fdb 100644 --- a/npm/ng-packs/packages/theme-basic/tsconfig.spec.json +++ b/npm/ng-packs/packages/theme-basic/tsconfig.spec.json @@ -2,16 +2,8 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "../../out-tsc/spec", - "types": [ - "jasmine", - "node" - ] + "types": ["node", "jest"] }, - "files": [ - "src/test.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] + "files": [], + "include": ["**/*.spec.ts", "**/*.d.ts"] } diff --git a/npm/ng-packs/packages/theme-shared/karma.conf.js b/npm/ng-packs/packages/theme-shared/karma.conf.js deleted file mode 100644 index 5703b124a6..0000000000 --- a/npm/ng-packs/packages/theme-shared/karma.conf.js +++ /dev/null @@ -1,32 +0,0 @@ -// Karma configuration file, see link for more information -// https://karma-runner.github.io/1.0/config/configuration-file.html - -module.exports = function(config) { - config.set({ - basePath: '', - frameworks: ['jasmine', '@angular-devkit/build-angular'], - plugins: [ - require('karma-jasmine'), - require('karma-chrome-launcher'), - require('karma-jasmine-html-reporter'), - require('karma-coverage-istanbul-reporter'), - require('@angular-devkit/build-angular/plugins/karma'), - ], - client: { - clearContext: false, // leave Jasmine Spec Runner output visible in browser - }, - coverageIstanbulReporter: { - dir: require('path').join(__dirname, '../../coverage/theme-shared'), - reports: ['html', 'lcovonly'], - fixWebpackSourcePaths: true, - }, - reporters: ['progress', 'kjhtml'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: true, - browsers: ['Chrome'], - singleRun: false, - restartOnFileChange: true, - }); -}; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tests/button.component.spec.ts b/npm/ng-packs/packages/theme-shared/src/lib/tests/button.component.spec.ts index 67526e271f..59d49e68c4 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/tests/button.component.spec.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/tests/button.component.spec.ts @@ -1,4 +1,4 @@ -import { createHostFactory, SpectatorHost } from '@ngneat/spectator'; +import { createHostFactory, SpectatorHost } from '@ngneat/spectator/jest'; import { ButtonComponent } from '../components'; describe('ButtonComponent', () => { diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tests/error.handler.spec.ts b/npm/ng-packs/packages/theme-shared/src/lib/tests/error.handler.spec.ts index f64b7d73e2..764197f1e3 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/tests/error.handler.spec.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/tests/error.handler.spec.ts @@ -2,7 +2,7 @@ import { CoreModule, RestOccurError, RouterOutletComponent } from '@abp/ng.core' import { Location } from '@angular/common'; import { HttpErrorResponse, HttpHeaders } from '@angular/common/http'; import { Component } from '@angular/core'; -import { createRoutingFactory, SpectatorRouting } from '@ngneat/spectator'; +import { createRoutingFactory, SpectatorRouting } from '@ngneat/spectator/jest'; import { NgxsModule, Store } from '@ngxs/store'; import { DEFAULT_ERROR_MESSAGES, ErrorHandler } from '../handlers'; import { ThemeSharedModule } from '../theme-shared.module'; @@ -35,7 +35,9 @@ describe('ErrorHandler', () => { store.dispatch(new RestOccurError(new HttpErrorResponse({ status: 500 }))); spectator.detectChanges(); expect(document.querySelector('.error-template')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultError500.title); - expect(document.querySelector('.error-details')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultError500.details); + expect(document.querySelector('.error-details')).toHaveText( + DEFAULT_ERROR_MESSAGES.defaultError500.details.defaultValue, + ); }); it('should display the error component when authorize error occurs', () => { @@ -49,7 +51,9 @@ describe('ErrorHandler', () => { store.dispatch(new RestOccurError(new HttpErrorResponse({ status: 0, statusText: 'Unknown Error' }))); spectator.detectChanges(); expect(document.querySelector('.error-template')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultErrorUnknown.title); - expect(document.querySelector('.error-details')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultErrorUnknown.details); + expect(document.querySelector('.error-details')).toHaveText( + DEFAULT_ERROR_MESSAGES.defaultErrorUnknown.details.defaultValue, + ); }); it('should display the confirmation when not found error occurs', () => { diff --git a/npm/ng-packs/packages/theme-shared/src/test.ts b/npm/ng-packs/packages/theme-shared/src/test.ts deleted file mode 100644 index 978c64fb83..0000000000 --- a/npm/ng-packs/packages/theme-shared/src/test.ts +++ /dev/null @@ -1,21 +0,0 @@ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - -import 'zone.js/dist/zone'; -import 'zone.js/dist/zone-testing'; -import { getTestBed } from '@angular/core/testing'; -import { - BrowserDynamicTestingModule, - platformBrowserDynamicTesting -} from '@angular/platform-browser-dynamic/testing'; - -declare const require: any; - -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment( - BrowserDynamicTestingModule, - platformBrowserDynamicTesting() -); -// Then we find all the tests. -const context = require.context('./', true, /\.spec\.ts$/); -// And load the modules. -context.keys().map(context); diff --git a/npm/ng-packs/packages/theme-shared/tsconfig.spec.json b/npm/ng-packs/packages/theme-shared/tsconfig.spec.json index 16da33db07..ebce9b9fdb 100644 --- a/npm/ng-packs/packages/theme-shared/tsconfig.spec.json +++ b/npm/ng-packs/packages/theme-shared/tsconfig.spec.json @@ -2,16 +2,8 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "../../out-tsc/spec", - "types": [ - "jasmine", - "node" - ] + "types": ["node", "jest"] }, - "files": [ - "src/test.ts" - ], - "include": [ - "**/*.spec.ts", - "**/*.d.ts" - ] + "files": [], + "include": ["**/*.spec.ts", "**/*.d.ts"] } diff --git a/npm/ng-packs/setupJest.ts b/npm/ng-packs/setupJest.ts new file mode 100644 index 0000000000..8d88704e8f --- /dev/null +++ b/npm/ng-packs/setupJest.ts @@ -0,0 +1 @@ +import 'jest-preset-angular'; From 7a14ea2bf32d34c8cff110c85e78e4c2951cb965 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Wed, 9 Oct 2019 14:39:29 +0300 Subject: [PATCH 05/62] feat: remove e2e --- npm/ng-packs/angular.json | 18 +---------- .../apps/dev-app/e2e/protractor.conf.js | 30 ------------------- .../apps/dev-app/e2e/src/app.e2e-spec.ts | 28 ----------------- npm/ng-packs/apps/dev-app/e2e/src/app.po.ts | 11 ------- npm/ng-packs/apps/dev-app/e2e/tsconfig.json | 9 ------ 5 files changed, 1 insertion(+), 95 deletions(-) delete mode 100644 npm/ng-packs/apps/dev-app/e2e/protractor.conf.js delete mode 100644 npm/ng-packs/apps/dev-app/e2e/src/app.e2e-spec.ts delete mode 100644 npm/ng-packs/apps/dev-app/e2e/src/app.po.ts delete mode 100644 npm/ng-packs/apps/dev-app/e2e/tsconfig.json diff --git a/npm/ng-packs/angular.json b/npm/ng-packs/angular.json index a06c34c90e..0a7736ac8d 100644 --- a/npm/ng-packs/angular.json +++ b/npm/ng-packs/angular.json @@ -532,25 +532,9 @@ "lint": { "builder": "@angular-devkit/build-angular:tslint", "options": { - "tsConfig": [ - "apps/dev-app/tsconfig.app.json", - "apps/dev-app/tsconfig.spec.json", - "apps/dev-app/e2e/tsconfig.json" - ], + "tsConfig": ["apps/dev-app/tsconfig.app.json", "apps/dev-app/tsconfig.spec.json"], "exclude": ["**/node_modules/**"] } - }, - "e2e": { - "builder": "@angular-devkit/build-angular:protractor", - "options": { - "protractorConfig": "apps/dev-app/e2e/protractor.conf.js", - "devServerTarget": "dev-app:serve" - }, - "configurations": { - "production": { - "devServerTarget": "dev-app:serve:production" - } - } } } } diff --git a/npm/ng-packs/apps/dev-app/e2e/protractor.conf.js b/npm/ng-packs/apps/dev-app/e2e/protractor.conf.js deleted file mode 100644 index 5c23d8477d..0000000000 --- a/npm/ng-packs/apps/dev-app/e2e/protractor.conf.js +++ /dev/null @@ -1,30 +0,0 @@ -// @ts-check -// Protractor configuration file, see link for more information -// https://github.com/angular/protractor/blob/master/lib/config.ts - -const { SpecReporter } = require('jasmine-spec-reporter'); - -/** - * @type { import("protractor").Config } - */ -exports.config = { - allScriptsTimeout: 11000, - specs: ['./src/**/*.e2e-spec.ts'], - capabilities: { - browserName: 'chrome', - }, - directConnect: true, - baseUrl: 'http://localhost:4200/', - framework: 'jasmine', - jasmineNodeOpts: { - showColors: true, - defaultTimeoutInterval: 30000, - print: function() {}, - }, - onPrepare() { - require('ts-node').register({ - project: require('path').join(__dirname, './tsconfig.json'), - }); - jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); - }, -}; diff --git a/npm/ng-packs/apps/dev-app/e2e/src/app.e2e-spec.ts b/npm/ng-packs/apps/dev-app/e2e/src/app.e2e-spec.ts deleted file mode 100644 index 96edba0042..0000000000 --- a/npm/ng-packs/apps/dev-app/e2e/src/app.e2e-spec.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { AppPage } from './app.po'; -import { browser, logging } from 'protractor'; - -describe('workspace-project App', () => { - let page: AppPage; - - beforeEach(() => { - page = new AppPage(); - }); - - it('should display welcome message', () => { - page.navigateTo(); - expect(page.getTitleText()).toEqual('dev-app app is running!'); - }); - - afterEach(async () => { - // Assert that there are no errors emitted from the browser - const logs = await browser - .manage() - .logs() - .get(logging.Type.BROWSER); - expect(logs).not.toContain( - jasmine.objectContaining({ - level: logging.Level.SEVERE, - } as logging.Entry), - ); - }); -}); diff --git a/npm/ng-packs/apps/dev-app/e2e/src/app.po.ts b/npm/ng-packs/apps/dev-app/e2e/src/app.po.ts deleted file mode 100644 index b8498c26f2..0000000000 --- a/npm/ng-packs/apps/dev-app/e2e/src/app.po.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { browser, by, element } from 'protractor'; - -export class AppPage { - navigateTo() { - return browser.get(browser.baseUrl) as Promise; - } - - getTitleText() { - return element(by.css('app-root .content span')).getText() as Promise; - } -} diff --git a/npm/ng-packs/apps/dev-app/e2e/tsconfig.json b/npm/ng-packs/apps/dev-app/e2e/tsconfig.json deleted file mode 100644 index 201351434e..0000000000 --- a/npm/ng-packs/apps/dev-app/e2e/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../../tsconfig.json", - "compilerOptions": { - "outDir": "../../../out-tsc/e2e", - "module": "commonjs", - "target": "es5", - "types": ["jasmine", "jasminewd2", "node"] - } -} From 450dcd981dca48d77d7c729a00abd8336c80cb0c Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 10 Oct 2019 10:51:09 +0800 Subject: [PATCH 06/62] Update identity server migration. --- .../20191010023719_Initial.Designer.cs} | 908 +++++++++++++----- ...3_Initial.cs => 20191010023719_Initial.cs} | 58 +- ...ardDemoMigrationsDbContextModelSnapshot.cs | 797 ++++++++++----- .../20191010024505_Initial.Designer.cs | 874 ++++++++++------- ...6_Initial.cs => 20191010024505_Initial.cs} | 58 +- .../AuthServerDbContextModelSnapshot.cs | 728 +++++++++----- .../20191010024652_Initial.Designer.cs} | 857 ++++++++++++----- ...2_Initial.cs => 20191010024652_Initial.cs} | 55 +- ...ectNameMigrationsDbContextModelSnapshot.cs | 104 +- .../20191010024800_Initial.Designer.cs | 845 ++++++++++------ ...9_Initial.cs => 20191010024800_Initial.cs} | 58 +- ...verHostMigrationsDbContextModelSnapshot.cs | 767 ++++++++++----- 12 files changed, 4107 insertions(+), 2002 deletions(-) rename samples/{MicroserviceDemo/applications/AuthServer.Host/Migrations/20190816095916_Initial.Designer.cs => DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20191010023719_Initial.Designer.cs} (50%) rename samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/{20190816095643_Initial.cs => 20191010023719_Initial.cs} (96%) rename templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190918061142_Initial.Designer.cs => samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20191010024505_Initial.Designer.cs (56%) rename samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/{20190816095916_Initial.cs => 20191010024505_Initial.cs} (96%) rename templates/{module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20190816093449_Initial.Designer.cs => app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20191010024652_Initial.Designer.cs} (53%) rename templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/{20190918061142_Initial.cs => 20191010024652_Initial.cs} (96%) rename samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20190816095643_Initial.Designer.cs => templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20191010024800_Initial.Designer.cs (56%) rename templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/{20190816093449_Initial.cs => 20191010024800_Initial.cs} (96%) diff --git a/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20190816095916_Initial.Designer.cs b/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20191010023719_Initial.Designer.cs similarity index 50% rename from samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20190816095916_Initial.Designer.cs rename to samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20191010023719_Initial.Designer.cs index 45555c790b..134a658f25 100644 --- a/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20190816095916_Initial.Designer.cs +++ b/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20191010023719_Initial.Designer.cs @@ -1,100 +1,122 @@ // using System; -using AuthServer.Host.EntityFrameworkCore; +using DashboardDemo.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -namespace AuthServer.Host.Migrations +namespace DashboardDemo.Migrations { - [DbContext(typeof(AuthServerDbContext))] - [Migration("20190816095916_Initial")] + [DbContext(typeof(DashboardDemoMigrationsDbContext))] + [Migration("20191010023719_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.2.6-servicing-10079") + .HasAnnotation("ProductVersion", "3.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ApplicationName") .HasColumnName("ApplicationName") + .HasColumnType("nvarchar(96)") .HasMaxLength(96); b.Property("BrowserInfo") .HasColumnName("BrowserInfo") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("ClientId") .HasColumnName("ClientId") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ClientIpAddress") .HasColumnName("ClientIpAddress") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ClientName") .HasColumnName("ClientName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("Comments") .HasColumnName("Comments") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("ConcurrencyStamp"); + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CorrelationId") .HasColumnName("CorrelationId") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Exceptions") .HasColumnName("Exceptions") + .HasColumnType("nvarchar(4000)") .HasMaxLength(4000); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration"); + .HasColumnName("ExecutionDuration") + .HasColumnType("int"); - b.Property("ExecutionTime"); + b.Property("ExecutionTime") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("HttpMethod") .HasColumnName("HttpMethod") + .HasColumnType("nvarchar(16)") .HasMaxLength(16); b.Property("HttpStatusCode") - .HasColumnName("HttpStatusCode"); + .HasColumnName("HttpStatusCode") + .HasColumnType("int"); b.Property("ImpersonatorTenantId") - .HasColumnName("ImpersonatorTenantId"); + .HasColumnName("ImpersonatorTenantId") + .HasColumnType("uniqueidentifier"); b.Property("ImpersonatorUserId") - .HasColumnName("ImpersonatorUserId"); + .HasColumnName("ImpersonatorUserId") + .HasColumnType("uniqueidentifier"); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantName"); + b.Property("TenantName") + .HasColumnType("nvarchar(max)"); b.Property("Url") .HasColumnName("Url") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("UserId") - .HasColumnName("UserId"); + .HasColumnName("UserId") + .HasColumnType("uniqueidentifier"); b.Property("UserName") .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -109,33 +131,42 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId"); + .HasColumnName("AuditLogId") + .HasColumnType("uniqueidentifier"); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration"); + .HasColumnName("ExecutionDuration") + .HasColumnType("int"); b.Property("ExecutionTime") - .HasColumnName("ExecutionTime"); + .HasColumnName("ExecutionTime") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("MethodName") .HasColumnName("MethodName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("Parameters") .HasColumnName("Parameters") + .HasColumnType("nvarchar(2000)") .HasMaxLength(2000); b.Property("ServiceName") .HasColumnName("ServiceName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -149,34 +180,43 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId"); + .HasColumnName("AuditLogId") + .HasColumnType("uniqueidentifier"); b.Property("ChangeTime") - .HasColumnName("ChangeTime"); + .HasColumnName("ChangeTime") + .HasColumnType("datetime2"); b.Property("ChangeType") - .HasColumnName("ChangeType"); + .HasColumnName("ChangeType") + .HasColumnType("tinyint"); b.Property("EntityId") .IsRequired() .HasColumnName("EntityId") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("EntityTenantId"); + b.Property("EntityTenantId") + .HasColumnType("uniqueidentifier"); b.Property("EntityTypeFullName") .IsRequired() .HasColumnName("EntityTypeFullName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -190,29 +230,36 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); - b.Property("EntityChangeId"); + b.Property("EntityChangeId") + .HasColumnType("uniqueidentifier"); b.Property("NewValue") .HasColumnName("NewValue") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("OriginalValue") .HasColumnName("OriginalValue") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("PropertyName") .IsRequired() .HasColumnName("PropertyName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("PropertyTypeFullName") .IsRequired() .HasColumnName("PropertyTypeFullName") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -221,38 +268,134 @@ namespace AuthServer.Host.Migrations b.ToTable("AbpEntityPropertyChanges"); }); + modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsAbandoned") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("JobArgs") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(1048576); + + b.Property("JobName") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("LastTryTime") + .HasColumnType("datetime2"); + + b.Property("NextTryTime") + .HasColumnType("datetime2"); + + b.Property("Priority") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint") + .HasDefaultValue((byte)15); + + b.Property("TryCount") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((short)0); + + b.HasKey("Id"); + + b.HasIndex("IsAbandoned", "NextTryTime"); + + b.ToTable("AbpBackgroundJobs"); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("ProviderKey") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ProviderName") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpFeatureValues"); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .IsRequired() .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Description") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("IsStatic"); + b.Property("IsStatic") + .HasColumnType("bit"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Regex") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("RegexDescription") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ValueType"); + b.Property("ValueType") + .HasColumnType("int"); b.HasKey("Id"); @@ -262,35 +405,44 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .IsRequired() .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDefault") - .HasColumnName("IsDefault"); + .HasColumnName("IsDefault") + .HasColumnType("bit"); b.Property("IsPublic") - .HasColumnName("IsPublic"); + .HasColumnName("IsPublic") + .HasColumnType("bit"); b.Property("IsStatic") - .HasColumnName("IsStatic"); + .HasColumnName("IsStatic") + .HasColumnType("bit"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedName") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -302,18 +454,22 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("uniqueidentifier"); b.Property("ClaimType") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -325,105 +481,131 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AccessFailedCount") .ValueGeneratedOnAdd() .HasColumnName("AccessFailedCount") + .HasColumnType("int") .HasDefaultValue(0); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Email") .HasColumnName("Email") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("EmailConfirmed") .ValueGeneratedOnAdd() .HasColumnName("EmailConfirmed") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnName("LockoutEnabled") + .HasColumnType("bit") .HasDefaultValue(false); - b.Property("LockoutEnd"); + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); b.Property("Name") .HasColumnName("Name") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("NormalizedEmail") .HasColumnName("NormalizedEmail") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedUserName") .IsRequired() .HasColumnName("NormalizedUserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("PasswordHash") .HasColumnName("PasswordHash") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("PhoneNumber") .HasColumnName("PhoneNumber") + .HasColumnType("nvarchar(16)") .HasMaxLength(16); b.Property("PhoneNumberConfirmed") .ValueGeneratedOnAdd() .HasColumnName("PhoneNumberConfirmed") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("SecurityStamp") .IsRequired() .HasColumnName("SecurityStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Surname") .HasColumnName("Surname") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); b.Property("TwoFactorEnabled") .ValueGeneratedOnAdd() .HasColumnName("TwoFactorEnabled") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("UserName") .IsRequired() .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -442,18 +624,22 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("uniqueidentifier"); b.Property("ClaimType") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -464,19 +650,24 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") .IsRequired() + .HasColumnType("nvarchar(196)") .HasMaxLength(196); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("UserId", "LoginProvider"); @@ -487,11 +678,14 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("UserId", "RoleId"); @@ -502,17 +696,22 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Name") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("Value"); + b.Property("Value") + .HasColumnType("nvarchar(max)"); b.HasKey("UserId", "LoginProvider", "Name"); @@ -522,51 +721,66 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Description") + .HasColumnType("nvarchar(1000)") .HasMaxLength(1000); b.Property("DisplayName") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Properties"); + b.Property("Properties") + .HasColumnType("nvarchar(max)"); b.HasKey("Id"); @@ -575,10 +789,12 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ApiResourceId", "Type"); @@ -587,22 +803,29 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Name") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("Description") - .HasMaxLength(256); + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); b.Property("DisplayName") - .HasMaxLength(128); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); - b.Property("Emphasize"); + b.Property("Emphasize") + .HasColumnType("bit"); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ShowInDiscoveryDocument"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); b.HasKey("ApiResourceId", "Name"); @@ -611,13 +834,16 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Name") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("Type") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ApiResourceId", "Name", "Type"); @@ -626,18 +852,23 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(32); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") - .HasMaxLength(196); + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); b.Property("Description") - .HasMaxLength(256); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.HasKey("ApiResourceId", "Type", "Value"); @@ -647,141 +878,190 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); - b.Property("AbsoluteRefreshTokenLifetime"); + b.Property("AbsoluteRefreshTokenLifetime") + .HasColumnType("int"); - b.Property("AccessTokenLifetime"); + b.Property("AccessTokenLifetime") + .HasColumnType("int"); - b.Property("AccessTokenType"); + b.Property("AccessTokenType") + .HasColumnType("int"); - b.Property("AllowAccessTokensViaBrowser"); + b.Property("AllowAccessTokensViaBrowser") + .HasColumnType("bit"); - b.Property("AllowOfflineAccess"); + b.Property("AllowOfflineAccess") + .HasColumnType("bit"); - b.Property("AllowPlainTextPkce"); + b.Property("AllowPlainTextPkce") + .HasColumnType("bit"); - b.Property("AllowRememberConsent"); + b.Property("AllowRememberConsent") + .HasColumnType("bit"); - b.Property("AlwaysIncludeUserClaimsInIdToken"); + b.Property("AlwaysIncludeUserClaimsInIdToken") + .HasColumnType("bit"); - b.Property("AlwaysSendClientClaims"); + b.Property("AlwaysSendClientClaims") + .HasColumnType("bit"); - b.Property("AuthorizationCodeLifetime"); + b.Property("AuthorizationCodeLifetime") + .HasColumnType("int"); - b.Property("BackChannelLogoutSessionRequired"); + b.Property("BackChannelLogoutSessionRequired") + .HasColumnType("bit"); b.Property("BackChannelLogoutUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("ClientClaimsPrefix") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientName") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); - b.Property("ConsentLifetime"); + b.Property("ConsentLifetime") + .HasColumnType("int"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Description") + .HasColumnType("nvarchar(1000)") .HasMaxLength(1000); - b.Property("DeviceCodeLifetime"); + b.Property("DeviceCodeLifetime") + .HasColumnType("int"); - b.Property("EnableLocalLogin"); + b.Property("EnableLocalLogin") + .HasColumnType("bit"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("FrontChannelLogoutSessionRequired"); + b.Property("FrontChannelLogoutSessionRequired") + .HasColumnType("bit"); b.Property("FrontChannelLogoutUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); - b.Property("IdentityTokenLifetime"); + b.Property("IdentityTokenLifetime") + .HasColumnType("int"); - b.Property("IncludeJwtId"); + b.Property("IncludeJwtId") + .HasColumnType("bit"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("LogoUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("PairWiseSubjectSalt") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ProtocolType") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("RefreshTokenExpiration"); + b.Property("RefreshTokenExpiration") + .HasColumnType("int"); - b.Property("RefreshTokenUsage"); + b.Property("RefreshTokenUsage") + .HasColumnType("int"); - b.Property("RequireClientSecret"); + b.Property("RequireClientSecret") + .HasColumnType("bit"); - b.Property("RequireConsent"); + b.Property("RequireConsent") + .HasColumnType("bit"); - b.Property("RequirePkce"); + b.Property("RequirePkce") + .HasColumnType("bit"); - b.Property("SlidingRefreshTokenLifetime"); + b.Property("SlidingRefreshTokenLifetime") + .HasColumnType("int"); - b.Property("UpdateAccessTokenClaimsOnRefresh"); + b.Property("UpdateAccessTokenClaimsOnRefresh") + .HasColumnType("bit"); b.Property("UserCodeType") + .HasColumnType("nvarchar(100)") .HasMaxLength(100); - b.Property("UserSsoLifetime"); + b.Property("UserSsoLifetime") + .HasColumnType("int"); b.HasKey("Id"); - b.HasIndex("ClientId") - .IsUnique(); + b.HasIndex("ClientId"); b.ToTable("IdentityServerClients"); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Type") + .HasColumnType("nvarchar(250)") .HasMaxLength(250); b.Property("Value") + .HasColumnType("nvarchar(250)") .HasMaxLength(250); b.HasKey("ClientId", "Type", "Value"); @@ -791,9 +1071,11 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Origin") + .HasColumnType("nvarchar(150)") .HasMaxLength(150); b.HasKey("ClientId", "Origin"); @@ -803,10 +1085,12 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("GrantType") - .HasMaxLength(196); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.HasKey("ClientId", "GrantType"); @@ -815,10 +1099,12 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Provider") - .HasMaxLength(64); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ClientId", "Provider"); @@ -827,10 +1113,12 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("PostLogoutRedirectUri") - .HasMaxLength(200); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "PostLogoutRedirectUri"); @@ -839,14 +1127,17 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Key") - .HasMaxLength(64); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") .IsRequired() - .HasMaxLength(128); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "Key"); @@ -855,10 +1146,12 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("RedirectUri") - .HasMaxLength(200); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "RedirectUri"); @@ -867,10 +1160,12 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Scope") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ClientId", "Scope"); @@ -879,18 +1174,23 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(32); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") - .HasMaxLength(196); + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); b.Property("Description") - .HasMaxLength(256); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.HasKey("ClientId", "Type", "Value"); @@ -900,35 +1200,48 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("ConcurrencyStamp"); + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("datetime2"); b.Property("Data") - .IsRequired(); + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(5000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("Id"); + b.Property("Id") + .HasColumnType("uniqueidentifier"); b.Property("SubjectId") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("Type") .IsRequired() + .HasColumnType("nvarchar(50)") .HasMaxLength(50); b.HasKey("Key"); + b.HasIndex("Expiration"); + b.HasIndex("SubjectId", "ClientId", "Type"); b.ToTable("IdentityServerPersistedGrants"); @@ -936,10 +1249,12 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => { - b.Property("IdentityResourceId"); + b.Property("IdentityResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("IdentityResourceId", "Type"); @@ -949,57 +1264,75 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Description") + .HasColumnType("nvarchar(1000)") .HasMaxLength(1000); b.Property("DisplayName") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Emphasize"); + b.Property("Emphasize") + .HasColumnType("bit"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Properties"); + b.Property("Properties") + .HasColumnType("nvarchar(max)"); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ShowInDiscoveryDocument"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); b.HasKey("Id"); @@ -1009,21 +1342,26 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderName") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -1035,20 +1373,25 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderName") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Value") .IsRequired() + .HasColumnType("nvarchar(2048)") .HasMaxLength(2048); b.HasKey("Id"); @@ -1058,185 +1401,294 @@ namespace AuthServer.Host.Migrations b.ToTable("AbpSettings"); }); + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.HasKey("Id"); + + b.HasIndex("Name") + .IsUnique(); + + b.ToTable("AbpTenants"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(1024)") + .HasMaxLength(1024); + + b.HasKey("TenantId", "Name"); + + b.ToTable("AbpTenantConnectionStrings"); + }); + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => { - b.HasOne("Volo.Abp.AuditLogging.AuditLog") + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) .WithMany("Actions") .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => { - b.HasOne("Volo.Abp.AuditLogging.AuditLog") + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) .WithMany("EntityChanges") .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => { - b.HasOne("Volo.Abp.AuditLogging.EntityChange") + b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) .WithMany("PropertyChanges") .HasForeignKey("EntityChangeId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => { - b.HasOne("Volo.Abp.Identity.IdentityRole") + b.HasOne("Volo.Abp.Identity.IdentityRole", null) .WithMany("Claims") .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Claims") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Logins") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { - b.HasOne("Volo.Abp.Identity.IdentityRole") + b.HasOne("Volo.Abp.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Roles") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Tokens") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("UserClaims") .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("Scopes") .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope", null) .WithMany("UserClaims") .HasForeignKey("ApiResourceId", "Name") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("Secrets") .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("Claims") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("AllowedCorsOrigins") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("AllowedGrantTypes") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("IdentityProviderRestrictions") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("PostLogoutRedirectUris") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("Properties") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("RedirectUris") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("AllowedScopes") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("ClientSecrets") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource") + b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) .WithMany("UserClaims") .HasForeignKey("IdentityResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.HasOne("Volo.Abp.TenantManagement.Tenant", null) + .WithMany("ConnectionStrings") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); #pragma warning restore 612, 618 } diff --git a/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20190816095643_Initial.cs b/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20191010023719_Initial.cs similarity index 96% rename from samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20190816095643_Initial.cs rename to samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20191010023719_Initial.cs index 991da6ff2f..fc139d6f52 100644 --- a/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20190816095643_Initial.cs +++ b/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20191010023719_Initial.cs @@ -243,8 +243,8 @@ namespace DashboardDemo.Migrations ClientId = table.Column(maxLength: 200, nullable: false), ClientName = table.Column(maxLength: 200, nullable: true), Description = table.Column(maxLength: 1000, nullable: true), - ClientUri = table.Column(maxLength: 300, nullable: true), - LogoUri = table.Column(maxLength: 300, nullable: true), + ClientUri = table.Column(maxLength: 2000, nullable: true), + LogoUri = table.Column(maxLength: 2000, nullable: true), Enabled = table.Column(nullable: false), ProtocolType = table.Column(maxLength: 200, nullable: false), RequireClientSecret = table.Column(nullable: false), @@ -254,9 +254,9 @@ namespace DashboardDemo.Migrations RequirePkce = table.Column(nullable: false), AllowPlainTextPkce = table.Column(nullable: false), AllowAccessTokensViaBrowser = table.Column(nullable: false), - FrontChannelLogoutUri = table.Column(maxLength: 300, nullable: true), + FrontChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), FrontChannelLogoutSessionRequired = table.Column(nullable: false), - BackChannelLogoutUri = table.Column(maxLength: 300, nullable: true), + BackChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), BackChannelLogoutSessionRequired = table.Column(nullable: false), AllowOfflineAccess = table.Column(nullable: false), IdentityTokenLifetime = table.Column(nullable: false), @@ -324,7 +324,7 @@ namespace DashboardDemo.Migrations ClientId = table.Column(maxLength: 200, nullable: false), CreationTime = table.Column(nullable: false), Expiration = table.Column(nullable: true), - Data = table.Column(nullable: false) + Data = table.Column(maxLength: 5000, nullable: false) }, constraints: table => { @@ -513,7 +513,7 @@ namespace DashboardDemo.Migrations name: "IdentityServerApiClaims", columns: table => new { - Type = table.Column(maxLength: 196, nullable: false), + Type = table.Column(maxLength: 200, nullable: false), ApiResourceId = table.Column(nullable: false) }, constraints: table => @@ -532,9 +532,9 @@ namespace DashboardDemo.Migrations columns: table => new { ApiResourceId = table.Column(nullable: false), - Name = table.Column(maxLength: 196, nullable: false), - DisplayName = table.Column(maxLength: 128, nullable: true), - Description = table.Column(maxLength: 256, nullable: true), + Name = table.Column(maxLength: 200, nullable: false), + DisplayName = table.Column(maxLength: 200, nullable: true), + Description = table.Column(maxLength: 1000, nullable: true), Required = table.Column(nullable: false), Emphasize = table.Column(nullable: false), ShowInDiscoveryDocument = table.Column(nullable: false) @@ -554,10 +554,10 @@ namespace DashboardDemo.Migrations name: "IdentityServerApiSecrets", columns: table => new { - Type = table.Column(maxLength: 32, nullable: false), - Value = table.Column(maxLength: 196, nullable: false), + Type = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 4000, nullable: false), ApiResourceId = table.Column(nullable: false), - Description = table.Column(maxLength: 256, nullable: true), + Description = table.Column(maxLength: 2000, nullable: true), Expiration = table.Column(nullable: true) }, constraints: table => @@ -613,7 +613,7 @@ namespace DashboardDemo.Migrations columns: table => new { ClientId = table.Column(nullable: false), - GrantType = table.Column(maxLength: 196, nullable: false) + GrantType = table.Column(maxLength: 250, nullable: false) }, constraints: table => { @@ -631,7 +631,7 @@ namespace DashboardDemo.Migrations columns: table => new { ClientId = table.Column(nullable: false), - Provider = table.Column(maxLength: 64, nullable: false) + Provider = table.Column(maxLength: 200, nullable: false) }, constraints: table => { @@ -649,7 +649,7 @@ namespace DashboardDemo.Migrations columns: table => new { ClientId = table.Column(nullable: false), - PostLogoutRedirectUri = table.Column(maxLength: 200, nullable: false) + PostLogoutRedirectUri = table.Column(maxLength: 2000, nullable: false) }, constraints: table => { @@ -667,8 +667,8 @@ namespace DashboardDemo.Migrations columns: table => new { ClientId = table.Column(nullable: false), - Key = table.Column(maxLength: 64, nullable: false), - Value = table.Column(maxLength: 128, nullable: false) + Key = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 2000, nullable: false) }, constraints: table => { @@ -686,7 +686,7 @@ namespace DashboardDemo.Migrations columns: table => new { ClientId = table.Column(nullable: false), - RedirectUri = table.Column(maxLength: 200, nullable: false) + RedirectUri = table.Column(maxLength: 2000, nullable: false) }, constraints: table => { @@ -704,7 +704,7 @@ namespace DashboardDemo.Migrations columns: table => new { ClientId = table.Column(nullable: false), - Scope = table.Column(maxLength: 196, nullable: false) + Scope = table.Column(maxLength: 200, nullable: false) }, constraints: table => { @@ -721,10 +721,10 @@ namespace DashboardDemo.Migrations name: "IdentityServerClientSecrets", columns: table => new { - Type = table.Column(maxLength: 32, nullable: false), - Value = table.Column(maxLength: 196, nullable: false), + Type = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 4000, nullable: false), ClientId = table.Column(nullable: false), - Description = table.Column(maxLength: 256, nullable: true), + Description = table.Column(maxLength: 2000, nullable: true), Expiration = table.Column(nullable: true) }, constraints: table => @@ -742,7 +742,7 @@ namespace DashboardDemo.Migrations name: "IdentityServerIdentityClaims", columns: table => new { - Type = table.Column(maxLength: 196, nullable: false), + Type = table.Column(maxLength: 200, nullable: false), IdentityResourceId = table.Column(nullable: false) }, constraints: table => @@ -783,9 +783,9 @@ namespace DashboardDemo.Migrations name: "IdentityServerApiScopeClaims", columns: table => new { - Type = table.Column(maxLength: 196, nullable: false), + Type = table.Column(maxLength: 200, nullable: false), ApiResourceId = table.Column(nullable: false), - Name = table.Column(maxLength: 196, nullable: false) + Name = table.Column(maxLength: 200, nullable: false) }, constraints: table => { @@ -907,8 +907,12 @@ namespace DashboardDemo.Migrations migrationBuilder.CreateIndex( name: "IX_IdentityServerClients_ClientId", table: "IdentityServerClients", - column: "ClientId", - unique: true); + column: "ClientId"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerPersistedGrants_Expiration", + table: "IdentityServerPersistedGrants", + column: "Expiration"); migrationBuilder.CreateIndex( name: "IX_IdentityServerPersistedGrants_SubjectId_ClientId_Type", diff --git a/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/DashboardDemoMigrationsDbContextModelSnapshot.cs b/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/DashboardDemoMigrationsDbContextModelSnapshot.cs index 8c3b06d1c2..6ec438f8dd 100644 --- a/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/DashboardDemoMigrationsDbContextModelSnapshot.cs +++ b/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/DashboardDemoMigrationsDbContextModelSnapshot.cs @@ -15,84 +15,106 @@ namespace DashboardDemo.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.2.6-servicing-10079") + .HasAnnotation("ProductVersion", "3.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ApplicationName") .HasColumnName("ApplicationName") + .HasColumnType("nvarchar(96)") .HasMaxLength(96); b.Property("BrowserInfo") .HasColumnName("BrowserInfo") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("ClientId") .HasColumnName("ClientId") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ClientIpAddress") .HasColumnName("ClientIpAddress") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ClientName") .HasColumnName("ClientName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("Comments") .HasColumnName("Comments") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("ConcurrencyStamp"); + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CorrelationId") .HasColumnName("CorrelationId") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Exceptions") .HasColumnName("Exceptions") + .HasColumnType("nvarchar(4000)") .HasMaxLength(4000); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration"); + .HasColumnName("ExecutionDuration") + .HasColumnType("int"); - b.Property("ExecutionTime"); + b.Property("ExecutionTime") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("HttpMethod") .HasColumnName("HttpMethod") + .HasColumnType("nvarchar(16)") .HasMaxLength(16); b.Property("HttpStatusCode") - .HasColumnName("HttpStatusCode"); + .HasColumnName("HttpStatusCode") + .HasColumnType("int"); b.Property("ImpersonatorTenantId") - .HasColumnName("ImpersonatorTenantId"); + .HasColumnName("ImpersonatorTenantId") + .HasColumnType("uniqueidentifier"); b.Property("ImpersonatorUserId") - .HasColumnName("ImpersonatorUserId"); + .HasColumnName("ImpersonatorUserId") + .HasColumnType("uniqueidentifier"); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantName"); + b.Property("TenantName") + .HasColumnType("nvarchar(max)"); b.Property("Url") .HasColumnName("Url") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("UserId") - .HasColumnName("UserId"); + .HasColumnName("UserId") + .HasColumnType("uniqueidentifier"); b.Property("UserName") .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -107,33 +129,42 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId"); + .HasColumnName("AuditLogId") + .HasColumnType("uniqueidentifier"); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration"); + .HasColumnName("ExecutionDuration") + .HasColumnType("int"); b.Property("ExecutionTime") - .HasColumnName("ExecutionTime"); + .HasColumnName("ExecutionTime") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("MethodName") .HasColumnName("MethodName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("Parameters") .HasColumnName("Parameters") + .HasColumnType("nvarchar(2000)") .HasMaxLength(2000); b.Property("ServiceName") .HasColumnName("ServiceName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -147,34 +178,43 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId"); + .HasColumnName("AuditLogId") + .HasColumnType("uniqueidentifier"); b.Property("ChangeTime") - .HasColumnName("ChangeTime"); + .HasColumnName("ChangeTime") + .HasColumnType("datetime2"); b.Property("ChangeType") - .HasColumnName("ChangeType"); + .HasColumnName("ChangeType") + .HasColumnType("tinyint"); b.Property("EntityId") .IsRequired() .HasColumnName("EntityId") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("EntityTenantId"); + b.Property("EntityTenantId") + .HasColumnType("uniqueidentifier"); b.Property("EntityTypeFullName") .IsRequired() .HasColumnName("EntityTypeFullName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -188,29 +228,36 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); - b.Property("EntityChangeId"); + b.Property("EntityChangeId") + .HasColumnType("uniqueidentifier"); b.Property("NewValue") .HasColumnName("NewValue") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("OriginalValue") .HasColumnName("OriginalValue") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("PropertyName") .IsRequired() .HasColumnName("PropertyName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("PropertyTypeFullName") .IsRequired() .HasColumnName("PropertyTypeFullName") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -222,38 +269,49 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); - b.Property("ConcurrencyStamp"); + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsAbandoned") .ValueGeneratedOnAdd() + .HasColumnType("bit") .HasDefaultValue(false); b.Property("JobArgs") .IsRequired() + .HasColumnType("nvarchar(max)") .HasMaxLength(1048576); b.Property("JobName") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("LastTryTime"); + b.Property("LastTryTime") + .HasColumnType("datetime2"); - b.Property("NextTryTime"); + b.Property("NextTryTime") + .HasColumnType("datetime2"); b.Property("Priority") .ValueGeneratedOnAdd() + .HasColumnType("tinyint") .HasDefaultValue((byte)15); b.Property("TryCount") .ValueGeneratedOnAdd() + .HasColumnType("smallint") .HasDefaultValue((short)0); b.HasKey("Id"); @@ -266,20 +324,25 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderName") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Value") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.HasKey("Id"); @@ -292,35 +355,45 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .IsRequired() .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Description") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("IsStatic"); + b.Property("IsStatic") + .HasColumnType("bit"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Regex") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("RegexDescription") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ValueType"); + b.Property("ValueType") + .HasColumnType("int"); b.HasKey("Id"); @@ -330,35 +403,44 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .IsRequired() .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDefault") - .HasColumnName("IsDefault"); + .HasColumnName("IsDefault") + .HasColumnType("bit"); b.Property("IsPublic") - .HasColumnName("IsPublic"); + .HasColumnName("IsPublic") + .HasColumnType("bit"); b.Property("IsStatic") - .HasColumnName("IsStatic"); + .HasColumnName("IsStatic") + .HasColumnType("bit"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedName") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -370,18 +452,22 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("uniqueidentifier"); b.Property("ClaimType") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -393,105 +479,131 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AccessFailedCount") .ValueGeneratedOnAdd() .HasColumnName("AccessFailedCount") + .HasColumnType("int") .HasDefaultValue(0); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Email") .HasColumnName("Email") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("EmailConfirmed") .ValueGeneratedOnAdd() .HasColumnName("EmailConfirmed") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnName("LockoutEnabled") + .HasColumnType("bit") .HasDefaultValue(false); - b.Property("LockoutEnd"); + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); b.Property("Name") .HasColumnName("Name") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("NormalizedEmail") .HasColumnName("NormalizedEmail") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedUserName") .IsRequired() .HasColumnName("NormalizedUserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("PasswordHash") .HasColumnName("PasswordHash") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("PhoneNumber") .HasColumnName("PhoneNumber") + .HasColumnType("nvarchar(16)") .HasMaxLength(16); b.Property("PhoneNumberConfirmed") .ValueGeneratedOnAdd() .HasColumnName("PhoneNumberConfirmed") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("SecurityStamp") .IsRequired() .HasColumnName("SecurityStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Surname") .HasColumnName("Surname") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); b.Property("TwoFactorEnabled") .ValueGeneratedOnAdd() .HasColumnName("TwoFactorEnabled") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("UserName") .IsRequired() .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -510,18 +622,22 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("uniqueidentifier"); b.Property("ClaimType") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -532,19 +648,24 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") .IsRequired() + .HasColumnType("nvarchar(196)") .HasMaxLength(196); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("UserId", "LoginProvider"); @@ -555,11 +676,14 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("UserId", "RoleId"); @@ -570,17 +694,22 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Name") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("Value"); + b.Property("Value") + .HasColumnType("nvarchar(max)"); b.HasKey("UserId", "LoginProvider", "Name"); @@ -590,51 +719,66 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Description") + .HasColumnType("nvarchar(1000)") .HasMaxLength(1000); b.Property("DisplayName") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Properties"); + b.Property("Properties") + .HasColumnType("nvarchar(max)"); b.HasKey("Id"); @@ -643,10 +787,12 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ApiResourceId", "Type"); @@ -655,22 +801,29 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Name") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("Description") - .HasMaxLength(256); + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); b.Property("DisplayName") - .HasMaxLength(128); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); - b.Property("Emphasize"); + b.Property("Emphasize") + .HasColumnType("bit"); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ShowInDiscoveryDocument"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); b.HasKey("ApiResourceId", "Name"); @@ -679,13 +832,16 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Name") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("Type") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ApiResourceId", "Name", "Type"); @@ -694,18 +850,23 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(32); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") - .HasMaxLength(196); + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); b.Property("Description") - .HasMaxLength(256); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.HasKey("ApiResourceId", "Type", "Value"); @@ -715,141 +876,190 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); - b.Property("AbsoluteRefreshTokenLifetime"); + b.Property("AbsoluteRefreshTokenLifetime") + .HasColumnType("int"); - b.Property("AccessTokenLifetime"); + b.Property("AccessTokenLifetime") + .HasColumnType("int"); - b.Property("AccessTokenType"); + b.Property("AccessTokenType") + .HasColumnType("int"); - b.Property("AllowAccessTokensViaBrowser"); + b.Property("AllowAccessTokensViaBrowser") + .HasColumnType("bit"); - b.Property("AllowOfflineAccess"); + b.Property("AllowOfflineAccess") + .HasColumnType("bit"); - b.Property("AllowPlainTextPkce"); + b.Property("AllowPlainTextPkce") + .HasColumnType("bit"); - b.Property("AllowRememberConsent"); + b.Property("AllowRememberConsent") + .HasColumnType("bit"); - b.Property("AlwaysIncludeUserClaimsInIdToken"); + b.Property("AlwaysIncludeUserClaimsInIdToken") + .HasColumnType("bit"); - b.Property("AlwaysSendClientClaims"); + b.Property("AlwaysSendClientClaims") + .HasColumnType("bit"); - b.Property("AuthorizationCodeLifetime"); + b.Property("AuthorizationCodeLifetime") + .HasColumnType("int"); - b.Property("BackChannelLogoutSessionRequired"); + b.Property("BackChannelLogoutSessionRequired") + .HasColumnType("bit"); b.Property("BackChannelLogoutUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("ClientClaimsPrefix") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientName") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); - b.Property("ConsentLifetime"); + b.Property("ConsentLifetime") + .HasColumnType("int"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Description") + .HasColumnType("nvarchar(1000)") .HasMaxLength(1000); - b.Property("DeviceCodeLifetime"); + b.Property("DeviceCodeLifetime") + .HasColumnType("int"); - b.Property("EnableLocalLogin"); + b.Property("EnableLocalLogin") + .HasColumnType("bit"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("FrontChannelLogoutSessionRequired"); + b.Property("FrontChannelLogoutSessionRequired") + .HasColumnType("bit"); b.Property("FrontChannelLogoutUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); - b.Property("IdentityTokenLifetime"); + b.Property("IdentityTokenLifetime") + .HasColumnType("int"); - b.Property("IncludeJwtId"); + b.Property("IncludeJwtId") + .HasColumnType("bit"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("LogoUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("PairWiseSubjectSalt") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ProtocolType") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("RefreshTokenExpiration"); + b.Property("RefreshTokenExpiration") + .HasColumnType("int"); - b.Property("RefreshTokenUsage"); + b.Property("RefreshTokenUsage") + .HasColumnType("int"); - b.Property("RequireClientSecret"); + b.Property("RequireClientSecret") + .HasColumnType("bit"); - b.Property("RequireConsent"); + b.Property("RequireConsent") + .HasColumnType("bit"); - b.Property("RequirePkce"); + b.Property("RequirePkce") + .HasColumnType("bit"); - b.Property("SlidingRefreshTokenLifetime"); + b.Property("SlidingRefreshTokenLifetime") + .HasColumnType("int"); - b.Property("UpdateAccessTokenClaimsOnRefresh"); + b.Property("UpdateAccessTokenClaimsOnRefresh") + .HasColumnType("bit"); b.Property("UserCodeType") + .HasColumnType("nvarchar(100)") .HasMaxLength(100); - b.Property("UserSsoLifetime"); + b.Property("UserSsoLifetime") + .HasColumnType("int"); b.HasKey("Id"); - b.HasIndex("ClientId") - .IsUnique(); + b.HasIndex("ClientId"); b.ToTable("IdentityServerClients"); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Type") + .HasColumnType("nvarchar(250)") .HasMaxLength(250); b.Property("Value") + .HasColumnType("nvarchar(250)") .HasMaxLength(250); b.HasKey("ClientId", "Type", "Value"); @@ -859,9 +1069,11 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Origin") + .HasColumnType("nvarchar(150)") .HasMaxLength(150); b.HasKey("ClientId", "Origin"); @@ -871,10 +1083,12 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("GrantType") - .HasMaxLength(196); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.HasKey("ClientId", "GrantType"); @@ -883,10 +1097,12 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Provider") - .HasMaxLength(64); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ClientId", "Provider"); @@ -895,10 +1111,12 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("PostLogoutRedirectUri") - .HasMaxLength(200); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "PostLogoutRedirectUri"); @@ -907,14 +1125,17 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Key") - .HasMaxLength(64); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") .IsRequired() - .HasMaxLength(128); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "Key"); @@ -923,10 +1144,12 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("RedirectUri") - .HasMaxLength(200); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "RedirectUri"); @@ -935,10 +1158,12 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Scope") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ClientId", "Scope"); @@ -947,18 +1172,23 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(32); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") - .HasMaxLength(196); + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); b.Property("Description") - .HasMaxLength(256); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.HasKey("ClientId", "Type", "Value"); @@ -968,35 +1198,48 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("ConcurrencyStamp"); + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("datetime2"); b.Property("Data") - .IsRequired(); + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(5000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("Id"); + b.Property("Id") + .HasColumnType("uniqueidentifier"); b.Property("SubjectId") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("Type") .IsRequired() + .HasColumnType("nvarchar(50)") .HasMaxLength(50); b.HasKey("Key"); + b.HasIndex("Expiration"); + b.HasIndex("SubjectId", "ClientId", "Type"); b.ToTable("IdentityServerPersistedGrants"); @@ -1004,10 +1247,12 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => { - b.Property("IdentityResourceId"); + b.Property("IdentityResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("IdentityResourceId", "Type"); @@ -1017,57 +1262,75 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Description") + .HasColumnType("nvarchar(1000)") .HasMaxLength(1000); b.Property("DisplayName") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Emphasize"); + b.Property("Emphasize") + .HasColumnType("bit"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Properties"); + b.Property("Properties") + .HasColumnType("nvarchar(max)"); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ShowInDiscoveryDocument"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); b.HasKey("Id"); @@ -1077,21 +1340,26 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderName") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -1103,20 +1371,25 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderName") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Value") .IsRequired() + .HasColumnType("nvarchar(2048)") .HasMaxLength(2048); b.HasKey("Id"); @@ -1129,40 +1402,51 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.HasKey("Id"); @@ -1175,13 +1459,16 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => { - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.Property("Name") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Value") .IsRequired() + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); b.HasKey("TenantId", "Name"); @@ -1191,191 +1478,215 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => { - b.HasOne("Volo.Abp.AuditLogging.AuditLog") + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) .WithMany("Actions") .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => { - b.HasOne("Volo.Abp.AuditLogging.AuditLog") + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) .WithMany("EntityChanges") .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => { - b.HasOne("Volo.Abp.AuditLogging.EntityChange") + b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) .WithMany("PropertyChanges") .HasForeignKey("EntityChangeId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => { - b.HasOne("Volo.Abp.Identity.IdentityRole") + b.HasOne("Volo.Abp.Identity.IdentityRole", null) .WithMany("Claims") .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Claims") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Logins") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { - b.HasOne("Volo.Abp.Identity.IdentityRole") + b.HasOne("Volo.Abp.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Roles") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Tokens") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("UserClaims") .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("Scopes") .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope", null) .WithMany("UserClaims") .HasForeignKey("ApiResourceId", "Name") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("Secrets") .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("Claims") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("AllowedCorsOrigins") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("AllowedGrantTypes") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("IdentityProviderRestrictions") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("PostLogoutRedirectUris") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("Properties") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("RedirectUris") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("AllowedScopes") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("ClientSecrets") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource") + b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) .WithMany("UserClaims") .HasForeignKey("IdentityResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => { - b.HasOne("Volo.Abp.TenantManagement.Tenant") + b.HasOne("Volo.Abp.TenantManagement.Tenant", null) .WithMany("ConnectionStrings") .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); #pragma warning restore 612, 618 } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190918061142_Initial.Designer.cs b/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20191010024505_Initial.Designer.cs similarity index 56% rename from templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190918061142_Initial.Designer.cs rename to samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20191010024505_Initial.Designer.cs index 2827fc559d..ea39239edb 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190918061142_Initial.Designer.cs +++ b/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20191010024505_Initial.Designer.cs @@ -1,100 +1,122 @@ // using System; +using AuthServer.Host.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyCompanyName.MyProjectName.EntityFrameworkCore; -namespace MyCompanyName.MyProjectName.Migrations +namespace AuthServer.Host.Migrations { - [DbContext(typeof(MyProjectNameMigrationsDbContext))] - [Migration("20190918061142_Initial")] + [DbContext(typeof(AuthServerDbContext))] + [Migration("20191010024505_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.2.6-servicing-10079") + .HasAnnotation("ProductVersion", "3.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ApplicationName") .HasColumnName("ApplicationName") + .HasColumnType("nvarchar(96)") .HasMaxLength(96); b.Property("BrowserInfo") .HasColumnName("BrowserInfo") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("ClientId") .HasColumnName("ClientId") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ClientIpAddress") .HasColumnName("ClientIpAddress") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ClientName") .HasColumnName("ClientName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("Comments") .HasColumnName("Comments") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("ConcurrencyStamp"); + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CorrelationId") .HasColumnName("CorrelationId") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Exceptions") .HasColumnName("Exceptions") + .HasColumnType("nvarchar(4000)") .HasMaxLength(4000); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration"); + .HasColumnName("ExecutionDuration") + .HasColumnType("int"); - b.Property("ExecutionTime"); + b.Property("ExecutionTime") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("HttpMethod") .HasColumnName("HttpMethod") + .HasColumnType("nvarchar(16)") .HasMaxLength(16); b.Property("HttpStatusCode") - .HasColumnName("HttpStatusCode"); + .HasColumnName("HttpStatusCode") + .HasColumnType("int"); b.Property("ImpersonatorTenantId") - .HasColumnName("ImpersonatorTenantId"); + .HasColumnName("ImpersonatorTenantId") + .HasColumnType("uniqueidentifier"); b.Property("ImpersonatorUserId") - .HasColumnName("ImpersonatorUserId"); + .HasColumnName("ImpersonatorUserId") + .HasColumnType("uniqueidentifier"); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantName"); + b.Property("TenantName") + .HasColumnType("nvarchar(max)"); b.Property("Url") .HasColumnName("Url") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("UserId") - .HasColumnName("UserId"); + .HasColumnName("UserId") + .HasColumnType("uniqueidentifier"); b.Property("UserName") .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -109,33 +131,42 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId"); + .HasColumnName("AuditLogId") + .HasColumnType("uniqueidentifier"); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration"); + .HasColumnName("ExecutionDuration") + .HasColumnType("int"); b.Property("ExecutionTime") - .HasColumnName("ExecutionTime"); + .HasColumnName("ExecutionTime") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("MethodName") .HasColumnName("MethodName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("Parameters") .HasColumnName("Parameters") + .HasColumnType("nvarchar(2000)") .HasMaxLength(2000); b.Property("ServiceName") .HasColumnName("ServiceName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -149,34 +180,43 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId"); + .HasColumnName("AuditLogId") + .HasColumnType("uniqueidentifier"); b.Property("ChangeTime") - .HasColumnName("ChangeTime"); + .HasColumnName("ChangeTime") + .HasColumnType("datetime2"); b.Property("ChangeType") - .HasColumnName("ChangeType"); + .HasColumnName("ChangeType") + .HasColumnType("tinyint"); b.Property("EntityId") .IsRequired() .HasColumnName("EntityId") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("EntityTenantId"); + b.Property("EntityTenantId") + .HasColumnType("uniqueidentifier"); b.Property("EntityTypeFullName") .IsRequired() .HasColumnName("EntityTypeFullName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -190,29 +230,36 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); - b.Property("EntityChangeId"); + b.Property("EntityChangeId") + .HasColumnType("uniqueidentifier"); b.Property("NewValue") .HasColumnName("NewValue") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("OriginalValue") .HasColumnName("OriginalValue") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("PropertyName") .IsRequired() .HasColumnName("PropertyName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("PropertyTypeFullName") .IsRequired() .HasColumnName("PropertyTypeFullName") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -221,108 +268,48 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpEntityPropertyChanges"); }); - modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ConcurrencyStamp"); - - b.Property("CreationTime") - .HasColumnName("CreationTime"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); - - b.Property("IsAbandoned") - .ValueGeneratedOnAdd() - .HasDefaultValue(false); - - b.Property("JobArgs") - .IsRequired() - .HasMaxLength(1048576); - - b.Property("JobName") - .IsRequired() - .HasMaxLength(128); - - b.Property("LastTryTime"); - - b.Property("NextTryTime"); - - b.Property("Priority") - .ValueGeneratedOnAdd() - .HasDefaultValue((byte)15); - - b.Property("TryCount") - .ValueGeneratedOnAdd() - .HasDefaultValue((short)0); - - b.HasKey("Id"); - - b.HasIndex("IsAbandoned", "NextTryTime"); - - b.ToTable("AbpBackgroundJobs"); - }); - - modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128); - - b.Property("ProviderKey") - .HasMaxLength(64); - - b.Property("ProviderName") - .HasMaxLength(64); - - b.Property("Value") - .IsRequired() - .HasMaxLength(128); - - b.HasKey("Id"); - - b.HasIndex("Name", "ProviderName", "ProviderKey"); - - b.ToTable("AbpFeatureValues"); - }); - modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .IsRequired() .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Description") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("IsStatic"); + b.Property("IsStatic") + .HasColumnType("bit"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Regex") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("RegexDescription") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ValueType"); + b.Property("ValueType") + .HasColumnType("int"); b.HasKey("Id"); @@ -332,35 +319,44 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .IsRequired() .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDefault") - .HasColumnName("IsDefault"); + .HasColumnName("IsDefault") + .HasColumnType("bit"); b.Property("IsPublic") - .HasColumnName("IsPublic"); + .HasColumnName("IsPublic") + .HasColumnType("bit"); b.Property("IsStatic") - .HasColumnName("IsStatic"); + .HasColumnName("IsStatic") + .HasColumnType("bit"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedName") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -372,18 +368,22 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("uniqueidentifier"); b.Property("ClaimType") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -395,105 +395,131 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AccessFailedCount") .ValueGeneratedOnAdd() .HasColumnName("AccessFailedCount") + .HasColumnType("int") .HasDefaultValue(0); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Email") .HasColumnName("Email") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("EmailConfirmed") .ValueGeneratedOnAdd() .HasColumnName("EmailConfirmed") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnName("LockoutEnabled") + .HasColumnType("bit") .HasDefaultValue(false); - b.Property("LockoutEnd"); + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); b.Property("Name") .HasColumnName("Name") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("NormalizedEmail") .HasColumnName("NormalizedEmail") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedUserName") .IsRequired() .HasColumnName("NormalizedUserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("PasswordHash") .HasColumnName("PasswordHash") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("PhoneNumber") .HasColumnName("PhoneNumber") + .HasColumnType("nvarchar(16)") .HasMaxLength(16); b.Property("PhoneNumberConfirmed") .ValueGeneratedOnAdd() .HasColumnName("PhoneNumberConfirmed") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("SecurityStamp") .IsRequired() .HasColumnName("SecurityStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Surname") .HasColumnName("Surname") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); b.Property("TwoFactorEnabled") .ValueGeneratedOnAdd() .HasColumnName("TwoFactorEnabled") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("UserName") .IsRequired() .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -512,18 +538,22 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("uniqueidentifier"); b.Property("ClaimType") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -534,19 +564,24 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") .IsRequired() + .HasColumnType("nvarchar(196)") .HasMaxLength(196); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("UserId", "LoginProvider"); @@ -557,11 +592,14 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("UserId", "RoleId"); @@ -572,17 +610,22 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Name") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("Value"); + b.Property("Value") + .HasColumnType("nvarchar(max)"); b.HasKey("UserId", "LoginProvider", "Name"); @@ -592,51 +635,66 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Description") + .HasColumnType("nvarchar(1000)") .HasMaxLength(1000); b.Property("DisplayName") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Properties"); + b.Property("Properties") + .HasColumnType("nvarchar(max)"); b.HasKey("Id"); @@ -645,10 +703,12 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ApiResourceId", "Type"); @@ -657,22 +717,29 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Name") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("Description") - .HasMaxLength(256); + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); b.Property("DisplayName") - .HasMaxLength(128); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); - b.Property("Emphasize"); + b.Property("Emphasize") + .HasColumnType("bit"); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ShowInDiscoveryDocument"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); b.HasKey("ApiResourceId", "Name"); @@ -681,13 +748,16 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Name") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("Type") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ApiResourceId", "Name", "Type"); @@ -696,18 +766,23 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(32); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") - .HasMaxLength(196); + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); b.Property("Description") - .HasMaxLength(256); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.HasKey("ApiResourceId", "Type", "Value"); @@ -717,124 +792,171 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); - b.Property("AbsoluteRefreshTokenLifetime"); + b.Property("AbsoluteRefreshTokenLifetime") + .HasColumnType("int"); - b.Property("AccessTokenLifetime"); + b.Property("AccessTokenLifetime") + .HasColumnType("int"); - b.Property("AccessTokenType"); + b.Property("AccessTokenType") + .HasColumnType("int"); - b.Property("AllowAccessTokensViaBrowser"); + b.Property("AllowAccessTokensViaBrowser") + .HasColumnType("bit"); - b.Property("AllowOfflineAccess"); + b.Property("AllowOfflineAccess") + .HasColumnType("bit"); - b.Property("AllowPlainTextPkce"); + b.Property("AllowPlainTextPkce") + .HasColumnType("bit"); - b.Property("AllowRememberConsent"); + b.Property("AllowRememberConsent") + .HasColumnType("bit"); - b.Property("AlwaysIncludeUserClaimsInIdToken"); + b.Property("AlwaysIncludeUserClaimsInIdToken") + .HasColumnType("bit"); - b.Property("AlwaysSendClientClaims"); + b.Property("AlwaysSendClientClaims") + .HasColumnType("bit"); - b.Property("AuthorizationCodeLifetime"); + b.Property("AuthorizationCodeLifetime") + .HasColumnType("int"); - b.Property("BackChannelLogoutSessionRequired"); + b.Property("BackChannelLogoutSessionRequired") + .HasColumnType("bit"); b.Property("BackChannelLogoutUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("ClientClaimsPrefix") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientName") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); - b.Property("ConsentLifetime"); + b.Property("ConsentLifetime") + .HasColumnType("int"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Description") + .HasColumnType("nvarchar(1000)") .HasMaxLength(1000); - b.Property("DeviceCodeLifetime"); + b.Property("DeviceCodeLifetime") + .HasColumnType("int"); - b.Property("EnableLocalLogin"); + b.Property("EnableLocalLogin") + .HasColumnType("bit"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("FrontChannelLogoutSessionRequired"); + b.Property("FrontChannelLogoutSessionRequired") + .HasColumnType("bit"); b.Property("FrontChannelLogoutUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); - b.Property("IdentityTokenLifetime"); + b.Property("IdentityTokenLifetime") + .HasColumnType("int"); - b.Property("IncludeJwtId"); + b.Property("IncludeJwtId") + .HasColumnType("bit"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("LogoUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("PairWiseSubjectSalt") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ProtocolType") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("RefreshTokenExpiration"); + b.Property("RefreshTokenExpiration") + .HasColumnType("int"); - b.Property("RefreshTokenUsage"); + b.Property("RefreshTokenUsage") + .HasColumnType("int"); - b.Property("RequireClientSecret"); + b.Property("RequireClientSecret") + .HasColumnType("bit"); - b.Property("RequireConsent"); + b.Property("RequireConsent") + .HasColumnType("bit"); - b.Property("RequirePkce"); + b.Property("RequirePkce") + .HasColumnType("bit"); - b.Property("SlidingRefreshTokenLifetime"); + b.Property("SlidingRefreshTokenLifetime") + .HasColumnType("int"); - b.Property("UpdateAccessTokenClaimsOnRefresh"); + b.Property("UpdateAccessTokenClaimsOnRefresh") + .HasColumnType("bit"); b.Property("UserCodeType") + .HasColumnType("nvarchar(100)") .HasMaxLength(100); - b.Property("UserSsoLifetime"); + b.Property("UserSsoLifetime") + .HasColumnType("int"); b.HasKey("Id"); @@ -845,12 +967,15 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Type") + .HasColumnType("nvarchar(250)") .HasMaxLength(250); b.Property("Value") + .HasColumnType("nvarchar(250)") .HasMaxLength(250); b.HasKey("ClientId", "Type", "Value"); @@ -860,9 +985,11 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Origin") + .HasColumnType("nvarchar(150)") .HasMaxLength(150); b.HasKey("ClientId", "Origin"); @@ -872,10 +999,12 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("GrantType") - .HasMaxLength(196); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.HasKey("ClientId", "GrantType"); @@ -884,10 +1013,12 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Provider") - .HasMaxLength(64); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ClientId", "Provider"); @@ -896,10 +1027,12 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("PostLogoutRedirectUri") - .HasMaxLength(200); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "PostLogoutRedirectUri"); @@ -908,14 +1041,17 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Key") - .HasMaxLength(64); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") .IsRequired() - .HasMaxLength(128); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "Key"); @@ -924,10 +1060,12 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("RedirectUri") - .HasMaxLength(200); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "RedirectUri"); @@ -936,10 +1074,12 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Scope") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ClientId", "Scope"); @@ -948,18 +1088,23 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(32); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") - .HasMaxLength(196); + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); b.Property("Description") - .HasMaxLength(256); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.HasKey("ClientId", "Type", "Value"); @@ -969,35 +1114,48 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("ConcurrencyStamp"); + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("datetime2"); b.Property("Data") - .IsRequired(); + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(5000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("Id"); + b.Property("Id") + .HasColumnType("uniqueidentifier"); b.Property("SubjectId") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("Type") .IsRequired() + .HasColumnType("nvarchar(50)") .HasMaxLength(50); b.HasKey("Key"); + b.HasIndex("Expiration"); + b.HasIndex("SubjectId", "ClientId", "Type"); b.ToTable("IdentityServerPersistedGrants"); @@ -1005,10 +1163,12 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => { - b.Property("IdentityResourceId"); + b.Property("IdentityResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("IdentityResourceId", "Type"); @@ -1018,57 +1178,75 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Description") + .HasColumnType("nvarchar(1000)") .HasMaxLength(1000); b.Property("DisplayName") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Emphasize"); + b.Property("Emphasize") + .HasColumnType("bit"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Properties"); + b.Property("Properties") + .HasColumnType("nvarchar(max)"); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ShowInDiscoveryDocument"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); b.HasKey("Id"); @@ -1078,21 +1256,26 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderName") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -1104,20 +1287,25 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderName") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Value") .IsRequired() + .HasColumnType("nvarchar(2048)") .HasMaxLength(2048); b.HasKey("Id"); @@ -1127,256 +1315,208 @@ 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") + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) .WithMany("Actions") .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => { - b.HasOne("Volo.Abp.AuditLogging.AuditLog") + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) .WithMany("EntityChanges") .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => { - b.HasOne("Volo.Abp.AuditLogging.EntityChange") + b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) .WithMany("PropertyChanges") .HasForeignKey("EntityChangeId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => { - b.HasOne("Volo.Abp.Identity.IdentityRole") + b.HasOne("Volo.Abp.Identity.IdentityRole", null) .WithMany("Claims") .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Claims") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Logins") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { - b.HasOne("Volo.Abp.Identity.IdentityRole") + b.HasOne("Volo.Abp.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Roles") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Tokens") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("UserClaims") .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("Scopes") .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope", null) .WithMany("UserClaims") .HasForeignKey("ApiResourceId", "Name") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("Secrets") .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("Claims") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("AllowedCorsOrigins") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("AllowedGrantTypes") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("IdentityProviderRestrictions") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("PostLogoutRedirectUris") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("Properties") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("RedirectUris") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("AllowedScopes") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("ClientSecrets") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource") + b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) .WithMany("UserClaims") .HasForeignKey("IdentityResourceId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => - { - b.HasOne("Volo.Abp.TenantManagement.Tenant") - .WithMany("ConnectionStrings") - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); #pragma warning restore 612, 618 } diff --git a/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20190816095916_Initial.cs b/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20191010024505_Initial.cs similarity index 96% rename from samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20190816095916_Initial.cs rename to samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20191010024505_Initial.cs index 27a02acde0..f1e47fcf68 100644 --- a/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20190816095916_Initial.cs +++ b/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20191010024505_Initial.cs @@ -186,8 +186,8 @@ namespace AuthServer.Host.Migrations ClientId = table.Column(maxLength: 200, nullable: false), ClientName = table.Column(maxLength: 200, nullable: true), Description = table.Column(maxLength: 1000, nullable: true), - ClientUri = table.Column(maxLength: 300, nullable: true), - LogoUri = table.Column(maxLength: 300, nullable: true), + ClientUri = table.Column(maxLength: 2000, nullable: true), + LogoUri = table.Column(maxLength: 2000, nullable: true), Enabled = table.Column(nullable: false), ProtocolType = table.Column(maxLength: 200, nullable: false), RequireClientSecret = table.Column(nullable: false), @@ -197,9 +197,9 @@ namespace AuthServer.Host.Migrations RequirePkce = table.Column(nullable: false), AllowPlainTextPkce = table.Column(nullable: false), AllowAccessTokensViaBrowser = table.Column(nullable: false), - FrontChannelLogoutUri = table.Column(maxLength: 300, nullable: true), + FrontChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), FrontChannelLogoutSessionRequired = table.Column(nullable: false), - BackChannelLogoutUri = table.Column(maxLength: 300, nullable: true), + BackChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), BackChannelLogoutSessionRequired = table.Column(nullable: false), AllowOfflineAccess = table.Column(nullable: false), IdentityTokenLifetime = table.Column(nullable: false), @@ -267,7 +267,7 @@ namespace AuthServer.Host.Migrations ClientId = table.Column(maxLength: 200, nullable: false), CreationTime = table.Column(nullable: false), Expiration = table.Column(nullable: true), - Data = table.Column(nullable: false) + Data = table.Column(maxLength: 5000, nullable: false) }, constraints: table => { @@ -437,7 +437,7 @@ namespace AuthServer.Host.Migrations name: "IdentityServerApiClaims", columns: table => new { - Type = table.Column(maxLength: 196, nullable: false), + Type = table.Column(maxLength: 200, nullable: false), ApiResourceId = table.Column(nullable: false) }, constraints: table => @@ -456,9 +456,9 @@ namespace AuthServer.Host.Migrations columns: table => new { ApiResourceId = table.Column(nullable: false), - Name = table.Column(maxLength: 196, nullable: false), - DisplayName = table.Column(maxLength: 128, nullable: true), - Description = table.Column(maxLength: 256, nullable: true), + Name = table.Column(maxLength: 200, nullable: false), + DisplayName = table.Column(maxLength: 200, nullable: true), + Description = table.Column(maxLength: 1000, nullable: true), Required = table.Column(nullable: false), Emphasize = table.Column(nullable: false), ShowInDiscoveryDocument = table.Column(nullable: false) @@ -478,10 +478,10 @@ namespace AuthServer.Host.Migrations name: "IdentityServerApiSecrets", columns: table => new { - Type = table.Column(maxLength: 32, nullable: false), - Value = table.Column(maxLength: 196, nullable: false), + Type = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 4000, nullable: false), ApiResourceId = table.Column(nullable: false), - Description = table.Column(maxLength: 256, nullable: true), + Description = table.Column(maxLength: 2000, nullable: true), Expiration = table.Column(nullable: true) }, constraints: table => @@ -537,7 +537,7 @@ namespace AuthServer.Host.Migrations columns: table => new { ClientId = table.Column(nullable: false), - GrantType = table.Column(maxLength: 196, nullable: false) + GrantType = table.Column(maxLength: 250, nullable: false) }, constraints: table => { @@ -555,7 +555,7 @@ namespace AuthServer.Host.Migrations columns: table => new { ClientId = table.Column(nullable: false), - Provider = table.Column(maxLength: 64, nullable: false) + Provider = table.Column(maxLength: 200, nullable: false) }, constraints: table => { @@ -573,7 +573,7 @@ namespace AuthServer.Host.Migrations columns: table => new { ClientId = table.Column(nullable: false), - PostLogoutRedirectUri = table.Column(maxLength: 200, nullable: false) + PostLogoutRedirectUri = table.Column(maxLength: 2000, nullable: false) }, constraints: table => { @@ -591,8 +591,8 @@ namespace AuthServer.Host.Migrations columns: table => new { ClientId = table.Column(nullable: false), - Key = table.Column(maxLength: 64, nullable: false), - Value = table.Column(maxLength: 128, nullable: false) + Key = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 2000, nullable: false) }, constraints: table => { @@ -610,7 +610,7 @@ namespace AuthServer.Host.Migrations columns: table => new { ClientId = table.Column(nullable: false), - RedirectUri = table.Column(maxLength: 200, nullable: false) + RedirectUri = table.Column(maxLength: 2000, nullable: false) }, constraints: table => { @@ -628,7 +628,7 @@ namespace AuthServer.Host.Migrations columns: table => new { ClientId = table.Column(nullable: false), - Scope = table.Column(maxLength: 196, nullable: false) + Scope = table.Column(maxLength: 200, nullable: false) }, constraints: table => { @@ -645,10 +645,10 @@ namespace AuthServer.Host.Migrations name: "IdentityServerClientSecrets", columns: table => new { - Type = table.Column(maxLength: 32, nullable: false), - Value = table.Column(maxLength: 196, nullable: false), + Type = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 4000, nullable: false), ClientId = table.Column(nullable: false), - Description = table.Column(maxLength: 256, nullable: true), + Description = table.Column(maxLength: 2000, nullable: true), Expiration = table.Column(nullable: true) }, constraints: table => @@ -666,7 +666,7 @@ namespace AuthServer.Host.Migrations name: "IdentityServerIdentityClaims", columns: table => new { - Type = table.Column(maxLength: 196, nullable: false), + Type = table.Column(maxLength: 200, nullable: false), IdentityResourceId = table.Column(nullable: false) }, constraints: table => @@ -707,9 +707,9 @@ namespace AuthServer.Host.Migrations name: "IdentityServerApiScopeClaims", columns: table => new { - Type = table.Column(maxLength: 196, nullable: false), + Type = table.Column(maxLength: 200, nullable: false), ApiResourceId = table.Column(nullable: false), - Name = table.Column(maxLength: 196, nullable: false) + Name = table.Column(maxLength: 200, nullable: false) }, constraints: table => { @@ -815,8 +815,12 @@ namespace AuthServer.Host.Migrations migrationBuilder.CreateIndex( name: "IX_IdentityServerClients_ClientId", table: "IdentityServerClients", - column: "ClientId", - unique: true); + column: "ClientId"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerPersistedGrants_Expiration", + table: "IdentityServerPersistedGrants", + column: "Expiration"); migrationBuilder.CreateIndex( name: "IX_IdentityServerPersistedGrants_SubjectId_ClientId_Type", diff --git a/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/AuthServerDbContextModelSnapshot.cs b/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/AuthServerDbContextModelSnapshot.cs index 113830d96d..0224c317e5 100644 --- a/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/AuthServerDbContextModelSnapshot.cs +++ b/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/AuthServerDbContextModelSnapshot.cs @@ -15,84 +15,106 @@ namespace AuthServer.Host.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.2.6-servicing-10079") + .HasAnnotation("ProductVersion", "3.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ApplicationName") .HasColumnName("ApplicationName") + .HasColumnType("nvarchar(96)") .HasMaxLength(96); b.Property("BrowserInfo") .HasColumnName("BrowserInfo") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("ClientId") .HasColumnName("ClientId") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ClientIpAddress") .HasColumnName("ClientIpAddress") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ClientName") .HasColumnName("ClientName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("Comments") .HasColumnName("Comments") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("ConcurrencyStamp"); + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CorrelationId") .HasColumnName("CorrelationId") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Exceptions") .HasColumnName("Exceptions") + .HasColumnType("nvarchar(4000)") .HasMaxLength(4000); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration"); + .HasColumnName("ExecutionDuration") + .HasColumnType("int"); - b.Property("ExecutionTime"); + b.Property("ExecutionTime") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("HttpMethod") .HasColumnName("HttpMethod") + .HasColumnType("nvarchar(16)") .HasMaxLength(16); b.Property("HttpStatusCode") - .HasColumnName("HttpStatusCode"); + .HasColumnName("HttpStatusCode") + .HasColumnType("int"); b.Property("ImpersonatorTenantId") - .HasColumnName("ImpersonatorTenantId"); + .HasColumnName("ImpersonatorTenantId") + .HasColumnType("uniqueidentifier"); b.Property("ImpersonatorUserId") - .HasColumnName("ImpersonatorUserId"); + .HasColumnName("ImpersonatorUserId") + .HasColumnType("uniqueidentifier"); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantName"); + b.Property("TenantName") + .HasColumnType("nvarchar(max)"); b.Property("Url") .HasColumnName("Url") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("UserId") - .HasColumnName("UserId"); + .HasColumnName("UserId") + .HasColumnType("uniqueidentifier"); b.Property("UserName") .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -107,33 +129,42 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId"); + .HasColumnName("AuditLogId") + .HasColumnType("uniqueidentifier"); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration"); + .HasColumnName("ExecutionDuration") + .HasColumnType("int"); b.Property("ExecutionTime") - .HasColumnName("ExecutionTime"); + .HasColumnName("ExecutionTime") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("MethodName") .HasColumnName("MethodName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("Parameters") .HasColumnName("Parameters") + .HasColumnType("nvarchar(2000)") .HasMaxLength(2000); b.Property("ServiceName") .HasColumnName("ServiceName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -147,34 +178,43 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId"); + .HasColumnName("AuditLogId") + .HasColumnType("uniqueidentifier"); b.Property("ChangeTime") - .HasColumnName("ChangeTime"); + .HasColumnName("ChangeTime") + .HasColumnType("datetime2"); b.Property("ChangeType") - .HasColumnName("ChangeType"); + .HasColumnName("ChangeType") + .HasColumnType("tinyint"); b.Property("EntityId") .IsRequired() .HasColumnName("EntityId") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("EntityTenantId"); + b.Property("EntityTenantId") + .HasColumnType("uniqueidentifier"); b.Property("EntityTypeFullName") .IsRequired() .HasColumnName("EntityTypeFullName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -188,29 +228,36 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); - b.Property("EntityChangeId"); + b.Property("EntityChangeId") + .HasColumnType("uniqueidentifier"); b.Property("NewValue") .HasColumnName("NewValue") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("OriginalValue") .HasColumnName("OriginalValue") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("PropertyName") .IsRequired() .HasColumnName("PropertyName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("PropertyTypeFullName") .IsRequired() .HasColumnName("PropertyTypeFullName") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -222,35 +269,45 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .IsRequired() .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Description") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("IsStatic"); + b.Property("IsStatic") + .HasColumnType("bit"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Regex") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("RegexDescription") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ValueType"); + b.Property("ValueType") + .HasColumnType("int"); b.HasKey("Id"); @@ -260,35 +317,44 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .IsRequired() .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDefault") - .HasColumnName("IsDefault"); + .HasColumnName("IsDefault") + .HasColumnType("bit"); b.Property("IsPublic") - .HasColumnName("IsPublic"); + .HasColumnName("IsPublic") + .HasColumnType("bit"); b.Property("IsStatic") - .HasColumnName("IsStatic"); + .HasColumnName("IsStatic") + .HasColumnType("bit"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedName") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -300,18 +366,22 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("uniqueidentifier"); b.Property("ClaimType") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -323,105 +393,131 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AccessFailedCount") .ValueGeneratedOnAdd() .HasColumnName("AccessFailedCount") + .HasColumnType("int") .HasDefaultValue(0); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Email") .HasColumnName("Email") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("EmailConfirmed") .ValueGeneratedOnAdd() .HasColumnName("EmailConfirmed") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnName("LockoutEnabled") + .HasColumnType("bit") .HasDefaultValue(false); - b.Property("LockoutEnd"); + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); b.Property("Name") .HasColumnName("Name") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("NormalizedEmail") .HasColumnName("NormalizedEmail") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedUserName") .IsRequired() .HasColumnName("NormalizedUserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("PasswordHash") .HasColumnName("PasswordHash") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("PhoneNumber") .HasColumnName("PhoneNumber") + .HasColumnType("nvarchar(16)") .HasMaxLength(16); b.Property("PhoneNumberConfirmed") .ValueGeneratedOnAdd() .HasColumnName("PhoneNumberConfirmed") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("SecurityStamp") .IsRequired() .HasColumnName("SecurityStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Surname") .HasColumnName("Surname") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); b.Property("TwoFactorEnabled") .ValueGeneratedOnAdd() .HasColumnName("TwoFactorEnabled") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("UserName") .IsRequired() .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -440,18 +536,22 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("uniqueidentifier"); b.Property("ClaimType") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -462,19 +562,24 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") .IsRequired() + .HasColumnType("nvarchar(196)") .HasMaxLength(196); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("UserId", "LoginProvider"); @@ -485,11 +590,14 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("UserId", "RoleId"); @@ -500,17 +608,22 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Name") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("Value"); + b.Property("Value") + .HasColumnType("nvarchar(max)"); b.HasKey("UserId", "LoginProvider", "Name"); @@ -520,51 +633,66 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Description") + .HasColumnType("nvarchar(1000)") .HasMaxLength(1000); b.Property("DisplayName") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Properties"); + b.Property("Properties") + .HasColumnType("nvarchar(max)"); b.HasKey("Id"); @@ -573,10 +701,12 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ApiResourceId", "Type"); @@ -585,22 +715,29 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Name") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("Description") - .HasMaxLength(256); + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); b.Property("DisplayName") - .HasMaxLength(128); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); - b.Property("Emphasize"); + b.Property("Emphasize") + .HasColumnType("bit"); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ShowInDiscoveryDocument"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); b.HasKey("ApiResourceId", "Name"); @@ -609,13 +746,16 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Name") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("Type") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ApiResourceId", "Name", "Type"); @@ -624,18 +764,23 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(32); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") - .HasMaxLength(196); + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); b.Property("Description") - .HasMaxLength(256); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.HasKey("ApiResourceId", "Type", "Value"); @@ -645,141 +790,190 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); - b.Property("AbsoluteRefreshTokenLifetime"); + b.Property("AbsoluteRefreshTokenLifetime") + .HasColumnType("int"); - b.Property("AccessTokenLifetime"); + b.Property("AccessTokenLifetime") + .HasColumnType("int"); - b.Property("AccessTokenType"); + b.Property("AccessTokenType") + .HasColumnType("int"); - b.Property("AllowAccessTokensViaBrowser"); + b.Property("AllowAccessTokensViaBrowser") + .HasColumnType("bit"); - b.Property("AllowOfflineAccess"); + b.Property("AllowOfflineAccess") + .HasColumnType("bit"); - b.Property("AllowPlainTextPkce"); + b.Property("AllowPlainTextPkce") + .HasColumnType("bit"); - b.Property("AllowRememberConsent"); + b.Property("AllowRememberConsent") + .HasColumnType("bit"); - b.Property("AlwaysIncludeUserClaimsInIdToken"); + b.Property("AlwaysIncludeUserClaimsInIdToken") + .HasColumnType("bit"); - b.Property("AlwaysSendClientClaims"); + b.Property("AlwaysSendClientClaims") + .HasColumnType("bit"); - b.Property("AuthorizationCodeLifetime"); + b.Property("AuthorizationCodeLifetime") + .HasColumnType("int"); - b.Property("BackChannelLogoutSessionRequired"); + b.Property("BackChannelLogoutSessionRequired") + .HasColumnType("bit"); b.Property("BackChannelLogoutUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("ClientClaimsPrefix") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientName") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); - b.Property("ConsentLifetime"); + b.Property("ConsentLifetime") + .HasColumnType("int"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Description") + .HasColumnType("nvarchar(1000)") .HasMaxLength(1000); - b.Property("DeviceCodeLifetime"); + b.Property("DeviceCodeLifetime") + .HasColumnType("int"); - b.Property("EnableLocalLogin"); + b.Property("EnableLocalLogin") + .HasColumnType("bit"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("FrontChannelLogoutSessionRequired"); + b.Property("FrontChannelLogoutSessionRequired") + .HasColumnType("bit"); b.Property("FrontChannelLogoutUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); - b.Property("IdentityTokenLifetime"); + b.Property("IdentityTokenLifetime") + .HasColumnType("int"); - b.Property("IncludeJwtId"); + b.Property("IncludeJwtId") + .HasColumnType("bit"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("LogoUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("PairWiseSubjectSalt") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ProtocolType") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("RefreshTokenExpiration"); + b.Property("RefreshTokenExpiration") + .HasColumnType("int"); - b.Property("RefreshTokenUsage"); + b.Property("RefreshTokenUsage") + .HasColumnType("int"); - b.Property("RequireClientSecret"); + b.Property("RequireClientSecret") + .HasColumnType("bit"); - b.Property("RequireConsent"); + b.Property("RequireConsent") + .HasColumnType("bit"); - b.Property("RequirePkce"); + b.Property("RequirePkce") + .HasColumnType("bit"); - b.Property("SlidingRefreshTokenLifetime"); + b.Property("SlidingRefreshTokenLifetime") + .HasColumnType("int"); - b.Property("UpdateAccessTokenClaimsOnRefresh"); + b.Property("UpdateAccessTokenClaimsOnRefresh") + .HasColumnType("bit"); b.Property("UserCodeType") + .HasColumnType("nvarchar(100)") .HasMaxLength(100); - b.Property("UserSsoLifetime"); + b.Property("UserSsoLifetime") + .HasColumnType("int"); b.HasKey("Id"); - b.HasIndex("ClientId") - .IsUnique(); + b.HasIndex("ClientId"); b.ToTable("IdentityServerClients"); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Type") + .HasColumnType("nvarchar(250)") .HasMaxLength(250); b.Property("Value") + .HasColumnType("nvarchar(250)") .HasMaxLength(250); b.HasKey("ClientId", "Type", "Value"); @@ -789,9 +983,11 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Origin") + .HasColumnType("nvarchar(150)") .HasMaxLength(150); b.HasKey("ClientId", "Origin"); @@ -801,10 +997,12 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("GrantType") - .HasMaxLength(196); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.HasKey("ClientId", "GrantType"); @@ -813,10 +1011,12 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Provider") - .HasMaxLength(64); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ClientId", "Provider"); @@ -825,10 +1025,12 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("PostLogoutRedirectUri") - .HasMaxLength(200); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "PostLogoutRedirectUri"); @@ -837,14 +1039,17 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Key") - .HasMaxLength(64); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") .IsRequired() - .HasMaxLength(128); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "Key"); @@ -853,10 +1058,12 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("RedirectUri") - .HasMaxLength(200); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "RedirectUri"); @@ -865,10 +1072,12 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Scope") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ClientId", "Scope"); @@ -877,18 +1086,23 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(32); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") - .HasMaxLength(196); + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); b.Property("Description") - .HasMaxLength(256); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.HasKey("ClientId", "Type", "Value"); @@ -898,35 +1112,48 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("ConcurrencyStamp"); + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("datetime2"); b.Property("Data") - .IsRequired(); + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(5000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("Id"); + b.Property("Id") + .HasColumnType("uniqueidentifier"); b.Property("SubjectId") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("Type") .IsRequired() + .HasColumnType("nvarchar(50)") .HasMaxLength(50); b.HasKey("Key"); + b.HasIndex("Expiration"); + b.HasIndex("SubjectId", "ClientId", "Type"); b.ToTable("IdentityServerPersistedGrants"); @@ -934,10 +1161,12 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => { - b.Property("IdentityResourceId"); + b.Property("IdentityResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("IdentityResourceId", "Type"); @@ -947,57 +1176,75 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Description") + .HasColumnType("nvarchar(1000)") .HasMaxLength(1000); b.Property("DisplayName") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Emphasize"); + b.Property("Emphasize") + .HasColumnType("bit"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Properties"); + b.Property("Properties") + .HasColumnType("nvarchar(max)"); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ShowInDiscoveryDocument"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); b.HasKey("Id"); @@ -1007,21 +1254,26 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderName") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -1033,20 +1285,25 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderName") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Value") .IsRequired() + .HasColumnType("nvarchar(2048)") .HasMaxLength(2048); b.HasKey("Id"); @@ -1058,183 +1315,206 @@ namespace AuthServer.Host.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => { - b.HasOne("Volo.Abp.AuditLogging.AuditLog") + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) .WithMany("Actions") .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => { - b.HasOne("Volo.Abp.AuditLogging.AuditLog") + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) .WithMany("EntityChanges") .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => { - b.HasOne("Volo.Abp.AuditLogging.EntityChange") + b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) .WithMany("PropertyChanges") .HasForeignKey("EntityChangeId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => { - b.HasOne("Volo.Abp.Identity.IdentityRole") + b.HasOne("Volo.Abp.Identity.IdentityRole", null) .WithMany("Claims") .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Claims") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Logins") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { - b.HasOne("Volo.Abp.Identity.IdentityRole") + b.HasOne("Volo.Abp.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Roles") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Tokens") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("UserClaims") .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("Scopes") .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope", null) .WithMany("UserClaims") .HasForeignKey("ApiResourceId", "Name") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("Secrets") .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("Claims") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("AllowedCorsOrigins") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("AllowedGrantTypes") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("IdentityProviderRestrictions") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("PostLogoutRedirectUris") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("Properties") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("RedirectUris") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("AllowedScopes") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("ClientSecrets") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource") + b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) .WithMany("UserClaims") .HasForeignKey("IdentityResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); #pragma warning restore 612, 618 } diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20190816093449_Initial.Designer.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20191010024652_Initial.Designer.cs similarity index 53% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20190816093449_Initial.Designer.cs rename to templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20191010024652_Initial.Designer.cs index c0af2fdf38..ca4d0263bf 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20190816093449_Initial.Designer.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20191010024652_Initial.Designer.cs @@ -9,92 +9,114 @@ using MyCompanyName.MyProjectName.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { - [DbContext(typeof(IdentityServerHostMigrationsDbContext))] - [Migration("20190816093449_Initial")] + [DbContext(typeof(MyProjectNameMigrationsDbContext))] + [Migration("20191010024652_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.2.6-servicing-10079") + .HasAnnotation("ProductVersion", "3.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ApplicationName") .HasColumnName("ApplicationName") + .HasColumnType("nvarchar(96)") .HasMaxLength(96); b.Property("BrowserInfo") .HasColumnName("BrowserInfo") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("ClientId") .HasColumnName("ClientId") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ClientIpAddress") .HasColumnName("ClientIpAddress") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ClientName") .HasColumnName("ClientName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("Comments") .HasColumnName("Comments") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("ConcurrencyStamp"); + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CorrelationId") .HasColumnName("CorrelationId") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Exceptions") .HasColumnName("Exceptions") + .HasColumnType("nvarchar(4000)") .HasMaxLength(4000); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration"); + .HasColumnName("ExecutionDuration") + .HasColumnType("int"); - b.Property("ExecutionTime"); + b.Property("ExecutionTime") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("HttpMethod") .HasColumnName("HttpMethod") + .HasColumnType("nvarchar(16)") .HasMaxLength(16); b.Property("HttpStatusCode") - .HasColumnName("HttpStatusCode"); + .HasColumnName("HttpStatusCode") + .HasColumnType("int"); b.Property("ImpersonatorTenantId") - .HasColumnName("ImpersonatorTenantId"); + .HasColumnName("ImpersonatorTenantId") + .HasColumnType("uniqueidentifier"); b.Property("ImpersonatorUserId") - .HasColumnName("ImpersonatorUserId"); + .HasColumnName("ImpersonatorUserId") + .HasColumnType("uniqueidentifier"); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantName"); + b.Property("TenantName") + .HasColumnType("nvarchar(max)"); b.Property("Url") .HasColumnName("Url") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("UserId") - .HasColumnName("UserId"); + .HasColumnName("UserId") + .HasColumnType("uniqueidentifier"); b.Property("UserName") .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -109,33 +131,42 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId"); + .HasColumnName("AuditLogId") + .HasColumnType("uniqueidentifier"); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration"); + .HasColumnName("ExecutionDuration") + .HasColumnType("int"); b.Property("ExecutionTime") - .HasColumnName("ExecutionTime"); + .HasColumnName("ExecutionTime") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("MethodName") .HasColumnName("MethodName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("Parameters") .HasColumnName("Parameters") + .HasColumnType("nvarchar(2000)") .HasMaxLength(2000); b.Property("ServiceName") .HasColumnName("ServiceName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -149,34 +180,43 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId"); + .HasColumnName("AuditLogId") + .HasColumnType("uniqueidentifier"); b.Property("ChangeTime") - .HasColumnName("ChangeTime"); + .HasColumnName("ChangeTime") + .HasColumnType("datetime2"); b.Property("ChangeType") - .HasColumnName("ChangeType"); + .HasColumnName("ChangeType") + .HasColumnType("tinyint"); b.Property("EntityId") .IsRequired() .HasColumnName("EntityId") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("EntityTenantId"); + b.Property("EntityTenantId") + .HasColumnType("uniqueidentifier"); b.Property("EntityTypeFullName") .IsRequired() .HasColumnName("EntityTypeFullName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -190,29 +230,36 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); - b.Property("EntityChangeId"); + b.Property("EntityChangeId") + .HasColumnType("uniqueidentifier"); b.Property("NewValue") .HasColumnName("NewValue") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("OriginalValue") .HasColumnName("OriginalValue") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("PropertyName") .IsRequired() .HasColumnName("PropertyName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("PropertyTypeFullName") .IsRequired() .HasColumnName("PropertyTypeFullName") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -221,38 +268,134 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpEntityPropertyChanges"); }); + modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsAbandoned") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("JobArgs") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(1048576); + + b.Property("JobName") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("LastTryTime") + .HasColumnType("datetime2"); + + b.Property("NextTryTime") + .HasColumnType("datetime2"); + + b.Property("Priority") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint") + .HasDefaultValue((byte)15); + + b.Property("TryCount") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((short)0); + + b.HasKey("Id"); + + b.HasIndex("IsAbandoned", "NextTryTime"); + + b.ToTable("AbpBackgroundJobs"); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("ProviderKey") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ProviderName") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpFeatureValues"); + }); + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .IsRequired() .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Description") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("IsStatic"); + b.Property("IsStatic") + .HasColumnType("bit"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Regex") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("RegexDescription") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ValueType"); + b.Property("ValueType") + .HasColumnType("int"); b.HasKey("Id"); @@ -262,35 +405,44 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .IsRequired() .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDefault") - .HasColumnName("IsDefault"); + .HasColumnName("IsDefault") + .HasColumnType("bit"); b.Property("IsPublic") - .HasColumnName("IsPublic"); + .HasColumnName("IsPublic") + .HasColumnType("bit"); b.Property("IsStatic") - .HasColumnName("IsStatic"); + .HasColumnName("IsStatic") + .HasColumnType("bit"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedName") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -302,18 +454,22 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("uniqueidentifier"); b.Property("ClaimType") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -325,105 +481,131 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AccessFailedCount") .ValueGeneratedOnAdd() .HasColumnName("AccessFailedCount") + .HasColumnType("int") .HasDefaultValue(0); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Email") .HasColumnName("Email") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("EmailConfirmed") .ValueGeneratedOnAdd() .HasColumnName("EmailConfirmed") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnName("LockoutEnabled") + .HasColumnType("bit") .HasDefaultValue(false); - b.Property("LockoutEnd"); + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); b.Property("Name") .HasColumnName("Name") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("NormalizedEmail") .HasColumnName("NormalizedEmail") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedUserName") .IsRequired() .HasColumnName("NormalizedUserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("PasswordHash") .HasColumnName("PasswordHash") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("PhoneNumber") .HasColumnName("PhoneNumber") + .HasColumnType("nvarchar(16)") .HasMaxLength(16); b.Property("PhoneNumberConfirmed") .ValueGeneratedOnAdd() .HasColumnName("PhoneNumberConfirmed") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("SecurityStamp") .IsRequired() .HasColumnName("SecurityStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Surname") .HasColumnName("Surname") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); b.Property("TwoFactorEnabled") .ValueGeneratedOnAdd() .HasColumnName("TwoFactorEnabled") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("UserName") .IsRequired() .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -442,18 +624,22 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("uniqueidentifier"); b.Property("ClaimType") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -464,19 +650,24 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") .IsRequired() + .HasColumnType("nvarchar(196)") .HasMaxLength(196); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("UserId", "LoginProvider"); @@ -487,11 +678,14 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("UserId", "RoleId"); @@ -502,17 +696,22 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Name") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("Value"); + b.Property("Value") + .HasColumnType("nvarchar(max)"); b.HasKey("UserId", "LoginProvider", "Name"); @@ -522,51 +721,66 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Description") + .HasColumnType("nvarchar(1000)") .HasMaxLength(1000); b.Property("DisplayName") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Properties"); + b.Property("Properties") + .HasColumnType("nvarchar(max)"); b.HasKey("Id"); @@ -575,10 +789,12 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ApiResourceId", "Type"); @@ -587,22 +803,29 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Name") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("Description") - .HasMaxLength(256); + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); b.Property("DisplayName") - .HasMaxLength(128); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); - b.Property("Emphasize"); + b.Property("Emphasize") + .HasColumnType("bit"); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ShowInDiscoveryDocument"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); b.HasKey("ApiResourceId", "Name"); @@ -611,13 +834,16 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Name") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("Type") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ApiResourceId", "Name", "Type"); @@ -626,18 +852,23 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(32); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") - .HasMaxLength(196); + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); b.Property("Description") - .HasMaxLength(256); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.HasKey("ApiResourceId", "Type", "Value"); @@ -647,141 +878,190 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); - b.Property("AbsoluteRefreshTokenLifetime"); + b.Property("AbsoluteRefreshTokenLifetime") + .HasColumnType("int"); - b.Property("AccessTokenLifetime"); + b.Property("AccessTokenLifetime") + .HasColumnType("int"); - b.Property("AccessTokenType"); + b.Property("AccessTokenType") + .HasColumnType("int"); - b.Property("AllowAccessTokensViaBrowser"); + b.Property("AllowAccessTokensViaBrowser") + .HasColumnType("bit"); - b.Property("AllowOfflineAccess"); + b.Property("AllowOfflineAccess") + .HasColumnType("bit"); - b.Property("AllowPlainTextPkce"); + b.Property("AllowPlainTextPkce") + .HasColumnType("bit"); - b.Property("AllowRememberConsent"); + b.Property("AllowRememberConsent") + .HasColumnType("bit"); - b.Property("AlwaysIncludeUserClaimsInIdToken"); + b.Property("AlwaysIncludeUserClaimsInIdToken") + .HasColumnType("bit"); - b.Property("AlwaysSendClientClaims"); + b.Property("AlwaysSendClientClaims") + .HasColumnType("bit"); - b.Property("AuthorizationCodeLifetime"); + b.Property("AuthorizationCodeLifetime") + .HasColumnType("int"); - b.Property("BackChannelLogoutSessionRequired"); + b.Property("BackChannelLogoutSessionRequired") + .HasColumnType("bit"); b.Property("BackChannelLogoutUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("ClientClaimsPrefix") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientName") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); - b.Property("ConsentLifetime"); + b.Property("ConsentLifetime") + .HasColumnType("int"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Description") + .HasColumnType("nvarchar(1000)") .HasMaxLength(1000); - b.Property("DeviceCodeLifetime"); + b.Property("DeviceCodeLifetime") + .HasColumnType("int"); - b.Property("EnableLocalLogin"); + b.Property("EnableLocalLogin") + .HasColumnType("bit"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("FrontChannelLogoutSessionRequired"); + b.Property("FrontChannelLogoutSessionRequired") + .HasColumnType("bit"); b.Property("FrontChannelLogoutUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); - b.Property("IdentityTokenLifetime"); + b.Property("IdentityTokenLifetime") + .HasColumnType("int"); - b.Property("IncludeJwtId"); + b.Property("IncludeJwtId") + .HasColumnType("bit"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("LogoUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("PairWiseSubjectSalt") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ProtocolType") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("RefreshTokenExpiration"); + b.Property("RefreshTokenExpiration") + .HasColumnType("int"); - b.Property("RefreshTokenUsage"); + b.Property("RefreshTokenUsage") + .HasColumnType("int"); - b.Property("RequireClientSecret"); + b.Property("RequireClientSecret") + .HasColumnType("bit"); - b.Property("RequireConsent"); + b.Property("RequireConsent") + .HasColumnType("bit"); - b.Property("RequirePkce"); + b.Property("RequirePkce") + .HasColumnType("bit"); - b.Property("SlidingRefreshTokenLifetime"); + b.Property("SlidingRefreshTokenLifetime") + .HasColumnType("int"); - b.Property("UpdateAccessTokenClaimsOnRefresh"); + b.Property("UpdateAccessTokenClaimsOnRefresh") + .HasColumnType("bit"); b.Property("UserCodeType") + .HasColumnType("nvarchar(100)") .HasMaxLength(100); - b.Property("UserSsoLifetime"); + b.Property("UserSsoLifetime") + .HasColumnType("int"); b.HasKey("Id"); - b.HasIndex("ClientId") - .IsUnique(); + b.HasIndex("ClientId"); b.ToTable("IdentityServerClients"); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Type") + .HasColumnType("nvarchar(250)") .HasMaxLength(250); b.Property("Value") + .HasColumnType("nvarchar(250)") .HasMaxLength(250); b.HasKey("ClientId", "Type", "Value"); @@ -791,9 +1071,11 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Origin") + .HasColumnType("nvarchar(150)") .HasMaxLength(150); b.HasKey("ClientId", "Origin"); @@ -803,10 +1085,12 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("GrantType") - .HasMaxLength(196); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.HasKey("ClientId", "GrantType"); @@ -815,10 +1099,12 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Provider") - .HasMaxLength(64); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ClientId", "Provider"); @@ -827,10 +1113,12 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("PostLogoutRedirectUri") - .HasMaxLength(200); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "PostLogoutRedirectUri"); @@ -839,14 +1127,17 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Key") - .HasMaxLength(64); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") .IsRequired() - .HasMaxLength(128); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "Key"); @@ -855,10 +1146,12 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("RedirectUri") - .HasMaxLength(200); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "RedirectUri"); @@ -867,10 +1160,12 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Scope") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ClientId", "Scope"); @@ -879,18 +1174,23 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(32); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") - .HasMaxLength(196); + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); b.Property("Description") - .HasMaxLength(256); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.HasKey("ClientId", "Type", "Value"); @@ -900,35 +1200,48 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("ConcurrencyStamp"); + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("datetime2"); b.Property("Data") - .IsRequired(); + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(5000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("Id"); + b.Property("Id") + .HasColumnType("uniqueidentifier"); b.Property("SubjectId") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("Type") .IsRequired() + .HasColumnType("nvarchar(50)") .HasMaxLength(50); b.HasKey("Key"); + b.HasIndex("Expiration"); + b.HasIndex("SubjectId", "ClientId", "Type"); b.ToTable("IdentityServerPersistedGrants"); @@ -936,10 +1249,12 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => { - b.Property("IdentityResourceId"); + b.Property("IdentityResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("IdentityResourceId", "Type"); @@ -949,57 +1264,75 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Description") + .HasColumnType("nvarchar(1000)") .HasMaxLength(1000); b.Property("DisplayName") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Emphasize"); + b.Property("Emphasize") + .HasColumnType("bit"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Properties"); + b.Property("Properties") + .HasColumnType("nvarchar(max)"); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ShowInDiscoveryDocument"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); b.HasKey("Id"); @@ -1009,21 +1342,26 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderName") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -1035,20 +1373,25 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderName") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Value") .IsRequired() + .HasColumnType("nvarchar(2048)") .HasMaxLength(2048); b.HasKey("Id"); @@ -1061,40 +1404,51 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.HasKey("Id"); @@ -1107,13 +1461,16 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => { - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.Property("Name") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Value") .IsRequired() + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); b.HasKey("TenantId", "Name"); @@ -1123,191 +1480,215 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => { - b.HasOne("Volo.Abp.AuditLogging.AuditLog") + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) .WithMany("Actions") .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => { - b.HasOne("Volo.Abp.AuditLogging.AuditLog") + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) .WithMany("EntityChanges") .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => { - b.HasOne("Volo.Abp.AuditLogging.EntityChange") + b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) .WithMany("PropertyChanges") .HasForeignKey("EntityChangeId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => { - b.HasOne("Volo.Abp.Identity.IdentityRole") + b.HasOne("Volo.Abp.Identity.IdentityRole", null) .WithMany("Claims") .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Claims") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Logins") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { - b.HasOne("Volo.Abp.Identity.IdentityRole") + b.HasOne("Volo.Abp.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Roles") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Tokens") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("UserClaims") .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("Scopes") .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope", null) .WithMany("UserClaims") .HasForeignKey("ApiResourceId", "Name") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("Secrets") .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("Claims") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("AllowedCorsOrigins") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("AllowedGrantTypes") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("IdentityProviderRestrictions") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("PostLogoutRedirectUris") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("Properties") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("RedirectUris") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("AllowedScopes") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("ClientSecrets") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource") + b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) .WithMany("UserClaims") .HasForeignKey("IdentityResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => { - b.HasOne("Volo.Abp.TenantManagement.Tenant") + b.HasOne("Volo.Abp.TenantManagement.Tenant", null) .WithMany("ConnectionStrings") .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); #pragma warning restore 612, 618 } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190918061142_Initial.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20191010024652_Initial.cs similarity index 96% rename from templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190918061142_Initial.cs rename to templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20191010024652_Initial.cs index 85fe9bcb90..5a7c9a3007 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20190918061142_Initial.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20191010024652_Initial.cs @@ -243,8 +243,8 @@ namespace MyCompanyName.MyProjectName.Migrations ClientId = table.Column(maxLength: 200, nullable: false), ClientName = table.Column(maxLength: 200, nullable: true), Description = table.Column(maxLength: 1000, nullable: true), - ClientUri = table.Column(maxLength: 300, nullable: true), - LogoUri = table.Column(maxLength: 300, nullable: true), + ClientUri = table.Column(maxLength: 2000, nullable: true), + LogoUri = table.Column(maxLength: 2000, nullable: true), Enabled = table.Column(nullable: false), ProtocolType = table.Column(maxLength: 200, nullable: false), RequireClientSecret = table.Column(nullable: false), @@ -254,9 +254,9 @@ namespace MyCompanyName.MyProjectName.Migrations RequirePkce = table.Column(nullable: false), AllowPlainTextPkce = table.Column(nullable: false), AllowAccessTokensViaBrowser = table.Column(nullable: false), - FrontChannelLogoutUri = table.Column(maxLength: 300, nullable: true), + FrontChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), FrontChannelLogoutSessionRequired = table.Column(nullable: false), - BackChannelLogoutUri = table.Column(maxLength: 300, nullable: true), + BackChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), BackChannelLogoutSessionRequired = table.Column(nullable: false), AllowOfflineAccess = table.Column(nullable: false), IdentityTokenLifetime = table.Column(nullable: false), @@ -324,7 +324,7 @@ namespace MyCompanyName.MyProjectName.Migrations ClientId = table.Column(maxLength: 200, nullable: false), CreationTime = table.Column(nullable: false), Expiration = table.Column(nullable: true), - Data = table.Column(nullable: false) + Data = table.Column(maxLength: 5000, nullable: false) }, constraints: table => { @@ -513,7 +513,7 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerApiClaims", columns: table => new { - Type = table.Column(maxLength: 196, nullable: false), + Type = table.Column(maxLength: 200, nullable: false), ApiResourceId = table.Column(nullable: false) }, constraints: table => @@ -532,9 +532,9 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { ApiResourceId = table.Column(nullable: false), - Name = table.Column(maxLength: 196, nullable: false), - DisplayName = table.Column(maxLength: 128, nullable: true), - Description = table.Column(maxLength: 256, nullable: true), + Name = table.Column(maxLength: 200, nullable: false), + DisplayName = table.Column(maxLength: 200, nullable: true), + Description = table.Column(maxLength: 1000, nullable: true), Required = table.Column(nullable: false), Emphasize = table.Column(nullable: false), ShowInDiscoveryDocument = table.Column(nullable: false) @@ -554,10 +554,10 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerApiSecrets", columns: table => new { - Type = table.Column(maxLength: 32, nullable: false), - Value = table.Column(maxLength: 196, nullable: false), + Type = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 4000, nullable: false), ApiResourceId = table.Column(nullable: false), - Description = table.Column(maxLength: 256, nullable: true), + Description = table.Column(maxLength: 2000, nullable: true), Expiration = table.Column(nullable: true) }, constraints: table => @@ -613,7 +613,7 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { ClientId = table.Column(nullable: false), - GrantType = table.Column(maxLength: 196, nullable: false) + GrantType = table.Column(maxLength: 250, nullable: false) }, constraints: table => { @@ -631,7 +631,7 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { ClientId = table.Column(nullable: false), - Provider = table.Column(maxLength: 64, nullable: false) + Provider = table.Column(maxLength: 200, nullable: false) }, constraints: table => { @@ -649,7 +649,7 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { ClientId = table.Column(nullable: false), - PostLogoutRedirectUri = table.Column(maxLength: 200, nullable: false) + PostLogoutRedirectUri = table.Column(maxLength: 2000, nullable: false) }, constraints: table => { @@ -667,8 +667,8 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { ClientId = table.Column(nullable: false), - Key = table.Column(maxLength: 64, nullable: false), - Value = table.Column(maxLength: 128, nullable: false) + Key = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 2000, nullable: false) }, constraints: table => { @@ -686,7 +686,7 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { ClientId = table.Column(nullable: false), - RedirectUri = table.Column(maxLength: 200, nullable: false) + RedirectUri = table.Column(maxLength: 2000, nullable: false) }, constraints: table => { @@ -704,7 +704,7 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { ClientId = table.Column(nullable: false), - Scope = table.Column(maxLength: 196, nullable: false) + Scope = table.Column(maxLength: 200, nullable: false) }, constraints: table => { @@ -721,10 +721,10 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerClientSecrets", columns: table => new { - Type = table.Column(maxLength: 32, nullable: false), - Value = table.Column(maxLength: 196, nullable: false), + Type = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 4000, nullable: false), ClientId = table.Column(nullable: false), - Description = table.Column(maxLength: 256, nullable: true), + Description = table.Column(maxLength: 2000, nullable: true), Expiration = table.Column(nullable: true) }, constraints: table => @@ -742,7 +742,7 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerIdentityClaims", columns: table => new { - Type = table.Column(maxLength: 196, nullable: false), + Type = table.Column(maxLength: 200, nullable: false), IdentityResourceId = table.Column(nullable: false) }, constraints: table => @@ -783,9 +783,9 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerApiScopeClaims", columns: table => new { - Type = table.Column(maxLength: 196, nullable: false), + Type = table.Column(maxLength: 200, nullable: false), ApiResourceId = table.Column(nullable: false), - Name = table.Column(maxLength: 196, nullable: false) + Name = table.Column(maxLength: 200, nullable: false) }, constraints: table => { @@ -909,6 +909,11 @@ namespace MyCompanyName.MyProjectName.Migrations table: "IdentityServerClients", column: "ClientId"); + migrationBuilder.CreateIndex( + name: "IX_IdentityServerPersistedGrants_Expiration", + table: "IdentityServerPersistedGrants", + column: "Expiration"); + migrationBuilder.CreateIndex( name: "IX_IdentityServerPersistedGrants_SubjectId_ClientId_Type", table: "IdentityServerPersistedGrants", diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs index 27c0c3e5b1..a785cd3b14 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs @@ -15,7 +15,7 @@ namespace MyCompanyName.MyProjectName.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0-preview9.19423.6") + .HasAnnotation("ProductVersion", "3.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); @@ -791,8 +791,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(196)") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ApiResourceId", "Type"); @@ -805,16 +805,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Name") - .HasColumnType("nvarchar(196)") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("Description") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); b.Property("DisplayName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("Emphasize") .HasColumnType("bit"); @@ -836,12 +836,12 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Name") - .HasColumnType("nvarchar(196)") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("Type") - .HasColumnType("nvarchar(196)") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ApiResourceId", "Name", "Type"); @@ -854,16 +854,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(32)") - .HasMaxLength(32); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") - .HasColumnType("nvarchar(196)") - .HasMaxLength(196); + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); b.Property("Description") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("Expiration") .HasColumnType("datetime2"); @@ -913,8 +913,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("BackChannelLogoutUri") - .HasColumnType("nvarchar(300)") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("ClientClaimsPrefix") .HasColumnType("nvarchar(200)") @@ -930,8 +930,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(200); b.Property("ClientUri") - .HasColumnType("nvarchar(300)") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("ConcurrencyStamp") .IsConcurrencyToken() @@ -978,8 +978,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("bit"); b.Property("FrontChannelLogoutUri") - .HasColumnType("nvarchar(300)") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("IdentityTokenLifetime") .HasColumnType("int"); @@ -1002,8 +1002,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("LogoUri") - .HasColumnType("nvarchar(300)") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("PairWiseSubjectSalt") .HasColumnType("nvarchar(200)") @@ -1087,8 +1087,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("GrantType") - .HasColumnType("nvarchar(196)") - .HasMaxLength(196); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.HasKey("ClientId", "GrantType"); @@ -1101,8 +1101,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Provider") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ClientId", "Provider"); @@ -1115,8 +1115,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("PostLogoutRedirectUri") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "PostLogoutRedirectUri"); @@ -1129,13 +1129,13 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Key") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "Key"); @@ -1148,8 +1148,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("RedirectUri") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "RedirectUri"); @@ -1162,8 +1162,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Scope") - .HasColumnType("nvarchar(196)") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ClientId", "Scope"); @@ -1176,16 +1176,16 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(32)") - .HasMaxLength(32); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") - .HasColumnType("nvarchar(196)") - .HasMaxLength(196); + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); b.Property("Description") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("Expiration") .HasColumnType("datetime2"); @@ -1213,7 +1213,9 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("datetime2"); b.Property("Data") - .HasColumnType("nvarchar(max)"); + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(5000); b.Property("Expiration") .HasColumnType("datetime2"); @@ -1236,6 +1238,8 @@ namespace MyCompanyName.MyProjectName.Migrations b.HasKey("Key"); + b.HasIndex("Expiration"); + b.HasIndex("SubjectId", "ClientId", "Type"); b.ToTable("IdentityServerPersistedGrants"); @@ -1247,8 +1251,8 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasColumnType("nvarchar(196)") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("IdentityResourceId", "Type"); diff --git a/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20190816095643_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20191010024800_Initial.Designer.cs similarity index 56% rename from samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20190816095643_Initial.Designer.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20191010024800_Initial.Designer.cs index 7c0ee10397..daa15fde16 100644 --- a/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20190816095643_Initial.Designer.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20191010024800_Initial.Designer.cs @@ -1,100 +1,122 @@ // using System; -using DashboardDemo.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using MyCompanyName.MyProjectName.EntityFrameworkCore; -namespace DashboardDemo.Migrations +namespace MyCompanyName.MyProjectName.Migrations { - [DbContext(typeof(DashboardDemoMigrationsDbContext))] - [Migration("20190816095643_Initial")] + [DbContext(typeof(IdentityServerHostMigrationsDbContext))] + [Migration("20191010024800_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.2.6-servicing-10079") + .HasAnnotation("ProductVersion", "3.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ApplicationName") .HasColumnName("ApplicationName") + .HasColumnType("nvarchar(96)") .HasMaxLength(96); b.Property("BrowserInfo") .HasColumnName("BrowserInfo") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("ClientId") .HasColumnName("ClientId") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ClientIpAddress") .HasColumnName("ClientIpAddress") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ClientName") .HasColumnName("ClientName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("Comments") .HasColumnName("Comments") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("ConcurrencyStamp"); + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CorrelationId") .HasColumnName("CorrelationId") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Exceptions") .HasColumnName("Exceptions") + .HasColumnType("nvarchar(4000)") .HasMaxLength(4000); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration"); + .HasColumnName("ExecutionDuration") + .HasColumnType("int"); - b.Property("ExecutionTime"); + b.Property("ExecutionTime") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("HttpMethod") .HasColumnName("HttpMethod") + .HasColumnType("nvarchar(16)") .HasMaxLength(16); b.Property("HttpStatusCode") - .HasColumnName("HttpStatusCode"); + .HasColumnName("HttpStatusCode") + .HasColumnType("int"); b.Property("ImpersonatorTenantId") - .HasColumnName("ImpersonatorTenantId"); + .HasColumnName("ImpersonatorTenantId") + .HasColumnType("uniqueidentifier"); b.Property("ImpersonatorUserId") - .HasColumnName("ImpersonatorUserId"); + .HasColumnName("ImpersonatorUserId") + .HasColumnType("uniqueidentifier"); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantName"); + b.Property("TenantName") + .HasColumnType("nvarchar(max)"); b.Property("Url") .HasColumnName("Url") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("UserId") - .HasColumnName("UserId"); + .HasColumnName("UserId") + .HasColumnType("uniqueidentifier"); b.Property("UserName") .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -109,33 +131,42 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId"); + .HasColumnName("AuditLogId") + .HasColumnType("uniqueidentifier"); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration"); + .HasColumnName("ExecutionDuration") + .HasColumnType("int"); b.Property("ExecutionTime") - .HasColumnName("ExecutionTime"); + .HasColumnName("ExecutionTime") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("MethodName") .HasColumnName("MethodName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("Parameters") .HasColumnName("Parameters") + .HasColumnType("nvarchar(2000)") .HasMaxLength(2000); b.Property("ServiceName") .HasColumnName("ServiceName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -149,34 +180,43 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId"); + .HasColumnName("AuditLogId") + .HasColumnType("uniqueidentifier"); b.Property("ChangeTime") - .HasColumnName("ChangeTime"); + .HasColumnName("ChangeTime") + .HasColumnType("datetime2"); b.Property("ChangeType") - .HasColumnName("ChangeType"); + .HasColumnName("ChangeType") + .HasColumnType("tinyint"); b.Property("EntityId") .IsRequired() .HasColumnName("EntityId") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("EntityTenantId"); + b.Property("EntityTenantId") + .HasColumnType("uniqueidentifier"); b.Property("EntityTypeFullName") .IsRequired() .HasColumnName("EntityTypeFullName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -190,29 +230,36 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); - b.Property("EntityChangeId"); + b.Property("EntityChangeId") + .HasColumnType("uniqueidentifier"); b.Property("NewValue") .HasColumnName("NewValue") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("OriginalValue") .HasColumnName("OriginalValue") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("PropertyName") .IsRequired() .HasColumnName("PropertyName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("PropertyTypeFullName") .IsRequired() .HasColumnName("PropertyTypeFullName") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -221,108 +268,48 @@ namespace DashboardDemo.Migrations b.ToTable("AbpEntityPropertyChanges"); }); - modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ConcurrencyStamp"); - - b.Property("CreationTime") - .HasColumnName("CreationTime"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); - - b.Property("IsAbandoned") - .ValueGeneratedOnAdd() - .HasDefaultValue(false); - - b.Property("JobArgs") - .IsRequired() - .HasMaxLength(1048576); - - b.Property("JobName") - .IsRequired() - .HasMaxLength(128); - - b.Property("LastTryTime"); - - b.Property("NextTryTime"); - - b.Property("Priority") - .ValueGeneratedOnAdd() - .HasDefaultValue((byte)15); - - b.Property("TryCount") - .ValueGeneratedOnAdd() - .HasDefaultValue((short)0); - - b.HasKey("Id"); - - b.HasIndex("IsAbandoned", "NextTryTime"); - - b.ToTable("AbpBackgroundJobs"); - }); - - modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128); - - b.Property("ProviderKey") - .HasMaxLength(64); - - b.Property("ProviderName") - .HasMaxLength(64); - - b.Property("Value") - .IsRequired() - .HasMaxLength(128); - - b.HasKey("Id"); - - b.HasIndex("Name", "ProviderName", "ProviderKey"); - - b.ToTable("AbpFeatureValues"); - }); - modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .IsRequired() .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Description") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("IsStatic"); + b.Property("IsStatic") + .HasColumnType("bit"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Regex") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("RegexDescription") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ValueType"); + b.Property("ValueType") + .HasColumnType("int"); b.HasKey("Id"); @@ -332,35 +319,44 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .IsRequired() .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDefault") - .HasColumnName("IsDefault"); + .HasColumnName("IsDefault") + .HasColumnType("bit"); b.Property("IsPublic") - .HasColumnName("IsPublic"); + .HasColumnName("IsPublic") + .HasColumnType("bit"); b.Property("IsStatic") - .HasColumnName("IsStatic"); + .HasColumnName("IsStatic") + .HasColumnType("bit"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedName") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -372,18 +368,22 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("uniqueidentifier"); b.Property("ClaimType") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -395,105 +395,131 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AccessFailedCount") .ValueGeneratedOnAdd() .HasColumnName("AccessFailedCount") + .HasColumnType("int") .HasDefaultValue(0); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Email") .HasColumnName("Email") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("EmailConfirmed") .ValueGeneratedOnAdd() .HasColumnName("EmailConfirmed") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnName("LockoutEnabled") + .HasColumnType("bit") .HasDefaultValue(false); - b.Property("LockoutEnd"); + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); b.Property("Name") .HasColumnName("Name") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("NormalizedEmail") .HasColumnName("NormalizedEmail") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedUserName") .IsRequired() .HasColumnName("NormalizedUserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("PasswordHash") .HasColumnName("PasswordHash") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("PhoneNumber") .HasColumnName("PhoneNumber") + .HasColumnType("nvarchar(16)") .HasMaxLength(16); b.Property("PhoneNumberConfirmed") .ValueGeneratedOnAdd() .HasColumnName("PhoneNumberConfirmed") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("SecurityStamp") .IsRequired() .HasColumnName("SecurityStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Surname") .HasColumnName("Surname") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); b.Property("TwoFactorEnabled") .ValueGeneratedOnAdd() .HasColumnName("TwoFactorEnabled") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("UserName") .IsRequired() .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -512,18 +538,22 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("uniqueidentifier"); b.Property("ClaimType") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -534,19 +564,24 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") .IsRequired() + .HasColumnType("nvarchar(196)") .HasMaxLength(196); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("UserId", "LoginProvider"); @@ -557,11 +592,14 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("UserId", "RoleId"); @@ -572,17 +610,22 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Name") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("Value"); + b.Property("Value") + .HasColumnType("nvarchar(max)"); b.HasKey("UserId", "LoginProvider", "Name"); @@ -592,51 +635,66 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Description") + .HasColumnType("nvarchar(1000)") .HasMaxLength(1000); b.Property("DisplayName") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Properties"); + b.Property("Properties") + .HasColumnType("nvarchar(max)"); b.HasKey("Id"); @@ -645,10 +703,12 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ApiResourceId", "Type"); @@ -657,22 +717,29 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Name") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("Description") - .HasMaxLength(256); + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); b.Property("DisplayName") - .HasMaxLength(128); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); - b.Property("Emphasize"); + b.Property("Emphasize") + .HasColumnType("bit"); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ShowInDiscoveryDocument"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); b.HasKey("ApiResourceId", "Name"); @@ -681,13 +748,16 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Name") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("Type") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ApiResourceId", "Name", "Type"); @@ -696,18 +766,23 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(32); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") - .HasMaxLength(196); + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); b.Property("Description") - .HasMaxLength(256); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.HasKey("ApiResourceId", "Type", "Value"); @@ -717,141 +792,190 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); - b.Property("AbsoluteRefreshTokenLifetime"); + b.Property("AbsoluteRefreshTokenLifetime") + .HasColumnType("int"); - b.Property("AccessTokenLifetime"); + b.Property("AccessTokenLifetime") + .HasColumnType("int"); - b.Property("AccessTokenType"); + b.Property("AccessTokenType") + .HasColumnType("int"); - b.Property("AllowAccessTokensViaBrowser"); + b.Property("AllowAccessTokensViaBrowser") + .HasColumnType("bit"); - b.Property("AllowOfflineAccess"); + b.Property("AllowOfflineAccess") + .HasColumnType("bit"); - b.Property("AllowPlainTextPkce"); + b.Property("AllowPlainTextPkce") + .HasColumnType("bit"); - b.Property("AllowRememberConsent"); + b.Property("AllowRememberConsent") + .HasColumnType("bit"); - b.Property("AlwaysIncludeUserClaimsInIdToken"); + b.Property("AlwaysIncludeUserClaimsInIdToken") + .HasColumnType("bit"); - b.Property("AlwaysSendClientClaims"); + b.Property("AlwaysSendClientClaims") + .HasColumnType("bit"); - b.Property("AuthorizationCodeLifetime"); + b.Property("AuthorizationCodeLifetime") + .HasColumnType("int"); - b.Property("BackChannelLogoutSessionRequired"); + b.Property("BackChannelLogoutSessionRequired") + .HasColumnType("bit"); b.Property("BackChannelLogoutUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("ClientClaimsPrefix") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientName") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); - b.Property("ConsentLifetime"); + b.Property("ConsentLifetime") + .HasColumnType("int"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Description") + .HasColumnType("nvarchar(1000)") .HasMaxLength(1000); - b.Property("DeviceCodeLifetime"); + b.Property("DeviceCodeLifetime") + .HasColumnType("int"); - b.Property("EnableLocalLogin"); + b.Property("EnableLocalLogin") + .HasColumnType("bit"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("FrontChannelLogoutSessionRequired"); + b.Property("FrontChannelLogoutSessionRequired") + .HasColumnType("bit"); b.Property("FrontChannelLogoutUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); - b.Property("IdentityTokenLifetime"); + b.Property("IdentityTokenLifetime") + .HasColumnType("int"); - b.Property("IncludeJwtId"); + b.Property("IncludeJwtId") + .HasColumnType("bit"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("LogoUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("PairWiseSubjectSalt") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ProtocolType") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("RefreshTokenExpiration"); + b.Property("RefreshTokenExpiration") + .HasColumnType("int"); - b.Property("RefreshTokenUsage"); + b.Property("RefreshTokenUsage") + .HasColumnType("int"); - b.Property("RequireClientSecret"); + b.Property("RequireClientSecret") + .HasColumnType("bit"); - b.Property("RequireConsent"); + b.Property("RequireConsent") + .HasColumnType("bit"); - b.Property("RequirePkce"); + b.Property("RequirePkce") + .HasColumnType("bit"); - b.Property("SlidingRefreshTokenLifetime"); + b.Property("SlidingRefreshTokenLifetime") + .HasColumnType("int"); - b.Property("UpdateAccessTokenClaimsOnRefresh"); + b.Property("UpdateAccessTokenClaimsOnRefresh") + .HasColumnType("bit"); b.Property("UserCodeType") + .HasColumnType("nvarchar(100)") .HasMaxLength(100); - b.Property("UserSsoLifetime"); + b.Property("UserSsoLifetime") + .HasColumnType("int"); b.HasKey("Id"); - b.HasIndex("ClientId") - .IsUnique(); + b.HasIndex("ClientId"); b.ToTable("IdentityServerClients"); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Type") + .HasColumnType("nvarchar(250)") .HasMaxLength(250); b.Property("Value") + .HasColumnType("nvarchar(250)") .HasMaxLength(250); b.HasKey("ClientId", "Type", "Value"); @@ -861,9 +985,11 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Origin") + .HasColumnType("nvarchar(150)") .HasMaxLength(150); b.HasKey("ClientId", "Origin"); @@ -873,10 +999,12 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("GrantType") - .HasMaxLength(196); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.HasKey("ClientId", "GrantType"); @@ -885,10 +1013,12 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Provider") - .HasMaxLength(64); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ClientId", "Provider"); @@ -897,10 +1027,12 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("PostLogoutRedirectUri") - .HasMaxLength(200); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "PostLogoutRedirectUri"); @@ -909,14 +1041,17 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Key") - .HasMaxLength(64); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") .IsRequired() - .HasMaxLength(128); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "Key"); @@ -925,10 +1060,12 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("RedirectUri") - .HasMaxLength(200); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "RedirectUri"); @@ -937,10 +1074,12 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Scope") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ClientId", "Scope"); @@ -949,18 +1088,23 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(32); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") - .HasMaxLength(196); + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); b.Property("Description") - .HasMaxLength(256); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.HasKey("ClientId", "Type", "Value"); @@ -970,35 +1114,48 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("ConcurrencyStamp"); + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("datetime2"); b.Property("Data") - .IsRequired(); + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(5000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("Id"); + b.Property("Id") + .HasColumnType("uniqueidentifier"); b.Property("SubjectId") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("Type") .IsRequired() + .HasColumnType("nvarchar(50)") .HasMaxLength(50); b.HasKey("Key"); + b.HasIndex("Expiration"); + b.HasIndex("SubjectId", "ClientId", "Type"); b.ToTable("IdentityServerPersistedGrants"); @@ -1006,10 +1163,12 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => { - b.Property("IdentityResourceId"); + b.Property("IdentityResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("IdentityResourceId", "Type"); @@ -1019,57 +1178,75 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Description") + .HasColumnType("nvarchar(1000)") .HasMaxLength(1000); b.Property("DisplayName") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Emphasize"); + b.Property("Emphasize") + .HasColumnType("bit"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Properties"); + b.Property("Properties") + .HasColumnType("nvarchar(max)"); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ShowInDiscoveryDocument"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); b.HasKey("Id"); @@ -1079,21 +1256,26 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderName") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -1105,20 +1287,25 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderName") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Value") .IsRequired() + .HasColumnType("nvarchar(2048)") .HasMaxLength(2048); b.HasKey("Id"); @@ -1131,40 +1318,51 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.HasKey("Id"); @@ -1177,13 +1375,16 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => { - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.Property("Name") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Value") .IsRequired() + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); b.HasKey("TenantId", "Name"); @@ -1193,191 +1394,215 @@ namespace DashboardDemo.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => { - b.HasOne("Volo.Abp.AuditLogging.AuditLog") + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) .WithMany("Actions") .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => { - b.HasOne("Volo.Abp.AuditLogging.AuditLog") + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) .WithMany("EntityChanges") .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => { - b.HasOne("Volo.Abp.AuditLogging.EntityChange") + b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) .WithMany("PropertyChanges") .HasForeignKey("EntityChangeId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => { - b.HasOne("Volo.Abp.Identity.IdentityRole") + b.HasOne("Volo.Abp.Identity.IdentityRole", null) .WithMany("Claims") .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Claims") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Logins") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { - b.HasOne("Volo.Abp.Identity.IdentityRole") + b.HasOne("Volo.Abp.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Roles") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Tokens") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("UserClaims") .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("Scopes") .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope", null) .WithMany("UserClaims") .HasForeignKey("ApiResourceId", "Name") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("Secrets") .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("Claims") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("AllowedCorsOrigins") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("AllowedGrantTypes") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("IdentityProviderRestrictions") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("PostLogoutRedirectUris") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("Properties") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("RedirectUris") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("AllowedScopes") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("ClientSecrets") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource") + b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) .WithMany("UserClaims") .HasForeignKey("IdentityResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => { - b.HasOne("Volo.Abp.TenantManagement.Tenant") + b.HasOne("Volo.Abp.TenantManagement.Tenant", null) .WithMany("ConnectionStrings") .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); #pragma warning restore 612, 618 } diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20190816093449_Initial.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20191010024800_Initial.cs similarity index 96% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20190816093449_Initial.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20191010024800_Initial.cs index c81fbc2f22..e2410a1d55 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20190816093449_Initial.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20191010024800_Initial.cs @@ -207,8 +207,8 @@ namespace MyCompanyName.MyProjectName.Migrations ClientId = table.Column(maxLength: 200, nullable: false), ClientName = table.Column(maxLength: 200, nullable: true), Description = table.Column(maxLength: 1000, nullable: true), - ClientUri = table.Column(maxLength: 300, nullable: true), - LogoUri = table.Column(maxLength: 300, nullable: true), + ClientUri = table.Column(maxLength: 2000, nullable: true), + LogoUri = table.Column(maxLength: 2000, nullable: true), Enabled = table.Column(nullable: false), ProtocolType = table.Column(maxLength: 200, nullable: false), RequireClientSecret = table.Column(nullable: false), @@ -218,9 +218,9 @@ namespace MyCompanyName.MyProjectName.Migrations RequirePkce = table.Column(nullable: false), AllowPlainTextPkce = table.Column(nullable: false), AllowAccessTokensViaBrowser = table.Column(nullable: false), - FrontChannelLogoutUri = table.Column(maxLength: 300, nullable: true), + FrontChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), FrontChannelLogoutSessionRequired = table.Column(nullable: false), - BackChannelLogoutUri = table.Column(maxLength: 300, nullable: true), + BackChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), BackChannelLogoutSessionRequired = table.Column(nullable: false), AllowOfflineAccess = table.Column(nullable: false), IdentityTokenLifetime = table.Column(nullable: false), @@ -288,7 +288,7 @@ namespace MyCompanyName.MyProjectName.Migrations ClientId = table.Column(maxLength: 200, nullable: false), CreationTime = table.Column(nullable: false), Expiration = table.Column(nullable: true), - Data = table.Column(nullable: false) + Data = table.Column(maxLength: 5000, nullable: false) }, constraints: table => { @@ -477,7 +477,7 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerApiClaims", columns: table => new { - Type = table.Column(maxLength: 196, nullable: false), + Type = table.Column(maxLength: 200, nullable: false), ApiResourceId = table.Column(nullable: false) }, constraints: table => @@ -496,9 +496,9 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { ApiResourceId = table.Column(nullable: false), - Name = table.Column(maxLength: 196, nullable: false), - DisplayName = table.Column(maxLength: 128, nullable: true), - Description = table.Column(maxLength: 256, nullable: true), + Name = table.Column(maxLength: 200, nullable: false), + DisplayName = table.Column(maxLength: 200, nullable: true), + Description = table.Column(maxLength: 1000, nullable: true), Required = table.Column(nullable: false), Emphasize = table.Column(nullable: false), ShowInDiscoveryDocument = table.Column(nullable: false) @@ -518,10 +518,10 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerApiSecrets", columns: table => new { - Type = table.Column(maxLength: 32, nullable: false), - Value = table.Column(maxLength: 196, nullable: false), + Type = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 4000, nullable: false), ApiResourceId = table.Column(nullable: false), - Description = table.Column(maxLength: 256, nullable: true), + Description = table.Column(maxLength: 2000, nullable: true), Expiration = table.Column(nullable: true) }, constraints: table => @@ -577,7 +577,7 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { ClientId = table.Column(nullable: false), - GrantType = table.Column(maxLength: 196, nullable: false) + GrantType = table.Column(maxLength: 250, nullable: false) }, constraints: table => { @@ -595,7 +595,7 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { ClientId = table.Column(nullable: false), - Provider = table.Column(maxLength: 64, nullable: false) + Provider = table.Column(maxLength: 200, nullable: false) }, constraints: table => { @@ -613,7 +613,7 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { ClientId = table.Column(nullable: false), - PostLogoutRedirectUri = table.Column(maxLength: 200, nullable: false) + PostLogoutRedirectUri = table.Column(maxLength: 2000, nullable: false) }, constraints: table => { @@ -631,8 +631,8 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { ClientId = table.Column(nullable: false), - Key = table.Column(maxLength: 64, nullable: false), - Value = table.Column(maxLength: 128, nullable: false) + Key = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 2000, nullable: false) }, constraints: table => { @@ -650,7 +650,7 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { ClientId = table.Column(nullable: false), - RedirectUri = table.Column(maxLength: 200, nullable: false) + RedirectUri = table.Column(maxLength: 2000, nullable: false) }, constraints: table => { @@ -668,7 +668,7 @@ namespace MyCompanyName.MyProjectName.Migrations columns: table => new { ClientId = table.Column(nullable: false), - Scope = table.Column(maxLength: 196, nullable: false) + Scope = table.Column(maxLength: 200, nullable: false) }, constraints: table => { @@ -685,10 +685,10 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerClientSecrets", columns: table => new { - Type = table.Column(maxLength: 32, nullable: false), - Value = table.Column(maxLength: 196, nullable: false), + Type = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 4000, nullable: false), ClientId = table.Column(nullable: false), - Description = table.Column(maxLength: 256, nullable: true), + Description = table.Column(maxLength: 2000, nullable: true), Expiration = table.Column(nullable: true) }, constraints: table => @@ -706,7 +706,7 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerIdentityClaims", columns: table => new { - Type = table.Column(maxLength: 196, nullable: false), + Type = table.Column(maxLength: 200, nullable: false), IdentityResourceId = table.Column(nullable: false) }, constraints: table => @@ -747,9 +747,9 @@ namespace MyCompanyName.MyProjectName.Migrations name: "IdentityServerApiScopeClaims", columns: table => new { - Type = table.Column(maxLength: 196, nullable: false), + Type = table.Column(maxLength: 200, nullable: false), ApiResourceId = table.Column(nullable: false), - Name = table.Column(maxLength: 196, nullable: false) + Name = table.Column(maxLength: 200, nullable: false) }, constraints: table => { @@ -861,8 +861,12 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.CreateIndex( name: "IX_IdentityServerClients_ClientId", table: "IdentityServerClients", - column: "ClientId", - unique: true); + column: "ClientId"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerPersistedGrants_Expiration", + table: "IdentityServerPersistedGrants", + column: "Expiration"); migrationBuilder.CreateIndex( name: "IX_IdentityServerPersistedGrants_SubjectId_ClientId_Type", diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs index 9280659e47..a140220ce0 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs @@ -15,84 +15,106 @@ namespace MyCompanyName.MyProjectName.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.2.6-servicing-10079") + .HasAnnotation("ProductVersion", "3.0.0") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ApplicationName") .HasColumnName("ApplicationName") + .HasColumnType("nvarchar(96)") .HasMaxLength(96); b.Property("BrowserInfo") .HasColumnName("BrowserInfo") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("ClientId") .HasColumnName("ClientId") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ClientIpAddress") .HasColumnName("ClientIpAddress") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ClientName") .HasColumnName("ClientName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("Comments") .HasColumnName("Comments") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("ConcurrencyStamp"); + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CorrelationId") .HasColumnName("CorrelationId") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Exceptions") .HasColumnName("Exceptions") + .HasColumnType("nvarchar(4000)") .HasMaxLength(4000); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration"); + .HasColumnName("ExecutionDuration") + .HasColumnType("int"); - b.Property("ExecutionTime"); + b.Property("ExecutionTime") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("HttpMethod") .HasColumnName("HttpMethod") + .HasColumnType("nvarchar(16)") .HasMaxLength(16); b.Property("HttpStatusCode") - .HasColumnName("HttpStatusCode"); + .HasColumnName("HttpStatusCode") + .HasColumnType("int"); b.Property("ImpersonatorTenantId") - .HasColumnName("ImpersonatorTenantId"); + .HasColumnName("ImpersonatorTenantId") + .HasColumnType("uniqueidentifier"); b.Property("ImpersonatorUserId") - .HasColumnName("ImpersonatorUserId"); + .HasColumnName("ImpersonatorUserId") + .HasColumnType("uniqueidentifier"); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantName"); + b.Property("TenantName") + .HasColumnType("nvarchar(max)"); b.Property("Url") .HasColumnName("Url") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("UserId") - .HasColumnName("UserId"); + .HasColumnName("UserId") + .HasColumnType("uniqueidentifier"); b.Property("UserName") .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -107,33 +129,42 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId"); + .HasColumnName("AuditLogId") + .HasColumnType("uniqueidentifier"); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration"); + .HasColumnName("ExecutionDuration") + .HasColumnType("int"); b.Property("ExecutionTime") - .HasColumnName("ExecutionTime"); + .HasColumnName("ExecutionTime") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("MethodName") .HasColumnName("MethodName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("Parameters") .HasColumnName("Parameters") + .HasColumnType("nvarchar(2000)") .HasMaxLength(2000); b.Property("ServiceName") .HasColumnName("ServiceName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -147,34 +178,43 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId"); + .HasColumnName("AuditLogId") + .HasColumnType("uniqueidentifier"); b.Property("ChangeTime") - .HasColumnName("ChangeTime"); + .HasColumnName("ChangeTime") + .HasColumnType("datetime2"); b.Property("ChangeType") - .HasColumnName("ChangeType"); + .HasColumnName("ChangeType") + .HasColumnType("tinyint"); b.Property("EntityId") .IsRequired() .HasColumnName("EntityId") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("EntityTenantId"); + b.Property("EntityTenantId") + .HasColumnType("uniqueidentifier"); b.Property("EntityTypeFullName") .IsRequired() .HasColumnName("EntityTypeFullName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -188,29 +228,36 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); - b.Property("EntityChangeId"); + b.Property("EntityChangeId") + .HasColumnType("uniqueidentifier"); b.Property("NewValue") .HasColumnName("NewValue") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("OriginalValue") .HasColumnName("OriginalValue") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("PropertyName") .IsRequired() .HasColumnName("PropertyName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("PropertyTypeFullName") .IsRequired() .HasColumnName("PropertyTypeFullName") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -222,35 +269,45 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .IsRequired() .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Description") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("IsStatic"); + b.Property("IsStatic") + .HasColumnType("bit"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Regex") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("RegexDescription") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ValueType"); + b.Property("ValueType") + .HasColumnType("int"); b.HasKey("Id"); @@ -260,35 +317,44 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .IsRequired() .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDefault") - .HasColumnName("IsDefault"); + .HasColumnName("IsDefault") + .HasColumnType("bit"); b.Property("IsPublic") - .HasColumnName("IsPublic"); + .HasColumnName("IsPublic") + .HasColumnType("bit"); b.Property("IsStatic") - .HasColumnName("IsStatic"); + .HasColumnName("IsStatic") + .HasColumnType("bit"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedName") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -300,18 +366,22 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("uniqueidentifier"); b.Property("ClaimType") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -323,105 +393,131 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AccessFailedCount") .ValueGeneratedOnAdd() .HasColumnName("AccessFailedCount") + .HasColumnType("int") .HasDefaultValue(0); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Email") .HasColumnName("Email") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("EmailConfirmed") .ValueGeneratedOnAdd() .HasColumnName("EmailConfirmed") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnName("LockoutEnabled") + .HasColumnType("bit") .HasDefaultValue(false); - b.Property("LockoutEnd"); + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); b.Property("Name") .HasColumnName("Name") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("NormalizedEmail") .HasColumnName("NormalizedEmail") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedUserName") .IsRequired() .HasColumnName("NormalizedUserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("PasswordHash") .HasColumnName("PasswordHash") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("PhoneNumber") .HasColumnName("PhoneNumber") + .HasColumnType("nvarchar(16)") .HasMaxLength(16); b.Property("PhoneNumberConfirmed") .ValueGeneratedOnAdd() .HasColumnName("PhoneNumberConfirmed") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("SecurityStamp") .IsRequired() .HasColumnName("SecurityStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Surname") .HasColumnName("Surname") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); b.Property("TwoFactorEnabled") .ValueGeneratedOnAdd() .HasColumnName("TwoFactorEnabled") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("UserName") .IsRequired() .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -440,18 +536,22 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("uniqueidentifier"); b.Property("ClaimType") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -462,19 +562,24 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") .IsRequired() + .HasColumnType("nvarchar(196)") .HasMaxLength(196); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("UserId", "LoginProvider"); @@ -485,11 +590,14 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("UserId", "RoleId"); @@ -500,17 +608,22 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Name") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("Value"); + b.Property("Value") + .HasColumnType("nvarchar(max)"); b.HasKey("UserId", "LoginProvider", "Name"); @@ -520,51 +633,66 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Description") + .HasColumnType("nvarchar(1000)") .HasMaxLength(1000); b.Property("DisplayName") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Properties"); + b.Property("Properties") + .HasColumnType("nvarchar(max)"); b.HasKey("Id"); @@ -573,10 +701,12 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ApiResourceId", "Type"); @@ -585,22 +715,29 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Name") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("Description") - .HasMaxLength(256); + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); b.Property("DisplayName") - .HasMaxLength(128); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); - b.Property("Emphasize"); + b.Property("Emphasize") + .HasColumnType("bit"); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ShowInDiscoveryDocument"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); b.HasKey("ApiResourceId", "Name"); @@ -609,13 +746,16 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Name") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.Property("Type") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ApiResourceId", "Name", "Type"); @@ -624,18 +764,23 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => { - b.Property("ApiResourceId"); + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(32); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") - .HasMaxLength(196); + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); b.Property("Description") - .HasMaxLength(256); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.HasKey("ApiResourceId", "Type", "Value"); @@ -645,141 +790,190 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); - b.Property("AbsoluteRefreshTokenLifetime"); + b.Property("AbsoluteRefreshTokenLifetime") + .HasColumnType("int"); - b.Property("AccessTokenLifetime"); + b.Property("AccessTokenLifetime") + .HasColumnType("int"); - b.Property("AccessTokenType"); + b.Property("AccessTokenType") + .HasColumnType("int"); - b.Property("AllowAccessTokensViaBrowser"); + b.Property("AllowAccessTokensViaBrowser") + .HasColumnType("bit"); - b.Property("AllowOfflineAccess"); + b.Property("AllowOfflineAccess") + .HasColumnType("bit"); - b.Property("AllowPlainTextPkce"); + b.Property("AllowPlainTextPkce") + .HasColumnType("bit"); - b.Property("AllowRememberConsent"); + b.Property("AllowRememberConsent") + .HasColumnType("bit"); - b.Property("AlwaysIncludeUserClaimsInIdToken"); + b.Property("AlwaysIncludeUserClaimsInIdToken") + .HasColumnType("bit"); - b.Property("AlwaysSendClientClaims"); + b.Property("AlwaysSendClientClaims") + .HasColumnType("bit"); - b.Property("AuthorizationCodeLifetime"); + b.Property("AuthorizationCodeLifetime") + .HasColumnType("int"); - b.Property("BackChannelLogoutSessionRequired"); + b.Property("BackChannelLogoutSessionRequired") + .HasColumnType("bit"); b.Property("BackChannelLogoutUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("ClientClaimsPrefix") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientName") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); - b.Property("ConsentLifetime"); + b.Property("ConsentLifetime") + .HasColumnType("int"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Description") + .HasColumnType("nvarchar(1000)") .HasMaxLength(1000); - b.Property("DeviceCodeLifetime"); + b.Property("DeviceCodeLifetime") + .HasColumnType("int"); - b.Property("EnableLocalLogin"); + b.Property("EnableLocalLogin") + .HasColumnType("bit"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("FrontChannelLogoutSessionRequired"); + b.Property("FrontChannelLogoutSessionRequired") + .HasColumnType("bit"); b.Property("FrontChannelLogoutUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); - b.Property("IdentityTokenLifetime"); + b.Property("IdentityTokenLifetime") + .HasColumnType("int"); - b.Property("IncludeJwtId"); + b.Property("IncludeJwtId") + .HasColumnType("bit"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("LogoUri") - .HasMaxLength(300); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.Property("PairWiseSubjectSalt") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ProtocolType") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("RefreshTokenExpiration"); + b.Property("RefreshTokenExpiration") + .HasColumnType("int"); - b.Property("RefreshTokenUsage"); + b.Property("RefreshTokenUsage") + .HasColumnType("int"); - b.Property("RequireClientSecret"); + b.Property("RequireClientSecret") + .HasColumnType("bit"); - b.Property("RequireConsent"); + b.Property("RequireConsent") + .HasColumnType("bit"); - b.Property("RequirePkce"); + b.Property("RequirePkce") + .HasColumnType("bit"); - b.Property("SlidingRefreshTokenLifetime"); + b.Property("SlidingRefreshTokenLifetime") + .HasColumnType("int"); - b.Property("UpdateAccessTokenClaimsOnRefresh"); + b.Property("UpdateAccessTokenClaimsOnRefresh") + .HasColumnType("bit"); b.Property("UserCodeType") + .HasColumnType("nvarchar(100)") .HasMaxLength(100); - b.Property("UserSsoLifetime"); + b.Property("UserSsoLifetime") + .HasColumnType("int"); b.HasKey("Id"); - b.HasIndex("ClientId") - .IsUnique(); + b.HasIndex("ClientId"); b.ToTable("IdentityServerClients"); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Type") + .HasColumnType("nvarchar(250)") .HasMaxLength(250); b.Property("Value") + .HasColumnType("nvarchar(250)") .HasMaxLength(250); b.HasKey("ClientId", "Type", "Value"); @@ -789,9 +983,11 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Origin") + .HasColumnType("nvarchar(150)") .HasMaxLength(150); b.HasKey("ClientId", "Origin"); @@ -801,10 +997,12 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("GrantType") - .HasMaxLength(196); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.HasKey("ClientId", "GrantType"); @@ -813,10 +1011,12 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Provider") - .HasMaxLength(64); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ClientId", "Provider"); @@ -825,10 +1025,12 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("PostLogoutRedirectUri") - .HasMaxLength(200); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "PostLogoutRedirectUri"); @@ -837,14 +1039,17 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Key") - .HasMaxLength(64); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") .IsRequired() - .HasMaxLength(128); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "Key"); @@ -853,10 +1058,12 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("RedirectUri") - .HasMaxLength(200); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); b.HasKey("ClientId", "RedirectUri"); @@ -865,10 +1072,12 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Scope") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("ClientId", "Scope"); @@ -877,18 +1086,23 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => { - b.Property("ClientId"); + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(32); + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); b.Property("Value") - .HasMaxLength(196); + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); b.Property("Description") - .HasMaxLength(256); + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.HasKey("ClientId", "Type", "Value"); @@ -898,35 +1112,48 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("ClientId") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("ConcurrencyStamp"); + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); - b.Property("CreationTime"); + b.Property("CreationTime") + .HasColumnType("datetime2"); b.Property("Data") - .IsRequired(); + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(5000); - b.Property("Expiration"); + b.Property("Expiration") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("Id"); + b.Property("Id") + .HasColumnType("uniqueidentifier"); b.Property("SubjectId") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); b.Property("Type") .IsRequired() + .HasColumnType("nvarchar(50)") .HasMaxLength(50); b.HasKey("Key"); + b.HasIndex("Expiration"); + b.HasIndex("SubjectId", "ClientId", "Type"); b.ToTable("IdentityServerPersistedGrants"); @@ -934,10 +1161,12 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => { - b.Property("IdentityResourceId"); + b.Property("IdentityResourceId") + .HasColumnType("uniqueidentifier"); b.Property("Type") - .HasMaxLength(196); + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); b.HasKey("IdentityResourceId", "Type"); @@ -947,57 +1176,75 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Description") + .HasColumnType("nvarchar(1000)") .HasMaxLength(1000); b.Property("DisplayName") + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Emphasize"); + b.Property("Emphasize") + .HasColumnType("bit"); - b.Property("Enabled"); + b.Property("Enabled") + .HasColumnType("bit"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(200)") .HasMaxLength(200); - b.Property("Properties"); + b.Property("Properties") + .HasColumnType("nvarchar(max)"); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ShowInDiscoveryDocument"); + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); b.HasKey("Id"); @@ -1007,21 +1254,26 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderName") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -1033,20 +1285,25 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderName") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Value") .IsRequired() + .HasColumnType("nvarchar(2048)") .HasMaxLength(2048); b.HasKey("Id"); @@ -1059,40 +1316,51 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.HasKey("Id"); @@ -1105,13 +1373,16 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => { - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.Property("Name") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Value") .IsRequired() + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); b.HasKey("TenantId", "Name"); @@ -1121,191 +1392,215 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => { - b.HasOne("Volo.Abp.AuditLogging.AuditLog") + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) .WithMany("Actions") .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => { - b.HasOne("Volo.Abp.AuditLogging.AuditLog") + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) .WithMany("EntityChanges") .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => { - b.HasOne("Volo.Abp.AuditLogging.EntityChange") + b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) .WithMany("PropertyChanges") .HasForeignKey("EntityChangeId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => { - b.HasOne("Volo.Abp.Identity.IdentityRole") + b.HasOne("Volo.Abp.Identity.IdentityRole", null) .WithMany("Claims") .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Claims") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Logins") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { - b.HasOne("Volo.Abp.Identity.IdentityRole") + b.HasOne("Volo.Abp.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Roles") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Tokens") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("UserClaims") .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("Scopes") .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope", null) .WithMany("UserClaims") .HasForeignKey("ApiResourceId", "Name") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource") + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) .WithMany("Secrets") .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("Claims") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("AllowedCorsOrigins") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("AllowedGrantTypes") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("IdentityProviderRestrictions") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("PostLogoutRedirectUris") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("Properties") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("RedirectUris") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("AllowedScopes") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client") + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) .WithMany("ClientSecrets") .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => { - b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource") + b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) .WithMany("UserClaims") .HasForeignKey("IdentityResourceId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => { - b.HasOne("Volo.Abp.TenantManagement.Tenant") + b.HasOne("Volo.Abp.TenantManagement.Tenant", null) .WithMany("ConnectionStrings") .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); #pragma warning restore 612, 618 } From 52513c9b986bd4e76129076ce845a80bf7b101a5 Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 10 Oct 2019 12:53:46 +0800 Subject: [PATCH 07/62] Make the identity module domain service method virtual. Resolve #1876 --- .../Volo/Abp/Identity/IdentityRoleManager.cs | 2 +- .../Volo/Abp/Identity/IdentityUserManager.cs | 4 ++-- ...IdentityUserRepositoryExternalUserLookupServiceProvider.cs | 4 ++-- .../Volo/Abp/Identity/UserRoleFinder.cs | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleManager.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleManager.cs index c66d501146..92e6d9893c 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleManager.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleManager.cs @@ -39,7 +39,7 @@ namespace Volo.Abp.Identity _cancellationTokenProvider = cancellationTokenProvider; } - public async Task GetByIdAsync(Guid id) + public virtual async Task GetByIdAsync(Guid id) { var role = await Store.FindByIdAsync(id.ToString(), CancellationToken); if (role == null) diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs index dc4b2fe4b2..0f732a8dd7 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs @@ -43,7 +43,7 @@ namespace Volo.Abp.Identity _cancellationTokenProvider = cancellationTokenProvider; } - public async Task GetByIdAsync(Guid id) + public virtual async Task GetByIdAsync(Guid id) { var user = await Store.FindByIdAsync(id.ToString(), CancellationToken); if (user == null) @@ -54,7 +54,7 @@ namespace Volo.Abp.Identity return user; } - public async Task SetRolesAsync([NotNull] IdentityUser user, [NotNull] IEnumerable roleNames) + public virtual async Task SetRolesAsync([NotNull] IdentityUser user, [NotNull] IEnumerable roleNames) { Check.NotNull(user, nameof(user)); Check.NotNull(roleNames, nameof(roleNames)); diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserRepositoryExternalUserLookupServiceProvider.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserRepositoryExternalUserLookupServiceProvider.cs index bbbebb81cd..cb380de5c7 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserRepositoryExternalUserLookupServiceProvider.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserRepositoryExternalUserLookupServiceProvider.cs @@ -20,7 +20,7 @@ namespace Volo.Abp.Identity _lookupNormalizer = lookupNormalizer; } - public async Task FindByIdAsync( + public virtual async Task FindByIdAsync( Guid id, CancellationToken cancellationToken = default) { @@ -33,7 +33,7 @@ namespace Volo.Abp.Identity )?.ToAbpUserData(); } - public async Task FindByUserNameAsync( + public virtual async Task FindByUserNameAsync( string userName, CancellationToken cancellationToken = default) { diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/UserRoleFinder.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/UserRoleFinder.cs index b168282526..d2de24a568 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/UserRoleFinder.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/UserRoleFinder.cs @@ -13,7 +13,7 @@ namespace Volo.Abp.Identity _identityUserRepository = identityUserRepository; } - public async Task GetRolesAsync(Guid userId) + public virtual async Task GetRolesAsync(Guid userId) { return (await _identityUserRepository.GetRoleNamesAsync(userId)).ToArray(); } From 183b779a9b1c5b64dfbbac5c2cbb953355fcfe30 Mon Sep 17 00:00:00 2001 From: Super <47396430@qq.com> Date: Thu, 10 Oct 2019 13:25:06 +0800 Subject: [PATCH 08/62] Upgrade to Npgsql.EntityFrameworkCore.PostgreSQL 3.0.1 --- .../Volo.Abp.EntityFrameworkCore.PostgreSql.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj index b385b920ed..9f2717823c 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj +++ b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj @@ -18,7 +18,7 @@ - + From 377b633fba8884c423f899a10f3a9935abc28fd6 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 10 Oct 2019 09:01:43 +0300 Subject: [PATCH 09/62] Added Web projects of the modules to the application parts --- .../AbpAccountWebIdentityServerModule.cs | 5 +++++ .../src/Volo.Abp.Account.Web/AbpAccountWebModule.cs | 5 +++++ .../src/Volo.Blogging.Web/BloggingWebModule.cs | 5 +++++ .../src/Volo.Docs.Admin.Web/DocsAdminWebModule.cs | 5 +++++ modules/docs/src/Volo.Docs.Web/DocsWebModule.cs | 5 +++++ .../AbpFeatureManagementWebModule.cs | 5 +++++ .../src/Volo.Abp.Identity.Web/AbpIdentityWebModule.cs | 5 +++++ .../AbpPermissionManagementWebModule.cs | 5 +++++ .../AbpSettingManagementWebModule.cs | 11 ++++++++++- .../AbpTenantManagementWebModule.cs | 5 +++++ .../MyProjectNameWebModule.cs | 5 +++++ 11 files changed, 60 insertions(+), 1 deletion(-) diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/AbpAccountWebIdentityServerModule.cs b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/AbpAccountWebIdentityServerModule.cs index b7f1557ed9..27e508fcb8 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/AbpAccountWebIdentityServerModule.cs +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/AbpAccountWebIdentityServerModule.cs @@ -19,6 +19,11 @@ namespace Volo.Abp.Account.Web { options.ConfigureAuthentication = false; }); + + PreConfigure(mvcBuilder => + { + mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpAccountWebIdentityServerModule).Assembly); + }); } public override void ConfigureServices(ServiceConfigurationContext context) diff --git a/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs b/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs index 0f9f43795d..a3b494a264 100644 --- a/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs +++ b/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs @@ -26,6 +26,11 @@ namespace Volo.Abp.Account.Web { options.AddAssemblyResource(typeof(AccountResource), typeof(AbpAccountWebModule).Assembly); }); + + PreConfigure(mvcBuilder => + { + mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpAccountWebModule).Assembly); + }); } public override void ConfigureServices(ServiceConfigurationContext context) diff --git a/modules/blogging/src/Volo.Blogging.Web/BloggingWebModule.cs b/modules/blogging/src/Volo.Blogging.Web/BloggingWebModule.cs index 104380e646..aaf3b65f81 100644 --- a/modules/blogging/src/Volo.Blogging.Web/BloggingWebModule.cs +++ b/modules/blogging/src/Volo.Blogging.Web/BloggingWebModule.cs @@ -26,6 +26,11 @@ namespace Volo.Blogging { options.AddAssemblyResource(typeof(BloggingResource), typeof(BloggingWebModule).Assembly); }); + + PreConfigure(mvcBuilder => + { + mvcBuilder.AddApplicationPartIfNotExists(typeof(BloggingWebModule).Assembly); + }); } public override void ConfigureServices(ServiceConfigurationContext context) diff --git a/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebModule.cs b/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebModule.cs index d7bb54fc5d..34e0272e2f 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebModule.cs +++ b/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebModule.cs @@ -26,6 +26,11 @@ namespace Volo.Docs.Admin { options.AddAssemblyResource(typeof(DocsResource), typeof(DocsAdminWebModule).Assembly); }); + + PreConfigure(mvcBuilder => + { + mvcBuilder.AddApplicationPartIfNotExists(typeof(DocsAdminWebModule).Assembly); + }); } public override void ConfigureServices(ServiceConfigurationContext context) diff --git a/modules/docs/src/Volo.Docs.Web/DocsWebModule.cs b/modules/docs/src/Volo.Docs.Web/DocsWebModule.cs index 9253176e58..3f3e87ea14 100644 --- a/modules/docs/src/Volo.Docs.Web/DocsWebModule.cs +++ b/modules/docs/src/Volo.Docs.Web/DocsWebModule.cs @@ -28,6 +28,11 @@ namespace Volo.Docs { options.AddAssemblyResource(typeof(DocsResource), typeof(DocsWebModule).Assembly); }); + + PreConfigure(mvcBuilder => + { + mvcBuilder.AddApplicationPartIfNotExists(typeof(DocsWebModule).Assembly); + }); } public override void ConfigureServices(ServiceConfigurationContext context) diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/AbpFeatureManagementWebModule.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/AbpFeatureManagementWebModule.cs index e9d80ec0bc..4908097f36 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/AbpFeatureManagementWebModule.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/AbpFeatureManagementWebModule.cs @@ -22,6 +22,11 @@ namespace Volo.Abp.FeatureManagement { options.AddAssemblyResource(typeof(AbpFeatureManagementResource), typeof(AbpFeatureManagementWebModule).Assembly); }); + + PreConfigure(mvcBuilder => + { + mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpFeatureManagementWebModule).Assembly); + }); } public override void ConfigureServices(ServiceConfigurationContext context) diff --git a/modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebModule.cs b/modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebModule.cs index 1fe917221f..91f7b9b3a8 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebModule.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/AbpIdentityWebModule.cs @@ -26,6 +26,11 @@ namespace Volo.Abp.Identity.Web { options.AddAssemblyResource(typeof(IdentityResource), typeof(AbpIdentityWebModule).Assembly); }); + + PreConfigure(mvcBuilder => + { + mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpIdentityWebModule).Assembly); + }); } public override void ConfigureServices(ServiceConfigurationContext context) diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/AbpPermissionManagementWebModule.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/AbpPermissionManagementWebModule.cs index 1655c6cba9..38fd9827a1 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/AbpPermissionManagementWebModule.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/AbpPermissionManagementWebModule.cs @@ -23,6 +23,11 @@ namespace Volo.Abp.PermissionManagement.Web { options.AddAssemblyResource(typeof(AbpPermissionManagementResource)); }); + + PreConfigure(mvcBuilder => + { + mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpPermissionManagementWebModule).Assembly); + }); } public override void ConfigureServices(ServiceConfigurationContext context) diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/AbpSettingManagementWebModule.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/AbpSettingManagementWebModule.cs index 8f1250e4fe..a99317daa4 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/AbpSettingManagementWebModule.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/AbpSettingManagementWebModule.cs @@ -1,4 +1,5 @@ -using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; using Volo.Abp.Modularity; using Volo.Abp.SettingManagement.Web.Navigation; using Volo.Abp.UI.Navigation; @@ -12,6 +13,14 @@ namespace Volo.Abp.SettingManagement.Web )] public class AbpSettingManagementWebModule : AbpModule { + public override void PreConfigureServices(ServiceConfigurationContext context) + { + PreConfigure(mvcBuilder => + { + mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpSettingManagementWebModule).Assembly); + }); + } + public override void ConfigureServices(ServiceConfigurationContext context) { Configure(options => diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/AbpTenantManagementWebModule.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/AbpTenantManagementWebModule.cs index f96052ec38..626970a1a9 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/AbpTenantManagementWebModule.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/AbpTenantManagementWebModule.cs @@ -28,6 +28,11 @@ namespace Volo.Abp.TenantManagement.Web { options.AddAssemblyResource(typeof(AbpTenantManagementResource), typeof(AbpTenantManagementWebModule).Assembly); }); + + PreConfigure(mvcBuilder => + { + mvcBuilder.AddApplicationPartIfNotExists(typeof(AbpTenantManagementWebModule).Assembly); + }); } public override void ConfigureServices(ServiceConfigurationContext context) diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs index 36662c1848..ec4ffacad5 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs @@ -23,6 +23,11 @@ namespace MyCompanyName.MyProjectName.Web { options.AddAssemblyResource(typeof(MyProjectNameResource), typeof(MyProjectNameWebModule).Assembly); }); + + PreConfigure(mvcBuilder => + { + mvcBuilder.AddApplicationPartIfNotExists(typeof(MyProjectNameWebModule).Assembly); + }); } public override void ConfigureServices(ServiceConfigurationContext context) From 8c10e70f417f7d1d56ae35511ca986e869856bb7 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 10 Oct 2019 09:49:23 +0300 Subject: [PATCH 10/62] removed NugetReferenceReplaceStep --- .../ModuleProjectBuildPipelineBuilder.cs | 2 +- .../Steps/NugetReferenceReplaceStep.cs | 138 ------------------ 2 files changed, 1 insertion(+), 139 deletions(-) delete mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/NugetReferenceReplaceStep.cs diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleProjectBuildPipelineBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleProjectBuildPipelineBuilder.cs index 3a5fcee77b..fc2a5b0dbc 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleProjectBuildPipelineBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleProjectBuildPipelineBuilder.cs @@ -9,7 +9,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building var pipeline = new ProjectBuildPipeline(context); pipeline.Steps.Add(new FileEntryListReadStep()); - pipeline.Steps.Add(new NugetReferenceReplaceStep()); + pipeline.Steps.Add(new ProjectReferenceReplaceStep()); pipeline.Steps.Add(new CreateProjectResultZipStep()); return pipeline; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/NugetReferenceReplaceStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/NugetReferenceReplaceStep.cs deleted file mode 100644 index 7d08ed7ff6..0000000000 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/NugetReferenceReplaceStep.cs +++ /dev/null @@ -1,138 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text.RegularExpressions; -using System.Xml; -using Volo.Abp.Cli.ProjectBuilding.Files; - -namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps -{ - public class NugetReferenceReplaceStep : ProjectBuildPipelineStep - { - public override void Execute(ProjectBuildContext context) - { - var nugetPackageVersion = context.TemplateFile.Version; - if (IsBranchName(nugetPackageVersion)) - { - nugetPackageVersion = context.TemplateFile.LatestVersion; - } - - new NugetReferenceReplacer( - context.Files, - context.Module?.Namespace ?? "MyCompanyName.MyProjectName", - nugetPackageVersion - ).Run(); - } - - private bool IsBranchName(string versionOrBranchName) - { - Check.NotNullOrWhiteSpace(versionOrBranchName, nameof(versionOrBranchName)); - - if (char.IsDigit(versionOrBranchName[0])) - { - return false; - } - - if (versionOrBranchName[0].IsIn('v','V') && - versionOrBranchName.Length > 1 && - char.IsDigit(versionOrBranchName[1])) - { - return false; - } - - return true; - } - - private class NugetReferenceReplacer - { - private readonly List _entries; - private readonly string _companyAndProjectNamePlaceHolder; - private readonly string _nugetPackageVersion; - - public NugetReferenceReplacer( - List entries, - string companyAndProjectNamePlaceHolder, - string nugetPackageVersion) - { - _entries = entries; - _companyAndProjectNamePlaceHolder = companyAndProjectNamePlaceHolder; - _nugetPackageVersion = nugetPackageVersion; - } - - public void Run() - { - foreach (var fileEntry in _entries) - { - if (fileEntry.Name.EndsWith(".csproj")) - { - fileEntry.SetContent(ProcessFileContent(fileEntry.Content)); - } - } - } - - private string ProcessFileContent(string content) - { - Check.NotNull(content, nameof(content)); - - var doc = new XmlDocument() { PreserveWhitespace = true }; - - doc.Load(GenerateStreamFromString(content)); - - return ProcessReferenceNodes(doc, content); - } - - private string ProcessReferenceNodes(XmlDocument doc, string content) - { - Check.NotNull(content, nameof(content)); - - var nodes = doc.SelectNodes("/Project/ItemGroup/ProjectReference[@Include]"); - - foreach (XmlNode oldNode in nodes) - { - var oldNodeIncludeValue = oldNode.Attributes["Include"].Value; - - // ReSharper disable once PossibleNullReferenceException : Can not be null because nodes are selected with include attribute filter in previous method - if (oldNodeIncludeValue.Contains($"{_companyAndProjectNamePlaceHolder}")) - { - continue; - } - - var newNode = doc.CreateElement("PackageReference"); - - var includeAttr = doc.CreateAttribute("Include"); - includeAttr.Value = ConvertToNugetReference(oldNodeIncludeValue); - newNode.Attributes.Append(includeAttr); - - var versionAttr = doc.CreateAttribute("Version"); - versionAttr.Value = _nugetPackageVersion; - newNode.Attributes.Append(versionAttr); - - oldNode.ParentNode.ReplaceChild(newNode, oldNode); - } - - return doc.OuterXml; - } - - private string ConvertToNugetReference(string oldValue) - { - var newValue = Regex.Match(oldValue, @"\\((?!.+?\\).+?)\.csproj", RegexOptions.CultureInvariant | RegexOptions.Compiled); - if (newValue.Success && newValue.Groups.Count == 2) - { - return newValue.Groups[1].Value; - } - - return oldValue; - } - - private static Stream GenerateStreamFromString(string s) - { - var stream = new MemoryStream(); - var writer = new StreamWriter(stream); - writer.Write(s); - writer.Flush(); - stream.Position = 0; - return stream; - } - } - } -} From 55119d8b5040fe6ee0eb85bca3694e4d4e12840e Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 10 Oct 2019 09:49:45 +0300 Subject: [PATCH 11/62] GitHubLocalRepositoryPath option added to source-code download --- .../Volo/Abp/Cli/Commands/GetSourceCommand.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs index 54711fbc31..97dfe23944 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs @@ -61,6 +61,12 @@ namespace Volo.Abp.Cli.Commands Logger.LogInformation("Output folder: " + outputFolder); + var gitHubLocalRepositoryPath = commandLineArgs.Options.GetOrNull(Options.GitHubLocalRepositoryPath.Long); + if (gitHubLocalRepositoryPath != null) + { + Logger.LogInformation("GitHub Local Repository Path: " + gitHubLocalRepositoryPath); + } + commandLineArgs.Options.Add(CliConsts.Command, commandLineArgs.Command); var result = await ModuleProjectBuilder.BuildAsync( @@ -70,6 +76,7 @@ namespace Volo.Abp.Cli.Commands version, DatabaseProvider.NotSpecified, UiFramework.NotSpecified, + gitHubLocalRepositoryPath, commandLineArgs.Options ) ); @@ -147,6 +154,11 @@ namespace Volo.Abp.Cli.Commands public const string Long = "output-folder"; } + public static class GitHubLocalRepositoryPath + { + public const string Long = "abp-path"; + } + public static class Version { public const string Short = "v"; From e0cf0e959f8b394e2910642467aa64416c3967ca Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 10 Oct 2019 14:53:36 +0800 Subject: [PATCH 12/62] Added determining current tenant tip. --- docs/en/Multi-Tenancy.md | 2 ++ docs/zh-Hans/Multi-Tenancy.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/docs/en/Multi-Tenancy.md b/docs/en/Multi-Tenancy.md index 0ad3c66b26..5106986fce 100644 --- a/docs/en/Multi-Tenancy.md +++ b/docs/en/Multi-Tenancy.md @@ -307,6 +307,8 @@ Volo.Abp.AspNetCore.MultiTenancy package adds following tenant resolvers to dete * **HeaderTenantResolver**: Tries to find current tenant id from HTTP header. Header name is "__tenant" by default. * **CookieTenantResolver**: Tries to find current tenant id from cookie values. Cookie name is "__tenant" by default. +> If you use nginx as a reverse proxy server, please note that if `TenantKey` contains an underscore, there may be a problem, please refer to: http://nginx.org/en/docs/http/ngx_http_core_module.html#underscores_in_headers + "__tenant" parameter name can be changed using AspNetCoreMultiTenancyOptions. Example: ````C# diff --git a/docs/zh-Hans/Multi-Tenancy.md b/docs/zh-Hans/Multi-Tenancy.md index 352190d5cd..e13e6cb72a 100644 --- a/docs/zh-Hans/Multi-Tenancy.md +++ b/docs/zh-Hans/Multi-Tenancy.md @@ -308,6 +308,8 @@ Volo.Abp.AspNetCore.MultiTenancy 添加了下面这些租户解析器,从当前W * **HeaderTenantResolver**: 尝试从HTTP header中获取当前租户,默认的header名称是"__tenant". * **CookieTenantResolver**: 尝试从当前cookie中获取当前租户.默认的Cookie名称是"__tenant". +> 如果你使用nginx作为反向代理服务器,请注意如果`TenantKey`包含下划线可能存在问题, 请参考: http://nginx.org/en/docs/http/ngx_http_core_module.html#underscores_in_headers + 可以使用AspNetCoreMultiTenancyOptions修改默认的参数名"__tenant".例如: ````C# From af8d371117452b728b1e5cc922cb9172638f1b0a Mon Sep 17 00:00:00 2001 From: maliming Date: Thu, 10 Oct 2019 15:02:37 +0800 Subject: [PATCH 13/62] Update multi-tenant documents. --- docs/en/Multi-Tenancy.md | 5 ++++- docs/zh-Hans/Multi-Tenancy.md | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/en/Multi-Tenancy.md b/docs/en/Multi-Tenancy.md index 5106986fce..c69e2cb299 100644 --- a/docs/en/Multi-Tenancy.md +++ b/docs/en/Multi-Tenancy.md @@ -307,7 +307,10 @@ Volo.Abp.AspNetCore.MultiTenancy package adds following tenant resolvers to dete * **HeaderTenantResolver**: Tries to find current tenant id from HTTP header. Header name is "__tenant" by default. * **CookieTenantResolver**: Tries to find current tenant id from cookie values. Cookie name is "__tenant" by default. -> If you use nginx as a reverse proxy server, please note that if `TenantKey` contains an underscore, there may be a problem, please refer to: http://nginx.org/en/docs/http/ngx_http_core_module.html#underscores_in_headers +> If you use nginx as a reverse proxy server, please note that if `TenantKey` contains an underscore or other special characters, there may be a problem, please refer to: +http://nginx.org/en/docs/http/ngx_http_core_module.html#ignore_invalid_headers +http://nginx.org/en/docs/http/ngx_http_core_module.html#underscores_in_headers + "__tenant" parameter name can be changed using AspNetCoreMultiTenancyOptions. Example: diff --git a/docs/zh-Hans/Multi-Tenancy.md b/docs/zh-Hans/Multi-Tenancy.md index e13e6cb72a..f42fd73454 100644 --- a/docs/zh-Hans/Multi-Tenancy.md +++ b/docs/zh-Hans/Multi-Tenancy.md @@ -308,7 +308,9 @@ Volo.Abp.AspNetCore.MultiTenancy 添加了下面这些租户解析器,从当前W * **HeaderTenantResolver**: 尝试从HTTP header中获取当前租户,默认的header名称是"__tenant". * **CookieTenantResolver**: 尝试从当前cookie中获取当前租户.默认的Cookie名称是"__tenant". -> 如果你使用nginx作为反向代理服务器,请注意如果`TenantKey`包含下划线可能存在问题, 请参考: http://nginx.org/en/docs/http/ngx_http_core_module.html#underscores_in_headers +> 如果你使用nginx作为反向代理服务器,请注意如果`TenantKey`包含下划线或其他特殊字符可能存在问题, 请参考: +http://nginx.org/en/docs/http/ngx_http_core_module.html#ignore_invalid_headers +http://nginx.org/en/docs/http/ngx_http_core_module.html#underscores_in_headers 可以使用AspNetCoreMultiTenancyOptions修改默认的参数名"__tenant".例如: From 42808add45937a344bbd2ef0b7b0a1a2999bbb14 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Thu, 10 Oct 2019 10:17:45 +0300 Subject: [PATCH 14/62] Update ModuleProjectBuilder.cs --- .../Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs index d7d31c81af..57332bd5e2 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs @@ -90,7 +90,7 @@ namespace Volo.Abp.Cli.ProjectBuilding Tool = Options.ToolName, Command = args.ExtraProperties.ContainsKey(CliConsts.Command) ? args.ExtraProperties[CliConsts.Command] : "", DatabaseProvider = null, - IsTiered = false, + IsTiered = null, UiFramework = null, Options = JsonSerializer.Serialize(options), ProjectName = null, From 19c487bf8f87d2359b827c5556c1cc0e7e951166 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Thu, 10 Oct 2019 11:34:10 +0300 Subject: [PATCH 15/62] feat(core): implement jest to core and add @angular-builders/jest:run --- npm/ng-packs/angular.json | 8 +-- npm/ng-packs/apps/dev-app/tsconfig.app.json | 52 +++++++++---------- npm/ng-packs/jest.config.js | 18 +++++++ npm/ng-packs/package.json | 10 ++-- npm/ng-packs/packages/core/jest.config.js | 9 ++++ .../tests/dynamic-layout.component.spec.ts | 2 +- .../src/lib/tests/locale.provider.spec.ts | 2 +- .../core/src/lib/tests/rest.service.spec.ts | 2 +- npm/ng-packs/packages/core/tsconfig.spec.json | 11 ++-- npm/ng-packs/{setupJest.ts => test-setup.ts} | 0 npm/ng-packs/tsconfig.json | 2 +- 11 files changed, 70 insertions(+), 46 deletions(-) create mode 100644 npm/ng-packs/jest.config.js create mode 100644 npm/ng-packs/packages/core/jest.config.js rename npm/ng-packs/{setupJest.ts => test-setup.ts} (100%) diff --git a/npm/ng-packs/angular.json b/npm/ng-packs/angular.json index 0a7736ac8d..e849d7dafa 100644 --- a/npm/ng-packs/angular.json +++ b/npm/ng-packs/angular.json @@ -17,12 +17,8 @@ } }, "test": { - "builder": "@angular-devkit/build-angular:karma", - "options": { - "main": "packages/core/src/test.ts", - "tsConfig": "packages/core/tsconfig.spec.json", - "karmaConfig": "packages/core/karma.conf.js" - } + "builder": "@angular-builders/jest:run", + "options": {} }, "lint": { "builder": "@angular-devkit/build-angular:tslint", diff --git a/npm/ng-packs/apps/dev-app/tsconfig.app.json b/npm/ng-packs/apps/dev-app/tsconfig.app.json index 6570e8f04a..cc22d70d1c 100644 --- a/npm/ng-packs/apps/dev-app/tsconfig.app.json +++ b/npm/ng-packs/apps/dev-app/tsconfig.app.json @@ -4,32 +4,32 @@ "outDir": "../../out-tsc/app", "types": [], "paths": { - // "@abp/ng.core": ["packages/core/src/public-api.ts"], - // "@abp/ng.core/*": ["packages/core/src/lib/*"], - // // "@abp/ng.theme.shared": ["packages/theme-shared/src/public-api.ts"], - // // "@abp/ng.theme.shared/*": ["packages/theme-shared/src/lib/*"], - // "@abp/ng.theme.basic": ["packages/theme-basic/src/public-api.ts"], - // "@abp/ng.theme.basic/*": ["packages/theme-basic/src/lib/*"], - // "@abp/ng.account": ["packages/account/src/public-api.ts"], - // "@abp/ng.account/*": ["packages/account/src/lib/*"], - // "@abp/ng.account.config": ["packages/account-config/src/public-api.ts"], - // "@abp/ng.account.config/*": ["packages/account-config/src/lib/*"], - // "@abp/ng.identity": ["packages/identity/src/public-api.ts"], - // "@abp/ng.identity/*": ["packages/identity/src/lib/*"], - // "@abp/ng.identity.config": ["packages/identity-config/src/public-api.ts"], - // "@abp/ng.identity.config/*": ["packages/identity-config/src/lib/*"], - // "@abp/ng.tenant-management": ["packages/tenant-management/src/public-api.ts"], - // "@abp/ng.tenant-management/*": ["packages/tenant-management/src/lib/*"], - // "@abp/ng.tenant-management.config": ["packages/tenant-management-config/src/public-api.ts"], - // "@abp/ng.tenant-management.config/*": ["packages/tenant-management-config/src/lib/*"], - // "@abp/ng.setting-management": ["packages/setting-management/src/public-api.ts"], - // "@abp/ng.setting-management/*": ["packages/setting-management/src/lib/*"], - // "@abp/ng.setting-management.config": ["packages/setting-management-config/src/public-api.ts"], - // "@abp/ng.setting-management.config/*": ["packages/setting-management-config/src/lib/*"], - // "@abp/ng.permission-management": ["packages/permission-management/src/public-api.ts"], - // "@abp/ng.permission-management/*": ["packages/permission-management/src/lib/*"], - // "@abp/ng.feature-management": ["packages/feature-management/src/public-api.ts"], - // "@abp/ng.feature-management/*": ["packages/feature-management/src/lib/*"] + "@abp/ng.core": ["packages/core/src/public-api.ts"], + "@abp/ng.core/*": ["packages/core/src/lib/*"], + // "@abp/ng.theme.shared": ["packages/theme-shared/src/public-api.ts"], + // "@abp/ng.theme.shared/*": ["packages/theme-shared/src/lib/*"], + "@abp/ng.theme.basic": ["packages/theme-basic/src/public-api.ts"], + "@abp/ng.theme.basic/*": ["packages/theme-basic/src/lib/*"], + "@abp/ng.account": ["packages/account/src/public-api.ts"], + "@abp/ng.account/*": ["packages/account/src/lib/*"], + "@abp/ng.account.config": ["packages/account-config/src/public-api.ts"], + "@abp/ng.account.config/*": ["packages/account-config/src/lib/*"], + "@abp/ng.identity": ["packages/identity/src/public-api.ts"], + "@abp/ng.identity/*": ["packages/identity/src/lib/*"], + "@abp/ng.identity.config": ["packages/identity-config/src/public-api.ts"], + "@abp/ng.identity.config/*": ["packages/identity-config/src/lib/*"], + "@abp/ng.tenant-management": ["packages/tenant-management/src/public-api.ts"], + "@abp/ng.tenant-management/*": ["packages/tenant-management/src/lib/*"], + "@abp/ng.tenant-management.config": ["packages/tenant-management-config/src/public-api.ts"], + "@abp/ng.tenant-management.config/*": ["packages/tenant-management-config/src/lib/*"], + "@abp/ng.setting-management": ["packages/setting-management/src/public-api.ts"], + "@abp/ng.setting-management/*": ["packages/setting-management/src/lib/*"], + "@abp/ng.setting-management.config": ["packages/setting-management-config/src/public-api.ts"], + "@abp/ng.setting-management.config/*": ["packages/setting-management-config/src/lib/*"], + "@abp/ng.permission-management": ["packages/permission-management/src/public-api.ts"], + "@abp/ng.permission-management/*": ["packages/permission-management/src/lib/*"], + "@abp/ng.feature-management": ["packages/feature-management/src/public-api.ts"], + "@abp/ng.feature-management/*": ["packages/feature-management/src/lib/*"] } }, "files": ["src/main.ts", "src/polyfills.ts"], diff --git a/npm/ng-packs/jest.config.js b/npm/ng-packs/jest.config.js new file mode 100644 index 0000000000..d9294d5935 --- /dev/null +++ b/npm/ng-packs/jest.config.js @@ -0,0 +1,18 @@ +module.exports = { + globals: { + 'ts-jest': { + allowSyntheticDefaultImports: true, + }, + }, + transform: { + '^.+\\.(ts|js|html)$': 'ts-jest', + }, + moduleFileExtensions: ['ts', 'js', 'html'], + coverageReporters: ['html'], + preset: 'jest-preset-angular', + setupFilesAfterEnv: ['/test-setup.ts'], + snapshotSerializers: [ + 'jest-preset-angular/AngularSnapshotSerializer.js', + 'jest-preset-angular/HTMLCommentSerializer.js', + ], +}; diff --git a/npm/ng-packs/package.json b/npm/ng-packs/package.json index 3eba277234..f432ab97d9 100644 --- a/npm/ng-packs/package.json +++ b/npm/ng-packs/package.json @@ -2,7 +2,7 @@ "scripts": { "start": "ng serve dev-app", "ng": "ng", - "test": "jest", + "test": "ng test", "symlink": "symlink", "abpng": "abpng", "commit": "git-cz && node scripts/push.js", @@ -15,6 +15,7 @@ "@abp/ng.theme.shared": "^0.9.0", "@angular-devkit/build-angular": "~0.803.6", "@angular-devkit/build-ng-packagr": "~0.803.6", + "@angular-builders/jest": "^8.2.0", "@angular/animations": "~8.2.8", "@angular/cdk": "^8.2.2", "@angular/cli": "~8.3.6", @@ -28,7 +29,7 @@ "@angular/platform-browser-dynamic": "~8.2.8", "@angular/router": "~8.2.8", "@ng-bootstrap/ng-bootstrap": "^5.1.0", - "@ngneat/spectator": "^4.3.2", + "@ngneat/spectator": "^4.4.0", "@ngx-validate/core": "^0.0.5", "@ngxs/devtools-plugin": "^3.5.1", "@ngxs/router-plugin": "^3.5.1", @@ -65,6 +66,7 @@ "zone.js": "~0.9.1" }, "dependencies": { + "@briebug/jest": "^1.3.1", "tslib": "^1.10.0" }, "config": { @@ -87,9 +89,5 @@ "tslint --fix", "git add" ] - }, - "jest": { - "preset": "jest-preset-angular", - "setupTestFrameworkScriptFile": "/setupJest.ts" } } diff --git a/npm/ng-packs/packages/core/jest.config.js b/npm/ng-packs/packages/core/jest.config.js new file mode 100644 index 0000000000..c46ff0a2da --- /dev/null +++ b/npm/ng-packs/packages/core/jest.config.js @@ -0,0 +1,9 @@ +const { pathsToModuleNameMapper } = require('ts-jest/utils'); +const { compilerOptions } = require('./tsconfig.spec'); + +module.exports = { + name: 'core', + testMatch: ['/packages/core/**/+(*.)+(spec|test).+(ts|js)?(x)'], + coverageDirectory: '../../coverage/libs/core', + moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths /*, { prefix: '/' } */), +}; diff --git a/npm/ng-packs/packages/core/src/lib/tests/dynamic-layout.component.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/dynamic-layout.component.spec.ts index e752829eb2..d2ac2c3c50 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/dynamic-layout.component.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/dynamic-layout.component.spec.ts @@ -7,7 +7,7 @@ import { NgxsResetPluginModule, StateOverwrite } from 'ngxs-reset-plugin'; import { LAYOUTS, ThemeBasicModule } from '../../../../theme-basic/src/public-api'; import { eLayoutType } from '../enums'; import { ABP } from '../models'; -import { RouterOutletComponent, CoreModule, DynamicLayoutComponent, ConfigState } from '../../public-api'; +import { RouterOutletComponent, CoreModule, DynamicLayoutComponent, ConfigState } from '@abp/ng.core'; import { ThemeSharedModule } from '../../../../theme-shared/src/public-api'; import { MessageService } from 'primeng/components/common/messageservice'; diff --git a/npm/ng-packs/packages/core/src/lib/tests/locale.provider.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/locale.provider.spec.ts index 3ff3516c6e..b5c788635d 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/locale.provider.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/locale.provider.spec.ts @@ -24,7 +24,7 @@ describe('LocaleProvider', () => { }); describe('#LOCALE_ID', () => { - it('should equal to localizationService.currentLang', async () => { + test('should equal to currentLang', async () => { spectator = createComponent(); const localizationService = spectator.get(LocalizationService); diff --git a/npm/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts index db37d673ae..f91fbcef3e 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts @@ -15,7 +15,7 @@ describe('HttpClient testing', () => { store.selectSnapshot.andReturn(api); }); - it('should send a GET request with params', () => { + test('should send a GET request with params', () => { spectator.service.request({ method: HttpMethod.GET, url: '/test', params: { id: 1 } }).subscribe(); spectator.expectOne(api + '/test?id=1', HttpMethod.GET); }); diff --git a/npm/ng-packs/packages/core/tsconfig.spec.json b/npm/ng-packs/packages/core/tsconfig.spec.json index cd178e12ee..d2fb1e6cb3 100644 --- a/npm/ng-packs/packages/core/tsconfig.spec.json +++ b/npm/ng-packs/packages/core/tsconfig.spec.json @@ -1,11 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "outDir": "../../out-tsc/spec", - "types": ["node", "jest"], "emitDecoratorMetadata": true, - "esModuleInterop": true + "esModuleInterop": true, + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"], + "paths": { + "@abp/ng.core/*": ["packages/core/src/lib/*"] + } }, - "files": [], "include": ["**/*.spec.ts", "**/*.d.ts"] } diff --git a/npm/ng-packs/setupJest.ts b/npm/ng-packs/test-setup.ts similarity index 100% rename from npm/ng-packs/setupJest.ts rename to npm/ng-packs/test-setup.ts diff --git a/npm/ng-packs/tsconfig.json b/npm/ng-packs/tsconfig.json index 9c996dd271..ac9e9e8eea 100644 --- a/npm/ng-packs/tsconfig.json +++ b/npm/ng-packs/tsconfig.json @@ -13,7 +13,7 @@ "target": "es2015", "typeRoots": ["node_modules/@types"], "lib": ["es2018", "dom"], - "paths": {} + "types": ["jest"] }, "angularCompilerOptions": { "fullTemplateTypeCheck": true, From 80da964dc36e9fc9ef1d85d3cdf4d90ca725a07b Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Thu, 10 Oct 2019 11:55:22 +0300 Subject: [PATCH 16/62] feat: configure coverage --- npm/ng-packs/jest.config.js | 1 + npm/ng-packs/packages/core/jest.config.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/npm/ng-packs/jest.config.js b/npm/ng-packs/jest.config.js index d9294d5935..580ba0bcdf 100644 --- a/npm/ng-packs/jest.config.js +++ b/npm/ng-packs/jest.config.js @@ -8,6 +8,7 @@ module.exports = { '^.+\\.(ts|js|html)$': 'ts-jest', }, moduleFileExtensions: ['ts', 'js', 'html'], + coverageDirectory: '/coverage', coverageReporters: ['html'], preset: 'jest-preset-angular', setupFilesAfterEnv: ['/test-setup.ts'], diff --git a/npm/ng-packs/packages/core/jest.config.js b/npm/ng-packs/packages/core/jest.config.js index c46ff0a2da..67c57c7a42 100644 --- a/npm/ng-packs/packages/core/jest.config.js +++ b/npm/ng-packs/packages/core/jest.config.js @@ -1,9 +1,10 @@ const { pathsToModuleNameMapper } = require('ts-jest/utils'); const { compilerOptions } = require('./tsconfig.spec'); +const jestConfig = require('../../jest.config'); module.exports = { + ...jestConfig, name: 'core', testMatch: ['/packages/core/**/+(*.)+(spec|test).+(ts|js)?(x)'], - coverageDirectory: '../../coverage/libs/core', moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths /*, { prefix: '/' } */), }; From 844225dd85ee8f0250f952ce493a0573060d5963 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Thu, 10 Oct 2019 13:31:31 +0300 Subject: [PATCH 17/62] feat(theme-shared): implement jest --- npm/ng-packs/angular.json | 10 +++++----- npm/ng-packs/packages/core/jest.config.js | 2 +- npm/ng-packs/packages/theme-shared/jest.config.js | 10 ++++++++++ npm/ng-packs/packages/theme-shared/tsconfig.spec.json | 11 ++++++++--- 4 files changed, 24 insertions(+), 9 deletions(-) create mode 100644 npm/ng-packs/packages/theme-shared/jest.config.js diff --git a/npm/ng-packs/angular.json b/npm/ng-packs/angular.json index e849d7dafa..f1c7d18a46 100644 --- a/npm/ng-packs/angular.json +++ b/npm/ng-packs/angular.json @@ -18,7 +18,9 @@ }, "test": { "builder": "@angular-builders/jest:run", - "options": {} + "options": { + "coverage": true + } }, "lint": { "builder": "@angular-devkit/build-angular:tslint", @@ -44,11 +46,9 @@ } }, "test": { - "builder": "@angular-devkit/build-angular:karma", + "builder": "@angular-builders/jest:run", "options": { - "main": "packages/theme-shared/src/test.ts", - "tsConfig": "packages/theme-shared/tsconfig.spec.json", - "karmaConfig": "packages/theme-shared/karma.conf.js" + "coverage": true } }, "lint": { diff --git a/npm/ng-packs/packages/core/jest.config.js b/npm/ng-packs/packages/core/jest.config.js index 67c57c7a42..2e294cf4e6 100644 --- a/npm/ng-packs/packages/core/jest.config.js +++ b/npm/ng-packs/packages/core/jest.config.js @@ -5,6 +5,6 @@ const jestConfig = require('../../jest.config'); module.exports = { ...jestConfig, name: 'core', - testMatch: ['/packages/core/**/+(*.)+(spec|test).+(ts|js)?(x)'], moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths /*, { prefix: '/' } */), + 'ts-jest': { allowSyntheticDefaultImports: true }, }; diff --git a/npm/ng-packs/packages/theme-shared/jest.config.js b/npm/ng-packs/packages/theme-shared/jest.config.js new file mode 100644 index 0000000000..718fcfe21b --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/jest.config.js @@ -0,0 +1,10 @@ +const { pathsToModuleNameMapper } = require('ts-jest/utils'); +const { compilerOptions } = require('./tsconfig.spec'); +const jestConfig = require('../../jest.config'); + +module.exports = { + ...jestConfig, + name: 'theme-shared', + moduleNameMapper: pathsToModuleNameMapper(compilerOptions.paths /*, { prefix: '/' } */), + 'ts-jest': { allowSyntheticDefaultImports: true }, +}; diff --git a/npm/ng-packs/packages/theme-shared/tsconfig.spec.json b/npm/ng-packs/packages/theme-shared/tsconfig.spec.json index ebce9b9fdb..f87ea306f2 100644 --- a/npm/ng-packs/packages/theme-shared/tsconfig.spec.json +++ b/npm/ng-packs/packages/theme-shared/tsconfig.spec.json @@ -1,9 +1,14 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "outDir": "../../out-tsc/spec", - "types": ["node", "jest"] + "emitDecoratorMetadata": true, + "esModuleInterop": true, + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"], + "paths": { + "@abp/ng.theme-shared/*": ["packages/theme-shared/src/lib/*"] + } }, - "files": [], "include": ["**/*.spec.ts", "**/*.d.ts"] } From a5049090c43fe45f85e6691b60ef95022ca8736a Mon Sep 17 00:00:00 2001 From: thediaval Date: Thu, 10 Oct 2019 14:09:06 +0300 Subject: [PATCH 18/62] test(core): add table-sort directive test --- .../packages/core/src/lib/tests/table-sort.directive.spec.ts | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 npm/ng-packs/packages/core/src/lib/tests/table-sort.directive.spec.ts diff --git a/npm/ng-packs/packages/core/src/lib/tests/table-sort.directive.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/table-sort.directive.spec.ts new file mode 100644 index 0000000000..e69de29bb2 From 624e3b231179e4bb4b131d4de390c3a5143bd1af Mon Sep 17 00:00:00 2001 From: thediaval Date: Thu, 10 Oct 2019 14:46:35 +0300 Subject: [PATCH 19/62] test(core): add new test to table-directive.spec --- .../lib/directives/table-sort.directive.ts | 4 ++- .../lib/tests/table-sort.directive.spec.ts | 27 +++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/npm/ng-packs/packages/core/src/lib/directives/table-sort.directive.ts b/npm/ng-packs/packages/core/src/lib/directives/table-sort.directive.ts index 707f2ab6ef..77e9bc10e8 100644 --- a/npm/ng-packs/packages/core/src/lib/directives/table-sort.directive.ts +++ b/npm/ng-packs/packages/core/src/lib/directives/table-sort.directive.ts @@ -1,6 +1,8 @@ import { Directive, Input, Optional, Self, SimpleChanges, OnChanges } from '@angular/core'; import { Table } from 'primeng/table'; import { SortPipe, SortOrder } from '../pipes/sort.pipe'; +import { timer } from 'rxjs'; +import clone from 'just-clone'; export interface TableSortOptions { key: string; @@ -23,7 +25,7 @@ export class TableSortDirective implements OnChanges { ngOnChanges({ value, abpTableSort }: SimpleChanges) { if (value || abpTableSort) { this.abpTableSort = this.abpTableSort || ({} as TableSortOptions); - this.table.value = this.sortPipe.transform(this.value, this.abpTableSort.order, this.abpTableSort.key); + this.table.value = this.sortPipe.transform(clone(this.value), this.abpTableSort.order, this.abpTableSort.key); } } } diff --git a/npm/ng-packs/packages/core/src/lib/tests/table-sort.directive.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/table-sort.directive.spec.ts index e69de29bb2..c705735f03 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/table-sort.directive.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/table-sort.directive.spec.ts @@ -0,0 +1,27 @@ +import { SpectatorDirective, createDirectiveFactory, SpyObject } from '@ngneat/spectator/jest'; +import { TableSortDirective } from '../directives/table-sort.directive'; +import { TableModule, Table } from 'primeng/table'; + +describe('TableSortDirective', () => { + let spectator: SpectatorDirective; + let directive: TableSortDirective; + const createDirective = createDirectiveFactory({ + directive: TableSortDirective, + imports: [TableModule], + }); + + beforeEach(() => { + spectator = createDirective(``); + directive = spectator.directive; + }); + + test('should be created', () => { + expect(directive).toBeTruthy(); + }); + + test('should change table value', () => { + expect(directive.value).toEqual([1, 4, 2]); + const table = spectator.query(Table); + expect(table.value).toEqual([1, 2, 4]); + }); +}); From 14b597e8640d5a9207fb40e03eb5e60640dbe802 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Thu, 10 Oct 2019 17:08:56 +0300 Subject: [PATCH 20/62] test(core): add rest.service tests --- .../core/src/lib/services/rest.service.ts | 3 +- .../core/src/lib/tests/rest.service.spec.ts | 75 ++++++++++++++++++- 2 files changed, 76 insertions(+), 2 deletions(-) diff --git a/npm/ng-packs/packages/core/src/lib/services/rest.service.ts b/npm/ng-packs/packages/core/src/lib/services/rest.service.ts index e3c99bac2c..4057a4a29a 100644 --- a/npm/ng-packs/packages/core/src/lib/services/rest.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/rest.service.ts @@ -19,7 +19,8 @@ export class RestService { return throwError(err); } - request(request: HttpRequest | Rest.Request, config: Rest.Config = {}, api?: string): Observable { + request(request: HttpRequest | Rest.Request, config?: Rest.Config, api?: string): Observable { + config = config || ({} as Rest.Config); const { observe = Rest.Observe.Body, skipHandleError } = config; const url = (api || this.store.selectSnapshot(ConfigState.getApiUrl())) + request.url; const { method, ...options } = request; diff --git a/npm/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts index f91fbcef3e..6a06ec2c12 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts @@ -1,6 +1,10 @@ import { createHttpFactory, HttpMethod, SpectatorHttp, SpyObject } from '@ngneat/spectator/jest'; -import { RestService } from '../services/rest.service'; import { Store } from '@ngxs/store'; +import { Subscription, timer, interval, throwError, of } from 'rxjs'; +import { mapTo, catchError } from 'rxjs/operators'; +import { RestService } from '../services/rest.service'; +import { Rest } from '../models'; +import { RestOccurError } from '../actions'; describe('HttpClient testing', () => { let spectator: SpectatorHttp; @@ -19,4 +23,73 @@ describe('HttpClient testing', () => { spectator.service.request({ method: HttpMethod.GET, url: '/test', params: { id: 1 } }).subscribe(); spectator.expectOne(api + '/test?id=1', HttpMethod.GET); }); + + test('should send a POST request with body', () => { + spectator.service.request({ method: HttpMethod.POST, url: '/test', body: { id: 1 } }).subscribe(); + const req = spectator.expectOne(api + '/test', HttpMethod.POST); + expect(req.request.body['id']).toEqual(1); + }); + + test('should use the specific api', () => { + spectator.service.request({ method: HttpMethod.GET, url: '/test' }, null, 'http://test.api').subscribe(); + spectator.expectOne('http://test.api' + '/test', HttpMethod.GET); + }); + + test('should close the subscriber when observe equal to body', done => { + jest.spyOn(spectator.httpClient, 'request').mockReturnValue(interval(50)); + + const subscriber: Subscription = spectator.service + .request({ method: HttpMethod.GET, url: '/test' }, { observe: Rest.Observe.Body }) + .subscribe(); + + timer(51).subscribe(() => { + expect(subscriber.closed).toBe(true); + done(); + }); + }); + + test('should open the subscriber when observe not equal to body', done => { + jest.spyOn(spectator.httpClient, 'request').mockReturnValue(interval(50)); + + const subscriber: Subscription = spectator.service + .request({ method: HttpMethod.GET, url: '/test' }, { observe: Rest.Observe.Events }) + .subscribe(); + + timer(51).subscribe(() => { + expect(subscriber.closed).toBe(false); + done(); + }); + }); + + test('should handle the error', () => { + jest.spyOn(spectator.httpClient, 'request').mockReturnValue(throwError('An error')); + const spy = jest.spyOn(store, 'dispatch'); + + spectator.service + .request({ method: HttpMethod.GET, url: '/test' }, { observe: Rest.Observe.Events }) + .pipe( + catchError(err => { + expect(err).toBeTruthy(); + expect(spy.mock.calls[0][0] instanceof RestOccurError).toBe(true); + return of(null); + }), + ) + .subscribe(); + }); + + test('should not handle the error when skipHandleError is true', () => { + jest.spyOn(spectator.httpClient, 'request').mockReturnValue(throwError('An error')); + const spy = jest.spyOn(store, 'dispatch'); + + spectator.service + .request({ method: HttpMethod.GET, url: '/test' }, { observe: Rest.Observe.Events, skipHandleError: true }) + .pipe( + catchError(err => { + expect(err).toBeTruthy(); + expect(spy.mock.calls).toHaveLength(0); + return of(null); + }), + ) + .subscribe(); + }); }); From b856b1dcbf2da9c037d1750c16dc7bad4f215f24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 10 Oct 2019 18:48:03 +0300 Subject: [PATCH 21/62] Added generic host support for the Volo.Abp.Autofac package. --- .../AbpAutofacHostBuilderExtensions.cs | 20 +++++++++++++++++++ .../Volo.Abp.Autofac/Volo.Abp.Autofac.csproj | 1 + 2 files changed, 21 insertions(+) create mode 100644 framework/src/Volo.Abp.Autofac/Microsoft/Extensions/Hosting/AbpAutofacHostBuilderExtensions.cs diff --git a/framework/src/Volo.Abp.Autofac/Microsoft/Extensions/Hosting/AbpAutofacHostBuilderExtensions.cs b/framework/src/Volo.Abp.Autofac/Microsoft/Extensions/Hosting/AbpAutofacHostBuilderExtensions.cs new file mode 100644 index 0000000000..65b008ecf4 --- /dev/null +++ b/framework/src/Volo.Abp.Autofac/Microsoft/Extensions/Hosting/AbpAutofacHostBuilderExtensions.cs @@ -0,0 +1,20 @@ +using Autofac; +using Volo.Abp.Autofac; +using Microsoft.Extensions.DependencyInjection; + +namespace Microsoft.Extensions.Hosting +{ + public static class AbpAutofacHostBuilderExtensions + { + public static IHostBuilder UseAutofac(this IHostBuilder hostBuilder) + { + var containerBuilder = new ContainerBuilder(); + + return hostBuilder.ConfigureServices((_, services) => + { + services.AddObjectAccessor(containerBuilder); + }) + .UseServiceProviderFactory(new AbpAutofacServiceProviderFactory(containerBuilder)); + } + } +} diff --git a/framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj b/framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj index bc7c696c3d..fdb7318e30 100644 --- a/framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj +++ b/framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj @@ -16,6 +16,7 @@ + From 026cdc9b744cd8f376fed88a410bb0cdda0bae04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 10 Oct 2019 18:48:42 +0300 Subject: [PATCH 22/62] Use generic host in the MyCompanyName.MyProjectName.Web --- .../MyCompanyName.MyProjectName.Web.csproj | 2 +- .../MyProjectNameWebModule.cs | 5 +++- .../Program.cs | 23 +++++++++---------- .../Startup.cs | 13 +++-------- 4 files changed, 19 insertions(+), 24 deletions(-) diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj index 9bfeded944..8c65e90c25 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj @@ -31,7 +31,7 @@ - + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs index c41aa762d8..25a59a3d07 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs @@ -1,5 +1,7 @@ -using System.IO; +using System; +using System.IO; using Localization.Resources.AbpUi; +using Microsoft.AspNetCore; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; @@ -22,6 +24,7 @@ using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; using Volo.Abp.Autofac; using Volo.Abp.AutoMapper; +using Volo.Abp.Configuration; using Volo.Abp.FeatureManagement; using Volo.Abp.Identity.Web; using Volo.Abp.Localization; diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Program.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Program.cs index 47b0ced597..f5163b6894 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Program.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Program.cs @@ -1,6 +1,6 @@ using System; -using System.IO; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; using Serilog; using Serilog.Events; @@ -16,7 +16,7 @@ namespace MyCompanyName.MyProjectName.Web #else .MinimumLevel.Information() #endif - .MinimumLevel.Override("Microsoft", LogEventLevel.Debug) + .MinimumLevel.Override("Microsoft", LogEventLevel.Information) .Enrich.FromLogContext() .WriteTo.Async(c => c.File("Logs/logs.txt")) .CreateLogger(); @@ -24,7 +24,7 @@ namespace MyCompanyName.MyProjectName.Web try { Log.Information("Starting web host."); - BuildWebHostInternal(args).Run(); + CreateHostBuilder(args).Build().Run(); return 0; } catch (Exception ex) @@ -38,14 +38,13 @@ namespace MyCompanyName.MyProjectName.Web } } - public static IWebHost BuildWebHostInternal(string[] args) => - new WebHostBuilder() - .UseKestrel() - .UseContentRoot(Directory.GetCurrentDirectory()) - .UseIIS() - .UseIISIntegration() - .UseStartup() - .UseSerilog() - .Build(); + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }) + .UseAutofac() + .UseSerilog(); } } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Startup.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Startup.cs index db5c45e654..9428c74114 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Startup.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Startup.cs @@ -1,21 +1,14 @@ -using System; -using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Volo.Abp; namespace MyCompanyName.MyProjectName.Web { public class Startup { - public IServiceProvider ConfigureServices(IServiceCollection services) + public void ConfigureServices(IServiceCollection services) { - services.AddApplication(options => - { - options.UseAutofac(); - }); - - return services.BuildServiceProviderFromFactory(); + services.AddApplication(); } public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) From 69e145eea30940318d00ef57c0de35007d6824a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 10 Oct 2019 19:06:06 +0300 Subject: [PATCH 23/62] Set IConfigurationAccessor obsolete --- .../Volo/Abp/Configuration/IConfigurationAccessor.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Configuration/IConfigurationAccessor.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Configuration/IConfigurationAccessor.cs index c8ae448be2..34e5d96692 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Configuration/IConfigurationAccessor.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Configuration/IConfigurationAccessor.cs @@ -1,7 +1,9 @@ -using Microsoft.Extensions.Configuration; +using System; +using Microsoft.Extensions.Configuration; namespace Volo.Abp.Configuration { + [Obsolete("IConfigurationAccessor will be removed in v1.0. Use IConfiguration instead (be use that you are using generic host just like the startup templates).")] public interface IConfigurationAccessor { IConfigurationRoot Configuration { get; } From 44897c6696a61ed4e4a644423a91c09d693e5f0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 10 Oct 2019 19:19:53 +0300 Subject: [PATCH 24/62] Use generic host in the app startup template #391 --- ...panyName.MyProjectName.HttpApi.Host.csproj | 2 +- .../Program.cs | 21 +++++++++---------- .../Startup.cs | 13 +++--------- ...e.MyProjectName.HttpApi.HostWithIds.csproj | 2 +- .../Program.cs | 21 +++++++++---------- .../Startup.cs | 13 +++--------- ...nyName.MyProjectName.IdentityServer.csproj | 2 +- .../Program.cs | 21 +++++++++---------- .../Startup.cs | 13 +++--------- ...yCompanyName.MyProjectName.Web.Host.csproj | 2 +- .../Program.cs | 21 +++++++++---------- .../Startup.cs | 13 +++--------- .../Program.cs | 2 +- 13 files changed, 57 insertions(+), 89 deletions(-) diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj index a6e9f78048..a0d90bf695 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj @@ -9,7 +9,7 @@ - + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/Program.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/Program.cs index c4a5b7a007..b9a7094c54 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/Program.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/Program.cs @@ -1,6 +1,6 @@ using System; -using System.IO; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; using Serilog; using Serilog.Events; @@ -24,7 +24,7 @@ namespace MyCompanyName.MyProjectName try { Log.Information("Starting MyCompanyName.MyProjectName.HttpApi.Host."); - BuildWebHostInternal(args).Run(); + CreateHostBuilder(args).Build().Run(); return 0; } catch (Exception ex) @@ -38,14 +38,13 @@ namespace MyCompanyName.MyProjectName } } - public static IWebHost BuildWebHostInternal(string[] args) => - new WebHostBuilder() - .UseKestrel() - .UseContentRoot(Directory.GetCurrentDirectory()) - .UseIIS() - .UseIISIntegration() - .UseStartup() - .UseSerilog() - .Build(); + internal static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }) + .UseAutofac() + .UseSerilog(); } } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/Startup.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/Startup.cs index 896211a175..644425b274 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/Startup.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/Startup.cs @@ -1,22 +1,15 @@ -using System; -using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Volo.Abp; namespace MyCompanyName.MyProjectName { public class Startup { - public IServiceProvider ConfigureServices(IServiceCollection services) + public void ConfigureServices(IServiceCollection services) { - services.AddApplication(options => - { - options.UseAutofac(); - }); - - return services.BuildServiceProviderFromFactory(); + services.AddApplication(); } public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj index c8f15b6820..3a566c6563 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj @@ -9,7 +9,7 @@ - + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/Program.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/Program.cs index c4a5b7a007..b9a7094c54 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/Program.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/Program.cs @@ -1,6 +1,6 @@ using System; -using System.IO; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; using Serilog; using Serilog.Events; @@ -24,7 +24,7 @@ namespace MyCompanyName.MyProjectName try { Log.Information("Starting MyCompanyName.MyProjectName.HttpApi.Host."); - BuildWebHostInternal(args).Run(); + CreateHostBuilder(args).Build().Run(); return 0; } catch (Exception ex) @@ -38,14 +38,13 @@ namespace MyCompanyName.MyProjectName } } - public static IWebHost BuildWebHostInternal(string[] args) => - new WebHostBuilder() - .UseKestrel() - .UseContentRoot(Directory.GetCurrentDirectory()) - .UseIIS() - .UseIISIntegration() - .UseStartup() - .UseSerilog() - .Build(); + internal static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }) + .UseAutofac() + .UseSerilog(); } } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/Startup.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/Startup.cs index 896211a175..644425b274 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/Startup.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/Startup.cs @@ -1,22 +1,15 @@ -using System; -using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Volo.Abp; namespace MyCompanyName.MyProjectName { public class Startup { - public IServiceProvider ConfigureServices(IServiceCollection services) + public void ConfigureServices(IServiceCollection services) { - services.AddApplication(options => - { - options.UseAutofac(); - }); - - return services.BuildServiceProviderFromFactory(); + services.AddApplication(); } public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILoggerFactory loggerFactory) diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj index bdd8139f79..6ccc50b140 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj @@ -31,7 +31,7 @@ - + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Program.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Program.cs index 31b888e68d..3264de7167 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Program.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Program.cs @@ -1,6 +1,6 @@ using System; -using System.IO; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; using Serilog; using Serilog.Events; @@ -24,7 +24,7 @@ namespace MyCompanyName.MyProjectName try { Log.Information("Starting MyCompanyName.MyProjectName.IdentityServer."); - BuildWebHostInternal(args).Run(); + CreateHostBuilder(args).Build().Run(); return 0; } catch (Exception ex) @@ -38,14 +38,13 @@ namespace MyCompanyName.MyProjectName } } - internal static IWebHost BuildWebHostInternal(string[] args) => - new WebHostBuilder() - .UseKestrel() - .UseContentRoot(Directory.GetCurrentDirectory()) - .UseIIS() - .UseIISIntegration() - .UseStartup() - .UseSerilog() - .Build(); + internal static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }) + .UseAutofac() + .UseSerilog(); } } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Startup.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Startup.cs index dd8727554f..7fd62325bd 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Startup.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/Startup.cs @@ -1,20 +1,13 @@ -using System; -using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp; namespace MyCompanyName.MyProjectName { public class Startup { - public IServiceProvider ConfigureServices(IServiceCollection services) + public void ConfigureServices(IServiceCollection services) { - services.AddApplication(options => - { - options.UseAutofac(); - }); - - return services.BuildServiceProviderFromFactory(); + services.AddApplication(); } public void Configure(IApplicationBuilder app) diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj index ca8202b42a..d8f91dfd0d 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj @@ -15,7 +15,7 @@ - + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Program.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Program.cs index 0fdbda7bf9..5143e37164 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Program.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Program.cs @@ -1,6 +1,6 @@ using System; -using System.IO; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; using Serilog; using Serilog.Events; @@ -24,7 +24,7 @@ namespace MyCompanyName.MyProjectName.Web try { Log.Information("Starting web host."); - BuildWebHostInternal(args).Run(); + CreateHostBuilder(args).Build().Run(); return 0; } catch (Exception ex) @@ -38,14 +38,13 @@ namespace MyCompanyName.MyProjectName.Web } } - public static IWebHost BuildWebHostInternal(string[] args) => - new WebHostBuilder() - .UseKestrel() - .UseContentRoot(Directory.GetCurrentDirectory()) - .UseIIS() - .UseIISIntegration() - .UseStartup() - .UseSerilog() - .Build(); + internal static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }) + .UseAutofac() + .UseSerilog(); } } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Startup.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Startup.cs index db5c45e654..9428c74114 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Startup.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Startup.cs @@ -1,21 +1,14 @@ -using System; -using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Volo.Abp; namespace MyCompanyName.MyProjectName.Web { public class Startup { - public IServiceProvider ConfigureServices(IServiceCollection services) + public void ConfigureServices(IServiceCollection services) { - services.AddApplication(options => - { - options.UseAutofac(); - }); - - return services.BuildServiceProviderFromFactory(); + services.AddApplication(); } public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Program.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Program.cs index f5163b6894..5143e37164 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Program.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/Program.cs @@ -38,7 +38,7 @@ namespace MyCompanyName.MyProjectName.Web } } - public static IHostBuilder CreateHostBuilder(string[] args) => + internal static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults(webBuilder => { From 9c1dd695e6dcbe55a9d877fdfd86d150fc8791f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Thu, 10 Oct 2019 19:51:39 +0300 Subject: [PATCH 25/62] Move module template to generic host --- ...panyName.MyProjectName.HttpApi.Host.csproj | 2 +- .../Program.cs | 20 +++++++++---------- .../Startup.cs | 10 ++-------- ...nyName.MyProjectName.IdentityServer.csproj | 2 +- .../Program.cs | 20 +++++++++---------- .../Startup.cs | 10 ++-------- ...yCompanyName.MyProjectName.Web.Host.csproj | 2 +- .../Program.cs | 20 +++++++++---------- .../Startup.cs | 13 +++--------- ...mpanyName.MyProjectName.Web.Unified.csproj | 2 +- .../MyProjectNameWebUnifiedModule.cs | 1 - .../Program.cs | 20 +++++++++---------- .../Startup.cs | 13 +++--------- 13 files changed, 54 insertions(+), 81 deletions(-) diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj index efcb7e857a..6a2ee611da 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj @@ -9,7 +9,7 @@ - + diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Program.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Program.cs index 639e485a38..31537b2398 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Program.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Program.cs @@ -1,6 +1,7 @@ using System; using System.IO; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; using Serilog; using Serilog.Events; @@ -24,7 +25,7 @@ namespace MyCompanyName.MyProjectName try { Log.Information("Starting web host."); - BuildWebHostInternal(args).Run(); + CreateHostBuilder(args).Build().Run(); return 0; } catch (Exception ex) @@ -38,14 +39,13 @@ namespace MyCompanyName.MyProjectName } } - public static IWebHost BuildWebHostInternal(string[] args) => - new WebHostBuilder() - .UseKestrel() - .UseContentRoot(Directory.GetCurrentDirectory()) - .UseIIS() - .UseIISIntegration() - .UseStartup() - .UseSerilog() - .Build(); + internal static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }) + .UseAutofac() + .UseSerilog(); } } diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Startup.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Startup.cs index 19fe569013..dc9807e4a0 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Startup.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/Startup.cs @@ -3,20 +3,14 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Volo.Abp; namespace MyCompanyName.MyProjectName { public class Startup { - public IServiceProvider ConfigureServices(IServiceCollection services) + public void ConfigureServices(IServiceCollection services) { - services.AddApplication(options => - { - options.UseAutofac(); - }); - - return services.BuildServiceProviderFromFactory(); + services.AddApplication(); } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj index 5586141e5a..f0431dce74 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj @@ -7,7 +7,7 @@ - + diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Program.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Program.cs index 639e485a38..31537b2398 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Program.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Program.cs @@ -1,6 +1,7 @@ using System; using System.IO; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; using Serilog; using Serilog.Events; @@ -24,7 +25,7 @@ namespace MyCompanyName.MyProjectName try { Log.Information("Starting web host."); - BuildWebHostInternal(args).Run(); + CreateHostBuilder(args).Build().Run(); return 0; } catch (Exception ex) @@ -38,14 +39,13 @@ namespace MyCompanyName.MyProjectName } } - public static IWebHost BuildWebHostInternal(string[] args) => - new WebHostBuilder() - .UseKestrel() - .UseContentRoot(Directory.GetCurrentDirectory()) - .UseIIS() - .UseIISIntegration() - .UseStartup() - .UseSerilog() - .Build(); + internal static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }) + .UseAutofac() + .UseSerilog(); } } diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Startup.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Startup.cs index ff2a868a60..5efb1ca00d 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Startup.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Startup.cs @@ -3,20 +3,14 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Volo.Abp; namespace MyCompanyName.MyProjectName { public class Startup { - public IServiceProvider ConfigureServices(IServiceCollection services) + public void ConfigureServices(IServiceCollection services) { - services.AddApplication(options => - { - options.UseAutofac(); - }); - - return services.BuildServiceProviderFromFactory(); + services.AddApplication(); } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj index f98264ed74..4a6578146d 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj @@ -9,7 +9,7 @@ - + diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/Program.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/Program.cs index 639e485a38..31537b2398 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/Program.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/Program.cs @@ -1,6 +1,7 @@ using System; using System.IO; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; using Serilog; using Serilog.Events; @@ -24,7 +25,7 @@ namespace MyCompanyName.MyProjectName try { Log.Information("Starting web host."); - BuildWebHostInternal(args).Run(); + CreateHostBuilder(args).Build().Run(); return 0; } catch (Exception ex) @@ -38,14 +39,13 @@ namespace MyCompanyName.MyProjectName } } - public static IWebHost BuildWebHostInternal(string[] args) => - new WebHostBuilder() - .UseKestrel() - .UseContentRoot(Directory.GetCurrentDirectory()) - .UseIIS() - .UseIISIntegration() - .UseStartup() - .UseSerilog() - .Build(); + internal static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }) + .UseAutofac() + .UseSerilog(); } } diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/Startup.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/Startup.cs index be06102769..1c5ffbe462 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/Startup.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/Startup.cs @@ -1,21 +1,14 @@ -using System; -using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Volo.Abp; namespace MyCompanyName.MyProjectName { public class Startup { - public IServiceProvider ConfigureServices(IServiceCollection services) + public void ConfigureServices(IServiceCollection services) { - services.AddApplication(options => - { - options.UseAutofac(); - }); - - return services.BuildServiceProviderFromFactory(); + services.AddApplication(); } public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyCompanyName.MyProjectName.Web.Unified.csproj b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyCompanyName.MyProjectName.Web.Unified.csproj index acf0fcb8c3..3c597f160c 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyCompanyName.MyProjectName.Web.Unified.csproj +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyCompanyName.MyProjectName.Web.Unified.csproj @@ -9,7 +9,7 @@ - + diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs index 004c00d3c1..ccfc845eaf 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs @@ -1,6 +1,5 @@ using System.IO; using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using MyCompanyName.MyProjectName.EntityFrameworkCore; diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Program.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Program.cs index c1e595c693..e196a31cb4 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Program.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Program.cs @@ -1,6 +1,7 @@ using System; using System.IO; using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Hosting; using Serilog; using Serilog.Events; @@ -20,7 +21,7 @@ namespace MyCompanyName.MyProjectName try { Log.Information("Starting web host."); - BuildWebHostInternal(args).Run(); + CreateHostBuilder(args).Build().Run(); return 0; } catch (Exception ex) @@ -34,14 +35,13 @@ namespace MyCompanyName.MyProjectName } } - public static IWebHost BuildWebHostInternal(string[] args) => - new WebHostBuilder() - .UseKestrel() - .UseContentRoot(Directory.GetCurrentDirectory()) - .UseIIS() - .UseIISIntegration() - .UseStartup() - .UseSerilog() - .Build(); + internal static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureWebHostDefaults(webBuilder => + { + webBuilder.UseStartup(); + }) + .UseAutofac() + .UseSerilog(); } } diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Startup.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Startup.cs index 0dbb22e4e6..e052534eb7 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Startup.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Startup.cs @@ -1,22 +1,15 @@ -using System; -using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; -using Volo.Abp; namespace MyCompanyName.MyProjectName { public class Startup { - public IServiceProvider ConfigureServices(IServiceCollection services) + public void ConfigureServices(IServiceCollection services) { - services.AddApplication(options => - { - options.UseAutofac(); - }); - - return services.BuildServiceProviderFromFactory(); + services.AddApplication(); } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) From a54735811b9875acf155e0122ffad2178774f694 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Fri, 11 Oct 2019 09:28:20 +0300 Subject: [PATCH 26/62] fixed a bug --- .../Steps/ProjectReferenceReplaceStep.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ProjectReferenceReplaceStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ProjectReferenceReplaceStep.cs index b040c5320d..44c4f9c0aa 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ProjectReferenceReplaceStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ProjectReferenceReplaceStep.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps new ProjectReferenceReplacer.LocalProjectPathReferenceReplacer( context.Files, - "MyCompanyName.MyProjectName", + context.Module.Namespace, localAbpRepoPath ).Run(); } @@ -65,14 +65,14 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps private abstract class ProjectReferenceReplacer { private readonly List _entries; - private readonly string _companyAndProjectNamePlaceHolder; + private readonly string _projectName; protected ProjectReferenceReplacer( List entries, - string companyAndProjectNamePlaceHolder) + string projectName) { _entries = entries; - _companyAndProjectNamePlaceHolder = companyAndProjectNamePlaceHolder; + _projectName = projectName; } public void Run() @@ -108,7 +108,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps var oldNodeIncludeValue = oldNode.Attributes["Include"].Value; // ReSharper disable once PossibleNullReferenceException : Can not be null because nodes are selected with include attribute filter in previous method - if (oldNodeIncludeValue.Contains($"{_companyAndProjectNamePlaceHolder}")) + if (oldNodeIncludeValue.Contains($"{_projectName}")) { continue; } @@ -140,8 +140,8 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps { private readonly string _nugetPackageVersion; - public NugetReferenceReplacer(List entries, string companyAndProjectNamePlaceHolder, string nugetPackageVersion) - : base(entries, companyAndProjectNamePlaceHolder) + public NugetReferenceReplacer(List entries, string projectName, string nugetPackageVersion) + : base(entries, projectName) { _nugetPackageVersion = nugetPackageVersion; } @@ -177,8 +177,8 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps { private readonly string _gitHubLocalRepositoryPath; - public LocalProjectPathReferenceReplacer(List entries, string companyAndProjectNamePlaceHolder, string gitHubLocalRepositoryPath) - : base(entries, companyAndProjectNamePlaceHolder) + public LocalProjectPathReferenceReplacer(List entries, string projectName, string gitHubLocalRepositoryPath) + : base(entries, projectName) { _gitHubLocalRepositoryPath = gitHubLocalRepositoryPath; } From 88025ddac72b1fbb9a3608be327242448d35c975 Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Fri, 11 Oct 2019 10:02:56 +0300 Subject: [PATCH 27/62] added ReplaceCommonPropsStep --- .../ModuleProjectBuildPipelineBuilder.cs | 1 + .../Steps/ProjectReferenceReplaceStep.cs | 6 +- .../Building/Steps/ReplaceCommonPropsStep.cs | 96 +++++++++++++++++++ 3 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ReplaceCommonPropsStep.cs diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleProjectBuildPipelineBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleProjectBuildPipelineBuilder.cs index fc2a5b0dbc..5eba01b388 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleProjectBuildPipelineBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleProjectBuildPipelineBuilder.cs @@ -10,6 +10,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building pipeline.Steps.Add(new FileEntryListReadStep()); pipeline.Steps.Add(new ProjectReferenceReplaceStep()); + pipeline.Steps.Add(new ReplaceCommonPropsStep()); pipeline.Steps.Add(new CreateProjectResultZipStep()); return pipeline; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ProjectReferenceReplaceStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ProjectReferenceReplaceStep.cs index 44c4f9c0aa..29f5afb19c 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ProjectReferenceReplaceStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ProjectReferenceReplaceStep.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps new ProjectReferenceReplacer.LocalProjectPathReferenceReplacer( context.Files, - context.Module.Namespace, + context.Module?.Namespace ?? "MyCompanyName.MyProjectName", localAbpRepoPath ).Run(); } @@ -37,7 +37,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps new ProjectReferenceReplacer.NugetReferenceReplacer( context.Files, - "MyCompanyName.MyProjectName", + context.Module?.Namespace ?? "MyCompanyName.MyProjectName", nugetPackageVersion ).Run(); } @@ -108,7 +108,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps var oldNodeIncludeValue = oldNode.Attributes["Include"].Value; // ReSharper disable once PossibleNullReferenceException : Can not be null because nodes are selected with include attribute filter in previous method - if (oldNodeIncludeValue.Contains($"{_projectName}")) + if (oldNodeIncludeValue.Contains(_projectName)) { continue; } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ReplaceCommonPropsStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ReplaceCommonPropsStep.cs new file mode 100644 index 0000000000..07b2081738 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/ReplaceCommonPropsStep.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text.RegularExpressions; +using System.Xml; +using Volo.Abp.Cli.ProjectBuilding.Files; + +namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps +{ + public class ReplaceCommonPropsStep : ProjectBuildPipelineStep + { + public override void Execute(ProjectBuildContext context) + { + new CommonPropsReplacer(context.Files).Run(); + } + + private class CommonPropsReplacer + { + private readonly List _entries; + + public CommonPropsReplacer( + List entries) + { + _entries = entries; + } + + public void Run() + { + foreach (var fileEntry in _entries) + { + if (fileEntry.Name.EndsWith(".csproj")) + { + fileEntry.SetContent(ProcessFileContent(fileEntry.Content)); + } + } + } + + private string ProcessFileContent(string content) + { + Check.NotNull(content, nameof(content)); + + var doc = new XmlDocument() { PreserveWhitespace = true }; + + doc.Load(GenerateStreamFromString(content)); + + return ProcessReferenceNodes(doc, content); + } + + private string ProcessReferenceNodes(XmlDocument doc, string content) + { + Check.NotNull(content, nameof(content)); + + var importNodes = doc.SelectNodes("/Project/Import[@Project]"); + + if (importNodes == null) + { + return doc.OuterXml; + } + + foreach (XmlNode node in importNodes) + { + if (!(node.Attributes?["Project"]?.Value?.EndsWith("\\common.props") ?? false)) + { + continue; + } + + node.ParentNode?.RemoveChild(node); + } + + var propertyGroupNodes = doc.SelectNodes("/Project/PropertyGroup"); + + if (propertyGroupNodes == null || propertyGroupNodes.Count < 1) + { + return doc.OuterXml; + } + + var firstPropertyGroupNode = propertyGroupNodes.Item(0); + var langNode = doc.CreateElement("LangVersion"); + langNode.InnerText = "latest"; + firstPropertyGroupNode?.PrependChild(langNode); + + return doc.OuterXml; + } + + private static Stream GenerateStreamFromString(string s) + { + var stream = new MemoryStream(); + var writer = new StreamWriter(stream); + writer.Write(s); + writer.Flush(); + stream.Position = 0; + return stream; + } + } + } +} From 0c1946d5dac474466406172bf8acdd14a9a7fd6a Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Fri, 11 Oct 2019 11:13:51 +0300 Subject: [PATCH 28/62] test(core): add lazy-load-service.spec --- .../src/lib/services/lazy-load.service.ts | 6 +- .../src/lib/tests/lazy-load.service.spec.ts | 92 +++++++++++++++++++ 2 files changed, 95 insertions(+), 3 deletions(-) create mode 100644 npm/ng-packs/packages/core/src/lib/tests/lazy-load.service.spec.ts diff --git a/npm/ng-packs/packages/core/src/lib/services/lazy-load.service.ts b/npm/ng-packs/packages/core/src/lib/services/lazy-load.service.ts index 0cdf546ff0..fa6ab37fa1 100644 --- a/npm/ng-packs/packages/core/src/lib/services/lazy-load.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/lazy-load.service.ts @@ -1,5 +1,5 @@ -import { Inject, Injectable } from '@angular/core'; -import { Observable, ReplaySubject } from 'rxjs'; +import { Injectable } from '@angular/core'; +import { Observable, ReplaySubject, throwError } from 'rxjs'; import { uuid } from '../utils'; @Injectable({ @@ -16,7 +16,7 @@ export class LazyLoadService { position: InsertPosition = 'afterend', ): Observable { if (!urlOrUrls && !content) { - return; + return throwError('Should pass url or content'); } else if (!urlOrUrls && content) { urlOrUrls = [null]; } diff --git a/npm/ng-packs/packages/core/src/lib/tests/lazy-load.service.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/lazy-load.service.spec.ts new file mode 100644 index 0000000000..8afb0745f6 --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/tests/lazy-load.service.spec.ts @@ -0,0 +1,92 @@ +import { createServiceFactory, SpectatorService } from '@ngneat/spectator/jest'; +import clone from 'just-clone'; +import { LazyLoadService } from '../services/lazy-load.service'; +import { catchError } from 'rxjs/operators'; +import { of } from 'rxjs'; + +describe('LazyLoadService', () => { + let spectator: SpectatorService; + let service: LazyLoadService; + const scriptElement = document.createElement('script'); + const linkElement = document.createElement('link'); + const styleElement = document.createElement('style'); + const cloneDocument = clone(document); + + const createService = createServiceFactory({ service: LazyLoadService }); + + beforeEach(() => { + spectator = createService(); + service = spectator.service; + }); + + afterEach(() => (document = clone(cloneDocument))); + + test('should load script with content just one time', done => { + const spy = jest.spyOn(document, 'createElement'); + spy.mockReturnValue(scriptElement); + + service.load('https://abp.io', 'script', 'test').subscribe(res => { + expect(document.querySelector('script[src="https://abp.io"][type="text/javascript"]').textContent).toMatch( + 'test', + ); + }); + + scriptElement.onload(null); + + service.load('https://abp.io', 'script', 'test').subscribe(res => { + expect(document.querySelectorAll('script[src="https://abp.io"][type="text/javascript"]')).toHaveLength(1); + done(); + }); + }); + + test('should load style element', done => { + const spy = jest.spyOn(document, 'createElement'); + spy.mockReturnValue(styleElement); + + const content = '* { color: black; }'; + service.load(null, 'style', content).subscribe(res => { + expect(document.querySelector('style').textContent).toMatch(content); + done(); + }); + + styleElement.onload(null); + }); + + describe('style with url', () => { + beforeEach(() => { + const spy = jest.spyOn(document, 'createElement'); + spy.mockReturnValue(linkElement); + }); + + test('should load an link element', done => { + service.load('https://abp.io', 'style').subscribe(res => { + expect(document.querySelector('link[type="text/css"][rel="stylesheet"][href="https://abp.io"]')).toBeTruthy(); + done(); + }); + + linkElement.onload(null); + }); + + test('should load link elements', done => { + service.load(['https://abp.io', 'https://volosoft.com'], 'style').subscribe(res => { + expect(document.querySelector('link[href="https://volosoft.com"]')).toBeTruthy(); + done(); + }); + + linkElement.onload(null); + }); + }); + + test('should throw error when required parameters are null', done => { + service + .load(null, 'style') + .pipe( + catchError(err => { + expect(err).toBeTruthy(); + done(); + return of(null); + }), + ) + .subscribe(); + }); +}); From 403513b633916d9ac09fbd5d32de98b360de80ae Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Fri, 11 Oct 2019 11:28:00 +0300 Subject: [PATCH 29/62] bugfix in audit log repos --- .../EntityFrameworkCore/EfCoreAuditLogRepository.cs | 4 ++-- .../Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs index 4564a6d7ae..094f946777 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs @@ -110,8 +110,8 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore .IncludeDetails(includeDetails) .WhereIf(startTime.HasValue, auditLog => auditLog.ExecutionTime >= startTime) .WhereIf(endTime.HasValue, auditLog => auditLog.ExecutionTime <= endTime) - .WhereIf(hasException.HasValue && hasException.Value, auditLog => auditLog.Exceptions != null) - .WhereIf(hasException.HasValue && !hasException.Value, auditLog => auditLog.Exceptions == null) + .WhereIf(hasException.HasValue && hasException.Value, auditLog => auditLog.Exceptions != null && auditLog.Exceptions != "") + .WhereIf(hasException.HasValue && !hasException.Value, auditLog => auditLog.Exceptions == null || auditLog.Exceptions == "") .WhereIf(httpMethod != null, auditLog => auditLog.HttpMethod == httpMethod) .WhereIf(url != null, auditLog => auditLog.Url != null && auditLog.Url.Contains(url)) .WhereIf(userName != null, auditLog => auditLog.UserName == userName) diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs index 1f090f81f2..a0e3c31961 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs @@ -109,8 +109,8 @@ namespace Volo.Abp.AuditLogging.MongoDB return GetMongoQueryable() .WhereIf(startTime.HasValue, auditLog => auditLog.ExecutionTime >= startTime) .WhereIf(endTime.HasValue, auditLog => auditLog.ExecutionTime <= endTime) - .WhereIf(hasException.HasValue && hasException.Value, auditLog => auditLog.Exceptions != null) - .WhereIf(hasException.HasValue && !hasException.Value, auditLog => auditLog.Exceptions == null) + .WhereIf(hasException.HasValue && hasException.Value, auditLog => auditLog.Exceptions != null && auditLog.Exceptions != "") + .WhereIf(hasException.HasValue && !hasException.Value, auditLog => auditLog.Exceptions == null || auditLog.Exceptions == "") .WhereIf(httpMethod != null, auditLog => auditLog.HttpMethod == httpMethod) .WhereIf(url != null, auditLog => auditLog.Url != null && auditLog.Url.Contains(url)) .WhereIf(userName != null, auditLog => auditLog.UserName == userName) From 2aa70bf9cb89e2c09ba2cbf0d048b5427c2b28db Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Fri, 11 Oct 2019 11:43:34 +0300 Subject: [PATCH 30/62] Feature Management localization fixes --- .../Volo.Abp.FeatureManagement.Domain.Shared.csproj | 2 +- .../AbpFeatureManagementDomainSharedModule.cs | 2 +- .../FeatureManagement/Localization/Domain/en.json | 2 +- .../Volo.Abp.FeatureManagement.Domain.csproj | 5 ----- .../AbpFeatureManagementDomainModule.cs | 12 ------------ .../FeatureManagement/Localization/Domain/cs.json | 6 ------ .../FeatureManagement/Localization/Domain/en.json | 6 ------ .../FeatureManagement/Localization/Domain/pl.json | 6 ------ .../FeatureManagement/Localization/Domain/pt-BR.json | 6 ------ .../FeatureManagement/Localization/Domain/tr.json | 6 ------ .../FeatureManagement/Localization/Domain/vi.json | 6 ------ .../Localization/Domain/zh-Hans.json | 6 ------ 12 files changed, 3 insertions(+), 62 deletions(-) delete mode 100644 modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/cs.json delete mode 100644 modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/en.json delete mode 100644 modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/pl.json delete mode 100644 modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/pt-BR.json delete mode 100644 modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/tr.json delete mode 100644 modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/vi.json delete mode 100644 modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/zh-Hans.json diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo.Abp.FeatureManagement.Domain.Shared.csproj b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo.Abp.FeatureManagement.Domain.Shared.csproj index 1772c74748..5990dc210c 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo.Abp.FeatureManagement.Domain.Shared.csproj +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo.Abp.FeatureManagement.Domain.Shared.csproj @@ -8,8 +8,8 @@ - + diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/AbpFeatureManagementDomainSharedModule.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/AbpFeatureManagementDomainSharedModule.cs index 0008faf693..95bff48f2e 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/AbpFeatureManagementDomainSharedModule.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/AbpFeatureManagementDomainSharedModule.cs @@ -24,7 +24,7 @@ namespace Volo.Abp.FeatureManagement .Add("en") .AddBaseTypes( typeof(AbpValidationResource) - ).AddVirtualJson("Volo/Abp/FeatureManagement/Localization/Resources/Domain"); + ).AddVirtualJson("Volo/Abp/FeatureManagement/Localization/Domain"); }); } } diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/Localization/Domain/en.json b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/Localization/Domain/en.json index 2e8812968d..e5a2406aaf 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/Localization/Domain/en.json +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/Localization/Domain/en.json @@ -2,6 +2,6 @@ "culture": "en", "texts": { "Features": "Features", - "NoFeatureFoundMessage": "There is't any available feature." + "NoFeatureFoundMessage": "There isn't any available feature." } } \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo.Abp.FeatureManagement.Domain.csproj b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo.Abp.FeatureManagement.Domain.csproj index 15145798e2..8b29b704ce 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo.Abp.FeatureManagement.Domain.csproj +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo.Abp.FeatureManagement.Domain.csproj @@ -13,11 +13,6 @@ - - - - - diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/AbpFeatureManagementDomainModule.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/AbpFeatureManagementDomainModule.cs index 0958746237..22b845eeaa 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/AbpFeatureManagementDomainModule.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/AbpFeatureManagementDomainModule.cs @@ -27,18 +27,6 @@ namespace Volo.Abp.FeatureManagement options.ProviderPolicies[TenantFeatureValueProvider.ProviderName] = "AbpTenantManagement.Tenants.ManageFeatures"; }); - Configure(options => - { - options.FileSets.AddEmbedded(); - }); - - Configure(options => - { - options.Resources - .Get() - .AddVirtualJson("/Volo/Abp/FeatureManagement/Localization/Domain"); - }); - Configure(options => { options.MapCodeNamespace("AbpFeatureManagement", typeof(AbpFeatureManagementResource)); diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/cs.json b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/cs.json deleted file mode 100644 index 6a060a54c1..0000000000 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/cs.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "culture": "cs", - "texts": { - - } -} \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/en.json b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/en.json deleted file mode 100644 index 92e4e9582b..0000000000 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/en.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "culture": "en", - "texts": { - - } -} \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/pl.json b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/pl.json deleted file mode 100644 index 2ea227cbf3..0000000000 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/pl.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "culture": "pl", - "texts": { - - } -} \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/pt-BR.json b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/pt-BR.json deleted file mode 100644 index 6d746df04c..0000000000 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/pt-BR.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "culture": "pt-BR", - "texts": { - - } -} \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/tr.json b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/tr.json deleted file mode 100644 index 3f906a3cdc..0000000000 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/tr.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "culture": "tr", - "texts": { - - } -} \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/vi.json b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/vi.json deleted file mode 100644 index d8eb5f3c75..0000000000 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/vi.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "culture": "vi", - "texts": { - - } -} diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/zh-Hans.json b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/zh-Hans.json deleted file mode 100644 index 25137f1ee3..0000000000 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/zh-Hans.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "culture": "zh-Hans", - "texts": { - - } -} \ No newline at end of file From ce55eb2afa4815f66d2b4bde29d6bbaf5e2e90cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 11 Oct 2019 12:15:18 +0300 Subject: [PATCH 31/62] Use .AsNoTracking() on EF Core repo Delete --- .../Repositories/EntityFrameworkCore/EfCoreRepository.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs index e26624747c..d7d39a25d8 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs @@ -143,7 +143,10 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore public override void Delete(Expression> predicate, bool autoSave = false) { - base.Delete(predicate, autoSave); + foreach (var entity in GetQueryable().AsNoTracking().Where(predicate).ToList()) + { + Delete(entity, autoSave); + } if (autoSave) { @@ -153,7 +156,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore public override async Task DeleteAsync(Expression> predicate, bool autoSave = false, CancellationToken cancellationToken = default) { - var entities = await GetQueryable() + var entities = await GetQueryable().AsNoTracking() .Where(predicate) .ToListAsync(GetCancellationToken(cancellationToken)); From 6a05ad36ead31fa5534cfbba3e43115152af6f87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 11 Oct 2019 12:17:45 +0300 Subject: [PATCH 32/62] Revert "Use .AsNoTracking() on EF Core repo Delete" This reverts commit ce55eb2afa4815f66d2b4bde29d6bbaf5e2e90cf. --- .../Repositories/EntityFrameworkCore/EfCoreRepository.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs index d7d39a25d8..e26624747c 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs @@ -143,10 +143,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore public override void Delete(Expression> predicate, bool autoSave = false) { - foreach (var entity in GetQueryable().AsNoTracking().Where(predicate).ToList()) - { - Delete(entity, autoSave); - } + base.Delete(predicate, autoSave); if (autoSave) { @@ -156,7 +153,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore public override async Task DeleteAsync(Expression> predicate, bool autoSave = false, CancellationToken cancellationToken = default) { - var entities = await GetQueryable().AsNoTracking() + var entities = await GetQueryable() .Where(predicate) .ToListAsync(GetCancellationToken(cancellationToken)); From 67bb801d8e7f46d8db70108efb9606928b7a158d Mon Sep 17 00:00:00 2001 From: Yunus Emre Kalkan Date: Fri, 11 Oct 2019 13:34:23 +0300 Subject: [PATCH 33/62] Used new Volo.Abp.Ddd.Application.Contracts resolves #1889 --- .../MyCompanyName.MyProjectName.Application.Contracts.csproj | 3 ++- .../MyProjectNameApplicationContractsModule.cs | 4 +++- .../MyCompanyName.MyProjectName.Application.csproj | 1 + .../MyProjectNameApplicationModule.cs | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application.Contracts/MyCompanyName.MyProjectName.Application.Contracts.csproj b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application.Contracts/MyCompanyName.MyProjectName.Application.Contracts.csproj index 729ccf3294..fba582f665 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application.Contracts/MyCompanyName.MyProjectName.Application.Contracts.csproj +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application.Contracts/MyCompanyName.MyProjectName.Application.Contracts.csproj @@ -8,7 +8,8 @@ - + + diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application.Contracts/MyProjectNameApplicationContractsModule.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application.Contracts/MyProjectNameApplicationContractsModule.cs index fb601c8ea0..947e42f33a 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application.Contracts/MyProjectNameApplicationContractsModule.cs +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application.Contracts/MyProjectNameApplicationContractsModule.cs @@ -1,12 +1,14 @@ using Volo.Abp.Application; using Volo.Abp.Modularity; using Volo.Abp.VirtualFileSystem; +using Volo.Abp.Authorization; namespace MyCompanyName.MyProjectName { [DependsOn( typeof(MyProjectNameDomainSharedModule), - typeof(AbpDddApplicationModule) + typeof(AbpDddApplicationContractsModule), + typeof(AbpAuthorizationModule) )] public class MyProjectNameApplicationContractsModule : AbpModule { diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyCompanyName.MyProjectName.Application.csproj b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyCompanyName.MyProjectName.Application.csproj index 89e9307b47..04cbe3d9c1 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyCompanyName.MyProjectName.Application.csproj +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyCompanyName.MyProjectName.Application.csproj @@ -9,6 +9,7 @@ + diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyProjectNameApplicationModule.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyProjectNameApplicationModule.cs index 7b6410654a..bb0e72e856 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyProjectNameApplicationModule.cs +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyProjectNameApplicationModule.cs @@ -1,11 +1,13 @@ using Volo.Abp.AutoMapper; using Volo.Abp.Modularity; +using Volo.Abp.Application; namespace MyCompanyName.MyProjectName { [DependsOn( typeof(MyProjectNameDomainModule), typeof(MyProjectNameApplicationContractsModule), + typeof(AbpDddApplicationModule), typeof(AbpAutoMapperModule) )] public class MyProjectNameApplicationModule : AbpModule From e5ea49e17ba678d006f0d247c91b0ecc6ea58971 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 11 Oct 2019 14:09:46 +0300 Subject: [PATCH 34/62] Register IConfiguration if not registered before. --- .../InternalServiceCollectionExtensions.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Internal/InternalServiceCollectionExtensions.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Internal/InternalServiceCollectionExtensions.cs index 5b50e6fee2..609328216e 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Internal/InternalServiceCollectionExtensions.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Internal/InternalServiceCollectionExtensions.cs @@ -24,14 +24,19 @@ namespace Volo.Abp.Internal var assemblyFinder = new AssemblyFinder(abpApplication); var typeFinder = new TypeFinder(assemblyFinder); - services.TryAddSingleton( - new DefaultConfigurationAccessor( - ConfigurationHelper.BuildConfiguration( - applicationCreationOptions.Configuration - ) + var configurationAccessor = new DefaultConfigurationAccessor( + ConfigurationHelper.BuildConfiguration( + applicationCreationOptions.Configuration ) ); + services.TryAddSingleton(configurationAccessor); + + if (!services.IsAdded()) + { + services.AddSingleton(configurationAccessor.Configuration); + } + services.TryAddSingleton(moduleLoader); services.TryAddSingleton(assemblyFinder); services.TryAddSingleton(typeFinder); From 9b733bffe36c7c96b5573464a402918327447ccb Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Fri, 11 Oct 2019 14:12:51 +0300 Subject: [PATCH 35/62] chore: upgrade angular versions --- templates/app/angular/package.json | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/templates/app/angular/package.json b/templates/app/angular/package.json index 6a8fb96d91..45d2c1592a 100644 --- a/templates/app/angular/package.json +++ b/templates/app/angular/package.json @@ -6,7 +6,7 @@ "start": "ng serve", "start:hmr": "ng serve --configuration hmr", "build": "ng build", - "build:prod": "ng build --configuration production", + "build:prod": "ng build --prod", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" @@ -18,14 +18,14 @@ "@abp/ng.theme.basic": "^0.9.0", "@abp/ng.tenant-management": "^0.9.0", "@abp/ng.setting-management": "^0.9.0", - "@angular/animations": "~8.2.8", - "@angular/common": "~8.2.8", - "@angular/compiler": "~8.2.8", - "@angular/core": "~8.2.8", - "@angular/forms": "~8.2.8", - "@angular/platform-browser": "~8.2.8", - "@angular/platform-browser-dynamic": "~8.2.8", - "@angular/router": "~8.2.8", + "@angular/animations": "~8.2.10", + "@angular/common": "~8.2.10", + "@angular/compiler": "~8.2.10", + "@angular/core": "~8.2.10", + "@angular/forms": "~8.2.10", + "@angular/platform-browser": "~8.2.10", + "@angular/platform-browser-dynamic": "~8.2.10", + "@angular/router": "~8.2.10", "@angularclass/hmr": "^2.1.3", "@ngxs/hmr-plugin": "^3.5.0", "@ngxs/devtools-plugin": "^3.5.0", @@ -34,10 +34,10 @@ "zone.js": "~0.9.1" }, "devDependencies": { - "@angular-devkit/build-angular": "~0.803.6", - "@angular/cli": "~8.3.6", - "@angular/compiler-cli": "~8.2.8", - "@angular/language-service": "~8.2.8", + "@angular-devkit/build-angular": "~0.803.9", + "@angular/cli": "~8.3.9", + "@angular/compiler-cli": "~8.2.10", + "@angular/language-service": "~8.2.10", "@types/jasmine": "~3.3.8", "@types/jasminewd2": "~2.0.3", "@types/node": "~8.9.4", From f67de232b7395a1dcd6cb0760411a05b7c67b6bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 11 Oct 2019 14:36:59 +0300 Subject: [PATCH 36/62] Create AbpCommonDbProperties as a single point to set table prefix for modules. #1429 --- .../Volo/Abp/Data/AbpCommonDbProperties.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpCommonDbProperties.cs diff --git a/framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpCommonDbProperties.cs b/framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpCommonDbProperties.cs new file mode 100644 index 0000000000..726b8bd5f8 --- /dev/null +++ b/framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpCommonDbProperties.cs @@ -0,0 +1,18 @@ +namespace Volo.Abp.Data +{ + public static class AbpCommonDbProperties + { + /// + /// This table prefix is shared by most of the ABP modules. + /// You can change it to set table prefix for all modules using this. + /// + /// Default value: "Abp". + /// + public static string DbTablePrefix { get; } = "Abp"; + + /// + /// Default value: null. + /// + public static string DbSchema { get; } = null; + } +} From 12bcb995b62133d79a3a3c44ea312c713b41ecf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 11 Oct 2019 14:37:29 +0300 Subject: [PATCH 37/62] Db table prefix revision for the identity module. --- .../Volo/Abp/Identity/AbpIdentityConsts.cs | 11 ----------- .../Volo/Abp/Identity/AbpIdentityDbProperties.cs | 13 +++++++++++++ .../EntityFrameworkCore/IIdentityDbContext.cs | 2 +- .../EntityFrameworkCore/IdentityDbContext.cs | 12 ++---------- .../IdentityDbContextModelBuilderExtensions.cs | 5 ++++- .../IdentityModelBuilderConfigurationOptions.cs | 4 ++-- .../Identity/MongoDB/AbpIdentityMongoDbContext.cs | 9 ++------- .../MongoDB/AbpIdentityMongoDbContextExtensions.cs | 4 +++- .../Identity/MongoDB/IAbpIdentityMongoDbContext.cs | 2 +- ...IdentityMongoModelBuilderConfigurationOptions.cs | 7 ++++--- 10 files changed, 32 insertions(+), 37 deletions(-) delete mode 100644 modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityConsts.cs create mode 100644 modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDbProperties.cs diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityConsts.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityConsts.cs deleted file mode 100644 index de7cede4bb..0000000000 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityConsts.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Volo.Abp.Identity -{ - public static class AbpIdentityConsts - { - public const string DefaultDbTablePrefix = "Abp"; - - public const string DefaultDbSchema = null; - - public const string ConnectionStringName = "AbpIdentity"; - } -} diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDbProperties.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDbProperties.cs new file mode 100644 index 0000000000..9123449357 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDbProperties.cs @@ -0,0 +1,13 @@ +using Volo.Abp.Data; + +namespace Volo.Abp.Identity +{ + public static class AbpIdentityDbProperties + { + public static string DbTablePrefix { get; } = AbpCommonDbProperties.DbTablePrefix; + + public static string DbSchema { get; } = AbpCommonDbProperties.DbSchema; + + public const string ConnectionStringName = "AbpIdentity"; + } +} diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IIdentityDbContext.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IIdentityDbContext.cs index 69f0f1e72d..d3c560dca2 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IIdentityDbContext.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IIdentityDbContext.cs @@ -4,7 +4,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Volo.Abp.Identity.EntityFrameworkCore { - [ConnectionStringName(AbpIdentityConsts.ConnectionStringName)] + [ConnectionStringName(AbpIdentityDbProperties.ConnectionStringName)] public interface IIdentityDbContext : IEfCoreDbContext { DbSet Users { get; set; } diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContext.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContext.cs index a5734a3cda..05050159bc 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContext.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContext.cs @@ -7,13 +7,9 @@ namespace Volo.Abp.Identity.EntityFrameworkCore /// /// Base class for the Entity Framework database context used for identity. /// - [ConnectionStringName(AbpIdentityConsts.ConnectionStringName)] + [ConnectionStringName(AbpIdentityDbProperties.ConnectionStringName)] public class IdentityDbContext : AbpDbContext, IIdentityDbContext { - public static string TablePrefix { get; set; } = AbpIdentityConsts.DefaultDbTablePrefix; - - public static string Schema { get; set; } = AbpIdentityConsts.DefaultDbSchema; - public DbSet Users { get; set; } public DbSet Roles { get; set; } @@ -30,11 +26,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore { base.OnModelCreating(builder); - builder.ConfigureIdentity(options => - { - options.TablePrefix = TablePrefix; - options.Schema = Schema; - }); + builder.ConfigureIdentity(); } } } \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs index 5df9e6de60..01adfad531 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs @@ -14,7 +14,10 @@ namespace Volo.Abp.Identity.EntityFrameworkCore { Check.NotNull(builder, nameof(builder)); - var options = new IdentityModelBuilderConfigurationOptions(); + var options = new IdentityModelBuilderConfigurationOptions( + AbpIdentityDbProperties.DbTablePrefix, + AbpIdentityDbProperties.DbSchema + ); optionsAction?.Invoke(options); diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityModelBuilderConfigurationOptions.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityModelBuilderConfigurationOptions.cs index 09e1747372..ce27e4c1e9 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityModelBuilderConfigurationOptions.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityModelBuilderConfigurationOptions.cs @@ -6,8 +6,8 @@ namespace Volo.Abp.Identity.EntityFrameworkCore public class IdentityModelBuilderConfigurationOptions : ModelBuilderConfigurationOptions { public IdentityModelBuilderConfigurationOptions( - [NotNull] string tablePrefix = AbpIdentityConsts.DefaultDbTablePrefix, - [CanBeNull] string schema = AbpIdentityConsts.DefaultDbSchema) + [NotNull] string tablePrefix, + [CanBeNull] string schema) : base( tablePrefix, schema) diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/AbpIdentityMongoDbContext.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/AbpIdentityMongoDbContext.cs index b199fbe941..3db35866f5 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/AbpIdentityMongoDbContext.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/AbpIdentityMongoDbContext.cs @@ -4,11 +4,9 @@ using Volo.Abp.MongoDB; namespace Volo.Abp.Identity.MongoDB { - [ConnectionStringName(AbpIdentityConsts.ConnectionStringName)] + [ConnectionStringName(AbpIdentityDbProperties.ConnectionStringName)] public class AbpIdentityMongoDbContext : AbpMongoDbContext, IAbpIdentityMongoDbContext { - public static string CollectionPrefix { get; set; } = AbpIdentityConsts.DefaultDbTablePrefix; - public IMongoCollection Users => Collection(); public IMongoCollection Roles => Collection(); @@ -19,10 +17,7 @@ namespace Volo.Abp.Identity.MongoDB { base.CreateModel(modelBuilder); - modelBuilder.ConfigureIdentity(options => - { - options.CollectionPrefix = CollectionPrefix; - }); + modelBuilder.ConfigureIdentity(); } } } \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/AbpIdentityMongoDbContextExtensions.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/AbpIdentityMongoDbContextExtensions.cs index 266c100ff6..dd0cc8d42e 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/AbpIdentityMongoDbContextExtensions.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/AbpIdentityMongoDbContextExtensions.cs @@ -11,7 +11,9 @@ namespace Volo.Abp.Identity.MongoDB { Check.NotNull(builder, nameof(builder)); - var options = new IdentityMongoModelBuilderConfigurationOptions(); + var options = new IdentityMongoModelBuilderConfigurationOptions( + AbpIdentityDbProperties.DbTablePrefix + ); optionsAction?.Invoke(options); diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/IAbpIdentityMongoDbContext.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/IAbpIdentityMongoDbContext.cs index 1ed5a4286b..36cdcbec3e 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/IAbpIdentityMongoDbContext.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/IAbpIdentityMongoDbContext.cs @@ -4,7 +4,7 @@ using Volo.Abp.MongoDB; namespace Volo.Abp.Identity.MongoDB { - [ConnectionStringName(AbpIdentityConsts.ConnectionStringName)] + [ConnectionStringName(AbpIdentityDbProperties.ConnectionStringName)] public interface IAbpIdentityMongoDbContext : IAbpMongoDbContext { IMongoCollection Users { get; } diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/IdentityMongoModelBuilderConfigurationOptions.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/IdentityMongoModelBuilderConfigurationOptions.cs index 60ab8ef57b..e1c6796d84 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/IdentityMongoModelBuilderConfigurationOptions.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/IdentityMongoModelBuilderConfigurationOptions.cs @@ -1,11 +1,12 @@ -using Volo.Abp.MongoDB; +using JetBrains.Annotations; +using Volo.Abp.MongoDB; namespace Volo.Abp.Identity.MongoDB { public class IdentityMongoModelBuilderConfigurationOptions : MongoModelBuilderConfigurationOptions { - public IdentityMongoModelBuilderConfigurationOptions() - : base(AbpIdentityConsts.DefaultDbTablePrefix) + public IdentityMongoModelBuilderConfigurationOptions([NotNull] string collectionPrefix = "") + : base(collectionPrefix) { } } From 110f015d38b48c7636d89dc31eacd01202134b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 11 Oct 2019 14:57:41 +0300 Subject: [PATCH 38/62] Db table prefix revision for the audit log module #1429 --- .../Abp/AuditLogging/AbpAuditLoggingConsts.cs | 12 --------- .../AbpAuditLoggingDbProperties.cs | 13 +++++++++ .../AbpAuditLoggingDbContext.cs | 8 ++---- ...LoggingDbContextModelBuilderExtensions.cs} | 27 ++++++++++--------- ...LoggingModelBuilderConfigurationOptions.cs | 18 +++++++++++++ .../IAuditLoggingDbContext.cs | 2 +- ...AbpAuditLoggingMongoDbContextExtensions.cs | 6 +++-- .../MongoDB/AuditLoggingMongoDbContext.cs | 9 ++----- ...ngMongoModelBuilderConfigurationOptions.cs | 5 ++-- .../MongoDB/IAuditLoggingMongoDbContext.cs | 2 +- 10 files changed, 59 insertions(+), 43 deletions(-) delete mode 100644 modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AbpAuditLoggingConsts.cs create mode 100644 modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AbpAuditLoggingDbProperties.cs rename modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/{AbpAuditLoggingtDbContextModelBuilderExtensions.cs => AbpAuditLoggingDbContextModelBuilderExtensions.cs} (87%) create mode 100644 modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingModelBuilderConfigurationOptions.cs diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AbpAuditLoggingConsts.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AbpAuditLoggingConsts.cs deleted file mode 100644 index 1213a99e5e..0000000000 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AbpAuditLoggingConsts.cs +++ /dev/null @@ -1,12 +0,0 @@ - -namespace Volo.Abp.AuditLogging -{ - public static class AbpAuditLoggingConsts - { - public const string DefaultDbTablePrefix = "Abp"; - - public const string DefaultDbSchema = null; - - public const string ConnectionStringName = "AbpAuditLogging"; - } -} diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AbpAuditLoggingDbProperties.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AbpAuditLoggingDbProperties.cs new file mode 100644 index 0000000000..d1d1775721 --- /dev/null +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AbpAuditLoggingDbProperties.cs @@ -0,0 +1,13 @@ +using Volo.Abp.Data; + +namespace Volo.Abp.AuditLogging +{ + public static class AbpAuditLoggingDbProperties + { + public static string DbTablePrefix { get; } = AbpCommonDbProperties.DbTablePrefix; + + public static string DbSchema { get; } = AbpCommonDbProperties.DbSchema; + + public const string ConnectionStringName = "AbpAuditLogging"; + } +} diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingDbContext.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingDbContext.cs index 047d8cc4f9..880f6b996a 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingDbContext.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingDbContext.cs @@ -4,13 +4,9 @@ using Volo.Abp.EntityFrameworkCore; namespace Volo.Abp.AuditLogging.EntityFrameworkCore { - [ConnectionStringName(AbpAuditLoggingConsts.ConnectionStringName)] + [ConnectionStringName(AbpAuditLoggingDbProperties.ConnectionStringName)] public class AbpAuditLoggingDbContext : AbpDbContext, IAuditLoggingDbContext { - public static string TablePrefix { get; set; } = AbpAuditLoggingConsts.DefaultDbTablePrefix; - - public static string Schema { get; set; } = AbpAuditLoggingConsts.DefaultDbSchema; - public DbSet AuditLogs { get; set; } public AbpAuditLoggingDbContext(DbContextOptions options) @@ -23,7 +19,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore { base.OnModelCreating(builder); - builder.ConfigureAuditLogging(TablePrefix, Schema); + builder.ConfigureAuditLogging(); } } } diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingtDbContextModelBuilderExtensions.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingDbContextModelBuilderExtensions.cs similarity index 87% rename from modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingtDbContextModelBuilderExtensions.cs rename to modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingDbContextModelBuilderExtensions.cs index bc8a8d2e52..23b4cb3dbe 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingtDbContextModelBuilderExtensions.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingDbContextModelBuilderExtensions.cs @@ -1,26 +1,29 @@ -using JetBrains.Annotations; +using System; +using JetBrains.Annotations; using Microsoft.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.Modeling; +using Volo.Abp.Identity.EntityFrameworkCore; namespace Volo.Abp.AuditLogging.EntityFrameworkCore { - public static class AbpAuditLoggingtDbContextModelBuilderExtensions + public static class AbpAuditLoggingDbContextModelBuilderExtensions { public static void ConfigureAuditLogging( [NotNull] this ModelBuilder builder, - [CanBeNull] string tablePrefix = AbpAuditLoggingConsts.DefaultDbTablePrefix, - [CanBeNull] string schema = AbpAuditLoggingConsts.DefaultDbSchema) + Action optionsAction = null) { Check.NotNull(builder, nameof(builder)); - if (tablePrefix == null) - { - tablePrefix = ""; - } + var options = new AbpAuditLoggingModelBuilderConfigurationOptions( + AbpAuditLoggingDbProperties.DbTablePrefix, + AbpAuditLoggingDbProperties.DbSchema + ); + + optionsAction?.Invoke(options); builder.Entity(b => { - b.ToTable(tablePrefix + "AuditLogs", schema); + b.ToTable(options.TablePrefix + "AuditLogs", options.Schema); b.ConfigureExtraProperties(); @@ -51,7 +54,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore builder.Entity(b => { - b.ToTable(tablePrefix + "AuditLogActions", schema); + b.ToTable(options.TablePrefix + "AuditLogActions", options.Schema); b.ConfigureExtraProperties(); @@ -68,7 +71,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore builder.Entity(b => { - b.ToTable(tablePrefix + "EntityChanges", schema); + b.ToTable(options.TablePrefix + "EntityChanges", options.Schema); b.ConfigureExtraProperties(); @@ -87,7 +90,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore builder.Entity(b => { - b.ToTable(tablePrefix + "EntityPropertyChanges", schema); + b.ToTable(options.TablePrefix + "EntityPropertyChanges", options.Schema); b.Property(x => x.NewValue).HasMaxLength(EntityPropertyChangeConsts.MaxNewValueLength).HasColumnName(nameof(EntityPropertyChange.NewValue)); b.Property(x => x.PropertyName).HasMaxLength(EntityPropertyChangeConsts.MaxPropertyNameLength).IsRequired().HasColumnName(nameof(EntityPropertyChange.PropertyName)); diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingModelBuilderConfigurationOptions.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingModelBuilderConfigurationOptions.cs new file mode 100644 index 0000000000..1518afe236 --- /dev/null +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingModelBuilderConfigurationOptions.cs @@ -0,0 +1,18 @@ +using JetBrains.Annotations; +using Volo.Abp.EntityFrameworkCore.Modeling; + +namespace Volo.Abp.Identity.EntityFrameworkCore +{ + public class AbpAuditLoggingModelBuilderConfigurationOptions : ModelBuilderConfigurationOptions + { + public AbpAuditLoggingModelBuilderConfigurationOptions( + [NotNull] string tablePrefix, + [CanBeNull] string schema) + : base( + tablePrefix, + schema) + { + + } + } +} \ No newline at end of file diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/IAuditLoggingDbContext.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/IAuditLoggingDbContext.cs index 94312acbb1..684c5fc55f 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/IAuditLoggingDbContext.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/IAuditLoggingDbContext.cs @@ -4,7 +4,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Volo.Abp.AuditLogging.EntityFrameworkCore { - [ConnectionStringName(AbpAuditLoggingConsts.ConnectionStringName)] + [ConnectionStringName(AbpAuditLoggingDbProperties.ConnectionStringName)] public interface IAuditLoggingDbContext : IEfCoreDbContext { DbSet AuditLogs { get; set; } diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/AbpAuditLoggingMongoDbContextExtensions.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/AbpAuditLoggingMongoDbContextExtensions.cs index de2a2479a6..40411691cb 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/AbpAuditLoggingMongoDbContextExtensions.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/AbpAuditLoggingMongoDbContextExtensions.cs @@ -7,11 +7,13 @@ namespace Volo.Abp.AuditLogging.MongoDB { public static void ConfigureAuditLogging( this IMongoModelBuilder builder, - Action optionsAction = null) + Action optionsAction = null) { Check.NotNull(builder, nameof(builder)); - var options = new AuditLoggingMongoModelBuilderConfigurationOptions(); + var options = new AuditLoggingMongoModelBuilderConfigurationOptions( + AbpAuditLoggingDbProperties.DbTablePrefix + ); optionsAction?.Invoke(options); diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/AuditLoggingMongoDbContext.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/AuditLoggingMongoDbContext.cs index e8a8945973..5f76a82ff4 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/AuditLoggingMongoDbContext.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/AuditLoggingMongoDbContext.cs @@ -4,21 +4,16 @@ using Volo.Abp.MongoDB; namespace Volo.Abp.AuditLogging.MongoDB { - [ConnectionStringName(AbpAuditLoggingConsts.ConnectionStringName)] + [ConnectionStringName(AbpAuditLoggingDbProperties.ConnectionStringName)] public class AuditLoggingMongoDbContext : AbpMongoDbContext, IAuditLoggingMongoDbContext { - public static string CollectionPrefix { get; set; } = AbpAuditLoggingConsts.DefaultDbTablePrefix; - public IMongoCollection AuditLogs => Collection(); protected override void CreateModel(IMongoModelBuilder modelBuilder) { base.CreateModel(modelBuilder); - modelBuilder.ConfigureAuditLogging(options => - { - options.CollectionPrefix = CollectionPrefix; - }); + modelBuilder.ConfigureAuditLogging(); } } } diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/AuditLoggingMongoModelBuilderConfigurationOptions.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/AuditLoggingMongoModelBuilderConfigurationOptions.cs index 3f31028b5a..d3fadc3e28 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/AuditLoggingMongoModelBuilderConfigurationOptions.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/AuditLoggingMongoModelBuilderConfigurationOptions.cs @@ -5,8 +5,9 @@ namespace Volo.Abp.AuditLogging.MongoDB { public class AuditLoggingMongoModelBuilderConfigurationOptions : MongoModelBuilderConfigurationOptions { - public AuditLoggingMongoModelBuilderConfigurationOptions([NotNull] string tablePrefix = AbpAuditLoggingConsts.DefaultDbTablePrefix) - : base(tablePrefix) + public AuditLoggingMongoModelBuilderConfigurationOptions( + [NotNull] string collectionPrefix = "") + : base(collectionPrefix) { } } diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/IAuditLoggingMongoDbContext.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/IAuditLoggingMongoDbContext.cs index 685fff3a52..2edd1cb003 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/IAuditLoggingMongoDbContext.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/IAuditLoggingMongoDbContext.cs @@ -4,7 +4,7 @@ using Volo.Abp.MongoDB; namespace Volo.Abp.AuditLogging.MongoDB { - [ConnectionStringName(AbpAuditLoggingConsts.ConnectionStringName)] + [ConnectionStringName(AbpAuditLoggingDbProperties.ConnectionStringName)] public interface IAuditLoggingMongoDbContext : IAbpMongoDbContext { IMongoCollection AuditLogs { get; } From cc8fd28e5d1c37f8bdb4ac66c5c6f7f35d5f4b74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 11 Oct 2019 15:04:19 +0300 Subject: [PATCH 39/62] Db table prefix revision for the identity module #1429 --- .../Volo/Abp/BackgroundJobs/BackgroundJobsConsts.cs | 11 ----------- .../BackgroundJobs/BackgroundJobsDbProperties.cs | 13 +++++++++++++ .../EntityFrameworkCore/BackgroundJobsDbContext.cs | 12 ++---------- ...ackgroundJobsDbContextModelCreatingExtensions.cs | 5 ++++- ...ackgroundJobsModelBuilderConfigurationOptions.cs | 4 ++-- .../EntityFrameworkCore/IBackgroundJobsDbContext.cs | 2 +- .../MongoDB/BackgroundJobsMongoDbContext.cs | 9 ++------- .../BackgroundJobsMongoDbContextExtensions.cs | 4 +++- ...oundJobsMongoModelBuilderConfigurationOptions.cs | 4 ++-- .../MongoDB/IBackgroundJobsMongoDbContext.cs | 2 +- 10 files changed, 30 insertions(+), 36 deletions(-) delete mode 100644 modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobsConsts.cs create mode 100644 modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobsDbProperties.cs diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobsConsts.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobsConsts.cs deleted file mode 100644 index a4a2e5ab94..0000000000 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobsConsts.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Volo.Abp.BackgroundJobs -{ - public static class BackgroundJobsConsts - { - public const string DefaultDbTablePrefix = "Abp"; - - public const string DefaultDbSchema = null; - - public const string ConnectionStringName = "AbpBackgroundJobs"; - } -} diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobsDbProperties.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobsDbProperties.cs new file mode 100644 index 0000000000..48bd5701a1 --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobsDbProperties.cs @@ -0,0 +1,13 @@ +using Volo.Abp.Data; + +namespace Volo.Abp.BackgroundJobs +{ + public static class BackgroundJobsDbProperties + { + public static string DbTablePrefix { get; } = AbpCommonDbProperties.DbTablePrefix; + + public static string DbSchema { get; } = AbpCommonDbProperties.DbSchema; + + public const string ConnectionStringName = "AbpBackgroundJobs"; + } +} diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContext.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContext.cs index d2885ac35f..d879803677 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContext.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContext.cs @@ -4,13 +4,9 @@ using Volo.Abp.EntityFrameworkCore; namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore { - [ConnectionStringName(BackgroundJobsConsts.ConnectionStringName)] + [ConnectionStringName(BackgroundJobsDbProperties.ConnectionStringName)] public class BackgroundJobsDbContext : AbpDbContext, IBackgroundJobsDbContext { - public static string TablePrefix { get; set; } = BackgroundJobsConsts.DefaultDbTablePrefix; - - public static string Schema { get; set; } = BackgroundJobsConsts.DefaultDbSchema; - public DbSet BackgroundJobs { get; set; } public BackgroundJobsDbContext(DbContextOptions options) @@ -23,11 +19,7 @@ namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore { base.OnModelCreating(builder); - builder.ConfigureBackgroundJobs(options => - { - options.TablePrefix = TablePrefix; - options.Schema = Schema; - }); + builder.ConfigureBackgroundJobs(); } } } \ No newline at end of file diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContextModelCreatingExtensions.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContextModelCreatingExtensions.cs index 191b0bd8ee..8a3e4b126a 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContextModelCreatingExtensions.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsDbContextModelCreatingExtensions.cs @@ -12,7 +12,10 @@ namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore { Check.NotNull(builder, nameof(builder)); - var options = new BackgroundJobsModelBuilderConfigurationOptions(); + var options = new BackgroundJobsModelBuilderConfigurationOptions( + BackgroundJobsDbProperties.DbTablePrefix, + BackgroundJobsDbProperties.DbSchema + ); optionsAction?.Invoke(options); diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsModelBuilderConfigurationOptions.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsModelBuilderConfigurationOptions.cs index 43cd847ea2..0f59572d6e 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsModelBuilderConfigurationOptions.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/BackgroundJobsModelBuilderConfigurationOptions.cs @@ -6,8 +6,8 @@ namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore public class BackgroundJobsModelBuilderConfigurationOptions : ModelBuilderConfigurationOptions { public BackgroundJobsModelBuilderConfigurationOptions( - [NotNull] string tablePrefix = BackgroundJobsConsts.DefaultDbTablePrefix, - [CanBeNull] string schema = BackgroundJobsConsts.DefaultDbSchema) + [NotNull] string tablePrefix = "", + [CanBeNull] string schema = null) : base( tablePrefix, schema) diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/IBackgroundJobsDbContext.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/IBackgroundJobsDbContext.cs index e46f60f22b..cc70b6543a 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/IBackgroundJobsDbContext.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/IBackgroundJobsDbContext.cs @@ -4,7 +4,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore { - [ConnectionStringName(BackgroundJobsConsts.ConnectionStringName)] + [ConnectionStringName(BackgroundJobsDbProperties.ConnectionStringName)] public interface IBackgroundJobsDbContext : IEfCoreDbContext { DbSet BackgroundJobs { get; } diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbContext.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbContext.cs index ffcd7fbe9f..745903cae7 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbContext.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbContext.cs @@ -4,21 +4,16 @@ using Volo.Abp.MongoDB; namespace Volo.Abp.BackgroundJobs.MongoDB { - [ConnectionStringName(BackgroundJobsConsts.ConnectionStringName)] + [ConnectionStringName(BackgroundJobsDbProperties.ConnectionStringName)] public class BackgroundJobsMongoDbContext : AbpMongoDbContext, IBackgroundJobsMongoDbContext { - public static string CollectionPrefix { get; set; } = BackgroundJobsConsts.DefaultDbTablePrefix; - public IMongoCollection BackgroundJobs { get; set; } protected override void CreateModel(IMongoModelBuilder modelBuilder) { base.CreateModel(modelBuilder); - modelBuilder.ConfigureBackgroundJobs(options => - { - options.CollectionPrefix = CollectionPrefix; - }); + modelBuilder.ConfigureBackgroundJobs(); } } } \ No newline at end of file diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbContextExtensions.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbContextExtensions.cs index 637d17a9d2..a16def3668 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbContextExtensions.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoDbContextExtensions.cs @@ -11,7 +11,9 @@ namespace Volo.Abp.BackgroundJobs.MongoDB { Check.NotNull(builder, nameof(builder)); - var options = new BackgroundJobsMongoModelBuilderConfigurationOptions(); + var options = new BackgroundJobsMongoModelBuilderConfigurationOptions( + BackgroundJobsDbProperties.DbTablePrefix + ); optionsAction?.Invoke(options); diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoModelBuilderConfigurationOptions.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoModelBuilderConfigurationOptions.cs index 1dfa33ed69..3833841b9f 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoModelBuilderConfigurationOptions.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/BackgroundJobsMongoModelBuilderConfigurationOptions.cs @@ -6,8 +6,8 @@ namespace Volo.Abp.BackgroundJobs.MongoDB public class BackgroundJobsMongoModelBuilderConfigurationOptions : MongoModelBuilderConfigurationOptions { public BackgroundJobsMongoModelBuilderConfigurationOptions( - [NotNull] string tablePrefix = BackgroundJobsConsts.DefaultDbTablePrefix) - : base(tablePrefix) + [NotNull] string collectionPrefix = "") + : base(collectionPrefix) { } } diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/IBackgroundJobsMongoDbContext.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/IBackgroundJobsMongoDbContext.cs index e771c3461a..8e2d11869d 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/IBackgroundJobsMongoDbContext.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/IBackgroundJobsMongoDbContext.cs @@ -4,7 +4,7 @@ using Volo.Abp.MongoDB; namespace Volo.Abp.BackgroundJobs.MongoDB { - [ConnectionStringName(BackgroundJobsConsts.ConnectionStringName)] + [ConnectionStringName(BackgroundJobsDbProperties.ConnectionStringName)] public interface IBackgroundJobsMongoDbContext : IAbpMongoDbContext { IMongoCollection BackgroundJobs { get; } From 898c800d8202264bfdeeeb593c924a6561c43ce8 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Fri, 11 Oct 2019 15:40:54 +0300 Subject: [PATCH 40/62] test(core): add premission.directive.spec --- .../lib/tests/permission.directive.spec.ts | 46 +++++++++++++++++++ .../core/src/lib/tests/rest.service.spec.ts | 4 +- 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 npm/ng-packs/packages/core/src/lib/tests/permission.directive.spec.ts diff --git a/npm/ng-packs/packages/core/src/lib/tests/permission.directive.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/permission.directive.spec.ts new file mode 100644 index 0000000000..c1d324620d --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/tests/permission.directive.spec.ts @@ -0,0 +1,46 @@ +import { PermissionDirective } from '../directives/permission.directive'; +import { SpectatorDirective, createDirectiveFactory, SpyObject } from '@ngneat/spectator/jest'; +import { Store } from '@ngxs/store'; +import { of, Subject } from 'rxjs'; + +describe('PermissionDirective', () => { + let spectator: SpectatorDirective; + let directive: PermissionDirective; + const grantedPolicy$ = new Subject(); + + const createDirective = createDirectiveFactory({ + directive: PermissionDirective, + providers: [{ provide: Store, useValue: { select: () => grantedPolicy$ } }], + }); + + describe('with condition', () => { + beforeEach(() => { + spectator = createDirective(`
Testing Permission Directive
`); + directive = spectator.directive; + }); + + it('should be created', () => { + expect(directive).toBeTruthy(); + }); + + it('should remove the element from DOM', () => { + grantedPolicy$.next(true); + expect(spectator.query('#test-element')).toBeTruthy(); + grantedPolicy$.next(false); + expect(spectator.query('#test-element')).toBeFalsy(); + }); + }); + + describe('without condition', () => { + beforeEach(() => { + spectator = createDirective('
Testing Permission Directive
'); + directive = spectator.directive; + }); + + it('should do nothing when condition is undefined', () => { + const spy = jest.spyOn(spectator.get(Store), 'select'); + grantedPolicy$.next(false); + expect(spy.mock.calls).toHaveLength(0); + }); + }); +}); diff --git a/npm/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts index 6a06ec2c12..3d5cc11287 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/rest.service.spec.ts @@ -62,7 +62,7 @@ describe('HttpClient testing', () => { }); test('should handle the error', () => { - jest.spyOn(spectator.httpClient, 'request').mockReturnValue(throwError('An error')); + jest.spyOn(spectator.httpClient, 'request').mockReturnValue(throwError('Testing error')); const spy = jest.spyOn(store, 'dispatch'); spectator.service @@ -78,7 +78,7 @@ describe('HttpClient testing', () => { }); test('should not handle the error when skipHandleError is true', () => { - jest.spyOn(spectator.httpClient, 'request').mockReturnValue(throwError('An error')); + jest.spyOn(spectator.httpClient, 'request').mockReturnValue(throwError('Testing error')); const spy = jest.spyOn(store, 'dispatch'); spectator.service From e347cd1fa064fbee07cd14332033cd418ee0bf5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 11 Oct 2019 15:42:52 +0300 Subject: [PATCH 41/62] Revisit docs & blog modules db table prefixes. --- .../Volo/Blogging/BloggingConsts.cs | 9 --------- .../Volo/Blogging/BloggingDbProperties.cs | 20 +++++++++++++++++++ .../EntityFrameworkCore/BloggingDbContext.cs | 11 ++-------- ...BloggingDbContextModelBuilderExtensions.cs | 6 +++++- ...loggingModelBuilderConfigurationOptions.cs | 9 ++++++--- .../EntityFrameworkCore/IBloggingDbContext.cs | 2 +- .../MongoDB/BloggingMongoDbContext.cs | 14 +++---------- .../BloggingMongoDbContextExtensions.cs | 6 +++--- ...ngMongoModelBuilderConfigurationOptions.cs | 10 ++++------ .../MongoDB/IBloggingMongoDbContext.cs | 2 +- .../Volo.Docs.Domain/Volo/Docs/DocsConsts.cs | 11 ---------- .../Volo/Docs/DocsDbProperties.cs | 11 ++++++++++ .../Docs/EntityFrameworkCore/DocsDbContext.cs | 11 ++-------- .../DocsDbContextModelBuilderExtensions.cs | 6 +++++- .../DocsModelBuilderConfigurationOptions.cs | 9 ++++++--- .../EntityFrameworkCore/IDocsDbContext.cs | 2 +- .../Volo/Docs/MongoDB/DocsMongoDbContext.cs | 9 ++------- .../MongoDB/DocsMongoDbContextExtensions.cs | 7 ++++--- ...csMongoModelBuilderConfigurationOptions.cs | 10 ++++------ .../Volo/Docs/MongoDB/IDocsMongoDbContext.cs | 2 +- 20 files changed, 81 insertions(+), 86 deletions(-) delete mode 100644 modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingConsts.cs create mode 100644 modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingDbProperties.cs delete mode 100644 modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsConsts.cs create mode 100644 modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDbProperties.cs diff --git a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingConsts.cs b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingConsts.cs deleted file mode 100644 index 431a7d2cb0..0000000000 --- a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingConsts.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Volo.Blogging -{ - public static class BloggingConsts - { - public const string DefaultDbTablePrefix = "Blg"; - public const string DefaultDbSchema = null; - public const string ConnectionStringName = "Blogging"; - } -} diff --git a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingDbProperties.cs b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingDbProperties.cs new file mode 100644 index 0000000000..abd32c10ed --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingDbProperties.cs @@ -0,0 +1,20 @@ +namespace Volo.Blogging +{ + public static class BloggingDbProperties + { + /// + /// Default value: "Blg". + /// + public static string DbTablePrefix { get; } = "Blg"; + + /// + /// Default value: "null". + /// + public static string DbSchema { get; } = null; + + /// + /// "Blogging". + /// + public const string ConnectionStringName = "Blogging"; + } +} diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContext.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContext.cs index 1795c8aae3..4ab71a0222 100644 --- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContext.cs +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContext.cs @@ -9,12 +9,9 @@ using Volo.Blogging.Users; namespace Volo.Blogging.EntityFrameworkCore { - [ConnectionStringName(BloggingConsts.ConnectionStringName)] + [ConnectionStringName(BloggingDbProperties.ConnectionStringName)] public class BloggingDbContext : AbpDbContext, IBloggingDbContext { - public static string TablePrefix { get; set; } = BloggingConsts.DefaultDbTablePrefix; - public static string Schema { get; set; } = BloggingConsts.DefaultDbSchema; - public DbSet Users { get; set; } public DbSet Blogs { get; set; } @@ -37,11 +34,7 @@ namespace Volo.Blogging.EntityFrameworkCore { base.OnModelCreating(builder); - builder.ConfigureBlogging(options => - { - options.TablePrefix = TablePrefix; - options.Schema = Schema; - }); + builder.ConfigureBlogging(); } } } \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContextModelBuilderExtensions.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContextModelBuilderExtensions.cs index acc400ef3f..00fd20dbdc 100644 --- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContextModelBuilderExtensions.cs +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingDbContextModelBuilderExtensions.cs @@ -20,7 +20,11 @@ namespace Volo.Blogging.EntityFrameworkCore { Check.NotNull(builder, nameof(builder)); - var options = new BloggingModelBuilderConfigurationOptions(); + var options = new BloggingModelBuilderConfigurationOptions( + BloggingDbProperties.DbTablePrefix, + BloggingDbProperties.DbSchema + ); + optionsAction?.Invoke(options); builder.Entity(b => diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingModelBuilderConfigurationOptions.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingModelBuilderConfigurationOptions.cs index 255e2abf54..278208ced6 100644 --- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingModelBuilderConfigurationOptions.cs +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/BloggingModelBuilderConfigurationOptions.cs @@ -1,11 +1,14 @@ -using Volo.Abp.EntityFrameworkCore.Modeling; +using JetBrains.Annotations; +using Volo.Abp.EntityFrameworkCore.Modeling; namespace Volo.Blogging.EntityFrameworkCore { public class BloggingModelBuilderConfigurationOptions : ModelBuilderConfigurationOptions { - public BloggingModelBuilderConfigurationOptions() - : base(BloggingConsts.DefaultDbTablePrefix, BloggingConsts.DefaultDbSchema) + public BloggingModelBuilderConfigurationOptions( + [NotNull] string tablePrefix = "", + [CanBeNull] string schema = null) + : base(tablePrefix, schema) { } } diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/IBloggingDbContext.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/IBloggingDbContext.cs index 7e851c2cee..dcdb6c78e1 100644 --- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/IBloggingDbContext.cs +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/EntityFrameworkCore/IBloggingDbContext.cs @@ -9,7 +9,7 @@ using Volo.Blogging.Users; namespace Volo.Blogging.EntityFrameworkCore { - [ConnectionStringName(BloggingConsts.ConnectionStringName)] + [ConnectionStringName(BloggingDbProperties.ConnectionStringName)] public interface IBloggingDbContext : IEfCoreDbContext { DbSet Users { get; } diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/BloggingMongoDbContext.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/BloggingMongoDbContext.cs index dd17cfb548..fa265b3e67 100644 --- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/BloggingMongoDbContext.cs +++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/BloggingMongoDbContext.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using MongoDB.Driver; +using MongoDB.Driver; using Volo.Abp.Data; using Volo.Abp.MongoDB; using Volo.Blogging.Blogs; @@ -11,11 +8,9 @@ using Volo.Blogging.Users; namespace Volo.Blogging.MongoDB { - [ConnectionStringName(BloggingConsts.ConnectionStringName)] + [ConnectionStringName(BloggingDbProperties.ConnectionStringName)] public class BloggingMongoDbContext : AbpMongoDbContext, IBloggingMongoDbContext { - public static string CollectionPrefix { get; set; } = BloggingConsts.DefaultDbTablePrefix; - public IMongoCollection Users => Collection(); public IMongoCollection Blogs => Collection(); @@ -30,10 +25,7 @@ namespace Volo.Blogging.MongoDB { base.CreateModel(modelBuilder); - modelBuilder.ConfigureBlogging(options => - { - options.CollectionPrefix = CollectionPrefix; - }); + modelBuilder.ConfigureBlogging(); } } } diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/BloggingMongoDbContextExtensions.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/BloggingMongoDbContextExtensions.cs index bb6bf8775e..ecb9b45a33 100644 --- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/BloggingMongoDbContextExtensions.cs +++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/BloggingMongoDbContextExtensions.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using Volo.Abp; using Volo.Abp.MongoDB; using Volo.Blogging.Blogs; @@ -18,7 +16,9 @@ namespace Volo.Blogging.MongoDB { Check.NotNull(builder, nameof(builder)); - var options = new BloggingMongoModelBuilderConfigurationOptions(); + var options = new BloggingMongoModelBuilderConfigurationOptions( + BloggingDbProperties.DbTablePrefix + ); optionsAction?.Invoke(options); diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/BloggingMongoModelBuilderConfigurationOptions.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/BloggingMongoModelBuilderConfigurationOptions.cs index c913106c3f..2e73f1a00c 100644 --- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/BloggingMongoModelBuilderConfigurationOptions.cs +++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/BloggingMongoModelBuilderConfigurationOptions.cs @@ -1,15 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Text; -using JetBrains.Annotations; +using JetBrains.Annotations; using Volo.Abp.MongoDB; namespace Volo.Blogging.MongoDB { public class BloggingMongoModelBuilderConfigurationOptions : MongoModelBuilderConfigurationOptions { - public BloggingMongoModelBuilderConfigurationOptions([NotNull] string tablePrefix = BloggingConsts.DefaultDbTablePrefix) - : base(tablePrefix) + public BloggingMongoModelBuilderConfigurationOptions( + [NotNull] string collectionPrefix = "") + : base(collectionPrefix) { } } diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/IBloggingMongoDbContext.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/IBloggingMongoDbContext.cs index 7e68f7b791..8366e87d74 100644 --- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/IBloggingMongoDbContext.cs +++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/MongoDB/IBloggingMongoDbContext.cs @@ -8,7 +8,7 @@ using Volo.Blogging.Users; namespace Volo.Blogging.MongoDB { - [ConnectionStringName(BloggingConsts.ConnectionStringName)] + [ConnectionStringName(BloggingDbProperties.ConnectionStringName)] public interface IBloggingMongoDbContext : IAbpMongoDbContext { IMongoCollection Users { get; } diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsConsts.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsConsts.cs deleted file mode 100644 index bcfd85852d..0000000000 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsConsts.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Volo.Docs -{ - public static class DocsConsts - { - public const string DefaultDbTablePrefix = "Docs"; - - public const string DefaultDbSchema = null; - - public const string ConnectionStringName = "Docs"; - } -} diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDbProperties.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDbProperties.cs new file mode 100644 index 0000000000..d30118bd32 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDbProperties.cs @@ -0,0 +1,11 @@ +namespace Volo.Docs +{ + public static class DocsDbProperties + { + public const string DbTablePrefix = "Docs"; + + public const string DbSchema = null; + + public const string ConnectionStringName = "Docs"; + } +} diff --git a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContext.cs b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContext.cs index d2a7f41756..1f6a43b825 100644 --- a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContext.cs +++ b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContext.cs @@ -5,12 +5,9 @@ using Volo.Docs.Projects; namespace Volo.Docs.EntityFrameworkCore { - [ConnectionStringName(DocsConsts.ConnectionStringName)] + [ConnectionStringName(DocsDbProperties.ConnectionStringName)] public class DocsDbContext: AbpDbContext, IDocsDbContext { - public static string TablePrefix { get; set; } = DocsConsts.DefaultDbTablePrefix; - public static string Schema { get; set; } = DocsConsts.DefaultDbSchema; - public DbSet Projects { get; set; } public DocsDbContext(DbContextOptions options) @@ -23,11 +20,7 @@ namespace Volo.Docs.EntityFrameworkCore { base.OnModelCreating(builder); - builder.ConfigureDocs(options => - { - options.TablePrefix = TablePrefix; - options.Schema = Schema; - }); + builder.ConfigureDocs(); } } } diff --git a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContextModelBuilderExtensions.cs b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContextModelBuilderExtensions.cs index 967938fbae..b9cada3e4d 100644 --- a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContextModelBuilderExtensions.cs +++ b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContextModelBuilderExtensions.cs @@ -15,7 +15,11 @@ namespace Volo.Docs.EntityFrameworkCore { Check.NotNull(builder, nameof(builder)); - var options = new DocsModelBuilderConfigurationOptions(); + var options = new DocsModelBuilderConfigurationOptions( + DocsDbProperties.DbTablePrefix, + DocsDbProperties.DbSchema + ); + optionsAction?.Invoke(options); builder.Entity(b => diff --git a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsModelBuilderConfigurationOptions.cs b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsModelBuilderConfigurationOptions.cs index 822fab4b9e..217345eee2 100644 --- a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsModelBuilderConfigurationOptions.cs +++ b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsModelBuilderConfigurationOptions.cs @@ -1,11 +1,14 @@ -using Volo.Abp.EntityFrameworkCore.Modeling; +using JetBrains.Annotations; +using Volo.Abp.EntityFrameworkCore.Modeling; namespace Volo.Docs.EntityFrameworkCore { public class DocsModelBuilderConfigurationOptions : ModelBuilderConfigurationOptions { - public DocsModelBuilderConfigurationOptions() - : base(DocsConsts.DefaultDbTablePrefix, DocsConsts.DefaultDbSchema) + public DocsModelBuilderConfigurationOptions( + [NotNull] string tablePrefix, + [CanBeNull] string schema) + : base(tablePrefix, schema) { } } diff --git a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/IDocsDbContext.cs b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/IDocsDbContext.cs index 1414d1bff8..4f11d438e7 100644 --- a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/IDocsDbContext.cs +++ b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/IDocsDbContext.cs @@ -5,7 +5,7 @@ using Volo.Docs.Projects; namespace Volo.Docs.EntityFrameworkCore { - [ConnectionStringName(DocsConsts.ConnectionStringName)] + [ConnectionStringName(DocsDbProperties.ConnectionStringName)] public interface IDocsDbContext : IEfCoreDbContext { DbSet Projects { get; set; } diff --git a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoDbContext.cs b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoDbContext.cs index faa8b6bfa7..cc65e9ab3e 100644 --- a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoDbContext.cs +++ b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoDbContext.cs @@ -5,21 +5,16 @@ using Volo.Abp.MongoDB; namespace Volo.Docs.MongoDB { - [ConnectionStringName(DocsConsts.ConnectionStringName)] + [ConnectionStringName(DocsDbProperties.ConnectionStringName)] public class DocsMongoDbContext : AbpMongoDbContext, IDocsMongoDbContext { - public static string CollectionPrefix { get; set; } = DocsConsts.DefaultDbTablePrefix; - public IMongoCollection Projects => Collection(); protected override void CreateModel(IMongoModelBuilder modelBuilder) { base.CreateModel(modelBuilder); - modelBuilder.ConfigureDocs(options => - { - options.CollectionPrefix = CollectionPrefix; - }); + modelBuilder.ConfigureDocs(); } } } diff --git a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoDbContextExtensions.cs b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoDbContextExtensions.cs index 8975dd4de5..865da90981 100644 --- a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoDbContextExtensions.cs +++ b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoDbContextExtensions.cs @@ -1,5 +1,4 @@ - -using System; +using System; using Volo.Abp; using Volo.Abp.MongoDB; using Volo.Docs.Projects; @@ -14,7 +13,9 @@ namespace Volo.Docs.MongoDB { Check.NotNull(builder, nameof(builder)); - var options = new DocsMongoModelBuilderConfigurationOptions(); + var options = new DocsMongoModelBuilderConfigurationOptions( + DocsDbProperties.DbTablePrefix + ); optionsAction?.Invoke(options); diff --git a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoModelBuilderConfigurationOptions.cs b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoModelBuilderConfigurationOptions.cs index 1afc610d5e..20a67382a1 100644 --- a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoModelBuilderConfigurationOptions.cs +++ b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoModelBuilderConfigurationOptions.cs @@ -1,15 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Text; -using JetBrains.Annotations; +using JetBrains.Annotations; using Volo.Abp.MongoDB; namespace Volo.Docs.MongoDB { public class DocsMongoModelBuilderConfigurationOptions : MongoModelBuilderConfigurationOptions { - public DocsMongoModelBuilderConfigurationOptions([NotNull] string tablePrefix = DocsConsts.DefaultDbTablePrefix) - : base(tablePrefix) + public DocsMongoModelBuilderConfigurationOptions( + [NotNull] string collectionPrefix) + : base(collectionPrefix) { } } diff --git a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/IDocsMongoDbContext.cs b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/IDocsMongoDbContext.cs index ec4f3b1fde..78b3be8484 100644 --- a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/IDocsMongoDbContext.cs +++ b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/IDocsMongoDbContext.cs @@ -5,7 +5,7 @@ using Volo.Docs.Projects; namespace Volo.Docs.MongoDB { - [ConnectionStringName(DocsConsts.ConnectionStringName)] + [ConnectionStringName(DocsDbProperties.ConnectionStringName)] public interface IDocsMongoDbContext : IAbpMongoDbContext { From 3d357e46c07986aba52cbf56ea40bbb1f307b560 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 11 Oct 2019 15:47:45 +0300 Subject: [PATCH 42/62] Db table prefix revision for the feature management module --- .../FeatureManagement/FeatureManagementConsts.cs | 11 ----------- .../FeatureManagementDbProperties.cs | 13 +++++++++++++ .../FeatureManagementDbContext.cs | 12 ++---------- ...ureManagementDbContextModelCreatingExtensions.cs | 5 ++++- ...ureManagementModelBuilderConfigurationOptions.cs | 4 ++-- .../IFeatureManagementDbContext.cs | 2 +- .../MongoDB/FeatureManagementMongoDbContext.cs | 9 ++------- .../FeatureManagementMongoDbContextExtensions.cs | 4 +++- ...nagementMongoModelBuilderConfigurationOptions.cs | 4 ++-- .../MongoDB/IFeatureManagementMongoDbContext.cs | 2 +- 10 files changed, 30 insertions(+), 36 deletions(-) delete mode 100644 modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementConsts.cs create mode 100644 modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementDbProperties.cs diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementConsts.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementConsts.cs deleted file mode 100644 index 0255847ba6..0000000000 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementConsts.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Volo.Abp.FeatureManagement -{ - public static class FeatureManagementConsts - { - public const string DefaultDbTablePrefix = "Abp"; - - public const string DefaultDbSchema = null; - - public const string ConnectionStringName = "AbpFeatureManagement"; - } -} diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementDbProperties.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementDbProperties.cs new file mode 100644 index 0000000000..fb54ac2e01 --- /dev/null +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementDbProperties.cs @@ -0,0 +1,13 @@ +using Volo.Abp.Data; + +namespace Volo.Abp.FeatureManagement +{ + public static class FeatureManagementDbProperties + { + public static string DbTablePrefix { get; } = AbpCommonDbProperties.DbTablePrefix; + + public static string DbSchema { get; } = AbpCommonDbProperties.DbSchema; + + public const string ConnectionStringName = "AbpFeatureManagement"; + } +} diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContext.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContext.cs index d1b685a150..af027dc9ba 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContext.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContext.cs @@ -4,13 +4,9 @@ using Volo.Abp.EntityFrameworkCore; namespace Volo.Abp.FeatureManagement.EntityFrameworkCore { - [ConnectionStringName(FeatureManagementConsts.ConnectionStringName)] + [ConnectionStringName(FeatureManagementDbProperties.ConnectionStringName)] public class FeatureManagementDbContext : AbpDbContext, IFeatureManagementDbContext { - public static string TablePrefix { get; set; } = FeatureManagementConsts.DefaultDbTablePrefix; - - public static string Schema { get; set; } = FeatureManagementConsts.DefaultDbSchema; - public DbSet FeatureValues { get; set; } public FeatureManagementDbContext(DbContextOptions options) @@ -23,11 +19,7 @@ namespace Volo.Abp.FeatureManagement.EntityFrameworkCore { base.OnModelCreating(builder); - builder.ConfigureFeatureManagement(options => - { - options.TablePrefix = TablePrefix; - options.Schema = Schema; - }); + builder.ConfigureFeatureManagement(); } } } \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContextModelCreatingExtensions.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContextModelCreatingExtensions.cs index 19abd9d6a5..eb8b18ee0a 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContextModelCreatingExtensions.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementDbContextModelCreatingExtensions.cs @@ -11,7 +11,10 @@ namespace Volo.Abp.FeatureManagement.EntityFrameworkCore { Check.NotNull(builder, nameof(builder)); - var options = new FeatureManagementModelBuilderConfigurationOptions(); + var options = new FeatureManagementModelBuilderConfigurationOptions( + FeatureManagementDbProperties.DbTablePrefix, + FeatureManagementDbProperties.DbSchema + ); optionsAction?.Invoke(options); diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementModelBuilderConfigurationOptions.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementModelBuilderConfigurationOptions.cs index 6567288188..035b6ed341 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementModelBuilderConfigurationOptions.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/FeatureManagementModelBuilderConfigurationOptions.cs @@ -6,8 +6,8 @@ namespace Volo.Abp.FeatureManagement.EntityFrameworkCore public class FeatureManagementModelBuilderConfigurationOptions : ModelBuilderConfigurationOptions { public FeatureManagementModelBuilderConfigurationOptions( - [NotNull] string tablePrefix = FeatureManagementConsts.DefaultDbTablePrefix, - [CanBeNull] string schema = FeatureManagementConsts.DefaultDbSchema) + [NotNull] string tablePrefix = "", + [CanBeNull] string schema = null) : base( tablePrefix, schema) diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/IFeatureManagementDbContext.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/IFeatureManagementDbContext.cs index 0b14c47319..14abbccc5c 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/IFeatureManagementDbContext.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/IFeatureManagementDbContext.cs @@ -4,7 +4,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Volo.Abp.FeatureManagement.EntityFrameworkCore { - [ConnectionStringName(FeatureManagementConsts.ConnectionStringName)] + [ConnectionStringName(FeatureManagementDbProperties.ConnectionStringName)] public interface IFeatureManagementDbContext : IEfCoreDbContext { DbSet FeatureValues { get; set; } diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoDbContext.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoDbContext.cs index 7689a16801..e563130d4f 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoDbContext.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoDbContext.cs @@ -4,21 +4,16 @@ using Volo.Abp.MongoDB; namespace Volo.Abp.FeatureManagement.MongoDB { - [ConnectionStringName(FeatureManagementConsts.ConnectionStringName)] + [ConnectionStringName(FeatureManagementDbProperties.ConnectionStringName)] public class FeatureManagementMongoDbContext : AbpMongoDbContext, IFeatureManagementMongoDbContext { - public static string CollectionPrefix { get; set; } = FeatureManagementConsts.DefaultDbTablePrefix; - public IMongoCollection FeatureValues => Collection(); protected override void CreateModel(IMongoModelBuilder modelBuilder) { base.CreateModel(modelBuilder); - modelBuilder.ConfigureFeatureManagement(options => - { - options.CollectionPrefix = CollectionPrefix; - }); + modelBuilder.ConfigureFeatureManagement(); } } } \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoDbContextExtensions.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoDbContextExtensions.cs index 852efd0576..48c3f88dd2 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoDbContextExtensions.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoDbContextExtensions.cs @@ -11,7 +11,9 @@ namespace Volo.Abp.FeatureManagement.MongoDB { Check.NotNull(builder, nameof(builder)); - var options = new FeatureManagementMongoModelBuilderConfigurationOptions(); + var options = new FeatureManagementMongoModelBuilderConfigurationOptions( + FeatureManagementDbProperties.DbTablePrefix + ); optionsAction?.Invoke(options); diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoModelBuilderConfigurationOptions.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoModelBuilderConfigurationOptions.cs index 88361e345d..e4ba0bbc8a 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoModelBuilderConfigurationOptions.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/FeatureManagementMongoModelBuilderConfigurationOptions.cs @@ -6,8 +6,8 @@ namespace Volo.Abp.FeatureManagement.MongoDB public class FeatureManagementMongoModelBuilderConfigurationOptions : MongoModelBuilderConfigurationOptions { public FeatureManagementMongoModelBuilderConfigurationOptions( - [NotNull] string tablePrefix = FeatureManagementConsts.DefaultDbTablePrefix) - : base(tablePrefix) + [NotNull] string collectionPrefix = "") + : base(collectionPrefix) { } diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/IFeatureManagementMongoDbContext.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/IFeatureManagementMongoDbContext.cs index 5f425c1a4c..290dfbe950 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/IFeatureManagementMongoDbContext.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/IFeatureManagementMongoDbContext.cs @@ -4,7 +4,7 @@ using Volo.Abp.MongoDB; namespace Volo.Abp.FeatureManagement.MongoDB { - [ConnectionStringName(FeatureManagementConsts.ConnectionStringName)] + [ConnectionStringName(FeatureManagementDbProperties.ConnectionStringName)] public interface IFeatureManagementMongoDbContext : IAbpMongoDbContext { IMongoCollection FeatureValues { get; } From a18becca1128b7f3b82ac7349fa23baafde19e62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 11 Oct 2019 15:57:11 +0300 Subject: [PATCH 43/62] Revisit db table prefixes for identityserver --- .../IdentityServer/AbpIdentityServerConsts.cs | 11 ---- .../AbpIdentityServerDbProperties.cs | 11 ++++ .../IIdentityServerDbContext.cs | 2 +- .../IdentityServerDbContext.cs | 8 +-- ...yServerDbContextModelCreatingExtensions.cs | 55 ++++++++++--------- ...yServerModelBuilderConfigurationOptions.cs | 18 ++++++ .../AbpIdentityServerMongoDbContext.cs | 9 +-- ...pIdentityServerMongoDbContextExtensions.cs | 4 +- .../IAbpIdentityServerMongoDbContext.cs | 2 +- ...erMongoModelBuilderConfigurationOptions.cs | 7 ++- 10 files changed, 70 insertions(+), 57 deletions(-) delete mode 100644 modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerConsts.cs create mode 100644 modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDbProperties.cs create mode 100644 modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerModelBuilderConfigurationOptions.cs diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerConsts.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerConsts.cs deleted file mode 100644 index 99ec29758f..0000000000 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerConsts.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Volo.Abp.IdentityServer -{ - public static class AbpIdentityServerConsts - { - public const string DefaultDbTablePrefix = "IdentityServer"; - - public const string DefaultDbSchema = null; - - public const string ConnectionStringName = "AbpIdentityServer"; - } -} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDbProperties.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDbProperties.cs new file mode 100644 index 0000000000..751c33ccd5 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDbProperties.cs @@ -0,0 +1,11 @@ +namespace Volo.Abp.IdentityServer +{ + public static class AbpIdentityServerDbProperties + { + public static string DbTablePrefix { get; } = "IdentityServer"; + + public static string DbSchema { get; } = null; + + public const string ConnectionStringName = "AbpIdentityServer"; + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs index 6e4941c119..3c7f425dc9 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs @@ -8,7 +8,7 @@ using Volo.Abp.IdentityServer.IdentityResources; namespace Volo.Abp.IdentityServer.EntityFrameworkCore { - [ConnectionStringName(AbpIdentityServerConsts.ConnectionStringName)] + [ConnectionStringName(AbpIdentityServerDbProperties.ConnectionStringName)] public interface IIdentityServerDbContext : IEfCoreDbContext { DbSet ApiResources { get; set; } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs index 43bc14a303..800aa8b8be 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs @@ -8,13 +8,9 @@ using Volo.Abp.IdentityServer.IdentityResources; namespace Volo.Abp.IdentityServer.EntityFrameworkCore { - [ConnectionStringName(AbpIdentityServerConsts.ConnectionStringName)] + [ConnectionStringName(AbpIdentityServerDbProperties.ConnectionStringName)] public class IdentityServerDbContext : AbpDbContext, IIdentityServerDbContext { - public static string TablePrefix { get; set; } = AbpIdentityServerConsts.DefaultDbTablePrefix; - - public static string Schema { get; set; } = AbpIdentityServerConsts.DefaultDbSchema; - public DbSet ApiResources { get; set; } public DbSet ApiSecrets { get; set; } @@ -60,7 +56,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); - builder.ConfigureIdentityServer(TablePrefix, Schema); + builder.ConfigureIdentityServer(); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs index 58fb39f8a5..a9b1f1fe33 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs @@ -1,5 +1,5 @@ -using System.Collections.Generic; -using JetBrains.Annotations; +using System; +using System.Collections.Generic; using Microsoft.EntityFrameworkCore; using Newtonsoft.Json; using Volo.Abp.EntityFrameworkCore.Modeling; @@ -13,20 +13,21 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore public static class IdentityServerDbContextModelCreatingExtensions { public static void ConfigureIdentityServer( - this ModelBuilder builder, - [CanBeNull] string tablePrefix = AbpIdentityServerConsts.DefaultDbTablePrefix, - [CanBeNull] string schema = AbpIdentityServerConsts.DefaultDbSchema) + this ModelBuilder builder, + Action optionsAction = null) { Check.NotNull(builder, nameof(builder)); - if (tablePrefix == null) - { - tablePrefix = ""; - } + var options = new IdentityServerModelBuilderConfigurationOptions( + AbpIdentityServerDbProperties.DbTablePrefix, + AbpIdentityServerDbProperties.DbSchema + ); + + optionsAction?.Invoke(options); builder.Entity(client => { - client.ToTable(tablePrefix + "Clients", schema); + client.ToTable(options.TablePrefix + "Clients", options.Schema); client.ConfigureFullAuditedAggregateRoot(); @@ -57,7 +58,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore builder.Entity(grantType => { - grantType.ToTable(tablePrefix + "ClientGrantTypes", schema); + grantType.ToTable(options.TablePrefix + "ClientGrantTypes", options.Schema); grantType.HasKey(x => new { x.ClientId, x.GrantType }); @@ -66,7 +67,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore builder.Entity(redirectUri => { - redirectUri.ToTable(tablePrefix + "ClientRedirectUris", schema); + redirectUri.ToTable(options.TablePrefix + "ClientRedirectUris", options.Schema); redirectUri.HasKey(x => new { x.ClientId, x.RedirectUri }); @@ -75,7 +76,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore builder.Entity(postLogoutRedirectUri => { - postLogoutRedirectUri.ToTable(tablePrefix + "ClientPostLogoutRedirectUris", schema); + postLogoutRedirectUri.ToTable(options.TablePrefix + "ClientPostLogoutRedirectUris", options.Schema); postLogoutRedirectUri.HasKey(x => new { x.ClientId, x.PostLogoutRedirectUri }); @@ -84,7 +85,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore builder.Entity(scope => { - scope.ToTable(tablePrefix + "ClientScopes", schema); + scope.ToTable(options.TablePrefix + "ClientScopes", options.Schema); scope.HasKey(x => new { x.ClientId, x.Scope }); @@ -93,7 +94,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore builder.Entity(secret => { - secret.ToTable(tablePrefix + "ClientSecrets", schema); + secret.ToTable(options.TablePrefix + "ClientSecrets", options.Schema); secret.HasKey(x => new { x.ClientId, x.Type, x.Value }); @@ -104,7 +105,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore builder.Entity(claim => { - claim.ToTable(tablePrefix + "ClientClaims", schema); + claim.ToTable(options.TablePrefix + "ClientClaims", options.Schema); claim.HasKey(x => new { x.ClientId, x.Type, x.Value }); @@ -114,7 +115,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore builder.Entity(idPRestriction => { - idPRestriction.ToTable(tablePrefix + "ClientIdPRestrictions", schema); + idPRestriction.ToTable(options.TablePrefix + "ClientIdPRestrictions", options.Schema); idPRestriction.HasKey(x => new { x.ClientId, x.Provider }); @@ -123,7 +124,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore builder.Entity(corsOrigin => { - corsOrigin.ToTable(tablePrefix + "ClientCorsOrigins", schema); + corsOrigin.ToTable(options.TablePrefix + "ClientCorsOrigins", options.Schema); corsOrigin.HasKey(x => new { x.ClientId, x.Origin }); @@ -132,7 +133,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore builder.Entity(property => { - property.ToTable(tablePrefix + "ClientProperties", schema); + property.ToTable(options.TablePrefix + "ClientProperties", options.Schema); property.HasKey(x => new { x.ClientId, x.Key }); @@ -142,7 +143,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore builder.Entity(grant => { - grant.ToTable(tablePrefix + "PersistedGrants", schema); + grant.ToTable(options.TablePrefix + "PersistedGrants", options.Schema); grant.ConfigureExtraProperties(); @@ -161,7 +162,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore builder.Entity(identityResource => { - identityResource.ToTable(tablePrefix + "IdentityResources", schema); + identityResource.ToTable(options.TablePrefix + "IdentityResources", options.Schema); identityResource.ConfigureFullAuditedAggregateRoot(); @@ -179,7 +180,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore builder.Entity(claim => { - claim.ToTable(tablePrefix + "IdentityClaims", schema); + claim.ToTable(options.TablePrefix + "IdentityClaims", options.Schema); claim.HasKey(x => new { x.IdentityResourceId, x.Type }); @@ -188,7 +189,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore builder.Entity(apiResource => { - apiResource.ToTable(tablePrefix + "ApiResources", schema); + apiResource.ToTable(options.TablePrefix + "ApiResources", options.Schema); apiResource.ConfigureFullAuditedAggregateRoot(); @@ -208,7 +209,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore builder.Entity(apiSecret => { - apiSecret.ToTable(tablePrefix + "ApiSecrets", schema); + apiSecret.ToTable(options.TablePrefix + "ApiSecrets", options.Schema); apiSecret.HasKey(x => new { x.ApiResourceId, x.Type, x.Value }); @@ -219,7 +220,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore builder.Entity(apiClaim => { - apiClaim.ToTable(tablePrefix + "ApiClaims", schema); + apiClaim.ToTable(options.TablePrefix + "ApiClaims", options.Schema); apiClaim.HasKey(x => new { x.ApiResourceId, x.Type }); @@ -228,7 +229,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore builder.Entity(apiScope => { - apiScope.ToTable(tablePrefix + "ApiScopes", schema); + apiScope.ToTable(options.TablePrefix + "ApiScopes", options.Schema); apiScope.HasKey(x => new { x.ApiResourceId, x.Name }); @@ -241,7 +242,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore builder.Entity(apiScopeClaim => { - apiScopeClaim.ToTable(tablePrefix + "ApiScopeClaims", schema); + apiScopeClaim.ToTable(options.TablePrefix + "ApiScopeClaims", options.Schema); apiScopeClaim.HasKey(x => new { x.ApiResourceId, x.Name, x.Type }); diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerModelBuilderConfigurationOptions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerModelBuilderConfigurationOptions.cs new file mode 100644 index 0000000000..55dcc06837 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerModelBuilderConfigurationOptions.cs @@ -0,0 +1,18 @@ +using JetBrains.Annotations; +using Volo.Abp.EntityFrameworkCore.Modeling; + +namespace Volo.Abp.IdentityServer.EntityFrameworkCore +{ + public class IdentityServerModelBuilderConfigurationOptions : ModelBuilderConfigurationOptions + { + public IdentityServerModelBuilderConfigurationOptions( + [NotNull] string tablePrefix, + [CanBeNull] string schema) + : base( + tablePrefix, + schema) + { + + } + } +} \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs index 7f519234a0..16f99b9119 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs @@ -8,11 +8,9 @@ using IdentityResource = Volo.Abp.IdentityServer.IdentityResources.IdentityResou namespace Volo.Abp.IdentityServer.MongoDB { - [ConnectionStringName(AbpIdentityServerConsts.ConnectionStringName)] + [ConnectionStringName(AbpIdentityServerDbProperties.ConnectionStringName)] public class AbpIdentityServerMongoDbContext : AbpMongoDbContext, IAbpIdentityServerMongoDbContext { - public static string CollectionPrefix { get; set; } = AbpIdentityServerConsts.DefaultDbTablePrefix; - public IMongoCollection ApiResources => Collection(); public IMongoCollection Clients => Collection(); @@ -25,10 +23,7 @@ namespace Volo.Abp.IdentityServer.MongoDB { base.CreateModel(modelBuilder); - modelBuilder.ConfigureIdentityServer(options => - { - options.CollectionPrefix = CollectionPrefix; - }); + modelBuilder.ConfigureIdentityServer(); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContextExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContextExtensions.cs index 6f81a67493..474188a0e1 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContextExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContextExtensions.cs @@ -15,7 +15,9 @@ namespace Volo.Abp.IdentityServer.MongoDB { Check.NotNull(builder, nameof(builder)); - var options = new IdentityServerMongoModelBuilderConfigurationOptions(); + var options = new IdentityServerMongoModelBuilderConfigurationOptions( + AbpIdentityServerDbProperties.DbTablePrefix + ); optionsAction?.Invoke(options); diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IAbpIdentityServerMongoDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IAbpIdentityServerMongoDbContext.cs index 2813c4f87b..cda4718896 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IAbpIdentityServerMongoDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IAbpIdentityServerMongoDbContext.cs @@ -8,7 +8,7 @@ using ApiResource = Volo.Abp.IdentityServer.ApiResources.ApiResource; namespace Volo.Abp.IdentityServer.MongoDB { - [ConnectionStringName(AbpIdentityServerConsts.ConnectionStringName)] + [ConnectionStringName(AbpIdentityServerDbProperties.ConnectionStringName)] public interface IAbpIdentityServerMongoDbContext : IAbpMongoDbContext { IMongoCollection ApiResources { get; } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IdentityServerMongoModelBuilderConfigurationOptions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IdentityServerMongoModelBuilderConfigurationOptions.cs index bb88711e9e..f6afe62737 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IdentityServerMongoModelBuilderConfigurationOptions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IdentityServerMongoModelBuilderConfigurationOptions.cs @@ -1,11 +1,12 @@ -using Volo.Abp.MongoDB; +using JetBrains.Annotations; +using Volo.Abp.MongoDB; namespace Volo.Abp.IdentityServer.MongoDB { public class IdentityServerMongoModelBuilderConfigurationOptions : MongoModelBuilderConfigurationOptions { - public IdentityServerMongoModelBuilderConfigurationOptions() - : base(AbpIdentityServerConsts.DefaultDbTablePrefix) + public IdentityServerMongoModelBuilderConfigurationOptions([NotNull] string collectionPrefix = "") + : base(collectionPrefix) { } } From b7b40447eec5d141b67c28ad77ec6f575aede3f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 11 Oct 2019 15:59:55 +0300 Subject: [PATCH 44/62] DocsDbProperties properties should be static --- .../docs/src/Volo.Docs.Domain/Volo/Docs/DocsDbProperties.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDbProperties.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDbProperties.cs index d30118bd32..d212f7e24d 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDbProperties.cs +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDbProperties.cs @@ -2,9 +2,9 @@ { public static class DocsDbProperties { - public const string DbTablePrefix = "Docs"; + public static string DbTablePrefix { get; } = "Docs"; - public const string DbSchema = null; + public static string DbSchema { get; } = null; public const string ConnectionStringName = "Docs"; } From 7dfce0ef581aca7cb10ac1be329433c83af12cae Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Fri, 11 Oct 2019 16:02:34 +0300 Subject: [PATCH 45/62] test(core): add auth.guard.spec --- .../core/src/lib/tests/auth.guard.spec.ts | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 npm/ng-packs/packages/core/src/lib/tests/auth.guard.spec.ts diff --git a/npm/ng-packs/packages/core/src/lib/tests/auth.guard.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/auth.guard.spec.ts new file mode 100644 index 0000000000..3ae113c948 --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/tests/auth.guard.spec.ts @@ -0,0 +1,35 @@ +import { createServiceFactory, SpectatorService } from '@ngneat/spectator'; +import { AuthGuard } from '../guards/auth.guard'; +import { OAuthService } from 'angular-oauth2-oidc'; +import { RouterModule, UrlTree, Router } from '@angular/router'; +import { RouterOutletComponent } from '../components'; +import { APP_BASE_HREF } from '@angular/common'; + +describe('AuthGuard', () => { + let spectator: SpectatorService; + let guard: AuthGuard; + const createService = createServiceFactory({ + service: AuthGuard, + mocks: [OAuthService], + imports: [RouterModule.forRoot([{ path: '', component: RouterOutletComponent }])], + declarations: [RouterOutletComponent], + providers: [{ provide: APP_BASE_HREF, useValue: '/' }], + }); + + beforeEach(() => { + spectator = createService(); + guard = spectator.service; + }); + + it('should return true when user logged in', () => { + spectator.get(OAuthService).hasValidAccessToken.andReturn(true); + expect(guard.canActivate(null, null)).toBe(true); + }); + + it('should return url tree when user not logged in', () => { + const router = spectator.get(Router); + const expectedUrlTree = router.createUrlTree(['/account/login'], { state: { redirectUrl: '/' } }); + spectator.get(OAuthService).hasValidAccessToken.andReturn(false); + expect(guard.canActivate(null, { url: '/' } as any) as UrlTree).toEqual(expectedUrlTree); + }); +}); From 3154baeba7f97df76ea57cdb4b67e21c58872dca Mon Sep 17 00:00:00 2001 From: thediaval Date: Fri, 11 Oct 2019 16:05:54 +0300 Subject: [PATCH 46/62] test(core): add sort.pipe.spec --- .../lib/directives/table-sort.directive.ts | 6 ---- .../packages/core/src/lib/pipes/sort.pipe.ts | 26 ++++++++-------- .../core/src/lib/tests/sort.pipe.spec.ts | 30 +++++++++++++++++++ .../lib/tests/table-sort.directive.spec.ts | 2 +- 4 files changed, 43 insertions(+), 21 deletions(-) create mode 100644 npm/ng-packs/packages/core/src/lib/tests/sort.pipe.spec.ts diff --git a/npm/ng-packs/packages/core/src/lib/directives/table-sort.directive.ts b/npm/ng-packs/packages/core/src/lib/directives/table-sort.directive.ts index 77e9bc10e8..e9a58fe589 100644 --- a/npm/ng-packs/packages/core/src/lib/directives/table-sort.directive.ts +++ b/npm/ng-packs/packages/core/src/lib/directives/table-sort.directive.ts @@ -1,14 +1,11 @@ import { Directive, Input, Optional, Self, SimpleChanges, OnChanges } from '@angular/core'; import { Table } from 'primeng/table'; import { SortPipe, SortOrder } from '../pipes/sort.pipe'; -import { timer } from 'rxjs'; import clone from 'just-clone'; - export interface TableSortOptions { key: string; order: SortOrder; } - @Directive({ selector: '[abpTableSort]', providers: [SortPipe], @@ -16,12 +13,9 @@ export interface TableSortOptions { export class TableSortDirective implements OnChanges { @Input() abpTableSort: TableSortOptions; - @Input() value: any[] = []; - constructor(@Optional() @Self() private table: Table, private sortPipe: SortPipe) {} - ngOnChanges({ value, abpTableSort }: SimpleChanges) { if (value || abpTableSort) { this.abpTableSort = this.abpTableSort || ({} as TableSortOptions); diff --git a/npm/ng-packs/packages/core/src/lib/pipes/sort.pipe.ts b/npm/ng-packs/packages/core/src/lib/pipes/sort.pipe.ts index d31d4903c6..9e7b5a0d10 100644 --- a/npm/ng-packs/packages/core/src/lib/pipes/sort.pipe.ts +++ b/npm/ng-packs/packages/core/src/lib/pipes/sort.pipe.ts @@ -1,29 +1,27 @@ -import { Pipe, PipeTransform, Injectable } from '@angular/core'; -import clone from 'just-clone'; - +import { Injectable, Pipe, PipeTransform } from '@angular/core'; export type SortOrder = 'asc' | 'desc'; - @Injectable() @Pipe({ name: 'abpSort', }) export class SortPipe implements PipeTransform { - intialValue: any[]; - transform(value: any[], sortOrder: SortOrder | string = 'asc', sortKey?: string): any { sortOrder = sortOrder && (sortOrder.toLowerCase() as any); - - if (!this.intialValue) this.intialValue = clone(value); - - if (!value || (sortOrder !== 'asc' && sortOrder !== 'desc')) return this.intialValue; - + if (!value || (sortOrder !== 'asc' && sortOrder !== 'desc')) return value; let sorted; if (!sortKey) { - sorted = value.sort(); + const numberArray = []; + const stringArray = []; + value.forEach(item => (typeof item === 'number' ? numberArray.push(item) : stringArray.push(item))); + sorted = numberArray.sort().concat(stringArray.sort()); } else { - sorted = value.sort((a, b) => (a[sortKey] < b[sortKey] ? -1 : a[sortKey] > b[sortKey] ? 1 : 0)); + sorted = value.sort((a, b) => { + return ( + Number(typeof b[sortKey] === 'number') - Number(typeof a[sortKey] === 'number') || + (a[sortKey] < b[sortKey] ? -1 : 1) + ); + }); } - return sortOrder === 'asc' ? sorted : sorted.reverse(); } } diff --git a/npm/ng-packs/packages/core/src/lib/tests/sort.pipe.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/sort.pipe.spec.ts new file mode 100644 index 0000000000..6b88961728 --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/tests/sort.pipe.spec.ts @@ -0,0 +1,30 @@ +import { createServiceFactory, SpectatorService } from '@ngneat/spectator'; +import { SortPipe } from '../pipes/sort.pipe'; + +describe('SortPipe', () => { + let pipe: SortPipe; + let spectator: SpectatorService; + const createService = createServiceFactory(SortPipe); + + beforeEach(() => { + spectator = createService(); + pipe = spectator.service; + }); + + test('should sort array in ascending and descending orders', () => { + expect(pipe.transform([5, 'b', 1, 'a'], 'asc')).toEqual([1, 5, 'a', 'b']); + expect(pipe.transform([5, 'b', 1, 'a'], 'desc')).toEqual(['b', 'a', 5, 1]); + }); + + test('should sort object array in given order with given key', () => { + const array = [{ key: 5 }, { key: 'b' }, { key: 1 }, { key: 'a' }]; + + expect(pipe.transform(array, 'asc', 'key')).toEqual([{ key: 1 }, { key: 5 }, { key: 'a' }, { key: 'b' }]); + expect(pipe.transform(array, 'desc', 'key')).toEqual([{ key: 'b' }, { key: 'a' }, { key: 5 }, { key: 1 }]); + }); + + test('should require an array as value', () => { + expect(pipe.transform(null, 'asc')).toBeFalsy(); + expect(pipe.transform(undefined, 'desc')).toBeFalsy(); + }); +}); diff --git a/npm/ng-packs/packages/core/src/lib/tests/table-sort.directive.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/table-sort.directive.spec.ts index c705735f03..6a9401217e 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/table-sort.directive.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/table-sort.directive.spec.ts @@ -1,4 +1,4 @@ -import { SpectatorDirective, createDirectiveFactory, SpyObject } from '@ngneat/spectator/jest'; +import { SpectatorDirective, createDirectiveFactory } from '@ngneat/spectator/jest'; import { TableSortDirective } from '../directives/table-sort.directive'; import { TableModule, Table } from 'primeng/table'; From 4170a36764de6049956b6fc1d565ec75e02423e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 11 Oct 2019 16:07:58 +0300 Subject: [PATCH 47/62] PermissionManagement db table prefix revision --- .../AbpPermissionManagementConsts.cs | 11 ----------- .../AbpPermissionManagementDbProperties.cs | 13 +++++++++++++ ...anagementDbContextModelBuilderExtensions.cs | 18 ++++++++++-------- ...nagementModelBuilderConfigurationOptions.cs | 18 ++++++++++++++++++ .../IPermissionManagementDbContext.cs | 2 +- .../PermissionManagementDbContext.cs | 8 ++------ ...issionManagementMongoDbContextExtensions.cs | 4 +++- .../IPermissionManagementMongoDbContext.cs | 2 +- .../PermissionManagementMongoDbContext.cs | 9 ++------- ...entMongoModelBuilderConfigurationOptions.cs | 3 ++- 10 files changed, 52 insertions(+), 36 deletions(-) delete mode 100644 modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/AbpPermissionManagementConsts.cs create mode 100644 modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/AbpPermissionManagementDbProperties.cs create mode 100644 modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/AbpPermissionManagementModelBuilderConfigurationOptions.cs diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/AbpPermissionManagementConsts.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/AbpPermissionManagementConsts.cs deleted file mode 100644 index b53ea98cdb..0000000000 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/AbpPermissionManagementConsts.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Volo.Abp.PermissionManagement -{ - public static class AbpPermissionManagementConsts - { - public const string DefaultDbTablePrefix = "Abp"; - - public const string DefaultDbSchema = null; - - public const string ConnectionStringName = "AbpPermissionManagement"; - } -} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/AbpPermissionManagementDbProperties.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/AbpPermissionManagementDbProperties.cs new file mode 100644 index 0000000000..6b318dbc25 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/AbpPermissionManagementDbProperties.cs @@ -0,0 +1,13 @@ +using Volo.Abp.Data; + +namespace Volo.Abp.PermissionManagement +{ + public static class AbpPermissionManagementDbProperties + { + public static string DbTablePrefix { get; } = AbpCommonDbProperties.DbTablePrefix; + + public static string DbSchema { get; } = AbpCommonDbProperties.DbSchema; + + public const string ConnectionStringName = "AbpPermissionManagement"; + } +} diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/AbpPermissionManagementDbContextModelBuilderExtensions.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/AbpPermissionManagementDbContextModelBuilderExtensions.cs index ceb14be6d5..6fefa69c8f 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/AbpPermissionManagementDbContextModelBuilderExtensions.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/AbpPermissionManagementDbContextModelBuilderExtensions.cs @@ -1,4 +1,5 @@ -using JetBrains.Annotations; +using System; +using JetBrains.Annotations; using Microsoft.EntityFrameworkCore; namespace Volo.Abp.PermissionManagement.EntityFrameworkCore @@ -7,19 +8,20 @@ namespace Volo.Abp.PermissionManagement.EntityFrameworkCore { public static void ConfigurePermissionManagement( [NotNull] this ModelBuilder builder, - [CanBeNull] string tablePrefix = AbpPermissionManagementConsts.DefaultDbTablePrefix, - [CanBeNull] string schema = AbpPermissionManagementConsts.DefaultDbSchema) + [CanBeNull] Action optionsAction = null) { Check.NotNull(builder, nameof(builder)); - if (tablePrefix == null) - { - tablePrefix = ""; - } + var options = new AbpPermissionManagementModelBuilderConfigurationOptions( + AbpPermissionManagementDbProperties.DbTablePrefix, + AbpPermissionManagementDbProperties.DbSchema + ); + + optionsAction?.Invoke(options); builder.Entity(b => { - b.ToTable(tablePrefix + "PermissionGrants", schema); + b.ToTable(options.TablePrefix + "PermissionGrants", options.Schema); b.Property(x => x.Name).HasMaxLength(PermissionGrantConsts.MaxNameLength).IsRequired(); b.Property(x => x.ProviderName).HasMaxLength(PermissionGrantConsts.MaxProviderNameLength).IsRequired(); diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/AbpPermissionManagementModelBuilderConfigurationOptions.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/AbpPermissionManagementModelBuilderConfigurationOptions.cs new file mode 100644 index 0000000000..3cf4c1755a --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/AbpPermissionManagementModelBuilderConfigurationOptions.cs @@ -0,0 +1,18 @@ +using JetBrains.Annotations; +using Volo.Abp.EntityFrameworkCore.Modeling; + +namespace Volo.Abp.PermissionManagement.EntityFrameworkCore +{ + public class AbpPermissionManagementModelBuilderConfigurationOptions : ModelBuilderConfigurationOptions + { + public AbpPermissionManagementModelBuilderConfigurationOptions( + [NotNull] string tablePrefix, + [CanBeNull] string schema) + : base( + tablePrefix, + schema) + { + + } + } +} \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/IPermissionManagementDbContext.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/IPermissionManagementDbContext.cs index 61e5a68209..9319e75f5e 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/IPermissionManagementDbContext.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/IPermissionManagementDbContext.cs @@ -4,7 +4,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Volo.Abp.PermissionManagement.EntityFrameworkCore { - [ConnectionStringName(AbpPermissionManagementConsts.ConnectionStringName)] + [ConnectionStringName(AbpPermissionManagementDbProperties.ConnectionStringName)] public interface IPermissionManagementDbContext : IEfCoreDbContext { DbSet PermissionGrants { get; set; } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/PermissionManagementDbContext.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/PermissionManagementDbContext.cs index 45b1e74500..78549c1452 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/PermissionManagementDbContext.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/PermissionManagementDbContext.cs @@ -4,13 +4,9 @@ using Volo.Abp.EntityFrameworkCore; namespace Volo.Abp.PermissionManagement.EntityFrameworkCore { - [ConnectionStringName(AbpPermissionManagementConsts.ConnectionStringName)] + [ConnectionStringName(AbpPermissionManagementDbProperties.ConnectionStringName)] public class PermissionManagementDbContext : AbpDbContext, IPermissionManagementDbContext { - public static string TablePrefix { get; set; } = AbpPermissionManagementConsts.DefaultDbTablePrefix; - - public static string Schema { get; set; } = AbpPermissionManagementConsts.DefaultDbSchema; - public DbSet PermissionGrants { get; set; } public PermissionManagementDbContext(DbContextOptions options) @@ -23,7 +19,7 @@ namespace Volo.Abp.PermissionManagement.EntityFrameworkCore { base.OnModelCreating(builder); - builder.ConfigurePermissionManagement(TablePrefix, Schema); + builder.ConfigurePermissionManagement(); } } } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/AbpPermissionManagementMongoDbContextExtensions.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/AbpPermissionManagementMongoDbContextExtensions.cs index a00f0cbfc3..e3ec872065 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/AbpPermissionManagementMongoDbContextExtensions.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/AbpPermissionManagementMongoDbContextExtensions.cs @@ -11,7 +11,9 @@ namespace Volo.Abp.PermissionManagement.MongoDB { Check.NotNull(builder, nameof(builder)); - var options = new PermissionManagementMongoModelBuilderConfigurationOptions(); + var options = new PermissionManagementMongoModelBuilderConfigurationOptions( + AbpPermissionManagementDbProperties.DbTablePrefix + ); optionsAction?.Invoke(options); diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/IPermissionManagementMongoDbContext.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/IPermissionManagementMongoDbContext.cs index 5013ced4e8..45c99eade2 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/IPermissionManagementMongoDbContext.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/IPermissionManagementMongoDbContext.cs @@ -4,7 +4,7 @@ using Volo.Abp.MongoDB; namespace Volo.Abp.PermissionManagement.MongoDB { - [ConnectionStringName(AbpPermissionManagementConsts.ConnectionStringName)] + [ConnectionStringName(AbpPermissionManagementDbProperties.ConnectionStringName)] public interface IPermissionManagementMongoDbContext : IAbpMongoDbContext { IMongoCollection PermissionGrants { get; } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/PermissionManagementMongoDbContext.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/PermissionManagementMongoDbContext.cs index 3b0b4dece9..cdc6ccdff5 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/PermissionManagementMongoDbContext.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/PermissionManagementMongoDbContext.cs @@ -4,21 +4,16 @@ using Volo.Abp.MongoDB; namespace Volo.Abp.PermissionManagement.MongoDB { - [ConnectionStringName(AbpPermissionManagementConsts.ConnectionStringName)] + [ConnectionStringName(AbpPermissionManagementDbProperties.ConnectionStringName)] public class PermissionManagementMongoDbContext : AbpMongoDbContext, IPermissionManagementMongoDbContext { - public static string CollectionPrefix { get; set; } = AbpPermissionManagementConsts.DefaultDbTablePrefix; - public IMongoCollection PermissionGrants => Collection(); protected override void CreateModel(IMongoModelBuilder modelBuilder) { base.CreateModel(modelBuilder); - modelBuilder.ConfigurePermissionManagement(options => - { - options.CollectionPrefix = CollectionPrefix; - }); + modelBuilder.ConfigurePermissionManagement(); } } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/PermissionManagementMongoModelBuilderConfigurationOptions.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/PermissionManagementMongoModelBuilderConfigurationOptions.cs index 930c811c0c..0af620956c 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/PermissionManagementMongoModelBuilderConfigurationOptions.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/PermissionManagementMongoModelBuilderConfigurationOptions.cs @@ -5,7 +5,8 @@ namespace Volo.Abp.PermissionManagement.MongoDB { public class PermissionManagementMongoModelBuilderConfigurationOptions : MongoModelBuilderConfigurationOptions { - public PermissionManagementMongoModelBuilderConfigurationOptions([NotNull] string tablePrefix = AbpPermissionManagementConsts.DefaultDbTablePrefix) + public PermissionManagementMongoModelBuilderConfigurationOptions( + [NotNull] string tablePrefix = "") : base(tablePrefix) { } From f053870733afdee384c097542bb389b7b624ab6d Mon Sep 17 00:00:00 2001 From: Alper Ebicoglu Date: Fri, 11 Oct 2019 16:09:46 +0300 Subject: [PATCH 48/62] add RemoteServiceExceptionHandler --- .../Abp/Cli/Licensing/AbpIoApiKeyService.cs | 12 ++- .../Volo/Abp/Cli/NuGet/NuGetService.cs | 13 ++- .../ProjectBuilding/AbpIoSourceCodeStore.cs | 33 ++++--- .../Analyticses/CliAnalyticsCollect.cs | 19 +++- .../IRemoteServiceExceptionHandler.cs | 12 +++ .../Cli/ProjectBuilding/ModuleInfoProvider.cs | 15 +-- .../RemoteServiceExceptionHandler.cs | 92 +++++++++++++++++++ .../ProjectNugetPackageAdder.cs | 8 +- .../SolutionModuleAdder.cs | 8 +- 9 files changed, 176 insertions(+), 36 deletions(-) create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/IRemoteServiceExceptionHandler.cs create mode 100644 framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/RemoteServiceExceptionHandler.cs diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/AbpIoApiKeyService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/AbpIoApiKeyService.cs index 22cd692ec3..c8f221b73c 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/AbpIoApiKeyService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/AbpIoApiKeyService.cs @@ -1,6 +1,7 @@ using System; using System.Threading.Tasks; using Volo.Abp.Cli.Http; +using Volo.Abp.Cli.ProjectBuilding; using Volo.Abp.DependencyInjection; using Volo.Abp.Json; @@ -8,13 +9,16 @@ namespace Volo.Abp.Cli.Licensing { public class AbpIoApiKeyService : IApiKeyService, ITransientDependency { - public AbpIoApiKeyService(IJsonSerializer jsonSerializer) + protected IJsonSerializer JsonSerializer { get; } + + protected IRemoteServiceExceptionHandler RemoteServiceExceptionHandler { get; } + + public AbpIoApiKeyService(IJsonSerializer jsonSerializer, IRemoteServiceExceptionHandler remoteServiceExceptionHandler) { JsonSerializer = jsonSerializer; + RemoteServiceExceptionHandler = remoteServiceExceptionHandler; } - protected IJsonSerializer JsonSerializer { get; } - public async Task GetApiKeyOrNullAsync() { using (var client = new CliHttpClient()) @@ -28,6 +32,8 @@ namespace Volo.Abp.Cli.Licensing throw new Exception($"ERROR: Remote server returns '{response.StatusCode}'"); } + await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response); + var responseContent = await response.Content.ReadAsStringAsync(); return JsonSerializer.Deserialize(responseContent); } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/NuGet/NuGetService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/NuGet/NuGetService.cs index b0dd6328db..700303006b 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/NuGet/NuGetService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/NuGet/NuGetService.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Volo.Abp.Cli.Http; +using Volo.Abp.Cli.ProjectBuilding; using Volo.Abp.DependencyInjection; using Volo.Abp.Json; using Volo.Abp.Threading; @@ -17,11 +18,15 @@ namespace Volo.Abp.Cli.NuGet protected ICancellationTokenProvider CancellationTokenProvider { get; } + protected IRemoteServiceExceptionHandler RemoteServiceExceptionHandler { get; } + public NuGetService( IJsonSerializer jsonSerializer, + IRemoteServiceExceptionHandler remoteServiceExceptionHandler, ICancellationTokenProvider cancellationTokenProvider) { JsonSerializer = jsonSerializer; + RemoteServiceExceptionHandler = remoteServiceExceptionHandler; CancellationTokenProvider = cancellationTokenProvider; } @@ -35,10 +40,7 @@ namespace Volo.Abp.Cli.NuGet var responseMessage = await client.GetAsync(url, CancellationTokenProvider.Token); - if (!responseMessage.IsSuccessStatusCode) - { - throw new Exception("Remote server returns error! HTTP status code: " + responseMessage.StatusCode); - } + await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(responseMessage); var result = await responseMessage.Content.ReadAsStringAsync(); @@ -49,7 +51,8 @@ namespace Volo.Abp.Cli.NuGet versions = versions.Where(x => !x.IsPrerelease); } - return versions.Any() ? versions.Max() : null; + var semanticVersions = versions.ToList(); + return semanticVersions.Any() ? semanticVersions.Max() : null; } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs index 6fde8db9e3..ac51be6fac 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs @@ -2,7 +2,9 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; using System; +using System.Collections.Generic; using System.IO; +using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; @@ -23,14 +25,18 @@ namespace Volo.Abp.Cli.ProjectBuilding protected IJsonSerializer JsonSerializer { get; } + protected IRemoteServiceExceptionHandler RemoteServiceExceptionHandler { get; } + protected ICancellationTokenProvider CancellationTokenProvider { get; } public AbpIoSourceCodeStore( IOptions options, IJsonSerializer jsonSerializer, + IRemoteServiceExceptionHandler remoteServiceExceptionHandler, ICancellationTokenProvider cancellationTokenProvider) { JsonSerializer = jsonSerializer; + RemoteServiceExceptionHandler = remoteServiceExceptionHandler; CancellationTokenProvider = cancellationTokenProvider; Options = options.Value; @@ -42,6 +48,7 @@ namespace Volo.Abp.Cli.ProjectBuilding string type, string version = null) { + var latestVersion = await GetLatestSourceCodeVersionAsync(name, type); if (version == null) { @@ -74,26 +81,29 @@ namespace Volo.Abp.Cli.ProjectBuilding } return new TemplateFile(fileContent, version, latestVersion); + } private async Task GetLatestSourceCodeVersionAsync(string name, string type) { - var postData = JsonSerializer.Serialize(new GetLatestSourceCodeVersionDto { Name = name }); - using (var client = new CliHttpClient()) { - var responseMessage = await client.PostAsync( + var response = await client.PostAsync( $"{CliUrls.WwwAbpIo}api/download/{type}/get-version/", - new StringContent(postData, Encoding.UTF8, MimeTypes.Application.Json), + new StringContent( + JsonSerializer.Serialize( + new GetLatestSourceCodeVersionDto { Name = name } + ), + Encoding.UTF8, + MimeTypes.Application.Json + ), CancellationTokenProvider.Token ); - if (!responseMessage.IsSuccessStatusCode) - { - throw new Exception("Remote server returns error! HTTP status code: " + responseMessage.StatusCode); - } + await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response); + + var result = await response.Content.ReadAsStringAsync(); - var result = await responseMessage.Content.ReadAsStringAsync(); return JsonSerializer.Deserialize(result).Version; } } @@ -110,10 +120,7 @@ namespace Volo.Abp.Cli.ProjectBuilding CancellationTokenProvider.Token ); - if (!responseMessage.IsSuccessStatusCode) - { - throw new Exception("Remote server returns error! HTTP status code: " + responseMessage.StatusCode); - } + await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(responseMessage); return await responseMessage.Content.ReadAsByteArrayAsync(); } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Analyticses/CliAnalyticsCollect.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Analyticses/CliAnalyticsCollect.cs index 6598c9fb31..fdfbb8b5d3 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Analyticses/CliAnalyticsCollect.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Analyticses/CliAnalyticsCollect.cs @@ -16,12 +16,16 @@ namespace Volo.Abp.Cli.ProjectBuilding.Analyticses private readonly ICancellationTokenProvider _cancellationTokenProvider; private readonly IJsonSerializer _jsonSerializer; private readonly ILogger _logger; + private readonly IRemoteServiceExceptionHandler _remoteServiceExceptionHandler; - public CliAnalyticsCollect(ICancellationTokenProvider cancellationTokenProvider, - IJsonSerializer jsonSerializer) + public CliAnalyticsCollect( + ICancellationTokenProvider cancellationTokenProvider, + IJsonSerializer jsonSerializer, + IRemoteServiceExceptionHandler remoteServiceExceptionHandler) { _cancellationTokenProvider = cancellationTokenProvider; _jsonSerializer = jsonSerializer; + _remoteServiceExceptionHandler = remoteServiceExceptionHandler; _logger = NullLogger.Instance; } @@ -38,8 +42,15 @@ namespace Volo.Abp.Cli.ProjectBuilding.Analyticses if (!responseMessage.IsSuccessStatusCode) { - _logger.LogInformation("Remote server returns error! HTTP status code: " + - responseMessage.StatusCode); + var exceptionMessage = "Remote server returns '" + (int)responseMessage.StatusCode + "-" + responseMessage.ReasonPhrase + "'. "; + var remoteServiceErrorMessage = await _remoteServiceExceptionHandler.GetAbpRemoteServiceErrorAsync(responseMessage); + + if (remoteServiceErrorMessage != null) + { + exceptionMessage += remoteServiceErrorMessage; + } + + _logger.LogInformation(exceptionMessage); } } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/IRemoteServiceExceptionHandler.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/IRemoteServiceExceptionHandler.cs new file mode 100644 index 0000000000..b3459f53ed --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/IRemoteServiceExceptionHandler.cs @@ -0,0 +1,12 @@ +using System.Net.Http; +using System.Threading.Tasks; + +namespace Volo.Abp.Cli.ProjectBuilding +{ + public interface IRemoteServiceExceptionHandler + { + Task EnsureSuccessfulHttpResponseAsync(HttpResponseMessage responseMessage); + + Task GetAbpRemoteServiceErrorAsync(HttpResponseMessage responseMessage); + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleInfoProvider.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleInfoProvider.cs index e82d4478b7..10b3a07172 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleInfoProvider.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleInfoProvider.cs @@ -10,15 +10,20 @@ using Volo.Abp.Threading; namespace Volo.Abp.Cli.ProjectBuilding { - public class ModuleInfoProvider: IModuleInfoProvider, ITransientDependency + public class ModuleInfoProvider : IModuleInfoProvider, ITransientDependency { public IJsonSerializer JsonSerializer { get; } public ICancellationTokenProvider CancellationTokenProvider { get; } + public IRemoteServiceExceptionHandler RemoteServiceExceptionHandler { get; } - public ModuleInfoProvider(IJsonSerializer jsonSerializer, ICancellationTokenProvider cancellationTokenProvider) + public ModuleInfoProvider( + IJsonSerializer jsonSerializer, + ICancellationTokenProvider cancellationTokenProvider, + IRemoteServiceExceptionHandler remoteServiceExceptionHandler) { JsonSerializer = jsonSerializer; CancellationTokenProvider = cancellationTokenProvider; + RemoteServiceExceptionHandler = remoteServiceExceptionHandler; } public async Task GetAsync(string name) @@ -44,11 +49,7 @@ namespace Volo.Abp.Cli.ProjectBuilding CancellationTokenProvider.Token ); - if (!responseMessage.IsSuccessStatusCode) - { - throw new Exception("Remote server returns error! HTTP status code: " + responseMessage.StatusCode); - } - + await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(responseMessage); var result = await responseMessage.Content.ReadAsStringAsync(); return JsonSerializer.Deserialize>(result); } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/RemoteServiceExceptionHandler.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/RemoteServiceExceptionHandler.cs new file mode 100644 index 0000000000..fe41577583 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/RemoteServiceExceptionHandler.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; +using Newtonsoft.Json; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Http; +using Volo.Abp.Json; + +namespace Volo.Abp.Cli.ProjectBuilding +{ + public class RemoteServiceExceptionHandler : IRemoteServiceExceptionHandler, ITransientDependency + { + private readonly IJsonSerializer _jsonSerializer; + + public RemoteServiceExceptionHandler(IJsonSerializer jsonSerializer) + { + _jsonSerializer = jsonSerializer; + } + + public async Task EnsureSuccessfulHttpResponseAsync(HttpResponseMessage responseMessage) + { + if (responseMessage == null) + { + return; + } + + if (responseMessage.IsSuccessStatusCode) + { + return; + } + + var exceptionMessage = "Remote server returns '" + (int)responseMessage.StatusCode + "-" + responseMessage.ReasonPhrase + "'. "; + + var remoteServiceErrorMessage = await GetAbpRemoteServiceErrorAsync(responseMessage); + if (remoteServiceErrorMessage != null) + { + exceptionMessage += remoteServiceErrorMessage; + } + + throw new Exception(exceptionMessage); + } + + public async Task GetAbpRemoteServiceErrorAsync(HttpResponseMessage responseMessage) + { + var errorResult = _jsonSerializer.Deserialize + ( + await responseMessage.Content.ReadAsStringAsync() + ); + + if (errorResult?.Error == null) + { + return null; + } + + var sbError = new StringBuilder(); + if (!string.IsNullOrWhiteSpace(errorResult.Error.Code)) + { + sbError.Append("Code: " + errorResult.Error.Code); + } + + if (!string.IsNullOrWhiteSpace(errorResult.Error.Message)) + { + if (sbError.Length > 0) + { + sbError.Append(" - "); + } + + sbError.Append("Message: " + errorResult.Error.Message); + } + + if (errorResult.Error.ValidationErrors != null && errorResult.Error.ValidationErrors.Any()) + { + if (sbError.Length > 0) + { + sbError.Append(" - "); + } + + sbError.AppendLine("Validation Errors: "); + for (var i = 0; i < errorResult.Error.ValidationErrors.Length; i++) + { + var validationError = errorResult.Error.ValidationErrors[i]; + sbError.AppendLine("Validation error #" + i + ": " + validationError.Message + " - Members: " + validationError.Members.JoinAsString(", ") + "."); + } + } + + return sbError.ToString(); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs index 2b2941a30d..1bacd7cd61 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Volo.Abp.Cli.Http; +using Volo.Abp.Cli.ProjectBuilding; using Volo.Abp.Cli.Utils; using Volo.Abp.DependencyInjection; using Volo.Abp.IO; @@ -22,17 +23,20 @@ namespace Volo.Abp.Cli.ProjectModification protected ProjectNpmPackageAdder NpmPackageAdder { get; } protected DerivedClassFinder ModuleClassFinder { get; } protected ModuleClassDependcyAdder ModuleClassDependcyAdder { get; } + protected IRemoteServiceExceptionHandler RemoteServiceExceptionHandler { get; } public ProjectNugetPackageAdder( IJsonSerializer jsonSerializer, ProjectNpmPackageAdder npmPackageAdder, DerivedClassFinder moduleClassFinder, - ModuleClassDependcyAdder moduleClassDependcyAdder) + ModuleClassDependcyAdder moduleClassDependcyAdder, + IRemoteServiceExceptionHandler remoteServiceExceptionHandler) { JsonSerializer = jsonSerializer; NpmPackageAdder = npmPackageAdder; ModuleClassFinder = moduleClassFinder; ModuleClassDependcyAdder = moduleClassDependcyAdder; + RemoteServiceExceptionHandler = remoteServiceExceptionHandler; Logger = NullLogger.Instance; } @@ -84,7 +88,7 @@ namespace Volo.Abp.Cli.ProjectModification throw new CliUsageException($"'{moduleName}' nuget package could not be found!"); } - throw new Exception($"ERROR: Remote server returns '{response.StatusCode}'"); + await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response); } var responseContent = await response.Content.ReadAsStringAsync(); diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs index 22e063a8ae..5950872419 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs @@ -8,6 +8,7 @@ using System.Linq; using System.Net; using System.Threading.Tasks; using Volo.Abp.Cli.Http; +using Volo.Abp.Cli.ProjectBuilding; using Volo.Abp.DependencyInjection; using Volo.Abp.Json; @@ -24,6 +25,7 @@ namespace Volo.Abp.Cli.ProjectModification protected DerivedClassFinder DerivedClassFinder { get; } protected ProjectNpmPackageAdder ProjectNpmPackageAdder { get; } protected NpmGlobalPackagesChecker NpmGlobalPackagesChecker { get; } + protected IRemoteServiceExceptionHandler RemoteServiceExceptionHandler { get; } public SolutionModuleAdder( IJsonSerializer jsonSerializer, @@ -32,7 +34,8 @@ namespace Volo.Abp.Cli.ProjectModification EfCoreMigrationAdder efCoreMigrationAdder, DerivedClassFinder derivedClassFinder, ProjectNpmPackageAdder projectNpmPackageAdder, - NpmGlobalPackagesChecker npmGlobalPackagesChecker) + NpmGlobalPackagesChecker npmGlobalPackagesChecker, + IRemoteServiceExceptionHandler remoteServiceExceptionHandler) { JsonSerializer = jsonSerializer; ProjectNugetPackageAdder = projectNugetPackageAdder; @@ -41,6 +44,7 @@ namespace Volo.Abp.Cli.ProjectModification DerivedClassFinder = derivedClassFinder; ProjectNpmPackageAdder = projectNpmPackageAdder; NpmGlobalPackagesChecker = npmGlobalPackagesChecker; + RemoteServiceExceptionHandler = remoteServiceExceptionHandler; Logger = NullLogger.Instance; } @@ -142,7 +146,7 @@ namespace Volo.Abp.Cli.ProjectModification throw new CliUsageException($"ERROR: '{moduleName}' module could not be found!"); } - throw new Exception($"ERROR: Remote server returns '{response.StatusCode}'"); + await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response); } var responseContent = await response.Content.ReadAsStringAsync(); From edea62e938319782263cebaffaf4995ecaeacb72 Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Fri, 11 Oct 2019 16:21:54 +0300 Subject: [PATCH 49/62] test(core): add permission.guard.spec --- .../core/src/lib/tests/auth.guard.spec.ts | 2 +- .../src/lib/tests/permission.guard.spec.ts | 43 +++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 npm/ng-packs/packages/core/src/lib/tests/permission.guard.spec.ts diff --git a/npm/ng-packs/packages/core/src/lib/tests/auth.guard.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/auth.guard.spec.ts index 3ae113c948..93339bcbcc 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/auth.guard.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/auth.guard.spec.ts @@ -1,4 +1,4 @@ -import { createServiceFactory, SpectatorService } from '@ngneat/spectator'; +import { createServiceFactory, SpectatorService } from '@ngneat/spectator/jest'; import { AuthGuard } from '../guards/auth.guard'; import { OAuthService } from 'angular-oauth2-oidc'; import { RouterModule, UrlTree, Router } from '@angular/router'; diff --git a/npm/ng-packs/packages/core/src/lib/tests/permission.guard.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/permission.guard.spec.ts new file mode 100644 index 0000000000..b358005837 --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/tests/permission.guard.spec.ts @@ -0,0 +1,43 @@ +import { createServiceFactory, SpectatorService, SpyObject } from '@ngneat/spectator/jest'; +import { Store } from '@ngxs/store'; +import { of } from 'rxjs'; +import { PermissionGuard } from '../guards/permission.guard'; +import { RestOccurError } from '../actions'; + +describe('PermissionGuard', () => { + let spectator: SpectatorService; + let guard: PermissionGuard; + let store: SpyObject; + + const createService = createServiceFactory({ + service: PermissionGuard, + mocks: [Store], + }); + + beforeEach(() => { + spectator = createService(); + guard = spectator.service; + store = spectator.get(Store); + }); + + it('should return true when the grantedPolicy is true', done => { + store.select.andReturn(of(true)); + const spy = jest.spyOn(store, 'dispatch'); + guard.canActivate({ data: { requiredPolicy: '' } } as any).subscribe(res => { + expect(res).toBe(true); + expect(spy.mock.calls).toHaveLength(0); + done(); + }); + }); + + it('should return false and dispatch RestOccurError when the grantedPolicy is false', done => { + store.select.andReturn(of(false)); + const spy = jest.spyOn(store, 'dispatch'); + guard.canActivate({ data: { requiredPolicy: '' } } as any).subscribe(res => { + expect(res).toBe(false); + expect(spy.mock.calls[0][0] instanceof RestOccurError).toBeTruthy(); + expect((spy.mock.calls[0][0] as RestOccurError).payload).toEqual({ status: 403 }); + done(); + }); + }); +}); From 0c710c6dcee530a0527950c044f53b0439cec441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 11 Oct 2019 16:30:43 +0300 Subject: [PATCH 50/62] setting-management revisit db prefix --- ...IdentityDbContextModelBuilderExtensions.cs | 2 +- .../AbpSettingManagementConsts.cs | 11 ------- .../AbpSettingManagementDbProperties.cs | 13 ++++++++ .../ISettingManagementDbContext.cs | 2 +- .../SettingManagementDbContext.cs | 8 ++--- ...nagementDbContextModelBuilderExtensions.cs | 32 ++++++++++++++----- .../ISettingManagementMongoDbContext.cs | 2 +- .../SettingManagementMongoDbContext.cs | 9 ++---- ...ttingManagementMongoDbContextExtensions.cs | 6 ++-- ...ntMongoModelBuilderConfigurationOptions.cs | 3 +- 10 files changed, 50 insertions(+), 38 deletions(-) delete mode 100644 modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/AbpSettingManagementConsts.cs create mode 100644 modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/AbpSettingManagementDbProperties.cs diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs index 01adfad531..a2a63062d3 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs @@ -10,7 +10,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore { public static void ConfigureIdentity( [NotNull] this ModelBuilder builder, - Action optionsAction = null) + [CanBeNull] Action optionsAction = null) { Check.NotNull(builder, nameof(builder)); diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/AbpSettingManagementConsts.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/AbpSettingManagementConsts.cs deleted file mode 100644 index 518a06c244..0000000000 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/AbpSettingManagementConsts.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Volo.Abp.SettingManagement -{ - public static class AbpSettingManagementConsts - { - public const string DefaultDbTablePrefix = "Abp"; - - public const string DefaultDbSchema = null; - - public const string ConnectionStringName = "AbpSettingManagement"; - } -} diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/AbpSettingManagementDbProperties.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/AbpSettingManagementDbProperties.cs new file mode 100644 index 0000000000..6ffa8c192b --- /dev/null +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/AbpSettingManagementDbProperties.cs @@ -0,0 +1,13 @@ +using Volo.Abp.Data; + +namespace Volo.Abp.SettingManagement +{ + public static class AbpSettingManagementDbProperties + { + public static string DbTablePrefix { get; } = AbpCommonDbProperties.DbTablePrefix; + + public static string DbSchema { get; } = AbpCommonDbProperties.DbSchema; + + public const string ConnectionStringName = "AbpSettingManagement"; + } +} diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/ISettingManagementDbContext.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/ISettingManagementDbContext.cs index a24c07b350..fea486a163 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/ISettingManagementDbContext.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/ISettingManagementDbContext.cs @@ -4,7 +4,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Volo.Abp.SettingManagement.EntityFrameworkCore { - [ConnectionStringName(AbpSettingManagementConsts.ConnectionStringName)] + [ConnectionStringName(AbpSettingManagementDbProperties.ConnectionStringName)] public interface ISettingManagementDbContext : IEfCoreDbContext { DbSet Settings { get; set; } diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/SettingManagementDbContext.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/SettingManagementDbContext.cs index 7db9bf2bf2..e85bcd21cc 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/SettingManagementDbContext.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/SettingManagementDbContext.cs @@ -4,13 +4,9 @@ using Volo.Abp.EntityFrameworkCore; namespace Volo.Abp.SettingManagement.EntityFrameworkCore { - [ConnectionStringName(AbpSettingManagementConsts.ConnectionStringName)] + [ConnectionStringName(AbpSettingManagementDbProperties.ConnectionStringName)] public class SettingManagementDbContext : AbpDbContext, ISettingManagementDbContext { - public static string TablePrefix { get; set; } = AbpSettingManagementConsts.DefaultDbTablePrefix; - - public static string Schema { get; set; } = AbpSettingManagementConsts.DefaultDbSchema; - public DbSet Settings { get; set; } public SettingManagementDbContext(DbContextOptions options) @@ -23,7 +19,7 @@ namespace Volo.Abp.SettingManagement.EntityFrameworkCore { base.OnModelCreating(builder); - builder.ConfigureSettingManagement(TablePrefix, Schema); + builder.ConfigureSettingManagement(); } } } diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/SettingManagementDbContextModelBuilderExtensions.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/SettingManagementDbContextModelBuilderExtensions.cs index 5c8c68b4f4..e95cb9791a 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/SettingManagementDbContextModelBuilderExtensions.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/SettingManagementDbContextModelBuilderExtensions.cs @@ -1,26 +1,42 @@ -using JetBrains.Annotations; +using System; +using JetBrains.Annotations; using Microsoft.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore.Modeling; namespace Volo.Abp.SettingManagement.EntityFrameworkCore { + public class SettingManagementModelBuilderConfigurationOptions : ModelBuilderConfigurationOptions + { + public SettingManagementModelBuilderConfigurationOptions( + [NotNull] string tablePrefix, + [CanBeNull] string schema) + : base( + tablePrefix, + schema) + { + + } + } + public static class SettingManagementDbContextModelBuilderExtensions { //TODO: Instead of getting parameters, get a action of SettingManagementModelBuilderConfigurationOptions like other modules public static void ConfigureSettingManagement( [NotNull] this ModelBuilder builder, - [CanBeNull] string tablePrefix = AbpSettingManagementConsts.DefaultDbTablePrefix, - [CanBeNull] string schema = AbpSettingManagementConsts.DefaultDbSchema) + [CanBeNull] Action optionsAction = null) { Check.NotNull(builder, nameof(builder)); - if (tablePrefix == null) - { - tablePrefix = ""; - } + var options = new SettingManagementModelBuilderConfigurationOptions( + AbpSettingManagementDbProperties.DbTablePrefix, + AbpSettingManagementDbProperties.DbSchema + ); + + optionsAction?.Invoke(options); builder.Entity(b => { - b.ToTable(tablePrefix + "Settings", schema); + b.ToTable(options.TablePrefix + "Settings", options.Schema); b.Property(x => x.Name).HasMaxLength(SettingConsts.MaxNameLength).IsRequired(); b.Property(x => x.Value).HasMaxLength(SettingConsts.MaxValueLength).IsRequired(); diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/ISettingManagementMongoDbContext.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/ISettingManagementMongoDbContext.cs index 0bf3894e7c..357ab0bfe3 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/ISettingManagementMongoDbContext.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/ISettingManagementMongoDbContext.cs @@ -4,7 +4,7 @@ using Volo.Abp.MongoDB; namespace Volo.Abp.SettingManagement.MongoDB { - [ConnectionStringName(AbpSettingManagementConsts.ConnectionStringName)] + [ConnectionStringName(AbpSettingManagementDbProperties.ConnectionStringName)] public interface ISettingManagementMongoDbContext : IAbpMongoDbContext { IMongoCollection Settings { get; } diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/SettingManagementMongoDbContext.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/SettingManagementMongoDbContext.cs index 7cc388982d..ada3a8100f 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/SettingManagementMongoDbContext.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/SettingManagementMongoDbContext.cs @@ -4,21 +4,16 @@ using Volo.Abp.MongoDB; namespace Volo.Abp.SettingManagement.MongoDB { - [ConnectionStringName(AbpSettingManagementConsts.ConnectionStringName)] + [ConnectionStringName(AbpSettingManagementDbProperties.ConnectionStringName)] public class SettingManagementMongoDbContext : AbpMongoDbContext, ISettingManagementMongoDbContext { - public static string CollectionPrefix { get; set; } = AbpSettingManagementConsts.DefaultDbTablePrefix; - public IMongoCollection Settings => Collection(); protected override void CreateModel(IMongoModelBuilder modelBuilder) { base.CreateModel(modelBuilder); - modelBuilder.ConfigureSettingManagement(options => - { - options.CollectionPrefix = CollectionPrefix; - }); + modelBuilder.ConfigureSettingManagement(); } } } \ No newline at end of file diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/SettingManagementMongoDbContextExtensions.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/SettingManagementMongoDbContextExtensions.cs index 057eebf7a4..349341b5d3 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/SettingManagementMongoDbContextExtensions.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/SettingManagementMongoDbContextExtensions.cs @@ -7,11 +7,13 @@ namespace Volo.Abp.SettingManagement.MongoDB { public static void ConfigureSettingManagement( this IMongoModelBuilder builder, - Action optionsAction = null) + Action optionsAction = null) { Check.NotNull(builder, nameof(builder)); - var options = new SettingManagementMongoModelBuilderConfigurationOptions(); + var options = new SettingManagementMongoModelBuilderConfigurationOptions( + AbpSettingManagementDbProperties.DbTablePrefix + ); optionsAction?.Invoke(options); diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/SettingManagementMongoModelBuilderConfigurationOptions.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/SettingManagementMongoModelBuilderConfigurationOptions.cs index aad41fc470..a603e1e204 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/SettingManagementMongoModelBuilderConfigurationOptions.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/SettingManagementMongoModelBuilderConfigurationOptions.cs @@ -5,7 +5,8 @@ namespace Volo.Abp.SettingManagement.MongoDB { public class SettingManagementMongoModelBuilderConfigurationOptions : MongoModelBuilderConfigurationOptions { - public SettingManagementMongoModelBuilderConfigurationOptions([NotNull] string tablePrefix = AbpSettingManagementConsts.DefaultDbTablePrefix) + public SettingManagementMongoModelBuilderConfigurationOptions( + [NotNull] string tablePrefix = "") : base(tablePrefix) { } From 103532a9eadf9239c8b597ed7d3596d246ac56cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 11 Oct 2019 16:34:52 +0300 Subject: [PATCH 51/62] tenant-management module db prefix revision --- .../AbpTenantManagementConsts.cs | 11 ----------- .../AbpTenantManagementDbProperties.cs | 13 +++++++++++++ ...nagementDbContextModelCreatingExtensions.cs | 18 ++++++++++-------- ...nagementModelBuilderConfigurationOptions.cs | 18 ++++++++++++++++++ .../ITenantManagementDbContext.cs | 2 +- .../TenantManagementDbContext.cs | 8 ++------ ...TenantManagementMongoDbContextExtensions.cs | 4 +++- .../MongoDb/ITenantManagementMongoDbContext.cs | 2 +- .../MongoDb/TenantManagementMongoDbContext.cs | 9 ++------- ...entMongoModelBuilderConfigurationOptions.cs | 3 ++- 10 files changed, 52 insertions(+), 36 deletions(-) delete mode 100644 modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementConsts.cs create mode 100644 modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementDbProperties.cs create mode 100644 modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/AbpTenantManagementModelBuilderConfigurationOptions.cs diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementConsts.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementConsts.cs deleted file mode 100644 index d64cb8b436..0000000000 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementConsts.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace Volo.Abp.TenantManagement -{ - public static class AbpTenantManagementConsts - { - public const string DefaultDbTablePrefix = "Abp"; - - public const string DefaultDbSchema = null; - - public const string ConnectionStringName = "AbpTenantManagement"; - } -} diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementDbProperties.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementDbProperties.cs new file mode 100644 index 0000000000..53f2d9b025 --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementDbProperties.cs @@ -0,0 +1,13 @@ +using Volo.Abp.Data; + +namespace Volo.Abp.TenantManagement +{ + public static class AbpTenantManagementDbProperties + { + public static string DbTablePrefix { get; } = AbpCommonDbProperties.DbTablePrefix; + + public static string DbSchema { get; } = AbpCommonDbProperties.DbSchema; + + public const string ConnectionStringName = "AbpTenantManagement"; + } +} diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/AbpTenantManagementDbContextModelCreatingExtensions.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/AbpTenantManagementDbContextModelCreatingExtensions.cs index c88baf22c5..f616a9c018 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/AbpTenantManagementDbContextModelCreatingExtensions.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/AbpTenantManagementDbContextModelCreatingExtensions.cs @@ -1,3 +1,4 @@ +using System; using JetBrains.Annotations; using Microsoft.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.Modeling; @@ -8,19 +9,20 @@ namespace Volo.Abp.TenantManagement.EntityFrameworkCore { public static void ConfigureTenantManagement( this ModelBuilder builder, - [CanBeNull] string tablePrefix = AbpTenantManagementConsts.DefaultDbTablePrefix, - [CanBeNull] string schema = AbpTenantManagementConsts.DefaultDbSchema) + [CanBeNull] Action optionsAction = null) { Check.NotNull(builder, nameof(builder)); - if (tablePrefix == null) - { - tablePrefix = ""; - } + var options = new AbpTenantManagementModelBuilderConfigurationOptions( + AbpTenantManagementDbProperties.DbTablePrefix, + AbpTenantManagementDbProperties.DbSchema + ); + + optionsAction?.Invoke(options); builder.Entity(b => { - b.ToTable(tablePrefix + "Tenants", schema); + b.ToTable(options.TablePrefix + "Tenants", options.Schema); b.ConfigureFullAuditedAggregateRoot(); @@ -33,7 +35,7 @@ namespace Volo.Abp.TenantManagement.EntityFrameworkCore builder.Entity(b => { - b.ToTable(tablePrefix + "TenantConnectionStrings", schema); + b.ToTable(options.TablePrefix + "TenantConnectionStrings", options.Schema); b.HasKey(x => new { x.TenantId, x.Name }); diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/AbpTenantManagementModelBuilderConfigurationOptions.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/AbpTenantManagementModelBuilderConfigurationOptions.cs new file mode 100644 index 0000000000..2c7bba5afe --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/AbpTenantManagementModelBuilderConfigurationOptions.cs @@ -0,0 +1,18 @@ +using JetBrains.Annotations; +using Volo.Abp.EntityFrameworkCore.Modeling; + +namespace Volo.Abp.TenantManagement.EntityFrameworkCore +{ + public class AbpTenantManagementModelBuilderConfigurationOptions : ModelBuilderConfigurationOptions + { + public AbpTenantManagementModelBuilderConfigurationOptions( + [NotNull] string tablePrefix, + [CanBeNull] string schema) + : base( + tablePrefix, + schema) + { + + } + } +} \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/ITenantManagementDbContext.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/ITenantManagementDbContext.cs index 31cfba5660..20eb5128da 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/ITenantManagementDbContext.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/ITenantManagementDbContext.cs @@ -4,7 +4,7 @@ using Volo.Abp.EntityFrameworkCore; namespace Volo.Abp.TenantManagement.EntityFrameworkCore { - [ConnectionStringName(AbpTenantManagementConsts.ConnectionStringName)] + [ConnectionStringName(AbpTenantManagementDbProperties.ConnectionStringName)] public interface ITenantManagementDbContext : IEfCoreDbContext { DbSet Tenants { get; set; } diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/TenantManagementDbContext.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/TenantManagementDbContext.cs index c4144f7ff2..f75dbd0562 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/TenantManagementDbContext.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/TenantManagementDbContext.cs @@ -4,13 +4,9 @@ using Volo.Abp.EntityFrameworkCore; namespace Volo.Abp.TenantManagement.EntityFrameworkCore { - [ConnectionStringName(AbpTenantManagementConsts.ConnectionStringName)] + [ConnectionStringName(AbpTenantManagementDbProperties.ConnectionStringName)] public class TenantManagementDbContext : AbpDbContext, ITenantManagementDbContext { - public static string TablePrefix { get; set; } = AbpTenantManagementConsts.DefaultDbTablePrefix; - - public static string Schema { get; set; } = AbpTenantManagementConsts.DefaultDbSchema; - public DbSet Tenants { get; set; } public DbSet TenantConnectionStrings { get; set; } @@ -24,7 +20,7 @@ namespace Volo.Abp.TenantManagement.EntityFrameworkCore { base.OnModelCreating(builder); - builder.ConfigureTenantManagement(TablePrefix, Schema); + builder.ConfigureTenantManagement(); } } } diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/AbpTenantManagementMongoDbContextExtensions.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/AbpTenantManagementMongoDbContextExtensions.cs index 39dbed6d57..590feb6a39 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/AbpTenantManagementMongoDbContextExtensions.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/AbpTenantManagementMongoDbContextExtensions.cs @@ -11,7 +11,9 @@ namespace Volo.Abp.TenantManagement.MongoDB { Check.NotNull(builder, nameof(builder)); - var options = new TenantManagementMongoModelBuilderConfigurationOptions(); + var options = new TenantManagementMongoModelBuilderConfigurationOptions( + AbpTenantManagementDbProperties.DbTablePrefix + ); optionsAction?.Invoke(options); diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/ITenantManagementMongoDbContext.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/ITenantManagementMongoDbContext.cs index 06bdd814da..d3c3fcbb62 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/ITenantManagementMongoDbContext.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/ITenantManagementMongoDbContext.cs @@ -4,7 +4,7 @@ using Volo.Abp.MongoDB; namespace Volo.Abp.TenantManagement.MongoDB { - [ConnectionStringName(AbpTenantManagementConsts.ConnectionStringName)] + [ConnectionStringName(AbpTenantManagementDbProperties.ConnectionStringName)] public interface ITenantManagementMongoDbContext : IAbpMongoDbContext { IMongoCollection Tenants { get; } diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/TenantManagementMongoDbContext.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/TenantManagementMongoDbContext.cs index adef6a0c2d..56327952d0 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/TenantManagementMongoDbContext.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/TenantManagementMongoDbContext.cs @@ -4,21 +4,16 @@ using Volo.Abp.MongoDB; namespace Volo.Abp.TenantManagement.MongoDB { - [ConnectionStringName(AbpTenantManagementConsts.ConnectionStringName)] + [ConnectionStringName(AbpTenantManagementDbProperties.ConnectionStringName)] public class TenantManagementMongoDbContext : AbpMongoDbContext, ITenantManagementMongoDbContext { - public static string CollectionPrefix { get; set; } = AbpTenantManagementConsts.DefaultDbTablePrefix; - public IMongoCollection Tenants => Collection(); protected override void CreateModel(IMongoModelBuilder modelBuilder) { base.CreateModel(modelBuilder); - modelBuilder.ConfigureTenantManagement(options => - { - options.CollectionPrefix = CollectionPrefix; - }); + modelBuilder.ConfigureTenantManagement(); } } } \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/TenantManagementMongoModelBuilderConfigurationOptions.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/TenantManagementMongoModelBuilderConfigurationOptions.cs index 5f2814460d..3b964a8940 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/TenantManagementMongoModelBuilderConfigurationOptions.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/TenantManagementMongoModelBuilderConfigurationOptions.cs @@ -5,7 +5,8 @@ namespace Volo.Abp.TenantManagement.MongoDB { public class TenantManagementMongoModelBuilderConfigurationOptions : MongoModelBuilderConfigurationOptions { - public TenantManagementMongoModelBuilderConfigurationOptions([NotNull] string tablePrefix = AbpTenantManagementConsts.DefaultDbTablePrefix) + public TenantManagementMongoModelBuilderConfigurationOptions( + [NotNull] string tablePrefix = "") : base(tablePrefix) { } From 2d3645843c92564ab0f55babd8e67cf0314f6f0d Mon Sep 17 00:00:00 2001 From: mehmet-erim Date: Fri, 11 Oct 2019 17:08:20 +0300 Subject: [PATCH 52/62] refactor(core): remove unnecessary injected service --- npm/ng-packs/packages/core/src/lib/guards/auth.guard.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/npm/ng-packs/packages/core/src/lib/guards/auth.guard.ts b/npm/ng-packs/packages/core/src/lib/guards/auth.guard.ts index 5ef01db246..cbd59fb5df 100644 --- a/npm/ng-packs/packages/core/src/lib/guards/auth.guard.ts +++ b/npm/ng-packs/packages/core/src/lib/guards/auth.guard.ts @@ -1,15 +1,13 @@ import { Injectable } from '@angular/core'; -import { ActivatedRouteSnapshot, CanActivate, RouterStateSnapshot, UrlTree, Router } from '@angular/router'; -import { Store } from '@ngxs/store'; +import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot, UrlTree } from '@angular/router'; import { OAuthService } from 'angular-oauth2-oidc'; import { Observable } from 'rxjs'; -import { Navigate } from '@ngxs/router-plugin'; @Injectable({ providedIn: 'root', }) export class AuthGuard implements CanActivate { - constructor(private oauthService: OAuthService, private store: Store, private router: Router) {} + constructor(private oauthService: OAuthService, private router: Router) {} canActivate(_: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable | boolean | UrlTree { const hasValidAccessToken = this.oauthService.hasValidAccessToken(); From 03c8e57fca63a281559291aecf9dd5558cf1f6ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 11 Oct 2019 17:34:13 +0300 Subject: [PATCH 53/62] Module template db prefix change --- .../MyProjectNameConsts.cs | 9 --------- .../MyProjectNameDbProperties.cs | 11 +++++++++++ .../EntityFrameworkCore/IMyProjectNameDbContext.cs | 2 +- .../EntityFrameworkCore/MyProjectNameDbContext.cs | 12 ++---------- .../MyProjectNameDbContextModelCreatingExtensions.cs | 5 ++++- .../MyProjectNameModelBuilderConfigurationOptions.cs | 4 ++-- .../MongoDB/IMyProjectNameMongoDbContext.cs | 2 +- .../MongoDB/MyProjectNameMongoDbContext.cs | 9 ++------- .../MongoDB/MyProjectNameMongoDbContextExtensions.cs | 4 +++- ...ojectNameMongoModelBuilderConfigurationOptions.cs | 4 ++-- 10 files changed, 28 insertions(+), 34 deletions(-) delete mode 100644 templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain/MyProjectNameConsts.cs create mode 100644 templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain/MyProjectNameDbProperties.cs diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain/MyProjectNameConsts.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain/MyProjectNameConsts.cs deleted file mode 100644 index 3d3d8236e7..0000000000 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain/MyProjectNameConsts.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace MyCompanyName.MyProjectName -{ - public static class MyProjectNameConsts - { - public const string DefaultDbTablePrefix = "MyProjectName"; - - public const string DefaultDbSchema = null; - } -} diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain/MyProjectNameDbProperties.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain/MyProjectNameDbProperties.cs new file mode 100644 index 0000000000..835045f486 --- /dev/null +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain/MyProjectNameDbProperties.cs @@ -0,0 +1,11 @@ +namespace MyCompanyName.MyProjectName +{ + public static class MyProjectNameDbProperties + { + public static string DbTablePrefix { get; } = "MyProjectName"; + + public static string DbSchema { get; } = null; + + public const string ConnectionStringName = "MyProjectName"; + } +} diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/IMyProjectNameDbContext.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/IMyProjectNameDbContext.cs index cb565702f7..f4be3e0eac 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/IMyProjectNameDbContext.cs +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/IMyProjectNameDbContext.cs @@ -3,7 +3,7 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.EntityFrameworkCore { - [ConnectionStringName("MyProjectName")] + [ConnectionStringName(MyProjectNameDbProperties.ConnectionStringName)] public interface IMyProjectNameDbContext : IEfCoreDbContext { /* Add DbSet for each Aggregate Root here. Example: diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameDbContext.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameDbContext.cs index 0ea5fb3d3f..1d37924126 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameDbContext.cs +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameDbContext.cs @@ -4,13 +4,9 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.EntityFrameworkCore { - [ConnectionStringName("MyProjectName")] + [ConnectionStringName(MyProjectNameDbProperties.ConnectionStringName)] public class MyProjectNameDbContext : AbpDbContext, IMyProjectNameDbContext { - public static string TablePrefix { get; set; } = MyProjectNameConsts.DefaultDbTablePrefix; - - public static string Schema { get; set; } = MyProjectNameConsts.DefaultDbSchema; - /* Add DbSet for each Aggregate Root here. Example: * public DbSet Questions { get; set; } */ @@ -25,11 +21,7 @@ namespace MyCompanyName.MyProjectName.EntityFrameworkCore { base.OnModelCreating(builder); - builder.ConfigureMyProjectName(options => - { - options.TablePrefix = TablePrefix; - options.Schema = Schema; - }); + builder.ConfigureMyProjectName(); } } } \ No newline at end of file diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameDbContextModelCreatingExtensions.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameDbContextModelCreatingExtensions.cs index c337573d14..c0f2a85865 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameDbContextModelCreatingExtensions.cs +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameDbContextModelCreatingExtensions.cs @@ -12,7 +12,10 @@ namespace MyCompanyName.MyProjectName.EntityFrameworkCore { Check.NotNull(builder, nameof(builder)); - var options = new MyProjectNameModelBuilderConfigurationOptions(); + var options = new MyProjectNameModelBuilderConfigurationOptions( + MyProjectNameDbProperties.DbTablePrefix, + MyProjectNameDbProperties.DbSchema + ); optionsAction?.Invoke(options); diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameModelBuilderConfigurationOptions.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameModelBuilderConfigurationOptions.cs index 8f7af7fa89..445cde72b5 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameModelBuilderConfigurationOptions.cs +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/EntityFrameworkCore/MyProjectNameModelBuilderConfigurationOptions.cs @@ -6,8 +6,8 @@ namespace MyCompanyName.MyProjectName.EntityFrameworkCore public class MyProjectNameModelBuilderConfigurationOptions : ModelBuilderConfigurationOptions { public MyProjectNameModelBuilderConfigurationOptions( - [NotNull] string tablePrefix = MyProjectNameConsts.DefaultDbTablePrefix, - [CanBeNull] string schema = MyProjectNameConsts.DefaultDbSchema) + [NotNull] string tablePrefix = "", + [CanBeNull] string schema = null) : base( tablePrefix, schema) diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MongoDB/IMyProjectNameMongoDbContext.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MongoDB/IMyProjectNameMongoDbContext.cs index d7def8491a..cb1a269091 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MongoDB/IMyProjectNameMongoDbContext.cs +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MongoDB/IMyProjectNameMongoDbContext.cs @@ -3,7 +3,7 @@ using Volo.Abp.MongoDB; namespace MyCompanyName.MyProjectName.MongoDB { - [ConnectionStringName("MyProjectName")] + [ConnectionStringName(MyProjectNameDbProperties.ConnectionStringName)] public interface IMyProjectNameMongoDbContext : IAbpMongoDbContext { /* Define mongo collections here. Example: diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MongoDB/MyProjectNameMongoDbContext.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MongoDB/MyProjectNameMongoDbContext.cs index 5aee1f430e..82b1f54ea2 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MongoDB/MyProjectNameMongoDbContext.cs +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MongoDB/MyProjectNameMongoDbContext.cs @@ -3,11 +3,9 @@ using Volo.Abp.MongoDB; namespace MyCompanyName.MyProjectName.MongoDB { - [ConnectionStringName("MyProjectName")] + [ConnectionStringName(MyProjectNameDbProperties.ConnectionStringName)] public class MyProjectNameMongoDbContext : AbpMongoDbContext, IMyProjectNameMongoDbContext { - public static string CollectionPrefix { get; set; } = MyProjectNameConsts.DefaultDbTablePrefix; - /* Add mongo collections here. Example: * public IMongoCollection Questions => Collection(); */ @@ -16,10 +14,7 @@ namespace MyCompanyName.MyProjectName.MongoDB { base.CreateModel(modelBuilder); - modelBuilder.ConfigureMyProjectName(options => - { - options.CollectionPrefix = CollectionPrefix; - }); + modelBuilder.ConfigureMyProjectName(); } } } \ No newline at end of file diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MongoDB/MyProjectNameMongoDbContextExtensions.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MongoDB/MyProjectNameMongoDbContextExtensions.cs index 34bfa02555..b71c77e231 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MongoDB/MyProjectNameMongoDbContextExtensions.cs +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MongoDB/MyProjectNameMongoDbContextExtensions.cs @@ -12,7 +12,9 @@ namespace MyCompanyName.MyProjectName.MongoDB { Check.NotNull(builder, nameof(builder)); - var options = new MyProjectNameMongoModelBuilderConfigurationOptions(); + var options = new MyProjectNameMongoModelBuilderConfigurationOptions( + MyProjectNameDbProperties.DbTablePrefix + ); optionsAction?.Invoke(options); } diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MongoDB/MyProjectNameMongoModelBuilderConfigurationOptions.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MongoDB/MyProjectNameMongoModelBuilderConfigurationOptions.cs index f06fec9e24..c0038f1f12 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MongoDB/MyProjectNameMongoModelBuilderConfigurationOptions.cs +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MongoDB/MyProjectNameMongoModelBuilderConfigurationOptions.cs @@ -6,8 +6,8 @@ namespace MyCompanyName.MyProjectName.MongoDB public class MyProjectNameMongoModelBuilderConfigurationOptions : MongoModelBuilderConfigurationOptions { public MyProjectNameMongoModelBuilderConfigurationOptions( - [NotNull] string tablePrefix = MyProjectNameConsts.DefaultDbTablePrefix) - : base(tablePrefix) + [NotNull] string collectionPrefix = "") + : base(collectionPrefix) { } } From 10313cf02c04b9b813fcd2d25913e80198b54733 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 11 Oct 2019 17:45:40 +0300 Subject: [PATCH 54/62] Add setters for DbTablePrefix and DbSchema --- .../src/Volo.Abp.Data/Volo/Abp/Data/AbpCommonDbProperties.cs | 4 ++-- .../Volo/Abp/AuditLogging/AbpAuditLoggingDbProperties.cs | 4 ++-- .../Volo/Abp/BackgroundJobs/BackgroundJobsDbProperties.cs | 4 ++-- .../Volo/Blogging/BloggingDbProperties.cs | 4 ++-- .../docs/src/Volo.Docs.Domain/Volo/Docs/DocsDbProperties.cs | 4 ++-- .../Abp/FeatureManagement/FeatureManagementDbProperties.cs | 4 ++-- .../Volo/Abp/Identity/AbpIdentityDbProperties.cs | 4 ++-- .../Volo/Abp/IdentityServer/AbpIdentityServerDbProperties.cs | 4 ++-- .../AbpPermissionManagementDbProperties.cs | 4 ++-- .../Abp/SettingManagement/AbpSettingManagementDbProperties.cs | 4 ++-- .../Abp/TenantManagement/AbpTenantManagementDbProperties.cs | 4 ++-- .../MyProjectNameDbProperties.cs | 4 ++-- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpCommonDbProperties.cs b/framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpCommonDbProperties.cs index 726b8bd5f8..cd4f013ea5 100644 --- a/framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpCommonDbProperties.cs +++ b/framework/src/Volo.Abp.Data/Volo/Abp/Data/AbpCommonDbProperties.cs @@ -8,11 +8,11 @@ /// /// Default value: "Abp". /// - public static string DbTablePrefix { get; } = "Abp"; + public static string DbTablePrefix { get; set; } = "Abp"; /// /// Default value: null. /// - public static string DbSchema { get; } = null; + public static string DbSchema { get; set; } = null; } } diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AbpAuditLoggingDbProperties.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AbpAuditLoggingDbProperties.cs index d1d1775721..d58a9b3566 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AbpAuditLoggingDbProperties.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AbpAuditLoggingDbProperties.cs @@ -4,9 +4,9 @@ namespace Volo.Abp.AuditLogging { public static class AbpAuditLoggingDbProperties { - public static string DbTablePrefix { get; } = AbpCommonDbProperties.DbTablePrefix; + public static string DbTablePrefix { get; set; } = AbpCommonDbProperties.DbTablePrefix; - public static string DbSchema { get; } = AbpCommonDbProperties.DbSchema; + public static string DbSchema { get; set; } = AbpCommonDbProperties.DbSchema; public const string ConnectionStringName = "AbpAuditLogging"; } diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobsDbProperties.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobsDbProperties.cs index 48bd5701a1..6ef52d5037 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobsDbProperties.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobsDbProperties.cs @@ -4,9 +4,9 @@ namespace Volo.Abp.BackgroundJobs { public static class BackgroundJobsDbProperties { - public static string DbTablePrefix { get; } = AbpCommonDbProperties.DbTablePrefix; + public static string DbTablePrefix { get; set; } = AbpCommonDbProperties.DbTablePrefix; - public static string DbSchema { get; } = AbpCommonDbProperties.DbSchema; + public static string DbSchema { get; set; } = AbpCommonDbProperties.DbSchema; public const string ConnectionStringName = "AbpBackgroundJobs"; } diff --git a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingDbProperties.cs b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingDbProperties.cs index abd32c10ed..6f57d5f404 100644 --- a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingDbProperties.cs +++ b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/BloggingDbProperties.cs @@ -5,12 +5,12 @@ /// /// Default value: "Blg". /// - public static string DbTablePrefix { get; } = "Blg"; + public static string DbTablePrefix { get; set; } = "Blg"; /// /// Default value: "null". /// - public static string DbSchema { get; } = null; + public static string DbSchema { get; set; } = null; /// /// "Blogging". diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDbProperties.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDbProperties.cs index d212f7e24d..7f534d4305 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDbProperties.cs +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDbProperties.cs @@ -2,9 +2,9 @@ { public static class DocsDbProperties { - public static string DbTablePrefix { get; } = "Docs"; + public static string DbTablePrefix { get; set; } = "Docs"; - public static string DbSchema { get; } = null; + public static string DbSchema { get; set; } = null; public const string ConnectionStringName = "Docs"; } diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementDbProperties.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementDbProperties.cs index fb54ac2e01..9cd04b9a75 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementDbProperties.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementDbProperties.cs @@ -4,9 +4,9 @@ namespace Volo.Abp.FeatureManagement { public static class FeatureManagementDbProperties { - public static string DbTablePrefix { get; } = AbpCommonDbProperties.DbTablePrefix; + public static string DbTablePrefix { get; set; } = AbpCommonDbProperties.DbTablePrefix; - public static string DbSchema { get; } = AbpCommonDbProperties.DbSchema; + public static string DbSchema { get; set; } = AbpCommonDbProperties.DbSchema; public const string ConnectionStringName = "AbpFeatureManagement"; } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDbProperties.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDbProperties.cs index 9123449357..cd40984cc0 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDbProperties.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityDbProperties.cs @@ -4,9 +4,9 @@ namespace Volo.Abp.Identity { public static class AbpIdentityDbProperties { - public static string DbTablePrefix { get; } = AbpCommonDbProperties.DbTablePrefix; + public static string DbTablePrefix { get; set; } = AbpCommonDbProperties.DbTablePrefix; - public static string DbSchema { get; } = AbpCommonDbProperties.DbSchema; + public static string DbSchema { get; set; } = AbpCommonDbProperties.DbSchema; public const string ConnectionStringName = "AbpIdentity"; } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDbProperties.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDbProperties.cs index 751c33ccd5..3e6fe6a986 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDbProperties.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDbProperties.cs @@ -2,9 +2,9 @@ { public static class AbpIdentityServerDbProperties { - public static string DbTablePrefix { get; } = "IdentityServer"; + public static string DbTablePrefix { get; set; } = "IdentityServer"; - public static string DbSchema { get; } = null; + public static string DbSchema { get; set; } = null; public const string ConnectionStringName = "AbpIdentityServer"; } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/AbpPermissionManagementDbProperties.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/AbpPermissionManagementDbProperties.cs index 6b318dbc25..494a3ca750 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/AbpPermissionManagementDbProperties.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/AbpPermissionManagementDbProperties.cs @@ -4,9 +4,9 @@ namespace Volo.Abp.PermissionManagement { public static class AbpPermissionManagementDbProperties { - public static string DbTablePrefix { get; } = AbpCommonDbProperties.DbTablePrefix; + public static string DbTablePrefix { get; set; } = AbpCommonDbProperties.DbTablePrefix; - public static string DbSchema { get; } = AbpCommonDbProperties.DbSchema; + public static string DbSchema { get; set; } = AbpCommonDbProperties.DbSchema; public const string ConnectionStringName = "AbpPermissionManagement"; } diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/AbpSettingManagementDbProperties.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/AbpSettingManagementDbProperties.cs index 6ffa8c192b..f9b2570186 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/AbpSettingManagementDbProperties.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/AbpSettingManagementDbProperties.cs @@ -4,9 +4,9 @@ namespace Volo.Abp.SettingManagement { public static class AbpSettingManagementDbProperties { - public static string DbTablePrefix { get; } = AbpCommonDbProperties.DbTablePrefix; + public static string DbTablePrefix { get; set; } = AbpCommonDbProperties.DbTablePrefix; - public static string DbSchema { get; } = AbpCommonDbProperties.DbSchema; + public static string DbSchema { get; set; } = AbpCommonDbProperties.DbSchema; public const string ConnectionStringName = "AbpSettingManagement"; } diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementDbProperties.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementDbProperties.cs index 53f2d9b025..878247a18f 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementDbProperties.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementDbProperties.cs @@ -4,9 +4,9 @@ namespace Volo.Abp.TenantManagement { public static class AbpTenantManagementDbProperties { - public static string DbTablePrefix { get; } = AbpCommonDbProperties.DbTablePrefix; + public static string DbTablePrefix { get; set; } = AbpCommonDbProperties.DbTablePrefix; - public static string DbSchema { get; } = AbpCommonDbProperties.DbSchema; + public static string DbSchema { get; set; } = AbpCommonDbProperties.DbSchema; public const string ConnectionStringName = "AbpTenantManagement"; } diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain/MyProjectNameDbProperties.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain/MyProjectNameDbProperties.cs index 835045f486..f8c73d0653 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain/MyProjectNameDbProperties.cs +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain/MyProjectNameDbProperties.cs @@ -2,9 +2,9 @@ { public static class MyProjectNameDbProperties { - public static string DbTablePrefix { get; } = "MyProjectName"; + public static string DbTablePrefix { get; set; } = "MyProjectName"; - public static string DbSchema { get; } = null; + public static string DbSchema { get; set; } = null; public const string ConnectionStringName = "MyProjectName"; } From a4700aecc70e47aaeb15faf8a438347938d13b42 Mon Sep 17 00:00:00 2001 From: thediaval Date: Fri, 11 Oct 2019 18:06:21 +0300 Subject: [PATCH 55/62] refactor(core): refactor sort-pipe --- .../packages/core/src/lib/pipes/sort.pipe.ts | 27 +++++++++++-------- .../core/src/lib/tests/sort.pipe.spec.ts | 4 +-- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/npm/ng-packs/packages/core/src/lib/pipes/sort.pipe.ts b/npm/ng-packs/packages/core/src/lib/pipes/sort.pipe.ts index 9e7b5a0d10..ea23da1efc 100644 --- a/npm/ng-packs/packages/core/src/lib/pipes/sort.pipe.ts +++ b/npm/ng-packs/packages/core/src/lib/pipes/sort.pipe.ts @@ -7,21 +7,26 @@ export type SortOrder = 'asc' | 'desc'; export class SortPipe implements PipeTransform { transform(value: any[], sortOrder: SortOrder | string = 'asc', sortKey?: string): any { sortOrder = sortOrder && (sortOrder.toLowerCase() as any); + if (!value || (sortOrder !== 'asc' && sortOrder !== 'desc')) return value; - let sorted; + + let numberArray = []; + let stringArray = []; + if (!sortKey) { - const numberArray = []; - const stringArray = []; - value.forEach(item => (typeof item === 'number' ? numberArray.push(item) : stringArray.push(item))); - sorted = numberArray.sort().concat(stringArray.sort()); + numberArray = value.filter(item => typeof item === 'number').sort(); + stringArray = value.filter(item => typeof item === 'string').sort(); } else { - sorted = value.sort((a, b) => { - return ( - Number(typeof b[sortKey] === 'number') - Number(typeof a[sortKey] === 'number') || - (a[sortKey] < b[sortKey] ? -1 : 1) - ); - }); + numberArray = value.filter(item => typeof item[sortKey] === 'number').sort((a, b) => a[sortKey] - b[sortKey]); + stringArray = value + .filter(item => typeof item[sortKey] === 'string') + .sort((a, b) => { + if (a[sortKey] < b[sortKey]) return -1; + else if (a[sortKey] > b[sortKey]) return 1; + else return 0; + }); } + const sorted = numberArray.concat(stringArray); return sortOrder === 'asc' ? sorted : sorted.reverse(); } } diff --git a/npm/ng-packs/packages/core/src/lib/tests/sort.pipe.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/sort.pipe.spec.ts index 6b88961728..8428515118 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/sort.pipe.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/sort.pipe.spec.ts @@ -1,4 +1,4 @@ -import { createServiceFactory, SpectatorService } from '@ngneat/spectator'; +import { createServiceFactory, SpectatorService } from '@ngneat/spectator/jest'; import { SortPipe } from '../pipes/sort.pipe'; describe('SortPipe', () => { @@ -24,7 +24,7 @@ describe('SortPipe', () => { }); test('should require an array as value', () => { - expect(pipe.transform(null, 'asc')).toBeFalsy(); + expect(pipe.transform(null)).toBeFalsy(); expect(pipe.transform(undefined, 'desc')).toBeFalsy(); }); }); From c1f56f03a2ae11b09b3c79a69984a22947941a90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 11 Oct 2019 22:26:24 +0300 Subject: [PATCH 56/62] Added ToKebabCase string extension method --- .../System/AbpStringExtensions.cs | 19 +++++++++++++++++++ .../System/StringExtensions_Tests.cs | 12 ++++++++++++ 2 files changed, 31 insertions(+) diff --git a/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs b/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs index 31e7f257d4..f8086c8ecd 100644 --- a/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs +++ b/framework/src/Volo.Abp.Core/System/AbpStringExtensions.cs @@ -293,6 +293,25 @@ namespace System : Regex.Replace(str, "[a-z][A-Z]", m => m.Value[0] + " " + char.ToLowerInvariant(m.Value[1])); } + /// + /// Converts given PascalCase/camelCase string to kebab-case. + /// + /// String to convert. + /// set true to use current culture. Otherwise, invariant culture will be used. + public static string ToKebabCase(this string str, bool useCurrentCulture = false) + { + if (string.IsNullOrWhiteSpace(str)) + { + return str; + } + + str = str.ToCamelCase(); + + return useCurrentCulture + ? Regex.Replace(str, "[a-z][A-Z]", m => m.Value[0] + "-" + char.ToLower(m.Value[1])) + : Regex.Replace(str, "[a-z][A-Z]", m => m.Value[0] + "-" + char.ToLowerInvariant(m.Value[1])); + } + /// /// Converts string to enum value. /// diff --git a/framework/test/Volo.Abp.Core.Tests/System/StringExtensions_Tests.cs b/framework/test/Volo.Abp.Core.Tests/System/StringExtensions_Tests.cs index 8a818a75cb..0720a492aa 100644 --- a/framework/test/Volo.Abp.Core.Tests/System/StringExtensions_Tests.cs +++ b/framework/test/Volo.Abp.Core.Tests/System/StringExtensions_Tests.cs @@ -73,12 +73,24 @@ namespace System "Istanbul".ToCamelCase().ShouldBe("istanbul"); } + [Fact] + public void ToKebabCase_Test() + { + (null as string).ToKebabCase().ShouldBe(null); + "helloMoon".ToKebabCase().ShouldBe("hello-moon"); + "HelloWorld".ToKebabCase().ShouldBe("hello-world"); + "HelloIsparta".ToKebabCase().ShouldBe("hello-isparta"); + "ThisIsSampleText".ToKebabCase().ShouldBe("this-is-sample-text"); + } + [Fact] public void ToSentenceCase_Test() { (null as string).ToSentenceCase().ShouldBe(null); "HelloWorld".ToSentenceCase().ShouldBe("Hello world"); "HelloIsparta".ToSentenceCase().ShouldBe("Hello isparta"); + "ThisIsSampleSentence".ToSentenceCase().ShouldBe("This is sample sentence"); + "thisIsSampleSentence".ToSentenceCase().ShouldBe("this is sample sentence"); } [Fact] From 1a19895a55fc53a4b5802ff8cb12fd1da5b4f3c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Fri, 11 Oct 2019 22:31:41 +0300 Subject: [PATCH 57/62] Handle camelCase and kebab-case renaming for the startup templates. --- .../Building/Steps/RenameHelper.cs | 3 ++- .../Building/Steps/SolutionRenameStep.cs | 17 +++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RenameHelper.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RenameHelper.cs index 6f6fc6d983..d8cdc59949 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RenameHelper.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RenameHelper.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using Volo.Abp.Cli.ProjectBuilding.Files; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs index cb6f29de7e..bf5ad938af 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/SolutionRenameStep.cs @@ -49,16 +49,21 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps public void Run() { - if (_companyNamePlaceHolder != null && _companyName != null) + if (_companyNamePlaceHolder != null) { - RenameHelper.RenameAll(_entries, _companyNamePlaceHolder, _companyName); - } - else if (_companyNamePlaceHolder != null) - { - RenameHelper.RenameAll(_entries, _companyNamePlaceHolder + "." + _projectNamePlaceHolder, _projectNamePlaceHolder); + if (_companyName != null) + { + RenameHelper.RenameAll(_entries, _companyNamePlaceHolder, _companyName); + } + else + { + RenameHelper.RenameAll(_entries, _companyNamePlaceHolder + "." + _projectNamePlaceHolder, _projectNamePlaceHolder); + } } RenameHelper.RenameAll(_entries, _projectNamePlaceHolder, _projectName); + RenameHelper.RenameAll(_entries, _projectNamePlaceHolder.ToCamelCase(), _projectName.ToCamelCase()); + RenameHelper.RenameAll(_entries, _projectNamePlaceHolder.ToKebabCase(), _projectName.ToKebabCase()); } } } From d71e7b8b541f50f12f249047ab6bea05187e4559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sun, 13 Oct 2019 11:13:48 +0300 Subject: [PATCH 58/62] Added Caching documentation. --- docs/en/Caching.md | 82 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/docs/en/Caching.md b/docs/en/Caching.md index f7d9c52407..c413a4599c 100644 --- a/docs/en/Caching.md +++ b/docs/en/Caching.md @@ -1,3 +1,85 @@ # Caching +ABP framework extends ASP.NET Core's distributed caching system. + +## IDistributedCache Interface + +ASP.NET Core defines the `IDistributedCache` interface to get/set cache values. But it has some difficulties: + +* It works with **byte arrays** rather than .NET objects. So, you need to **serialize/deserialize** the objects you need to cache. +* It provides a **single key pool** for all cache items, so; + * You need to care about the keys to distinguish **different type of objects**. + * You need to care about the cache items of **different tenants** (see [multi-tenancy](Multi-Tenancy.md)). + +> `IDistributedCache` is defined in the `Microsoft.Extensions.Caching.Abstractions` package. That means it is not only usable for ASP.NET Core applications, but also available to **any type of applications**. + +> Default implementation of the `IDistributedCache` interface is the `MemoryDistributedCache` which works **in-memory**. See [ASP.NET Core's documentation](https://docs.microsoft.com/en-us/aspnet/core/performance/caching/distributed) to see how to switch to **Redis** or another cache provider. + +See [ASP.NET Core's distributed caching document](https://docs.microsoft.com/en-us/aspnet/core/performance/caching/distributed) for more information. + +## IDistributedCache Interface + +ABP framework defines the generic `IDistributedCache` interface in the [Volo.Abp.Caching](https://www.nuget.org/packages/Volo.Abp.Caching/) package. `TCacheItem` is the type of the object stored in the cache. + +`IDistributedCache` solves the difficulties explained above; + +* It internally **serializes/deserializes** the cached objects. Uses **JSON** serialization by default, but can be overridden by replacing the `IDistributedCacheSerializer` service in the [dependency injection](Dependency-Injection.md) system. +* It automatically adds a **cache name** prefix to the cache keys based on the object type stored in the cache. Default cache name is the full name of the cache item class (`CacheItem` postfix is removed if your cache item class ends with it). You can use the `CacheName` attribute on the cache item class to set the cache name. +* It automatically adds the **current tenant id** to the cache key to distinguish cache items for different tenants (only works if your application is [multi-tenant](Multi-Tenancy.md)). Define `IgnoreMultiTenancy` attribute on the cache item class to disable this if you want to share the cached objects among all tenants in a multi-tenant application. +* Allows to define a **global cache key prefix** per application, so different applications can use their isolated key pools in a shared distributed cache source. + +### Usage + +An example class to store an item in the cache: + +````csharp +public class BookCacheItem +{ + public string Name { get; set; } + + public float Price { get; set; } +} +```` + +You can inject and use the `IDistributedCache` service to get/set `BookCacheItem` objects. + +Example usage: + +````csharp +public class BookService : ITransientDependency +{ + private readonly IDistributedCache _cache; + + public BookService(IDistributedCache cache) + { + _cache = cache; + } + + public async Task GetAsync(Guid bookId) + { + return await _cache.GetOrAddAsync( + bookId.ToString(), //Cache key + async () => await GetBookFromDatabaseAsync(bookId), + () => new DistributedCacheEntryOptions + { + AbsoluteExpiration = DateTimeOffset.Now.AddHours(1) + } + ); + } + + private Task GetBookFromDatabaseAsync(Guid bookId) + { + //TODO: get from database + } +} +```` + +* This sample service uses the `GetOrAddAsync()` method to get a book item from the cache. +* If the book was not found in the cache, it calls the factory method (`GetBookFromDatabaseAsync` in this case) to retrieve the book item from the original source. +* `GetOrAddAsync` optionally gets a `DistributedCacheEntryOptions` which can be used to set the lifetime of the cached item. + +Other methods of the `IDistributedCache` are same as ASP.NET Core's `IDistributedCache` interface, so you can refer [it's documentation](https://docs.microsoft.com/en-us/aspnet/core/performance/caching/distributed). + +### DistributedCacheOptions + TODO \ No newline at end of file From 68381d9893eaf3bc532f0d0f17d2b00c002a452e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sun, 13 Oct 2019 14:47:43 +0300 Subject: [PATCH 59/62] Add initial Object to object mapping document --- docs/en/Object-To-Object-Mapping.md | 257 +++++++++++++++++++++++++++- 1 file changed, 255 insertions(+), 2 deletions(-) diff --git a/docs/en/Object-To-Object-Mapping.md b/docs/en/Object-To-Object-Mapping.md index 9bb22e0c66..7d08637d79 100644 --- a/docs/en/Object-To-Object-Mapping.md +++ b/docs/en/Object-To-Object-Mapping.md @@ -1,3 +1,256 @@ -## Object To Object Mapping +# Object To Object Mapping + +It's common to map an object to another similar object. It's also tedious and repetitive since generally both classes have the same or similar properties mapped to each other. Imagine a typical [application service](Application-Services.md) method below: + +```csharp +public class UserAppService : ApplicationService +{ + private readonly IRepository _userRepository; + + public UserAppService(IRepository userRepository) + { + _userRepository = userRepository; + } + + public void CreateUser(CreateUserInput input) + { + //Manually creating a User object from the CreateUserInput object + var user = new User + { + Name = input.Name, + Surname = input.Surname, + EmailAddress = input.EmailAddress, + Password = input.Password + }; + + _userRepository.Insert(user); + } +} +``` + +`CreateUserInput ` is a simple [DTO](Data-Transfer-Objects.md) class and the `User` is a simple [entity](Entities.md). The code above creates a `User` entity from the given input object. The `User` entity will have more properties in a real-world application and manually creating it will become tedious and error-prone. You also have to change the mapping code when you add new properties to `User` and `CreateUserInput` classes. + +We can use a library to automatically handle these kind of mappings. ABP provides abstractions for object to object mapping and has an integration package to use [AutoMapper](http://automapper.org/) as the object mapper. + +## IObjectMapper + +`IObjectMapper` interface (in the [Volo.Abp.ObjectMapping](https://www.nuget.org/packages/Volo.Abp.ObjectMapping) package) defines a simple `Map` method. The example code introduced before can be re-written as shown below: + +````csharp +public class UserAppService : ApplicationService +{ + private readonly IRepository _userRepository; + + public UserAppService(IRepository userRepository) + { + _userRepository = userRepository; + } + + public void CreateUser(CreateUserInput input) + { + //Automatically creating a new User object using the CreateUserInput object + var user = ObjectMapper.Map(input); + + _userRepository.Insert(user); + } +} +```` + +> `ObjectMapper` is defined in the `ApplicationService` base class in this example. You can directly inject the `IObjectMapper` interface when you need it somewhere else. + +Map method has two generic argument: First one is the source object type while the second one is the destination object type. + +If you need to set properties of an existing object, you can use the second overload of the `Map` method: + +````csharp +public class UserAppService : ApplicationService +{ + private readonly IRepository _userRepository; + + public UserAppService(IRepository userRepository) + { + _userRepository = userRepository; + } + + public async Task UpdateUserAsync(Guid id, UpdateUserInput input) + { + var user = await _userRepository.GetAsync(id); + + //Automatically set properties of the user object using the UpdateUserInput + ObjectMapper.Map(input, user); + + await _userRepository.UpdateAsync(user); + } +} +```` + +You should have defined the mappings before to be able to map objects. See the AutoMapper integration section to learn how to define mappings. + +## AutoMapper Integration + +[AutoMapper](http://automapper.org/) is one of the most popular object to object mapping libraries. [Volo.Abp.AutoMapper](https://www.nuget.org/packages/Volo.Abp.AutoMapper) package defines the AutoMapper integration for the `IObjectMapper`. + +Once you define mappings described as below, you can use the `IObjectMapper` interface just like explained before. + +### Define Mappings + +AutoMapper provides multiple ways of defining mapping between classes. Refer to [its own documentation](https://docs.automapper.org) for all details. + +One way to define object mappings is creating a [Profile](https://docs.automapper.org/en/stable/Configuration.html#profile-instances) class. Example: + +````csharp +public class MyProfile : Profile +{ + public MyProfile() + { + CreateMap(); + } +} +```` + +You should then register profiles using the `AbpAutoMapperOptions`: + +````csharp +[DependsOn(typeof(AbpAutoMapperModule))] +public class MyModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => + { + //Add all mappings defined in the assembly of the MyModule class + options.AddMaps(); + }); + } +} +```` + +`AddMaps` registers all profile classes defined in the assembly of the given class, typically your module class. It also registers for the [attribute mapping](https://docs.automapper.org/en/stable/Attribute-mapping.html). + +### Configuration Validation + +`AddMaps` optionally takes a `bool` parameter to control the [configuration validation](https://docs.automapper.org/en/stable/Configuration-validation.html) for your [module](Module-Development-Basics.md): + +````csharp +options.AddMaps(validate: true); +```` + +While this option is `false` by default, it is suggested to enable configuration validation as a best practice. + +Configuration validation can be controlled per profile class using `AddProfile` instead of `AddMaps`: + +````csharp +options.AddProfile(validate: true); +```` + +> If you have multiple profiles and need to enable validation only for a few of them, first use `AddMaps` without validation, then use `AddProfile` for each profile you want to validate. + +## Advanced Topics + +### IObjectMapper Interface + +Assume that you have created a **reusable module** which defines AutoMapper profiles and uses `IObjectMapper` when it needs to map objects. Your module then can be used in different applications, by nature of the [modularity](Module-Development-Basics.md). + +`IObjectMapper` is an abstraction and can be replaced by the final application to use another mapping library. The problem here that your reusable module is designed to use the AutoMapper library, because it only defines mappings for it. In such a case, you will want to guarantee that your module always uses AutoMapper even if the final application uses another default object mapping library. + +`IObjectMapper` is used to contextualize the object mapper, so you can use different libraries for different modules/contexts. + +Example usage: + +````csharp +public class UserAppService : ApplicationService +{ + private readonly IRepository _userRepository; + + private readonly IObjectMapper _objectMapper; + + public UserAppService( + IRepository userRepository, + IObjectMapper objectMapper) //Inject module specific mapper + { + _userRepository = userRepository; + _objectMapper = objectMapper; + } + + public async Task CreateUserAsync(CreateUserInput input) + { + //Use the module specific mapper + var user = _objectMapper.Map(input); + + await _userRepository.InsertAsync(user); + } +} +```` + +`UserAppService ` injects the `IObjectMapper`, the specific object mapper for this module. It's usage is exactly same of the `IObjectMapper`. + +The example code above don't use the `ObjectMapper` property defined in the `ApplicationService`, but injects the `IObjectMapper`. However, it is still possible to use the base property since the `ApplicationService` defines an `ObjectMapperContext` property that can be set in the class constructor. So, the example about can be re-written as like below: + +````csharp +public class UserAppService : ApplicationService +{ + private readonly IRepository _userRepository; + + public UserAppService(IRepository userRepository) + { + _userRepository = userRepository; + //Set the object mapper context + ObjectMapperContext = typeof(MyModule); + } + + public async Task CreateUserAsync(CreateUserInput input) + { + var user = ObjectMapper.Map(input); + + await _userRepository.InsertAsync(user); + } +} +```` + +While using the contextualized object mapper is same as the normal object mapper, you should register the contextualized mapper in your module's `ConfigureServices` method: + +````csharp +[DependsOn(typeof(AbpAutoMapperModule))] +public class MyModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + //Use AutoMapper for MyModule + context.Services.AddAutoMapperObjectMapper(); + + Configure(options => + { + options.AddMaps(validate: true); + }); + } +} +```` + +`IObjectMapper` is an essential feature for a reusable module where it can be used in multiple applications each may use a different library for object to object mapping. All pre-built ABP modules are using it. But, for the final application, you can ignore this interface and always use the default `IObjectMapper` interface. + +### IObjectMapper Interface + +ABP allows you to customize the mapping code for specific classes. Assume that you want to create a custom class to map from `User` to `UserDto`. In this case, you can create a class that implements the `IObjectMapper`: + +````csharp +public class MyCustomUserMapper : IObjectMapper, ITransientDependency +{ + public UserDto Map(User source) + { + //TODO: Create a new UserDto + } + + public UserDto Map(User source, UserDto destination) + { + //TODO: Set properties of an existing UserDto + return destination; + } +} +```` + +ABP automatically discovers and registers the `MyCustomUserMapper` and it is automatically used whenever you use the `IObjectMapper` to map `User` to `UserDto`. + +A single class may implement more than one `IObjectMapper` each for a different object pairs. + +> This approach is powerful since `MyCustomUserMapper` can inject any other service and use in the `Map` methods. -TODO \ No newline at end of file From c98b0b622f5918bdf3fd404a1e35d2751661c784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sun, 13 Oct 2019 14:49:28 +0300 Subject: [PATCH 60/62] Update docs-nav.json --- docs/en/docs-nav.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json index cc53aa802f..2dbbb4a38e 100644 --- a/docs/en/docs-nav.json +++ b/docs/en/docs-nav.json @@ -115,6 +115,10 @@ { "text": "Services", "items": [ + { + "text": "Object to object mapping", + "path": "Object-To-Object-Mapping.md" + }, { "text": "Object Serialization" }, From 193ab3ffff48666c9b19ab4c6688e93b10d8b7b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Sun, 13 Oct 2019 14:53:09 +0300 Subject: [PATCH 61/62] Update docs-nav.json --- docs/en/docs-nav.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json index 2dbbb4a38e..eb8b3865c1 100644 --- a/docs/en/docs-nav.json +++ b/docs/en/docs-nav.json @@ -86,7 +86,8 @@ "path": "Authorization.md" }, { - "text": "Caching" + "text": "Caching", + "path": "Caching.md" }, { "text": "Auditing" From 887f9468d17d676334dcc344d58bc071a06d403d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=AE=8F=E7=8E=BA?= Date: Mon, 14 Oct 2019 10:27:59 +0800 Subject: [PATCH 62/62] Update Getting-Started-AspNetCore-MVC-Template.md --- docs/zh-Hans/Getting-Started-AspNetCore-MVC-Template.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh-Hans/Getting-Started-AspNetCore-MVC-Template.md b/docs/zh-Hans/Getting-Started-AspNetCore-MVC-Template.md index 36268beb8a..3d74fc6354 100644 --- a/docs/zh-Hans/Getting-Started-AspNetCore-MVC-Template.md +++ b/docs/zh-Hans/Getting-Started-AspNetCore-MVC-Template.md @@ -49,7 +49,7 @@ abp new Acme.BookStore } ```` -解决方案使用 **Entity Framework Core** 和 **MS SQL Server**. EF Core支持[各种](https://docs.microsoft.com/en-us/ef/core/providers/)数据库提供程序,因此你可以根据实际需要使用其他DBMS. 如果需要,请更改连接字符串. +解决方案使用 **Entity Framework Core** 和 **MS SQL Server**. EF Core支持[各种](https://docs.microsoft.com/zh-cn/ef/core/providers/)数据库提供程序,因此你可以根据实际需要使用其他DBMS. 如果需要,请更改连接字符串. ### 创建数据库并应用数据库迁移