Browse Source

Merge branch 'dev' into maliming/test

pull/6815/head
maliming 6 years ago
parent
commit
da0e76bc66
  1. 2
      docs/en/CLI.md
  2. 2
      docs/en/Contribution/Index.md
  3. 10
      docs/en/Entity-Framework-Core-Migrations.md
  4. 2
      docs/en/Modules/Docs.md
  5. 6
      docs/en/Samples/Microservice-Demo.md
  6. 2
      docs/zh-Hans/CLI.md
  7. 10
      docs/zh-Hans/Entity-Framework-Core-Migrations.md
  8. 2
      docs/zh-Hans/Modules/Docs.md
  9. 6
      docs/zh-Hans/Samples/Microservice-Demo.md
  10. 40
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/ui-extensions.js
  11. 34
      framework/src/Volo.Abp.AutoMapper/Volo/Abp/AutoMapper/AbpAutoMapperConventionalRegistrar.cs
  12. 26
      framework/src/Volo.Abp.AutoMapper/Volo/Abp/AutoMapper/AbpAutoMapperModule.cs
  13. 140
      framework/src/Volo.Abp.Autofac/Autofac/Extensions/DependencyInjection/AutofacRegistration.cs
  14. 122
      framework/src/Volo.Abp.Autofac/Autofac/Extensions/DependencyInjection/AutofacServiceProvider.cs
  15. 77
      framework/src/Volo.Abp.Autofac/Autofac/Extensions/DependencyInjection/AutofacServiceProviderFactory.cs
  16. 67
      framework/src/Volo.Abp.Autofac/Autofac/Extensions/DependencyInjection/AutofacServiceScope.cs
  17. 65
      framework/src/Volo.Abp.Autofac/Autofac/Extensions/DependencyInjection/AutofacServiceScopeFactory.cs
  18. 4
      framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj
  19. 25
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs
  20. 11
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs
  21. 6
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs
  22. 9
      framework/src/Volo.Abp.Cli/Properties/launchSettings.json
  23. 3
      framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/EntityExtensionConfiguration.cs
  24. 62
      framework/test/Volo.Abp.AutoMapper.Tests/Volo/Abp/AutoMapper/AutoMapper_Dependency_Injection_Tests.cs
  25. 2
      modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/appsettings.json
  26. 2
      modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/appsettings.json
  27. 2
      modules/blob-storing-database/host/BlobStoring.Database.Host.ConsoleApp/src/BlobStoring.Database.Host.ConsoleApp.ConsoleApp/ConsoleAppConsoleAppModule.cs
  28. 2
      modules/blob-storing-database/host/BlobStoring.Database.Host.ConsoleApp/src/BlobStoring.Database.Host.ConsoleApp.ConsoleApp/appsettings.json
  29. 2
      modules/blogging/app/Volo.BloggingTestApp/appsettings.json
  30. 14
      modules/cms-kit/docker-compose.override.yml
  31. 4
      modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/appsettings.json
  32. 2
      modules/cms-kit/host/Volo.CmsKit.IdentityServer/appsettings.json
  33. 2
      modules/cms-kit/host/Volo.CmsKit.Web.Unified/appsettings.json
  34. 2
      modules/docs/app/VoloDocs.Migrator/appsettings.json
  35. 2
      modules/docs/app/VoloDocs.Web/appsettings.json
  36. 2
      modules/docs/docker-compose.migrate.yml
  37. 2
      modules/docs/docker-compose.override.yml
  38. 26
      modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleDeletedEventHandler.cs
  39. 4
      modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IPermissionManager.cs
  40. 12
      modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManager.cs
  41. 2
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator/appsettings.json
  42. 2
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/appsettings.json
  43. 2
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/appsettings.json
  44. 2
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/appsettings.json
  45. 2
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/appsettings.json
  46. 14
      templates/module/aspnet-core/docker-compose.override.yml
  47. 4
      templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/appsettings.json
  48. 2
      templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/appsettings.json
  49. 2
      templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/appsettings.json
  50. 2
      test/AbpPerfTest/AbpPerfTest.WithAbp/appsettings.json
  51. 2
      test/AbpPerfTest/AbpPerfTest.WithoutAbp/appsettings.json

2
docs/en/CLI.md

@ -105,7 +105,7 @@ abp new Acme.BookStore
* `--preview`: Use latest preview version. * `--preview`: Use latest preview version.
* `--template-source` or `-ts`: Specifies a custom template source to use to build the project. Local and network sources can be used(Like `D:\local-template` or `https://.../my-template-file.zip`). * `--template-source` or `-ts`: Specifies a custom template source to use to build the project. Local and network sources can be used(Like `D:\local-template` or `https://.../my-template-file.zip`).
* `--create-solution-folder` or `-csf`: Specifies if the project will be in a new folder in the output folder or directly the output folder. * `--create-solution-folder` or `-csf`: Specifies if the project will be in a new folder in the output folder or directly the output folder.
* `--connection-string` or `-cs`: Overwrites the default connection strings in all `appsettings.json` files. The default connection string is `Server=localhost;Database=MyProjectName;Trusted_Connection=True;MultipleActiveResultSets=true` for EF Core and it is configured to use the SQL Server. If you want to use the EF Core, but need to change the DBMS, you can change it as [described here](Entity-Framework-Core-Other-DBMS.md) (after creating the solution). * `--connection-string` or `-cs`: Overwrites the default connection strings in all `appsettings.json` files. The default connection string is `Server=localhost;Database=MyProjectName;Trusted_Connection=True` for EF Core and it is configured to use the SQL Server. If you want to use the EF Core, but need to change the DBMS, you can change it as [described here](Entity-Framework-Core-Other-DBMS.md) (after creating the solution).
* `--database-management-system` or `-dbms`: Sets the database management system. Default is **SQL Server**. Supported DBMS's: * `--database-management-system` or `-dbms`: Sets the database management system. Default is **SQL Server**. Supported DBMS's:
* `SqlServer` * `SqlServer`
* `MySQL` * `MySQL`

2
docs/en/Contribution/Index.md

@ -10,7 +10,7 @@ If you want to write **articles** or **how to guides** related to the ABP Framew
You can always send pull requests to the GitHub repository. You can always send pull requests to the GitHub repository.
- Clone the [ABP repository](https://github.com/abpframework/abp/) from GitHub. - [Fork](https://docs.github.com/en/free-pro-team@latest/github/getting-started-with-github/fork-a-repo) the [ABP repository](https://github.com/abpframework/abp/) from GitHub.
- Build the repository using the `/build/build-all.ps1 -f` for one time. - Build the repository using the `/build/build-all.ps1 -f` for one time.
- Make the necessary changes, including unit/integration tests. - Make the necessary changes, including unit/integration tests.
- Send a pull request. - Send a pull request.

10
docs/en/Entity-Framework-Core-Migrations.md

@ -586,7 +586,7 @@ First step is to change the connection string section inside all the `appsetting
````json ````json
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=localhost;Database=BookStore;Trusted_Connection=True;MultipleActiveResultSets=true" "Default": "Server=localhost;Database=BookStore;Trusted_Connection=True"
} }
```` ````
@ -594,10 +594,10 @@ Change it as shown below:
````json ````json
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=localhost;Database=BookStore;Trusted_Connection=True;MultipleActiveResultSets=true", "Default": "Server=localhost;Database=BookStore;Trusted_Connection=True",
"AbpPermissionManagement": "Server=localhost;Database=BookStore_SecondDb;Trusted_Connection=True;MultipleActiveResultSets=true", "AbpPermissionManagement": "Server=localhost;Database=BookStore_SecondDb;Trusted_Connection=True",
"AbpSettingManagement": "Server=localhost;Database=BookStore_SecondDb;Trusted_Connection=True;MultipleActiveResultSets=true", "AbpSettingManagement": "Server=localhost;Database=BookStore_SecondDb;Trusted_Connection=True",
"AbpAuditLogging": "Server=localhost;Database=BookStore_SecondDb;Trusted_Connection=True;MultipleActiveResultSets=true" "AbpAuditLogging": "Server=localhost;Database=BookStore_SecondDb;Trusted_Connection=True"
} }
```` ````

2
docs/en/Modules/Docs.md

@ -47,7 +47,7 @@ The database connection string is located in `appsettings.json` of your `Acme.My
```json ```json
{ {
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProject;Trusted_Connection=True;MultipleActiveResultSets=true" "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProject;Trusted_Connection=True"
} }
} }
``` ```

6
docs/en/Samples/Microservice-Demo.md

@ -842,7 +842,7 @@ It has a dedicated MongoDB database (MsDemo_Blogging) to store blog and posts. I
````json ````json
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true", "Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True",
"Blogging": "mongodb://localhost/MsDemo_Blogging" "Blogging": "mongodb://localhost/MsDemo_Blogging"
} }
```` ````
@ -968,8 +968,8 @@ There are two connection strings in the `appsettings.json` file:
````json ````json
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true", "Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True",
"ProductManagement": "Server=localhost;Database=MsDemo_ProductManagement;Trusted_Connection=True;MultipleActiveResultSets=true" "ProductManagement": "Server=localhost;Database=MsDemo_ProductManagement;Trusted_Connection=True"
} }
```` ````

2
docs/zh-Hans/CLI.md

@ -103,7 +103,7 @@ abp new Acme.BookStore
* `--preview`: 使用最新的预览版本. * `--preview`: 使用最新的预览版本.
* `--template-source` 或者 `-ts`: 指定自定义模板源用于生成项目,可以使用本地源和网络源(例如 `D:\local-templat` 或 `https://.../my-template-file.zip`). * `--template-source` 或者 `-ts`: 指定自定义模板源用于生成项目,可以使用本地源和网络源(例如 `D:\local-templat` 或 `https://.../my-template-file.zip`).
* `--create-solution-folder` 或者 `-csf`: 指定项目是在输出文件夹中的新文件夹中还是直接在输出文件夹中. * `--create-solution-folder` 或者 `-csf`: 指定项目是在输出文件夹中的新文件夹中还是直接在输出文件夹中.
* `--connection-string` 或者 `-cs`: 重写所有 `appsettings.json` 文件的默认连接字符串. 默认连接字符串是 `Server=localhost;Database=MyProjectName;Trusted_Connection=True;MultipleActiveResultSets=true`. 默认的数据库提供程序是 `SQL Server`. 如果你使用EF Core但需要更改DBMS,可以按[这里所述](Entity-Framework-Core-Other-DBMS.md)进行更改(创建解决方案之后). * `--connection-string` 或者 `-cs`: 重写所有 `appsettings.json` 文件的默认连接字符串. 默认连接字符串是 `Server=localhost;Database=MyProjectName;Trusted_Connection=True`. 默认的数据库提供程序是 `SQL Server`. 如果你使用EF Core但需要更改DBMS,可以按[这里所述](Entity-Framework-Core-Other-DBMS.md)进行更改(创建解决方案之后).
* `--local-framework-ref --abp-path`: 使用对项目的本地引用,而不是替换为NuGet包引用. * `--local-framework-ref --abp-path`: 使用对项目的本地引用,而不是替换为NuGet包引用.
### update ### update

10
docs/zh-Hans/Entity-Framework-Core-Migrations.md

@ -588,7 +588,7 @@ public class IdentityRoleExtendingService : ITransientDependency
````json ````json
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=localhost;Database=BookStore;Trusted_Connection=True;MultipleActiveResultSets=true" "Default": "Server=localhost;Database=BookStore;Trusted_Connection=True"
} }
```` ````
@ -596,10 +596,10 @@ public class IdentityRoleExtendingService : ITransientDependency
````json ````json
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=localhost;Database=BookStore;Trusted_Connection=True;MultipleActiveResultSets=true", "Default": "Server=localhost;Database=BookStore;Trusted_Connection=True",
"AbpPermissionManagement": "Server=localhost;Database=BookStore_SecondDb;Trusted_Connection=True;MultipleActiveResultSets=true", "AbpPermissionManagement": "Server=localhost;Database=BookStore_SecondDb;Trusted_Connection=True",
"AbpSettingManagement": "Server=localhost;Database=BookStore_SecondDb;Trusted_Connection=True;MultipleActiveResultSets=true", "AbpSettingManagement": "Server=localhost;Database=BookStore_SecondDb;Trusted_Connection=True",
"AbpAuditLogging": "Server=localhost;Database=BookStore_SecondDb;Trusted_Connection=True;MultipleActiveResultSets=true" "AbpAuditLogging": "Server=localhost;Database=BookStore_SecondDb;Trusted_Connection=True"
} }
```` ````

2
docs/zh-Hans/Modules/Docs.md

@ -47,7 +47,7 @@ ABP框架的[文档](docs.abp.io)也是使用的此模块.
```json ```json
{ {
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProject;Trusted_Connection=True;MultipleActiveResultSets=true" "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProject;Trusted_Connection=True"
} }
} }
``` ```

6
docs/zh-Hans/Samples/Microservice-Demo.md

@ -843,7 +843,7 @@ Swagger UI已配置,是此服务的默认页面. 如果你导航到URL`http://lo
````json ````json
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true", "Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True",
"Blogging": "mongodb://localhost/MsDemo_Blogging" "Blogging": "mongodb://localhost/MsDemo_Blogging"
} }
```` ````
@ -969,8 +969,8 @@ public class ProductServiceMigrationDbContext : AbpDbContext<ProductServiceMigra
````json ````json
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True;MultipleActiveResultSets=true", "Default": "Server=localhost;Database=MsDemo_Identity;Trusted_Connection=True",
"ProductManagement": "Server=localhost;Database=MsDemo_ProductManagement;Trusted_Connection=True;MultipleActiveResultSets=true" "ProductManagement": "Server=localhost;Database=MsDemo_ProductManagement;Trusted_Connection=True"
} }
```` ````

40
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/ui-extensions.js

@ -96,7 +96,7 @@
get: _get get: _get
}; };
})(); })();
function initializeObjectExtensions() { function initializeObjectExtensions() {
var getShortEnumTypeName = function (enumType) { var getShortEnumTypeName = function (enumType) {
@ -149,7 +149,7 @@
return defaultValue; return defaultValue;
} }
function localizeEnumMember(property, enumMemberValue) { function localizeEnumMember(property, enumMemberValue) {
var enumType = property.config.type; var enumType = property.config.type;
var enumInfo = abp.objectExtensions.enums[enumType]; var enumInfo = abp.objectExtensions.enums[enumType];
@ -188,10 +188,28 @@
var propertyName = propertyNames[i]; var propertyName = propertyNames[i];
var propertyConfig = objectConfig.properties[propertyName]; var propertyConfig = objectConfig.properties[propertyName];
if (propertyConfig.ui.onTable.isVisible) { if (propertyConfig.ui.onTable.isVisible) {
tableProperties.push({ if (propertyName.endsWith("_Text")) {
name: propertyName, var lookupPropertyName = propertyName.replace("_Text", "");
config: propertyConfig var lookupProperty = objectConfig.properties[lookupPropertyName];
}); if (lookupProperty) {
tableProperties.push({
name: propertyName,
config: propertyConfig,
lookupPropertyName: lookupPropertyName,
lookupPropertyDisplayName: lookupProperty.displayName
});
} else {
tableProperties.push({
name: propertyName,
config: propertyConfig,
});
}
} else {
tableProperties.push({
name: propertyName,
config: propertyConfig,
});
}
} }
} }
@ -199,19 +217,23 @@
} }
function getValueFromRow(property, row) { function getValueFromRow(property, row) {
return row.extraProperties[property.name];; return row.extraProperties[property.name];
} }
function convertPropertyToColumnConfig(property) { function convertPropertyToColumnConfig(property) {
var columnConfig = { var columnConfig = {
title: localizeDisplayName(property.name, property.config.displayName),
data: "extraProperties." + property.name, data: "extraProperties." + property.name,
orderable: false orderable: false
}; };
if (property.lookupPropertyName) {
columnConfig.title = localizeDisplayName(property.lookupPropertyName, property.lookupPropertyDisplayName);
} else {
columnConfig.title = localizeDisplayName(property.name, property.config.displayName);
}
if (property.config.typeSimple === 'enum') { if (property.config.typeSimple === 'enum') {
columnConfig.render = function(data, type, row) { columnConfig.render = function (data, type, row) {
var value = getValueFromRow(property, row); var value = getValueFromRow(property, row);
return localizeEnumMember(property, value); return localizeEnumMember(property, value);
} }

34
framework/src/Volo.Abp.AutoMapper/Volo/Abp/AutoMapper/AbpAutoMapperConventionalRegistrar.cs

@ -0,0 +1,34 @@
using System;
using System.Linq;
using AutoMapper;
using AutoMapper.Internal;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.AutoMapper
{
public class AbpAutoMapperConventionalRegistrar : ConventionalRegistrarBase
{
protected readonly Type[] OpenTypes = {
typeof(IValueResolver<,,>),
typeof(IMemberValueResolver<,,,>),
typeof(ITypeConverter<,>),
typeof(IValueConverter<,>),
typeof(IMappingAction<,>)
};
public override void AddType(IServiceCollection services, Type type)
{
if (IsConventionalRegistrationDisabled(type))
{
return;
}
if (type.IsClass && !type.IsAbstract && OpenTypes.Any(type.ImplementsGenericInterface))
{
services.TryAddTransient(type);
}
}
}
}

26
framework/src/Volo.Abp.AutoMapper/Volo/Abp/AutoMapper/AbpAutoMapperModule.cs

@ -13,24 +13,23 @@ namespace Volo.Abp.AutoMapper
typeof(AbpObjectMappingModule), typeof(AbpObjectMappingModule),
typeof(AbpObjectExtendingModule), typeof(AbpObjectExtendingModule),
typeof(AbpAuditingModule) typeof(AbpAuditingModule)
)] )]
public class AbpAutoMapperModule : AbpModule public class AbpAutoMapperModule : AbpModule
{ {
public override void ConfigureServices(ServiceConfigurationContext context) public override void PreConfigureServices(ServiceConfigurationContext context)
{ {
context.Services.AddAutoMapperObjectMapper(); context.Services.AddConventionalRegistrar(new AbpAutoMapperConventionalRegistrar());
var mapperAccessor = new MapperAccessor();
context.Services.AddSingleton<IMapperAccessor>(_ => mapperAccessor);
context.Services.AddSingleton<MapperAccessor>(_ => mapperAccessor);
} }
public override void OnPreApplicationInitialization(ApplicationInitializationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
CreateMappings(context.ServiceProvider); context.Services.AddAutoMapperObjectMapper();
context.Services.AddSingleton<MapperAccessor>(provider => CreateMappings(provider));
context.Services.AddSingleton<IMapperAccessor>(provider => provider.GetRequiredService<MapperAccessor>());
} }
private void CreateMappings(IServiceProvider serviceProvider) private MapperAccessor CreateMappings(IServiceProvider serviceProvider)
{ {
using (var scope = serviceProvider.CreateScope()) using (var scope = serviceProvider.CreateScope())
{ {
@ -48,7 +47,7 @@ namespace Volo.Abp.AutoMapper
{ {
foreach (var profileType in options.ValidatingProfiles) foreach (var profileType in options.ValidatingProfiles)
{ {
config.AssertConfigurationIsValid(((Profile)Activator.CreateInstance(profileType)).ProfileName); config.AssertConfigurationIsValid(((Profile) Activator.CreateInstance(profileType)).ProfileName);
} }
} }
@ -59,7 +58,10 @@ namespace Volo.Abp.AutoMapper
ValidateAll(mapperConfiguration); ValidateAll(mapperConfiguration);
scope.ServiceProvider.GetRequiredService<MapperAccessor>().Mapper = mapperConfiguration.CreateMapper(); return new MapperAccessor
{
Mapper = new Mapper(mapperConfiguration, serviceProvider.GetService)
};
} }
} }
} }

140
framework/src/Volo.Abp.Autofac/Autofac/Extensions/DependencyInjection/AutofacRegistration.cs

@ -1,6 +1,6 @@
// This software is part of the Autofac IoC container // This software is part of the Autofac IoC container
// Copyright © 2015 Autofac Contributors // Copyright © 2015 Autofac Contributors
// http://autofac.org // https://autofac.org
// //
// Permission is hereby granted, free of charge, to any person // Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation // obtaining a copy of this software and associated documentation
@ -24,10 +24,13 @@
// OTHER DEALINGS IN THE SOFTWARE. // OTHER DEALINGS IN THE SOFTWARE.
using System; using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Reflection; using System.Reflection;
using Autofac.Builder; using Autofac.Builder;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Autofac; using Volo.Abp.Autofac;
using Volo.Abp;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
namespace Autofac.Extensions.DependencyInjection namespace Autofac.Extensions.DependencyInjection
@ -46,16 +49,62 @@ namespace Autofac.Extensions.DependencyInjection
/// The <see cref="ContainerBuilder"/> into which the registrations should be made. /// The <see cref="ContainerBuilder"/> into which the registrations should be made.
/// </param> /// </param>
/// <param name="services"> /// <param name="services">
/// The set of service descriptors to register in the container. /// A container builder that can be used to create an <see cref="IServiceProvider" />.
/// </param> /// </param>
public static void Populate( public static void Populate(
this ContainerBuilder builder, this ContainerBuilder builder,
IServiceCollection services) IServiceCollection services)
{ {
builder.RegisterType<AutofacServiceProvider>().As<IServiceProvider>(); Populate(builder, services, null);
builder.RegisterType<AutofacServiceScopeFactory>().As<IServiceScopeFactory>(); }
/// <summary>
/// Populates the Autofac container builder with the set of registered service descriptors
/// and makes <see cref="IServiceProvider"/> and <see cref="IServiceScopeFactory"/>
/// available in the container. Using this overload is incompatible with the ASP.NET Core
/// support for <see cref="IServiceProviderFactory{TContainerBuilder}"/>.
/// </summary>
/// <param name="builder">
/// The <see cref="ContainerBuilder"/> into which the registrations should be made.
/// </param>
/// <param name="services">
/// A container builder that can be used to create an <see cref="IServiceProvider" />.
/// </param>
/// <param name="lifetimeScopeTagForSingletons">
/// If provided and not <see langword="null"/> then all registrations with lifetime <see cref="ServiceLifetime.Singleton" /> are registered
/// using <see cref="IRegistrationBuilder{TLimit,TActivatorData,TRegistrationStyle}.InstancePerMatchingLifetimeScope" />
/// with provided <paramref name="lifetimeScopeTagForSingletons"/>
/// instead of using <see cref="IRegistrationBuilder{TLimit,TActivatorData,TRegistrationStyle}.SingleInstance"/>.
/// </param>
/// <remarks>
/// <para>
/// Specifying a <paramref name="lifetimeScopeTagForSingletons"/> addresses a specific case where you have
/// an application that uses Autofac but where you need to isolate a set of services in a child scope. For example,
/// if you have a large application that self-hosts ASP.NET Core items, you may want to isolate the ASP.NET
/// Core registrations in a child lifetime scope so they don't show up for the rest of the application.
/// This overload allows that. Note it is the developer's responsibility to execute this and create an
/// <see cref="AutofacServiceProvider"/> using the child lifetime scope.
/// </para>
/// </remarks>
public static void Populate(
this ContainerBuilder builder,
IServiceCollection services,
object lifetimeScopeTagForSingletons)
{
if (services == null)
{
throw new ArgumentNullException(nameof(services));
}
Register(builder, services); builder.RegisterType<AutofacServiceProvider>().As<IServiceProvider>().ExternallyOwned();
var autofacServiceScopeFactory = typeof(AutofacServiceProvider).Assembly.GetType("Autofac.Extensions.DependencyInjection.AutofacServiceScopeFactory");
if (autofacServiceScopeFactory == null)
{
throw new AbpException("Unable get type of Autofac.Extensions.DependencyInjection.AutofacServiceScopeFactory!");
}
builder.RegisterType(autofacServiceScopeFactory).As<IServiceScopeFactory>();
Register(builder, services, lifetimeScopeTagForSingletons);
} }
/// <summary> /// <summary>
@ -65,18 +114,33 @@ namespace Autofac.Extensions.DependencyInjection
/// <typeparam name="TRegistrationStyle">The object registration style.</typeparam> /// <typeparam name="TRegistrationStyle">The object registration style.</typeparam>
/// <param name="registrationBuilder">The registration being built.</param> /// <param name="registrationBuilder">The registration being built.</param>
/// <param name="lifecycleKind">The lifecycle specified on the service registration.</param> /// <param name="lifecycleKind">The lifecycle specified on the service registration.</param>
/// <param name="lifetimeScopeTagForSingleton">
/// If not <see langword="null"/> then all registrations with lifetime <see cref="ServiceLifetime.Singleton" /> are registered
/// using <see cref="IRegistrationBuilder{TLimit,TActivatorData,TRegistrationStyle}.InstancePerMatchingLifetimeScope" />
/// with provided <paramref name="lifetimeScopeTagForSingleton"/>
/// instead of using <see cref="IRegistrationBuilder{TLimit,TActivatorData,TRegistrationStyle}.SingleInstance"/>.
/// </param>
/// <returns> /// <returns>
/// The <paramref name="registrationBuilder" />, configured with the proper lifetime scope, /// The <paramref name="registrationBuilder" />, configured with the proper lifetime scope,
/// and available for additional configuration. /// and available for additional configuration.
/// </returns> /// </returns>
private static IRegistrationBuilder<object, TActivatorData, TRegistrationStyle> ConfigureLifecycle<TActivatorData, TRegistrationStyle>( private static IRegistrationBuilder<object, TActivatorData, TRegistrationStyle> ConfigureLifecycle<TActivatorData, TRegistrationStyle>(
this IRegistrationBuilder<object, TActivatorData, TRegistrationStyle> registrationBuilder, this IRegistrationBuilder<object, TActivatorData, TRegistrationStyle> registrationBuilder,
ServiceLifetime lifecycleKind) ServiceLifetime lifecycleKind,
object lifetimeScopeTagForSingleton)
{ {
switch (lifecycleKind) switch (lifecycleKind)
{ {
case ServiceLifetime.Singleton: case ServiceLifetime.Singleton:
registrationBuilder.SingleInstance(); if (lifetimeScopeTagForSingleton == null)
{
registrationBuilder.SingleInstance();
}
else
{
registrationBuilder.InstancePerMatchingLifetimeScope(lifetimeScopeTagForSingleton);
}
break; break;
case ServiceLifetime.Scoped: case ServiceLifetime.Scoped:
registrationBuilder.InstancePerLifetimeScope(); registrationBuilder.InstancePerLifetimeScope();
@ -96,59 +160,67 @@ namespace Autofac.Extensions.DependencyInjection
/// The <see cref="ContainerBuilder"/> into which the registrations should be made. /// The <see cref="ContainerBuilder"/> into which the registrations should be made.
/// </param> /// </param>
/// <param name="services"> /// <param name="services">
/// The set of service descriptors to register in the container. /// A container builder that can be used to create an <see cref="IServiceProvider" />.
/// </param>
/// <param name="lifetimeScopeTagForSingletons">
/// If not <see langword="null"/> then all registrations with lifetime <see cref="ServiceLifetime.Singleton" /> are registered
/// using <see cref="IRegistrationBuilder{TLimit,TActivatorData,TRegistrationStyle}.InstancePerMatchingLifetimeScope" />
/// with provided <paramref name="lifetimeScopeTagForSingletons"/>
/// instead of using <see cref="IRegistrationBuilder{TLimit,TActivatorData,TRegistrationStyle}.SingleInstance"/>.
/// </param> /// </param>
[SuppressMessage("CA2000", "CA2000", Justification = "Registrations created here are disposed when the built container is disposed.")]
private static void Register( private static void Register(
ContainerBuilder builder, ContainerBuilder builder,
IServiceCollection services) IServiceCollection services,
object lifetimeScopeTagForSingletons)
{ {
var moduleContainer = services.GetSingletonInstance<IModuleContainer>(); var moduleContainer = services.GetSingletonInstance<IModuleContainer>();
var registrationActionList = services.GetRegistrationActionList(); var registrationActionList = services.GetRegistrationActionList();
foreach (var service in services) foreach (var descriptor in services)
{ {
if (service.ImplementationType != null) if (descriptor.ImplementationType != null)
{ {
// Test if the an open generic type is being registered // Test if the an open generic type is being registered
var serviceTypeInfo = service.ServiceType.GetTypeInfo(); var serviceTypeInfo = descriptor.ServiceType.GetTypeInfo();
if (serviceTypeInfo.IsGenericTypeDefinition) if (serviceTypeInfo.IsGenericTypeDefinition)
{ {
builder builder
.RegisterGeneric(service.ImplementationType) .RegisterGeneric(descriptor.ImplementationType)
.As(service.ServiceType) .As(descriptor.ServiceType)
.ConfigureLifecycle(service.Lifetime) .ConfigureLifecycle(descriptor.Lifetime, lifetimeScopeTagForSingletons)
.FindConstructorsWith(new AbpAutofacConstructorFinder()) .FindConstructorsWith(new AbpAutofacConstructorFinder())
.ConfigureAbpConventions(moduleContainer, registrationActionList); .ConfigureAbpConventions(moduleContainer, registrationActionList);
} }
else else
{ {
builder builder
.RegisterType(service.ImplementationType) .RegisterType(descriptor.ImplementationType)
.As(service.ServiceType) .As(descriptor.ServiceType)
.ConfigureLifecycle(service.Lifetime) .ConfigureLifecycle(descriptor.Lifetime, lifetimeScopeTagForSingletons)
.FindConstructorsWith(new AbpAutofacConstructorFinder()) .FindConstructorsWith(new AbpAutofacConstructorFinder())
.ConfigureAbpConventions(moduleContainer, registrationActionList); .ConfigureAbpConventions(moduleContainer, registrationActionList);
} }
} }
else if (service.ImplementationFactory != null) else if (descriptor.ImplementationFactory != null)
{ {
var registration = RegistrationBuilder.ForDelegate(service.ServiceType, (context, parameters) => var registration = RegistrationBuilder.ForDelegate(descriptor.ServiceType, (context, parameters) =>
{ {
var serviceProvider = context.Resolve<IServiceProvider>(); var serviceProvider = context.Resolve<IServiceProvider>();
return service.ImplementationFactory(serviceProvider); return descriptor.ImplementationFactory(serviceProvider);
}) })
.ConfigureLifecycle(service.Lifetime) .ConfigureLifecycle(descriptor.Lifetime, lifetimeScopeTagForSingletons)
.CreateRegistration(); .CreateRegistration();
//TODO: ConfigureAbpConventions ? //TODO: ConfigureAbpConventions ?
builder.RegisterComponent(registration); builder.RegisterComponent(registration);
} }
else else
{ {
builder builder
.RegisterInstance(service.ImplementationInstance) .RegisterInstance(descriptor.ImplementationInstance)
.As(service.ServiceType) .As(descriptor.ServiceType)
.ConfigureLifecycle(service.Lifetime); .ConfigureLifecycle(descriptor.Lifetime, null);
} }
} }
} }

122
framework/src/Volo.Abp.Autofac/Autofac/Extensions/DependencyInjection/AutofacServiceProvider.cs

@ -1,122 +0,0 @@
// This software is part of the Autofac IoC container
// Copyright © 2015 Autofac Contributors
// https://autofac.org
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
using System;
using Microsoft.Extensions.DependencyInjection;
namespace Autofac.Extensions.DependencyInjection
{
/// <summary>
/// Autofac implementation of the ASP.NET Core <see cref="IServiceProvider"/>.
/// </summary>
/// <seealso cref="System.IServiceProvider" />
/// <seealso cref="Microsoft.Extensions.DependencyInjection.ISupportRequiredService" />
public class AutofacServiceProvider : IServiceProvider, ISupportRequiredService, IDisposable
{
private readonly ILifetimeScope _lifetimeScope;
private bool _disposed = false;
/// <summary>
/// Initializes a new instance of the <see cref="AutofacServiceProvider"/> class.
/// </summary>
/// <param name="lifetimeScope">
/// The lifetime scope from which services will be resolved.
/// </param>
public AutofacServiceProvider(ILifetimeScope lifetimeScope)
{
this._lifetimeScope = lifetimeScope;
}
/// <summary>
/// Gets service of type <paramref name="serviceType" /> from the
/// <see cref="AutofacServiceProvider" /> and requires it be present.
/// </summary>
/// <param name="serviceType">
/// An object that specifies the type of service object to get.
/// </param>
/// <returns>
/// A service object of type <paramref name="serviceType" />.
/// </returns>
/// <exception cref="Autofac.Core.Registration.ComponentNotRegisteredException">
/// Thrown if the <paramref name="serviceType" /> isn't registered with the container.
/// </exception>
/// <exception cref="Autofac.Core.DependencyResolutionException">
/// Thrown if the object can't be resolved from the container.
/// </exception>
public object GetRequiredService(Type serviceType)
{
return this._lifetimeScope.Resolve(serviceType);
}
/// <summary>
/// Gets the service object of the specified type.
/// </summary>
/// <param name="serviceType">
/// An object that specifies the type of service object to get.
/// </param>
/// <returns>
/// A service object of type <paramref name="serviceType" />; or <see langword="null" />
/// if there is no service object of type <paramref name="serviceType" />.
/// </returns>
public object GetService(Type serviceType)
{
return this._lifetimeScope.ResolveOptional(serviceType);
}
/// <summary>
/// Gets the underlying instance of <see cref="ILifetimeScope" />.
/// </summary>
public ILifetimeScope LifetimeScope => _lifetimeScope;
/// <summary>
/// Releases unmanaged and - optionally - managed resources.
/// </summary>
/// <param name="disposing">
/// <see langword="true" /> to release both managed and unmanaged resources;
/// <see langword="false" /> to release only unmanaged resources.
/// </param>
protected virtual void Dispose(bool disposing)
{
if (!this._disposed)
{
this._disposed = true;
if (disposing)
{
this._lifetimeScope.Dispose();
}
}
}
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
public void Dispose()
{
this.Dispose(true);
GC.SuppressFinalize(this);
}
}
}

77
framework/src/Volo.Abp.Autofac/Autofac/Extensions/DependencyInjection/AutofacServiceProviderFactory.cs

@ -1,77 +0,0 @@
// This software is part of the Autofac IoC container
// Copyright © 2017 Autofac Contributors
// http://autofac.org
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
using System;
using Microsoft.Extensions.DependencyInjection;
namespace Autofac.Extensions.DependencyInjection
{
/// <summary>
/// A factory for creating a <see cref="ContainerBuilder"/> and an <see cref="T:System.IServiceProvider" />.
/// </summary>
public class AutofacServiceProviderFactory : IServiceProviderFactory<ContainerBuilder>
{
private readonly Action<ContainerBuilder> _configurationAction;
/// <summary>
/// Initializes a new instance of the <see cref="AutofacServiceProviderFactory"/> class.
/// </summary>
/// <param name="configurationAction">Action on a <see cref="ContainerBuilder"/> that adds component registrations to the container.</param>
public AutofacServiceProviderFactory(Action<ContainerBuilder> configurationAction = null)
{
_configurationAction = configurationAction ?? (builder => { });
}
/// <summary>
/// Creates a container builder from an <see cref="T:Microsoft.Extensions.DependencyInjection.IServiceCollection" />.
/// </summary>
/// <param name="services">The collection of services</param>
/// <returns>A container builder that can be used to create an <see cref="T:System.IServiceProvider" />.</returns>
public ContainerBuilder CreateBuilder(IServiceCollection services)
{
var builder = new ContainerBuilder();
builder.Populate(services);
_configurationAction(builder);
return builder;
}
/// <summary>
/// Creates an <see cref="T:System.IServiceProvider" /> from the container builder.
/// </summary>
/// <param name="containerBuilder">The container builder</param>
/// <returns>An <see cref="T:System.IServiceProvider" /></returns>
public IServiceProvider CreateServiceProvider(ContainerBuilder containerBuilder)
{
if (containerBuilder == null) throw new ArgumentNullException(nameof(containerBuilder));
var container = containerBuilder.Build();
return new AutofacServiceProvider(container);
}
}
}

67
framework/src/Volo.Abp.Autofac/Autofac/Extensions/DependencyInjection/AutofacServiceScope.cs

@ -1,67 +0,0 @@
// This software is part of the Autofac IoC container
// Copyright © 2015 Autofac Contributors
// http://autofac.org
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
using System;
using Microsoft.Extensions.DependencyInjection;
namespace Autofac.Extensions.DependencyInjection
{
/// <summary>
/// Autofac implementation of the ASP.NET Core <see cref="IServiceScope"/>.
/// </summary>
/// <seealso cref="Microsoft.Extensions.DependencyInjection.IServiceScope" />
internal class AutofacServiceScope : IServiceScope
{
private readonly ILifetimeScope _lifetimeScope;
/// <summary>
/// Initializes a new instance of the <see cref="AutofacServiceScope"/> class.
/// </summary>
/// <param name="lifetimeScope">
/// The lifetime scope from which services should be resolved for this service scope.
/// </param>
public AutofacServiceScope(ILifetimeScope lifetimeScope)
{
this._lifetimeScope = lifetimeScope;
this.ServiceProvider = this._lifetimeScope.Resolve<IServiceProvider>();
}
/// <summary>
/// Gets an <see cref="IServiceProvider" /> corresponding to this service scope.
/// </summary>
/// <value>
/// An <see cref="IServiceProvider" /> that can be used to resolve dependencies from the scope.
/// </value>
public IServiceProvider ServiceProvider { get; }
/// <summary>
/// Disposes of the lifetime scope and resolved disposable services.
/// </summary>
public void Dispose()
{
this._lifetimeScope.Dispose();
}
}
}

65
framework/src/Volo.Abp.Autofac/Autofac/Extensions/DependencyInjection/AutofacServiceScopeFactory.cs

@ -1,65 +0,0 @@
// This software is part of the Autofac IoC container
// Copyright © 2015 Autofac Contributors
// http://autofac.org
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation
// files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use,
// copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following
// conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
using System.Diagnostics.CodeAnalysis;
using Microsoft.Extensions.DependencyInjection;
namespace Autofac.Extensions.DependencyInjection
{
/// <summary>
/// Autofac implementation of the ASP.NET Core <see cref="IServiceScopeFactory"/>.
/// </summary>
/// <seealso cref="Microsoft.Extensions.DependencyInjection.IServiceScopeFactory" />
[SuppressMessage("Microsoft.ApiDesignGuidelines", "CA2213", Justification = "The creator of the root service lifetime scope is responsible for disposal.")]
internal class AutofacServiceScopeFactory : IServiceScopeFactory
{
private readonly ILifetimeScope _lifetimeScope;
/// <summary>
/// Initializes a new instance of the <see cref="AutofacServiceScopeFactory"/> class.
/// </summary>
/// <param name="lifetimeScope">The lifetime scope.</param>
public AutofacServiceScopeFactory(ILifetimeScope lifetimeScope)
{
this._lifetimeScope = lifetimeScope;
}
/// <summary>
/// Creates an <see cref="IServiceScope" /> which contains an
/// <see cref="System.IServiceProvider" /> used to resolve dependencies within
/// the scope.
/// </summary>
/// <returns>
/// An <see cref="IServiceScope" /> controlling the lifetime of the scope. Once
/// this is disposed, any scoped services that have been resolved
/// from the <see cref="IServiceScope.ServiceProvider" />
/// will also be disposed.
/// </returns>
public IServiceScope CreateScope()
{
return new AutofacServiceScope(this._lifetimeScope.BeginLifetimeScope());
}
}
}

4
framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj

@ -15,8 +15,10 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Autofac.Extras.DynamicProxy" Version="6.0.0" />
<PackageReference Include="Autofac" Version="6.0.0" /> <PackageReference Include="Autofac" Version="6.0.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Autofac.Extras.DynamicProxy" Version="6.0.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="$(MicrosoftPackageVersion)" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="$(MicrosoftPackageVersion)" /> <PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="$(MicrosoftPackageVersion)" />
</ItemGroup> </ItemGroup>

25
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs

@ -150,6 +150,13 @@ namespace Volo.Abp.Cli.Commands
Logger.LogInformation("Output folder: " + outputFolder); Logger.LogInformation("Output folder: " + outputFolder);
if (connectionString == null &&
databaseManagementSystem != DatabaseManagementSystem.NotSpecified &&
databaseManagementSystem != DatabaseManagementSystem.SQLServer)
{
connectionString = GetNewConnectionStringByDbms(databaseManagementSystem, outputFolder);
}
commandLineArgs.Options.Add(CliConsts.Command, commandLineArgs.Command); commandLineArgs.Options.Add(CliConsts.Command, commandLineArgs.Command);
var result = await TemplateProjectBuilder.BuildAsync( var result = await TemplateProjectBuilder.BuildAsync(
@ -219,6 +226,24 @@ namespace Volo.Abp.Cli.Commands
} }
} }
private string GetNewConnectionStringByDbms(DatabaseManagementSystem databaseManagementSystem, string outputFolder)
{
switch (databaseManagementSystem)
{
case DatabaseManagementSystem.MySQL:
return "Server=localhost;Port=3306;Database=MyProjectName;Uid=root;Pwd=myPassword;";
case DatabaseManagementSystem.PostgreSQL:
return "User ID=root;Password=myPassword;Host=localhost;Port=5432;Database=MyProjectName;Pooling=true;Min Pool Size=0;Max Pool Size=100;Connection Lifetime=0;";
//case DatabaseManagementSystem.Oracle:
case DatabaseManagementSystem.OracleDevart:
return "Data Source=MyProjectName;Integrated Security=yes;";
case DatabaseManagementSystem.SQLite:
return $"Data Source={Path.Combine(outputFolder,"database\\MyProjectName.db")};Version=3;";
default:
return null;
}
}
private void DeleteMigrationsIfNeeded(DatabaseProvider databaseProvider, DatabaseManagementSystem databaseManagementSystem, string outputFolder) private void DeleteMigrationsIfNeeded(DatabaseProvider databaseProvider, DatabaseManagementSystem databaseManagementSystem, string outputFolder)
{ {
if (databaseManagementSystem == DatabaseManagementSystem.NotSpecified || databaseManagementSystem == DatabaseManagementSystem.SQLServer) if (databaseManagementSystem == DatabaseManagementSystem.NotSpecified || databaseManagementSystem == DatabaseManagementSystem.SQLServer)

11
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/TemplateProjectBuildPipelineBuilder.cs

@ -17,6 +17,12 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building
pipeline.Steps.Add(new ProjectReferenceReplaceStep()); pipeline.Steps.Add(new ProjectReferenceReplaceStep());
pipeline.Steps.Add(new TemplateCodeDeleteStep()); pipeline.Steps.Add(new TemplateCodeDeleteStep());
if (context.BuildArgs.ConnectionString != null)
{
pipeline.Steps.Add(new ConnectionStringChangeStep());
}
pipeline.Steps.Add(new SolutionRenameStep()); pipeline.Steps.Add(new SolutionRenameStep());
if (context.Template.Name == AppProTemplate.TemplateName || if (context.Template.Name == AppProTemplate.TemplateName ||
@ -37,11 +43,6 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building
pipeline.Steps.Add(new RemoveRootFolderStep()); pipeline.Steps.Add(new RemoveRootFolderStep());
} }
if (context.BuildArgs.ConnectionString != null)
{
pipeline.Steps.Add(new ConnectionStringChangeStep());
}
pipeline.Steps.Add(new CreateProjectResultZipStep()); pipeline.Steps.Add(new CreateProjectResultZipStep());
return pipeline; return pipeline;

6
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs

@ -206,6 +206,12 @@ namespace Volo.Abp.Cli.ProjectModification
{ {
var srcPath = Path.Combine(Path.GetDirectoryName(moduleSolutionFile), targetFolder); var srcPath = Path.Combine(Path.GetDirectoryName(moduleSolutionFile), targetFolder);
var projectFolderPath = Directory.GetDirectories(srcPath).FirstOrDefault(d=> d.EndsWith(postFix)); var projectFolderPath = Directory.GetDirectories(srcPath).FirstOrDefault(d=> d.EndsWith(postFix));
if(projectFolderPath == null)
{
return;
}
await SolutionFileModifier.RemoveProjectFromSolutionFileAsync(moduleSolutionFile, new DirectoryInfo(projectFolderPath).Name); await SolutionFileModifier.RemoveProjectFromSolutionFileAsync(moduleSolutionFile, new DirectoryInfo(projectFolderPath).Name);
if (Directory.Exists(projectFolderPath)) if (Directory.Exists(projectFolderPath))

9
framework/src/Volo.Abp.Cli/Properties/launchSettings.json

@ -1,9 +0,0 @@
{
"profiles": {
"Volo.Abp.Cli": {
"commandName": "Project",
"commandLineArgs": "bundle --skip-version-check",
"workingDirectory": "C:\\Github\\volo\\abp\\templates\\app-pro\\aspnet-core\\src\\MyCompanyName.MyProjectName.Blazor"
}
}
}

3
framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/EntityExtensionConfiguration.cs

@ -67,7 +67,8 @@ namespace Volo.Abp.ObjectExtending.Modularity
lookupTextPropertyName, lookupTextPropertyName,
() => new ExtensionPropertyConfiguration(this, typeof(string), lookupTextPropertyName) () => new ExtensionPropertyConfiguration(this, typeof(string), lookupTextPropertyName)
); );
lookupTextPropertyInfo.DisplayName = propertyInfo.DisplayName ?? new FixedLocalizableString(propertyInfo.Name);
lookupTextPropertyInfo.DisplayName = propertyInfo.DisplayName;
} }
[NotNull] [NotNull]

62
framework/test/Volo.Abp.AutoMapper.Tests/Volo/Abp/AutoMapper/AutoMapper_Dependency_Injection_Tests.cs

@ -0,0 +1,62 @@
using AutoMapper;
using Shouldly;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Testing;
using Xunit;
using IObjectMapper = Volo.Abp.ObjectMapping.IObjectMapper;
namespace Volo.Abp.AutoMapper
{
public class AutoMapper_Dependency_Injection_Tests : AbpIntegratedTest<AutoMapperTestModule>
{
private readonly IObjectMapper _objectMapper;
public AutoMapper_Dependency_Injection_Tests()
{
_objectMapper = GetRequiredService<IObjectMapper>();
}
[Fact]
public void Should_Registered_AutoMapper_Service()
{
GetService<CustomMappingActionService>().ShouldNotBeNull();
}
[Fact]
public void Custom_MappingAction_Test()
{
var sourceModel = new SourceModel
{
Name = "Source"
};
_objectMapper.Map<SourceModel, DestModel>(sourceModel).Name.ShouldBe(nameof(CustomMappingActionService));
}
public class SourceModel
{
public string Name { get; set; }
}
public class DestModel
{
public string Name { get; set; }
}
public class MapperActionProfile : Profile
{
public MapperActionProfile()
{
CreateMap<SourceModel, DestModel>().AfterMap<CustomMappingActionService>();
}
}
public class CustomMappingActionService : IMappingAction<SourceModel, DestModel>
{
public void Process(SourceModel source, DestModel destination, ResolutionContext context)
{
destination.Name = nameof(CustomMappingActionService);
}
}
}
}

2
modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/appsettings.json

@ -1,5 +1,5 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=localhost;Database=BackgroundJobsDemoApp;Trusted_Connection=True;MultipleActiveResultSets=true" "Default": "Server=localhost;Database=BackgroundJobsDemoApp;Trusted_Connection=True"
} }
} }

2
modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/appsettings.json

@ -1,5 +1,5 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=localhost;Database=BackgroundJobsDemoApp;Trusted_Connection=True;MultipleActiveResultSets=true" "Default": "Server=localhost;Database=BackgroundJobsDemoApp;Trusted_Connection=True"
} }
} }

2
modules/blob-storing-database/host/BlobStoring.Database.Host.ConsoleApp/src/BlobStoring.Database.Host.ConsoleApp.ConsoleApp/ConsoleAppConsoleAppModule.cs

@ -39,7 +39,7 @@ namespace BlobStoring.Database.Host.ConsoleApp.ConsoleApp
{ {
Configure<AbpDbConnectionOptions>(options => Configure<AbpDbConnectionOptions>(options =>
{ {
options.ConnectionStrings.Default = "Server=localhost;Database=BlobStoring_Host;Trusted_Connection=True;MultipleActiveResultSets=true"; options.ConnectionStrings.Default = "Server=localhost;Database=BlobStoring_Host;Trusted_Connection=True";
}); });
context.Services.AddAbpDbContext<BlobStoringHostDbContext>(options => context.Services.AddAbpDbContext<BlobStoringHostDbContext>(options =>

2
modules/blob-storing-database/host/BlobStoring.Database.Host.ConsoleApp/src/BlobStoring.Database.Host.ConsoleApp.ConsoleApp/appsettings.json

@ -1,5 +1,5 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=localhost;Database=BlobStoring_Host;Trusted_Connection=True;MultipleActiveResultSets=true" "Default": "Server=localhost;Database=BlobStoring_Host;Trusted_Connection=True"
} }
} }

2
modules/blogging/app/Volo.BloggingTestApp/appsettings.json

@ -1,6 +1,6 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"SqlServer": "Server=localhost;Database=BloggingTestApp;Trusted_Connection=True;MultipleActiveResultSets=true", "SqlServer": "Server=localhost;Database=BloggingTestApp;Trusted_Connection=True",
"MongoDb": "mongodb://localhost:27017/BloggingTestApp" "MongoDb": "mongodb://localhost:27017/BloggingTestApp"
} }
} }

14
modules/cms-kit/docker-compose.override.yml

@ -11,19 +11,19 @@ services:
identity-server: identity-server:
environment: environment:
- ASPNETCORE_URLS=http://0.0.0.0:80 - ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionStrings__Default=Server=sqlserver;Database=CmsKit_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false - ConnectionStrings__Default=Server=sqlserver;Database=CmsKit_Identity;Trusted_Connection=True;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- ConnectionStrings__SqlServerCache=Server=sqlserver;Database=CmsKit_Cache;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false - ConnectionStrings__SqlServerCache=Server=sqlserver;Database=CmsKit_Cache;Trusted_Connection=True;User=sa;Password=yourStrong(!)Password;Integrated Security=false
ports: ports:
- "51600:80" - "51600:80"
cms-kit: cms-kit:
environment: environment:
- ASPNETCORE_URLS=http://0.0.0.0:80 - ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionStrings__Default=Server=sqlserver;Database=CmsKit_ModuleDb;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false - ConnectionStrings__Default=Server=sqlserver;Database=CmsKit_ModuleDb;Trusted_Connection=True;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- ConnectionStrings__AbpSettingManagement=Server=sqlserver;Database=CmsKit_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false - ConnectionStrings__AbpSettingManagement=Server=sqlserver;Database=CmsKit_Identity;Trusted_Connection=True;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- ConnectionStrings__AbpPermissionManagement=Server=sqlserver;Database=CmsKit_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false - ConnectionStrings__AbpPermissionManagement=Server=sqlserver;Database=CmsKit_Identity;Trusted_Connection=True;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- ConnectionStrings__AbpAuditLogging=Server=sqlserver;Database=CmsKit_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false - ConnectionStrings__AbpAuditLogging=Server=sqlserver;Database=CmsKit_Identity;Trusted_Connection=True;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- ConnectionStrings__SqlServerCache=Server=sqlserver;Database=CmsKit_Cache;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false - ConnectionStrings__SqlServerCache=Server=sqlserver;Database=CmsKit_Cache;Trusted_Connection=True;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- AuthServer__Authority=http://identity-server - AuthServer__Authority=http://identity-server
ports: ports:
- "51601:80" - "51601:80"

4
modules/cms-kit/host/Volo.CmsKit.HttpApi.Host/appsettings.json

@ -3,8 +3,8 @@
"CorsOrigins": "https://*.CmsKit.com,http://localhost:4200" "CorsOrigins": "https://*.CmsKit.com,http://localhost:4200"
}, },
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=localhost;Database=CmsKit_Main;Trusted_Connection=True;MultipleActiveResultSets=true", "Default": "Server=localhost;Database=CmsKit_Main;Trusted_Connection=True",
"CmsKit": "Server=localhost;Database=CmsKit_Module;Trusted_Connection=True;MultipleActiveResultSets=true" "CmsKit": "Server=localhost;Database=CmsKit_Module;Trusted_Connection=True"
}, },
"Redis": { "Redis": {
"Configuration": "127.0.0.1" "Configuration": "127.0.0.1"

2
modules/cms-kit/host/Volo.CmsKit.IdentityServer/appsettings.json

@ -5,7 +5,7 @@
}, },
"AppSelfUrl": "https://localhost:44318/", "AppSelfUrl": "https://localhost:44318/",
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=localhost;Database=CmsKit_Main;Trusted_Connection=True;MultipleActiveResultSets=true" "Default": "Server=localhost;Database=CmsKit_Main;Trusted_Connection=True"
}, },
"Redis": { "Redis": {
"Configuration": "127.0.0.1" "Configuration": "127.0.0.1"

2
modules/cms-kit/host/Volo.CmsKit.Web.Unified/appsettings.json

@ -1,5 +1,5 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=localhost;Database=CmsKit_Unified;Trusted_Connection=True;MultipleActiveResultSets=true" "Default": "Server=localhost;Database=CmsKit_Unified;Trusted_Connection=True"
} }
} }

2
modules/docs/app/VoloDocs.Migrator/appsettings.json

@ -1,3 +1,3 @@
{ {
"ConnectionString": "Server=localhost;Database=VoloDocs;Trusted_Connection=True;MultipleActiveResultSets=true" "ConnectionString": "Server=localhost;Database=VoloDocs;Trusted_Connection=True"
} }

2
modules/docs/app/VoloDocs.Web/appsettings.json

@ -1,5 +1,5 @@
{ {
"ConnectionString": "Server=localhost;Database=VoloDocs;Trusted_Connection=True;MultipleActiveResultSets=true", "ConnectionString": "Server=localhost;Database=VoloDocs;Trusted_Connection=True",
"LogoUrl": "/assets/images/Logo.png", "LogoUrl": "/assets/images/Logo.png",
"ElasticSearch": { "ElasticSearch": {
"Url": "http://localhost:9200" "Url": "http://localhost:9200"

2
modules/docs/docker-compose.migrate.yml

@ -7,6 +7,6 @@ services:
context: ../../ context: ../../
dockerfile: modules/docs/app/VoloDocs.Migrator/Dockerfile dockerfile: modules/docs/app/VoloDocs.Migrator/Dockerfile
environment: environment:
- ConnectionString=Server=sqlserver;Database=VoloDocs;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false - ConnectionString=Server=sqlserver;Database=VoloDocs;Trusted_Connection=True;User=sa;Password=yourStrong(!)Password;Integrated Security=false
depends_on: depends_on:
- sqlserver - sqlserver

2
modules/docs/docker-compose.override.yml

@ -10,7 +10,7 @@ services:
volo-docs: volo-docs:
environment: environment:
- ConnectionString=Server=sqlserver;Database=VoloDocs;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false - ConnectionString=Server=sqlserver;Database=VoloDocs;Trusted_Connection=True;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- Title=VoloDocs - Title=VoloDocs
- LogoUrl=/assets/images/Logo.png - LogoUrl=/assets/images/Logo.png
ports: ports:

26
modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleDeletedEventHandler.cs

@ -0,0 +1,26 @@
using System.Threading.Tasks;
using Volo.Abp.Authorization.Permissions;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Entities.Events;
using Volo.Abp.EventBus;
using Volo.Abp.Identity;
namespace Volo.Abp.PermissionManagement.Identity
{
public class RoleDeletedEventHandler :
ILocalEventHandler<EntityDeletedEventData<IdentityRole>>,
ITransientDependency
{
protected IPermissionManager PermissionManager { get; }
public RoleDeletedEventHandler(IPermissionManager permissionManager)
{
PermissionManager = permissionManager;
}
public virtual async Task HandleEventAsync(EntityDeletedEventData<IdentityRole> eventData)
{
await PermissionManager.DeleteAsync(RolePermissionValueProvider.ProviderName, eventData.Entity.Name);
}
}
}

4
modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IPermissionManager.cs

@ -15,5 +15,7 @@ namespace Volo.Abp.PermissionManagement
Task SetAsync(string permissionName, string providerName, string providerKey, bool isGranted); Task SetAsync(string permissionName, string providerName, string providerKey, bool isGranted);
Task<PermissionGrant> UpdateProviderKeyAsync(PermissionGrant permissionGrant, string providerKey); Task<PermissionGrant> UpdateProviderKeyAsync(PermissionGrant permissionGrant, string providerKey);
Task DeleteAsync(string providerName, string providerKey);
} }
} }

12
modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManager.cs

@ -111,6 +111,16 @@ namespace Volo.Abp.PermissionManagement
return await PermissionGrantRepository.UpdateAsync(permissionGrant); return await PermissionGrantRepository.UpdateAsync(permissionGrant);
} }
public virtual async Task DeleteAsync(string providerName, string providerKey)
{
var permissionGrants = await PermissionGrantRepository.GetListAsync(providerName, providerKey);
//TODO: Use DeleteManyAsync method
foreach (var permissionGrant in permissionGrants)
{
await PermissionGrantRepository.DeleteAsync(permissionGrant);
}
}
protected virtual async Task<PermissionWithGrantedProviders> GetInternalAsync(PermissionDefinition permission, string providerName, string providerKey) protected virtual async Task<PermissionWithGrantedProviders> GetInternalAsync(PermissionDefinition permission, string providerName, string providerKey)
{ {
var result = new PermissionWithGrantedProviders(permission.Name, false); var result = new PermissionWithGrantedProviders(permission.Name, false);
@ -143,4 +153,4 @@ namespace Volo.Abp.PermissionManagement
return result; return result;
} }
} }
} }

2
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator/appsettings.json

@ -1,6 +1,6 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProjectName;Trusted_Connection=True;MultipleActiveResultSets=true" "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProjectName;Trusted_Connection=True"
}, },
"IdentityServer": { "IdentityServer": {
"Clients": { "Clients": {

2
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/appsettings.json

@ -3,7 +3,7 @@
"CorsOrigins": "https://*.MyProjectName.com,http://localhost:4200,https://localhost:44307" "CorsOrigins": "https://*.MyProjectName.com,http://localhost:4200,https://localhost:44307"
}, },
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProjectName;Trusted_Connection=True;MultipleActiveResultSets=true" "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProjectName;Trusted_Connection=True"
}, },
"Redis": { "Redis": {
"Configuration": "127.0.0.1" "Configuration": "127.0.0.1"

2
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/appsettings.json

@ -5,7 +5,7 @@
"RedirectAllowedUrls": "http://localhost:4200,https://localhost:44307" "RedirectAllowedUrls": "http://localhost:4200,https://localhost:44307"
}, },
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProjectName;Trusted_Connection=True;MultipleActiveResultSets=true" "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProjectName;Trusted_Connection=True"
}, },
"AuthServer": { "AuthServer": {
"Authority": "https://localhost:44305", "Authority": "https://localhost:44305",

2
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/appsettings.json

@ -5,7 +5,7 @@
"RedirectAllowedUrls": "http://localhost:4200,https://localhost:44307" "RedirectAllowedUrls": "http://localhost:4200,https://localhost:44307"
}, },
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProjectName;Trusted_Connection=True;MultipleActiveResultSets=true" "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProjectName;Trusted_Connection=True"
}, },
"Redis": { "Redis": {
"Configuration": "127.0.0.1" "Configuration": "127.0.0.1"

2
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/appsettings.json

@ -3,7 +3,7 @@
"SelfUrl": "https://localhost:44303" "SelfUrl": "https://localhost:44303"
}, },
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProjectName;Trusted_Connection=True;MultipleActiveResultSets=true" "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProjectName;Trusted_Connection=True"
}, },
"AuthServer": { "AuthServer": {
"Authority": "https://localhost:44303", "Authority": "https://localhost:44303",

14
templates/module/aspnet-core/docker-compose.override.yml

@ -11,19 +11,19 @@ services:
identity-server: identity-server:
environment: environment:
- ASPNETCORE_URLS=http://0.0.0.0:80 - ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionStrings__Default=Server=sqlserver;Database=MyProjectName_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false - ConnectionStrings__Default=Server=sqlserver;Database=MyProjectName_Identity;Trusted_Connection=True;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- ConnectionStrings__SqlServerCache=Server=sqlserver;Database=MyProjectName_Cache;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false - ConnectionStrings__SqlServerCache=Server=sqlserver;Database=MyProjectName_Cache;Trusted_Connection=True;User=sa;Password=yourStrong(!)Password;Integrated Security=false
ports: ports:
- "51600:80" - "51600:80"
my-project-name: my-project-name:
environment: environment:
- ASPNETCORE_URLS=http://0.0.0.0:80 - ASPNETCORE_URLS=http://0.0.0.0:80
- ConnectionStrings__Default=Server=sqlserver;Database=MyProjectName_ModuleDb;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false - ConnectionStrings__Default=Server=sqlserver;Database=MyProjectName_ModuleDb;Trusted_Connection=True;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- ConnectionStrings__AbpSettingManagement=Server=sqlserver;Database=MyProjectName_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false - ConnectionStrings__AbpSettingManagement=Server=sqlserver;Database=MyProjectName_Identity;Trusted_Connection=True;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- ConnectionStrings__AbpPermissionManagement=Server=sqlserver;Database=MyProjectName_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false - ConnectionStrings__AbpPermissionManagement=Server=sqlserver;Database=MyProjectName_Identity;Trusted_Connection=True;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- ConnectionStrings__AbpAuditLogging=Server=sqlserver;Database=MyProjectName_Identity;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false - ConnectionStrings__AbpAuditLogging=Server=sqlserver;Database=MyProjectName_Identity;Trusted_Connection=True;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- ConnectionStrings__SqlServerCache=Server=sqlserver;Database=MyProjectName_Cache;Trusted_Connection=True;MultipleActiveResultSets=true;User=sa;Password=yourStrong(!)Password;Integrated Security=false - ConnectionStrings__SqlServerCache=Server=sqlserver;Database=MyProjectName_Cache;Trusted_Connection=True;User=sa;Password=yourStrong(!)Password;Integrated Security=false
- AuthServer__Authority=http://identity-server - AuthServer__Authority=http://identity-server
ports: ports:
- "51601:80" - "51601:80"

4
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/appsettings.json

@ -3,8 +3,8 @@
"CorsOrigins": "https://*.MyProjectName.com,http://localhost:4200,http://localhost:44307,https://localhost:44307" "CorsOrigins": "https://*.MyProjectName.com,http://localhost:4200,http://localhost:44307,https://localhost:44307"
}, },
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProjectName_Main;Trusted_Connection=True;MultipleActiveResultSets=true", "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProjectName_Main;Trusted_Connection=True",
"MyProjectName": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProjectName_Module;Trusted_Connection=True;MultipleActiveResultSets=true" "MyProjectName": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProjectName_Module;Trusted_Connection=True"
}, },
"Redis": { "Redis": {
"Configuration": "127.0.0.1" "Configuration": "127.0.0.1"

2
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/appsettings.json

@ -5,7 +5,7 @@
}, },
"AppSelfUrl": "https://localhost:44301/", "AppSelfUrl": "https://localhost:44301/",
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProjectName_Main;Trusted_Connection=True;MultipleActiveResultSets=true" "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProjectName_Main;Trusted_Connection=True"
}, },
"Redis": { "Redis": {
"Configuration": "127.0.0.1" "Configuration": "127.0.0.1"

2
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/appsettings.json

@ -1,5 +1,5 @@
{ {
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProjectName_Unified;Trusted_Connection=True;MultipleActiveResultSets=true" "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=MyProjectName_Unified;Trusted_Connection=True"
} }
} }

2
test/AbpPerfTest/AbpPerfTest.WithAbp/appsettings.json

@ -8,6 +8,6 @@
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=AbpPerfTest_WithAbp;Trusted_Connection=True;MultipleActiveResultSets=true" "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=AbpPerfTest_WithAbp;Trusted_Connection=True"
} }
} }

2
test/AbpPerfTest/AbpPerfTest.WithoutAbp/appsettings.json

@ -8,6 +8,6 @@
}, },
"AllowedHosts": "*", "AllowedHosts": "*",
"ConnectionStrings": { "ConnectionStrings": {
"Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=AbpPerfTest_WithoutAbp;Trusted_Connection=True;MultipleActiveResultSets=true" "Default": "Server=(LocalDb)\\MSSQLLocalDB;Database=AbpPerfTest_WithoutAbp;Trusted_Connection=True"
} }
} }

Loading…
Cancel
Save