mirror of https://github.com/abpframework/abp.git
81 changed files with 540 additions and 2432 deletions
@ -0,0 +1,78 @@ |
|||
using System; |
|||
using System.Net.Mime; |
|||
using System.Text; |
|||
using Microsoft.AspNetCore.Http; |
|||
using Microsoft.Net.Http.Headers; |
|||
|
|||
namespace Microsoft.AspNetCore.Internal; |
|||
|
|||
/// <summary>
|
|||
/// https://github.com/dotnet/aspnetcore/blob/release/7.0/src/Shared/ResponseContentTypeHelper.cs
|
|||
/// </summary>
|
|||
public static class ResponseContentTypeHelper |
|||
{ |
|||
/// <summary>
|
|||
/// Gets the content type and encoding that need to be used for the response.
|
|||
/// The priority for selecting the content type is:
|
|||
/// 1. ContentType property set on the action result
|
|||
/// 2. <see cref="ContentType"/> property set on <see cref="HttpResponse"/>
|
|||
/// 3. Default content type set on the action result
|
|||
/// </summary>
|
|||
/// <remarks>
|
|||
/// The user supplied content type is not modified and is used as is. For example, if user
|
|||
/// sets the content type to be "text/plain" without any encoding, then the default content type's
|
|||
/// encoding is used to write the response and the ContentType header is set to be "text/plain" without any
|
|||
/// "charset" information.
|
|||
/// </remarks>
|
|||
public static void ResolveContentTypeAndEncoding( |
|||
string? actionResultContentType, |
|||
string? httpResponseContentType, |
|||
(string defaultContentType, Encoding defaultEncoding) @default, |
|||
Func<string, Encoding> getEncoding, |
|||
out string resolvedContentType, |
|||
out Encoding resolvedContentTypeEncoding) |
|||
{ |
|||
var (defaultContentType, defaultContentTypeEncoding) = @default; |
|||
|
|||
// 1. User sets the ContentType property on the action result
|
|||
if (actionResultContentType != null) |
|||
{ |
|||
resolvedContentType = actionResultContentType; |
|||
var actionResultEncoding = getEncoding(actionResultContentType); |
|||
resolvedContentTypeEncoding = actionResultEncoding ?? defaultContentTypeEncoding; |
|||
return; |
|||
} |
|||
|
|||
// 2. User sets the ContentType property on the http response directly
|
|||
if (!string.IsNullOrEmpty(httpResponseContentType)) |
|||
{ |
|||
var mediaTypeEncoding = getEncoding(httpResponseContentType); |
|||
if (mediaTypeEncoding != null) |
|||
{ |
|||
resolvedContentType = httpResponseContentType; |
|||
resolvedContentTypeEncoding = mediaTypeEncoding; |
|||
} |
|||
else |
|||
{ |
|||
resolvedContentType = httpResponseContentType; |
|||
resolvedContentTypeEncoding = defaultContentTypeEncoding; |
|||
} |
|||
|
|||
return; |
|||
} |
|||
|
|||
// 3. Fall-back to the default content type
|
|||
resolvedContentType = defaultContentType; |
|||
resolvedContentTypeEncoding = defaultContentTypeEncoding; |
|||
} |
|||
|
|||
public static Encoding GetEncoding(string mediaType) |
|||
{ |
|||
if (MediaTypeHeaderValue.TryParse(mediaType, out var parsed)) |
|||
{ |
|||
return parsed.Encoding; |
|||
} |
|||
|
|||
return default; |
|||
} |
|||
} |
|||
@ -0,0 +1,3 @@ |
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|||
<ConfigureAwait ContinueOnCapturedContext="false" /> |
|||
</Weavers> |
|||
@ -0,0 +1,30 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
|||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> |
|||
<xs:element name="Weavers"> |
|||
<xs:complexType> |
|||
<xs:all> |
|||
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> |
|||
<xs:complexType> |
|||
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:all> |
|||
<xs:attribute name="VerifyAssembly" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> |
|||
<xs:annotation> |
|||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
<xs:attribute name="GenerateXsd" type="xs:boolean"> |
|||
<xs:annotation> |
|||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> |
|||
</xs:annotation> |
|||
</xs:attribute> |
|||
</xs:complexType> |
|||
</xs:element> |
|||
</xs:schema> |
|||
@ -0,0 +1,22 @@ |
|||
<Project Sdk="Microsoft.NET.Sdk"> |
|||
|
|||
<Import Project="..\..\..\configureawait.props" /> |
|||
<Import Project="..\..\..\common.props" /> |
|||
|
|||
<PropertyGroup> |
|||
<TargetFrameworks>netstandard2.0;netstandard2.1;net7.0</TargetFrameworks> |
|||
<AssemblyName>Volo.Abp.Ddd.Domain.Shared</AssemblyName> |
|||
<PackageId>Volo.Abp.Ddd.Domain.Shared</PackageId> |
|||
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback> |
|||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> |
|||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> |
|||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> |
|||
<RootNamespace /> |
|||
</PropertyGroup> |
|||
|
|||
<ItemGroup> |
|||
<ProjectReference Include="..\Volo.Abp.MultiTenancy\Volo.Abp.MultiTenancy.csproj" /> |
|||
<ProjectReference Include="..\Volo.Abp.EventBus.Abstractions\Volo.Abp.EventBus.Abstractions.csproj" /> |
|||
</ItemGroup> |
|||
|
|||
</Project> |
|||
@ -0,0 +1,14 @@ |
|||
using Volo.Abp.EventBus.Abstractions; |
|||
using Volo.Abp.Modularity; |
|||
using Volo.Abp.MultiTenancy; |
|||
|
|||
namespace Volo.Abp.Domain; |
|||
|
|||
[DependsOn( |
|||
typeof(AbpMultiTenancyModule), |
|||
typeof(AbpEventBusAbstractionsModule) |
|||
)] |
|||
public class AbpDddDomainSharedModule : AbpModule |
|||
{ |
|||
|
|||
} |
|||
@ -1,6 +1,5 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using Volo.Abp.EventBus.Distributed; |
|||
|
|||
namespace Volo.Abp.Domain.Entities.Events.Distributed; |
|||
|
|||
File diff suppressed because it is too large
@ -1,62 +0,0 @@ |
|||
using Microsoft.EntityFrameworkCore.Migrations; |
|||
|
|||
#nullable disable |
|||
|
|||
namespace Volo.CmsKit.Migrations |
|||
{ |
|||
/// <inheritdoc />
|
|||
public partial class AddedEntityVersion : Migration |
|||
{ |
|||
/// <inheritdoc />
|
|||
protected override void Up(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.AddColumn<int>( |
|||
name: "EntityVersion", |
|||
table: "AbpUsers", |
|||
type: "int", |
|||
nullable: false, |
|||
defaultValue: 0); |
|||
|
|||
migrationBuilder.AddColumn<int>( |
|||
name: "EntityVersion", |
|||
table: "AbpTenants", |
|||
type: "int", |
|||
nullable: false, |
|||
defaultValue: 0); |
|||
|
|||
migrationBuilder.AddColumn<int>( |
|||
name: "EntityVersion", |
|||
table: "AbpRoles", |
|||
type: "int", |
|||
nullable: false, |
|||
defaultValue: 0); |
|||
|
|||
migrationBuilder.AddColumn<int>( |
|||
name: "EntityVersion", |
|||
table: "AbpOrganizationUnits", |
|||
type: "int", |
|||
nullable: false, |
|||
defaultValue: 0); |
|||
} |
|||
|
|||
/// <inheritdoc />
|
|||
protected override void Down(MigrationBuilder migrationBuilder) |
|||
{ |
|||
migrationBuilder.DropColumn( |
|||
name: "EntityVersion", |
|||
table: "AbpUsers"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "EntityVersion", |
|||
table: "AbpTenants"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "EntityVersion", |
|||
table: "AbpRoles"); |
|||
|
|||
migrationBuilder.DropColumn( |
|||
name: "EntityVersion", |
|||
table: "AbpOrganizationUnits"); |
|||
} |
|||
} |
|||
} |
|||
@ -1,3 +1,3 @@ |
|||
.datatableCell{ |
|||
cursor: pointer; |
|||
} |
|||
} |
|||
|
|||
Loading…
Reference in new issue