Browse Source

Merge branch 'aspnetcore-3.0' into dev

pull/1810/head
Halil İbrahim Kalkan 7 years ago
parent
commit
654eeede81
  1. 10
      common.test.props
  2. 4
      framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo.Abp.AspNetCore.Authentication.JwtBearer.csproj
  3. 27
      framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Properties/launchSettings.json
  4. 12
      framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Volo.Abp.AspNetCore.Authentication.OAuth.csproj
  5. 27
      framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Volo/Abp/AspNetCore/Authentication/OAuth/Claims/MultipleClaimAction.cs
  6. 27
      framework/src/Volo.Abp.AspNetCore.MultiTenancy/Properties/launchSettings.json
  7. 6
      framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo.Abp.AspNetCore.MultiTenancy.csproj
  8. 27
      framework/src/Volo.Abp.AspNetCore.Mvc.Client/Properties/launchSettings.json
  9. 6
      framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo.Abp.AspNetCore.Mvc.Client.csproj
  10. 7
      framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/CachedApplicationConfigurationClient.cs
  11. 116
      framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteTenantStore.cs
  12. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo.Abp.AspNetCore.Mvc.Contracts.csproj
  13. 14
      framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/MultiTenancy/FindTenantResultDto.cs
  14. 13
      framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/MultiTenancy/IAbpTenantAppService.cs
  15. 6
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj
  16. 27
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Properties/launchSettings.json
  17. 6
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj
  18. 5
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs
  19. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/Styles/StyleBundler.cs
  20. 6
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs
  21. 3
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs
  22. 3
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs
  23. 52
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantAppService.cs
  24. 37
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantController.cs
  25. 11
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/FindTenantResult.cs
  26. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj
  27. 27
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Properties/launchSettings.json
  28. 6
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo.Abp.AspNetCore.Mvc.UI.Packages.csproj
  29. 4
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj
  30. 8
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj
  31. 27
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Properties/launchSettings.json
  32. 6
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj
  33. 6
      framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj
  34. 16
      framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/AspNetCore/Builder/AbpAspNetCoreMvcApplicationBuilderExtensions.cs
  35. 27
      framework/src/Volo.Abp.AspNetCore.Mvc/Properties/launchSettings.json
  36. 10
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj
  37. 19
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
  38. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs
  39. 7
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/DependencyInjection/AbpAspNetCoreMvcConventionalDependencyRegistrar.cs
  40. 27
      framework/src/Volo.Abp.AspNetCore.TestBase/Properties/launchSettings.json
  41. 8
      framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj
  42. 9
      framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/DynamicProxying/AspNetCoreTestDynamicProxyHttpClientFactory.cs
  43. 12
      framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs
  44. 2
      framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Hosting/AbpHostingEnvironmentExtensions.cs
  45. 15
      framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestLocalizationMiddleware.cs
  46. 4
      framework/src/Volo.Abp.AspNetCore/Microsoft/Extensions/DependencyInjection/AbpAspNetCoreServiceCollectionExtensions.cs
  47. 27
      framework/src/Volo.Abp.AspNetCore/Properties/launchSettings.json
  48. 15
      framework/src/Volo.Abp.AspNetCore/Volo.Abp.AspNetCore.csproj
  49. 4
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/ApplicationInitializationContextExtensions.cs
  50. 6
      framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/WebContentFileProvider.cs
  51. 2
      framework/src/Volo.Abp.Authorization/Volo.Abp.Authorization.csproj
  52. 2
      framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationModule.cs
  53. 4
      framework/src/Volo.Abp.Caching/Volo.Abp.Caching.csproj
  54. 5
      framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/UpdateNuGetConfigStep.cs
  55. 2
      framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj
  56. 5
      framework/src/Volo.Abp.Core/Microsoft/Extensions/Configuration/ConfigurationBuilderOptions.cs
  57. 2
      framework/src/Volo.Abp.Core/Microsoft/Extensions/Configuration/ConfigurationHelper.cs
  58. 20
      framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj
  59. 19
      framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ConventionalRegistrarBase.cs
  60. 22
      framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/DefaultConventionalRegistrar.cs
  61. 2
      framework/src/Volo.Abp.Core/Volo/Abp/Modularity/IAbpModule.cs
  62. 2
      framework/src/Volo.Abp.Dapper/Volo.Abp.Dapper.csproj
  63. 6
      framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs
  64. 11
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedAggregateRoot.cs
  65. 11
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedAggregateRootWithUser.cs
  66. 11
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedEntity.cs
  67. 11
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedEntityWithUser.cs
  68. 11
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/CreationAuditedAggregateRoot.cs
  69. 11
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/CreationAuditedAggregateRootWithUser.cs
  70. 11
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/CreationAuditedEntity.cs
  71. 11
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/CreationAuditedEntityWithUser.cs
  72. 11
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedAggregateRoot.cs
  73. 11
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedAggregateRootWithUser.cs
  74. 11
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedEntity.cs
  75. 11
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedEntityWithUser.cs
  76. 9
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/DisableIdGenerationAttribute.cs
  77. 33
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Entity.cs
  78. 27
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/EntityHelper.cs
  79. 2
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/IEntity.cs
  80. 27
      framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Values/ValueObject.cs
  81. 2
      framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo.Abp.EntityFrameworkCore.MySQL.csproj
  82. 6
      framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj
  83. 4
      framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo.Abp.EntityFrameworkCore.SqlServer.csproj
  84. 4
      framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo.Abp.EntityFrameworkCore.Sqlite.csproj
  85. 6
      framework/src/Volo.Abp.EntityFrameworkCore/Volo.Abp.EntityFrameworkCore.csproj
  86. 4
      framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs
  87. 44
      framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs
  88. 12
      framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/IEfCoreDbContext.cs
  89. 14
      framework/src/Volo.Abp.FluentValidation/Volo/Abp/FluentValidation/AbpFluentValidationConventionalRegistrar.cs
  90. 27
      framework/src/Volo.Abp.Http.Client.IdentityModel/Properties/launchSettings.json
  91. 6
      framework/src/Volo.Abp.Http.Client.IdentityModel/Volo.Abp.Http.Client.IdentityModel.csproj
  92. 27
      framework/src/Volo.Abp.Http.Client/Properties/launchSettings.json
  93. 9
      framework/src/Volo.Abp.Http.Client/Volo.Abp.Http.Client.csproj
  94. 2
      framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs
  95. 2
      framework/src/Volo.Abp.Localization/Volo/Abp/Localization/VirtualFiles/VirtualFileLocalizationResourceContributorBase.cs
  96. 2
      framework/src/Volo.Abp.MailKit/Volo.Abp.MailKit.csproj
  97. 8
      framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs
  98. 35
      framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/Utf8JsonMemoryDbSerializer.cs
  99. 2
      framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj
  100. 19
      framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs

10
common.test.props

@ -0,0 +1,10 @@
<Project>
<PropertyGroup>
<LangVersion>latest</LangVersion>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
</PropertyGroup>
</Project>

4
framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo.Abp.AspNetCore.Authentication.JwtBearer.csproj

@ -3,7 +3,7 @@
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyName>Volo.Abp.AspNetCore.Authentication.JwtBearer</AssemblyName> <AssemblyName>Volo.Abp.AspNetCore.Authentication.JwtBearer</AssemblyName>
<PackageId>Volo.Abp.AspNetCore.Authentication.JwtBearer</PackageId> <PackageId>Volo.Abp.AspNetCore.Authentication.JwtBearer</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
@ -18,7 +18,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.0.0-preview9.19424.4" />
</ItemGroup> </ItemGroup>
</Project> </Project>

27
framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Properties/launchSettings.json

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:53450/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Volo.Abp.AspNetCore.Authentication.OAuth": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:53451/"
}
}
}

12
framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Volo.Abp.AspNetCore.Authentication.OAuth.csproj

@ -1,15 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyName>Volo.Abp.AspNetCore.Authentication.OAuth</AssemblyName> <AssemblyName>Volo.Abp.AspNetCore.Authentication.OAuth</AssemblyName>
<PackageId>Volo.Abp.AspNetCore.Authentication.OAuth</PackageId> <PackageId>Volo.Abp.AspNetCore.Authentication.OAuth</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<IsPackable>true</IsPackable>
<OutputType>Library</OutputType>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>
@ -17,8 +19,4 @@
<ProjectReference Include="..\Volo.Abp.Security\Volo.Abp.Security.csproj" /> <ProjectReference Include="..\Volo.Abp.Security\Volo.Abp.Security.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> </Project>
<PackageReference Include="Microsoft.AspNetCore.Authentication.OAuth" Version="2.2.0" />
</ItemGroup>
</Project>

27
framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Volo/Abp/AspNetCore/Authentication/OAuth/Claims/MultipleClaimAction.cs

@ -1,6 +1,6 @@
using System.Security.Claims; using System.Security.Claims;
using System.Text.Json;
using Microsoft.AspNetCore.Authentication.OAuth.Claims; using Microsoft.AspNetCore.Authentication.OAuth.Claims;
using Newtonsoft.Json.Linq;
namespace Volo.Abp.AspNetCore.Authentication.OAuth.Claims namespace Volo.Abp.AspNetCore.Authentication.OAuth.Claims
{ {
@ -9,31 +9,30 @@ namespace Volo.Abp.AspNetCore.Authentication.OAuth.Claims
public MultipleClaimAction(string claimType, string jsonKey) public MultipleClaimAction(string claimType, string jsonKey)
: base(claimType, jsonKey) : base(claimType, jsonKey)
{ {
} }
public override void Run(JObject userData, ClaimsIdentity identity, string issuer) public override void Run(JsonElement userData, ClaimsIdentity identity, string issuer)
{ {
var prop = userData?.Property(ValueType); var prop = userData.GetProperty(ValueType);
if (prop == null) if (prop.ValueKind == JsonValueKind.Null)
{ {
return; return;
} }
var propValue = prop.Value; switch (prop.ValueKind)
switch (propValue.Type)
{ {
case JTokenType.String: case JsonValueKind.String:
identity.AddClaim(new Claim(ClaimType, propValue.Value<string>(), ValueType, issuer)); identity.AddClaim(new Claim(ClaimType, prop.GetString(), ValueType, issuer));
break; break;
case JTokenType.Array: case JsonValueKind.Array:
foreach (var innterValue in propValue.Values<string>()) foreach (var arramItem in prop.EnumerateArray())
{ {
identity.AddClaim(new Claim(ClaimType, innterValue, ValueType, issuer)); identity.AddClaim(new Claim(ClaimType, arramItem.GetString(), ValueType, issuer));
} }
break; break;
default: default:
throw new AbpException("Unhandled JTokenType: " + propValue.Type); throw new AbpException("Unhandled JsonValueKind: " + prop.ValueKind);
} }
} }
} }

27
framework/src/Volo.Abp.AspNetCore.MultiTenancy/Properties/launchSettings.json

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:53760/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Volo.Abp.AspNetCore.MultiTenancy": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:53763/"
}
}
}

6
framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo.Abp.AspNetCore.MultiTenancy.csproj

@ -1,15 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyName>Volo.Abp.AspNetCore.MultiTenancy</AssemblyName> <AssemblyName>Volo.Abp.AspNetCore.MultiTenancy</AssemblyName>
<PackageId>Volo.Abp.AspNetCore.MultiTenancy</PackageId> <PackageId>Volo.Abp.AspNetCore.MultiTenancy</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<IsPackable>true</IsPackable>
<OutputType>Library</OutputType>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>

27
framework/src/Volo.Abp.AspNetCore.Mvc.Client/Properties/launchSettings.json

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:52302/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Volo.Abp.AspNetCore.Mvc.Client": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:52303/"
}
}
}

6
framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo.Abp.AspNetCore.Mvc.Client.csproj

@ -1,15 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyName>Volo.Abp.AspNetCore.Mvc.Client</AssemblyName> <AssemblyName>Volo.Abp.AspNetCore.Mvc.Client</AssemblyName>
<PackageId>Volo.Abp.AspNetCore.Mvc.Client</PackageId> <PackageId>Volo.Abp.AspNetCore.Mvc.Client</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<IsPackable>true</IsPackable>
<OutputType>Library</OutputType>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>

7
framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/CachedApplicationConfigurationClient.cs

@ -13,8 +13,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Client
{ {
public class CachedApplicationConfigurationClient : ICachedApplicationConfigurationClient, ITransientDependency public class CachedApplicationConfigurationClient : ICachedApplicationConfigurationClient, ITransientDependency
{ {
public IHttpContextAccessor HttpContextAccessor { get; set; } protected IHttpContextAccessor HttpContextAccessor { get; }
protected IHttpClientProxy<IAbpApplicationConfigurationAppService> Proxy { get; } protected IHttpClientProxy<IAbpApplicationConfigurationAppService> Proxy { get; }
protected ICurrentUser CurrentUser { get; } protected ICurrentUser CurrentUser { get; }
protected IDistributedCache<ApplicationConfigurationDto> Cache { get; } protected IDistributedCache<ApplicationConfigurationDto> Cache { get; }
@ -42,11 +41,11 @@ namespace Volo.Abp.AspNetCore.Mvc.Client
} }
configuration = await Cache.GetOrAddAsync( configuration = await Cache.GetOrAddAsync(
CreateCacheKey(), cacheKey,
async () => await Proxy.Service.GetAsync(), async () => await Proxy.Service.GetAsync(),
() => new DistributedCacheEntryOptions () => new DistributedCacheEntryOptions
{ {
AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(60) //TODO: Should be configurable. Default value should be higher (5 mins would be good). AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(120) //TODO: Should be configurable. Default value should be higher (5 mins would be good).
} }
); );

116
framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteTenantStore.cs

@ -0,0 +1,116 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Caching.Distributed;
using Volo.Abp.AspNetCore.Mvc.MultiTenancy;
using Volo.Abp.Caching;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Http.Client.DynamicProxying;
using Volo.Abp.MultiTenancy;
using Volo.Abp.Threading;
namespace Volo.Abp.AspNetCore.Mvc.Client
{
public class RemoteTenantStore : ITenantStore, ITransientDependency
{
protected IHttpClientProxy<IAbpTenantAppService> Proxy { get; }
protected IHttpContextAccessor HttpContextAccessor { get; }
protected IDistributedCache<TenantConfiguration> Cache { get; }
public RemoteTenantStore(
IHttpClientProxy<IAbpTenantAppService> proxy,
IHttpContextAccessor httpContextAccessor,
IDistributedCache<TenantConfiguration> cache)
{
Proxy = proxy;
HttpContextAccessor = httpContextAccessor;
Cache = cache;
}
public async Task<TenantConfiguration> FindAsync(string name)
{
var cacheKey = CreateCacheKey(name);
var httpContext = HttpContextAccessor?.HttpContext;
if (httpContext != null && httpContext.Items[cacheKey] is TenantConfiguration tenantConfiguration)
{
return tenantConfiguration;
}
tenantConfiguration = await Cache.GetOrAddAsync(
cacheKey,
async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByNameAsync(name)),
() => new DistributedCacheEntryOptions
{
AbsoluteExpirationRelativeToNow =
TimeSpan.FromMinutes(5) //TODO: Should be configurable.
}
);
if (httpContext != null)
{
httpContext.Items[cacheKey] = tenantConfiguration;
}
return tenantConfiguration;
}
public async Task<TenantConfiguration> FindAsync(Guid id)
{
var cacheKey = CreateCacheKey(id);
var httpContext = HttpContextAccessor?.HttpContext;
if (httpContext != null && httpContext.Items[cacheKey] is TenantConfiguration tenantConfiguration)
{
return tenantConfiguration;
}
tenantConfiguration = await Cache.GetOrAddAsync(
cacheKey,
async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByIdAsync(id)),
() => new DistributedCacheEntryOptions
{
AbsoluteExpirationRelativeToNow =
TimeSpan.FromMinutes(5) //TODO: Should be configurable.
}
);
if (httpContext != null)
{
httpContext.Items[cacheKey] = tenantConfiguration;
}
return tenantConfiguration;
}
public TenantConfiguration Find(string name)
{
return AsyncHelper.RunSync(() => FindAsync(name));
}
public TenantConfiguration Find(Guid id)
{
return AsyncHelper.RunSync(() => FindAsync(id));
}
protected virtual TenantConfiguration CreateTenantConfiguration(FindTenantResultDto tenantResultDto)
{
if (!tenantResultDto.Success || tenantResultDto.TenantId == null)
{
return null;
}
return new TenantConfiguration(tenantResultDto.TenantId.Value, tenantResultDto.Name);
}
protected virtual string CreateCacheKey(string tenantName)
{
return $"RemoteTenantStore_Name_{tenantName}";
}
protected virtual string CreateCacheKey(Guid tenantId)
{
return $"RemoteTenantStore_Id_{tenantId:N}";
}
}
}

2
framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo.Abp.AspNetCore.Mvc.Contracts.csproj

@ -3,7 +3,7 @@
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyName>Volo.Abp.AspNetCore.Mvc.Contracts</AssemblyName> <AssemblyName>Volo.Abp.AspNetCore.Mvc.Contracts</AssemblyName>
<PackageId>Volo.Abp.AspNetCore.Mvc.Contracts</PackageId> <PackageId>Volo.Abp.AspNetCore.Mvc.Contracts</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

14
framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/MultiTenancy/FindTenantResultDto.cs

@ -0,0 +1,14 @@
using System;
namespace Volo.Abp.AspNetCore.Mvc.MultiTenancy
{
[Serializable]
public class FindTenantResultDto
{
public bool Success { get; set; }
public Guid? TenantId { get; set; }
public string Name { get; set; }
}
}

13
framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/MultiTenancy/IAbpTenantAppService.cs

@ -0,0 +1,13 @@
using System;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
namespace Volo.Abp.AspNetCore.Mvc.MultiTenancy
{
public interface IAbpTenantAppService : IApplicationService
{
Task<FindTenantResultDto> FindTenantByNameAsync(string name);
Task<FindTenantResultDto> FindTenantByIdAsync(Guid id);
}
}

6
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj

@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Razor">
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyName>Volo.Abp.AspNetCore.Mvc.UI.Bootstrap</AssemblyName> <AssemblyName>Volo.Abp.AspNetCore.Mvc.UI.Bootstrap</AssemblyName>
<PackageId>Volo.Abp.AspNetCore.Mvc.UI.Bootstrap</PackageId> <PackageId>Volo.Abp.AspNetCore.Mvc.UI.Bootstrap</PackageId>
<IsPackable>true</IsPackable>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<IsPackable>true</IsPackable>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
</PropertyGroup> </PropertyGroup>

27
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Properties/launchSettings.json

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:53762/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Volo.Abp.AspNetCore.Mvc.UI.Bundling": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:53765/"
}
}
}

6
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj

@ -1,11 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk.Razor">
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyName>Volo.Abp.AspNetCore.Mvc.UI.Bundling</AssemblyName> <AssemblyName>Volo.Abp.AspNetCore.Mvc.UI.Bundling</AssemblyName>
<PackageId>Volo.Abp.AspNetCore.Mvc.UI.Bundling</PackageId> <PackageId>Volo.Abp.AspNetCore.Mvc.UI.Bundling</PackageId>
<IsPackable>true</IsPackable>
<OutputType>Library</OutputType>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>

5
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs

@ -4,6 +4,7 @@ using System.Collections.Immutable;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
@ -23,7 +24,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
protected readonly BundlingOptions Options; protected readonly BundlingOptions Options;
protected readonly BundleContributorOptions ContributorOptions; protected readonly BundleContributorOptions ContributorOptions;
protected readonly IWebContentFileProvider WebContentFileProvider; protected readonly IWebContentFileProvider WebContentFileProvider;
protected readonly IHostingEnvironment HostingEnvironment; protected readonly IWebHostEnvironment HostingEnvironment;
protected readonly IScriptBundler ScriptBundler; protected readonly IScriptBundler ScriptBundler;
protected readonly IStyleBundler StyleBundler; protected readonly IStyleBundler StyleBundler;
protected readonly IServiceProvider ServiceProvider; protected readonly IServiceProvider ServiceProvider;
@ -36,7 +37,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling
IOptions<BundleContributorOptions> contributorOptions, IOptions<BundleContributorOptions> contributorOptions,
IScriptBundler scriptBundler, IScriptBundler scriptBundler,
IStyleBundler styleBundler, IStyleBundler styleBundler,
IHostingEnvironment hostingEnvironment, IWebHostEnvironment hostingEnvironment,
IServiceProvider serviceProvider, IServiceProvider serviceProvider,
IDynamicFileProvider dynamicFileProvider, IDynamicFileProvider dynamicFileProvider,
IBundleCache bundleCache, IBundleCache bundleCache,

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/Styles/StyleBundler.cs

@ -8,10 +8,10 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.Styles
{ {
public class StyleBundler : BundlerBase, IStyleBundler public class StyleBundler : BundlerBase, IStyleBundler
{ {
private readonly IHostingEnvironment _hostingEnvironment; private readonly IWebHostEnvironment _hostingEnvironment;
public override string FileExtension => "css"; public override string FileExtension => "css";
public StyleBundler(IWebContentFileProvider webContentFileProvider, ICssMinifier minifier, IHostingEnvironment hostingEnvironment) public StyleBundler(IWebContentFileProvider webContentFileProvider, ICssMinifier minifier, IWebHostEnvironment hostingEnvironment)
: base(webContentFileProvider, minifier) : base(webContentFileProvider, minifier)
{ {
_hostingEnvironment = hostingEnvironment; _hostingEnvironment = hostingEnvironment;

6
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs

@ -19,14 +19,14 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
protected IBundleManager BundleManager { get; } protected IBundleManager BundleManager { get; }
protected IWebContentFileProvider WebContentFileProvider { get; } protected IWebContentFileProvider WebContentFileProvider { get; }
protected IHostingEnvironment HostingEnvironment { get; } protected IWebHostEnvironment HostingEnvironment { get; }
protected readonly BundlingOptions Options; protected readonly BundlingOptions Options;
protected AbpTagHelperResourceService( protected AbpTagHelperResourceService(
IBundleManager bundleManager, IBundleManager bundleManager,
IWebContentFileProvider webContentFileProvider, IWebContentFileProvider webContentFileProvider,
IOptions<BundlingOptions> options, IOptions<BundlingOptions> options,
IHostingEnvironment hostingEnvironment) IWebHostEnvironment hostingEnvironment)
{ {
BundleManager = bundleManager; BundleManager = bundleManager;
WebContentFileProvider = webContentFileProvider; WebContentFileProvider = webContentFileProvider;

3
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Razor.TagHelpers; using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Volo.Abp.AspNetCore.VirtualFileSystem; using Volo.Abp.AspNetCore.VirtualFileSystem;
@ -14,7 +15,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
IBundleManager bundleManager, IBundleManager bundleManager,
IWebContentFileProvider webContentFileProvider, IWebContentFileProvider webContentFileProvider,
IOptions<BundlingOptions> options, IOptions<BundlingOptions> options,
IHostingEnvironment hostingEnvironment IWebHostEnvironment hostingEnvironment
) : base( ) : base(
bundleManager, bundleManager,
webContentFileProvider, webContentFileProvider,

3
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Razor.TagHelpers; using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Volo.Abp.AspNetCore.VirtualFileSystem; using Volo.Abp.AspNetCore.VirtualFileSystem;
@ -14,7 +15,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers
IBundleManager bundleManager, IBundleManager bundleManager,
IWebContentFileProvider webContentFileProvider, IWebContentFileProvider webContentFileProvider,
IOptions<BundlingOptions> options, IOptions<BundlingOptions> options,
IHostingEnvironment hostingEnvironment IWebHostEnvironment hostingEnvironment
) : base( ) : base(
bundleManager, bundleManager,
webContentFileProvider, webContentFileProvider,

52
framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantAppService.cs

@ -0,0 +1,52 @@
using System;
using System.Threading.Tasks;
using Volo.Abp.Application.Services;
using Volo.Abp.AspNetCore.Mvc.MultiTenancy;
using Volo.Abp.MultiTenancy;
namespace Pages.Abp.MultiTenancy
{
public class AbpTenantAppService : ApplicationService, IAbpTenantAppService
{
protected ITenantStore TenantStore { get; }
public AbpTenantAppService(ITenantStore tenantStore)
{
TenantStore = tenantStore;
}
public async Task<FindTenantResultDto> FindTenantByNameAsync(string name)
{
var tenant = await TenantStore.FindAsync(name);
if (tenant == null)
{
return new FindTenantResultDto { Success = false };
}
return new FindTenantResultDto
{
Success = true,
TenantId = tenant.Id,
Name = tenant.Name
};
}
public async Task<FindTenantResultDto> FindTenantByIdAsync(Guid id)
{
var tenant = await TenantStore.FindAsync(id);
if (tenant == null)
{
return new FindTenantResultDto { Success = false };
}
return new FindTenantResultDto
{
Success = true,
TenantId = tenant.Id,
Name = tenant.Name
};
}
}
}

37
framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantController.cs

@ -1,37 +1,34 @@
using System.Threading.Tasks; using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc;
using Volo.Abp.MultiTenancy; using Volo.Abp.AspNetCore.Mvc.MultiTenancy;
namespace Pages.Abp.MultiTenancy namespace Pages.Abp.MultiTenancy
{ {
[Route("api/abp/multi-tenancy")] [Route("api/abp/multi-tenancy")]
public class AbpTenantController : AbpController public class AbpTenantController : AbpController, IAbpTenantAppService
{ {
private readonly IAbpTenantAppService _abpTenantAppService;
protected ITenantStore TenantStore { get; } public AbpTenantController(IAbpTenantAppService abpTenantAppService)
public AbpTenantController(ITenantStore tenantStore)
{ {
TenantStore = tenantStore; _abpTenantAppService = abpTenantAppService;
} }
[HttpGet] [HttpGet]
[Route("find-tenant/{name}")] [Route("find-tenant/{name}")] //TODO: Remove on v1.0
public async Task<FindTenantResult> FindTenantAsync(string name) [Route("tenants/by-name/{name}")]
public async Task<FindTenantResultDto> FindTenantByNameAsync(string name)
{ {
var tenant = await TenantStore.FindAsync(name); return await _abpTenantAppService.FindTenantByNameAsync(name);
}
if (tenant == null)
{
return new FindTenantResult{Success = false};
}
return new FindTenantResult [HttpGet]
{ [Route("tenants/by-id/{id}")]
Success = true, public async Task<FindTenantResultDto> FindTenantByIdAsync(Guid id)
TenantId = tenant.Id {
}; return await _abpTenantAppService.FindTenantByIdAsync(id);
} }
} }
} }

11
framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/FindTenantResult.cs

@ -1,11 +0,0 @@
using System;
namespace Pages.Abp.MultiTenancy
{
public class FindTenantResult
{
public bool Success { get; set; }
public Guid? TenantId { get; set; }
}
}

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj

@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Razor">
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyName>Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy</AssemblyName> <AssemblyName>Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy</AssemblyName>
<PackageId>Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy</PackageId> <PackageId>Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

27
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Properties/launchSettings.json

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:53766/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Volo.Abp.AspNetCore.Mvc.UI.Packages": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:53768/"
}
}
}

6
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo.Abp.AspNetCore.Mvc.UI.Packages.csproj

@ -1,11 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk.Razor">
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyName>Volo.Abp.AspNetCore.Mvc.UI.Packages</AssemblyName> <AssemblyName>Volo.Abp.AspNetCore.Mvc.UI.Packages</AssemblyName>
<PackageId>Volo.Abp.AspNetCore.Mvc.UI.Packages</PackageId> <PackageId>Volo.Abp.AspNetCore.Mvc.UI.Packages</PackageId>
<IsPackable>true</IsPackable>
<OutputType>Library</OutputType>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>

4
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj

@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Razor">
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyName>Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic</AssemblyName> <AssemblyName>Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic</AssemblyName>
<PackageId>Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic</PackageId> <PackageId>Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

8
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj

@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Razor">
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyName>Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared</AssemblyName> <AssemblyName>Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared</AssemblyName>
<PackageId>Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared</PackageId> <PackageId>Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
@ -32,10 +32,6 @@
<None Include="Properties\launchSettings.json" /> <None Include="Properties\launchSettings.json" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="2.2.0" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Volo.Abp.AspNetCore.Mvc.UI.Bootstrap\Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj" /> <ProjectReference Include="..\Volo.Abp.AspNetCore.Mvc.UI.Bootstrap\Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj" />
<ProjectReference Include="..\Volo.Abp.AspNetCore.Mvc.UI.Packages\Volo.Abp.AspNetCore.Mvc.UI.Packages.csproj" /> <ProjectReference Include="..\Volo.Abp.AspNetCore.Mvc.UI.Packages\Volo.Abp.AspNetCore.Mvc.UI.Packages.csproj" />

27
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Properties/launchSettings.json

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:53761/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Volo.Abp.AspNetCore.Mvc.UI.Widgets": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:53764/"
}
}
}

6
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj

@ -1,11 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk.Razor">
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyName>Volo.Abp.AspNetCore.Mvc.UI.Widgets</AssemblyName> <AssemblyName>Volo.Abp.AspNetCore.Mvc.UI.Widgets</AssemblyName>
<PackageId>Volo.Abp.AspNetCore.Mvc.UI.Widgets</PackageId> <PackageId>Volo.Abp.AspNetCore.Mvc.UI.Widgets</PackageId>
<IsPackable>true</IsPackable>
<OutputType>Library</OutputType>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>

6
framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj

@ -1,12 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk.Razor">
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyName>Volo.Abp.AspNetCore.Mvc.UI</AssemblyName> <AssemblyName>Volo.Abp.AspNetCore.Mvc.UI</AssemblyName>
<PackageId>Volo.Abp.AspNetCore.Mvc.UI</PackageId> <PackageId>Volo.Abp.AspNetCore.Mvc.UI</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<IsPackable>true</IsPackable>
<OutputType>Library</OutputType>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>

16
framework/src/Volo.Abp.AspNetCore.Mvc/Microsoft/AspNetCore/Builder/AbpAspNetCoreMvcApplicationBuilderExtensions.cs

@ -17,19 +17,15 @@ namespace Microsoft.AspNetCore.Builder
/// <returns>A reference to this instance after the operation has completed.</returns> /// <returns>A reference to this instance after the operation has completed.</returns>
public static IApplicationBuilder UseMvcWithDefaultRouteAndArea( public static IApplicationBuilder UseMvcWithDefaultRouteAndArea(
this IApplicationBuilder app, this IApplicationBuilder app,
Action<IRouteBuilder> additionalConfigurationAction = null) Action<IEndpointRouteBuilder> additionalConfigurationAction = null)
{ {
return app.UseMvc(routes => return app.UseEndpoints(endpoints =>
{ {
routes.MapRoute( endpoints.MapControllerRoute("defaultWithArea", "{area}/{controller=Home}/{action=Index}/{id?}");
name: "defaultWithArea", endpoints.MapControllerRoute("default", "{controller=Home}/{action=Index}/{id?}");
template: "{area}/{controller=Home}/{action=Index}/{id?}"); endpoints.MapRazorPages();
routes.MapRoute( additionalConfigurationAction?.Invoke(endpoints);
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
additionalConfigurationAction?.Invoke(routes);
}); });
} }
} }

27
framework/src/Volo.Abp.AspNetCore.Mvc/Properties/launchSettings.json

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:53767/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Volo.Abp.AspNetCore.Mvc": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:53769/"
}
}
}

10
framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj

@ -1,15 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk.Razor">
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyName>Volo.Abp.AspNetCore.Mvc</AssemblyName> <AssemblyName>Volo.Abp.AspNetCore.Mvc</AssemblyName>
<PackageId>Volo.Abp.AspNetCore.Mvc</PackageId> <PackageId>Volo.Abp.AspNetCore.Mvc</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<IsPackable>true</IsPackable>
<OutputType>Library</OutputType>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>
@ -22,8 +24,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="3.0.0-preview9.19424.4" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="3.1.5" /> <PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="4.0.0-preview8.19405.7" />
</ItemGroup> </ItemGroup>
</Project> </Project>

19
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs

@ -3,12 +3,11 @@ using Microsoft.AspNetCore.Mvc.ApplicationParts;
using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Mvc.Infrastructure;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.Mvc.ViewComponents; using Microsoft.AspNetCore.Mvc.ViewComponents;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Newtonsoft.Json.Serialization; using Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -16,7 +15,6 @@ using System.Reflection;
using Volo.Abp.ApiVersioning; using Volo.Abp.ApiVersioning;
using Volo.Abp.AspNetCore.Mvc.Conventions; using Volo.Abp.AspNetCore.Mvc.Conventions;
using Volo.Abp.AspNetCore.Mvc.DependencyInjection; using Volo.Abp.AspNetCore.Mvc.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc.Json;
using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.VirtualFileSystem; using Volo.Abp.AspNetCore.VirtualFileSystem;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
@ -45,8 +43,8 @@ namespace Volo.Abp.AspNetCore.Mvc
{ {
//Configure Razor //Configure Razor
context.Services.Insert(0, context.Services.Insert(0,
ServiceDescriptor.Singleton<IConfigureOptions<RazorViewEngineOptions>>( ServiceDescriptor.Singleton<IConfigureOptions<MvcRazorRuntimeCompilationOptions>>(
new ConfigureOptions<RazorViewEngineOptions>(options => new ConfigureOptions<MvcRazorRuntimeCompilationOptions>(options =>
{ {
options.FileProviders.Add( options.FileProviders.Add(
new RazorViewEngineVirtualFileProvider( new RazorViewEngineVirtualFileProvider(
@ -78,6 +76,7 @@ namespace Volo.Abp.AspNetCore.Mvc
); );
var mvcBuilder = context.Services.AddMvc() var mvcBuilder = context.Services.AddMvc()
.AddRazorRuntimeCompilation()
.AddDataAnnotationsLocalization(options => .AddDataAnnotationsLocalization(options =>
{ {
@ -86,7 +85,7 @@ namespace Volo.Abp.AspNetCore.Mvc
var resourceType = abpMvcDataAnnotationsLocalizationOptions.AssemblyResources.GetOrDefault(type.Assembly); var resourceType = abpMvcDataAnnotationsLocalizationOptions.AssemblyResources.GetOrDefault(type.Assembly);
return factory.Create(resourceType ?? type); return factory.Create(resourceType ?? type);
}; };
}) })
.AddViewLocalization(); //TODO: How to configure from the application? Also, consider to move to a UI module since APIs does not care about it. .AddViewLocalization(); //TODO: How to configure from the application? Also, consider to move to a UI module since APIs does not care about it.
context.Services.ExecutePreConfiguredActions(mvcBuilder); context.Services.ExecutePreConfiguredActions(mvcBuilder);
@ -112,10 +111,10 @@ namespace Volo.Abp.AspNetCore.Mvc
mvcOptions.AddAbp(context.Services); mvcOptions.AddAbp(context.Services);
}); });
Configure<MvcJsonOptions>(jsonOptions => //Configure<MvcJsonOptions>(jsonOptions => @3.0.0!
{ //{
jsonOptions.SerializerSettings.ContractResolver = new AbpMvcJsonContractResolver(context.Services); // jsonOptions.SerializerSettings.ContractResolver = new AbpMvcJsonContractResolver(context.Services);
}); //});
} }
public override void OnApplicationInitialization(ApplicationInitializationContext context) public override void OnApplicationInitialization(ApplicationInitializationContext context)

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs

@ -4,8 +4,8 @@ using System.Linq;
using System.Reflection; using System.Reflection;
using JetBrains.Annotations; using JetBrains.Annotations;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ActionConstraints;
using Microsoft.AspNetCore.Mvc.ApplicationModels; using Microsoft.AspNetCore.Mvc.ApplicationModels;
using Microsoft.AspNetCore.Mvc.Internal;
using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Volo.Abp.Application.Services; using Volo.Abp.Application.Services;

7
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/DependencyInjection/AbpAspNetCoreMvcConventionalDependencyRegistrar.cs

@ -7,10 +7,15 @@ using Volo.Abp.DependencyInjection;
namespace Volo.Abp.AspNetCore.Mvc.DependencyInjection namespace Volo.Abp.AspNetCore.Mvc.DependencyInjection
{ {
public class AbpAspNetCoreMvcConventionalRegistrar : DefaultConventionalRegistrar public class AbpAspNetCoreMvcConventionalRegistrar : ConventionalRegistrarBase
{ {
public override void AddType(IServiceCollection services, Type type) public override void AddType(IServiceCollection services, Type type)
{ {
if (IsConventionalRegistrationDisabled(type))
{
return;
}
if (!IsMvcService(type)) if (!IsMvcService(type))
{ {
return; return;

27
framework/src/Volo.Abp.AspNetCore.TestBase/Properties/launchSettings.json

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:53783/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Volo.Abp.AspNetCore.TestBase": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:53784/"
}
}
}

8
framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj

@ -1,15 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyName>Volo.Abp.AspNetCore.TestBase</AssemblyName> <AssemblyName>Volo.Abp.AspNetCore.TestBase</AssemblyName>
<PackageId>Volo.Abp.AspNetCore.TestBase</PackageId> <PackageId>Volo.Abp.AspNetCore.TestBase</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<IsPackable>true</IsPackable>
<OutputType>Library</OutputType>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>
@ -20,7 +22,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.TestHost" Version="3.0.0-preview9.19424.4" />
</ItemGroup> </ItemGroup>
</Project> </Project>

9
framework/src/Volo.Abp.AspNetCore.TestBase/Volo/Abp/AspNetCore/TestBase/DynamicProxying/AspNetCoreTestDynamicProxyHttpClientFactory.cs

@ -8,11 +8,11 @@ namespace Volo.Abp.AspNetCore.TestBase.DynamicProxying
public class AspNetCoreTestDynamicProxyHttpClientFactory : IDynamicProxyHttpClientFactory, ITransientDependency public class AspNetCoreTestDynamicProxyHttpClientFactory : IDynamicProxyHttpClientFactory, ITransientDependency
{ {
private readonly ITestServerAccessor _testServerAccessor; private readonly ITestServerAccessor _testServerAccessor;
private readonly IHttpClientFactory _httpClientFactory;
public AspNetCoreTestDynamicProxyHttpClientFactory(ITestServerAccessor testServerAccessor, IHttpClientFactory httpClientFactory) { public AspNetCoreTestDynamicProxyHttpClientFactory(
ITestServerAccessor testServerAccessor)
{
_testServerAccessor = testServerAccessor; _testServerAccessor = testServerAccessor;
_httpClientFactory = httpClientFactory;
} }
public HttpClient Create() public HttpClient Create()
@ -20,7 +20,8 @@ namespace Volo.Abp.AspNetCore.TestBase.DynamicProxying
return _testServerAccessor.Server.CreateClient(); return _testServerAccessor.Server.CreateClient();
} }
public HttpClient Create(string name) { public HttpClient Create(string name)
{
return Create(); return Create();
} }
} }

12
framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs

@ -1,9 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using JetBrains.Annotations; using JetBrains.Annotations;
using Microsoft.AspNetCore.Localization;
using Microsoft.AspNetCore.RequestLocalization; using Microsoft.AspNetCore.RequestLocalization;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Volo.Abp; using Volo.Abp;
@ -12,9 +8,6 @@ using Volo.Abp.AspNetCore.Mvc.ExceptionHandling;
using Volo.Abp.AspNetCore.Tracing; using Volo.Abp.AspNetCore.Tracing;
using Volo.Abp.AspNetCore.Uow; using Volo.Abp.AspNetCore.Uow;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Localization;
using Volo.Abp.Settings;
using Volo.Abp.Threading;
namespace Microsoft.AspNetCore.Builder namespace Microsoft.AspNetCore.Builder
{ {
@ -51,7 +44,10 @@ namespace Microsoft.AspNetCore.Builder
public static IApplicationBuilder UseAbpRequestLocalization(this IApplicationBuilder app, Action<RequestLocalizationOptions> optionsAction = null) public static IApplicationBuilder UseAbpRequestLocalization(this IApplicationBuilder app, Action<RequestLocalizationOptions> optionsAction = null)
{ {
app.ApplicationServices.GetRequiredService<IAbpRequestLocalizationOptionsProvider>().InitLocalizationOptions(optionsAction); app.ApplicationServices
.GetRequiredService<IAbpRequestLocalizationOptionsProvider>()
.InitLocalizationOptions(optionsAction);
return app.UseMiddleware<AbpRequestLocalizationMiddleware>(); return app.UseMiddleware<AbpRequestLocalizationMiddleware>();
} }

2
framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Hosting/AbpHostingEnvironmentExtensions.cs

@ -6,7 +6,7 @@ namespace Microsoft.AspNetCore.Hosting
public static class AbpHostingEnvironmentExtensions public static class AbpHostingEnvironmentExtensions
{ {
public static IConfigurationRoot BuildConfiguration( public static IConfigurationRoot BuildConfiguration(
this IHostingEnvironment env, this IWebHostEnvironment env,
ConfigurationBuilderOptions options = null) ConfigurationBuilderOptions options = null)
{ {
options = options ?? new ConfigurationBuilderOptions(); options = options ?? new ConfigurationBuilderOptions();

15
framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestLocalizationMiddleware.cs

@ -1,6 +1,8 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Localization; using Microsoft.AspNetCore.Localization;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
@ -9,17 +11,24 @@ namespace Microsoft.AspNetCore.RequestLocalization
public class AbpRequestLocalizationMiddleware : IMiddleware, ITransientDependency public class AbpRequestLocalizationMiddleware : IMiddleware, ITransientDependency
{ {
private readonly IAbpRequestLocalizationOptionsProvider _requestLocalizationOptionsProvider; private readonly IAbpRequestLocalizationOptionsProvider _requestLocalizationOptionsProvider;
private readonly ILoggerFactory _loggerFactory;
public AbpRequestLocalizationMiddleware( public AbpRequestLocalizationMiddleware(
IAbpRequestLocalizationOptionsProvider requestLocalizationOptionsProvider) IAbpRequestLocalizationOptionsProvider requestLocalizationOptionsProvider,
ILoggerFactory loggerFactory)
{ {
_requestLocalizationOptionsProvider = requestLocalizationOptionsProvider; _requestLocalizationOptionsProvider = requestLocalizationOptionsProvider;
_loggerFactory = loggerFactory;
} }
public async Task InvokeAsync(HttpContext context, RequestDelegate next) public async Task InvokeAsync(HttpContext context, RequestDelegate next)
{ {
var options = Options.Create(_requestLocalizationOptionsProvider.GetLocalizationOptions()); var middleware = new RequestLocalizationMiddleware(
var middleware = new RequestLocalizationMiddleware(next, options); next,
new OptionsWrapper<RequestLocalizationOptions>(_requestLocalizationOptionsProvider.GetLocalizationOptions()),
_loggerFactory
);
await middleware.Invoke(context); await middleware.Invoke(context);
} }
} }

4
framework/src/Volo.Abp.AspNetCore/Microsoft/Extensions/DependencyInjection/AbpAspNetCoreServiceCollectionExtensions.cs

@ -5,9 +5,9 @@ namespace Microsoft.Extensions.DependencyInjection
{ {
public static class AbpAspNetCoreServiceCollectionExtensions public static class AbpAspNetCoreServiceCollectionExtensions
{ {
public static IHostingEnvironment GetHostingEnvironment(this IServiceCollection services) public static IWebHostEnvironment GetHostingEnvironment(this IServiceCollection services)
{ {
return services.GetSingletonInstance<IHostingEnvironment>(); return services.GetSingletonInstance<IWebHostEnvironment>();
} }
public static IConfigurationRoot BuildConfiguration(this IServiceCollection services, ConfigurationBuilderOptions options = null) public static IConfigurationRoot BuildConfiguration(this IServiceCollection services, ConfigurationBuilderOptions options = null)

27
framework/src/Volo.Abp.AspNetCore/Properties/launchSettings.json

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:53374/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Volo.Abp.AspNetCore": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:53375/"
}
}
}

15
framework/src/Volo.Abp.AspNetCore/Volo.Abp.AspNetCore.csproj

@ -1,15 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyName>Volo.Abp.AspNetCore</AssemblyName> <AssemblyName>Volo.Abp.AspNetCore</AssemblyName>
<PackageId>Volo.Abp.AspNetCore</PackageId> <PackageId>Volo.Abp.AspNetCore</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<IsPackable>true</IsPackable>
<OutputType>Library</OutputType>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>
@ -26,13 +28,4 @@
<ProjectReference Include="..\Volo.Abp.VirtualFileSystem\Volo.Abp.VirtualFileSystem.csproj" /> <ProjectReference Include="..\Volo.Abp.VirtualFileSystem\Volo.Abp.VirtualFileSystem.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Routing.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Localization" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Cors" Version="2.2.0" />
</ItemGroup>
</Project> </Project>

4
framework/src/Volo.Abp.AspNetCore/Volo/Abp/ApplicationInitializationContextExtensions.cs

@ -13,9 +13,9 @@ namespace Volo.Abp
return context.ServiceProvider.GetRequiredService<IObjectAccessor<IApplicationBuilder>>().Value; return context.ServiceProvider.GetRequiredService<IObjectAccessor<IApplicationBuilder>>().Value;
} }
public static IHostingEnvironment GetEnvironment(this ApplicationInitializationContext context) public static IWebHostEnvironment GetEnvironment(this ApplicationInitializationContext context)
{ {
return context.ServiceProvider.GetRequiredService<IHostingEnvironment>(); return context.ServiceProvider.GetRequiredService<IWebHostEnvironment>();
} }
public static ILoggerFactory GetLoggerFactory(this ApplicationInitializationContext context) public static ILoggerFactory GetLoggerFactory(this ApplicationInitializationContext context)

6
framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/VirtualFileSystem/WebContentFileProvider.cs

@ -14,14 +14,14 @@ namespace Volo.Abp.AspNetCore.VirtualFileSystem
{ {
private readonly IVirtualFileProvider _virtualFileProvider; private readonly IVirtualFileProvider _virtualFileProvider;
private readonly IFileProvider _fileProvider; private readonly IFileProvider _fileProvider;
private readonly IHostingEnvironment _hostingEnvironment; private readonly IWebHostEnvironment _hostingEnvironment;
private string _rootPath = "/wwwroot"; //TODO: How to handle wwwroot naming? private string _rootPath = "/wwwroot"; //TODO: How to handle wwwroot naming?
protected AspNetCoreContentOptions Options { get; } protected AspNetCoreContentOptions Options { get; }
public WebContentFileProvider( public WebContentFileProvider(
IVirtualFileProvider virtualFileProvider, IVirtualFileProvider virtualFileProvider,
IHostingEnvironment hostingEnvironment, IWebHostEnvironment hostingEnvironment,
IOptions<AspNetCoreContentOptions> options) IOptions<AspNetCoreContentOptions> options)
{ {
_virtualFileProvider = virtualFileProvider; _virtualFileProvider = virtualFileProvider;

2
framework/src/Volo.Abp.Authorization/Volo.Abp.Authorization.csproj

@ -14,7 +14,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="2.2.0" /> <PackageReference Include="Microsoft.AspNetCore.Authorization" Version="3.0.0-preview9.19424.4" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

2
framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationModule.cs

@ -25,7 +25,7 @@ namespace Volo.Abp.Authorization
public override void ConfigureServices(ServiceConfigurationContext context) public override void ConfigureServices(ServiceConfigurationContext context)
{ {
context.Services.AddAuthorization(); context.Services.AddAuthorizationCore();
context.Services.AddSingleton<IAuthorizationHandler, PermissionRequirementHandler>(); context.Services.AddSingleton<IAuthorizationHandler, PermissionRequirementHandler>();

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

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
@ -14,7 +14,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="2.2.0" /> <PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="3.0.0-preview9.19423.4" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

5
framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/UpdateNuGetConfigStep.cs

@ -29,7 +29,10 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.App
return; return;
} }
file.ReplaceText("{api-key}", apiKey); const string placeHolder = "<!-- {ABP_COMMERCIAL_NUGET_SOURCE} -->";
var nugetSourceTag = $"<add key=\"ABP Commercial NuGet Source\" value=\"https://nuget.abp.io/{apiKey}/v3/index.json\" />";
file.ReplaceText(placeHolder, nugetSourceTag);
} }
} }
} }

2
framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj

@ -4,7 +4,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.2</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<PackAsTool>true</PackAsTool> <PackAsTool>true</PackAsTool>
<ToolCommandName>abp</ToolCommandName> <ToolCommandName>abp</ToolCommandName>
<RootNamespace /> <RootNamespace />

5
framework/src/Volo.Abp.Core/Microsoft/Extensions/Configuration/ConfigurationBuilderOptions.cs

@ -30,5 +30,10 @@ namespace Microsoft.Extensions.Configuration
/// Base path to read the configuration file indicated by <see cref="FileName"/>. /// Base path to read the configuration file indicated by <see cref="FileName"/>.
/// </summary> /// </summary>
public string BasePath { get; set; } public string BasePath { get; set; }
/// <summary>
/// Prefix for the environment variables.
/// </summary>
public string EnvironmentVariablesPrefix { get; set; }
} }
} }

2
framework/src/Volo.Abp.Core/Microsoft/Extensions/Configuration/ConfigurationHelper.cs

@ -23,7 +23,7 @@ namespace Microsoft.Extensions.Configuration
builder = builder.AddJsonFile($"{options.FileName}.{options.EnvironmentName}.json", optional: true, reloadOnChange: true); builder = builder.AddJsonFile($"{options.FileName}.{options.EnvironmentName}.json", optional: true, reloadOnChange: true);
} }
builder = builder.AddEnvironmentVariables(); builder = builder.AddEnvironmentVariables(options.EnvironmentVariablesPrefix);
if (options.EnvironmentName == "Development") if (options.EnvironmentName == "Development")
{ {

20
framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj

@ -11,18 +11,18 @@
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" /> <PackageReference Include="System.ComponentModel.Annotations" Version="4.6.0-preview9.19421.4" />
<PackageReference Include="System.Collections.Immutable" Version="1.5.0" /> <PackageReference Include="System.Collections.Immutable" Version="1.6.0-preview9.19421.4" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="3.0.0-preview9.19423.4" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.0-preview9.19423.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="3.0.0-preview9.19423.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="3.0.0-preview9.19423.4" />
<PackageReference Include="Microsoft.Extensions.Options" Version="3.0.0-preview9.19423.4" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="3.0.0-preview9.19423.4" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.0.0-preview9.19423.4" />
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" /> <PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.0.18" /> <PackageReference Include="System.Linq.Dynamic.Core" Version="1.0.19" />
<PackageReference Include="System.Linq.Queryable" Version="4.3.0" /> <PackageReference Include="System.Linq.Queryable" Version="4.3.0" />
<PackageReference Include="Microsoft.Extensions.Localization" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.2.4" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" />
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" /> <PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
<PackageReference Include="Nito.AsyncEx.Coordination" Version="5.0.0" /> <PackageReference Include="Nito.AsyncEx.Coordination" Version="5.0.0" />
<PackageReference Include="Nito.AsyncEx.Context" Version="5.0.0" /> <PackageReference Include="Nito.AsyncEx.Context" Version="5.0.0" />

19
framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/ConventionalRegistrarBase.cs

@ -1,4 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@ -31,5 +32,23 @@ namespace Volo.Abp.DependencyInjection
} }
public abstract void AddType(IServiceCollection services, Type type); public abstract void AddType(IServiceCollection services, Type type);
protected virtual bool IsConventionalRegistrationDisabled(Type type)
{
return type.IsDefined(typeof(DisableConventionalRegistrationAttribute), true);
}
protected virtual void TriggerServiceExposing(IServiceCollection services, Type implementationType, List<Type> serviceTypes)
{
var exposeActions = services.GetExposingActionList();
if (exposeActions.Any())
{
var args = new OnServiceExposingContext(implementationType, serviceTypes);
foreach (var action in exposeActions)
{
action(args);
}
}
}
} }
} }

22
framework/src/Volo.Abp.Core/Volo/Abp/DependencyInjection/DefaultConventionalRegistrar.cs

@ -1,6 +1,4 @@
using System; using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection; using System.Reflection;
using JetBrains.Annotations; using JetBrains.Annotations;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@ -48,25 +46,7 @@ namespace Volo.Abp.DependencyInjection
} }
} }
} }
protected virtual void TriggerServiceExposing(IServiceCollection services, Type type, List<Type> serviceTypes)
{
var exposeActions = services.GetExposingActionList();
if (exposeActions.Any())
{
var args = new OnServiceExposingContext(type, serviceTypes);
foreach (var action in exposeActions)
{
action(args);
}
}
}
protected virtual bool IsConventionalRegistrationDisabled(Type type)
{
return type.IsDefined(typeof(DisableConventionalRegistrationAttribute), true);
}
protected virtual DependencyAttribute GetDependencyAttributeOrNull(Type type) protected virtual DependencyAttribute GetDependencyAttributeOrNull(Type type)
{ {
return type.GetCustomAttribute<DependencyAttribute>(true); return type.GetCustomAttribute<DependencyAttribute>(true);

2
framework/src/Volo.Abp.Core/Volo/Abp/Modularity/IAbpModule.cs

@ -2,7 +2,7 @@
namespace Volo.Abp.Modularity namespace Volo.Abp.Modularity
{ {
public interface IAbpModule : ISingletonDependency public interface IAbpModule
{ {
void ConfigureServices(ServiceConfigurationContext context); void ConfigureServices(ServiceConfigurationContext context);
} }

2
framework/src/Volo.Abp.Dapper/Volo.Abp.Dapper.csproj

@ -3,7 +3,7 @@
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>Volo.Abp.Dapper</AssemblyName> <AssemblyName>Volo.Abp.Dapper</AssemblyName>
<PackageId>Volo.Abp.Dapper</PackageId> <PackageId>Volo.Abp.Dapper</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

6
framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs

@ -289,7 +289,11 @@ namespace Volo.Abp.Application.Services
return; return;
} }
entityWithGuidId.Id = GuidGenerator.Create(); EntityHelper.TrySetId(
entityWithGuidId,
() => GuidGenerator.Create(),
true
);
} }
/// <summary> /// <summary>

11
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedAggregateRoot.cs

@ -28,5 +28,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
/// <inheritdoc /> /// <inheritdoc />
public virtual Guid? LastModifierId { get; set; } public virtual Guid? LastModifierId { get; set; }
protected AuditedAggregateRoot()
{
}
protected AuditedAggregateRoot(TKey id)
: base(id)
{
}
} }
} }

11
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedAggregateRootWithUser.cs

@ -32,5 +32,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
/// <inheritdoc /> /// <inheritdoc />
public virtual TUser LastModifier { get; set; } public virtual TUser LastModifier { get; set; }
protected AuditedAggregateRootWithUser()
{
}
protected AuditedAggregateRootWithUser(TKey id)
: base(id)
{
}
} }
} }

11
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedEntity.cs

@ -28,5 +28,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
/// <inheritdoc /> /// <inheritdoc />
public virtual Guid? LastModifierId { get; set; } public virtual Guid? LastModifierId { get; set; }
protected AuditedEntity()
{
}
protected AuditedEntity(TKey id)
: base(id)
{
}
} }
} }

11
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/AuditedEntityWithUser.cs

@ -32,5 +32,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
/// <inheritdoc /> /// <inheritdoc />
public virtual TUser LastModifier { get; set; } public virtual TUser LastModifier { get; set; }
protected AuditedEntityWithUser()
{
}
protected AuditedEntityWithUser(TKey id)
: base(id)
{
}
} }
} }

11
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/CreationAuditedAggregateRoot.cs

@ -28,5 +28,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
/// <inheritdoc /> /// <inheritdoc />
public virtual Guid? CreatorId { get; set; } public virtual Guid? CreatorId { get; set; }
protected CreationAuditedAggregateRoot()
{
}
protected CreationAuditedAggregateRoot(TKey id)
: base(id)
{
}
} }
} }

11
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/CreationAuditedAggregateRootWithUser.cs

@ -24,5 +24,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
{ {
/// <inheritdoc /> /// <inheritdoc />
public virtual TUser Creator { get; set; } public virtual TUser Creator { get; set; }
protected CreationAuditedAggregateRootWithUser()
{
}
protected CreationAuditedAggregateRootWithUser(TKey id)
: base(id)
{
}
} }
} }

11
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/CreationAuditedEntity.cs

@ -28,5 +28,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
/// <inheritdoc /> /// <inheritdoc />
public virtual Guid? CreatorId { get; set; } public virtual Guid? CreatorId { get; set; }
protected CreationAuditedEntity()
{
}
protected CreationAuditedEntity(TKey id)
: base(id)
{
}
} }
} }

11
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/CreationAuditedEntityWithUser.cs

@ -24,5 +24,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
{ {
/// <inheritdoc /> /// <inheritdoc />
public virtual TUser Creator { get; set; } public virtual TUser Creator { get; set; }
protected CreationAuditedEntityWithUser()
{
}
protected CreationAuditedEntityWithUser(TKey id)
: base(id)
{
}
} }
} }

11
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedAggregateRoot.cs

@ -34,5 +34,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
/// <inheritdoc /> /// <inheritdoc />
public virtual DateTime? DeletionTime { get; set; } public virtual DateTime? DeletionTime { get; set; }
protected FullAuditedAggregateRoot()
{
}
protected FullAuditedAggregateRoot(TKey id)
: base(id)
{
}
} }
} }

11
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedAggregateRootWithUser.cs

@ -38,5 +38,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
/// <inheritdoc /> /// <inheritdoc />
public TUser LastModifier { get; set; } public TUser LastModifier { get; set; }
protected FullAuditedAggregateRootWithUser()
{
}
protected FullAuditedAggregateRootWithUser(TKey id)
: base(id)
{
}
} }
} }

11
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedEntity.cs

@ -34,5 +34,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
/// <inheritdoc /> /// <inheritdoc />
public virtual DateTime? DeletionTime { get; set; } public virtual DateTime? DeletionTime { get; set; }
protected FullAuditedEntity()
{
}
protected FullAuditedEntity(TKey id)
: base(id)
{
}
} }
} }

11
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedEntityWithUser.cs

@ -38,5 +38,16 @@ namespace Volo.Abp.Domain.Entities.Auditing
/// <inheritdoc /> /// <inheritdoc />
public TUser LastModifier { get; set; } public TUser LastModifier { get; set; }
protected FullAuditedEntityWithUser()
{
}
protected FullAuditedEntityWithUser(TKey id)
: base(id)
{
}
} }
} }

9
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/DisableIdGenerationAttribute.cs

@ -0,0 +1,9 @@
using System;
namespace Volo.Abp.Domain.Entities
{
public class DisableIdGenerationAttribute : Attribute
{
}
}

33
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Entity.cs

@ -23,7 +23,7 @@ namespace Volo.Abp.Domain.Entities
public abstract class Entity<TKey> : Entity, IEntity<TKey> public abstract class Entity<TKey> : Entity, IEntity<TKey>
{ {
/// <inheritdoc/> /// <inheritdoc/>
public virtual TKey Id { get; set; } public virtual TKey Id { get; protected set; }
protected Entity() protected Entity()
{ {
@ -35,8 +35,7 @@ namespace Volo.Abp.Domain.Entities
Id = id; Id = id;
} }
/// <inheritdoc/> public bool EntityEquals(object obj)
public override bool Equals(object obj)
{ {
if (obj == null || !(obj is Entity<TKey>)) if (obj == null || !(obj is Entity<TKey>))
{ {
@ -73,33 +72,7 @@ namespace Volo.Abp.Domain.Entities
return Id.Equals(other.Id); return Id.Equals(other.Id);
} }
/// <inheritdoc/>
public override int GetHashCode()
{
if (Id == null)
{
return 0;
}
return Id.GetHashCode();
}
public static bool operator ==(Entity<TKey> left, Entity<TKey> right)
{
if (Equals(left, null))
{
return Equals(right, null);
}
return left.Equals(right);
}
public static bool operator !=(Entity<TKey> left, Entity<TKey> right)
{
return !(left == right);
}
public override object[] GetKeys() public override object[] GetKeys()
{ {
return new object[] {Id}; return new object[] {Id};

27
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/EntityHelper.cs

@ -81,5 +81,32 @@ namespace Volo.Abp.Domain.Entities
var lambdaBody = Expression.Equal(leftExpression, rightExpression); var lambdaBody = Expression.Equal(leftExpression, rightExpression);
return Expression.Lambda<Func<TEntity, bool>>(lambdaBody, lambdaParam); return Expression.Lambda<Func<TEntity, bool>>(lambdaBody, lambdaParam);
} }
public static void TrySetId<TKey>(
IEntity<TKey> entity,
Func<TKey> idFactory,
bool checkForDisableGuidGenerationAttribute = false)
{
//TODO: Can be optimized (by caching per entity type)?
var entityType = entity.GetType();
var idProperty = entityType.GetProperty(
nameof(entity.Id)
);
if (idProperty == null)
{
return;
}
if (checkForDisableGuidGenerationAttribute)
{
if (idProperty.IsDefined(typeof(DisableIdGenerationAttribute), true))
{
return;
}
}
idProperty.SetValue(entity, idFactory());
}
} }
} }

2
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/IEntity.cs

@ -22,6 +22,6 @@
/// <summary> /// <summary>
/// Unique identifier for this entity. /// Unique identifier for this entity.
/// </summary> /// </summary>
TKey Id { get; set; } TKey Id { get; }
} }
} }

27
framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Values/ValueObject.cs

@ -7,23 +7,9 @@ namespace Volo.Abp.Domain.Values
public abstract class ValueObject public abstract class ValueObject
{ {
protected static bool EqualOperator(ValueObject left, ValueObject right)
{
if (ReferenceEquals(left, null) ^ ReferenceEquals(right, null))
{
return false;
}
return ReferenceEquals(left, null) || left.Equals(right);
}
protected static bool NotEqualOperator(ValueObject left, ValueObject right)
{
return !(EqualOperator(left, right));
}
protected abstract IEnumerable<object> GetAtomicValues(); protected abstract IEnumerable<object> GetAtomicValues();
public override bool Equals(object obj) public bool ValueEquals(object obj)
{ {
if (obj == null || obj.GetType() != GetType()) if (obj == null || obj.GetType() != GetType())
{ {
@ -31,8 +17,10 @@ namespace Volo.Abp.Domain.Values
} }
ValueObject other = (ValueObject)obj; ValueObject other = (ValueObject)obj;
IEnumerator<object> thisValues = GetAtomicValues().GetEnumerator(); IEnumerator<object> thisValues = GetAtomicValues().GetEnumerator();
IEnumerator<object> otherValues = other.GetAtomicValues().GetEnumerator(); IEnumerator<object> otherValues = other.GetAtomicValues().GetEnumerator();
while (thisValues.MoveNext() && otherValues.MoveNext()) while (thisValues.MoveNext() && otherValues.MoveNext())
{ {
if (ReferenceEquals(thisValues.Current, null) ^ if (ReferenceEquals(thisValues.Current, null) ^
@ -47,15 +35,8 @@ namespace Volo.Abp.Domain.Values
return false; return false;
} }
} }
return !thisValues.MoveNext() && !otherValues.MoveNext();
}
public override int GetHashCode() return !thisValues.MoveNext() && !otherValues.MoveNext();
{
return GetAtomicValues()
.Select(x => x != null ? x.GetHashCode() : 0)
.Aggregate((x, y) => x ^ y);
} }
// Other utilility methods
} }
} }

2
framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo.Abp.EntityFrameworkCore.MySQL.csproj

@ -3,7 +3,7 @@
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>Volo.Abp.EntityFrameworkCore.MySQL</AssemblyName> <AssemblyName>Volo.Abp.EntityFrameworkCore.MySQL</AssemblyName>
<PackageId>Volo.Abp.EntityFrameworkCore.MySQL</PackageId> <PackageId>Volo.Abp.EntityFrameworkCore.MySQL</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>

6
framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj

@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>Volo.Abp.EntityFrameworkCore.PostgreSql</AssemblyName> <AssemblyName>Volo.Abp.EntityFrameworkCore.PostgreSql</AssemblyName>
<PackageId>Volo.Abp.EntityFrameworkCore.PostgreSql</PackageId> <PackageId>Volo.Abp.EntityFrameworkCore.PostgreSql</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
@ -18,7 +18,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="2.2.4" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.0.0-preview9" />
</ItemGroup> </ItemGroup>
</Project> </Project>

4
framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo.Abp.EntityFrameworkCore.SqlServer.csproj

@ -3,7 +3,7 @@
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>Volo.Abp.EntityFrameworkCore.SqlServer</AssemblyName> <AssemblyName>Volo.Abp.EntityFrameworkCore.SqlServer</AssemblyName>
<PackageId>Volo.Abp.EntityFrameworkCore.SqlServer</PackageId> <PackageId>Volo.Abp.EntityFrameworkCore.SqlServer</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
@ -18,7 +18,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0-preview9.19423.6" />
</ItemGroup> </ItemGroup>
</Project> </Project>

4
framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo.Abp.EntityFrameworkCore.Sqlite.csproj

@ -3,7 +3,7 @@
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>Volo.Abp.EntityFrameworkCore.Sqlite</AssemblyName> <AssemblyName>Volo.Abp.EntityFrameworkCore.Sqlite</AssemblyName>
<PackageId>Volo.Abp.EntityFrameworkCore.Sqlite</PackageId> <PackageId>Volo.Abp.EntityFrameworkCore.Sqlite</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
@ -14,7 +14,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.0-preview9.19423.6" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

6
framework/src/Volo.Abp.EntityFrameworkCore/Volo.Abp.EntityFrameworkCore.csproj

@ -3,7 +3,7 @@
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>
<AssemblyName>Volo.Abp.EntityFrameworkCore</AssemblyName> <AssemblyName>Volo.Abp.EntityFrameworkCore</AssemblyName>
<PackageId>Volo.Abp.EntityFrameworkCore</PackageId> <PackageId>Volo.Abp.EntityFrameworkCore</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
@ -19,8 +19,8 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.0.0-preview9.19423.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="3.0.0-preview9.19423.6" />
</ItemGroup> </ItemGroup>
</Project> </Project>

4
framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs

@ -258,14 +258,14 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore
public virtual TEntity Find(TKey id, bool includeDetails = true) public virtual TEntity Find(TKey id, bool includeDetails = true)
{ {
return includeDetails return includeDetails
? WithDetails().FirstOrDefault(EntityHelper.CreateEqualityExpressionForId<TEntity, TKey>(id)) ? WithDetails().FirstOrDefault(e => e.Id.Equals(id))
: DbSet.Find(id); : DbSet.Find(id);
} }
public virtual async Task<TEntity> FindAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default) public virtual async Task<TEntity> FindAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default)
{ {
return includeDetails return includeDetails
? await WithDetails().FirstOrDefaultAsync(EntityHelper.CreateEqualityExpressionForId<TEntity, TKey>(id), GetCancellationToken(cancellationToken)) ? await WithDetails().FirstOrDefaultAsync(e => e.Id.Equals(id), GetCancellationToken(cancellationToken))
: await DbSet.FindAsync(new object[] { id }, GetCancellationToken(cancellationToken)); : await DbSet.FindAsync(new object[] { id }, GetCancellationToken(cancellationToken));
} }

44
framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs

@ -9,7 +9,6 @@ using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Logging.Abstractions;
using Newtonsoft.Json; using Newtonsoft.Json;
@ -282,20 +281,37 @@ namespace Volo.Abp.EntityFrameworkCore
protected virtual void CheckAndSetId(EntityEntry entry) protected virtual void CheckAndSetId(EntityEntry entry)
{ {
//Set GUID Ids if (entry.Entity is IEntity<Guid> entityWithGuidId)
var entity = entry.Entity as IEntity<Guid>;
if (entity != null && entity.Id == Guid.Empty)
{ {
var dbGeneratedAttr = ReflectionHelper TrySetGuidId(entry, entityWithGuidId);
.GetSingleAttributeOrDefault<DatabaseGeneratedAttribute>( }
entry.Property("Id").Metadata.PropertyInfo }
);
if (dbGeneratedAttr == null || dbGeneratedAttr.DatabaseGeneratedOption == DatabaseGeneratedOption.None) protected virtual void TrySetGuidId(EntityEntry entry, IEntity<Guid> entity)
{ {
entity.Id = GuidGenerator.Create(); if (entity.Id != default)
} {
return;
} }
var idProperty = entry.Property("Id").Metadata.PropertyInfo;
//Check for DatabaseGeneratedAttribute
var dbGeneratedAttr = ReflectionHelper
.GetSingleAttributeOrDefault<DatabaseGeneratedAttribute>(
idProperty
);
if (dbGeneratedAttr != null && dbGeneratedAttr.DatabaseGeneratedOption != DatabaseGeneratedOption.None)
{
return;
}
EntityHelper.TrySetId(
entity,
() => GuidGenerator.Create(),
true
);
} }
protected virtual void SetCreationAuditProperties(EntityEntry entry) protected virtual void SetCreationAuditProperties(EntityEntry entry)
@ -494,12 +510,12 @@ namespace Volo.Abp.EntityFrameworkCore
if (typeof(ISoftDelete).IsAssignableFrom(typeof(TEntity))) if (typeof(ISoftDelete).IsAssignableFrom(typeof(TEntity)))
{ {
expression = e => !IsSoftDeleteFilterEnabled || !((ISoftDelete) e).IsDeleted; expression = e => !IsSoftDeleteFilterEnabled || !EF.Property<bool>(e, "IsDeleted");
} }
if (typeof(IMultiTenant).IsAssignableFrom(typeof(TEntity))) if (typeof(IMultiTenant).IsAssignableFrom(typeof(TEntity)))
{ {
Expression<Func<TEntity, bool>> multiTenantFilter = e => !IsMultiTenantFilterEnabled || ((IMultiTenant) e).TenantId == CurrentTenantId; Expression<Func<TEntity, bool>> multiTenantFilter = e => !IsMultiTenantFilterEnabled || EF.Property<Guid>(e, "TenantId") == CurrentTenantId;
expression = expression == null ? multiTenantFilter : CombineExpressions(expression, multiTenantFilter); expression = expression == null ? multiTenantFilter : CombineExpressions(expression, multiTenantFilter);
} }

12
framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/IEfCoreDbContext.cs

@ -35,9 +35,9 @@ namespace Volo.Abp.EntityFrameworkCore
EntityEntry<TEntity> Add<TEntity>([NotNull] TEntity entity) where TEntity : class; EntityEntry<TEntity> Add<TEntity>([NotNull] TEntity entity) where TEntity : class;
Task<EntityEntry> AddAsync([NotNull] object entity, CancellationToken cancellationToken = default); ValueTask<EntityEntry> AddAsync([NotNull] object entity, CancellationToken cancellationToken = default);
Task<EntityEntry<TEntity>> AddAsync<TEntity>([NotNull] TEntity entity, CancellationToken cancellationToken = default) where TEntity : class; ValueTask<EntityEntry<TEntity>> AddAsync<TEntity>([NotNull] TEntity entity, CancellationToken cancellationToken = default) where TEntity : class;
void AddRange([NotNull] IEnumerable<object> entities); void AddRange([NotNull] IEnumerable<object> entities);
@ -59,13 +59,13 @@ namespace Volo.Abp.EntityFrameworkCore
TEntity Find<TEntity>([NotNull] params object[] keyValues) where TEntity : class; TEntity Find<TEntity>([NotNull] params object[] keyValues) where TEntity : class;
Task<object> FindAsync([NotNull] Type entityType, [NotNull] object[] keyValues, CancellationToken cancellationToken); ValueTask<object> FindAsync([NotNull] Type entityType, [NotNull] object[] keyValues, CancellationToken cancellationToken);
Task<TEntity> FindAsync<TEntity>([NotNull] object[] keyValues, CancellationToken cancellationToken) where TEntity : class; ValueTask<TEntity> FindAsync<TEntity>([NotNull] object[] keyValues, CancellationToken cancellationToken) where TEntity : class;
Task<TEntity> FindAsync<TEntity>([NotNull] params object[] keyValues) where TEntity : class; ValueTask<TEntity> FindAsync<TEntity>([NotNull] params object[] keyValues) where TEntity : class;
Task<object> FindAsync([NotNull] Type entityType, [NotNull] params object[] keyValues); ValueTask<object> FindAsync([NotNull] Type entityType, [NotNull] params object[] keyValues);
EntityEntry<TEntity> Remove<TEntity>([NotNull] TEntity entity) where TEntity : class; EntityEntry<TEntity> Remove<TEntity>([NotNull] TEntity entity) where TEntity : class;

14
framework/src/Volo.Abp.FluentValidation/Volo/Abp/FluentValidation/AbpFluentValidationConventionalRegistrar.cs

@ -1,14 +1,20 @@
using System; using System;
using System.Collections.Generic;
using FluentValidation; using FluentValidation;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
namespace Volo.Abp.FluentValidation namespace Volo.Abp.FluentValidation
{ {
public class AbpFluentValidationConventionalRegistrar : DefaultConventionalRegistrar public class AbpFluentValidationConventionalRegistrar : ConventionalRegistrarBase
{ {
public override void AddType(IServiceCollection services, Type type) public override void AddType(IServiceCollection services, Type type)
{ {
if (IsConventionalRegistrationDisabled(type))
{
return;
}
if (!typeof(IValidator).IsAssignableFrom(type)) if (!typeof(IValidator).IsAssignableFrom(type))
{ {
return; return;
@ -20,8 +26,12 @@ namespace Volo.Abp.FluentValidation
return; return;
} }
var serviceType = typeof(IValidator<>).MakeGenericType(validatingType);
TriggerServiceExposing(services, type, new List<Type>{ serviceType });
services.AddTransient( services.AddTransient(
typeof(IValidator<>).MakeGenericType(validatingType), serviceType,
type type
); );
} }

27
framework/src/Volo.Abp.Http.Client.IdentityModel/Properties/launchSettings.json

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:52306/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Volo.Abp.Http.Client.IdentityModel": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:52307/"
}
}
}

6
framework/src/Volo.Abp.Http.Client.IdentityModel/Volo.Abp.Http.Client.IdentityModel.csproj

@ -1,15 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyName>Volo.Abp.Http.Client.IdentityModel</AssemblyName> <AssemblyName>Volo.Abp.Http.Client.IdentityModel</AssemblyName>
<PackageId>Volo.Abp.Http.Client.IdentityModel</PackageId> <PackageId>Volo.Abp.Http.Client.IdentityModel</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<IsPackable>true</IsPackable>
<OutputType>Library</OutputType>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>

27
framework/src/Volo.Abp.Http.Client/Properties/launchSettings.json

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:52208/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Volo.Abp.Http.Client": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:52209/"
}
}
}

9
framework/src/Volo.Abp.Http.Client/Volo.Abp.Http.Client.csproj

@ -1,21 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="..\..\..\common.props" /> <Import Project="..\..\..\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
<AssemblyName>Volo.Abp.Http.Client</AssemblyName> <AssemblyName>Volo.Abp.Http.Client</AssemblyName>
<PackageId>Volo.Abp.Http.Client</PackageId> <PackageId>Volo.Abp.Http.Client</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> <AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<IsPackable>true</IsPackable>
<OutputType>Library</OutputType>
<RootNamespace /> <RootNamespace />
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.Abstractions" Version="2.2.0" /> <PackageReference Include="Microsoft.Extensions.Http.Polly" Version="3.0.0-preview9.19423.4" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="2.2.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

2
framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs

@ -92,7 +92,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying
if (!response.IsSuccessStatusCode) if (!response.IsSuccessStatusCode)
{ {
throw new AbpException("Remote service returns error!"); throw new AbpException("Remote service returns error! StatusCode = " + response.StatusCode);
} }
var content = await response.Content.ReadAsStringAsync(); var content = await response.Content.ReadAsStringAsync();

2
framework/src/Volo.Abp.Localization/Volo/Abp/Localization/VirtualFiles/VirtualFileLocalizationResourceContributorBase.cs

@ -84,7 +84,7 @@ namespace Volo.Abp.Localization.VirtualFiles
var dictionary = CreateDictionaryFromFile(file); var dictionary = CreateDictionaryFromFile(file);
if (dictionaries.ContainsKey(dictionary.CultureName)) if (dictionaries.ContainsKey(dictionary.CultureName))
{ {
throw new AbpException($"{file.PhysicalPath} dictionary has a culture name '{dictionary.CultureName}' which is already defined!"); throw new AbpException($"{file.GetVirtualOrPhysicalPathOrNull()} dictionary has a culture name '{dictionary.CultureName}' which is already defined!");
} }
dictionaries[dictionary.CultureName] = dictionary; dictionaries[dictionary.CultureName] = dictionary;

2
framework/src/Volo.Abp.MailKit/Volo.Abp.MailKit.csproj

@ -14,7 +14,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="MailKit" Version="2.2.0" /> <PackageReference Include="MailKit" Version="2.3.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

8
framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs

@ -75,18 +75,20 @@ namespace Volo.Abp.Domain.Repositories.MemoryDb
protected virtual void SetIdIfNeeded(TEntity entity) protected virtual void SetIdIfNeeded(TEntity entity)
{ {
if (typeof(TKey) == typeof(int) || typeof(TKey) == typeof(long) || typeof(TKey) == typeof(Guid)) if (typeof(TKey) == typeof(int) ||
typeof(TKey) == typeof(long) ||
typeof(TKey) == typeof(Guid))
{ {
if (EntityHelper.HasDefaultId(entity)) if (EntityHelper.HasDefaultId(entity))
{ {
entity.Id = Database.GenerateNextId<TEntity, TKey>(); EntityHelper.TrySetId(entity, () => Database.GenerateNextId<TEntity, TKey>());
} }
} }
} }
public virtual TEntity Find(TKey id, bool includeDetails = true) public virtual TEntity Find(TKey id, bool includeDetails = true)
{ {
return GetQueryable().FirstOrDefault(EntityHelper.CreateEqualityExpressionForId<TEntity, TKey>(id)); return GetQueryable().FirstOrDefault(e => e.Id.Equals(id));
} }
public virtual TEntity Get(TKey id, bool includeDetails = true) public virtual TEntity Get(TKey id, bool includeDetails = true)

35
framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/Utf8JsonMemoryDbSerializer.cs

@ -1,5 +1,8 @@
using System; using System;
using System.Reflection;
using System.Text; using System.Text;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
using Volo.Abp.Json; using Volo.Abp.Json;
@ -7,21 +10,43 @@ namespace Volo.Abp.Domain.Repositories.MemoryDb
{ {
public class Utf8JsonMemoryDbSerializer : IMemoryDbSerializer, ITransientDependency public class Utf8JsonMemoryDbSerializer : IMemoryDbSerializer, ITransientDependency
{ {
private readonly IJsonSerializer _jsonSerializer; private static readonly JsonSerializerSettings MemoryDbSerializerSettings;
public Utf8JsonMemoryDbSerializer(IJsonSerializer jsonSerializer) static Utf8JsonMemoryDbSerializer()
{ {
_jsonSerializer = jsonSerializer; MemoryDbSerializerSettings = new JsonSerializerSettings
{
ContractResolver = new ResolverWithPrivateSetters(),
ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor
};
} }
byte[] IMemoryDbSerializer.Serialize(object obj) byte[] IMemoryDbSerializer.Serialize(object obj)
{ {
return Encoding.UTF8.GetBytes(_jsonSerializer.Serialize(obj)); var jsonString = JsonConvert.SerializeObject(obj, MemoryDbSerializerSettings);
return Encoding.UTF8.GetBytes(jsonString);
} }
public object Deserialize(byte[] value, Type type) public object Deserialize(byte[] value, Type type)
{ {
return _jsonSerializer.Deserialize(type, Encoding.UTF8.GetString(value)); var jsonString = Encoding.UTF8.GetString(value);
return JsonConvert.DeserializeObject(jsonString, type, MemoryDbSerializerSettings);
}
public class ResolverWithPrivateSetters : DefaultContractResolver
{
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
{
var prop = base.CreateProperty(member, memberSerialization);
if (prop.Writable)
{
return prop;
}
prop.Writable = member.As<PropertyInfo>()?.GetSetMethod(true) != null;
return prop;
}
} }
} }
} }

2
framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj

@ -14,7 +14,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="MongoDB.Driver" Version="2.8.1" /> <PackageReference Include="MongoDB.Driver" Version="2.9.1" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

19
framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs

@ -15,6 +15,7 @@ using Volo.Abp.EventBus.Local;
using Volo.Abp.Guids; using Volo.Abp.Guids;
using Volo.Abp.MongoDB; using Volo.Abp.MongoDB;
using Volo.Abp.MultiTenancy; using Volo.Abp.MultiTenancy;
using Volo.Abp.Reflection;
using Volo.Abp.Threading; using Volo.Abp.Threading;
namespace Volo.Abp.Domain.Repositories.MongoDB namespace Volo.Abp.Domain.Repositories.MongoDB
@ -315,12 +316,26 @@ namespace Volo.Abp.Domain.Repositories.MongoDB
protected virtual void CheckAndSetId(TEntity entity) protected virtual void CheckAndSetId(TEntity entity)
{ {
if (entity is IEntity<Guid> entityWithGuidId && entityWithGuidId.Id == default) if (entity is IEntity<Guid> entityWithGuidId)
{ {
entityWithGuidId.Id = GuidGenerator.Create(); TrySetGuidId(entityWithGuidId);
} }
} }
protected virtual void TrySetGuidId(IEntity<Guid> entity)
{
if (entity.Id != default)
{
return;
}
EntityHelper.TrySetId(
entity,
() => GuidGenerator.Create(),
true
);
}
protected virtual void SetCreationAuditProperties(TEntity entity) protected virtual void SetCreationAuditProperties(TEntity entity)
{ {
AuditPropertySetter.SetCreationProperties(entity); AuditPropertySetter.SetCreationProperties(entity);

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save