100 changed files with 1 additions and 1809 deletions
@ -1,3 +0,0 @@ |
|||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|
||||
<ConfigureAwait ContinueOnCapturedContext="false" /> |
|
||||
</Weavers> |
|
||||
@ -1,30 +0,0 @@ |
|||||
<?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> |
|
||||
@ -1,3 +0,0 @@ |
|||||
{ |
|
||||
"role": "lib.application-contracts" |
|
||||
} |
|
||||
@ -1,16 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>netstandard2.0</TargetFramework> |
|
||||
<Nullable>enable</Nullable> |
|
||||
<RootNamespace>Lion.AbpPro.EntityFrameworkCore.Tests</RootNamespace> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Volo.Abp.Ddd.Application.Contracts" Version="7.2.2" /> |
|
||||
<PackageReference Include="Volo.Abp.Authorization" Version="7.2.2" /> |
|
||||
<ProjectReference Include="..\Lion.AbpPro.EntityFrameworkCore.Tests.Domain.Shared\Lion.AbpPro.EntityFrameworkCore.Tests.Domain.Shared.csproj" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
@ -1,18 +0,0 @@ |
|||||
using Lion.AbpPro.EntityFrameworkCore.Tests.Localization; |
|
||||
using Volo.Abp.Authorization.Permissions; |
|
||||
using Volo.Abp.Localization; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.Permissions; |
|
||||
|
|
||||
public class TestsPermissionDefinitionProvider : PermissionDefinitionProvider |
|
||||
{ |
|
||||
public override void Define(IPermissionDefinitionContext context) |
|
||||
{ |
|
||||
var myGroup = context.AddGroup(TestsPermissions.GroupName, L("Permission:Tests")); |
|
||||
} |
|
||||
|
|
||||
private static LocalizableString L(string name) |
|
||||
{ |
|
||||
return LocalizableString.Create<TestsResource>(name); |
|
||||
} |
|
||||
} |
|
||||
@ -1,13 +0,0 @@ |
|||||
using Volo.Abp.Reflection; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.Permissions; |
|
||||
|
|
||||
public class TestsPermissions |
|
||||
{ |
|
||||
public const string GroupName = "Tests"; |
|
||||
|
|
||||
public static string[] GetAll() |
|
||||
{ |
|
||||
return ReflectionHelper.GetPublicConstantsRecursively(typeof(TestsPermissions)); |
|
||||
} |
|
||||
} |
|
||||
@ -1,11 +0,0 @@ |
|||||
using System.Threading.Tasks; |
|
||||
using Volo.Abp.Application.Services; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.Samples; |
|
||||
|
|
||||
public interface ISampleAppService : IApplicationService |
|
||||
{ |
|
||||
Task<SampleDto> GetAsync(); |
|
||||
|
|
||||
Task<SampleDto> GetAuthorizedAsync(); |
|
||||
} |
|
||||
@ -1,6 +0,0 @@ |
|||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.Samples; |
|
||||
|
|
||||
public class SampleDto |
|
||||
{ |
|
||||
public int Value { get; set; } |
|
||||
} |
|
||||
@ -1,15 +0,0 @@ |
|||||
using Volo.Abp.Application; |
|
||||
using Volo.Abp.Modularity; |
|
||||
using Volo.Abp.Authorization; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests; |
|
||||
|
|
||||
[DependsOn( |
|
||||
typeof(TestsDomainSharedModule), |
|
||||
typeof(AbpDddApplicationContractsModule), |
|
||||
typeof(AbpAuthorizationModule) |
|
||||
)] |
|
||||
public class TestsApplicationContractsModule : AbpModule |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
@ -1,8 +0,0 @@ |
|||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests; |
|
||||
|
|
||||
public class TestsRemoteServiceConsts |
|
||||
{ |
|
||||
public const string RemoteServiceName = "Tests"; |
|
||||
|
|
||||
public const string ModuleName = "tests"; |
|
||||
} |
|
||||
@ -1,3 +0,0 @@ |
|||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|
||||
<ConfigureAwait ContinueOnCapturedContext="false" /> |
|
||||
</Weavers> |
|
||||
@ -1,30 +0,0 @@ |
|||||
<?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> |
|
||||
@ -1,3 +0,0 @@ |
|||||
{ |
|
||||
"role": "lib.application" |
|
||||
} |
|
||||
@ -1,16 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>net7.0</TargetFramework> |
|
||||
<Nullable>enable</Nullable> |
|
||||
<RootNamespace>Lion.AbpPro.EntityFrameworkCore.Tests</RootNamespace> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Volo.Abp.AutoMapper" Version="7.2.2" /> |
|
||||
<PackageReference Include="Volo.Abp.Ddd.Application" Version="7.2.2" /> |
|
||||
<ProjectReference Include="..\Lion.AbpPro.EntityFrameworkCore.Tests.Application.Contracts\Lion.AbpPro.EntityFrameworkCore.Tests.Application.Contracts.csproj" /> |
|
||||
<ProjectReference Include="..\Lion.AbpPro.EntityFrameworkCore.Tests.Domain\Lion.AbpPro.EntityFrameworkCore.Tests.Domain.csproj" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
@ -1,38 +0,0 @@ |
|||||
using System.Threading.Tasks; |
|
||||
using Lion.AbpPro.EntityFrameworkCore.Tests.Blogs; |
|
||||
using Microsoft.AspNetCore.Authorization; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.Samples; |
|
||||
|
|
||||
public class SampleAppService : TestsAppService, ISampleAppService |
|
||||
{ |
|
||||
private readonly IBlogRepository _blogRepository; |
|
||||
|
|
||||
public SampleAppService(IBlogRepository blogRepository) |
|
||||
{ |
|
||||
_blogRepository = blogRepository; |
|
||||
} |
|
||||
|
|
||||
public Task<SampleDto> GetAsync() |
|
||||
{ |
|
||||
var blog = new Blog(GuidGenerator.Create(),GuidGenerator.Create().ToString(),"001"); |
|
||||
_blogRepository.InsertManyAsync(new List<Blog>() { blog }); |
|
||||
return Task.FromResult( |
|
||||
new SampleDto |
|
||||
{ |
|
||||
Value = 42 |
|
||||
} |
|
||||
); |
|
||||
} |
|
||||
|
|
||||
[Authorize] |
|
||||
public Task<SampleDto> GetAuthorizedAsync() |
|
||||
{ |
|
||||
return Task.FromResult( |
|
||||
new SampleDto |
|
||||
{ |
|
||||
Value = 42 |
|
||||
} |
|
||||
); |
|
||||
} |
|
||||
} |
|
||||
@ -1,13 +0,0 @@ |
|||||
using Lion.AbpPro.EntityFrameworkCore.Tests.Localization; |
|
||||
using Volo.Abp.Application.Services; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests; |
|
||||
|
|
||||
public abstract class TestsAppService : ApplicationService |
|
||||
{ |
|
||||
protected TestsAppService() |
|
||||
{ |
|
||||
LocalizationResource = typeof(TestsResource); |
|
||||
ObjectMapperContext = typeof(TestsApplicationModule); |
|
||||
} |
|
||||
} |
|
||||
@ -1,13 +0,0 @@ |
|||||
using AutoMapper; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests; |
|
||||
|
|
||||
public class TestsApplicationAutoMapperProfile : Profile |
|
||||
{ |
|
||||
public TestsApplicationAutoMapperProfile() |
|
||||
{ |
|
||||
/* You can configure your AutoMapper mapping configuration here. |
|
||||
* Alternatively, you can split your mapping configurations |
|
||||
* into multiple profile classes for a better organization. */ |
|
||||
} |
|
||||
} |
|
||||
@ -1,24 +0,0 @@ |
|||||
using Microsoft.Extensions.DependencyInjection; |
|
||||
using Volo.Abp.AutoMapper; |
|
||||
using Volo.Abp.Modularity; |
|
||||
using Volo.Abp.Application; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests; |
|
||||
|
|
||||
[DependsOn( |
|
||||
typeof(TestsDomainModule), |
|
||||
typeof(TestsApplicationContractsModule), |
|
||||
typeof(AbpDddApplicationModule), |
|
||||
typeof(AbpAutoMapperModule) |
|
||||
)] |
|
||||
public class TestsApplicationModule : AbpModule |
|
||||
{ |
|
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
|
||||
{ |
|
||||
context.Services.AddAutoMapperObjectMapper<TestsApplicationModule>(); |
|
||||
Configure<AbpAutoMapperOptions>(options => |
|
||||
{ |
|
||||
options.AddMaps<TestsApplicationModule>(validate: true); |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
@ -1,3 +0,0 @@ |
|||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|
||||
<ConfigureAwait ContinueOnCapturedContext="false" /> |
|
||||
</Weavers> |
|
||||
@ -1,30 +0,0 @@ |
|||||
<?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> |
|
||||
@ -1,3 +0,0 @@ |
|||||
{ |
|
||||
"role": "lib.domain-shared" |
|
||||
} |
|
||||
@ -1,25 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
|
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>netstandard2.0</TargetFramework> |
|
||||
<Nullable>enable</Nullable> |
|
||||
<RootNamespace>Lion.AbpPro.EntityFrameworkCore.Tests</RootNamespace> |
|
||||
<GenerateEmbeddedFilesManifest>true</GenerateEmbeddedFilesManifest> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Volo.Abp.Validation" Version="7.2.2" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="7.0.0" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<EmbeddedResource Include="Localization\Tests\*.json" /> |
|
||||
<Content Remove="Localization\Tests\*.json" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
@ -1,7 +0,0 @@ |
|||||
{ |
|
||||
"culture": "ar", |
|
||||
"texts": { |
|
||||
"MyAccount": "إدارة ملفى", |
|
||||
"SamplePageMessage": "صفحة نموذجية للوحدة النمطية Tests" |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
{ |
|
||||
"culture": "cs", |
|
||||
"texts": { |
|
||||
"MyAccount": "Spravovat profil", |
|
||||
"SamplePageMessage": "Ukázková stránka pro modul Tests" |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
{ |
|
||||
"culture": "de", |
|
||||
"texts": { |
|
||||
"MyAccount": "Mein Konto", |
|
||||
"SamplePageMessage": "Eine Beispielseite für das Modul TestsModul" |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
{ |
|
||||
"culture": "en-GB", |
|
||||
"texts": { |
|
||||
"MyAccount": "My account", |
|
||||
"SamplePageMessage": "A sample page for the Tests module" |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
{ |
|
||||
"culture": "en", |
|
||||
"texts": { |
|
||||
"MyAccount": "My account", |
|
||||
"SamplePageMessage": "A sample page for the Tests module" |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
{ |
|
||||
"culture": "es", |
|
||||
"texts": { |
|
||||
"MyAccount": "Mi cuenta", |
|
||||
"SamplePageMessage": "Una página de ejemplo para el módulo Tests " |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
{ |
|
||||
"culture": "fi", |
|
||||
"texts": { |
|
||||
"MyAccount": "Tilini", |
|
||||
"SamplePageMessage": "Esimerkkisivu Tests-moduulille" |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
{ |
|
||||
"culture": "fr", |
|
||||
"texts": { |
|
||||
"MyAccount": "Mon compte", |
|
||||
"SamplePageMessage": "Exemple de page pour le module Tests" |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
{ |
|
||||
"culture": "hi", |
|
||||
"texts": { |
|
||||
"MyAccount": "मेरा खाता", |
|
||||
"SamplePageMessage": "Tests मॉड्यूल के लिए एक नमूना पृष्ठ" |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
{ |
|
||||
"culture": "hu", |
|
||||
"texts": { |
|
||||
"MyAccount": "A fiókom", |
|
||||
"SamplePageMessage": "Mintaoldal a Tests modulhoz" |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
{ |
|
||||
"culture": "is", |
|
||||
"texts": { |
|
||||
"MyAccount": "Minn aðgangur", |
|
||||
"SamplePageMessage": "Dæmi um síðu fyrir Tests eininguna" |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
{ |
|
||||
"culture": "it", |
|
||||
"texts": { |
|
||||
"MyAccount": "Il mio conto", |
|
||||
"SamplePageMessage": "Una pagina di esempio per il modulo Tests" |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
{ |
|
||||
"culture": "nl", |
|
||||
"texts": { |
|
||||
"MyAccount": "Mijn rekening", |
|
||||
"SamplePageMessage": "Een voorbeeldpagina voor de Tests module" |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
{ |
|
||||
"culture": "pl-PL", |
|
||||
"texts": { |
|
||||
"MyAccount": "Moje konto", |
|
||||
"SamplePageMessage": "Przykładowa strona modułu Tests" |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
{ |
|
||||
"culture": "pt-BR", |
|
||||
"texts": { |
|
||||
"MyAccount": "Minha conta", |
|
||||
"SamplePageMessage": "Uma página de amostra para o módulo Tests" |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
{ |
|
||||
"culture": "ro-RO", |
|
||||
"texts": { |
|
||||
"MyAccount": "Contul meu", |
|
||||
"SamplePageMessage": "Un exemplu de pagină pentru modululul Tests" |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
{ |
|
||||
"culture": "ru", |
|
||||
"texts": { |
|
||||
"MyAccount": "Мой аккаунт", |
|
||||
"SamplePageMessage": "Пример страницы для модуля Tests" |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
{ |
|
||||
"culture": "sk", |
|
||||
"texts": { |
|
||||
"MyAccount": "Môj účet", |
|
||||
"SamplePageMessage": "Ukážka stránky pre modul Tests" |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
{ |
|
||||
"culture": "sl", |
|
||||
"texts": { |
|
||||
"MyAccount": "Moj račun", |
|
||||
"SamplePageMessage": "Vzorčna stran za modul Tests" |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
{ |
|
||||
"culture": "tr", |
|
||||
"texts": { |
|
||||
"MyAccount": "Hesabım", |
|
||||
"SamplePageMessage": "Tests modulünden örnek bir sayfa" |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
{ |
|
||||
"culture": "vi", |
|
||||
"texts": { |
|
||||
"MyAccount": "Tài khoản của tôi", |
|
||||
"SamplePageMessage": "Trang mẫu cho mô-đun Tests" |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
{ |
|
||||
"culture": "zh-Hans", |
|
||||
"texts": { |
|
||||
"MyAccount": "我的账户", |
|
||||
"SamplePageMessage": "Tests模块的示例页面" |
|
||||
} |
|
||||
} |
|
||||
@ -1,7 +0,0 @@ |
|||||
{ |
|
||||
"culture": "zh-Hant", |
|
||||
"texts": { |
|
||||
"MyAccount": "我的賬戶", |
|
||||
"SamplePageMessage": "Tests 模塊的示例頁面" |
|
||||
} |
|
||||
} |
|
||||
@ -1,9 +0,0 @@ |
|||||
using Volo.Abp.Localization; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.Localization; |
|
||||
|
|
||||
[LocalizationResourceName("Tests")] |
|
||||
public class TestsResource |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
@ -1,36 +0,0 @@ |
|||||
using Volo.Abp.Modularity; |
|
||||
using Volo.Abp.Localization; |
|
||||
using Lion.AbpPro.EntityFrameworkCore.Tests.Localization; |
|
||||
using Volo.Abp.Localization.ExceptionHandling; |
|
||||
using Volo.Abp.Validation; |
|
||||
using Volo.Abp.Validation.Localization; |
|
||||
using Volo.Abp.VirtualFileSystem; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests; |
|
||||
|
|
||||
[DependsOn( |
|
||||
typeof(AbpValidationModule) |
|
||||
)] |
|
||||
public class TestsDomainSharedModule : AbpModule |
|
||||
{ |
|
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
|
||||
{ |
|
||||
Configure<AbpVirtualFileSystemOptions>(options => |
|
||||
{ |
|
||||
options.FileSets.AddEmbedded<TestsDomainSharedModule>(); |
|
||||
}); |
|
||||
|
|
||||
Configure<AbpLocalizationOptions>(options => |
|
||||
{ |
|
||||
options.Resources |
|
||||
.Add<TestsResource>("en") |
|
||||
.AddBaseTypes(typeof(AbpValidationResource)) |
|
||||
.AddVirtualJson("/Localization/Tests"); |
|
||||
}); |
|
||||
|
|
||||
Configure<AbpExceptionLocalizationOptions>(options => |
|
||||
{ |
|
||||
options.MapCodeNamespace("Tests", typeof(TestsResource)); |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
@ -1,6 +0,0 @@ |
|||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests; |
|
||||
|
|
||||
public static class TestsErrorCodes |
|
||||
{ |
|
||||
//Add your business exception error codes here...
|
|
||||
} |
|
||||
@ -1,69 +0,0 @@ |
|||||
using Volo.Abp.Domain.Entities.Auditing; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.Blogs; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 博客
|
|
||||
/// </summary>
|
|
||||
public class Blog : FullAuditedAggregateRoot<Guid> |
|
||||
{ |
|
||||
private Blog() |
|
||||
{ |
|
||||
Posts = new List<Post>(); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
public Blog( |
|
||||
Guid id, |
|
||||
string name, |
|
||||
string code |
|
||||
) : base(id) |
|
||||
{ |
|
||||
SetName(name); |
|
||||
SetCode(code); |
|
||||
Posts = new List<Post>(); |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 名称
|
|
||||
/// </summary>
|
|
||||
public string Name { get; private set; } |
|
||||
/// <summary>
|
|
||||
/// 编码
|
|
||||
/// </summary>
|
|
||||
public string Code { get; private set; } |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 文章 一对多
|
|
||||
/// </summary>
|
|
||||
public List<Post> Posts { get; private set; } |
|
||||
|
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 设置名称
|
|
||||
/// </summary>
|
|
||||
private void SetName(string name) |
|
||||
{ |
|
||||
Name = name; |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 设置编码
|
|
||||
/// </summary>
|
|
||||
private void SetCode(string code) |
|
||||
{ |
|
||||
Code = code; |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 更新博客
|
|
||||
/// </summary>
|
|
||||
public void Update( |
|
||||
string name, |
|
||||
string code |
|
||||
) |
|
||||
{ |
|
||||
SetName(name); |
|
||||
SetCode(code); |
|
||||
} |
|
||||
} |
|
||||
@ -1,65 +0,0 @@ |
|||||
using Volo.Abp.Domain.Entities.Auditing; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.Blogs; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 评论
|
|
||||
/// </summary>
|
|
||||
public class Comment : FullAuditedEntity<Guid> |
|
||||
{ |
|
||||
private Comment() |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
|
|
||||
public Comment( |
|
||||
Guid id, |
|
||||
int? star, |
|
||||
Guid postId, |
|
||||
string content |
|
||||
) : base(id) |
|
||||
{ |
|
||||
SetStar(star); |
|
||||
SetPostId(postId); |
|
||||
SetContent(content); |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 点赞
|
|
||||
/// </summary>
|
|
||||
public int? Star { get; private set; } |
|
||||
/// <summary>
|
|
||||
/// 外键
|
|
||||
/// </summary>
|
|
||||
public Guid PostId { get; private set; } |
|
||||
/// <summary>
|
|
||||
/// 内容
|
|
||||
/// </summary>
|
|
||||
public string Content { get; private set; } |
|
||||
|
|
||||
|
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 设置点赞
|
|
||||
/// </summary>
|
|
||||
private void SetStar(int? star) |
|
||||
{ |
|
||||
Star = star; |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 设置外键
|
|
||||
/// </summary>
|
|
||||
private void SetPostId(Guid postId) |
|
||||
{ |
|
||||
PostId = postId; |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 设置内容
|
|
||||
/// </summary>
|
|
||||
private void SetContent(string content) |
|
||||
{ |
|
||||
Content = content; |
|
||||
} |
|
||||
} |
|
||||
@ -1,10 +0,0 @@ |
|||||
using Volo.Abp.Domain.Repositories; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.Blogs; |
|
||||
|
|
||||
public interface IBlogRepository : IBasicRepository<Blog, Guid> |
|
||||
{ |
|
||||
Task<List<Blog>> GetListAsync(int maxResultCount = 10, int skipCount = 0); |
|
||||
|
|
||||
Task<long> GetCountAsync(); |
|
||||
} |
|
||||
@ -1,57 +0,0 @@ |
|||||
using Volo.Abp.Domain.Entities.Auditing; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.Blogs; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 文章
|
|
||||
/// </summary>
|
|
||||
public class Post : FullAuditedEntity<Guid> |
|
||||
{ |
|
||||
private Post() |
|
||||
{ |
|
||||
Comments = new List<Comment>(); |
|
||||
} |
|
||||
|
|
||||
|
|
||||
public Post( |
|
||||
Guid id, |
|
||||
Guid blogId, |
|
||||
string name |
|
||||
) : base(id) |
|
||||
{ |
|
||||
SetBlogId(blogId); |
|
||||
SetName(name); |
|
||||
Comments = new List<Comment>(); |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 外键
|
|
||||
/// </summary>
|
|
||||
public Guid BlogId { get; private set; } |
|
||||
/// <summary>
|
|
||||
/// 名称
|
|
||||
/// </summary>
|
|
||||
public string Name { get; private set; } |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 评论 一对多
|
|
||||
/// </summary>
|
|
||||
public List<Comment> Comments { get; private set; } |
|
||||
|
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 设置外键
|
|
||||
/// </summary>
|
|
||||
private void SetBlogId(Guid blogId) |
|
||||
{ |
|
||||
BlogId = blogId; |
|
||||
} |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 设置名称
|
|
||||
/// </summary>
|
|
||||
private void SetName(string name) |
|
||||
{ |
|
||||
Name = name; |
|
||||
} |
|
||||
} |
|
||||
@ -1,3 +0,0 @@ |
|||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|
||||
<ConfigureAwait ContinueOnCapturedContext="false" /> |
|
||||
</Weavers> |
|
||||
@ -1,30 +0,0 @@ |
|||||
<?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> |
|
||||
@ -1,3 +0,0 @@ |
|||||
{ |
|
||||
"role": "lib.domain" |
|
||||
} |
|
||||
@ -1,16 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
|
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>netstandard2.0</TargetFramework> |
|
||||
<Nullable>enable</Nullable> |
|
||||
<RootNamespace>Lion.AbpPro.EntityFrameworkCore.Tests</RootNamespace> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Volo.Abp.Ddd.Domain" Version="7.2.2" /> |
|
||||
<ProjectReference Include="..\Lion.AbpPro.EntityFrameworkCore.Tests.Domain.Shared\Lion.AbpPro.EntityFrameworkCore.Tests.Domain.Shared.csproj" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
@ -1,13 +0,0 @@ |
|||||
using Volo.Abp.Settings; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.Settings; |
|
||||
|
|
||||
public class TestsSettingDefinitionProvider : SettingDefinitionProvider |
|
||||
{ |
|
||||
public override void Define(ISettingDefinitionContext context) |
|
||||
{ |
|
||||
/* Define module settings here. |
|
||||
* Use names from TestsSettings class. |
|
||||
*/ |
|
||||
} |
|
||||
} |
|
||||
@ -1,10 +0,0 @@ |
|||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.Settings; |
|
||||
|
|
||||
public static class TestsSettings |
|
||||
{ |
|
||||
public const string GroupName = "Tests"; |
|
||||
|
|
||||
/* Add constants for setting names. Example: |
|
||||
* public const string MySettingName = GroupName + ".MySettingName"; |
|
||||
*/ |
|
||||
} |
|
||||
@ -1,10 +0,0 @@ |
|||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests; |
|
||||
|
|
||||
public static class TestsDbProperties |
|
||||
{ |
|
||||
public static string DbTablePrefix { get; set; } = "Tests"; |
|
||||
|
|
||||
public static string? DbSchema { get; set; } = null; |
|
||||
|
|
||||
public const string ConnectionStringName = "Tests"; |
|
||||
} |
|
||||
@ -1,13 +0,0 @@ |
|||||
using Volo.Abp.Domain; |
|
||||
using Volo.Abp.Modularity; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests; |
|
||||
|
|
||||
[DependsOn( |
|
||||
typeof(AbpDddDomainModule), |
|
||||
typeof(TestsDomainSharedModule) |
|
||||
)] |
|
||||
public class TestsDomainModule : AbpModule |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
@ -1,19 +0,0 @@ |
|||||
using Lion.AbpPro.EntityFrameworkCore.Tests.Blogs; |
|
||||
using Microsoft.EntityFrameworkCore; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.EntityFrameworkCore.Blogs; |
|
||||
|
|
||||
public static class EfCoreBlogQueryableExtensions |
|
||||
{ |
|
||||
public static IQueryable<Blog> IncludeDetails(this IQueryable<Blog> queryable, bool include = true) |
|
||||
{ |
|
||||
if (!include) |
|
||||
{ |
|
||||
return queryable; |
|
||||
} |
|
||||
|
|
||||
return queryable |
|
||||
.Include(e => e.Posts) |
|
||||
.ThenInclude(x => x.Comments); |
|
||||
} |
|
||||
} |
|
||||
@ -1,36 +0,0 @@ |
|||||
using Lion.AbpPro.EntityFrameworkCore.Tests.Blogs; |
|
||||
using Microsoft.EntityFrameworkCore; |
|
||||
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; |
|
||||
using Volo.Abp.EntityFrameworkCore; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.EntityFrameworkCore.Blogs; |
|
||||
|
|
||||
/// <summary>
|
|
||||
/// 博客 仓储Ef core 实现
|
|
||||
/// </summary>
|
|
||||
public class EfCoreBlogRepository : |
|
||||
EfCoreRepository<TestsDbContext, Blog, Guid>, |
|
||||
IBlogRepository |
|
||||
{ |
|
||||
public EfCoreBlogRepository(IDbContextProvider<TestsDbContext> dbContextProvider) : base(dbContextProvider) |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
public async Task<List<Blog>> GetListAsync(int maxResultCount = 10, int skipCount = 0) |
|
||||
{ |
|
||||
return await (await GetDbSetAsync()) |
|
||||
.OrderByDescending(e => e.CreationTime) |
|
||||
.PageBy(skipCount, maxResultCount) |
|
||||
.ToListAsync(); |
|
||||
} |
|
||||
|
|
||||
public async Task<long> GetCountAsync() |
|
||||
{ |
|
||||
return await (await GetDbSetAsync()).CountAsync(); |
|
||||
} |
|
||||
|
|
||||
public override async Task<IQueryable<Blog>> WithDetailsAsync() |
|
||||
{ |
|
||||
return (await GetQueryableAsync()).IncludeDetails(); |
|
||||
} |
|
||||
} |
|
||||
@ -1,12 +0,0 @@ |
|||||
using Volo.Abp.Data; |
|
||||
using Volo.Abp.EntityFrameworkCore; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.EntityFrameworkCore; |
|
||||
|
|
||||
[ConnectionStringName(TestsDbProperties.ConnectionStringName)] |
|
||||
public interface ITestsDbContext : IEfCoreDbContext |
|
||||
{ |
|
||||
/* Add DbSet for each Aggregate Root here. Example: |
|
||||
* DbSet<Question> Questions { get; } |
|
||||
*/ |
|
||||
} |
|
||||
@ -1,29 +0,0 @@ |
|||||
using Lion.AbpPro.EntityFrameworkCore.Tests.Blogs; |
|
||||
using Microsoft.EntityFrameworkCore; |
|
||||
using Volo.Abp.Data; |
|
||||
using Volo.Abp.EntityFrameworkCore; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.EntityFrameworkCore; |
|
||||
|
|
||||
[ConnectionStringName(TestsDbProperties.ConnectionStringName)] |
|
||||
public class TestsDbContext : AbpDbContext<TestsDbContext>, ITestsDbContext |
|
||||
{ |
|
||||
/* Add DbSet for each Aggregate Root here. Example: |
|
||||
* public DbSet<Question> Questions { get; set; } |
|
||||
*/ |
|
||||
public DbSet<Comment> Comments { get; set; } |
|
||||
public DbSet<Blog> Blogs { get; set; } |
|
||||
public DbSet<Post> Posts { get; set; } |
|
||||
|
|
||||
public TestsDbContext(DbContextOptions<TestsDbContext> options) |
|
||||
: base(options) |
|
||||
{ |
|
||||
} |
|
||||
|
|
||||
protected override void OnModelCreating(ModelBuilder builder) |
|
||||
{ |
|
||||
base.OnModelCreating(builder); |
|
||||
|
|
||||
builder.ConfigureTests(); |
|
||||
} |
|
||||
} |
|
||||
@ -1,38 +0,0 @@ |
|||||
using Lion.AbpPro.EntityFrameworkCore.Tests.Blogs; |
|
||||
using Microsoft.EntityFrameworkCore; |
|
||||
using Volo.Abp; |
|
||||
using Volo.Abp.EntityFrameworkCore.Modeling; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.EntityFrameworkCore; |
|
||||
|
|
||||
public static class TestsDbContextModelCreatingExtensions |
|
||||
{ |
|
||||
public static void ConfigureTests( |
|
||||
this ModelBuilder builder) |
|
||||
{ |
|
||||
Check.NotNull(builder, nameof(builder)); |
|
||||
|
|
||||
builder.Entity<Comment>(b => |
|
||||
{ |
|
||||
b.ToTable(nameof(Comment)); |
|
||||
b.Property(e => e.Star).HasComment("点赞"); |
|
||||
b.Property(e => e.Content).IsRequired().HasMaxLength(128).HasComment("内容"); |
|
||||
b.Property(e => e.PostId).HasComment("外键"); |
|
||||
b.ConfigureByConvention(); |
|
||||
}); |
|
||||
builder.Entity<Blog>(b => |
|
||||
{ |
|
||||
b.ToTable(nameof(Blog)); |
|
||||
b.Property(e => e.Code).IsRequired().HasMaxLength(128).HasComment("编码"); |
|
||||
b.Property(e => e.Name).IsRequired().HasMaxLength(128).HasComment("名称"); |
|
||||
b.ConfigureByConvention(); |
|
||||
}); |
|
||||
builder.Entity<Post>(b => |
|
||||
{ |
|
||||
b.ToTable(nameof(Post)); |
|
||||
b.Property(e => e.Name).IsRequired().HasMaxLength(128).HasComment("名称"); |
|
||||
b.Property(e => e.BlogId).HasComment("外键"); |
|
||||
b.ConfigureByConvention(); |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
@ -1,22 +0,0 @@ |
|||||
using Microsoft.Extensions.DependencyInjection; |
|
||||
using Volo.Abp.EntityFrameworkCore; |
|
||||
using Volo.Abp.Modularity; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.EntityFrameworkCore; |
|
||||
|
|
||||
[DependsOn( |
|
||||
typeof(TestsDomainModule), |
|
||||
typeof(AbpEntityFrameworkCoreModule) |
|
||||
)] |
|
||||
public class TestsEntityFrameworkCoreModule : AbpModule |
|
||||
{ |
|
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
|
||||
{ |
|
||||
context.Services.AddAbpDbContext<TestsDbContext>(options => |
|
||||
{ |
|
||||
/* Add custom repositories here. Example: |
|
||||
* options.AddRepository<Question, EfCoreQuestionRepository>(); |
|
||||
*/ |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
@ -1,3 +0,0 @@ |
|||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|
||||
<ConfigureAwait ContinueOnCapturedContext="false" /> |
|
||||
</Weavers> |
|
||||
@ -1,30 +0,0 @@ |
|||||
<?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> |
|
||||
@ -1,3 +0,0 @@ |
|||||
{ |
|
||||
"role": "lib.ef" |
|
||||
} |
|
||||
@ -1,16 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
|
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>net7.0</TargetFramework> |
|
||||
<Nullable>enable</Nullable> |
|
||||
<RootNamespace>Lion.AbpPro.EntityFrameworkCore.Tests</RootNamespace> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Volo.Abp.EntityFrameworkCore" Version="7.2.2" /> |
|
||||
<ProjectReference Include="..\Lion.AbpPro.EntityFrameworkCore.Tests.Domain\Lion.AbpPro.EntityFrameworkCore.Tests.Domain.csproj" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
@ -1,3 +0,0 @@ |
|||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|
||||
<ConfigureAwait ContinueOnCapturedContext="false" /> |
|
||||
</Weavers> |
|
||||
@ -1,30 +0,0 @@ |
|||||
<?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> |
|
||||
@ -1,3 +0,0 @@ |
|||||
{ |
|
||||
"role": "lib.http-api-client" |
|
||||
} |
|
||||
@ -1,20 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>netstandard2.0</TargetFramework> |
|
||||
<Nullable>enable</Nullable> |
|
||||
<RootNamespace>Lion.AbpPro.EntityFrameworkCore.Tests</RootNamespace> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Volo.Abp.Http.Client" Version="7.2.2" /> |
|
||||
<ProjectReference Include="..\Lion.AbpPro.EntityFrameworkCore.Tests.Application.Contracts\Lion.AbpPro.EntityFrameworkCore.Tests.Application.Contracts.csproj" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<EmbeddedResource Include="**\*generate-proxy.json" /> |
|
||||
<Content Remove="**\*generate-proxy.json" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
@ -1,26 +0,0 @@ |
|||||
using Microsoft.Extensions.DependencyInjection; |
|
||||
using Volo.Abp.Http.Client; |
|
||||
using Volo.Abp.Modularity; |
|
||||
using Volo.Abp.VirtualFileSystem; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests; |
|
||||
|
|
||||
[DependsOn( |
|
||||
typeof(TestsApplicationContractsModule), |
|
||||
typeof(AbpHttpClientModule))] |
|
||||
public class TestsHttpApiClientModule : AbpModule |
|
||||
{ |
|
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
|
||||
{ |
|
||||
context.Services.AddHttpClientProxies( |
|
||||
typeof(TestsApplicationContractsModule).Assembly, |
|
||||
TestsRemoteServiceConsts.RemoteServiceName |
|
||||
); |
|
||||
|
|
||||
Configure<AbpVirtualFileSystemOptions>(options => |
|
||||
{ |
|
||||
options.FileSets.AddEmbedded<TestsHttpApiClientModule>(); |
|
||||
}); |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
@ -1,12 +0,0 @@ |
|||||
using Microsoft.AspNetCore.Mvc; |
|
||||
using Volo.Abp.AspNetCore.Mvc; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.Controllers; |
|
||||
|
|
||||
public class HomeController : AbpController |
|
||||
{ |
|
||||
public ActionResult Index() |
|
||||
{ |
|
||||
return Redirect("~/swagger"); |
|
||||
} |
|
||||
} |
|
||||
@ -1,18 +0,0 @@ |
|||||
FROM mcr.microsoft.com/dotnet/core/aspnet:7.0-bullseye-slim AS base |
|
||||
WORKDIR /app |
|
||||
EXPOSE 80 |
|
||||
|
|
||||
FROM mcr.microsoft.com/dotnet/core/sdk:7.0 AS build |
|
||||
WORKDIR /src |
|
||||
COPY . . |
|
||||
WORKDIR /src/templates/service/host/Lion.AbpPro.EntityFrameworkCore.Tests.HttpApi.Host |
|
||||
RUN dotnet restore -nowarn:msb3202,nu1503 |
|
||||
RUN dotnet build --no-restore -c Release -o /app |
|
||||
|
|
||||
FROM build AS publish |
|
||||
RUN dotnet publish --no-restore -c Release -o /app |
|
||||
|
|
||||
FROM base AS final |
|
||||
WORKDIR /app |
|
||||
COPY --from=publish /app . |
|
||||
ENTRYPOINT ["dotnet", "Lion.AbpPro.EntityFrameworkCore.Tests.HttpApi.Host.dll"] |
|
||||
@ -1,20 +0,0 @@ |
|||||
using Microsoft.EntityFrameworkCore; |
|
||||
using Volo.Abp.EntityFrameworkCore; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.EntityFrameworkCore; |
|
||||
|
|
||||
public class TestsHttpApiHostMigrationsDbContext : AbpDbContext<TestsHttpApiHostMigrationsDbContext> |
|
||||
{ |
|
||||
public TestsHttpApiHostMigrationsDbContext(DbContextOptions<TestsHttpApiHostMigrationsDbContext> options) |
|
||||
: base(options) |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
|
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder) |
|
||||
{ |
|
||||
base.OnModelCreating(modelBuilder); |
|
||||
|
|
||||
|
|
||||
} |
|
||||
} |
|
||||
@ -1,27 +0,0 @@ |
|||||
using System.IO; |
|
||||
using Microsoft.EntityFrameworkCore; |
|
||||
using Microsoft.EntityFrameworkCore.Design; |
|
||||
using Microsoft.Extensions.Configuration; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.EntityFrameworkCore; |
|
||||
|
|
||||
public class TestsHttpApiHostMigrationsDbContextFactory : IDesignTimeDbContextFactory<TestsHttpApiHostMigrationsDbContext> |
|
||||
{ |
|
||||
public TestsHttpApiHostMigrationsDbContext CreateDbContext(string[] args) |
|
||||
{ |
|
||||
var configuration = BuildConfiguration(); |
|
||||
|
|
||||
var builder = new DbContextOptionsBuilder<TestsHttpApiHostMigrationsDbContext>() |
|
||||
.UseMySql(configuration.GetConnectionString("Tests"), MySqlServerVersion.LatestSupportedServerVersion); |
|
||||
return new TestsHttpApiHostMigrationsDbContext(builder.Options); |
|
||||
} |
|
||||
|
|
||||
private static IConfigurationRoot BuildConfiguration() |
|
||||
{ |
|
||||
var builder = new ConfigurationBuilder() |
|
||||
.SetBasePath(Directory.GetCurrentDirectory()) |
|
||||
.AddJsonFile("appsettings.json", optional: false); |
|
||||
|
|
||||
return builder.Build(); |
|
||||
} |
|
||||
} |
|
||||
@ -1,3 +0,0 @@ |
|||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|
||||
<ConfigureAwait ContinueOnCapturedContext="false" /> |
|
||||
</Weavers> |
|
||||
@ -1,30 +0,0 @@ |
|||||
<?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> |
|
||||
@ -1,3 +0,0 @@ |
|||||
{ |
|
||||
"role": "host.http-api" |
|
||||
} |
|
||||
@ -1,44 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk.Web"> |
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>net7.0</TargetFramework> |
|
||||
<Nullable>enable</Nullable> |
|
||||
<RootNamespace>Lion.AbpPro.EntityFrameworkCore.Tests</RootNamespace> |
|
||||
<PreserveCompilationReferences>true</PreserveCompilationReferences> |
|
||||
<UserSecretsId>Lion.AbpPro.EntityFrameworkCore.Tests-c2d31439-b723-48e2-b061-5ebd7aeb6010</UserSecretsId> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Serilog.AspNetCore" Version="5.0.0" /> |
|
||||
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" /> |
|
||||
<PackageReference Include="IdentityModel" Version="6.0.0" /> |
|
||||
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.0" /> |
|
||||
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="7.0.0" /> |
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.1" /> |
|
||||
<PackageReference Include="Volo.Abp.Autofac" Version="7.2.2" /> |
|
||||
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="7.2.2" /> |
|
||||
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy" Version="7.2.2" /> |
|
||||
<PackageReference Include="Volo.Abp.EntityFrameworkCore.MySQL" Version="7.2.2" /> |
|
||||
<PackageReference Include="Volo.Abp.AspNetCore.Serilog" Version="7.2.2" /> |
|
||||
<PackageReference Include="Volo.Abp.Swashbuckle" Version="7.2.2" /> |
|
||||
<PackageReference Include="Volo.Abp.PermissionManagement.EntityFrameworkCore" Version="7.2.2" /> |
|
||||
<PackageReference Include="Volo.Abp.SettingManagement.EntityFrameworkCore" Version="7.2.2" /> |
|
||||
<PackageReference Include="Volo.Abp.AuditLogging.EntityFrameworkCore" Version="7.2.2" /> |
|
||||
<PackageReference Include="Volo.Abp.TenantManagement.EntityFrameworkCore" Version="7.2.2" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<ProjectReference Include="..\Lion.AbpPro.EntityFrameworkCore.Tests.Application\Lion.AbpPro.EntityFrameworkCore.Tests.Application.csproj" /> |
|
||||
<ProjectReference Include="..\Lion.AbpPro.EntityFrameworkCore.Tests.EntityFrameworkCore\Lion.AbpPro.EntityFrameworkCore.Tests.EntityFrameworkCore.csproj" /> |
|
||||
<ProjectReference Include="..\Lion.AbpPro.EntityFrameworkCore.Tests.HttpApi\Lion.AbpPro.EntityFrameworkCore.Tests.HttpApi.csproj" /> |
|
||||
<ProjectReference Include="..\..\..\src\Lion.AbpPro.EntityFrameworkCore.Mysql\Lion.AbpPro.EntityFrameworkCore.Mysql.csproj" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<Compile Remove="Logs\**" /> |
|
||||
<Content Remove="Logs\**" /> |
|
||||
<EmbeddedResource Remove="Logs\**" /> |
|
||||
<None Remove="Logs\**" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
@ -1,17 +0,0 @@ |
|||||
2023-06-19 17:39:32.267 +08:00 [INF] Starting web host. |
|
||||
2023-06-19 17:39:35.122 +08:00 [FTL] Host terminated unexpectedly! |
|
||||
Volo.Abp.AbpInitializationException: An error occurred during ConfigureServicesAsync phase of the module Lion.AbpPro.EntityFrameworkCore.Tests.TestsHttpApiHostModule, Lion.AbpPro.EntityFrameworkCore.Tests.HttpApi.Host, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. See the inner exception for details. |
|
||||
---> System.NullReferenceException: Object reference not set to an instance of an object. |
|
||||
at Microsoft.Extensions.DependencyInjection.AbpSwaggerGenServiceCollectionExtensions.AddAbpSwaggerGenWithOAuth(IServiceCollection services, String authority, Dictionary`2 scopes, Action`1 setupAction, String authorizationEndpoint, String tokenEndpoint) |
|
||||
at Lion.AbpPro.EntityFrameworkCore.Tests.TestsHttpApiHostModule.ConfigureServices(ServiceConfigurationContext context) in D:\github\WangJunZzz\abp-vnext-pro\aspnet-core\frameworks\test\Lion.AbpPro.EntityFrameworkCore.Tests\Lion.AbpPro.EntityFrameworkCore.Tests.HttpApi.Host\TestsHttpApiHostModule.cs:line 80 |
|
||||
at Volo.Abp.Modularity.AbpModule.ConfigureServicesAsync(ServiceConfigurationContext context) |
|
||||
at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync() |
|
||||
--- End of inner exception stack trace --- |
|
||||
at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync() |
|
||||
at Volo.Abp.AbpApplicationFactory.CreateAsync[TStartupModule](IServiceCollection services, Action`1 optionsAction) |
|
||||
at Microsoft.Extensions.DependencyInjection.ServiceCollectionApplicationExtensions.AddApplicationAsync[TStartupModule](IServiceCollection services, Action`1 optionsAction) |
|
||||
at Microsoft.Extensions.DependencyInjection.WebApplicationBuilderExtensions.AddApplicationAsync[TStartupModule](WebApplicationBuilder builder, Action`1 optionsAction) |
|
||||
at Lion.AbpPro.EntityFrameworkCore.Tests.Program.Main(String[] args) in D:\github\WangJunZzz\abp-vnext-pro\aspnet-core\frameworks\test\Lion.AbpPro.EntityFrameworkCore.Tests\Lion.AbpPro.EntityFrameworkCore.Tests.HttpApi.Host\Program.cs:line 35 |
|
||||
2023-06-19 17:54:04.532 +08:00 [INF] Starting web host. |
|
||||
2023-06-19 17:56:12.444 +08:00 [INF] Starting web host. |
|
||||
2023-06-19 18:00:24.441 +08:00 [INF] Starting web host. |
|
||||
@ -1,28 +0,0 @@ |
|||||
// <auto-generated />
|
|
||||
using Lion.AbpPro.EntityFrameworkCore.Tests.EntityFrameworkCore; |
|
||||
using Microsoft.EntityFrameworkCore; |
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|
||||
using Microsoft.EntityFrameworkCore.Migrations; |
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|
||||
using Volo.Abp.EntityFrameworkCore; |
|
||||
|
|
||||
#nullable disable |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.Migrations |
|
||||
{ |
|
||||
[DbContext(typeof(TestsHttpApiHostMigrationsDbContext))] |
|
||||
[Migration("20230619095614_Init")] |
|
||||
partial class Init |
|
||||
{ |
|
||||
/// <inheritdoc />
|
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder) |
|
||||
{ |
|
||||
#pragma warning disable 612, 618
|
|
||||
modelBuilder |
|
||||
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) |
|
||||
.HasAnnotation("ProductVersion", "7.0.2") |
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64); |
|
||||
#pragma warning restore 612, 618
|
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,23 +0,0 @@ |
|||||
using Microsoft.EntityFrameworkCore.Migrations; |
|
||||
|
|
||||
#nullable disable |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.Migrations |
|
||||
{ |
|
||||
/// <inheritdoc />
|
|
||||
public partial class Init : Migration |
|
||||
{ |
|
||||
/// <inheritdoc />
|
|
||||
protected override void Up(MigrationBuilder migrationBuilder) |
|
||||
{ |
|
||||
migrationBuilder.AlterDatabase() |
|
||||
.Annotation("MySql:CharSet", "utf8mb4"); |
|
||||
} |
|
||||
|
|
||||
/// <inheritdoc />
|
|
||||
protected override void Down(MigrationBuilder migrationBuilder) |
|
||||
{ |
|
||||
|
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,25 +0,0 @@ |
|||||
// <auto-generated />
|
|
||||
using Lion.AbpPro.EntityFrameworkCore.Tests.EntityFrameworkCore; |
|
||||
using Microsoft.EntityFrameworkCore; |
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; |
|
||||
using Volo.Abp.EntityFrameworkCore; |
|
||||
|
|
||||
#nullable disable |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.Migrations |
|
||||
{ |
|
||||
[DbContext(typeof(TestsHttpApiHostMigrationsDbContext))] |
|
||||
partial class TestsHttpApiHostMigrationsDbContextModelSnapshot : ModelSnapshot |
|
||||
{ |
|
||||
protected override void BuildModel(ModelBuilder modelBuilder) |
|
||||
{ |
|
||||
#pragma warning disable 612, 618
|
|
||||
modelBuilder |
|
||||
.HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) |
|
||||
.HasAnnotation("ProductVersion", "7.0.2") |
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 64); |
|
||||
#pragma warning restore 612, 618
|
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,56 +0,0 @@ |
|||||
using System; |
|
||||
using System.Threading.Tasks; |
|
||||
using Microsoft.AspNetCore.Builder; |
|
||||
using Microsoft.Extensions.DependencyInjection; |
|
||||
using Microsoft.Extensions.Hosting; |
|
||||
using Serilog; |
|
||||
using Serilog.Events; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests; |
|
||||
|
|
||||
public class Program |
|
||||
{ |
|
||||
public async static Task<int> Main(string[] args) |
|
||||
{ |
|
||||
Log.Logger = new LoggerConfiguration() |
|
||||
#if DEBUG
|
|
||||
.MinimumLevel.Debug() |
|
||||
#else
|
|
||||
.MinimumLevel.Information() |
|
||||
#endif
|
|
||||
.MinimumLevel.Override("Microsoft", LogEventLevel.Information) |
|
||||
.MinimumLevel.Override("Microsoft.EntityFrameworkCore", LogEventLevel.Warning) |
|
||||
.Enrich.FromLogContext() |
|
||||
.WriteTo.Async(c => c.File("Logs/logs.txt")) |
|
||||
.WriteTo.Async(c => c.Console()) |
|
||||
.CreateLogger(); |
|
||||
|
|
||||
try |
|
||||
{ |
|
||||
Log.Information("Starting web host."); |
|
||||
var builder = WebApplication.CreateBuilder(args); |
|
||||
builder.Host.AddAppSettingsSecretsJson() |
|
||||
.UseAutofac() |
|
||||
.UseSerilog(); |
|
||||
await builder.AddApplicationAsync<TestsHttpApiHostModule>(); |
|
||||
var app = builder.Build(); |
|
||||
await app.InitializeApplicationAsync(); |
|
||||
await app.RunAsync(); |
|
||||
return 0; |
|
||||
} |
|
||||
catch (Exception ex) |
|
||||
{ |
|
||||
if (ex is HostAbortedException) |
|
||||
{ |
|
||||
throw; |
|
||||
} |
|
||||
|
|
||||
Log.Fatal(ex, "Host terminated unexpectedly!"); |
|
||||
return 1; |
|
||||
} |
|
||||
finally |
|
||||
{ |
|
||||
Log.CloseAndFlush(); |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,27 +0,0 @@ |
|||||
{ |
|
||||
"iisSettings": { |
|
||||
"windowsAuthentication": false, |
|
||||
"anonymousAuthentication": true, |
|
||||
"iisExpress": { |
|
||||
"applicationUrl": "https://localhost:44368", |
|
||||
"sslPort": 44368 |
|
||||
} |
|
||||
}, |
|
||||
"profiles": { |
|
||||
"IIS Express": { |
|
||||
"commandName": "IISExpress", |
|
||||
"launchBrowser": true, |
|
||||
"environmentVariables": { |
|
||||
"ASPNETCORE_ENVIRONMENT": "Development" |
|
||||
} |
|
||||
}, |
|
||||
"Lion.AbpPro.EntityFrameworkCore.Tests.DemoApp": { |
|
||||
"commandName": "Project", |
|
||||
"launchBrowser": true, |
|
||||
"applicationUrl": "https://localhost:44368", |
|
||||
"environmentVariables": { |
|
||||
"ASPNETCORE_ENVIRONMENT": "Development" |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
@ -1,192 +0,0 @@ |
|||||
using System; |
|
||||
using System.Collections.Generic; |
|
||||
using System.IO; |
|
||||
using System.Linq; |
|
||||
using IdentityModel; |
|
||||
using Lion.AbpPro.EntityFrameworkCore.Mysql; |
|
||||
using Microsoft.AspNetCore.Authentication.JwtBearer; |
|
||||
using Microsoft.AspNetCore.Builder; |
|
||||
using Microsoft.AspNetCore.Cors; |
|
||||
using Microsoft.AspNetCore.DataProtection; |
|
||||
using Microsoft.Extensions.Configuration; |
|
||||
using Microsoft.Extensions.DependencyInjection; |
|
||||
using Microsoft.Extensions.Hosting; |
|
||||
using Lion.AbpPro.EntityFrameworkCore.Tests.EntityFrameworkCore; |
|
||||
using StackExchange.Redis; |
|
||||
using Microsoft.OpenApi.Models; |
|
||||
using Volo.Abp; |
|
||||
using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy; |
|
||||
using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; |
|
||||
using Volo.Abp.AspNetCore.Serilog; |
|
||||
using Volo.Abp.AuditLogging.EntityFrameworkCore; |
|
||||
using Volo.Abp.Autofac; |
|
||||
using Volo.Abp.Caching; |
|
||||
using Volo.Abp.Caching.StackExchangeRedis; |
|
||||
using Volo.Abp.EntityFrameworkCore; |
|
||||
using Volo.Abp.EntityFrameworkCore.MySQL; |
|
||||
using Volo.Abp.Localization; |
|
||||
using Volo.Abp.Modularity; |
|
||||
using Volo.Abp.MultiTenancy; |
|
||||
using Volo.Abp.PermissionManagement.EntityFrameworkCore; |
|
||||
using Volo.Abp.Security.Claims; |
|
||||
using Volo.Abp.SettingManagement.EntityFrameworkCore; |
|
||||
using Volo.Abp.Swashbuckle; |
|
||||
using Volo.Abp.TenantManagement.EntityFrameworkCore; |
|
||||
using Volo.Abp.VirtualFileSystem; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests; |
|
||||
|
|
||||
[DependsOn( |
|
||||
typeof(TestsApplicationModule), |
|
||||
typeof(TestsEntityFrameworkCoreModule), |
|
||||
typeof(TestsHttpApiModule), |
|
||||
typeof(AbpAspNetCoreMvcUiMultiTenancyModule), |
|
||||
typeof(AbpAutofacModule), |
|
||||
typeof(AbpCachingStackExchangeRedisModule), |
|
||||
typeof(AbpEntityFrameworkCoreMySQLModule), |
|
||||
typeof(AbpAuditLoggingEntityFrameworkCoreModule), |
|
||||
typeof(AbpPermissionManagementEntityFrameworkCoreModule), |
|
||||
typeof(AbpSettingManagementEntityFrameworkCoreModule), |
|
||||
typeof(AbpTenantManagementEntityFrameworkCoreModule), |
|
||||
typeof(AbpAspNetCoreSerilogModule), |
|
||||
typeof(AbpSwashbuckleModule), |
|
||||
typeof(LionAbpProEntityFrameworkCoreMysqlModule) |
|
||||
)] |
|
||||
public class TestsHttpApiHostModule : AbpModule |
|
||||
{ |
|
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
|
||||
{ |
|
||||
var hostingEnvironment = context.Services.GetHostingEnvironment(); |
|
||||
var configuration = context.Services.GetConfiguration(); |
|
||||
|
|
||||
Configure<AbpDbContextOptions>(options => { options.UseMySQL(); }); |
|
||||
|
|
||||
// Configure<AbpMultiTenancyOptions>(options =>
|
|
||||
// {
|
|
||||
// options.IsEnabled = MultiTenancyConsts.IsEnabled;
|
|
||||
// });
|
|
||||
|
|
||||
if (hostingEnvironment.IsDevelopment()) |
|
||||
{ |
|
||||
// Configure<AbpVirtualFileSystemOptions>(options =>
|
|
||||
// {
|
|
||||
// options.FileSets.ReplaceEmbeddedByPhysical<TestsDomainSharedModule>(Path.Combine(hostingEnvironment.ContentRootPath, string.Format("..{0}..{0}src{0}Lion.AbpPro.EntityFrameworkCore.Tests.Domain.Shared", Path.DirectorySeparatorChar)));
|
|
||||
// options.FileSets.ReplaceEmbeddedByPhysical<TestsDomainModule>(Path.Combine(hostingEnvironment.ContentRootPath, string.Format("..{0}..{0}src{0}Lion.AbpPro.EntityFrameworkCore.Tests.Domain", Path.DirectorySeparatorChar)));
|
|
||||
// options.FileSets.ReplaceEmbeddedByPhysical<TestsApplicationContractsModule>(Path.Combine(hostingEnvironment.ContentRootPath, string.Format("..{0}..{0}src{0}Lion.AbpPro.EntityFrameworkCore.Tests.Application.Contracts", Path.DirectorySeparatorChar)));
|
|
||||
// options.FileSets.ReplaceEmbeddedByPhysical<TestsApplicationModule>(Path.Combine(hostingEnvironment.ContentRootPath, string.Format("..{0}..{0}src{0}Lion.AbpPro.EntityFrameworkCore.Tests.Application", Path.DirectorySeparatorChar)));
|
|
||||
// });
|
|
||||
} |
|
||||
|
|
||||
// context.Services.AddAbpSwaggerGenWithOAuth(
|
|
||||
// configuration["AuthServer:Authority"],
|
|
||||
// new Dictionary<string, string>
|
|
||||
// {
|
|
||||
// { "Tests", "Tests API" }
|
|
||||
// },
|
|
||||
// options =>
|
|
||||
// {
|
|
||||
// options.SwaggerDoc("v1", new OpenApiInfo { Title = "Tests API", Version = "v1" });
|
|
||||
// options.DocInclusionPredicate((docName, description) => true);
|
|
||||
// options.CustomSchemaIds(type => type.FullName);
|
|
||||
// });
|
|
||||
|
|
||||
Configure<AbpLocalizationOptions>(options => |
|
||||
{ |
|
||||
options.Languages.Add(new LanguageInfo("ar", "ar", "العربية")); |
|
||||
options.Languages.Add(new LanguageInfo("cs", "cs", "Čeština")); |
|
||||
options.Languages.Add(new LanguageInfo("en", "en", "English")); |
|
||||
options.Languages.Add(new LanguageInfo("en-GB", "en-GB", "English (UK)")); |
|
||||
options.Languages.Add(new LanguageInfo("fi", "fi", "Finnish")); |
|
||||
options.Languages.Add(new LanguageInfo("fr", "fr", "Français")); |
|
||||
options.Languages.Add(new LanguageInfo("hi", "hi", "Hindi", "in")); |
|
||||
options.Languages.Add(new LanguageInfo("is", "is", "Icelandic", "is")); |
|
||||
options.Languages.Add(new LanguageInfo("it", "it", "Italiano", "it")); |
|
||||
options.Languages.Add(new LanguageInfo("hu", "hu", "Magyar")); |
|
||||
options.Languages.Add(new LanguageInfo("pt-BR", "pt-BR", "Português")); |
|
||||
options.Languages.Add(new LanguageInfo("ro-RO", "ro-RO", "Română")); |
|
||||
options.Languages.Add(new LanguageInfo("ru", "ru", "Русский")); |
|
||||
options.Languages.Add(new LanguageInfo("sk", "sk", "Slovak")); |
|
||||
options.Languages.Add(new LanguageInfo("tr", "tr", "Türkçe")); |
|
||||
options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文")); |
|
||||
options.Languages.Add(new LanguageInfo("zh-Hant", "zh-Hant", "繁體中文")); |
|
||||
options.Languages.Add(new LanguageInfo("de-DE", "de-DE", "Deutsch")); |
|
||||
options.Languages.Add(new LanguageInfo("es", "es", "Español")); |
|
||||
options.Languages.Add(new LanguageInfo("el", "el", "Ελληνικά")); |
|
||||
}); |
|
||||
|
|
||||
context.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) |
|
||||
.AddJwtBearer(options => |
|
||||
{ |
|
||||
options.Authority = configuration["AuthServer:Authority"]; |
|
||||
options.RequireHttpsMetadata = Convert.ToBoolean(configuration["AuthServer:RequireHttpsMetadata"]); |
|
||||
options.Audience = "Tests"; |
|
||||
}); |
|
||||
|
|
||||
Configure<AbpDistributedCacheOptions>(options => { options.KeyPrefix = "Tests:"; }); |
|
||||
|
|
||||
var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("Tests"); |
|
||||
if (!hostingEnvironment.IsDevelopment()) |
|
||||
{ |
|
||||
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]); |
|
||||
dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "Tests-Protection-Keys"); |
|
||||
} |
|
||||
|
|
||||
context.Services.AddCors(options => |
|
||||
{ |
|
||||
options.AddDefaultPolicy(builder => |
|
||||
{ |
|
||||
builder |
|
||||
.WithOrigins( |
|
||||
configuration["App:CorsOrigins"]? |
|
||||
.Split(",", StringSplitOptions.RemoveEmptyEntries) |
|
||||
.Select(o => o.RemovePostFix("/")) |
|
||||
.ToArray() ?? Array.Empty<string>() |
|
||||
) |
|
||||
.WithAbpExposedHeaders() |
|
||||
.SetIsOriginAllowedToAllowWildcardSubdomains() |
|
||||
.AllowAnyHeader() |
|
||||
.AllowAnyMethod() |
|
||||
.AllowCredentials(); |
|
||||
}); |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
public override void OnApplicationInitialization(ApplicationInitializationContext context) |
|
||||
{ |
|
||||
var app = context.GetApplicationBuilder(); |
|
||||
var env = context.GetEnvironment(); |
|
||||
|
|
||||
if (env.IsDevelopment()) |
|
||||
{ |
|
||||
app.UseDeveloperExceptionPage(); |
|
||||
} |
|
||||
else |
|
||||
{ |
|
||||
app.UseHsts(); |
|
||||
} |
|
||||
|
|
||||
app.UseHttpsRedirection(); |
|
||||
app.UseCorrelationId(); |
|
||||
app.UseStaticFiles(); |
|
||||
app.UseRouting(); |
|
||||
app.UseCors(); |
|
||||
app.UseAuthentication(); |
|
||||
|
|
||||
app.UseMultiTenancy(); |
|
||||
|
|
||||
app.UseAbpRequestLocalization(); |
|
||||
app.UseAuthorization(); |
|
||||
app.UseSwagger(); |
|
||||
app.UseAbpSwaggerUI(options => |
|
||||
{ |
|
||||
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Support APP API"); |
|
||||
|
|
||||
var configuration = context.GetConfiguration(); |
|
||||
options.OAuthClientId(configuration["AuthServer:SwaggerClientId"]); |
|
||||
options.OAuthScopes("Tests"); |
|
||||
}); |
|
||||
app.UseAuditing(); |
|
||||
app.UseAbpSerilogEnrichers(); |
|
||||
app.UseConfiguredEndpoints(); |
|
||||
} |
|
||||
} |
|
||||
@ -1,12 +0,0 @@ |
|||||
{ |
|
||||
"App": { |
|
||||
"CorsOrigins": "https://*.Tests.com,http://localhost:4200,http://localhost:44307,https://localhost:44307" |
|
||||
}, |
|
||||
"ConnectionStrings": { |
|
||||
"Default": "Data Source=localhost;Port=3306;Database=LionAbpProDB;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true", |
|
||||
"Tests": "Data Source=localhost;Port=3306;Database=LionAbpProDBMysql;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true" |
|
||||
}, |
|
||||
"Redis": { |
|
||||
"Configuration": "127.0.0.1" |
|
||||
} |
|
||||
} |
|
||||
@ -1,2 +0,0 @@ |
|||||
{ |
|
||||
} |
|
||||
@ -1,3 +0,0 @@ |
|||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd"> |
|
||||
<ConfigureAwait ContinueOnCapturedContext="false" /> |
|
||||
</Weavers> |
|
||||
@ -1,30 +0,0 @@ |
|||||
<?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> |
|
||||
@ -1,3 +0,0 @@ |
|||||
{ |
|
||||
"role": "lib.http-api" |
|
||||
} |
|
||||
@ -1,16 +0,0 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
|
||||
|
|
||||
|
|
||||
|
|
||||
<PropertyGroup> |
|
||||
<TargetFramework>net7.0</TargetFramework> |
|
||||
<Nullable>enable</Nullable> |
|
||||
<RootNamespace>Lion.AbpPro.EntityFrameworkCore.Tests</RootNamespace> |
|
||||
</PropertyGroup> |
|
||||
|
|
||||
<ItemGroup> |
|
||||
<PackageReference Include="Volo.Abp.AspNetCore.Mvc" Version="7.2.2" /> |
|
||||
<ProjectReference Include="..\Lion.AbpPro.EntityFrameworkCore.Tests.Application.Contracts\Lion.AbpPro.EntityFrameworkCore.Tests.Application.Contracts.csproj" /> |
|
||||
</ItemGroup> |
|
||||
|
|
||||
</Project> |
|
||||
@ -1,33 +0,0 @@ |
|||||
using System.Threading.Tasks; |
|
||||
using Microsoft.AspNetCore.Authorization; |
|
||||
using Microsoft.AspNetCore.Mvc; |
|
||||
using Volo.Abp; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests.Samples; |
|
||||
|
|
||||
[Area(TestsRemoteServiceConsts.ModuleName)] |
|
||||
[RemoteService(Name = TestsRemoteServiceConsts.RemoteServiceName)] |
|
||||
[Route("api/Tests/sample")] |
|
||||
public class SampleController : TestsController, ISampleAppService |
|
||||
{ |
|
||||
private readonly ISampleAppService _sampleAppService; |
|
||||
|
|
||||
public SampleController(ISampleAppService sampleAppService) |
|
||||
{ |
|
||||
_sampleAppService = sampleAppService; |
|
||||
} |
|
||||
|
|
||||
[HttpGet] |
|
||||
public async Task<SampleDto> GetAsync() |
|
||||
{ |
|
||||
return await _sampleAppService.GetAsync(); |
|
||||
} |
|
||||
|
|
||||
[HttpGet] |
|
||||
[Route("authorized")] |
|
||||
[Authorize] |
|
||||
public async Task<SampleDto> GetAuthorizedAsync() |
|
||||
{ |
|
||||
return await _sampleAppService.GetAsync(); |
|
||||
} |
|
||||
} |
|
||||
@ -1,12 +0,0 @@ |
|||||
using Lion.AbpPro.EntityFrameworkCore.Tests.Localization; |
|
||||
using Volo.Abp.AspNetCore.Mvc; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests; |
|
||||
|
|
||||
public abstract class TestsController : AbpControllerBase |
|
||||
{ |
|
||||
protected TestsController() |
|
||||
{ |
|
||||
LocalizationResource = typeof(TestsResource); |
|
||||
} |
|
||||
} |
|
||||
@ -1,32 +0,0 @@ |
|||||
using Localization.Resources.AbpUi; |
|
||||
using Lion.AbpPro.EntityFrameworkCore.Tests.Localization; |
|
||||
using Volo.Abp.AspNetCore.Mvc; |
|
||||
using Volo.Abp.Localization; |
|
||||
using Volo.Abp.Modularity; |
|
||||
using Microsoft.Extensions.DependencyInjection; |
|
||||
|
|
||||
namespace Lion.AbpPro.EntityFrameworkCore.Tests; |
|
||||
|
|
||||
[DependsOn( |
|
||||
typeof(TestsApplicationContractsModule), |
|
||||
typeof(AbpAspNetCoreMvcModule))] |
|
||||
public class TestsHttpApiModule : AbpModule |
|
||||
{ |
|
||||
public override void PreConfigureServices(ServiceConfigurationContext context) |
|
||||
{ |
|
||||
PreConfigure<IMvcBuilder>(mvcBuilder => |
|
||||
{ |
|
||||
mvcBuilder.AddApplicationPartIfNotExists(typeof(TestsHttpApiModule).Assembly); |
|
||||
}); |
|
||||
} |
|
||||
|
|
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
|
||||
{ |
|
||||
Configure<AbpLocalizationOptions>(options => |
|
||||
{ |
|
||||
options.Resources |
|
||||
.Get<TestsResource>() |
|
||||
.AddBaseTypes(typeof(AbpUiResource)); |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue