diff --git a/README.md b/README.md index c22fe5ec4b..8d872160ca 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Build Status](http://vjenkins.dynu.net:5480/job/abp/badge/icon)](http://ci.volosoft.com:5480/blue/organizations/jenkins/abp/activity) [![NuGet](https://img.shields.io/nuget/v/Volo.Abp.Core.svg?style=flat-square)](https://www.nuget.org/packages/Volo.Abp.Core) [![NuGet Download](https://img.shields.io/nuget/dt/Volo.Abp.Core.svg?style=flat-square)](https://www.nuget.org/packages/Volo.Abp.Core) -[![MyGet (with prereleases)](https://img.shields.io/myget/abp-nightly/vpre/Volo.Abp.Core.svg?style=flat-square)](https://docs.abp.io/en/abp/latest/Nightly-Builds) +[![MyGet (with prereleases)](https://img.shields.io/myget/abp-nightly/vpre/Volo.Abp.svg?style=flat-square)](https://docs.abp.io/en/abp/latest/Nightly-Builds) This project is the next generation of the [ASP.NET Boilerplate](https://aspnetboilerplate.com/) web application framework. See [the announcement](https://blog.abp.io/abp/Abp-vNext-Announcement). @@ -27,6 +27,8 @@ Framework solution is located under the `framework` folder. It has no external d [Modules](modules/) and [Templates](templates/) have their own solutions and have **local references** to the framework and each other. +Visual Studio can not work properly with the local references out of the solution folder. When you open a module/sample solution in the Visual Studio, you may get some errors related to the dependencies. In this case, run the `dotnet restore` on the command prompt for the related solution's folder. You need to run it after you first open the solution or change a dependency. + ### Contribution ABP is an open source platform. Check [the contribution guide](docs/en/Contribution/Index.md) if you want to contribute to the project. diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/AbpIoLocalization.csproj b/abp_io/AbpIoLocalization/AbpIoLocalization/AbpIoLocalization.csproj index aaebfafe6f..7b26f13919 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/AbpIoLocalization.csproj +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/AbpIoLocalization.csproj @@ -1,4 +1,4 @@ - + netstandard2.0 diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Account/Localization/Resources/zh-Hant.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Account/Localization/Resources/zh-Hant.json new file mode 100644 index 0000000000..58d01109b5 --- /dev/null +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Account/Localization/Resources/zh-Hant.json @@ -0,0 +1,13 @@ +{ + "culture": "zh-Hant", + "texts": { + "Account": "帳號", + "Welcome": "歡迎", + "UseOneOfTheFollowingLinksToContinue": "使用下面的連結繼續", + "FrameworkHomePage": "框架首頁", + "FrameworkDocumentation": "框架文件", + "OfficialBlog": "官方部落格", + "CommercialHomePage": "商業版首頁", + "CommercialSupportWebSite": "商業版支援網站" + } +} \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json index 7ce192c3ca..9c00e584ab 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json @@ -1,6 +1,8 @@ { "culture": "en", "texts": { + "Permission:Organizations": "Organizations", + "Permission:Manage": "Manage Organizations", "Permission:NpmPackages": "NPM Packages", "Permission:NugetPackages": "Nuget Packages", "Permission:Maintenance": "Maintenance", @@ -11,6 +13,7 @@ "Permission:Edit": "Edit", "Permission:Delete": "Delete", "Permission:Create": "Create", + "Menu:Organizations": "Organizations", "Menu:Packages": "Packages", "NpmPackageDeletionWarningMessage": "This NPM Package will be deleted. Do you confirm that?", "NugetPackageDeletionWarningMessage": "This Nuget Package will be deleted. Do you confirm that?", @@ -34,7 +37,7 @@ "NugetPackageTarget.HttpApi": "Http Api", "NugetPackageTarget.HttpApiClient": "Http Api Client", "NugetPackageTarget.Web": "Web", - "NugetPackageTarget.EntityFrameworkCore": "EntityFramework Core", + "NugetPackageTarget.EntityFrameworkCore": "DeleteAllEntityFramework Core", "NugetPackageTarget.MongoDB": "MongoDB", "Edit": "Edit", "Delete": "Delete", @@ -55,6 +58,31 @@ "Menu:NpmPackages": "NPM Packages", "Menu:Modules": "Modules", "Menu:Maintenance": "Maintenance", - "Menu:NugetPackages": "Nuget Packages" + "Menu:NugetPackages": "Nuget Packages", + "CreateAnOrganization": "Create an organization", + "Organizations": "Organizations", + "LongName": "Long name", + "LicenseType": "License type", + "LicenseStartTime": "License start time", + "LicenseEndTime": "License end time", + "AllowedDeveloperCount": "Allowed developer count", + "UserNameOrEmailAddress": "Username or email address", + "AddOwner": "Add owner", + "UserName": "Username", + "Email": "Email", + "Developers": "Developers", + "AddDeveloper": "Add developer", + "Create": "Create", + "UserNotFound": "User not found", + "{0}WillBeRemovedFromMembers": "{0} Will be removed from members", + "Computers": "Computers", + "UniqueComputerId": "Unique computer id", + "LastSeenDate": "Last seen date", + "{0}Computer{1}WillBeRemovedFromRecords": "Computer of {0} ({1}) will be removed from records", + "OrganizationDeletionWarningMessage": "Organization will be deleted", + "This{0}AlreadyExistInThisOrganization": "This {0} already exist in this organization", + "AreYouSureYouWantToDeleteAllComputers": "Are you sure you want to delete all computers?", + "DeleteAll": "Delete all", + "DoYouWantToCreateNewUser": "Do you want to create new user?" } } \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/zh-Hans.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/zh-Hans.json index 7c3d3ce695..bc78a54119 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/zh-Hans.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/zh-Hans.json @@ -1,6 +1,8 @@ { "culture": "zh-Hans", "texts": { + "Permission:Organizations": "组织", + "Permission:Manage": "管理组织", "Permission:NpmPackages": "NPM包", "Permission:NugetPackages": "Nuget包", "Permission:Maintenance": "维护", @@ -11,6 +13,7 @@ "Permission:Edit": "编辑", "Permission:Delete": "删除", "Permission:Create": "创建", + "Menu:Organizations": "组织", "Menu:Packages": "包", "NpmPackageDeletionWarningMessage": "该NPM包将会被删除. 你确定吗?", "NugetPackageDeletionWarningMessage": "该Nuget包将会被删除. 你确定吗?", @@ -55,6 +58,30 @@ "Menu:NpmPackages": "NPM包", "Menu:Modules": "模块", "Menu:Maintenance": "维护", - "Menu:NugetPackages": "Nuget包" + "Menu:NugetPackages": "Nuget包", + "CreateAnOrganization": "创建新组织", + "Organizations": "组织", + "LongName": "完整名称", + "LicenseType": "授权类型", + "LicenseStartTime": "授权开始时间", + "LicenseEndTime": "授权结束时间", + "AllowedDeveloperCount": "允许的开发人员数量", + "UserNameOrEmailAddress": "用户名或电子邮件地址", + "AddOwner": "添加所有者", + "UserName": "用户名", + "Email": "电子邮件地址", + "Developers": "开发者", + "AddDeveloper": "添加开发者", + "Create": "创建", + "UserNotFound": "用户不存在", + "{0}WillBeRemovedFromMembers": "{0} 将从成员中删除", + "Computers": "计算机", + "UniqueComputerId": "计算机唯一ID", + "LastSeenDate": "上次查看日期", + "{0}Computer{1}WillBeRemovedFromRecords": "计算机 {0} ({1}) 将从记录中删除", + "OrganizationDeletionWarningMessage": "组织将被删除", + "This{0}AlreadyExistInThisOrganization": "该组织中已经存在此 {0}", + "AreYouSureYouWantToDeleteAllComputers": "您确定要删除所有计算机吗?", + "DeleteAll": "删除所有" } } \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/zh-Hant.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/zh-Hant.json new file mode 100644 index 0000000000..4787d74b25 --- /dev/null +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/zh-Hant.json @@ -0,0 +1,60 @@ +{ + "culture": "zh-Hant", + "texts": { + "Permission:NpmPackages": "NPM套件", + "Permission:NugetPackages": "Nuget套件", + "Permission:Maintenance": "維護", + "Permission:Maintain": "維護", + "Permission:ClearCaches": "清除快取", + "Permission:Modules": "模組", + "Permission:Packages": "套件", + "Permission:Edit": "編輯", + "Permission:Delete": "刪除", + "Permission:Create": "建立", + "Menu:Packages": "套件", + "NpmPackageDeletionWarningMessage": "該NPM套件將會被刪除. 你確定嗎?", + "NugetPackageDeletionWarningMessage": "該Nuget套件將會被刪除. 你確定嗎?", + "ModuleDeletionWarningMessage": "該模組將會被刪除. 你確定嗎?", + "Name": "名稱", + "DisplayName": "顯示名稱", + "ShortDescription": "簡述", + "NameFilter": "名稱", + "CreationTime": "建立時間", + "IsPro": "是否為專業版", + "EfCoreConfigureMethodName": "設定方法", + "IsProFilter": "是否為專業版", + "ApplicationType": "應用程式類型", + "Target": "目標", + "TargetFilter": "目標", + "ModuleClass": "模組分類", + "NugetPackageTarget.DomainShared": "Domain Shared", + "NugetPackageTarget.Domain": "Domain", + "NugetPackageTarget.Application": "Application", + "NugetPackageTarget.ApplicationContracts": "Application Contracts", + "NugetPackageTarget.HttpApi": "Http Api", + "NugetPackageTarget.HttpApiClient": "Http Api Client", + "NugetPackageTarget.Web": "Web", + "NugetPackageTarget.EntityFrameworkCore": "EntityFramework Core", + "NugetPackageTarget.MongoDB": "MongoDB", + "Edit": "編輯", + "Delete": "刪除", + "Refresh": "刷新", + "NpmPackages": "NPM套件", + "NugetPackages": "Nuget套件", + "NpmPackageCount": "NPM套件數量", + "NugetPackageCount": "Nuget套件數量", + "Module": "模組", + "ModuleInfo": "模組信息", + "CreateANpmPackage": "建立NPM套件", + "CreateAModule": "建立模組", + "CreateANugetPackage": "建立Nuget套件", + "AddNew": "建立", + "PackageAlreadyExist{0}": "\"{0}\"已經被添加.", + "ClearCache": "清除快取", + "SuccessfullyCleared": "清除成功", + "Menu:NpmPackages": "NPM套件", + "Menu:Modules": "模組", + "Menu:Maintenance": "維護", + "Menu:NugetPackages": "Nuget套件" + } +} \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/zh-Hant.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/zh-Hant.json new file mode 100644 index 0000000000..fe97ac3a6c --- /dev/null +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/zh-Hant.json @@ -0,0 +1,31 @@ +{ + "culture": "zh-Hant", + "texts": { + "Volo.AbpIo.Domain:010004": "超過最大成員數!", + "Volo.AbpIo.Domain:010005": "超過最大擁有者數!", + "Volo.AbpIo.Domain:010006": "使用者已經是該組織的擁有者!", + "Volo.AbpIo.Domain:010007": "該使用者已經是該組織的開發者!", + "Volo.AbpIo.Domain:010008": "允許的開發者數量不能低於當前開發者數量!", + "Volo.AbpIo.Domain:010009": "允許的開發者數量不能小於零!", + "Volo.AbpIo.Domain:010010": "超出了最大mac地址數!", + "Volo.AbpIo.Domain:010011": "個人許可不允許超過1個開發者!", + "Volo.AbpIo.Domain:010012": "許可過期後許可不可延長1個月!", + "Volo.AbpIo.Domain:020001": "不能刪除該NPM套件因為\"{NugetPackages}\"Nuget套件依賴此套件.", + "Volo.AbpIo.Domain:020002": "不能刪除該NPM套件因為\"{Modules}\"模組正在使用此套件.", + "Volo.AbpIo.Domain:020003": "不能刪除該NPM套件因為\"{Modules}\"模組正在使用此套件並且\"{NugetPackages}\"Nuget套件依賴此套件.", + "Volo.AbpIo.Domain:020004": "不能刪除該Nuget套件因為\"{Modules}\"模組正在使用此套件.", + "WantToLearn?": "想學習嗎?", + "ReadyToGetStarted?": "準備開始了嗎?", + "JoinOurCommunity": "加入我們的社群", + "GetStartedUpper": "開始", + "ForkMeOnGitHub": "Fork me on GitHub", + "Features": "功能", + "GetStarted": "開始", + "Documents": "文件", + "Community": "社群", + "ContributionGuide": "貢獻指南", + "Blog": "部落格", + "Commercial": "商業版", + "SeeDocuments": "查看文件" + } +} \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Blog/Localization/Resources/zh-Hant.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Blog/Localization/Resources/zh-Hant.json new file mode 100644 index 0000000000..7de3798218 --- /dev/null +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Blog/Localization/Resources/zh-Hant.json @@ -0,0 +1,5 @@ +{ + "culture": "zh-Hant", + "texts": { + } +} \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json index c83e5aa6a9..7987b9ab32 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json @@ -6,6 +6,7 @@ "Volo.AbpIo.Commercial:010003": "You are not owner of this organization!", "OrganizationNotFoundMessage": "No organization found!", "DeveloperCount": "Developer count", + "QuestionCount": "Question count", "Owners": "Owners", "AddMember": "Add member", "AddOwner": "Add owner", @@ -26,6 +27,8 @@ "MyOrganizations": "My organizations", "ApiKey": "API key", "UserNameNotFound": "There is no user with username {0}", - "SuccessfullyAddedToNewsletter": "Thanks you for subscribing to our newsletter!" + "SuccessfullyAddedToNewsletter": "Thanks you for subscribing to our newsletter!", + "ManageProfile": "Manage your profile", + "EmailNotValid": "Please enter a valid email address." } } \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/zh-Hant.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/zh-Hant.json new file mode 100644 index 0000000000..e39eaba846 --- /dev/null +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/zh-Hant.json @@ -0,0 +1,30 @@ +{ + "culture": "zh-Hant", + "texts": { + "OrganizationManagement": "組織管理", + "OrganizationList": "組織列表", + "Volo.AbpIo.Commercial:010003": "您不是該組織的擁有者!", + "OrganizationNotFoundMessage": "找不到任何組織!", + "DeveloperCount": "開發者數量", + "Owners": "擁有者", + "AddMember": "加入成員", + "AddOwner": "加入擁有者", + "AddDeveloper": "加入開發者", + "UserName": "使用者名稱", + "Name": "名稱", + "EmailAddress": "電子信箱地址", + "Developers": "開發者", + "LicenseType": "許可證類型", + "Manage": "管理", + "StartDate": "開始日期", + "EndDate": "結束日期", + "Modules": "模組", + "LicenseExtendMessage": "您的許可已經延長至{0}", + "LicenseUpgradeMessage": "您的許可已升級為{0}", + "LicenseAddDeveloperMessage": "{0}個開發者已加入到您的許可", + "Volo.AbpIo.Commercial:010004": "不能找到指定的使用者! 使用者必須已經註冊.", + "MyOrganizations": "我的組織", + "ApiKey": "API key", + "UserNameNotFound": "沒有使用者名稱為{0}的使用者" + } +} \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Docs/Localization/Resources/zh-Hant.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Docs/Localization/Resources/zh-Hant.json new file mode 100644 index 0000000000..7de3798218 --- /dev/null +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Docs/Localization/Resources/zh-Hant.json @@ -0,0 +1,5 @@ +{ + "culture": "zh-Hant", + "texts": { + } +} \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Support/Localization/Resources/zh-Hant.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Support/Localization/Resources/zh-Hant.json new file mode 100644 index 0000000000..7de3798218 --- /dev/null +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Support/Localization/Resources/zh-Hant.json @@ -0,0 +1,5 @@ +{ + "culture": "zh-Hant", + "texts": { + } +} \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hant.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hant.json new file mode 100644 index 0000000000..6c74dbcadd --- /dev/null +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hant.json @@ -0,0 +1,159 @@ +{ + "culture": "zh-Hant", + "texts": { + "GetStarted": "開始", + "Create": "建立", + "NewProject": "新專案", + "DirectDownload": "直接下載", + "ProjectName": "專案名稱", + "ProjectType": "專案類型", + "DatabaseProvider": "資料庫提供者", + "NTier": "N層", + "IncludeUserInterface": "包含使用者介面", + "CreateNow": "現在建立", + "TheStartupProject": "起始專案", + "Tutorial": "教學", + "UsingCLI": "使用CLI", + "SeeDetails": "看詳細", + "AbpShortDescription": "ABP是用於建立現代Web應用程式的完整架構和強大的基礎設施! 遵循最佳實作和約定,為您提供SOLID開發經驗.", + "SourceCodeUpper": "原始碼", + "LatestReleaseLogs": "最新發佈日誌", + "Infrastructure": "基礎設施", + "Architecture": "架構", + "Modular": "模組化", + "DontRepeatYourself": "不要重複工作", + "DeveloperFocused": "專注於開發者", + "FullStackApplicationInfrastructure": "全端應用程式基礎設施", + "DomainDrivenDesign": "領域驅動設計", + "DomainDrivenDesignExplanation": "依據DDD模式和準則進行設計和開發. 為您的應用程式提供分層模型.", + "Authorization": "授權", + "AuthorizationExplanation": "具有使用者,角色和細膩度權限系統的高級授權. 建立於Microsoft Identity套件上.", + "MultiTenancy": "多租戶", + "MultiTenancyExplanationShort": "SaaS應用程式變得簡單! 從資料庫到UI的多租戶整合.", + "CrossCuttingConcerns": "橫切關注點", + "CrossCuttingConcernsExplanationShort": "完整的基礎架構,用於授權,驗證,異常處理,快取,稽核日誌,交易管理等.", + "BuiltInBundlingMinification": "內建Bundling & Minification", + "BuiltInBundlingMinificationExplanation": "無須使用外部工具進行Bundling & Minification. ABP提供了一種更簡單,動態,功能強大,模組化和內建的方式!", + "VirtualFileSystem": "虛擬文件系統", + "VirtualFileSystemExplanation": "將檢視,腳本,樣式,圖片...嵌入到套件/類別庫中,並在不同的應用程式中重複使用.", + "Theming": "主題", + "ThemingExplanationShort": "使用和訂製基於bootstrap的標準UI主題,或建立自己的主題.", + "BootstrapTagHelpersDynamicForms": "Bootstrap Tag Helpers和動態表單", + "BootstrapTagHelpersDynamicFormsExplanation": "內建的背景作業系統可以整合到Hangfire,RabbitMQ或您喜歡的任何工具中.", //TODO explanation doesn't match. + "HTTPAPIsDynamicProxies": "HTTP APIs和動態代理", + "HTTPAPIsDynamicProxiesExplanation": "自動將應用程式服務公開為REST樣式的HTTP API,並與動態JavaScript和C#代理一起使用.", + "CompleteArchitectureInfo": "現在架構用來建立可維護的軟體解決方案.", + "DomainDrivenDesignBasedLayeringModelExplanation": "幫助您實現基於DDD的分層架構並建構可維護的程式碼.", + "DomainDrivenDesignBasedLayeringModelExplanationCont": "提供啟動模板,抽象,基礎類別,服務,文件和指南以幫助您開發基於DDD模式和準則的應用程式.", + "MicroserviceCompatibleModelExplanation": "核心框架和預先建構模組在設計時就考慮了微服務架構.", + "MicroserviceCompatibleModelExplanationCont": "提供基礎結構,整合,範例和文件,以更輕鬆地實現微服務解決方案,而如果您要使用整體應用程式,也不會帶來額外的複雜性.", + "ModularInfo": "ABP提供了完整的模組化系統,使您能夠開發可重複使用的應用程式模組.", + "PreBuiltModulesThemes": "預先建構模組和主題", + "PreBuiltModulesThemesExplanation": "開源和商業模組和主題已準備好在您的業務應用程式中使用.", + "NuGetNPMPackages": "NuGet和NPM套件", + "NuGetNPMPackagesExplanation": "作為NuGet和NPM套件發佈.易於安裝和升級.", + "ExtensibleReplaceable": "可擴展/可替換", + "ExtensibleReplaceableExplanation": "所有服務和模組在設計時都考慮了可擴展性.您可以替換服務,頁面,樣式,組件...", + "CrossCuttingConcernsExplanation2": "保持原始碼整潔,專注於您自己的業務邏輯.", + "CrossCuttingConcernsExplanation3": "不要浪費時間一次又一次地實作共通用的應用程式需求.", + "AuthenticationAuthorization": "認證與授權", + "ExceptionHandling": "異常處理", + "Validation": "驗證", + "DatabaseConnection": "資料庫連接", + "TransactionManagement": "交易管理", + "AuditLogging": "稽核日誌", + "Caching": "快取", + "Multitenancy": "多租戶", + "DataFiltering": "資料過濾", + "ConventionOverConfiguration": "習慣優於設定", + "ConventionOverConfigurationExplanation": "預設情況下,ABP使用最小或零設定實現共通用的應用程式.", + "ConventionOverConfigurationExplanationList1": "自動註冊已知服務以進行依賴注入.", + "ConventionOverConfigurationExplanationList2": "通過命名習慣將應用程式服務公開為HTTP API.", + "ConventionOverConfigurationExplanationList3": "為C#和JavaScript建立動態HTTP客戶端代理.", + "ConventionOverConfigurationExplanationList4": "為您的實體提供預設Repository.", + "ConventionOverConfigurationExplanationList5": "根據Web請求或應用程式服務方法管理工作單元.", + "ConventionOverConfigurationExplanationList6": "為實體發佈建立,更新和刪除事件.", + "BaseClasses": "基礎類別", + "BaseClassesExplanation": "共通用應用程式模式的預先建構基礎類別.", + "DeveloperFocusedExplanation": "ABP是為了開發者", + "DeveloperFocusedExplanationCont": "它旨在簡化您的日常軟體開發,同時又不限制您在需要時進行底層工作。", + "SeeAllFeatures": "瀏覽所有功能", + "CLI_CommandLineInterface": "CLI (命令列介面)", + "CLI_CommandLineInterfaceExplanation": "CLI會自動建立新專案並將模組添加到您的應用程式.", + "StartupTemplates": "起始模板", + "StartupTemplatesExplanation": "各種起始模板為您提供了完整設定的解結方案,以快速啟動您的開發.", + "BasedOnFamiliarTools": "基於熟悉的工具", + "BasedOnFamiliarToolsExplanation": "建立在您已經知道的主流工具上並與其整合.學習曲線低,適應性強,舒適的開發.", + "ORMIndependent": "ORM獨立", + "ORMIndependentExplanation": "核心框架獨立於ORM/資料庫,並且可以與任何資料庫一起使用.Entity Framework Core和MongoDB提供者已經可用.", + "Features": "功能", + "ABPCLI": "ABP CLI", + "Modularity": "模組化", + "BootstrapTagHelpers": "Bootstrap Tag Helpers", + "DynamicForms": "動態表單", + "BundlingMinification": "Bundling & Minification", + "BackgroundJobs": "背景作業", + "DDDInfrastructure": "DDD基礎設施", + "DomainDrivenDesignInfrastructure": "Domain Driven Design基礎設施", + "AutoRESTAPIs": "自動REST APIs", + "DynamicClientProxies": "動態客戶端代理", + "DistributedEventBus": "分散式事件匯流排", + "DistributedEventBusWithRabbitMQIntegration": "具有RabbitMQ整合的分散式事件匯流排", + "TestInfrastructure": "測試基礎設施", + "AuditLoggingEntityHistories": "稽核日誌和實體歷史", + "ObjectToObjectMapping": "物件對應", + "EmailSMSAbstractions": "電子郵件和簡訊抽象", + "EmailSMSAbstractionsWithTemplatingSupport": "具有模板支援的電子郵件和簡訊抽象", + "Localization": "本地化", + "SettingManagement": "設定管理", + "ExtensionMethods": "擴充方法", + "ExtensionMethodsHelpers": "擴充方法和助手", + "AspectOrientedProgramming": "切面導向設計", + "DependencyInjection": "依賴注入", + "DependencyInjectionByConventions": "依照習慣的依賴注入", + "ABPCLIExplanation": "ABP CLI(命令列介面)是用於對ABP解決方案執行常見操作的命令列工具.", + "ModularityExplanation": "ABP提供了一個完整的基礎設施來建構您自己的應用程式模組,這些模組可能具有實體,服務,資料庫整合,API,UI組件等.", //TODO: strong "your own application modules",- + "MultiTenancyExplanation": "ABP框建不僅支援開發多租戶應用程式,而且使您的程式碼幾乎無須知道多租戶.", + "MultiTenancyExplanation2": "可以自動確定當前租戶,將不同租戶的資料互相隔離.", + "MultiTenancyExplanation3": "支援單一資料庫,或每個租戶單獨資料庫或者混合方式.", + "MultiTenancyExplanation4": "您專注於業務邏輯,並讓該框架為您處理多租戶.", + "BootstrapTagHelpersExplanation": "與其手動撰寫重複細節的bootstrap組件,不如使用ABP的tag helper來簡化它並利用自動完成.您當然也可以在需要時直接使用Bootstrap.", + "DynamicFormsExplanation": "動態表單和tag helpers可以利用C#類別做為模型來建立完整的表單.", + "AuthenticationAuthorizationExplanation": "整合到ASP.NET Core Identity和IdentityServer4的豐富身份驗證和授權選項.提供可擴展且詳細的權限系統.", + "CrossCuttingConcernsExplanation": "部要重複資幾一次又一次地實作所有這寫常見的東西.專注於您的業務邏輯,並讓ABP按照習慣自動執行.", + "DatabaseConnectionTransactionManagement": "資料庫連接和交易管理", + "CorrelationIdTracking": "關聯ID追蹤", + "BundlingMinificationExplanation": "ABP提供了一個簡單,動態,功能強大,模組化的內建Bundling & Minification系統.", + "VirtualFileSystemnExplanation": "虛擬文件系統使管理文件系統(硬碟)上不存在的文件成為可能.它主要用於將(js,css,image,cshtml...)文件嵌入到組件(Assembly)中,並在運行時像實體文件一樣使用他們.", + "ThemingExplanation": "主題系統允許通過基於最新的Bootstrap框架定義一組通用基礎類別庫和佈局來獨立開發應用程式和模組主題.", + "DomainDrivenDesignInfrastructureExplanation": "基於領域驅動設計模式和準則建構分層應用程式的完整基礎設施;", + "Specification": "規範", + "Repository": "倉儲", + "DomainService": "領域服務", + "ValueObject": "值對象", + "ApplicationService": "應用服務", + "DataTransferObject": "資料傳輸對象", + "AggregateRootEntity": "聚合根, 實體", + "AutoRESTAPIsExplanation": "ABP可以依照習慣自動將您的應用服務設定為API控制器.", + "DynamicClientProxiesExplanation": "從JavaScript和C#客戶端輕鬆使用您的API.", + "DistributedEventBusWithRabbitMQIntegrationExplanation": "使用帶有RabbitMQ整合的內建分散式事件匯流排,可以輕鬆發佈和使用分散式事件.", + "TestInfrastructureExplanation": "框架已經考慮了單元和整合測試.為您提供基礎類別,使其更容易.起始模板已預先設定用於測試.", + "AuditLoggingEntityHistoriesExplanation": "針對關鍵業務應用的內建稽核日誌紀錄.請求,服務,方法級別的稽核日誌紀錄以及具有屬性級別詳細資訊的實體歷史紀錄.", + "EmailSMSAbstractionsWithTemplatingSupportExplanation": "IEmailSender和ISmsSender抽象使您的應用程式邏輯與基礎設施解耦.先進的電子郵件模板系統允許建立和在地化電子郵件模板,並在需要實輕鬆使用.", + "LocalizationExplanation": "在地化系統允許在純JSON文件中建立資源,並使用它們來在地化UI.它支援繼承,擴展和JavaScript整合等高級方案,同時與AspNet Core的在地化系統完全兼容.", + "SettingManagementExplanation": "定義應用程式的設定,並根據當前設定,租戶和使用者在運行時獲取值.", + "ExtensionMethodsHelpersExplanation": "即使式瑣碎的程式碼部分,也不要重複.標準類型的擴展方法和助手使您的程式碼更加清晰和易於撰寫.", + "AspectOrientedProgrammingExplanation": "提供合適的基礎設施來建立動態代理並實現切面導向設計.攔截任何類別,並在每次方法執行之前和之後執行程式碼.", + "DependencyInjectionByConventionsExplanation": "無須手動註冊類別以進行依賴注入.按照習慣自動註冊常用服務類型.對於其他類型的服務,您可以使用介面和屬性來使其變得更輕鬆.", + "DataFilteringExplanation": "定義和使用資料過濾器,這些過濾器在您從資料庫中查詢實體時會自動應用.當您實現簡單的介面時,可立即使用軟刪除功能和多租戶過濾器.", + "PublishEvents": "發佈事件", + "HandleEvents": "處理事件", + "AndMore": "更多...", + "Code": "編碼", + "Result": "結果", + "SeeTheDocumentForMoreInformation": "查看{0} 文件獲得更多訊息", + "IndexPageHeroSection": "asp.net core的開源Web應用程式
框架
", + "UiFramework": "UI框架", + "EmailAddress": "電子信箱地址" + } +} \ No newline at end of file diff --git a/build-all-release.ps1 b/build-all-release.ps1 deleted file mode 100644 index e6555f8d6b..0000000000 --- a/build-all-release.ps1 +++ /dev/null @@ -1,40 +0,0 @@ -# COMMON PATHS - -$rootFolder = (Get-Item -Path "./" -Verbose).FullName - -# List of solutions - -$solutionPaths = ( - "framework", - "modules/users", - "modules/permission-management", - "modules/setting-management", - "modules/feature-management", - "modules/identity", - "modules/identityserver", - "modules/tenant-management", - "modules/account", - "modules/docs", - "modules/blogging", - "modules/audit-logging", - "modules/background-jobs", - "modules/client-simulation", - "templates/module/aspnet-core", - "templates/app/aspnet-core", - "abp_io/AbpIoLocalization" -) - -# Build all solutions - -foreach ($solutionPath in $solutionPaths) { - $solutionAbsPath = (Join-Path $rootFolder $solutionPath) - Set-Location $solutionAbsPath - dotnet build --configuration Release - if (-Not $?) { - Write-Host ("Build failed for the solution: " + $solutionPath) - Set-Location $rootFolder - exit $LASTEXITCODE - } -} - -Set-Location $rootFolder diff --git a/build-all.ps1 b/build-all.ps1 deleted file mode 100644 index 649abc5f8c..0000000000 --- a/build-all.ps1 +++ /dev/null @@ -1,40 +0,0 @@ -# COMMON PATHS - -$rootFolder = (Get-Item -Path "./" -Verbose).FullName - -# List of solutions - -$solutionPaths = ( - "framework", - "modules/users", - "modules/permission-management", - "modules/setting-management", - "modules/feature-management", - "modules/identity", - "modules/identityserver", - "modules/tenant-management", - "modules/account", - "modules/docs", - "modules/blogging", - "modules/audit-logging", - "modules/background-jobs", - "modules/client-simulation", - "templates/module/aspnet-core", - "templates/app/aspnet-core", - "abp_io/AbpIoLocalization" -) - -# Build all solutions - -foreach ($solutionPath in $solutionPaths) { - $solutionAbsPath = (Join-Path $rootFolder $solutionPath) - Set-Location $solutionAbsPath - dotnet build - if (-Not $?) { - Write-Host ("Build failed for the solution: " + $solutionPath) - Set-Location $rootFolder - exit $LASTEXITCODE - } -} - -Set-Location $rootFolder diff --git a/build/build-all-release.ps1 b/build/build-all-release.ps1 new file mode 100644 index 0000000000..1c86351379 --- /dev/null +++ b/build/build-all-release.ps1 @@ -0,0 +1,16 @@ +. ".\common.ps1" + +# Build all solutions + +foreach ($solutionPath in $solutionPaths) { + $solutionAbsPath = (Join-Path $rootFolder $solutionPath) + Set-Location $solutionAbsPath + dotnet build --configuration Release + if (-Not $?) { + Write-Host ("Build failed for the solution: " + $solutionPath) + Set-Location $rootFolder + exit $LASTEXITCODE + } +} + +Set-Location $rootFolder diff --git a/build/build-all.ps1 b/build/build-all.ps1 new file mode 100644 index 0000000000..ffaffa67a3 --- /dev/null +++ b/build/build-all.ps1 @@ -0,0 +1,16 @@ +. ".\common.ps1" + +# Build all solutions + +foreach ($solutionPath in $solutionPaths) { + $solutionAbsPath = (Join-Path $rootFolder $solutionPath) + Set-Location $solutionAbsPath + dotnet build + if (-Not $?) { + Write-Host ("Build failed for the solution: " + $solutionPath) + Set-Location $rootFolder + exit $LASTEXITCODE + } +} + +Set-Location $rootFolder diff --git a/build/common.ps1 b/build/common.ps1 new file mode 100644 index 0000000000..e4ba6a8adc --- /dev/null +++ b/build/common.ps1 @@ -0,0 +1,34 @@ +# COMMON PATHS + +$rootFolder = (Get-Item -Path "./" -Verbose).FullName + +# List of solutions + +$solutionPaths = ( + "../framework", + "../modules/users", + "../modules/permission-management", + "../modules/setting-management", + "../modules/feature-management", + "../modules/identity", + "../modules/identityserver", + "../modules/tenant-management", + "../modules/account", + "../modules/docs", + "../modules/blogging", + "../modules/audit-logging", + "../modules/background-jobs", + "../modules/client-simulation", + "../templates/module/aspnet-core", + "../templates/app/aspnet-core", + "../samples/BasicAspNetCoreApplication", + "../samples/BasicConsoleApplication", + "../samples/BookStore", + "../samples/BookStore-Angular-MongoDb/aspnet-core", + "../samples/BookStore-Modular/modules/book-management", + "../samples/BookStore-Modular/application", + "../samples/DashboardDemo", + "../samples/MicroserviceDemo", + "../samples/RabbitMqEventBus", + "../abp_io/AbpIoLocalization" +) \ No newline at end of file diff --git a/build/test-all.ps1 b/build/test-all.ps1 new file mode 100644 index 0000000000..1465bff6c3 --- /dev/null +++ b/build/test-all.ps1 @@ -0,0 +1,16 @@ +. ".\common.ps1" + +# Test all solutions + +foreach ($solutionPath in $solutionPaths) { + $solutionAbsPath = (Join-Path $rootFolder $solutionPath) + Set-Location $solutionAbsPath + dotnet test --no-build --no-restore + if (-Not $?) { + Write-Host ("Test failed for the solution: " + $solutionPath) + Set-Location $rootFolder + exit $LASTEXITCODE + } +} + +Set-Location $rootFolder diff --git a/common.props b/common.props index 1a273a3efe..1cccebd015 100644 --- a/common.props +++ b/common.props @@ -1,7 +1,7 @@ latest - 2.0.0 + 2.1.0 $(NoWarn);CS1591 https://abp.io/assets/abp_nupkg.png https://abp.io diff --git a/configureawait.props b/configureawait.props new file mode 100644 index 0000000000..5247c80ae0 --- /dev/null +++ b/configureawait.props @@ -0,0 +1,9 @@ + + + + + all + runtime; build; native; contentfiles; analyzers + + + \ No newline at end of file diff --git a/docs/cs/CLI.md b/docs/cs/CLI.md index 2779ba64f3..7d2ab4c479 100644 --- a/docs/cs/CLI.md +++ b/docs/cs/CLI.md @@ -129,6 +129,24 @@ abp update [možnosti] * `--npm`: Aktualizuje pouze balíčky NPM. * `--nuget`: Aktualizuje pouze balíčky NuGet. +### login + +Některé funkce CLI vyžadují přihlášení k platformě abp.io. Chcete-li se přihlásit pomocí svého uživatelského jména, napište + +```bash +abp login +``` + +Všimněte si, že nové přihlášení s již aktivní relací ukončí předchozí relaci a vytvoří novou. + +### logout + +Odhlásí vás odebráním tokenu relace z počítače. + +``` +abp logout +``` + ### help Vypíše základní informace k používání CLI. diff --git a/docs/cs/Entity-Framework-Core-PostgreSQL.md b/docs/cs/Entity-Framework-Core-PostgreSQL.md index 9d4f685316..3a39c7485d 100644 --- a/docs/cs/Entity-Framework-Core-PostgreSQL.md +++ b/docs/cs/Entity-Framework-Core-PostgreSQL.md @@ -1,74 +1,39 @@ -## Entity Framework Core PostgreSQL integrace +# Přepnutí na EF Core PostgreSQL providera -> Podívejte se na [Entity Framework Core integrační dokument](../Entity-Framework-Core.md) pro základy integrace EF Core. +Tento dokument vysvětluje, jak přepnout na poskytovatele databáze **PostgreSQL** pro **[spouštěcí šablonu aplikace](Startup-Templates/Application.md)**, která je dodávána s předem nakonfigurovaným SQL poskytovatelem. -### Aktualizace projektu EntityFrameworkCore +## Výměna balíku Volo.Abp.EntityFrameworkCore.SqlServer -- V projektu `Acme.BookStore.EntityFrameworkCore` nahraďte balík `Volo.Abp.EntityFrameworkCore.SqlServer` za `Volo.Abp.EntityFrameworkCore.PostgreSql` -- Aktualizace pro použití PostgreSQL v `BookStoreEntityFrameworkCoreModule` - - Nahraďte `AbpEntityFrameworkCoreSqlServerModule` za `AbpEntityFrameworkCorePostgreSqlModule` - - Nahraďte `options.UseSqlServer()` za `options.UsePostgreSql()` -- V jiných projektech aktualizujte PostgreSQL connection string v nezbytných `appsettings.json` souborech - - Více informací v [PostgreSQL connection strings](https://www.connectionstrings.com/postgresql/), v tomto dokumentu věnujte pozornost sekci `Npgsql` +Projekt `.EntityFrameworkCore` v řešení závisí na NuGet balíku [Volo.Abp.EntityFrameworkCore.SqlServer](https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore.SqlServer). Odstraňte tento balík a přidejte stejnou verzi balíku [Volo.Abp.EntityFrameworkCore.PostgreSql](https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore.PostgreSql). -### Aktualizace projektu EntityFrameworkCore.DbMigrations -- Aktualizace pro použití PostgreSQL v `XXXMigrationsDbContextFactory` - - Nahraďte `new DbContextOptionsBuilder().UseSqlServer()` za `new DbContextOptionsBuilder().UseNpgsql()` +## Nahrazení závislosti modulu +Najděte třídu ***YourProjectName*EntityFrameworkCoreModule** v projektu `.EntityFrameworkCore`, odstraňte `typeof(AbpEntityFrameworkCoreSqlServerModule)` z atributu `DependsOn`, přidejte `typeof(AbpEntityFrameworkCorePostgreSqlModule)` (také nahraďte `using Volo.Abp.EntityFrameworkCore.SqlServer;` za `using Volo.Abp.EntityFrameworkCore.PostgreSql;`). -### Odstranění stávajících migrací +## UsePostgreSql() -Smažte všechny stavající migrační soubory (včetně `DbContextModelSnapshot`) +Najděte volání `UseSqlServer()` v *YourProjectName*EntityFrameworkCoreModule.cs uvnitř projektu `.EntityFrameworkCore` a nahraďte za `UsePostgreSql()`. -![postgresql-delete-initial-migrations](images/postgresql-delete-initial-migrations.png) +Najděte volání `UseSqlServer()` v *YourProjectName*MigrationsDbContextFactory.cs uvnitř projektu `.EntityFrameworkCore.DbMigrations` a nahraďte za `UseNpgsql()`. -### Znovu vygenerujte počáteční migraci +> V závislosti na struktuře řešení můžete najít více volání `UseSqlServer()`, které je třeba změnit. -Nastavte správný spouštěcí projekt (obvykle web projekt) +## Změna connection stringů -![set-as-startup-project](../images/set-as-startup-project.png) +PostgreSql connection stringy se od těch pro SQL Server liší. Je proto potřeba zkontrolovat všechny soubory `appsettings.json` v řešení a connection stringy v nich nahradit. Podívejte se na [connectionstrings.com](https://www.connectionstrings.com/postgresql/) pro více detailů o možnostech PostgreSql connection stringů. -Otevřete **Package Manager Console** (Tools -> Nuget Package Manager -> Package Manager Console), zvolte `.EntityFrameworkCore.DbMigrations` jako **Default project** a proveďte následující příkaz: +Typicky je potřeba změnit `appsettings.json` v projektech `.DbMigrator` a `.Web` projects, ale to záleží na vaší struktuře řešení. -Proveďte příkaz `Add-Migration`: -```` -PM> Add-Migration Initial -```` +## Regenerace migrací -### Aktualizace databáze +Startovací šablona používá [Entity Framework Core Code First migrace](https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/). EF Core migrace závisí na zvoleném DBMS poskytovateli. Tudíž změna DBMS poskytovatele způsobí selhání migrace. +* Smažte složku Migrations v projektu `.EntityFrameworkCore.DbMigrations` and znovu sestavte řešení. +* Spusťte `Add-Migration "Initial"` v Package Manager Console (je nutné zvolit `.DbMigrator` (nebo `.Web`) projekt jako startovací projekt v Solution Explorer a zvolit projekt `.EntityFrameworkCore.DbMigrations` jako výchozí v Package Manager Console). -K vytvoření databáze máte dvě možnosti. +Tímto vytvoříte migraci databáze se všemi nakonfigurovanými databázovými objekty (tabulkami). -#### Použití DbMigrator aplikace +Spusťte projekt `.DbMigrator` k vytvoření databáze a vložení počátečních dat. -Řešení obsahuje konzolovou aplikaci (v tomto příkladu nazvanou `Acme.BookStore.DbMigrator`), která může vytvářet databáze, aplikovat migrace a vkládat seed data. Je užitečná jak pro vývojové, tak pro produkční prostředí. +## Spuštění aplikace -> Projekt `.DbMigrator` má vlastní `appsettings.json`. Takže pokud jste změnili connection string uvedený výše, musíte změnit také tento. - -Klikněte pravým na projekt `.DbMigrator` a vyberte **Set as StartUp Project**: - -![set-as-startup-project](images/set-as-startup-project.png) - -Zmáčkněte F5 (nebo Ctrl+F5) ke spuštění aplikace. Výstup bude vypadat následovně: - -![set-as-startup-project](images/db-migrator-app.png) - -#### Použití EF Core Update-Database příkazu - -Ef Core má `Update-Database` příkaz, který v případě potřeby vytvoří databázi a aplikuje čekající migrace. - -Nastavte správný spouštěcí projekt (obvykle web projekt) - -![set-as-startup-project](../images/set-as-startup-project.png) - -Otevřete **Package Manager Console** (Tools -> Nuget Package Manager -> Package Manager Console), vyberte projekt `.EntityFrameworkCore.DbMigrations` jako **Default Project** and spusťte následující příkaz: - -```` -PM> Update-Database -```` - -Dojde k vytvoření nové databáze na základě nakonfigurovaného connection stringu. - -![postgresql-update-database](images/postgresql-update-database.png) - -> Použití nástroje `.DbMigrator` je doporučený způsob, jelikož zároveň vloží seed data nutné k správnému běhu webové aplikace. +Vše je připraveno. Stačí už jen spustit aplikaci a užívat si kódování. diff --git a/docs/cs/docs-nav.json b/docs/cs/docs-nav.json index 2854966a10..6c05d77dcf 100644 --- a/docs/cs/docs-nav.json +++ b/docs/cs/docs-nav.json @@ -60,6 +60,10 @@ "text": "Konfigurace", "path": "Configuration.md" }, + { + "text": "Možnosti", + "path": "Options.md" + }, { "text": "Vkládání závislostí", "path": "Dependency-Injection.md", @@ -83,7 +87,14 @@ "path": "Exception-Handling.md" }, { - "text": "Validace" + "text": "Validace", + "path": "Validation.md", + "items": [ + { + "text": "FluentValidation integrace", + "path": "FluentValidation.md" + } + ] }, { "text": "Autorizace", @@ -257,24 +268,46 @@ }, { "text": "Přístup k datům", + "path": "Data-Access.md", "items": [ { - "text": "Entity Framework Core integrace", - "path": "Entity-Framework-Core.md", + "text": "Connection stringy", + "path": "Connection-Strings.md" + }, + { + "text": "Poskytovatelé databází", "items": [ { - "text": "PostgreSQL integrace", - "path": "Entity-Framework-Core-PostgreSQL.md" + "text": "Entity Framework Core", + "path": "Entity-Framework-Core.md", + "items": [ + { + "text": "Přepnutí na MySQL", + "path": "Entity-Framework-Core-MySQL.md" + }, + { + "text": "Přepnutí na PostgreSQL", + "path": "Entity-Framework-Core-PostgreSQL.md" + }, + { + "text": "Přepnutí na SQLite", + "path": "Entity-Framework-Core-SQLite.md" + }, + { + "text": "Přepnutí na jiný DBMS", + "path": "Entity-Framework-Core-Other-DBMS.md" + } + ] + }, + { + "text": "MongoDB", + "path": "MongoDB.md" + }, + { + "text": "Dapper", + "path": "Dapper.md" } ] - }, - { - "text": "MongoDB integrace", - "path": "MongoDB.md" - }, - { - "text": "Dapper integrace", - "path": "Dapper.md" } ] }, diff --git a/docs/cs/images/docs-section-ui.png b/docs/cs/images/docs-section-ui.png new file mode 100644 index 0000000000..7856454e5d Binary files /dev/null and b/docs/cs/images/docs-section-ui.png differ diff --git a/docs/en/Ambient-Context-Pattern.md b/docs/en/Ambient-Context-Pattern.md new file mode 100644 index 0000000000..d00a721ce2 --- /dev/null +++ b/docs/en/Ambient-Context-Pattern.md @@ -0,0 +1,3 @@ +## Ambient Context Pattern + +TODO \ No newline at end of file diff --git a/docs/en/AspNet-Boilerplate-Migration-Guide.md b/docs/en/AspNet-Boilerplate-Migration-Guide.md new file mode 100644 index 0000000000..d47b266839 --- /dev/null +++ b/docs/en/AspNet-Boilerplate-Migration-Guide.md @@ -0,0 +1,734 @@ +# ASP.NET Boilerplate v5+ to ABP Framework Migration + +ABP Framework is **the successor** of the open source [ASP.NET Boilerplate](https://aspnetboilerplate.com/) framework. This guide aims to help you to **migrate your existing solutions** (you developed with the ASP.NET Boilerplate framework) to the ABP Framework. + +## Introduction + +**ASP.NET Boilerplate** is being **actively developed** [since 2013](https://github.com/aspnetboilerplate/aspnetboilerplate/graphs/contributors). It is loved, used and contributed by the community. It started as a side project of [a developer](http://halilibrahimkalkan.com/), but now it is officially maintained and improved by the company [Volosoft](https://volosoft.com/) in addition to the great community support. + +ABP Framework has the same goal of the ASP.NET Boilerplate framework: **Don't Repeat Yourself**! It provides infrastructure, tools and startup templates to make a developer's life easier while developing enterprise software solutions. + +See [the introduction blog post](https://blog.abp.io/abp/Abp-vNext-Announcement) if you wonder why we needed to re-write the ASP.NET Boilerplate framework. + +### Should I Migrate? + +No, you don't have to! + +* ASP.NET Boilerplate is still in active development and maintenance. +* It also works on the latest ASP.NET Core and related libraries and tools. It is up to date. + +However, if you want to take the advantage of the new ABP Framework [features](https://abp.io/features) and the new architecture opportunities (like support for NoSQL databases, microservice compatibility, advanced modularity), you can use this document as a guide. + +### What About the ASP.NET Zero? + +[ASP.NET Zero](https://aspnetzero.com/) is a commercial product developed by the core ASP.NET Boilerplate team, on top of the ASP.NET Boilerplate framework. It provides pre-built application [features](https://aspnetzero.com/Features), code generation tooling and a nice looking modern UI. It is trusted and used by thousands of companies from all around the World. + +We have created the [ABP Commercial](https://commercial.abp.io/) as an alternative to the ASP.NET Zero. ABP Commercial is more modular and upgradeable compared to the ASP.NET Zero. It currently has less features compared to ASP.NET Zero, but the gap will be closed by the time (it also has some features don't exist in the ASP.NET Zero). + +We think ASP.NET Zero is still a good choice while starting a new application. It is production ready and mature solution delivered as a full source code. It is being actively developed and we are constantly adding new features. + +We don't suggest to migrate your ASP.NET Zero based solution to the ABP Commercial if; + +* Your ASP.NET Zero solution is mature and it is in maintenance rather than a rapid development. +* You don't have enough development time to perform the migration. +* A monolithic solution fits in your business. +* You've customized existing ASP.NET Zero features too much based on your requirements. + +We also suggest you to compare the features of two products based on your needs. + +If you have an ASP.NET Zero based solution and want to migrate to the ABP Commercial, this guide will also help you. + +### ASP.NET MVC 5.x Projects + +The ABP Framework doesn't support ASP.NET MVC 5.x, it only works with ASP.NET Core. So, if you migrate your ASP.NET MVC 5.x based projects, you will also deal with the .NET Core migration. + +## The Migration Progress + +We've designed the ABP Framework by **getting the best parts** of the ASP.NET Boilerplate framework, so it will be familiar to you if you've developed ASP.NET Boilerplate based applications. + +In the ASP.NET Boilerplate, we have not worked much on the UI side, but used some free themes (we've used [metronic theme](https://keenthemes.com/metronic/) for ASP.NET Zero on the other side). In the ABP Framework, we worked a lot on the UI side (especially for the MVC / Razor Pages UI, because Angular already has a good modular system of its own). So, the **most challenging part** of the migration will be the **User Interface** of your solution. + +ABP Framework is (and ASP.NET Boilerplate was) designed based on the [Domain Driven Design](https://docs.abp.io/en/abp/latest/Domain-Driven-Design) patterns & principles and the startup templates are layered based on the DDD layers. So, this guide respects to that layering model and explains the migration layer by layer. + +## Creating the Solution + +First step of the migration is to create a new solution. We suggest you to create a fresh new project using [the startup templates](https://abp.io/get-started) (see [this document](https://docs.abp.io/en/commercial/latest/getting-started) for the ABP Commercial). + +After creating the project and running the application, you can copy your code from your existing solution to the new solution step by step, layer by layer. + +### About Pre-Built Modules + +The startup projects for the ABP Framework use the [pre-built modules](https://docs.abp.io/en/abp/latest/Modules/Index) (not all of them, but the essentials) and themes as NuGet/NPM packages. So, you don't see the source code of the modules/themes in your solution. This has an advantage that you can easily update these packages when a new version is released. However, you can not easily customize them as their source code in your hands. + +We suggest to continue to use these modules as package references, in this way you can get new features easily (see [abp update command](https://docs.abp.io/en/abp/latest/CLI#update)). In this case, you have a few options to customize or extend the functionality of the used modules; + +* You can create your own entity and share the same database table with an entity in a used module. An example of this is the `AppUser` entity comes in the startup template. +* You can [replace](https://docs.abp.io/en/abp/latest/Dependency-Injection#replace-a-service) a domain service, application service, controller, page model or other types of services with your own implementation. We suggest you to inherit from the existing implementation and override the method you need. +* You can replace a `.cshtml` view, page, view component, partial view... with your own one using the [Virtual File System](https://docs.abp.io/en/abp/latest/Virtual-File-System). +* You can override javascript, css, image or any other type of static files using the [Virtual File System](https://docs.abp.io/en/abp/latest/Virtual-File-System). + +More extend/customization options will be developed and documented by the time. However, if you need to fully change the module implementation, it is best to add the [source code](https://github.com/abpframework/abp/tree/dev/modules) of the related module into your own solution and remove the package dependencies. + +The source code of the modules and the themes are [MIT](https://opensource.org/licenses/MIT) licensed, you can fully own and customize it without any limitation (for the ABP Commercial, you can download the source code of a [module](https://commercial.abp.io/modules)/[theme](https://commercial.abp.io/themes) if you have a [license](https://commercial.abp.io/pricing) type that includes the source code). + +## The Domain Layer + +Most of your domain layer code will remain same, while you need to perform some minor changes in your domain objects. + +### Aggregate Roots & Entities + +The ABP Framework and the ASP.NET Boilerplate both have the `IEntity` and `IEntity` interfaces and `Entity` and `Entity` base classes to define entities but they have some differences. + +If you have an entity in the ASP.NET Boilerplate application like that: + +````csharp +public class Person : Entity //Default PK is int for the ASP.NET Boilerplate +{ + ... +} +```` + +Then your primary key (the `Id` property in the base class) is `int` which is the **default primary key** (PK) type for the ASP.NET Boilerplate. If you want to set another type of PK, you need to explicitly declare it: + +````csharp +public class Person : Entity //Set explicit PK in the ASP.NET Boilerplate +{ + ... +} +```` + +ABP Framework behaves differently and expects to **always explicitly set** the PK type: + +````csharp +public class Person : Entity //Set explicit PK in the ASP.NET Boilerplate +{ + ... +} +```` + +`Id` property (and the corresponding PK in the database) will be `Guid` in this case. + +#### Composite Primary Keys + +ABP Framework also has a non-generic `Entity` base class, but this time it has no `Id` property. Its purpose is to allow you to create entities with composite PKs. See [the documentation](https://docs.abp.io/en/abp/latest/Entities#entities-with-composite-keys) to learn more about the composite PKs. + +#### Aggregate Root + +It is best practice now to use the `AggregateRoot` base class instead of `Entity` for aggregate root entities. See [the documentation](https://docs.abp.io/en/abp/latest/Entities#aggregateroot-class) to learn more about the aggregate roots. + +In opposite to the ASP.NET Boilerplate, the ABP Framework creates default repositories (`IRepository`) **only for the aggregate roots**. It doesn't create for other types derived from the `Entity`. + +If you still want to create default repositories for all entity types, find the *YourProjectName*EntityFrameworkCoreModule class in your solution and change `options.AddDefaultRepositories()` to `options.AddDefaultRepositories(includeAllEntities: true)` (it may be already like that for the application startup template). + +#### Migrating the Existing Entities + +We suggest & use the GUID as the PK type for all the ABP Framework modules. However, you can continue to use your existing PK types to migrate your database tables easier. + +The challenging part will be the primary keys of the ASP.NET Boilerplate related entities, like Users, Roles, Tenants, Settings... etc. Our suggestion is to copy data from existing database to the new database tables using a tool or in a manual way (be careful about the foreign key values). + +#### Documentation + +See the documentation for details on the entities: + +* [ASP.NET Boilerplate - Entity documentation](https://aspnetboilerplate.com/Pages/Documents/Entities) +* [ABP Framework - Entity documentation](https://docs.abp.io/en/abp/latest/Entities) + +### Repositories + +> ABP Framework creates default repositories (`IRepository`) **only for the aggregate roots**. It doesn't create for other types derived from the `Entity`. See the "Aggregate Root" section above for more information. + +The ABP Framework and the ASP.NET Boilerplate both have the default generic repository system, but has some differences. + +#### Injecting the Repositories + +In the ASP.NET Boilerplate, there are two default repository interfaces you can directly inject and use: + +* `IRepository` (e.g. `IRepository`) is used for entities with `int` primary key (PK) which is the default PK type. +* `IRepository` (e.g. `IRepository`) is used for entities with other types of PKs. + +ABP Framework doesn't have a default PK type, so you need to **explicitly declare the PK type** of your entity, like `IRepository` or `IRepository`. + +ABP Framework also has the `IRepository` (without PK), but it is mostly used when your entity has a composite PK (because this repository has no methods work with the `Id` property). See [the documentation](https://docs.abp.io/en/abp/latest/Entities#entities-with-composite-keys) to learn more about the **composite PKs**. + +#### Restricted Repositories + +ABP Framework additionally provides a few repository interfaces: + +* `IBasicRepository` has the same methods with the `IRepository` except it doesn't have `IQueryable` support. It can be useful if you don't want to expose complex querying code to the application layer. In this case, you typically want to create custom repositories to encapsulate the querying logic. It is also useful for database providers those don't support `IQueryable`. +* `IReadOnlyRepository` has the methods get data from the database, but doesn't contain any method change the database. +* `IReadOnlyBasicRepository` is similar to the read only repository but also doesn't support `IQueryable`. + +All the interfaces also have versions without `TKey` (like ``IReadOnlyRepository`) those can be used for composite PKs just like explained above. + +#### GetAll() vs IQueryable + +ASP.NET Boilerplate's repository has a `GetAll()` method that is used to obtain an `IQueryable` object to execute LINQ on it. An example application service calls the `GetAll()` method: + +````csharp +public class PersonAppService : ApplicationService, IPersonAppService +{ + private readonly IRepository _personRepository; + + public PersonAppService(IRepository personRepository) + { + _personRepository = personRepository; + } + + public async Task DoIt() + { + var people = await _personRepository + .GetAll() //GetAll() returns IQueryable + .Where(p => p.BirthYear > 2000) //Use LINQ extension methods + .ToListAsync(); + } +} +```` + +ABP Framework's repository doesn't have this method. Instead, it implements the `IQueryable` itself. So, you can directly use LINQ on the repository: + +````csharp +public class PersonAppService : ApplicationService, IPersonAppService +{ + private readonly IRepository _personRepository; + + public PersonAppService(IRepository personRepository) + { + _personRepository = personRepository; + } + + public async Task DoIt() + { + var people = await _personRepository + .Where(p => p.BirthYear > 2000) //Use LINQ extension methods + .ToListAsync(); + } +} +```` + +> Note that in order to use the async LINQ extension methods (like `ToListAsync` here), you may need to depend on the database provider (like EF Core) since these methods are defined in the database provider package, they are not standard LINQ methods. + +#### FirstOrDefault(predicate), Single()... Methods + +ABP Framework repository has not such methods get predicate (expression) since the repository itself is `IQueryable` and all these methods are already standard LINQ extension methods those can be directly used. + +However, it provides the following methods those can be used to query a single entity by its Id: + +* `FindAsync(id)` returns the entity or null if not found. +* `GetAsync(id)` method returns the entity or throws an `EntityNotFoundException` (which causes HTTP 404 status code) if not found. + +#### Sync vs Async + +ABP Framework repository has no sync methods (like `Insert`). All the methods are async (like `InsertAsync`). So, if your application has sync repository method usages, convert them to async versions. + +In general, ABP Framework forces you to completely use async everywhere, because mixing async & sync methods is not a recommended approach. + +#### Documentation + +See the documentation for details on the repositories: + +* [ASP.NET Boilerplate - Repository documentation](https://aspnetboilerplate.com/Pages/Documents/Repositories) +* [ABP Framework - Repository documentation](https://docs.abp.io/en/abp/latest/Repositories) + +### Domain Services + +Your domain service logic mostly remains same on the migration. ABP Framework also defines the base `DomainService` class and the `IDomainService` interface just works like the ASP.NET Boilerplate. + +## The Application Layer + +Your application service logic remains similar on the migration. ABP Framework also defines the base `ApplicationService` class and the `IApplicationService` interface just works like the ASP.NET Boilerplate, but there are some differences in details. + +### Declarative Authorization + +ASP.NET Boilerplate has `AbpAuthorize` and `AbpMvcAuthorize` attributes for declarative authorization. Example usage: + +````csharp +[AbpAuthorize("MyUserDeletionPermissionName")] +public async Task DeleteUserAsync(...) +{ + ... +} +```` + +ABP Framework doesn't has such a custom attribute. It uses the standard `Authorize` attribute in all layers. + +````csharp +[Authorize("MyUserDeletionPermissionName")] +public async Task DeleteUserAsync(...) +{ + ... +} +```` + +This is possible with the better integration to the Microsoft Authorization Extensions libraries. See the Authorization section below for more information about the authorization system. + +### CrudAppService and AsyncCrudAppService Classes + +ASP.NET Boilerplate has `CrudAppService` (with sync service methods) and `AsyncCrudAppService` (with async service methods) classes. + +ABP Framework only has the `CrudAppService` which actually has only the async methods (instead of sync methods). + +ABP Framework's `CrudAppService` method signatures are slightly different than the old one. For example, old update method signature was ` Task UpdateAsync(TUpdateInput input) ` while the new one is ` Task UpdateAsync(TKey id, TUpdateInput input) `. The main difference is that it gets the Id of the updating entity as a separate parameter instead of including in the input DTO. + +### Data Transfer Objects (DTOs) + +There are similar base DTO classes (like `EntityDto`) in the ABP Framework too. So, you can find the corresponding DTO base class if you need. + +#### Validation + +You can continue to use the data annotation attributes to validate your DTOs just like in the ASP.NET Boilerplate. + +ABP Framework doesn't include the ` ICustomValidate ` that does exists in the ASP.NET Boilerplate. Instead, you should implement the standard `IValidatableObject` interface for your custom validation logic. + +## The Infrastructure Layer + +### Namespaces + +ASP.NET Boilerplate uses the `Abp.*` namespaces while the ABP Framework uses the `Volo.Abp.*` namespaces for the framework and pre-built fundamental modules. + +In addition, there are also some pre-built application modules (like docs and blog modules) those are using the `Volo.*` namespaces (like `Volo.Blogging.*` and `Volo.Docs.*`). We consider these modules as standalone open source products developed by Volosoft rather than add-ons or generic modules completing the ABP Framework and used in the applications. We've developed them as a module to make them re-usable as a part of a bigger solution. + +### Module System + +Both of the ASP.NET Boilerplate and the ABP Framework have the `AbpModule` while they are a bit different. + +ASP.NET Boilerplate's `AbpModule` class has `PreInitialize`, `Initialize` and `PostInitialize` methods you can override and configure the framework and the depended modules. You can also register and resolve dependencies in these methods. + +ABP Framework's `AbpModule` class has the `ConfigureServices` and `OnApplicationInitialization` methods (and their Pre and Post versions). It is similar to ASP.NET Core's Startup class. You configure other services and register dependencies in the `ConfigureServices`. However, you can now resolve dependencies in that point. You can resolve dependencies and configure the ASP.NET Core pipeline in the `OnApplicationInitialization` method while you can not register dependencies here. So, the new module classes separate dependency registration phase from dependency resolution phase since it follows the ASP.NET Core's approach. + +### Dependency Injection + +#### The DI Framework + +ASP.NET Boilerplate is using the [Castle Windsor](http://www.castleproject.org/projects/windsor/) as the dependency injection framework. This is a fundamental dependency of the ASP.NET Boilerplate framework. We've got a lot of feedback to make the ASP.NET Boilerplate DI framework agnostic, but it was not so easy because of the design. + +ABP Framework is dependency injection framework independent since it uses Microsoft's [Dependency Injection Extensions](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection) library as an abstraction. None of the ABP Framework or module packages depends on any specific library. + +However, ABP Framework doesn't use the Microsoft's base DI library because it has some missing features ABP Framework needs to: Property Injection and Interception. All the startup templates and the samples are using the [Autofac](https://autofac.org/) as the DI library and it is the only [officially integrated](Autofac-Integration.md) library to the ABP Framework. We suggest you to use the Autofac with the ABP Framework if you have not a good reason. If you have a good reason, please create an [issue](https://github.com/abpframework/abp/issues/new) on GitHub to request it or just implement it and send a pull request :) + +#### Registering the Dependencies + +Registering the dependencies are similar and mostly handled by the framework conventionally (like repositories, application services, controllers... etc). Implement the same `ITransientDependency`, `ISingletonDependency` and `IScopedDependency` interfaces for the services not registered by conventions. + +When you need to manually register dependencies, use the `context.Services` in the `ConfigureServices` method of your module. Example: + +````csharp +public class BlogModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + //Register an instance as singleton + context.Services.AddSingleton(new TaxCalculator(taxRatio: 0.18)); + + //Register a factory method that resolves from IServiceProvider + context.Services.AddScoped( + sp => sp.GetRequiredService() + ); + } +} +```` + +See the ABP Framework [dependency injection document](https://docs.abp.io/en/abp/latest/Dependency-Injection) for details. + +### Configuration vs Options System + +ASP.NET Boilerplate has its own configuration system to configure the framework and the modules. For example, you could disable the audit logging in the `Initialize` method of your [module](https://aspnetboilerplate.com/Pages/Documents/Module-System): + +````csharp +public override void Initialize() +{ + Configuration.Auditing.IsEnabled = false; +} +```` + +ABP Framework uses [the options pattern](Options.md) to configure the framework and the modules. You typically configure the options in the `ConfigureServices` method of your [module](Module-Development-Basics.md): + +````csharp +public override void ConfigureServices(ServiceConfigurationContext context) +{ + Configure(options => + { + options.IsEnabled = false; + }); +} +```` + +Instead of a central configuration object, there are separated option classes for every module and feature those are defined in the related documents. + +### IAbpSession vs ICurrentUser and ICurrentTenant + +ASP.NET Boilerplate's `IAbpSession` service is used to obtain the current user and tenant information, like ` UserId ` and `TenantId`. + +ABP Framework doesn't have the same service. Instead, use `ICurrentUser` and `ICurrentTenant` services. These services are defined as base properties in some common classes (like `ApplicationService` and `AbpController`), so you generally don't need to manually inject them. They also have much properties compared to the `IAbpSession`. + +### Authorization + +ABP Framework extends the [ASP.NET Core Authorization](https://docs.microsoft.com/en-us/aspnet/core/security/authorization/introduction) by adding **permissions** as auto [policies](https://docs.microsoft.com/en-us/aspnet/core/security/authorization/policies) and allowing the authorization system to be usable in the [application services](Application-Services.md) too. + +#### AbpAutorize vs Autorize + +Use the standard `[Autorize]` and `[AllowAnonymous]` attributes instead of ASP.NET Boilerplate's custom `[AbpAutorize]` and `[AbpAllowAnonymous]` attributes. + +#### IPermissionChecker vs IAuthorizationService + +Use the standard `IAuthorizationService` to check permissions instead of the ASP.NET Boilerplate's `IPermissionChecker` service. While `IPermissionChecker` also exists in the ABP Framework, it is used to explicitly use the permissions. Using `IAuthorizationService` is the recommended way since it covers other type of policy checks too. + +#### AuthorizationProvider vs PermissionDefinitionProvider + +You inherit from the `AuthorizationProvider` in the ASP.NET Boilerplate to define your permissions. ABP Framework replaces it by the `PermissionDefinitionProvider` base class. So, define your permissions by inheriting from the `PermissionDefinitionProvider` class. + +### Unit of Work + +Unit of work system has been designed to work seamlessly. For most of the cases, you don't need to change anything. + +`UnitOfWork` attribute of the ABP Framework doesn't have the `ScopeOption` (type of `TransactionScopeOption`) property. Instead, use `IUnitOfWorkManager.Begin()` method with `requiresNew = true` to create an independent inner transaction in a transaction scope. + +#### Data Filters + +ASP.NET Boilerplate implements the data filtering system as a part of the unit of work. ABP Framework has a separate `IDataFilter` service. + +See the [data filtering document](Data-Filtering.md) to learn how to enable/disable a filter. + +See [the UOW documentation](Unit-Of-Work.md) for more about the UOW system. + +### Multi-Tenancy + +#### IMustHaveTenant & IMayHaveTenant vs IMultiTenant + +ASP.NET Boilerplate defines `IMustHaveTenant` and `IMayHaveTenant` interfaces to implement them for your entities. In this way, your entities are automatically filtered according to the current tenant. Because of the design, there was a problem: You had to create a "Default" tenant in the database with "1" as the Id if you want to create a non multi-tenant application (this "Default" tenant was used as the single tenant). + +ABP Framework has a single interface for multi-tenant entities: `IMultiTenant` which defines a nullable `TenantId` property of type `Guid`. If your application is not multi-tenant, then your entities will have null TenantId (instead of a default one). + +On the migration, you need to change the TenantId field type and replace these interfaces with the `IMultiTenant` + +#### Switch Between Tenants + +In some cases you might need to switch to a tenant for a code scope and work with the tenant's data in this scope. + +In ASP.NET Boilerplate, it is done using the `IUnitOfWorkManager` service: + +````csharp +public async Task> GetProducts(int tenantId) +{ + using (_unitOfWorkManager.Current.SetTenantId(tenantId)) + { + return await _productRepository.GetAllListAsync(); + } +} +```` + +In the ABP Framework it is done with the `ICurrentTenant` service: + +````csharp +public async Task> GetProducts(Guid tenantId) +{ + using (_currentTenant.Change(tenantId)) + { + return await _productRepository.GetListAsync(); + } +} +```` + +Pass `null` to the `Change` method to switch to the host side. + +### Caching + +ASP.NET Boilerplate has its [own distributed caching abstraction](https://aspnetboilerplate.com/Pages/Documents/Caching) which has in-memory and Redis implementations. You typically inject the `ICacheManager` service and use its `GetCache(...)` method to obtain a cache, then get and set objects in the cache. + +ABP Framework uses and extends ASP.NET Core's [distributed caching abstraction](Caching.md). It defines the `IDistributedCache` services to inject a cache and get/set objects. + +### Logging + +ASP.NET Boilerplate uses Castle Windsor's [logging facility](http://docs.castleproject.org/Windsor.Logging-Facility.ashx) as an abstraction and supports multiple logging providers including Log4Net (the default one comes with the startup projects) and Serilog. You typically property-inject the logger: + +````csharp +using Castle.Core.Logging; //1: Import Logging namespace + +public class TaskAppService : ITaskAppService +{ + //2: Getting a logger using property injection + public ILogger Logger { get; set; } + + public TaskAppService() + { + //3: Do not write logs if no Logger supplied. + Logger = NullLogger.Instance; + } + + public void CreateTask(CreateTaskInput input) + { + //4: Write logs + Logger.Info("Creating a new task with description: " + input.Description); + //... + } +} +```` + +ABP Framework depends on Microsoft's [logging extensions](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging) library which is also an abstraction and there are many providers implement it. Startup templates are using the Serilog as the pre-configured logging libary while it is easy to change in your project. The usage pattern is similar: + +````csharp +//1: Import the Logging namespaces +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; + +public class TaskAppService : ITaskAppService +{ + //2: Getting a logger using property injection + public ILogger Logger { get; set; } + + public TaskAppService() + { + //3: Do not write logs if no Logger supplied. + Logger = NullLogger.Instance; + } + + public void CreateTask(CreateTaskInput input) + { + //4: Write logs + Logger.Info("Creating a new task with description: " + input.Description); + //... + } +} +```` + +You inject the `ILogger` instead of the `ILogger`. + +### Object to Object Mapping + +#### IObjectMapper Service + +ASP.NET Boilerplate defines an `IObjectMapper` service ([see](https://aspnetboilerplate.com/Pages/Documents/Object-To-Object-Mapping)) and has an integration to the [AutoMapper](https://automapper.org/) library. + +Example usage: Create a `User` object with the given `CreateUserInput` object: + +````csharp +public void CreateUser(CreateUserInput input) +{ + var user = ObjectMapper.Map(input); + ... +} +```` + +Example: Update an existing `User` properties with the given `UpdateUserInput` object: + +````csharp +public async Task UpdateUserAsync(Guid id, UpdateUserInput input) +{ + var user = await _userRepository.GetAsync(id); + ObjectMapper.Map(input, user); +} +```` + +ABP Framework has the same `IObjectMapper` service ([see](Object-To-Object-Mapping.md)) and the AutoMapper integration with a slightly different mapping methods. + +Example usage: Create a `User` object with the given `CreateUserInput` object: + +````csharp +public void CreateUser(CreateUserInput input) +{ + var user = ObjectMapper.Map(input); +} +```` + +This time you need to explicitly declare the source type and target type (while ASP.NET Boilerplate was requiring only the target type). + +Example: Update an existing `User` properties with the given `UpdateUserInput` object: + +````csharp +public async Task UpdateUserAsync(Guid id, UpdateUserInput input) +{ + var user = await _userRepository.GetAsync(id); + ObjectMapper.Map(input, user); +} +```` + +Again, ABP Framework expects to explicitly set the source and target types. + +#### AutoMapper Integration + +##### Auto Mapping Attributes + +ASP.NET Boilerplate has `AutoMapTo`, `AutoMapFrom` and `AutoMap` attributes to automatically create mappings for the declared types. Example: + +````csharp +[AutoMapTo(typeof(User))] +public class CreateUserInput +{ + public string Name { get; set; } + public string Surname { get; set; } + ... +} +```` + +ABP Framework has no such attributes, because AutoMapper as a [similar attribute](https://automapper.readthedocs.io/en/latest/Attribute-mapping.html) now. You need to switch to AutoMapper's attribute. + +##### Mapping Definitions + +ABP Framework follows AutoMapper principles closely. You can define classes derived from the `Profile` class to define your mappings. + +##### Configuration Validation + +Configuration validation is a best practice for the AutoMapper to maintain your mapping configuration in a safe way. + +See [the documentation](Object-To-Object-Mapping.md) for more information related to the object mapping. + +### Setting Management + +#### Defining the Settings + +In an ASP.NET Boilerplate based application, you create a class deriving from the `SettingProvider` class, implement the `GetSettingDefinitions` method and add your class to the `Configuration.Settings.Providers` list. + +In the ABP Framework, you need to derive your class from the `SettingDefinitionProvider` and implement the `Define` method. You don't need to register your class since the ABP Framework automatically discovers it. + +#### Getting the Setting Values + +ASP.NET Boilerplate provides the `ISettingManager` to read the setting values in the server side and `abp.setting.get(...)` method in the JavaScript side. + +ABP Framework has the `ISettingProvider` service to read the setting values in the server side and `abp.setting.get(...)` method in the JavaScript side. + +#### Setting the Setting Values + +For ASP.NET Boilerplate, you use the same `ISettingManager` service to change the setting values. + +ABP Framework separates it and provides the setting management module (pre-added to the startup projects) which has the ` ISettingManager ` to change the setting values. This separation was introduced to support tiered deployment scenarios (where `ISettingProvider` can also work in the client application while `ISettingManager ` can also work in the server (API) side). + +### Clock + +ASP.NET Boilerplate has a static `Clock` service ([see](https://aspnetboilerplate.com/Pages/Documents/Timing)) which is used to abstract the `DateTime` kind, so you can easily switch between Local and UTC times. You don't inject it, but just use the `Clock.Now` static method to obtain the current time. + +ABP Framework has the `IClock` service ([see](Clock.md)) which has a similar goal, but now you need to inject it whenever you need it. + +### Event Bus + +ASP.NET Boilerplate has an in-process event bus system. You typically inject the `IEventBus` (or use the static instance `EventBus.Default`) to trigger an event. It automatically triggers events for entity changes (like `EntityCreatingEventData` and `EntityUpdatedEventData`). You create a class by implementing the `IEventHandler` interface. + +ABP Framework separates the event bus into two services: `ILocalEventBus` and `IDistributedEventBus`. + +The local event bus is similar to the event bus of the ASP.NET Boilerplate while the distributed event bus is new feature introduced in the ABP Framework. + +So, to migrate your code; + +* Use the `ILocalEventBus` instead of the `IEventBus`. +* Implement the `ILocalEventHandler` instead of the `IEventHandler`. + +> Note that ABP Framework has also an `IEventBus` interface, but it does exists to be a common interface for the local and distributed event bus. It is not injected and directly used. + +### Feature Management + +Feature system is used in multi-tenant applications to define features of your application check if given feature is available for the current tenant. + +#### Defining Features + +In the ASP.NET Boilerplate ([see](https://aspnetboilerplate.com/Pages/Documents/Feature-Management)), you create a class inheriting from the `FeatureProvider`, override the `SetFeatures` method and add your class to the `Configuration.Features.Providers` list. + +In the ABP Framework ([see](Features.md)), you derive your class from the `FeatureDefinitionProvider` and override the `Define` method. No need to add your class to the configuration, it is automatically discovered by the framework. + +#### Checking Features + +You can continue to use the `RequiresFeature` attribute and `IFeatureChecker` service to check if a feature is enabled for the current tenant. + +#### Changing the Feature Values + +In the ABP Framework you use the `IFeatureManager` to change a feature value for a tenant. + +### Audit Logging + +The ASP.NET Boilerplate ([see](https://aspnetboilerplate.com/Pages/Documents/Audit-Logging)) and the ABP Framework ([see](Audit-Logging.md)) has similar audit logging systems. ABP Framework requires to add `UseAuditing()` middleware to the ASP.NET Core pipeline, which is already added in the startup templates. So, most of the times it will be work out of the box. + +### Localization + +ASP.NET Boilerplate supports XML and JSON files to define the localization key-values for the UI ([see](https://aspnetboilerplate.com/Pages/Documents/Localization)). ABP Framework only supports the JSON formatter localization files ([see](Localization.md)). So, you need to convert your XML file to JSON. + +The ASP.NET Boilerplate has its own the `ILocalizationManager` service to be injected and used for the localization in the server side. + +The ABP Framework uses [Microsoft localization extension](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/localization) library, so it is completely integrated to ASP.NET Core. You use the `IStringLocalizer` service to get a localized text. Example: + +````csharp +public class MyService +{ + private readonly IStringLocalizer _localizer; + + public MyService(IStringLocalizer localizer) + { + _localizer = localizer; + } + + public void Foo() + { + var str = _localizer["HelloWorld"]; //Get a localized text + } +} +```` + +So, you need to replace `ILocalizationManager` usage by the `IStringLocalizer`. + +It also provides API used in the client side: + +````js +var testResource = abp.localization.getResource('Test'); +var str = testResource('HelloWorld'); +```` + +It was like `abp.localization.localize(...)` in the ASP.NET Boilerplate. + +### Navigation vs Menu + +In ASP.NET you create a class deriving from the `NavigationProvider` to define your menu elements. Menu items has `requiredPermissionName` attributes to restrict access to a menu element. Menu items were static and your class is executed only one time. + +Int the ABP Framework you need to create a class implements the `IMenuContributor` interface. Your class is executed whenever the menu needs to be rendered. So, you can conditionally add menu items. + +As an example, this is the menu contributor of the tenant management module: + +````csharp +public class AbpTenantManagementWebMainMenuContributor : IMenuContributor +{ + public async Task ConfigureMenuAsync(MenuConfigurationContext context) + { + //Add items only to the main menu + if (context.Menu.Name != StandardMenus.Main) + { + return; + } + + //Get the standard administration menu item + var administrationMenu = context.Menu.GetAdministration(); + + //Resolve some needed services from the DI container + var authorizationService = context.ServiceProvider + .GetRequiredService(); + var l = context.ServiceProvider + .GetRequiredService>(); + + var tenantManagementMenuItem = new ApplicationMenuItem( + TenantManagementMenuNames.GroupName, + l["Menu:TenantManagement"], + icon: "fa fa-users"); + + administrationMenu.AddItem(tenantManagementMenuItem); + + //Conditionally add the "Tenants" menu item based on the permission + if (await authorizationService + .IsGrantedAsync(TenantManagementPermissions.Tenants.Default)) + { + tenantManagementMenuItem.AddItem( + new ApplicationMenuItem( + TenantManagementMenuNames.Tenants, + l["Tenants"], + url: "/TenantManagement/Tenants")); + } + } +} +```` + +So, you need to check permission using the `IAuthorizationService` if you want to show a menu item only when the user has the related permission. + +> Navigation/Menu system is only for ASP.NET Core MVC / Razor Pages applications. Angular applications has a different system implemented in the startup templates. + +## Missing Features + +The following features are not present for the ABP Framework. Here, a list of some major missing features (and the related issue for that feature waiting on the ABP Framework GitHub repository): + +* [Multi-Lingual Entities](https://aspnetboilerplate.com/Pages/Documents/Multi-Lingual-Entities) ([#1754](https://github.com/abpframework/abp/issues/1754)) +* [Real time notification system](https://aspnetboilerplate.com/Pages/Documents/Notification-System) ([#633](https://github.com/abpframework/abp/issues/633)) +* [NHibernate Integration](https://aspnetboilerplate.com/Pages/Documents/NHibernate-Integration) ([#339](https://github.com/abpframework/abp/issues/339)) - We don't intent to work on this, but any community contribution welcome. + +Some of these features will eventually be implemented. However, you can implement them yourself if they are important for you. If you want, you can [contribute](Contribution/Index.md) to the framework, it is appreciated. \ No newline at end of file diff --git a/docs/en/Audit-Logging.md b/docs/en/Audit-Logging.md index f11a3f19e3..799b3b76c3 100644 --- a/docs/en/Audit-Logging.md +++ b/docs/en/Audit-Logging.md @@ -1,3 +1,373 @@ # Audit Logging -TODO \ No newline at end of file +[Wikipedia](https://en.wikipedia.org/wiki/Audit_trail): "*An audit trail (also called **audit log**) is a security-relevant chronological record, set of records, and/or destination and source of records that provide documentary evidence of the sequence of activities that have affected at any time a specific operation, procedure, or event*". + +ABP Framework provides an **extensible audit logging system** that automates the audit logging by **convention** and provides **configuration** points to control the level of the audit logs. + +An **audit log object** (see the Audit Log Object section below) is typically created & saved per web request. It includes; + +* **Request & response details** (like URL, Http method, Browser info, HTTP status code... etc.). +* **Performed actions** (controller actions and application service method calls with their parameters). +* **Entity changes** occurred in the web request. +* **Exception** information (if there was an error while executing the request). +* **Request duration** (to measure the performance of the application). + +> [Startup templates](Startup-Templates/Index.md) are configured for the audit logging system which is suitable for most of the applications. Use this document for a detailed control over the audit log system. + +### Database Provider Support + +* Fully supported by the [Entity Framework Core](Entity-Framework-Core.md) provider. +* Entity change logging is not supported by the [MongoDB](MongoDB.md) provider. Other features work as expected. + +## UseAuditing() + +`UseAuditing()` middleware should be added to the ASP.NET Core request pipeline in order to create and save the audit logs. If you've created your applications using [the startup templates](Startup-Templates/Index.md), it is already added. + +## AbpAuditingOptions + +`AbpAuditingOptions` is the main [options object](Options.md) to configure the audit log system. You can configure it in the `ConfigureServices` method of your [module](Module-Development-Basics.md): + +````csharp +Configure(options => +{ + options.IsEnabled = false; //Disables the auditing system +}); +```` + +Here, a list of the options you can configure: + +* `IsEnabled` (default: `true`): A root switch to enable or disable the auditing system. Other options is not used if this value is `false`. +* `HideErrors` (default: `true`): Audit log system hides and write regular [logs](Logging.md) if any error occurs while saving the audit log objects. If saving the audit logs is critical for your system, set this to `false` to throw exception in case of hiding the errors. +* `IsEnabledForAnonymousUsers` (default: `true`): If you want to write audit logs only for the authenticated users, set this to `false`. If you save audit logs for anonymous users, you will see `null` for `UserId` values for these users. +* `AlwaysLogOnException` (default: `true`): If you set to true, it always saves the audit log on an exception/error case without checking other options (except `IsEnabled`, which completely disables the audit logging). +* `IsEnabledForGetRequests` (default: `false`): HTTP GET requests should not make any change in the database normally and audit log system doesn't save audit log objects for GET request. Set this to `true` to enable it also for the GET requests. +* `ApplicationName`: If multiple applications saving audit logs into a single database, set this property to your application name, so you can distinguish the logs of different applications. +* `IgnoredTypes`: A list of `Type`s to be ignored for audit logging. If this is an entity type, changes for this type of entities will not be saved. This list is also used while serializing the action parameters. +* `EntityHistorySelectors`: A list of selectors those are used to determine if an entity type is selected for saving the entity change. See the section below for details. +* `Contributors`: A list of `AuditLogContributor` implementations. A contributor is a way of extending the audit log system. See the "Audit Log Contributors" section below. + +### Entity History Selectors + +Saving all changes of all your entities would require a lot of database space. For this reason, **audit log system doesn't save any change for the entities unless you explicitly configure it**. + +To save all changes of all entities, simply use the `AddAllEntities()` extension method. + +````csharp +Configure(options => +{ + options.EntityHistorySelectors.AddAllEntities(); +}); +```` + +`options.EntityHistorySelectors` actually a list of type predicate. You can write a lambda expression to define your filter. + +The example selector below does the same of the `AddAllEntities()` extension method defined above: + +````csharp +Configure(options => +{ + options.EntityHistorySelectors.Add( + new NamedTypeSelector( + "MySelectorName", + type => + { + if (typeof(IEntity).IsAssignableFrom(type)) + { + return true; + } + else + { + return false; + } + } + ) + ); +}); +```` + +The condition `typeof(IEntity).IsAssignableFrom(type)` will be `true` for any class implements the `IEntity` interface (this is technically all the entities in your application). You can conditionally check and return `true` or `false` based on your preference. + +`options.EntityHistorySelectors` is a flexible and dynamic way of selecting the entities for audit logging. Another way is to use the `Audited` and `DisableAuditing` attributes per entity. + +## Enabling/Disabling Audit Logging for Services + +### Enable/Disable for Controllers & Actions + +All the controller actions are logged by default (see `IsEnabledForGetRequests` above for GET requests). + +You can use the `[DisableAuditing]` to disable it for a specific controller type: + +````csharp +[DisableAuditing] +public class HomeController : AbpController +{ + //... +} +```` + +Use `[DisableAuditing]` for any action to control it in the action level: + +````csharp +public class HomeController : AbpController +{ + [DisableAuditing] + public async Task Home() + { + //... + } + + public async Task OtherActionLogged() + { + //... + } +} +```` + +### Enable/Disable for Application Services & Methods + +[Application service](Application-Services.md) method calls also included into the audit log by default. You can use the `[DisableAuditing]` in service or method level. + +#### Enable/Disable for Other Services + +Action audit logging can be enabled for any type of class (registered to and resolved from the [dependency injection](Dependency-Injection.md)) while it is only enabled for the controllers and the application services by default. + +Use `[Audited]` and `[DisableAuditing]` for any class or method that need to be audit logged. In addition, your class can (directly or inherently) implement the `IAuditingEnabled` interface to enable the audit logging for that class by default. + +### Enable/Disable for Entities & Properties + +An entity is ignored on entity change audit logging in the following cases; + +* If you add an entity type to the `AbpAuditingOptions.IgnoredTypes` (as explained before), it is completely ignored in the audit logging system. +* If the object is not an [entity](Entities.md) (not implements `IEntity` directly or inherently - All entities implement this interface by default). +* If entity type is not public. + +Otherwise, you can use `Audited` to enable entity change audit logging for an entity: + +````csharp +[Audited] +public class MyEntity : Entity +{ + //... +} +```` + +Or disable it for an entity: + +````csharp +[DisableAuditing] +public class MyEntity : Entity +{ + //... +} +```` + +Disabling audit logging can be necessary only if the entity is being selected by the `AbpAuditingOptions.EntityHistorySelectors` that explained before. + +You can disable auditing only some properties of your entities for a detailed control over the audit logging: + +````csharp +[Audited] +public class MyUser : Entity +{ + public string Name { get; set; } + + public string Email { get; set; } + + [DisableAuditing] //Ignore the Passoword on audit logging + public string Password { get; set; } +} +```` + +Audit log system will save changes for the `MyUser` entity while it ignores the `Password` property which can be dangerous to save for security purposes. + +In some cases, you may want to save a few properties but ignore all others. Writing `[DisableAuditing]` for all the other properties would be tedious. In such cases, use `[Audited]` only for the desired properties and mark the entity with the `[DisableAuditing]` attribute: + +````csharp +[DisableAuditing] +public class MyUser : Entity +{ + [Audited] //Only log the Name change + public string Name { get; set; } + + public string Email { get; set; } + + public string Password { get; set; } +} +```` + +## IAuditingStore + +`IAuditingStore` is an interface that is used to save the audit log objects (explained below) by the ABP Framework. If you need to save the audit log objects to a custom data store, you can implement the `IAuditingStore` in your own application and replace using the [dependency injection system](Dependency-Injection.md). + +`SimpleLogAuditingStore` is used if no audit store was registered. It simply writes the audit object to the standard [logging system](Logging.md). + +[The Audit Logging Module](Modules/Audit-Logging.md) has been configured in [the startup templates](Startup-Templates/Index.md) saves audit log objects to a database (it supports multiple database providers). So, most of the times you don't care about how `IAuditingStore` was implemented and used. + +## Audit Log Object + +An **audit log object** is created for each **web request** by default. An audit log object can be represented by the following relation diagram: + +![**auditlog-object-diagram**](images/auditlog-object-diagram.png) + +* **AuditLogInfo**: The root object with the following properties: + * `ApplicationName`: When you save audit logs of different applications to the same database, this property is used to distinguish the logs of the applications. + * `UserId`: Id of the current user, if the user has logged in. + * `UserName`: User name of the current user, if the user has logged in (this value is here to not depend on the identity module/system for lookup). + * `TenantId`: Id of the current tenant, for a multi-tenant application. + * `TenantName`: Name of the current tenant, for a multi-tenant application. + * `ExecutionTime`: The time when this audit log object has been created. + * `ExecutionDuration`: Total execution duration of the request, in milliseconds. This can be used to observe the performance of the application. + * `ClientId`: Id of the current client, if the client has been authenticated. A client is generally a 3rd-party application using the system over an HTTP API. + * `ClientName`: Name of the current client, if available. + * `ClientIpAddress`: IP address of the client/user device. + * `CorrelationId`: Current [Correlation Id](CorrelationId.md). Correlation Id is used to relate the audit logs written by different applications (or microservices) in a single logical operation. + * `BrowserInfo`: Browser name/version info of the current user, if available. + * `HttpMethod`: HTTP method of the current request (GET, POST, PUT, DELETE... etc.). + * `HttpStatusCode`: HTTP response status code for this request. + * `Url`: URL of the request. +* **AuditLogActionInfo**: An audit log action is typically a controller action or an [application service](Application-Services.md) method call during the web request. One audit log may contain multiple actions. An action object has the following properties: + * `ServiceName`: Name of the executed controller/service. + * `MethodName`: Name of the executed method of the controller/service. + * `Parameters`: A JSON formatted text representing the parameters passed to the method. + * `ExecutionTime`: The time when this method was executed. + * `ExecutionDuration`: Duration of the method execution, in milliseconds. This can be used to observe the performance of the method. +* **EntityChangeInfo**: Represents a change of an entity in this web request. An audit log may contain zero or more entity changes. An entity change has the following properties: + * `ChangeTime`: The time when the entity was changed. + * `ChangeType`: An enum with the following fields: `Created` (0), `Updated` (1) and `Deleted` (2). + * `EntityId`: Id of the entity that was changed. + * `EntityTenantId`: Id of the tenant this entity belongs to. + * `EntityTypeFullName`: Type (class) name of the entity with full namespace (like *Acme.BookStore.Book* for the Book entity). +* **EntityPropertyChangeInfo**: Represents a change of a property of an entity. An entity change info (explained above) may contain one or more property change with the following properties: + * `NewValue`: New value of the property. It is `null` if the entity was deleted. + * `OriginalValue`: Old/original value before the change. It is `null` if the entity was newly created. + * `PropertyName`: The name of the property on the entity class. + * `PropertyTypeFullName`: Type (class) name of the property with full namespace. +* **Exception**: An audit log object may contain zero or more exception. In this way, you can get a report of the failed requests. +* **Comment**: An arbitrary string value to add custom messages to the audit log entry. An audit log object may contain zero or more comments. + +In addition to the standard properties explained above, `AuditLogInfo`, `AuditLogActionInfo` and `EntityChangeInfo` objects implement the `IHasExtraProperties` interface, so you can add custom properties to these objects. + +## Audit Log Contributors + +You can extend the auditing system by creating a class that is derived from the `AuditLogContributor` class which defines the `PreContribute` and the `PostContribute` methods. + +The only pre-built contributor is the `AspNetCoreAuditLogContributor` class which sets the related properties for an HTTP request. + +A contributor can set properties and collections of the `AuditLogInfo` class to add more information. + +Example: + +````csharp +public class MyAuditLogContributor : AuditLogContributor +{ + public override void PreContribute(AuditLogContributionContext context) + { + var currentUser = context.ServiceProvider.GetRequiredService(); + context.AuditInfo.SetProperty( + "MyCustomClaimValue", + currentUser.FindClaimValue("MyCustomClaim") + ); + } + + public override void PostContribute(AuditLogContributionContext context) + { + context.AuditInfo.Comments.Add("Some comment..."); + } +} +```` + +* `context.ServiceProvider` can be used to resolve services from the [dependency injection](Dependency-Injection.md). +* `context.AuditInfo` can be used to access to the current audit log object to manipulate it. + +After creating such a contributor, you must add it to the `AbpAuditingOptions.Contributors` list: + +````csharp +Configure(options => +{ + options.Contributors.Add(new MyAuditLogContributor()); +}); +```` + +## IAuditLogScope & IAuditingManager + +This section explains the `IAuditLogScope` & `IAuditingManager` services for advanced use cases. + +An **audit log scope** is an [ambient scope](Ambient-Context-Pattern.md) that **builds** and **saves** an audit log object (explained before). By default, an audit log scope is created for a web request by the Audit Log Middleware (see `UseAuditing()` section above). + +### Access to the Current Audit Log Scope + +Audit log contributors, was explained above, is a global way of manipulating the audit log object. It is good if you can get a value from a service. + +If you need to manipulate the audit log object in an arbitrary point of your application, you can access to the current audit log scope and get the current audit log object (independent of how the scope is managed). Example: + +````csharp +public class MyService : ITransientDependency +{ + private readonly IAuditingManager _auditingManager; + + public MyService(IAuditingManager auditingManager) + { + _auditingManager = auditingManager; + } + + public async Task DoItAsync() + { + var currentAuditLogScope = _auditingManager.Current; + if (currentAuditLogScope != null) + { + currentAuditLogScope.Log.Comments.Add( + "Executed the MyService.DoItAsync method :)" + ); + + currentAuditLogScope.Log.SetProperty("MyCustomProperty", 42); + } + } +} +```` + +Always check if `_auditingManager.Current` is null or not, because it is controlled in an outer scope and you can't know if an audit log scope was created before calling your method. + +### Manually Create an Audit Log Scope + +You rarely need to create a manual audit log scope, but if you need, you can create an audit log scope using the `IAuditingManager` as like in the following example: + +````csharp +public class MyService : ITransientDependency +{ + private readonly IAuditingManager _auditingManager; + + public MyService(IAuditingManager auditingManager) + { + _auditingManager = auditingManager; + } + + public async Task DoItAsync() + { + using (var auditingScope = _auditingManager.BeginScope()) + { + try + { + //Call other services... + } + catch (Exception ex) + { + //Add exceptions + _auditingManager.Current.Log.Exceptions.Add(ex); + } + finally + { + //Always save the log + await auditingScope.SaveAsync(); + } + } + } +} +```` + +You can call other services, they may call others, they may change entities and so on. All these interactions are saved as a single audit log object in the finally block. + +## The Audit Logging Module + +The Audit Logging Module basically implements the `IAuditingStore` to save the audit log objects to a database. It supports multiple database providers. This module is added to the startup templates by default. + +See [the Audit Logging Module document](Modules/Audit-Logging.md) for more about it. diff --git a/docs/en/Background-Jobs-Hangfire.md b/docs/en/Background-Jobs-Hangfire.md index 031ae28589..588fcace9e 100644 --- a/docs/en/Background-Jobs-Hangfire.md +++ b/docs/en/Background-Jobs-Hangfire.md @@ -1,3 +1,43 @@ # Hangfire Background Job Manager -TODO \ No newline at end of file +[Hangfire](https://www.hangfire.io/) is an advanced background job manager. You can integrate Hangfire with the ABP Framework to use it instead of the [default background job manager](Background-Jobs.md). In this way, you can use the same background job API for Hangfire and your code will be independent of Hangfire. If you like, you can directly use Hangfire's API, too. + +> See the [background jobs document](Background-Jobs.md) to learn how to use the background job system. This document only shows how to install and configure the Hangfire integration. + +## Installation + +It is suggested to use the [ABP CLI](CLI.md) to install this package. + +### Using the ABP CLI + +Open a command line window in the folder of the project (.csproj file) and type the following command: + +````bash +abp add-package Volo.Abp.BackgroundJobs.HangFire +```` + +### Manual Installation + +If you want to manually install; + +1. Add the [Volo.Abp.BackgroundJobs.HangFire](https://www.nuget.org/packages/Volo.Abp.BackgroundJobs.HangFire) NuGet package to your project: + + ```` + Install-Package Volo.Abp.BackgroundJobs.HangFire + ```` + +2. Add the `AbpBackgroundJobsHangfireModule` to the dependency list of your module: + +````csharp +[DependsOn( + //...other dependencies + typeof(AbpBackgroundJobsHangfireModule) //Add the new module dependency + )] +public class YourModule : AbpModule +{ +} +```` + +## Configuration + +TODO... \ No newline at end of file diff --git a/docs/en/Background-Jobs.md b/docs/en/Background-Jobs.md index 73815bb229..70f06bbadb 100644 --- a/docs/en/Background-Jobs.md +++ b/docs/en/Background-Jobs.md @@ -108,7 +108,7 @@ Enqueue method gets some optional arguments to control the background job: You may want to disable background job execution for your application. This is generally needed if you want to execute background jobs in another process and disable it for the current process. -Use `BackgroundJobOptions` to configure the job execution: +Use `AbpBackgroundJobOptions` to configure the job execution: ````csharp [DependsOn(typeof(AbpBackgroundJobsModule))] @@ -116,7 +116,7 @@ public class MyModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - Configure(options => + Configure(options => { options.IsJobExecutionEnabled = false; //Disables job execution }); @@ -140,7 +140,7 @@ ABP framework includes a simple `IBackgroundJobManager` implementation that; ### Configuration -Use `BackgroundJobWorkerOptions` in your [module class](Module-Development-Basics.md) to configure the default background job manager. The example below changes the timeout duration for background jobs: +Use `AbpBackgroundJobWorkerOptions` in your [module class](Module-Development-Basics.md) to configure the default background job manager. The example below changes the timeout duration for background jobs: ````csharp [DependsOn(typeof(AbpBackgroundJobsModule))] @@ -148,7 +148,7 @@ public class MyModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - Configure(options => + Configure(options => { options.DefaultTimeout = 864000; //10 days (as seconds) }); diff --git a/docs/en/Best-Practices/Index.md b/docs/en/Best-Practices/Index.md index 1a48c6b46b..f3f626ca63 100644 --- a/docs/en/Best-Practices/Index.md +++ b/docs/en/Best-Practices/Index.md @@ -23,5 +23,5 @@ Also, this guide is mostly usable for general **application development**. * [Data Transfer Objects](Data-Transfer-Objects.md) * Data Access * [Entity Framework Core Integration](Entity-Framework-Core-Integration.md) - * [MongoDB Integration](MongoDB-Integration.md) + * [MongoDB Integration](MongoDB-Integration.md) diff --git a/docs/en/Blog-Posts/2019-02-22/Post.md b/docs/en/Blog-Posts/2019-02-22/Post.md index 35f8219014..b27a50ec05 100644 --- a/docs/en/Blog-Posts/2019-02-22/Post.md +++ b/docs/en/Blog-Posts/2019-02-22/Post.md @@ -1,6 +1,6 @@ # Microservice Demo, Projects Status and Road Map -After [the first announcement](https://abp.io/blog/abp/Abp-vNext-Announcement) on the ABP vNext, we have a lot of improvements on the codebase (1100+ commits on the [GitHub repository](https://github.com/abpframework/abp)). We've created features, samples, documentation and much more. In this post, I want to inform you about some news and the status of the project. +After [the first announcement](https://blog.abp.io/Abp-vNext-Announcement) on the ABP vNext, we have a lot of improvements on the codebase (1100+ commits on the [GitHub repository](https://github.com/abpframework/abp)). We've created features, samples, documentation and much more. In this post, I want to inform you about some news and the status of the project. ## Microservice Demo Solution @@ -38,7 +38,7 @@ First release may not include a SPA template. However, we want to prepare a simp ## Chinese Web Site -There is a big ABP community in China. They have created a Chinese version of the abp.io web site: https://cn.abp.io/ They are keeping it up to date. Thanks to the Chinese developers and especially to [Liming Ma](https://github.com/maliming). +There is a big ABP community in China. They have created a Chinese version of the abp.io web site: https://abp.io/ They are keeping it up to date. Thanks to the Chinese developers and especially to [Liming Ma](https://github.com/maliming). ## NDC {London} 2019 diff --git a/docs/en/Blog-Posts/2020-01-15 v2_0_Release/Post.md b/docs/en/Blog-Posts/2020-01-15 v2_0_Release/Post.md new file mode 100644 index 0000000000..d3a525c63f --- /dev/null +++ b/docs/en/Blog-Posts/2020-01-15 v2_0_Release/Post.md @@ -0,0 +1,164 @@ +# ABP Framework v2.0 and the ABP Commercial + +ABP Framework v2.0 has been released in this week. This post explains why we have released an **early major version** and what is changed with version 2.0. + +In addition to the v2.0 release, we are excited to announce the **ABP Commercial**, which is a set of professional modules, tools, themes, and services built on top of the open-source ABP framework. + +## ABP Framework v2.0 + +### Why 2.0 instead of 1.2? + +It was planned to release v1.2 after the [v1.1.2](https://github.com/abpframework/abp/releases/tag/1.1.2) release. However, [it is reported](https://github.com/abpframework/abp/issues/2026) that v1.x has some **performance** and **stability** issues on Linux, especially when you deploy your application to **Linux** containers with **low CPU and memory** resources. + +We have investigated the problem deeply and have seen that the root cause of the problem was related to the implementation of **intercepting `async` methods**. Besides, there were some **`async` over `sync`** usages that effected the thread pool optimization. + +Finally, we **solved all the problems** with the great help of the **community**. But we also had some important **design decisions** which cause some **breaking changes** and we had to change the major version number of the framework because of the [semantic versioning](https://semver.org/). + +Most of the applications won't be affected by [the breaking changes](https://github.com/abpframework/abp/releases), or it will be trivial to make these necessary changes. + +### Breaking Changes + +#### Removed Some Sync APIs + +Some of the interceptors are required to use `async` APIs. When they intercept `sync` methods, they need to call `async` over `sync`. This eventually ends up with `async` over `sync` problem. That's why we have [removed some sync APIs](https://github.com/abpframework/abp/pull/2464). + +**`Async` over `sync`** pattern is a classical problem of `C#` when you need to **call an `async` method inside a `sync` method**. While there are some workarounds to this problem, they all have **disadvantages** and it is suggested to **not write** such code at all. You can find many documents related to this topic on the web. + +To avoid this problem, we have removed: + +- `sync` [repository](https://docs.abp.io/en/abp/latest/Repositories) methods (like `insert`, `update`, etc...), +- `sync` APIs of the [unit of work](https://docs.abp.io/en/abp/latest/Unit-Of-Work), +- `sync` APIs of the [background jobs](https://docs.abp.io/en/abp/latest/Background-Jobs), +- `sync` APIs of the [audit logging](https://docs.abp.io/en/abp/latest/Audit-Logging), +- some other rarely used `sync` APIs. + +If you get any compile error, just use the `async` versions of these APIs. + +#### Always Async! + +Beginning from the v2.0, the ABP framework assumes that you are writing your application code `async` first. Otherwise, some framework functionalities may not properly work. + +It is suggested to write `async` to all your [application services](https://docs.abp.io/en/abp/latest/Application-Services), [repository methods](https://docs.abp.io/en/abp/latest/Repositories), controller actions, page handlers. + +Even if your application service method doesn't need to be `async` , set it as `async` , because interceptors perform `async` operations (for authorization, unit of work, etc...). You can return `Task.Completed` from a method that doesn't make an `async` call. + +Example: + +````csharp +public Task GetValueAsync() +{ + //this method doesn't make any async call. + return Task.CompletedTask(42); +} +```` + +The example above normally doesn't need to be `async` because it doesn't perform an `async` call. However, making it `async` helps the ABP framework to run interceptors without `async` over sync calls. + +This rule doesn't force you to write every method `async` . This would not be good and would be tedious. It is only needed for the intercepted services (especially for [application services](https://docs.abp.io/en/abp/latest/Application-Services) and [repository methods](https://docs.abp.io/en/abp/latest/Repositories)) + +#### Other Breaking Changes + +See [the release notes](https://github.com/abpframework/abp/releases/tag/2.0.0) for the other breaking changes. Most of them will not affect your application code. + +### New Features + +This release also contains some new features and tens of enhancements: + +- [#2597](https://github.com/abpframework/abp/pull/2597) New `Volo.Abp.AspNetCore.Serilog` package. +- [#2526](https://github.com/abpframework/abp/issues/2526) Client-side validation for the dynamic `C#` client proxies. +- [#2374](https://github.com/abpframework/abp/issues/2374) `Async` background jobs. +- [#265](https://github.com/abpframework/abp/issues/265) Managing the application shutdown. +- [#2472](https://github.com/abpframework/abp/issues/2472) Implemented `DeviceFlowCodes` and `TokenCleanupService` for the `IdentityServer` module. + +See [the release notes](https://github.com/abpframework/abp/releases/tag/2.0.0) for the complete list of features, enhancements and bug fixes. + +### Documentation + +We have completed some missing documentation with the v2.0 release. In the following weeks, we will mostly focus on the documentation and tutorials. + +## ABP Commercial + +[ABP Commercial](https://commercial.abp.io/) is a set of professional **modules, tools, themes, and services** built on top of the open-source ABP framework. + +- It provides [professional modules](https://commercial.abp.io/modules) in addition to the ABP Framework's free & [open source modules](https://docs.abp.io/en/abp/latest/Modules/Index). +- It includes a beautiful a [UI theme](https://commercial.abp.io/themes) with 5 different styles. +- It provides the [ABP Suite](https://commercial.abp.io/tools/suite); A tool to assist your development to make you more productive. It currently can create full-stack CRUD pages in a few seconds by configuring your entity properties. More functionalities will be added over time. +- [Premium support](https://commercial.abp.io/support) for enterprise companies. + +In addition to these standard set of features, we will provide customer basis services. See the [commercial.abp.io](https://commercial.abp.io/) web site for other details. + +### ABP Framework vs the ABP Commercial + +The ABP Commercial **is not a paid version** of the ABP Framework. You can consider it as **set of additional benefits** for professional companies. You can use it to save your time and develop your product faster. + +ABP Framework is **open source & free** and will always be like that! + +As a principle, we build the main infrastructure as open-source and sell additional pre-built application features, themes, and tools. The main idea similar to the [ASP.NET Boilerplate](https://aspnetboilerplate.com/) & the [ASP.NET Zero](https://aspnetzero.com/) products. + +Buying a commercial license saves your significant time and effort and you can focus on your own business, besides you get dedicated and high priority support. Also, you will be supporting the ABP core team since we are spending most of our time to develop, maintain and support the open-source ABP Framework. + +With the introduction of the ABP Commercial, now ABP becomes a platform. We call it as the **ABP.IO Platform** which consists of the open source ABP Framework and the ABP Commercial. + +### Demo + +If you are wondering how exactly looks like the ABP Commercial application startup template, you can easily [create a demo](https://commercial.abp.io/demo) and see it in action. The demo includes all the pre-built modules and the theme. + +Here, a screenshot from the IdentityServer management module UI: + +![abp-commercial-demo](abp-commercial-demo.png) + +This is another screenshot from a demo application using the material design style of the theme: + +![lepton-theme-material](lepton-theme-material.png) + +### Pricing + +You can build **unlimited projects/products**, sell to **unlimited customers**, host **unlimited servers** without any restriction. Pricing is mostly based on the **developer count**, **support level** and **source code** requirement. There are three main packages; + +- **Team license**: Includes all the modules, themes and tools. Allows developing your product with up to 3 developers. You can buy additional developer licenses. +- **Business license**: Allows downloading the source code of all the modules and the themes. Also, it includes 5 developer licenses by default. You can buy additional developer licenses. +- **Enterprise license**: Provides unlimited and private support in addition to the benefits of the business license. + +See the [pricing page](https://commercial.abp.io/pricing) for details. In addition to the standard packages, we are also providing custom services and custom licensing. [Contact us](https://commercial.abp.io/contact) if you have any questions. + +#### License Comparison + +The license price changes based on your developer count, support level and source-code access. + +##### The Source-Code + +Team license doesn't include the source-code of the pre-built modules & themes. It uses all these modules as **NuGet & NPM packages**. In this way, you can easily **get new features and bug fixes** by just updating the package dependencies. But you can't access their source-code. So you don't have the possibility to embed a module's source code into your application and freely change the source-code. + +Pre-built modules provide some level of **customization** and **extensibility** and allow you to override services, UI parts and so on. We are working on to make them much more customizable and extensible. If you don't need to make major changes in the pre-built modules, the team license will be ideal for you, because it is cheaper and allows you to easily get new features and bug fixes. + +Business and Enterprise licenses allow you to **download the source-code** of any module or the theme when you need it. They also use the same startup template with the team license, so all modules are used as `NuGet` & `NPM` packages by default. But in case of need, you can remove the package dependencies for a module and embed its source-code into your own solution to completely customize it. In this case, upgrading the module will not be as easy as before when a new version is available. You don't have to upgrade it, surely! But if you want, you should do it yourself using some merge tool or Git branch system. + +#### License Lifetime + +ABP Commercial license is **perpetual**, which means you can **use it forever** and continue to develop your applications. + +However, the following services are covered for one year: + +- Premium **support** ends after one year. You can continue to get community support. +- You can not get **updates** of the modules & the themes after one year. You can continue to use the last obtained version. You can even get bug fixes and enhancements for your current major version. +- You can use the **ABP Suite** tool for one year. + +If you want to continue to get these benefits, you can extend your license period. Renewing price is 20% less than the regular price. + +## NDC London 2020 + +Just like the [previous year](https://medium.com/volosoft/impressions-of-ndc-london-2019-f8f391bb7a9c), we are a partner of the famous software development conference: [NDC London](https://ndc-london.com/)! In the previous year, we were there with the [ASP.NET Boilerplate](https://aspnetboilerplate.com/) & [ASP.NET Zero](https://aspnetzero.com/) theme: + +![ndc-london-volosoft](ndc-london-volosoft.png) + +This year, we will be focusing on the **ABP.IO Platform** (The Open Source ABP Framework and the ABP Commercial). Our booth wall will be like that: + +![ndc-london-volosoft](ndc-2020-volosoft-booth-wall.png) + +If you attend to the conference, remember to visit our booth. We would be glad to talk about the ABP platform features, goals and software development in general. + +### Would you like to meet the ABP Team? + +If you are in London and want to have a coffee with us, we will be available at February 1st afternoon. [@hibrahimkalkan](https://twitter.com/hibrahimkalkan) and [@ismcagdas](https://twitter.com/ismcagdas) will be there. + +Just write to info@abp.io if you want to meet :) \ No newline at end of file diff --git a/docs/en/Blog-Posts/2020-01-15 v2_0_Release/abp-commercial-demo.png b/docs/en/Blog-Posts/2020-01-15 v2_0_Release/abp-commercial-demo.png new file mode 100644 index 0000000000..caddce27ab Binary files /dev/null and b/docs/en/Blog-Posts/2020-01-15 v2_0_Release/abp-commercial-demo.png differ diff --git a/docs/en/Blog-Posts/2020-01-15 v2_0_Release/abp-io-abpcommercial-release.png b/docs/en/Blog-Posts/2020-01-15 v2_0_Release/abp-io-abpcommercial-release.png new file mode 100644 index 0000000000..4366ceb986 Binary files /dev/null and b/docs/en/Blog-Posts/2020-01-15 v2_0_Release/abp-io-abpcommercial-release.png differ diff --git a/docs/en/Blog-Posts/2020-01-15 v2_0_Release/lepton-theme-material.png b/docs/en/Blog-Posts/2020-01-15 v2_0_Release/lepton-theme-material.png new file mode 100644 index 0000000000..72cb5c0639 Binary files /dev/null and b/docs/en/Blog-Posts/2020-01-15 v2_0_Release/lepton-theme-material.png differ diff --git a/docs/en/Blog-Posts/2020-01-15 v2_0_Release/ndc-2020-volosoft-booth-wall.png b/docs/en/Blog-Posts/2020-01-15 v2_0_Release/ndc-2020-volosoft-booth-wall.png new file mode 100644 index 0000000000..70fb9d54f7 Binary files /dev/null and b/docs/en/Blog-Posts/2020-01-15 v2_0_Release/ndc-2020-volosoft-booth-wall.png differ diff --git a/docs/en/Blog-Posts/2020-01-15 v2_0_Release/ndc-london-volosoft.png b/docs/en/Blog-Posts/2020-01-15 v2_0_Release/ndc-london-volosoft.png new file mode 100644 index 0000000000..afaed37a7a Binary files /dev/null and b/docs/en/Blog-Posts/2020-01-15 v2_0_Release/ndc-london-volosoft.png differ diff --git a/docs/en/Caching.md b/docs/en/Caching.md index 8aa9f00657..bb11b2b45a 100644 --- a/docs/en/Caching.md +++ b/docs/en/Caching.md @@ -2,6 +2,32 @@ ABP framework extends ASP.NET Core's distributed caching system. +## Volo.Abp.Caching Package + +> This package is already installed by default with the startup template. So, most of the time, you don't need to install it manually. + +Volo.Abp.Caching is the core package of the caching system. Install it to your project using the package manager console (PMC): + +``` +Install-Package Volo.Abp.Caching +``` + +Then you can add **AbpCachingModule** dependency to your module: + +```c# +using Volo.Abp.Modularity; +using Volo.Abp.Caching; + +namespace MyCompany.MyProject +{ + [DependsOn(typeof(AbpCachingModule))] + public class MyModule : AbpModule + { + //... + } +} +``` + ## `IDistributedCache` Interface ASP.NET Core defines the `IDistributedCache` interface to get/set cache values. But it has some difficulties: diff --git a/docs/en/Clock.md b/docs/en/Clock.md new file mode 100644 index 0000000000..46ef1235e0 --- /dev/null +++ b/docs/en/Clock.md @@ -0,0 +1,3 @@ +# Clock + +TODO \ No newline at end of file diff --git a/docs/en/Connection-Strings.md b/docs/en/Connection-Strings.md index 36103011e1..eb7aae3a21 100644 --- a/docs/en/Connection-Strings.md +++ b/docs/en/Connection-Strings.md @@ -1,11 +1,88 @@ -# Data Access +# Connection Strings -ABP framework was designed as database agnostic, it can work any type of data source by the help of the [repository](Repositories.md) and [unit of work](Unit-Of-Work.md) abstractions. +ABP Framework is designed to be [modular](Module-Development-Basics.md), [microservice compatible](Microservice-Architecture.md) and [multi-tenancy](Multi-Tenancy.md) aware. Connection string management is also designed to support these scenarios; -However, currently the following providers are implements: +* Allows to set separate connection strings for every module, so every module can have its own physical database. Modules even might be configured to use different DBMSs. +* Allows to set separate connection string and use a separate database per tenant (in a SaaS application). -* [Entity Framework Core](Entity-Framework-Core.md) (works with [various DBMS and providers](https://docs.microsoft.com/en-us/ef/core/providers/?tabs=dotnet-core-cli).) -* [MongoDB](MongoDB.md) -* [Dapper](Dapper.md) +It also supports hybrid scenarios; -More providers might be added in the next releases. \ No newline at end of file +* Allows to group modules into databases (all modules into a single shared database, 2 modules to database A, 3 modules to database B, 1 module to database C and rest of the modules to database D... etc.) +* Allows to group tenants into databases, just like the modules. +* Allows to separate databases per tenant per module (which might be harder to maintain for you because of too many databases, but the ABP framework supports it). + +All the [pre-built application modules](Modules/Index.md) are designed to be compatible these scenarios. + +## Configure the Connection Strings + +See the following configuration: + +````json +"ConnectionStrings": { + "Default": "Server=localhost;Database=MyMainDb;Trusted_Connection=True;", + "AbpIdentityServer": "Server=localhost;Database=MyIdsDb;Trusted_Connection=True;", + "AbpPermissionManagement": "Server=localhost;Database=MyPermissionDb;Trusted_Connection=True;" +} +```` + +> ABP uses the `IConfiguration` service to get the application configuration. While the simplest way to write configuration into the `appsettings.json` file, it is not limited to this file. You can use environment variables, user secrets, Azure Key Vault... etc. See the [configuration](Configuration.md) document for more. + +This configuration defines three different connection strings: + +* `MyMainDb` (the `Default` connection string) is the main connection string of the application. If you don't specify a connection string for a module, it fallbacks to the `Default` connection string. The [application startup template](Startup-Templates/Application.md) is configured to use a single connection string, so all the modules uses a single shared database. +* `MyIdsDb` is used by the [IdentityServer](Modules/IdentityServer.md) module. +* `MyPermissionDb` is used by the [Permission Management](Modules/Permission-Management.md) module. + +[Pre-built application modules](Modules/Index.md) define constants for the connection string names. For example, the IdentityServer module defines a ` ConnectionStringName ` constant in the ` AbpIdentityServerDbProperties ` class (located in the ` Volo.Abp.IdentityServer ` namespace). Other modules similarly define constants, so you can investigate the connection string name. + +### AbpDbConnectionOptions + +ABP actually uses the `AbpDbConnectionOptions` to get the connection strings. If you set the connection strings as explained above, `AbpDbConnectionOptions` is automatically filled. However, you can set or override the connection strings using [the options pattern](Options.md). You can configure the `AbpDbConnectionOptions` in the `ConfigureServices` method of your [module](Module-Development-Basics.md) as shown below: + +````csharp +public override void ConfigureServices(ServiceConfigurationContext context) +{ + Configure(options => + { + options.ConnectionStrings.Default = "..."; + options.ConnectionStrings["AbpPermissionManagement"] = "..."; + }); +} +```` + +## Set the Connection String Name + +A module typically has a unique connection string name associated to its `DbContext` class using the `ConnectionStringName` attribute. Example: + +````csharp +[ConnectionStringName("AbpIdentityServer")] +public class IdentityServerDbContext + : AbpDbContext, IIdentityServerDbContext +{ +} +```` + +For [Entity Framework Core](Entity-Framework-Core.md) and [MongoDB](MongoDB.md), write this to your `DbContext` class (and the interface if it has). + +> If you are developing a reusable, database provider independent module see also [the best practices guide](Best-Practices/Index.md). + +## Database Migrations for the Entity Framework Core + +Relational databases require to create the database and the database schema (tables, views... etc.) before using it. + +The startup template (with EF Core ORM) comes with a single database and a `.EntityFrameworkCore.DbMigrations` project that contains the migration files for that database. This project mainly defines a *YourProjectName*MigrationsDbContext that calls the `Configure...()` methods of the used modules, like `builder.ConfigurePermissionManagement()`. + +Once you want to separate a module's database, you typically will need to create a second migration path. The easiest way to create a copy of the `.EntityFrameworkCore.DbMigrations` project with the `DbContext` inside it, change its content to only call the `Configure...()` methods of the modules needs to be stored in the second database and re-create the initial migration. In this case, you also need to change the `.DbMigrator` application to be able to work with these second database too. In this way, you will have a separate migrations DbContext per database. + +## Multi-Tenancy + +See [the multi-tenancy document](Multi-Tenancy.md) to learn how to use separate databases for tenants. + +## Replace the Connection String Resolver + +ABP defines the `IConnectionStringResolver` and uses it whenever it needs a connection string. It has two pre-built implementations: + +* `DefaultConnectionStringResolver` uses the `AbpDbConnectionOptions` to select the connection string based on the rules defined in the "Configure the Connection Strings" section above. +* `MultiTenantConnectionStringResolver` used for multi-tenant applications and tries to get the configured connection string for the current tenant if available. It uses the `ITenantStore` to find the connection strings. It inherits from the `DefaultConnectionStringResolver` and fallbacks to the base logic if no connection string specified for the current tenant. + +If you need a custom logic to determine the connection string, implement the `IConnectionStringResolver` interface (optionally derive from the existing implementations) and replace the existing implementation using the [dependency injection](Dependency-Injection.md) system. \ No newline at end of file diff --git a/docs/en/Contribution/Localization-Text-Files.md b/docs/en/Contribution/Localization-Text-Files.md index 3932800575..2a8e5ee468 100644 --- a/docs/en/Contribution/Localization-Text-Files.md +++ b/docs/en/Contribution/Localization-Text-Files.md @@ -3,7 +3,7 @@ Here, a list of localization text files for anyone wants to contribute to localization of the texts coming from the framework. We will keep this list up to date: * https://github.com/abpframework/abp/tree/master/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Localization/en.json -* https://github.com/abpframework/abp/tree/master/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/en.json +* https://github.com/abpframework/abp/blob/master/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/en.json * https://github.com/abpframework/abp/tree/master/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Localization/Resource/en.json * https://github.com/abpframework/abp/tree/master/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json * https://github.com/abpframework/abp/tree/master/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/Resource/en.json @@ -12,29 +12,20 @@ Here, a list of localization text files for anyone wants to contribute to locali * https://github.com/abpframework/abp/tree/master/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/Base/Validation/en.json * https://github.com/abpframework/abp/tree/master/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/Source/en.json * https://github.com/abpframework/abp/tree/master/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/SourceExt/en.json -* https://github.com/abpframework/abp/tree/master/modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/en.json +* https://github.com/abpframework/abp/blob/master/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json * https://github.com/abpframework/abp/tree/master/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Localization/Resources/Blogging/ApplicationContracts/en.json -* https://github.com/abpframework/abp/tree/master/modules/blogging/src/Volo.Blogging.Web/Localization/Resources/Blogging/Web/en.json +* https://github.com/abpframework/abp/tree/master/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Localization/Resources/en.json * https://github.com/abpframework/abp/tree/master/modules/docs/app/VoloDocs.Web/Localization/Resources/VoloDocs/Web/en.json * https://github.com/abpframework/abp/tree/master/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/en.json -* https://github.com/abpframework/abp/tree/master/modules/docs/src/Volo.Docs.Admin.Web/Localization/Resources/Docs/Web/en.json * https://github.com/abpframework/abp/tree/master/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/en.json -* https://github.com/abpframework/abp/tree/master/modules/feature-management/src/Volo.Abp.FeatureManagement.Application.Contracts/Volo/Abp/FeatureManagement/Localization/ApplicationContracts/en.json -* https://github.com/abpframework/abp/tree/master/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/en.json -* https://github.com/abpframework/abp/tree/master/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Localization/Resources/FeatureManagement/en.json -* https://github.com/abpframework/abp/tree/master/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/Localization/ApplicationContracts/en.json -* https://github.com/abpframework/abp/tree/master/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/Localization/Domain/en.json -* https://github.com/abpframework/abp/tree/master/modules/identity/src/Volo.Abp.Identity.Web/Localization/Resources/AbpIdentity/en.json -* https://github.com/abpframework/abp/tree/master/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Localization/Resources/AbpPermissionManagement/en.json -* https://github.com/abpframework/abp/tree/master/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Localization/Resources/AbpSettingManagement/en.json -* https://github.com/abpframework/abp/tree/master/modules/tenant-management/src/Volo.Abp.TenantManagement.Application.Contracts/Volo/Abp/TenantManagement/Localization/ApplicationContracts/en.json -* https://github.com/abpframework/abp/tree/master/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Localization/Resources/AbpTenantManagement/Web/en.json +* https://github.com/abpframework/abp/tree/master/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/Localization/Domain/en.json +* https://github.com/abpframework/abp/tree/master/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en.json +* https://github.com/abpframework/abp/tree/master/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/en.json +* https://github.com/abpframework/abp/tree/master/modules/setting-management/src/Volo.Abp.SettingManagement.Domain.Shared/Volo/Abp/SettingManagement/Localization/Resources/AbpSettingManagement/en.json +* https://github.com/abpframework/abp/tree/master/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/Localization/Resources/en.json * https://github.com/abpframework/abp/tree/master/samples/BookStore/src/Acme.BookStore.Domain.Shared/Localization/BookStore/en.json -* https://github.com/abpframework/abp/tree/master/samples/DashboardDemo/src/DashboardDemo.Domain/Localization/DashboardDemo/en.json +* https://github.com/abpframework/abp/tree/master/samples/DashboardDemo/src/DashboardDemo.Domain.Shared/Localization/DashboardDemo/en.json * https://github.com/abpframework/abp/tree/master/samples/MicroserviceDemo/modules/product/src/ProductManagement.Application.Contracts/ProductManagement/Localization/ApplicationContracts/en.json * https://github.com/abpframework/abp/tree/master/samples/MicroserviceDemo/modules/product/src/ProductManagement.Domain/ProductManagement/Localization/Domain/en.json * https://github.com/abpframework/abp/tree/master/samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/Localization/Resources/ProductManagement/en.json -* https://github.com/abpframework/abp/tree/master/templates/mvc-module/src/MyCompanyName.MyProjectName.Application.Contracts/Localization/MyProjectName/ApplicationContracts/en.json -* https://github.com/abpframework/abp/tree/master/templates/mvc-module/src/MyCompanyName.MyProjectName.Domain.Shared/Localization/MyProjectName/DomainShared/en.json -* https://github.com/abpframework/abp/tree/master/templates/mvc-module/src/MyCompanyName.MyProjectName.Web/Localization/MyProjectName/Web/en.json -* https://github.com/abpframework/abp/tree/master/templates/mvc/src/MyCompanyName.MyProjectName.Domain.Shared/Localization/MyProjectName/en.json +* https://github.com/abpframework/abp/tree/master/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/Localization/MyProjectName/en.json diff --git a/docs/en/Data-Access.md b/docs/en/Data-Access.md index c1a45366a8..a37f77eb65 100644 --- a/docs/en/Data-Access.md +++ b/docs/en/Data-Access.md @@ -1,9 +1,15 @@ # Data Access +## Database Providers + ABP framework was designed as database agnostic. It can work any type of data source by the help of the [repository](Repositories.md) and [unit of work](Unit-Of-Work.md) abstractions. However, currently the following providers are implemented: * [Entity Framework Core](Entity-Framework-Core.md) (works with [various DBMS and providers](https://docs.microsoft.com/en-us/ef/core/providers/).) * [MongoDB](MongoDB.md) * [Dapper](Dapper.md) -More providers will be added in the future. \ No newline at end of file +More providers will be added in the future. + +## See Also + +* [Connection Strings](Connection-Strings.md) \ No newline at end of file diff --git a/docs/en/Dependency-Injection.md b/docs/en/Dependency-Injection.md index eb0da4a0e4..335e829461 100644 --- a/docs/en/Dependency-Injection.md +++ b/docs/en/Dependency-Injection.md @@ -166,6 +166,24 @@ public class BlogModule : AbpModule } ```` +### Replace a Service + +If you need to replace an existing service (defined by the ABP framework or another module dependency), you have two options; + +1. Use the `Dependency` attribute of the ABP framework as explained above. +2. Use the `IServiceCollection.Replace` method of the Microsoft Dependency Injection library. Example: + +````csharp +public class MyModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + //Replacing the IConnectionStringResolver service + context.Services.Replace(ServiceDescriptor.Transient()); + } +} +```` + ## Injecting Dependencies There are three common ways of using a service that has already been registered. diff --git a/docs/en/Entities.md b/docs/en/Entities.md index 8ae7cdf235..b5d196cccb 100644 --- a/docs/en/Entities.md +++ b/docs/en/Entities.md @@ -1,34 +1,87 @@ -## Entities +# Entities Entities are one of the core concepts of DDD (Domain Driven Design). Eric Evans describe it as "*An object that is not fundamentally defined by its attributes, but rather by a thread of continuity and identity*". An entity is generally mapped to a table in a relational database. -### Entity Class +## Entity Class -Entities are derived from `Entity` class as shown below: +Entities are derived from the `Entity` class as shown below: ```C# -public class Person : Entity +public class Book : Entity { public string Name { get; set; } - public DateTime CreationTime { get; set; } + public float Price { get; set; } +} +``` + +> If you do not want to derive your entity from the base `Entity` class, you can directly implement `IEntity` interface. + +`Entity` class just defines an `Id` property with the given primary **key type**, which is `Guid` in the example above. It can be other types like `string`, `int`, `long` or whatever you need. + +### Entities with GUID Keys + +If your entity's Id type is `Guid`, there are some good practices to implement: + +* Create a constructor that gets the Id as a parameter and passes to the base class. + * If you don't set a GUID Id, ABP Framework sets it on save, but it is good to have a valid Id on the entity even before saving it to the database. +* If you create an entity with a constructor that takes parameters, also create a `protected` empty constructor. This is used while your database provider reads your entity from the database (on deserialization). +* Don't use the `Guid.NewGuid()` to set the Id! Use [the `IGuidGenerator` service](Guid-Generation.md) while passing the Id from the code that creates the entity. `IGuidGenerator` optimized to generate sequential GUIDs, which is critical for clustered indexes in the relational databases. + +An example entity: - public Person() +````csharp +public class Book : Entity +{ + public string Name { get; set; } + + public float Price { get; set; } + + protected Book() { - CreationTime = DateTime.Now; + + } + + public Book(Guid id) + : base(id) + { + } } -``` +```` -> If you do not want to derive your entity from the base `Entity` class, you can directly implement `IEntity` interface. +Example usage in an [application service](Application-Services.md): -`Entity` class just defines an `Id` property with the given primary **key type**, which is `int` in the sample above. It can be other types like `string`, `Guid`, `long` or whatever you need. +````csharp +public class BookAppService : ApplicationService, IBookAppService +{ + private readonly IRepository _bookRepository; -Entity class also overrides the **equality** operator (==) to easily check if two entities are equal (they are equals if they are same entity type and their Ids are equals). + public BookAppService(IRepository bookRepository) + { + _bookRepository = bookRepository; + } -#### Entities with Composite Keys + public async Task CreateAsync(CreateBookDto input) + { + await _bookRepository.InsertAsync( + new Book(GuidGenerator.Create()) + { + Name = input.Name, + Price = input.Price + } + ); + } +} +```` + +* `BookAppService` injects the default [repository](Repositories.md) for the book entity and uses its `InsertAsync` method to insert a `Book` to the database. +* `GuidGenerator` is type of `IGuidGenerator` which is a property defined in the `ApplicationService` base class. ABP defines such frequently used base properties as pre-injected for you, so you don't need to manually [inject](Dependency-Injection.md) them. +* If you want to follow the DDD best practices, see the *Aggregate Example* section below. + +### Entities with Composite Keys Some entities may need to have **composite keys**. In that case, you can derive your entity from the non-generic `Entity` class. Example: @@ -53,31 +106,31 @@ public class UserRole : Entity } ```` -For the example above, the composite key is composed of `UserId` and `RoleId`. For a relational database, it is the composite primary key of the related table. - -Entities with composite keys should implement the `GetKeys()` method as shown above. +For the example above, the composite key is composed of `UserId` and `RoleId`. For a relational database, it is the composite primary key of the related table. Entities with composite keys should implement the `GetKeys()` method as shown above. -Notice that you also need to define keys of the entity in your **object-relational mapping** (ORM) configuration. +> Notice that you also need to define keys of the entity in your **object-relational mapping** (ORM) configuration. See the [Entity Framework Core](Entity-Framework-Core.md) integration document for example. -> Also note that Entities with Composite Primary Keys cannot utilize the `IRepository` interface since it requires a single unique Id property. However, you can always use `IRepository`. See [repositories documentation](Repositories.md) for more. +> Also note that Entities with Composite Primary Keys cannot utilize the `IRepository` interface since it requires a single Id property. However, you can always use `IRepository`. See [repositories documentation](Repositories.md) for more. -### AggregateRoot Class +## AggregateRoot Class "*Aggregate is a pattern in Domain-Driven Design. A DDD aggregate is a cluster of domain objects that can be treated as a single unit. An example may be an order and its line-items, these will be separate objects, but it's useful to treat the order (together with its line items) as a single aggregate.*" (see the [full description](http://martinfowler.com/bliki/DDD_Aggregate.html)) -`AggregateRoot` class extends the `Entity` class. So, it also has an `Id` property by default. +`AggregateRoot` class extends the `Entity` class. So, it also has an `Id` property by default. -> Notice that ABP creates default repositories only for aggregate roots by default. However, it's possible to include all entities. See [repositories documentation](Repositories.md) for more. +> Notice that ABP creates default repositories only for aggregate roots by default. However, it's possible to include all entities. See the [repositories documentation](Repositories.md) for more. -ABP does not force you to use aggregate roots, you can in fact use the `Entity` class as defined before. However, if you want to implement DDD and want to create aggregate root classes, there are some best practices you may want to consider: +ABP does not force you to use aggregate roots, you can in fact use the `Entity` class as defined before. However, if you want to implement the [Domain Driven Design](Domain-Driven-Design.md) and want to create aggregate root classes, there are some best practices you may want to consider: * An aggregate root is responsible to preserve it's own integrity. This is also true for all entities, but aggregate root has responsibility for it's sub entities too. So, the aggregate root must always be in a valid state. * An aggregate root can be referenced by it's Id. Do not reference it by it's navigation property. * An aggregate root is treated as a single unit. It's retrieved and updated as a single unit. It's generally considered as a transaction boundary. * Work with sub-entities over the aggregate root- do not modify them independently. -#### Aggregate Example +See the [entity design best practice guide](Best-Practices/Entities.md) if you want to implement DDD in your application. + +### Aggregate Example This is a full sample of an aggregate root with a related sub-entity collection: @@ -156,6 +209,11 @@ public class OrderLine : Entity { Count = newCount; } + + public override object[] GetKeys() + { + return new Object[] {OrderId, ProductId}; + } } ```` @@ -163,15 +221,80 @@ public class OrderLine : Entity `Order` is an **aggregate root** with `Guid` type `Id` property. It has a collection of `OrderLine` entities. `OrderLine` is another entity with a composite primary key (`OrderId` and ` ProductId`). -While this example may not implement all the best practices of an aggregate root, it still follows good practices: +While this example may not implement all the best practices of an aggregate root, it still follows some good practices: * `Order` has a public constructor that takes **minimal requirements** to construct an `Order` instance. So, it's not possible to create an order without an id and reference number. The **protected/private** constructor is only necessary to **deserialize** the object while reading from a data source. * `OrderLine` constructor is internal, so it is only allowed to be created by the domain layer. It's used inside of the `Order.AddProduct` method. * `Order.AddProduct` implements the business rule to add a product to an order. * All properties have `protected` setters. This is to prevent the entity from arbitrary changes from outside of the entity. For exmple, it would be dangerous to set `TotalItemCount` without adding a new product to the order. It's value is maintained by the `AddProduct` method. -ABP does not force you to apply any DDD rule or patterns. However, it tries to make it possible and easier when you do want to apply them. The documentation also follows the same principle. +ABP Framework does not force you to apply any DDD rule or patterns. However, it tries to make it possible and easier when you do want to apply them. The documentation also follows the same principle. -#### Aggregate Roots with Composite Keys +### Aggregate Roots with Composite Keys While it's not common (and not suggested) for aggregate roots, it is in fact possible to define composite keys in the same way as defined for the mentioned entities above. Use non-generic `AggregateRoot` base class in that case. + +## Base Classes & Interfaces for Audit Properties + +There are some properties like `CreationTime`, `CreatorId`, `LastModificationTime`... which are very common in all applications. ABP Framework provides some interfaces and base classes to **standardize** these properties and also **sets their values automatically**. + +### Auditing Interfaces + +There are a lot of auditing interfaces, so you can implement the one that you need. + +> While you can manually implement these interfaces, you can use **the base classes** defined in the next section to simplify it. + +* `IHasCreationTime` defines the following properties: + * `CreationTime` +* `IMayHaveCreator` defines the following properties: + * `CreatorId` +* `ICreationAuditedObject` inherits from the `IHasCreationTime` and the `IMayHaveCreator`, so it defines the following properties: + * `CreationTime` + * `CreatorId` +* `IHasModificationTime` defines the following properties: + * `LastModificationTime` +* `IModificationAuditedObject` extends the `IHasModificationTime` and adds the `LastModifierId` property. So, it defines the following properties: + * `LastModificationTime` + * `LastModifierId` +* `IAuditedObject` extends the `ICreationAuditedObject` and the `IModificationAuditedObject`, so it defines the following properties: + * `CreationTime` + * `CreatorId` + * `LastModificationTime` + * `LastModifierId` +* `ISoftDelete` (see the [data filtering document](Data-Filtering.md)) defines the following properties: + * `IsDeleted` +* `IHasDeletionTime` extends the `ISoftDelete` and adds the `DeletionTime` property. So, it defines the following properties: + * `IsDeleted` + * `DeletionTime` +* `IDeletionAuditedObject` extends the `IHasDeletionTime` and adds the `DeleterId` property. So, it defines the following properties: + * `IsDeleted` + * `DeletionTime` + * `DeleterId` +* `IFullAuditedObject` inherits from the `IAuditedObject` and the `IDeletionAuditedObject`, so it defines the following properties: + * `CreationTime` + * `CreatorId` + * `LastModificationTime` + * `LastModifierId` + * `IsDeleted` + * `DeletionTime` + * `DeleterId` + +Once you implement any of the interfaces, or derive from a class defined in the next section, ABP Framework automatically manages these properties wherever possible. + +> Implementing `ISoftDelete`, `IDeletionAuditedObject` or `IFullAuditedObject` makes your entity **soft-delete**. See the [data filtering document](Data-Filtering.md) to learn about the soft-delete pattern. + +### Auditing Base Classes + +While you can manually implement any of the interfaces defined above, it is suggested to inherit from the base classes defined here: + +* `CreationAuditedEntity` and `CreationAuditedAggregateRoot` implement the `ICreationAuditedObject` interface. +* `AuditedEntity` and `AuditedAggregateRoot` implement the `IAuditedObject` interface. +* `FullAuditedEntity` and `FullAuditedAggregateRoot` implement the `IFullAuditedObject` interface. + +All these base classes also have non-generic versions to take `AuditedEntity` and `FullAuditedAggregateRoot` to support the composite primary keys. + +All these base classes also have `...WithUser` pairs, like `FullAuditedAggregateRootWithUser` and`FullAuditedAggregateRootWithUser`. This makes possible to add a navigation property to your user entity. However, it is not a good practice to add navigation properties between aggregate roots, so this usage is not suggested (unless you are using an ORM, like EF Core, that well supports this scenario and you really need it - otherwise remember that this approach doesn't work for NoSQL databases like MongoDB where you must truly implement the aggregate pattern). + +## See Also + +* [Best practice guide to design the entities](Best-Practices/Entities.md) \ No newline at end of file diff --git a/docs/en/Entity-Framework-Core-MySQL.md b/docs/en/Entity-Framework-Core-MySQL.md index 911db6a010..d1fa66e1a4 100644 --- a/docs/en/Entity-Framework-Core-MySQL.md +++ b/docs/en/Entity-Framework-Core-MySQL.md @@ -1,4 +1,4 @@ -# Entity Framework Core MySQL Database Provider +# Switch to EF Core MySQL Provider This document explains how to switch to the **MySQL** database provider for **[the application startup template](Startup-Templates/Application.md)** which comes with SQL Server provider pre-configured. @@ -10,8 +10,49 @@ This document explains how to switch to the **MySQL** database provider for **[t Find ***YourProjectName*EntityFrameworkCoreModule** class inside the `.EntityFrameworkCore` project, remove `typeof(AbpEntityFrameworkCoreSqlServerModule)` from the `DependsOn` attribute, add `typeof(AbpEntityFrameworkCoreMySQLModule)` (also replace `using Volo.Abp.EntityFrameworkCore.SqlServer;` with `using Volo.Abp.EntityFrameworkCore.MySQL;`). -## Call UseMySQL +## UseMySQL() -Find `UseSqlServer()` calls in your solution, replace with `UseMySQL()` +Find `UseSqlServer()` calls in your solution, replace with `UseMySQL()`. Check the following files: -TODO \ No newline at end of file +* *YourProjectName*EntityFrameworkCoreModule.cs inside the `.EntityFrameworkCore` project. +* *YourProjectName*MigrationsDbContextFactory.cs inside the `.EntityFrameworkCore.DbMigrations` project. + +> Depending on your solution structure, you may find more code files need to be changed. + +## Change the Connection Strings + +MySQL connection strings are different than SQL Server connection strings. So, check all `appsettings.json` files in your solution and replace the connection strings inside them. See the [connectionstrings.com]( https://www.connectionstrings.com/mysql/ ) for details of MySQL connection string options. + +You typically will change the `appsettings.json` inside the `.DbMigrator` and `.Web` projects, but it depends on your solution structure. + +## Change the Migrations DbContext + +MySQL DBMS has some slight differences than the SQL Server. Some module database mapping configuration (especially the field lengths) causes problems with MySQL. For example, some of the the [IdentityServer module](Modules/IdentityServer.md) tables has such problems and it provides an option to configure the fields based on your DBMS. + +The startup template contains a *YourProjectName*MigrationsDbContext which is responsible to maintain and migrate the database schema. This DbContext basically calls extension methods of the depended modules to configure their database tables. + +Open the *YourProjectName*MigrationsDbContext and change the `builder.ConfigureIdentityServer();` line as shown below: + +````csharp +builder.ConfigureIdentityServer(options => +{ + options.DatabaseProvider = EfCoreDatabaseProvider.MySql; +}); +```` + +Then `ConfigureIdentityServer()` method will set the field lengths to not exceed the MySQL limits. Refer to related module documentation if you have any problem while creating or executing the database migrations. + +## Re-Generate the Migrations + +The startup template uses [Entity Framework Core's Code First Migrations](https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/). EF Core Migrations depend on the selected DBMS provider. So, changing the DBMS provider will cause the migration fails. + +* Delete the Migrations folder under the `.EntityFrameworkCore.DbMigrations` project and re-build the solution. +* Run `Add-Migration "Initial"` on the Package Manager Console (select the `.DbMigrator` (or `.Web`) project as the startup project in the Solution Explorer and select the `.EntityFrameworkCore.DbMigrations` project as the default project in the Package Manager Console). + +This will create a database migration with all database objects (tables) configured. + +Run the `.DbMigrator` project to create the database and seed the initial data. + +## Run the Application + +It is ready. Just run the application and enjoy coding. \ No newline at end of file diff --git a/docs/en/Entity-Framework-Core-Other-DBMS.md b/docs/en/Entity-Framework-Core-Other-DBMS.md new file mode 100644 index 0000000000..854309d070 --- /dev/null +++ b/docs/en/Entity-Framework-Core-Other-DBMS.md @@ -0,0 +1,90 @@ +# Switch to another DBMS for Entity Framework Core + +**[The application startup template](Startup-Templates/Application.md)** comes with SQL Server provider pre-configured for the Entity Framework Core. Entity Framework Core supports [many other DBMSs](https://docs.microsoft.com/en-us/ef/core/providers/) and you can use any of them with your ABP based applications. + +ABP framework provides integration packages for some common DBMSs to make the configuration a bit easier (see the [entity framework core document](Entity-Framework-Core.md) for a list of available integration packages). However, you can configure your DBMS provider without these integration packages. + +While using the integration package is always recommended (it also makes standard for the depended version across different modules), you can do it manually if there is no integration package for your DBMS provider. + +This document explains how to switch to MySQL without using [the MySQL integration package](Entity-Framework-Core-MySQL.md). + +## Replace the SQL Server Dependency + +* Remove the [Volo.Abp.EntityFrameworkCore.SqlServer](https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore.SqlServer) NuGet package dependency from the `.EntityFrameworkCore` project. +* Add the [Pomelo.EntityFrameworkCore.MySql](https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql/) NuGet package dependency to your `.EntityFrameworkCore` project. + +## Remove the Module Dependency + +Remove the `AbpEntityFrameworkCoreSqlServerModule` from the dependency list of your ***YourProjectName*EntityFrameworkCoreModule** class. + +## Change the UseSqlServer() Calls + +Find the following code part inside the *YourProjectName*EntityFrameworkCoreModule class: + +````csharp +Configure(options => +{ + options.UseSqlServer(); +}); +```` + +Replace it with the following code part: + +````csharp +Configure(options => +{ + options.Configure(ctx => + { + if (ctx.ExistingConnection != null) + { + ctx.DbContextOptions.UseMySql(ctx.ExistingConnection); + } + else + { + ctx.DbContextOptions.UseMySql(ctx.ConnectionString); + } + }); +}); +```` + +* `UseMySql` calls in this code is defined by the Pomelo.EntityFrameworkCore.MySql package and you can use its additional options if you need. +* This code first checks if there is an existing (active) connection to the same database in the current request and reuses it if possible. This allows to share a single transaction among different DbContext types. ABP handles the rest of the things. +* It uses `ctx.ConnectionString` and passes to the `UseMySql` if there is no active connection (which will cause to create a new database connection). Using the `ctx.ConnectionString` is important here. Don't pass a static connection string (or a connection string from a configuration). Because ABP [dynamically determines the correct connection string](Connection-Strings.md) in a multi-database or [multi-tenant](Multi-Tenancy.md) environment. + +## Change the Connection Strings + +MySQL connection strings are different than SQL Server connection strings. So, check all `appsettings.json` files in your solution and replace the connection strings inside them. See the [connectionstrings.com]( https://www.connectionstrings.com/mysql/ ) for details of MySQL connection string options. + +You typically will change the `appsettings.json` inside the `.DbMigrator` and `.Web` projects, but it depends on your solution structure. + +## Change the Migrations DbContext + +MySQL DBMS has some slight differences than the SQL Server. Some module database mapping configuration (especially the field lengths) causes problems with MySQL. For example, some of the the [IdentityServer module](Modules/IdentityServer.md) tables has such problems and it provides an option to configure the fields based on your DBMS. + +The startup template contains a *YourProjectName*MigrationsDbContext which is responsible to maintain and migrate the database schema. This DbContext basically calls extension methods of the depended modules to configure their database tables. + +Open the *YourProjectName*MigrationsDbContext and change the `builder.ConfigureIdentityServer();` line as shown below: + +````csharp +builder.ConfigureIdentityServer(options => +{ + options.DatabaseProvider = EfCoreDatabaseProvider.MySql; +}); +```` + +Then `ConfigureIdentityServer()` method will set the field lengths to not exceed the MySQL limits. Refer to related module documentation if you have any problem while creating or executing the database migrations. + +## Re-Generate the Migrations + +The startup template uses [Entity Framework Core's Code First Migrations](https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/). EF Core Migrations depend on the selected DBMS provider. So, changing the DBMS provider will cause the migration fails. + +* Delete the Migrations folder under the `.EntityFrameworkCore.DbMigrations` project and re-build the solution. +* Run `Add-Migration "Initial"` on the Package Manager Console (select the `.DbMigrator` (or `.Web`) project as the startup project in the Solution Explorer and select the `.EntityFrameworkCore.DbMigrations` project as the default project in the Package Manager Console). + +This will create a database migration with all database objects (tables) configured. + +Run the `.DbMigrator` project to create the database and seed the initial data. + +## Run the Application + +It is ready. Just run the application and enjoy coding. \ No newline at end of file diff --git a/docs/en/Entity-Framework-Core-PostgreSQL.md b/docs/en/Entity-Framework-Core-PostgreSQL.md index 2f6dd03be7..328ca4d416 100644 --- a/docs/en/Entity-Framework-Core-PostgreSQL.md +++ b/docs/en/Entity-Framework-Core-PostgreSQL.md @@ -1,73 +1,41 @@ -## Entity Framework Core PostgreSQL Integration +# Switch to EF Core PostgreSQL Provider -> See [Entity Framework Core Integration document](../Entity-Framework-Core.md) for the basics of the EF Core integration. +This document explains how to switch to the **PostgreSQL** database provider for **[the application startup template](Startup-Templates/Application.md)** which comes with SQL Server provider pre-configured. -### EntityFrameworkCore Project Update +## Replace the Volo.Abp.EntityFrameworkCore.SqlServer Package -- In `Acme.BookStore.EntityFrameworkCore` project replace package `Volo.Abp.EntityFrameworkCore.SqlServer` with `Volo.Abp.EntityFrameworkCore.PostgreSql` -- Update to use PostgreSQL in `BookStoreEntityFrameworkCoreModule` - - Replace the `AbpEntityFrameworkCoreSqlServerModule` with the `AbpEntityFrameworkCorePostgreSqlModule` - - Replace the `options.UseSqlServer()` with the `options.UsePostgreSql()` -- In other projects update the PostgreSQL connection string in necessary `appsettings.json` files - - more info of [PostgreSQL connection strings](https://www.connectionstrings.com/postgresql/),You need to pay attention to `Npgsql` in this document +`.EntityFrameworkCore` project in the solution depends on the [Volo.Abp.EntityFrameworkCore.SqlServer](https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore.SqlServer) NuGet package. Remove this package and add the same version of the [Volo.Abp.EntityFrameworkCore.PostgreSql](https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore.PostgreSql) package. -### EntityFrameworkCore.DbMigrations Project Update -- Update to use PostgreSQL in `XXXMigrationsDbContextFactory` - - Replace the `new DbContextOptionsBuilder().UseSqlServer()` with the `new DbContextOptionsBuilder().UseNpgsql()` +## Replace the Module Dependency -### Delete Existing Migrations +Find ***YourProjectName*EntityFrameworkCoreModule** class inside the `.EntityFrameworkCore` project, remove `typeof(AbpEntityFrameworkCoreSqlServerModule)` from the `DependsOn` attribute, add `typeof(AbpEntityFrameworkCorePostgreSqlModule)` (also replace `using Volo.Abp.EntityFrameworkCore.SqlServer;` with `using Volo.Abp.EntityFrameworkCore.PostgreSql;`). -Delete all existing migration files (including `DbContextModelSnapshot`) +## UsePostgreSql() -![postgresql-delete-initial-migrations](images/postgresql-delete-initial-migrations.png) +Find `UseSqlServer()` call in *YourProjectName*EntityFrameworkCoreModule.cs inside the `.EntityFrameworkCore` project and replace with `UsePostgreSql()`. -### Regenerate Initial Migration -Set the correct startup project (usually a web project) +Find `UseSqlServer()` call in *YourProjectName*MigrationsDbContextFactory.cs inside the `.EntityFrameworkCore.DbMigrations` project and replace with `UseNpgsql()`. -![set-as-startup-project](../images/set-as-startup-project.png) +> Depending on your solution structure, you may find more `UseSqlServer()` calls that needs to be changed. -Open the **Package Manager Console** (Tools -> Nuget Package Manager -> Package Manager Console), select the `.EntityFrameworkCore.DbMigrations` as the **Default project** and execute the following command: +## Change the Connection Strings -Run `Add-Migration` command. -```` -PM> Add-Migration Initial -```` +PostgreSql connection strings are different than SQL Server connection strings. So, check all `appsettings.json` files in your solution and replace the connection strings inside them. See the [connectionstrings.com]( https://www.connectionstrings.com/postgresql/ ) for details of PostgreSql connection string options. -### Update the Database +You typically will change the `appsettings.json` inside the `.DbMigrator` and `.Web` projects, but it depends on your solution structure. -You have two options to create the database. +## Re-Generate the Migrations -#### Using the DbMigrator Application +The startup template uses [Entity Framework Core's Code First Migrations](https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/). EF Core Migrations depend on the selected DBMS provider. So, changing the DBMS provider will cause the migration fails. -The solution contains a console application (named `Acme.BookStore.DbMigrator` in this sample) that can create database, apply migrations and seed initial data. It is useful on development as well as on production environment. +* Delete the Migrations folder under the `.EntityFrameworkCore.DbMigrations` project and re-build the solution. +* Run `Add-Migration "Initial"` on the Package Manager Console (select the `.DbMigrator` (or `.Web`) project as the startup project in the Solution Explorer and select the `.EntityFrameworkCore.DbMigrations` project as the default project in the Package Manager Console). -> `.DbMigrator` project has its own `appsettings.json`. So, if you have changed the connection string above, you should also change this one. +This will create a database migration with all database objects (tables) configured. -Right click to the `.DbMigrator` project and select **Set as StartUp Project**: +Run the `.DbMigrator` project to create the database and seed the initial data. -![set-as-startup-project](../images/set-as-startup-project.png) +## Run the Application -Hit F5 (or Ctrl+F5) to run the application. It will have an output like shown below: - -![set-as-startup-project](../images/db-migrator-app.png) - -#### Using EF Core Update-Database Command - -Ef Core has `Update-Database` command which creates database if necessary and applies pending migrations. - -Set the correct startup project (usually a web project) - -![set-as-startup-project](../images/set-as-startup-project.png) - -Open the **Package Manager Console** (Tools -> Nuget Package Manager -> Package Manager Console), select the `.EntityFrameworkCore.DbMigrations` as the **Default project** and execute the following command: - -```` -PM> Update-Database -```` - -This will create a new database based on the configured connection string. - -![postgresql-update-database](images/postgresql-update-database.png) - -> Using the `.DbMigrator` tool is the suggested way, because it also seeds the initial data to be able to properly run the web application. +It is ready. Just run the application and enjoy coding. diff --git a/docs/en/Entity-Framework-Core-SQLite.md b/docs/en/Entity-Framework-Core-SQLite.md new file mode 100644 index 0000000000..62a8ef815d --- /dev/null +++ b/docs/en/Entity-Framework-Core-SQLite.md @@ -0,0 +1,41 @@ +# Switch to EF Core SQLite Provider + +This document explains how to switch to the **SQLite** database provider for **[the application startup template](Startup-Templates/Application.md)** which comes with SQL Server provider pre-configured. + +## Replace the Volo.Abp.EntityFrameworkCore.SqlServer Package + +`.EntityFrameworkCore` project in the solution depends on the [Volo.Abp.EntityFrameworkCore.SqlServer](https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore.SqlServer) NuGet package. Remove this package and add the same version of the [Volo.Abp.EntityFrameworkCore.Sqlite](https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore.Sqlite) package. + +## Replace the Module Dependency + +Find ***YourProjectName*EntityFrameworkCoreModule** class inside the `.EntityFrameworkCore` project, remove `typeof(AbpEntityFrameworkCoreSqlServerModule)` from the `DependsOn` attribute, add `typeof(AbpEntityFrameworkCoreSqliteModule)` (also replace `using Volo.Abp.EntityFrameworkCore.SqlServer;` with `using Volo.Abp.EntityFrameworkCore.Sqlite;`). + +## UseSqlite() + +Find `UseSqlServer()` calls in your solution, replace with `UseSqlite()`. Check the following files: + +* *YourProjectName*EntityFrameworkCoreModule.cs inside the `.EntityFrameworkCore` project. +* *YourProjectName*MigrationsDbContextFactory.cs inside the `.EntityFrameworkCore.DbMigrations` project. + +> Depending on your solution structure, you may find more code files need to be changed. + +## Change the Connection Strings + +SQLite connection strings are different than SQL Server connection strings. So, check all `appsettings.json` files in your solution and replace the connection strings inside them. See the [connectionstrings.com]( https://www.connectionstrings.com/sqlite/ ) for details of SQLite connection string options. + +You typically will change the `appsettings.json` inside the `.DbMigrator` and `.Web` projects, but it depends on your solution structure. + +## Re-Generate the Migrations + +The startup template uses [Entity Framework Core's Code First Migrations](https://docs.microsoft.com/en-us/ef/core/managing-schemas/migrations/). EF Core Migrations depend on the selected DBMS provider. So, changing the DBMS provider will cause the migration fails. + +* Delete the Migrations folder under the `.EntityFrameworkCore.DbMigrations` project and re-build the solution. +* Run `Add-Migration "Initial"` on the Package Manager Console (select the `.DbMigrator` (or `.Web`) project as the startup project in the Solution Explorer and select the `.EntityFrameworkCore.DbMigrations` project as the default project in the Package Manager Console). + +This will create a database migration with all database objects (tables) configured. + +Run the `.DbMigrator` project to create the database and seed the initial data. + +## Run the Application + +It is ready. Just run the application and enjoy coding. \ No newline at end of file diff --git a/docs/en/Entity-Framework-Core.md b/docs/en/Entity-Framework-Core.md index b73e16a3e5..586c8d4a01 100644 --- a/docs/en/Entity-Framework-Core.md +++ b/docs/en/Entity-Framework-Core.md @@ -38,6 +38,8 @@ ABP framework provides integration packages for some common DBMSs to make the co * [MySQL](Entity-Framework-Core-MySQL.md) * [PostgreSQL](Entity-Framework-Core-PostgreSQL.md) +* [SQLite](Entity-Framework-Core-SQLite.md) +* [Others](Entity-Framework-Core-Other-DBMS.md) ## Creating DbContext @@ -191,7 +193,7 @@ public class BookRepository : EfCoreRepository, public async Task DeleteBooksByType(BookType type) { - await DbContext.Database.ExecuteSqlCommandAsync( + await DbContext.Database.ExecuteSqlRawAsync( $"DELETE FROM Books WHERE Type = {(int)type}" ); } diff --git a/docs/en/Features.md b/docs/en/Features.md new file mode 100644 index 0000000000..4b31ca16e9 --- /dev/null +++ b/docs/en/Features.md @@ -0,0 +1,3 @@ +# Features + +TODO \ No newline at end of file diff --git a/docs/en/FluentValidation.md b/docs/en/FluentValidation.md new file mode 100644 index 0000000000..c087f8a185 --- /dev/null +++ b/docs/en/FluentValidation.md @@ -0,0 +1,58 @@ +# FluentValidation Integration + +ABP [Validation](Validation.md) infrastructure is extensible. [Volo.Abp.FluentValidation](https://www.nuget.org/packages/Volo.Abp.FluentValidation) NuGet package extends the validation system to work with the [FluentValidation](https://fluentvalidation.net/) library. + +## Installation + +It is suggested to use the [ABP CLI](CLI.md) to install this package. + +### Using the ABP CLI + +Open a command line window in the folder of the project (.csproj file) and type the following command: + +````bash +abp add-package Volo.Abp.FluentValidation +```` + +### Manual Installation + +If you want to manually install; + +1. Add the [Volo.Abp.FluentValidation](https://www.nuget.org/packages/Volo.Abp.FluentValidation) NuGet package to your project: + + ```` + Install-Package Volo.Abp.FluentValidation + ```` + +2. Add the `AbpFluentValidationModule` to the dependency list of your module: + +````csharp +[DependsOn( + //...other dependencies + typeof(AbpFluentValidationModule) //Add the FluentValidation module + )] +public class YourModule : AbpModule +{ +} +```` + +## Using the FluentValidation + +Follow [the FluentValidation documentation](https://fluentvalidation.net/) to create validator classes. Example: + +````csharp +public class CreateUpdateBookDtoValidator : AbstractValidator +{ + public CreateUpdateBookDtoValidator() + { + RuleFor(x => x.Name).Length(3, 10); + RuleFor(x => x.Price).ExclusiveBetween(0.0f, 999.0f); + } +} +```` + +ABP will automatically find this class and associate with the `CreateUpdateBookDto` on object validation. + +## See Also + +* [Validation System](Validation.md) \ No newline at end of file diff --git a/docs/en/Logging.md b/docs/en/Logging.md new file mode 100644 index 0000000000..7fa45c03b9 --- /dev/null +++ b/docs/en/Logging.md @@ -0,0 +1,6 @@ +# Logging + +ABP Framework doesn't implement any logging infrastructure. It uses the [ASP.NET Core's logging system](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging). + +> .NET Core's logging system is actually independent from the ASP.NET Core. It is usable in any type of application. + diff --git a/docs/en/Modules/Audit-Logging.md b/docs/en/Modules/Audit-Logging.md new file mode 100644 index 0000000000..039c61d3a2 --- /dev/null +++ b/docs/en/Modules/Audit-Logging.md @@ -0,0 +1,7 @@ +# Audit Logging Module + +The Audit Logging Module basically implements the `IAuditingStore` to save the audit log objects to a database. + +> Audit Logging module is already installed and configured for [the startup templates](../Startup-Templates/Index.md). So, most of the times you don't need to manually add this module to your application. + +See [the audit logging system](../Audit-Logging.md) document for more about the audit logging. \ No newline at end of file diff --git a/docs/en/Modules/Blogging.md b/docs/en/Modules/Blogging.md new file mode 100644 index 0000000000..0d2ab35c21 --- /dev/null +++ b/docs/en/Modules/Blogging.md @@ -0,0 +1,3 @@ +# IdentityServer Module + +TODO \ No newline at end of file diff --git a/docs/en/Modules/Docs.md b/docs/en/Modules/Docs.md index 0a74d7ebde..afcc1a9dd7 100644 --- a/docs/en/Modules/Docs.md +++ b/docs/en/Modules/Docs.md @@ -16,7 +16,7 @@ Docs module is an application module and does not offer any hosting solution. Yo When you use GitHub to store your docs, Docs Module supports versioning. If you have multiple versions for your docs, there will be a combo-box on the UI to switch between versions. If you choose file system to store your docs, it does not support multiple versions. -[The documents](https://abp.io/documents/) for ABP framework is also using this module. +[The documents](docs.abp.io) for ABP framework is also using this module. > Docs module follows the [module architecture best practices](../Best-Practices/Module-Architecture.md) guide. @@ -316,7 +316,7 @@ You can use [ABP Framework](https://github.com/abpframework/abp/) GitHub documen - ExtraProperties: ```json - {"GitHubRootUrl":"https://github.com/abpframework/abp/tree/{version}/docs/en/","GitHubAccessToken":"***"} + {"GitHubRootUrl":"https://github.com/abpframework/abp/tree/{version}/docs","GitHubAccessToken":"***"} ``` Note that `GitHubAccessToken` is masked with `***`. It's a private token that you must get it from GitHub. See https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/ @@ -328,7 +328,7 @@ You can use [ABP Framework](https://github.com/abpframework/abp/) GitHub documen For `SQL` databases, you can use the below `T-SQL` command to insert the specified sample into your `DocsProjects` table: ```mssql -INSERT [dbo].[DocsProjects] ([Id], [Name], [ShortName], [Format], [DefaultDocumentName], [NavigationDocumentName], [MinimumVersion], [DocumentStoreType], [ExtraProperties], [MainWebsiteUrl], [LatestVersionBranchName]) VALUES (N'12f21123-e08e-4f15-bedb-ae0b2d939658', N'ABP framework (GitHub)', N'abp', N'md', N'Index', N'docs-nav.json', NULL, N'GitHub', N'{"GitHubRootUrl":"https://github.com/abpframework/abp/tree/{version}/docs/en/","GitHubAccessToken":"***"}', N'/', N'master') +INSERT [dbo].[DocsProjects] ([Id], [Name], [ShortName], [Format], [DefaultDocumentName], [NavigationDocumentName], [MinimumVersion], [DocumentStoreType], [ExtraProperties], [MainWebsiteUrl], [LatestVersionBranchName], [ParametersDocumentName]) VALUES (N'12f21123-e08e-4f15-bedb-ae0b2d939658', N'ABP framework (GitHub)', N'abp', N'md', N'Index', N'docs-nav.json', NULL, N'GitHub', N'{"GitHubRootUrl":"https://github.com/abpframework/abp/tree/{version}/docs","GitHubAccessToken":"***"}', N'/', N'master', N'') ``` Be aware that `GitHubAccessToken` is masked. It's a private token and you must get your own token and replace the `***` string. @@ -354,10 +354,10 @@ You can use [ABP Framework](https://github.com/abpframework/abp/) GitHub documen - ExtraProperties: ```json - {"Path":"C:\\Github\\abp\\docs\\en"} + {"Path":"C:\\Github\\abp\\docs"} ``` - Note that `Path` must be replaced with your local docs directory. You can fetch the ABP Framework's documents from https://github.com/abpframework/abp/tree/master/docs/en and copy to the directory `C:\\Github\\abp\\docs\\en` to get it work. + Note that `Path` must be replaced with your local docs directory. You can fetch the ABP Framework's documents from https://github.com/abpframework/abp/tree/master/docs and copy to the directory `C:\\Github\\abp\\docs` to get it work. - MainWebsiteUrl: `/` @@ -366,11 +366,9 @@ You can use [ABP Framework](https://github.com/abpframework/abp/) GitHub documen For `SQL` databases, you can use the below `T-SQL` command to insert the specified sample into your `DocsProjects` table: ```mssql -INSERT [dbo].[DocsProjects] ([Id], [Name], [ShortName], [Format], [DefaultDocumentName], [NavigationDocumentName], [MinimumVersion], [DocumentStoreType], [ExtraProperties], [MainWebsiteUrl], [LatestVersionBranchName]) VALUES (N'12f21123-e08e-4f15-bedb-ae0b2d939659', N'ABP framework (FileSystem)', N'abp', N'md', N'Index', N'docs-nav.json', NULL, N'FileSystem', N'{"Path":"C:\\Github\\abp\\docs\\en"}', N'/', NULL) +INSERT [dbo].[DocsProjects] ([Id], [Name], [ShortName], [Format], [DefaultDocumentName], [NavigationDocumentName], [MinimumVersion], [DocumentStoreType], [ExtraProperties], [MainWebsiteUrl], [LatestVersionBranchName], [ParametersDocumentName]) VALUES (N'12f21123-e08e-4f15-bedb-ae0b2d939659', N'ABP framework (FileSystem)', N'abp', N'md', N'Index', N'docs-nav.json', NULL, N'FileSystem', N'{"Path":"C:\\Github\\abp\\docs"}', N'/', NULL, N'') ``` - - Add one of the sample projects above and run the application. In the menu you will see `Documents` link, click the menu link to open the documents page. So far, we have created a new application from abp.io website and made it up and ready for Docs module. @@ -449,7 +447,7 @@ For example, [en/docs-params.json](https://github.com/abpio/abp-commercial-docs/ Since not every single document in your projects may not have sections or may not need all of those parameters, you have to declare which of those parameters will be used for sectioning the document, as a JSON block anywhere on the document. -For example [Getting-Started.md](https://github.com/abpio/abp-commercial-docs/blob/master/en/Getting-Started.md): +For example [Getting-Started.md](https://github.com/abpio/abp-commercial-docs/blob/master/en/getting-started.md): ``` ..... @@ -468,7 +466,7 @@ For example [Getting-Started.md](https://github.com/abpio/abp-commercial-docs/bl This section will be automatically deleted during render. And f course, those key values must match with the ones in **Parameter document**. -![Interface](..\images\docs-section-ui.png) +![Interface](../images/docs-section-ui.png) Now you can use **Scriban** syntax to create sections in your document. @@ -501,6 +499,10 @@ You can also use variables in a text, adding **_Value** postfix to its key: This document assumes that you prefer to use **{{ UI_Value }}** as the UI framework and **{{ DB_Value }}** as the database provider. ```` +Also, **Document_Language_Code** and **Document_Version** keys are pre-defined if you want to get the language code or the version of the current document (This may be useful for creating links that redirects to another documentation system in another domain). + +------ + **IMPORTANT NOTICE**: Scriban uses "{{" and "}}" for syntax. Therefore, you must use escape blocks if you are going to use those in your document (an Angular document, for example). See [Scriban docs]( ) for more information. ### 8- Creating the Navigation Document diff --git a/docs/en/Modules/Feature-Management.md b/docs/en/Modules/Feature-Management.md new file mode 100644 index 0000000000..5c41277dd8 --- /dev/null +++ b/docs/en/Modules/Feature-Management.md @@ -0,0 +1,3 @@ +# Feature Management Module + +TODO \ No newline at end of file diff --git a/docs/en/Modules/IdentityServer.md b/docs/en/Modules/IdentityServer.md new file mode 100644 index 0000000000..0d2ab35c21 --- /dev/null +++ b/docs/en/Modules/IdentityServer.md @@ -0,0 +1,3 @@ +# IdentityServer Module + +TODO \ No newline at end of file diff --git a/docs/en/Modules/Index.md b/docs/en/Modules/Index.md index 9d1c1d301f..2ffb509667 100644 --- a/docs/en/Modules/Index.md +++ b/docs/en/Modules/Index.md @@ -11,16 +11,21 @@ There are **two types of modules.** They don't have any structural difference bu There are some **free and open source** application modules developed and maintained by the ABP community: -* **Account**: Used to make user login/register to the application. -* **Audit Logging**: Used to persist audit logs to a database. -* **Background Jobs**: Used to persist background jobs when using default background job manager. -* **Blogging**: Used to create fancy blogs. ABP's [own blog](https://abp.io/blog/abp/) already using this module. +* **Account**: Provides UI for the account management and allows user to login/register to the application. +* [**Audit Logging**](Audit-Logging.md): Persists audit logs to a database. +* **Background Jobs**: Persist background jobs when using the default background job manager. +* **Blogging**: Used to create fancy blogs. ABP's [own blog](https://blog.abp.io/) already using this module. * [**Docs**](Docs.md): Used to create technical documentation pages. ABP's [own documentation](https://docs.abp.io) already using this module. -* **Identity**: Used to manage roles, users and their permissions. -* **Identity Server**: Integrates to IdentityServer4. +* **Feature Management**: Used to persist and manage the [features](../Features.md). +* **Identity**: Manages roles, users and their permissions, based on the Microsoft Identity library. +* **IdentityServer**: Integrates to IdentityServer4. * **Permission Management**: Used to persist permissions. * **[Setting Management](Setting-Management.md)**: Used to persist and manage the [settings](../Settings.md). -* **Tenant Management**: Used to manage tenants for a [multi-tenant](../Multi-Tenancy.md) application. -* **Users**: Used to abstract users, so other modules can depend on this instead of the Identity module. +* **Tenant Management**: Manages tenants for a [multi-tenant](../Multi-Tenancy.md) application. +* **Users**: Abstract users, so other modules can depend on this module instead of the Identity module. -Documenting the modules is in the progress. See [this repository](https://github.com/abpframework/abp/tree/master/modules) for source code of all modules. +See [the GitHub repository](https://github.com/abpframework/abp/tree/master/modules) for source code of all modules. + +## Commercial Application Modules + +[ABP Commercial](https://commercial.abp.io/) license provides additional pre-built application modules on top of the ABP framework. See the [module list](https://commercial.abp.io/modules) provided by the ABP Commercial. \ No newline at end of file diff --git a/docs/en/Modules/Setting-Management.md b/docs/en/Modules/Setting-Management.md index 39e8f8a0df..134e24aed2 100644 --- a/docs/en/Modules/Setting-Management.md +++ b/docs/en/Modules/Setting-Management.md @@ -67,6 +67,8 @@ namespace Demo So, you can get or set a setting value for different setting value providers (Default, Global, User, Tenant... etc). +> Use the `ISettingProvider` instead of the `ISettingManager` if you only need to read the setting values, because it implements caching and supports all deployment scenarios. You can use the `ISettingManager` if you are creating a setting management UI. + ### Setting Cache Setting values are cached using the [distributed cache](../Caching.md) system. Always use the `ISettingManager` to change the setting values which manages the cache for you. @@ -76,7 +78,7 @@ Setting values are cached using the [distributed cache](../Caching.md) system. A Setting Management module is extensible, just like the [setting system](../Settings.md). You can extend it by defining setting management providers. There are 5 pre-built setting management providers registered by the order below: * `DefaultValueSettingManagementProvider`: Gets the value from the default value of the setting definition. It can not set the default value since default values are hard-coded on the setting definition. -* `ConfigurationSettingManagementProvider`: Gets the value from the [IConfiguration service](Configuration.md). It can not set the configuration value because it is not possible to change the configuration values on runtime. +* `ConfigurationSettingManagementProvider`: Gets the value from the [IConfiguration service](../Configuration.md). It can not set the configuration value because it is not possible to change the configuration values on runtime. * `GlobalSettingManagementProvider`: Gets or sets the global (system-wide) value for a setting. * `TenantSettingManagementProvider`: Gets or sets the setting value for a tenant. * `UserSettingManagementProvider`: Gets the setting value for a user. diff --git a/docs/en/Multi-Tenancy.md b/docs/en/Multi-Tenancy.md index 00f51d430d..26b28b0ad7 100644 --- a/docs/en/Multi-Tenancy.md +++ b/docs/en/Multi-Tenancy.md @@ -98,7 +98,7 @@ The first thing for a multi-tenant application is to determine the current tenan ##### Custom Tenant Resolvers -You can add your custom tenant resolver to **TenantResolveOptions** in your module's ConfigureServices method as like below: +You can add your custom tenant resolver to **AbpTenantResolveOptions** in your module's ConfigureServices method as like below: ````C# using Microsoft.Extensions.DependencyInjection; @@ -112,7 +112,7 @@ namespace MyCompany.MyProject { public override void ConfigureServices(ServiceConfigurationContext context) { - Configure(options => + Configure(options => { options.TenantResolvers.Add(new MyCustomTenantResolveContributor()); }); @@ -323,7 +323,7 @@ services.Configure(options => ##### Domain Tenant Resolver -In a real application, most of times you will want to determine current tenant either by subdomain (like mytenant1.mydomain.com) or by the whole domain (like mytenant.com). If so, you can configure TenantResolveOptions to add a domain tenant resolver. +In a real application, most of times you will want to determine current tenant either by subdomain (like mytenant1.mydomain.com) or by the whole domain (like mytenant.com). If so, you can configure AbpTenantResolveOptions to add a domain tenant resolver. ###### Example: Add a subdomain resolver @@ -340,7 +340,7 @@ namespace MyCompany.MyProject { public override void ConfigureServices(ServiceConfigurationContext context) { - Configure(options => + Configure(options => { //Subdomain format: {0}.mydomain.com (adding as the highest priority resolver) options.TenantResolvers.Insert(0, new DomainTenantResolver("{0}.mydomain.com")); diff --git a/docs/en/Options.md b/docs/en/Options.md index cead1aea61..20168bdbe3 100644 --- a/docs/en/Options.md +++ b/docs/en/Options.md @@ -1,4 +1,118 @@ # Options -TODO! +Microsoft has introduced [the options pattern](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options) that is used to configure a group of settings used by the framework services. This pattern is implemented by the [Microsoft.Extensions.Options](https://www.nuget.org/packages/Microsoft.Extensions.Options) NuGet package, so it is usable by any type of applications in addition to ASP.NET Core based applications. + +ABP framework follows this option pattern and defines options classes to configure the framework and the modules (they are explained in the documents of the related feature). + +Since [the Microsoft documentation](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options) explains the pattern in detail, no reason to repeat all. However, ABP adds a few more features and they will be explained here. + +## Configure Options + +You typically configure options in the `ConfigureServices` of the `Startup` class. However, since ABP framework provides a modular infrastructure, you configure options in the `ConfigureServices` of your [module](Module-Development-Basics.md). Example: + +````csharp +public override void ConfigureServices(ServiceConfigurationContext context) +{ + context.Services.Configure(options => + { + options.IsEnabled = false; + }); +} +```` + +* `AbpAuditingOptions` is a simple class defines some properties like `IsEnabled` used here. +* `AbpModule` base class defines `Configure` method to make the code simpler. So, instead of `context.Services.Configure<...>`, you can directly use the `Configure<...>` shortcut method. + +If you are developing a reusable module, you may need to define an options class to allow developers to configure your module. In this case, define a plain options class as shown below: + +````csharp +public class MyOptions +{ + public int Value1 { get; set; } + public bool Value2 { get; set; } +} +```` + +Then developers can configure your options just like the `AbpAuditingOptions` example above: + +````csharp +public override void ConfigureServices(ServiceConfigurationContext context) +{ + Configure(options => + { + options.Value1 = 42; + options.Value2 = true; + }); +} +```` + +* In this example, used the shortcut `Configure<...>` method. + +### Get the Option Value + +Whenever you need to get the value of an option, [inject](Dependency-Injection.md) the `IOptions` service into your class and use its `.Value` property. Example: + +````csharp +public class MyService : ITransientDependency +{ + private readonly MyOptions _options; + + public MyService(IOptions options) + { + _options = options.Value; //Notice the options.Value usage! + } + + public void DoIt() + { + var v1 = _options.Value1; + var v2 = _options.Value2; + } +} +```` + +Read [the Microsoft documentation](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options) for all details of the options pattern. + +## Pre Configure + +One restriction of the options pattern is that you can only resolve (inject) the `IOptions` and get the option values when the dependency injection configuration completes (that means the `ConfigureServices` methods of all modules complete). + +If you are developing a module, you may need to allow developers to set some options and use these options in the dependency injection registration phase. You may need to configure other services or change the dependency injection registration code based on these option values. + +For such cases, ABP introduces the `PreConfigure` and the `ExecutePreConfiguredActions` extension methods for the `IServiceCollection`. The pattern works as explained below. + +1. Define a plan option class in your module. Example: + +````csharp +public class MyPreOptions +{ + public bool MyValue { get; set; } +} +```` + +Then any [module class](Module-Development-Basics.md) depends on your module can use the `PreConfigure` method in its `PreConfigureServices` method. Example: + +````csharp +public override void PreConfigureServices(ServiceConfigurationContext context) +{ + PreConfigure(options => + { + options.MyValue = true; + }); +} +```` + +> Multiple modules can pre-configure the options and override the option values based on their dependency order. + +Finally, your module can execute the `ExecutePreConfiguredActions` method in its `ConfigureServices` method to get the configured option values. Example: + +````csharp +public override void ConfigureServices(ServiceConfigurationContext context) +{ + var options = context.Services.ExecutePreConfiguredActions(); + if (options.MyValue) + { + //... + } +} +```` diff --git a/docs/en/Repositories.md b/docs/en/Repositories.md index e6b55cb3de..6a60c58278 100644 --- a/docs/en/Repositories.md +++ b/docs/en/Repositories.md @@ -52,7 +52,6 @@ Generic Repositories provides some standard CRUD features out of the box: * Provides `Update` and `Delete` methods to update or delete an entity by entity object or it's id. * Provides `Delete` method to delete multiple entities by a filter. * Implements `IQueryable`, so you can use LINQ and extension methods like `FirstOrDefault`, `Where`, `OrderBy`, `ToList` and so on... -* Have **sync** and **async** versions for all methods. ### Basic Repositories diff --git a/docs/en/Tutorials/Angular/Part-I.md b/docs/en/Tutorials/Angular/Part-I.md index 46368eeecb..6d5f91bce7 100644 --- a/docs/en/Tutorials/Angular/Part-I.md +++ b/docs/en/Tutorials/Angular/Part-I.md @@ -343,7 +343,7 @@ Run `yarn start`, wait Angular to run the application and open `http://localhost Open the `app-routing.module.ts` and replace `books` as shown below: ```js -import { ApplicationLayoutComponent } from '@abp/ng.theme.basic';- +import { ApplicationLayoutComponent } from '@abp/ng.theme.basic'; //... { diff --git a/docs/en/Tutorials/AspNetCore-Mvc/Part-I.md b/docs/en/Tutorials/AspNetCore-Mvc/Part-I.md index d113442af9..a1fbd1de54 100644 --- a/docs/en/Tutorials/AspNetCore-Mvc/Part-I.md +++ b/docs/en/Tutorials/AspNetCore-Mvc/Part-I.md @@ -50,6 +50,20 @@ namespace Acme.BookStore public DateTime PublishDate { get; set; } public float Price { get; set; } + + protected Book() + { + + } + + public Book(Guid id, string name, BookType type, DateTime publishDate, float price) + :base(id) + { + Name = name; + Type = type; + PublishDate = publishDate; + Price = price; + } } } ```` @@ -345,7 +359,7 @@ Open the `Index.cshtml` and change the content as shown below: ```` * This code changes the default inheritance of the Razor View Page Model so it **inherits** from the `BookStorePage` class (instead of `PageModel`). The `BookStorePage` class which comes with the startup template and provides some shared properties/methods used by all pages. -* Ensure that the `IndexModel` (*Index.cshtml.cs)* has the `Acme.BookStore.Pages.Books` namespace, or update it in the `Index.cshtml`. +* Ensure that the `IndexModel` (*Index.cshtml.cs)* has the `Acme.BookStore.Web.Pages.Books` namespace, or update it in the `Index.cshtml`. #### Add Books Page to the Main Menu @@ -422,7 +436,7 @@ Change the `Pages/Books/Index.cshtml` as following: ```` * `abp-script` [tag helper](https://docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/intro) is used to add external **scripts** to the page. It has many additional features compared to standard `script` tag. It handles **minification** and **versioning** for example. See the [bundling & minification document](../../AspNetCore/Bundling-Minification.md) for details. -* `abp-card` and `abp-table` are **tag helpers** for Twitter Bootstrap's [card component](http://getbootstrap.com/docs/4.1/components/card/). There are many tag helpers in ABP to easily use most of the [bootstrap](https://getbootstrap.com/) components. You can also use regular HTML tags instead of these tag helpers, but using tag helpers reduces HTML code and prevents errors by help of the intellisense and compile time type checking. See the [tag helpers document](../../AspNetCore/Tag-Helpers.md). +* `abp-card` and `abp-table` are **tag helpers** for Twitter Bootstrap's [card component](http://getbootstrap.com/docs/4.1/components/card/). There are many tag helpers in ABP to easily use most of the [bootstrap](https://getbootstrap.com/) components. You can also use regular HTML tags instead of these tag helpers, but using tag helpers reduces HTML code and prevents errors by help of the intellisense and compile time type checking. See the [tag helpers document](../../AspNetCore/Tag-Helpers/Index.md). * You can **localize** the column names in the localization file as you did for the menu items above. ##### Add a Script File diff --git a/docs/en/Tutorials/AspNetCore-Mvc/Part-II.md b/docs/en/Tutorials/AspNetCore-Mvc/Part-II.md index 1e3ec1f539..505de55adc 100644 --- a/docs/en/Tutorials/AspNetCore-Mvc/Part-II.md +++ b/docs/en/Tutorials/AspNetCore-Mvc/Part-II.md @@ -421,7 +421,8 @@ $(function () { Open the `en.json` in the `Acme.BookStore.Domain.Shared` project and add the following line: ````json -"BookDeletionConfirmationMessage": "Are you sure to delete the book {0}?" +"BookDeletionConfirmationMessage": "Are you sure to delete the book {0}?", +"SuccessfullyDeleted": "Successfully deleted" ```` Run the application and try to delete a book. diff --git a/docs/en/Tutorials/AspNetCore-Mvc/Part-III.md b/docs/en/Tutorials/AspNetCore-Mvc/Part-III.md index b115eb27ea..f207d9df0c 100644 --- a/docs/en/Tutorials/AspNetCore-Mvc/Part-III.md +++ b/docs/en/Tutorials/AspNetCore-Mvc/Part-III.md @@ -57,25 +57,11 @@ namespace Acme.BookStore public async Task SeedAsync(DataSeedContext context) { await _bookRepository.InsertAsync( - new Book - { - Id = _guidGenerator.Create(), - Name = "Test book 1", - Type = BookType.Fantastic, - PublishDate = new DateTime(2015, 05, 24), - Price = 21 - } + new Book(_guidGenerator.Create(), "Test book 1", BookType.Fantastic, new DateTime(2015, 05, 24), 21) ); await _bookRepository.InsertAsync( - new Book - { - Id = _guidGenerator.Create(), - Name = "Test book 2", - Type = BookType.Science, - PublishDate = new DateTime(2014, 02, 11), - Price = 15 - } + new Book(_guidGenerator.Create(), "Test book 2", BookType.Science, new DateTime(2014, 02, 11), 15) ); } } diff --git a/docs/en/Validation.md b/docs/en/Validation.md index a4b829c97d..15c3f13412 100644 --- a/docs/en/Validation.md +++ b/docs/en/Validation.md @@ -1,3 +1,158 @@ -## Validation +# Validation -TODO \ No newline at end of file +Validation system is used to validate the user input or client request for a particular controller action or service method. + +ABP is compatible with the ASP.NET Core Model Validation system and everything written in [its documentation](https://docs.microsoft.com/en-us/aspnet/core/mvc/models/validation) is already valid for ABP based applications. So, this document mostly focuses on the ABP features rather than repeating the Microsoft documentation. + +In addition, ABP adds the following benefits: + +* Defines `IValidationEnabled` to add automatic validation to an arbitrary class. Since all the [application services](Application-Services.md) inherently implements it, they are also validated automatically. +* Automatically localize the validation errors for the data annotation attributes. +* Provides extensible services to validate a method call or an object state. +* Provides [FluentValidation](https://fluentvalidation.net/) integration. + +## Validating DTOs + +This section briefly introduces the validation system. For details, see the [ASP.NET Core validation documentation](https://docs.microsoft.com/en-us/aspnet/core/mvc/models/validation). + +### Data Annotation Attributes + +Using data annotations is a simple way to implement the formal validation for a [DTO](Data-Transfer-Objects.md) in a declarative way. Example: + +````csharp +public class CreateBookDto +{ + [Required] + [StringLength(100)] + public string Name { get; set; } + + [Required] + [StringLength(1000)] + public string Description { get; set; } + + [Range(0, 999.99)] + public decimal Price { get; set; } +} +```` + +When you use this class as a parameter to an [application service](Application-Services.md) or a controller, it is automatically validated and a localized validation exception is thrown ([and handled](Exception-Handling.md) by the ABP framework). + +### IValidatableObject + +`IValidatableObject` can be implemented by a DTO to perform custom validation logic. `CreateBookDto` in the following example implements this interface and checks if the `Name` is equals to the `Description` and returns a validation error in this case. + +````csharp +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace Acme.BookStore +{ + public class CreateBookDto : IValidatableObject + { + [Required] + [StringLength(100)] + public string Name { get; set; } + + [Required] + [StringLength(1000)] + public string Description { get; set; } + + [Range(0, 999.99)] + public decimal Price { get; set; } + + public IEnumerable Validate( + ValidationContext validationContext) + { + if (Name == Description) + { + yield return new ValidationResult( + "Name and Description can not be the same!", + new[] { "Name", "Description" } + ); + } + } + } +} +```` + +#### Resolving a Service + +If you need to resolve a service from the [dependency injection system](Dependency-Injection.md), you can use the `ValidationContext` object. Example: + +````csharp +var myService = validationContext.GetRequiredService(); +```` + +> While resolving services in the `Validate` method allows any possibility, it is not a good practice to implement your domain validation logic in DTOs. Keep DTOs simple. Their purpose is to transfer data (DTO: Data Transfer Object). + +## Validation Infrastructure + +This section explains a few additional services provided by the ABP framework. + +### IValidationEnabled Interface + +`IValidationEnabled` is an empty marker interface that can be implemented by any class (registered to and resolved from the [DI](Dependency-Injection.md)) to let the ABP framework perform the validation system for the methods of the class. Example: + +````csharp +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Validation; + +namespace Acme.BookStore +{ + public class MyService : ITransientDependency, IValidationEnabled + { + public virtual async Task DoItAsync(MyInput input) + { + //... + } + } +} +```` + +> ABP framework uses the [dynamic proxying / interception](Dynamic-Proxying-Interceptors.md) system to perform the validation. In order to make it working, your method should be **virtual** or your service should be injected and used over an **interface** (like `IMyService`). + +### AbpValidationException + +Once ABP determines a validation error, it throws an exception of type `AbpValidationException`. Your application code can throw `AbpValidationException`, but most of the times it is not needed. + +* `ValidationErrors` property of the `AbpValidationException` contains the validation error list. +* Log level of the `AbpValidationException` is set to `Warning`. It logs all the validation errors to the [logging system](Logging.md). +* `AbpValidationException` is automatically caught by the ABP framework and converted to a usable error into with HTTP 400 status code. See the [exception handling](Exception-Handling.md) document for more. + +## Advanced Topics + +### IObjectValidator + +In addition to the automatic validation, you may want to manually validate an object. In this case, [inject](Dependency-Injection.md) and use the `IObjectValidator` service: + +* `Validate` method validates the given object based on the validation rules and throws an `AbpValidationException` if it is not in a valid state. +* `GetErrors` doesn't throw an exception, but only returns the validation errors. + +`IObjectValidator` is implemented by the `ObjectValidator` by default. `ObjectValidator` is extensible; you can implement `IObjectValidationContributor` interface to contribute a custom logic. Example: + +````csharp +public class MyObjectValidationContributor + : IObjectValidationContributor, ITransientDependency +{ + public void AddErrors(ObjectValidationContext context) + { + //Get the validating object + var obj = context.ValidatingObject; + + //Add the validation errors if available + context.Errors.Add(...); + } +} +```` + +* Remember to register your class to the [DI](Dependency-Injection.md) (implementing `ITransientDependency` does it just like in this example) +* ABP will automatically discover your class and use on any type of object validation (including automatic method call validation). + +### IMethodInvocationValidator + +`IMethodInvocationValidator` is used to validate a method call. It internally uses the `IObjectValidator` to validate objects passes to the method call. You normally don't need to this service since it is automatically used by the framework, but you may want to reuse or replace it on your application in rare cases. + +## FluentValidation Integration + +Volo.Abp.FluentValidation package integrates the FluentValidation library to the validation system (by implementing the `IObjectValidationContributor`). See the [FluentValidation Integration document](FluentValidation.md) for more. \ No newline at end of file diff --git a/docs/en/Virtual-File-System.md b/docs/en/Virtual-File-System.md index d13bbf491b..f2f85049bd 100644 --- a/docs/en/Virtual-File-System.md +++ b/docs/en/Virtual-File-System.md @@ -38,7 +38,8 @@ If you want to add multiple files, this can be tedious. Alternatively, you can d ````C# - + + ```` diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json index c4a864f4de..cbb4c80e72 100644 --- a/docs/en/docs-nav.json +++ b/docs/en/docs-nav.json @@ -49,6 +49,10 @@ } ] }, + { + "text": "ASP.NET Boilerplate Migration Guide", + "path": "AspNet-Boilerplate-Migration-Guide.md" + }, { "text": "CLI", "path": "CLI.md" @@ -60,6 +64,10 @@ "text": "Configuration", "path": "Configuration.md" }, + { + "text": "Options", + "path": "Options.md" + }, { "text": "Dependency Injection", "path": "Dependency-Injection.md", @@ -83,7 +91,14 @@ "path": "Exception-Handling.md" }, { - "text": "Validation" + "text": "Validation", + "path": "Validation.md", + "items": [ + { + "text": "FluentValidation Integration", + "path": "FluentValidation.md" + } + ] }, { "text": "Authorization", @@ -94,11 +109,20 @@ "path": "Caching.md" }, { - "text": "Auditing" + "text": "Logging", + "path": "Logging.md" + }, + { + "text": "Audit Logging", + "path": "Audit-Logging.md" }, { "text": "Settings", "path": "Settings.md" + }, + { + "text": "Data Filtering", + "path": "Data-Filtering.md" } ] }, @@ -257,25 +281,46 @@ }, { "text": "Data Access", - "path": "Data-Access.md", + "path": "Data-Access.md", "items": [ { - "text": "Entity Framework Core Integration", - "path": "Entity-Framework-Core.md", - "items": [ + "text": "Connection Strings", + "path": "Connection-Strings.md" + }, + { + "text": "Database Providers", + "items": [ + { + "text": "Entity Framework Core", + "path": "Entity-Framework-Core.md", + "items": [ + { + "text": "Switch to MySQL", + "path": "Entity-Framework-Core-MySQL.md" + }, + { + "text": "Switch to PostgreSQL", + "path": "Entity-Framework-Core-PostgreSQL.md" + }, + { + "text": "Switch to SQLite", + "path": "Entity-Framework-Core-SQLite.md" + }, + { + "text": "Switch to another DBMS", + "path": "Entity-Framework-Core-Other-DBMS.md" + } + ] + }, { - "text": "PostgreSQL Integration", - "path": "Entity-Framework-Core-PostgreSQL.md" + "text": "MongoDB", + "path": "MongoDB.md" + }, + { + "text": "Dapper", + "path": "Dapper.md" } ] - }, - { - "text": "MongoDB Integration", - "path": "MongoDB.md" - }, - { - "text": "Dapper Integration", - "path": "Dapper.md" } ] }, diff --git a/docs/en/images/auditlog-object-diagram.png b/docs/en/images/auditlog-object-diagram.png new file mode 100644 index 0000000000..a7e86a2bb2 Binary files /dev/null and b/docs/en/images/auditlog-object-diagram.png differ diff --git a/docs/pt-BR/Tutorials/AspNetCore-Mvc/Part-II.md b/docs/pt-BR/Tutorials/AspNetCore-Mvc/Part-II.md index 7e6471d3ed..ef2c28f1f1 100644 --- a/docs/pt-BR/Tutorials/AspNetCore-Mvc/Part-II.md +++ b/docs/pt-BR/Tutorials/AspNetCore-Mvc/Part-II.md @@ -454,7 +454,8 @@ $(function () { Abra o `en.json`no `Acme.BookStore.Domain.Shared`projeto e adicione a seguinte linha: ```json -"BookDeletionConfirmationMessage": "Are you sure to delete the book {0}?" +"BookDeletionConfirmationMessage": "Are you sure to delete the book {0}?", +"SuccessfullyDeleted": "Successfully deleted" ``` diff --git a/docs/zh-Hans/Ambient-Context-Pattern.md b/docs/zh-Hans/Ambient-Context-Pattern.md new file mode 100644 index 0000000000..d00a721ce2 --- /dev/null +++ b/docs/zh-Hans/Ambient-Context-Pattern.md @@ -0,0 +1,3 @@ +## Ambient Context Pattern + +TODO \ No newline at end of file diff --git a/docs/zh-Hans/Audit-Logging.md b/docs/zh-Hans/Audit-Logging.md new file mode 100644 index 0000000000..a028e640b2 --- /dev/null +++ b/docs/zh-Hans/Audit-Logging.md @@ -0,0 +1,375 @@ +# 审计日志 + +[维基百科](https://en.wikipedia.org/wiki/Audit_trail): "*审计跟踪(也称为**审计日志**)是一种安全相关的按时间顺序记录,记录集或记录目的和来源. 这种记录提供了在任何特定时间的操作,过程或事件产生影响活动顺序的文件证据* ". + +ABP框架提供一个可扩展的**审计日志系统**,自动化的根据**约定**记录审计日志,并提供**配置**控制审计日志的级别. + +一个**审计日志对象**(参见下面的审计日志对象部分)通常是针对每个web请求创建和保存的.包括; + +* **请求和响应的细节** (如URL,HTTP方法,浏览器信息,HTTP状态代码...等). +* **执行的动作** (控制器操作和应用服务方法调用及其参数). +* **实体的变化** (在Web请求中). +* **异常信息** (如果在执行请求发生操作). +* **请求时长** (测量应用程序的性能). + +> [启动模板](Startup-Templates/Index.md)已经将审计日志系统配置为适用于大多数应用程序. 本文档介绍了对审计日志系统更精细的控制. + +## 数据库提供程序支持 + +* [Entity Framework Core](Entity-Framework-Core.md)提供程序完全支持. +* [MongoDB](MongoDB.md)提供程序不支持实体更改审计记录. 其他功能按预期工作. + +## UseAuditing() + +`UseAuditing()` 中间件应该被添加到ASP.NET Core请求管道,用于创建和保存审计日志. 如果你使用[启动模板](Startup-Templates/Index.md)创建的应用程序,它已经默认添加. + +## AbpAuditingOptions + +`AbpAuditingOptions` 是配置审计日志系统的主要[options对象](Options.md). 你可以在[模块](Module-Development-Basics.md)的 `ConfigureServices` 方法中进行配置: + +````csharp +Configure(options => +{ + options.IsEnabled = false; //Disables the auditing system +}); +```` + +这里是你可以配置的选项列表: + +* `IsEnabled` (默认值: `true`): 启用或禁用审计系统的总开关. 如果值为 `false`,则不使用其他选项. +* `HideErrors` (默认值: `true`): 在保存审计日志对象时如果发生任何错误,审计日志系统会将错误隐藏并写入常规[日志](Logging.md). 如果保存审计日志对系统非常重要那么将其设置为 `false` 以便在隐藏错误时抛出异常. +* `IsEnabledForAnonymousUsers` (默认值: `true`): 如果只想为经过身份验证的用户记录审计日志,请设置为 `false`.如果为匿名用户保存审计日志,你将看到这些用户的 `UserId` 值为 `null`. +* `AlwaysLogOnException`(默认值: `true`): 如果设置为 `true`,将始终在异常/错误情况下保存审计日志,不检查其他选项(`IsEnabled` 除外,它完全禁用了审计日志). +* `IsEnabledForGetRequests` (默认值: `false`): HTTP GET请求通常不应该在数据库进行任何更改,审计日志系统不会为GET请求保存审计日志对象. 将此值设置为 `true` 可为GET请求启用审计日志系统. +* `ApplicationName`: 如果有多个应用程序保存审计日志到单一的数据库,使用此属性设置为你的应用程序名称区分不同的应用程序日志. +* `IgnoredTypes`: 审计日志系统忽略的 `Type` 列表. 如果它是实体类型,则不会保存此类型实体的更改. 在序列化操作参数时也使用此列表. +* `EntityHistorySelectors`:选择器列表,用于确定是否选择了用于保存实体更改的实体类型. 有关详细信息请参阅下面的部分. +* `Contributors`: `AuditLogContributor` 实现的列表. 贡献者是扩展审计日志系统的一种方式. 有关详细信息请参阅下面的"审计日志贡献者"部分. + +### 实体历史选择器 + +保存您的所有实体的所有变化将需要大量的数据库空间. 出于这个原因**审计日志系统不保存为实体的任何改变,除非你明确地对其进行配置**. + +要保存的所有实体的所有更改,只需使用 `AddAllEntities()` 扩展方法. + +````csharp +Configure(options => +{ + options.EntityHistorySelectors.AddAllEntities(); +}); +```` + +`options.EntityHistorySelectors` 实际上是一个类型谓词的列表,你可以写一个lambda表达式定义过滤器. + +下面的示例中与使用 `AddAllEntities()` 扩展方法效果相同: + +````csharp +Configure(options => +{ + options.EntityHistorySelectors.Add( + new NamedTypeSelector( + "MySelectorName", + type => + { + if (typeof(IEntity).IsAssignableFrom(type)) + { + return true; + } + else + { + return false; + } + } + ) + ); +}); +```` + +条件 `typeof(IEntity).IsAssignableFrom(type)` 对于任何实现 `IEntity` 接口的类(从技术上来这些都是你应用程序中的实体) 结果都为 `true` . 你可以根据自己的逻辑编写条件并返回 `true` 或 `false`. + +`options.EntityHistorySelectors` 是一种灵活动态的选择实体进行审计日志记录的方法. 另一种方法是为每个实体使用 `Audited` 和 `DisableAuditing` attribute. + +## 启用/禁用审计日志服务 + +### 启用/禁用 Controllers & Actions + +默认所有的控制器动作都会被记录下来(有关GET请求,请参阅上面的 `IsEnabledForGetRequests` ). + +你可以使用 `[DisableAuditing]` 来禁用特定的控制器: + +````csharp +[DisableAuditing] +public class HomeController : AbpController +{ + //... +} +```` + +使用 `[DisableAuditing]` 在action级别控制: + +````csharp +public class HomeController : AbpController +{ + [DisableAuditing] + public async Task Home() + { + //... + } + + public async Task OtherActionLogged() + { + //... + } +} +```` + +### 启用/禁用 应用服务&方法 + +[应用服务](Application-Services.md)也默认包含在审计日志中. 你可在服务或方法级别使用 `[DisableAuditing]`. + +#### 启用/禁用 其他服务 + +可以为任何类型的类(注册到[依赖注入](Dependency-Injection.md)并从依赖注入解析)启用审计日志,默认情况下仅对控制器和应用程序服务启用. + +对于任何需要被审计记录的类或方法都可以使用 `[Audited]` 和`IAuditingEnabled`.此外,您的类可以(直接或固有的)实现 `IAuditingEnabled` 接口以认启用该类的审计日志记录. + +### 启用/禁用 实体 & 属性 + +以下情况下实体在实体更改审计日志记录中忽略实体; + +* 如果将实体类型添加到 `AbpAuditingOptions.IgnoredTypes`(如前所述),它在审计日志系统中被完全忽略. +* 如果对象不是[实体](Entities.md)(没有直接或固有的实现 `IEntity` - 所有实体默认实现这个接口). +* 如果实体访问级别不是public的. + +你可以使用 `Audited` 来启用实体更改审计日志: + +````csharp +[Audited] +public class MyEntity : Entity +{ + //... +} +```` + +或者禁用实体: + +````csharp +[DisableAuditing] +public class MyEntity : Entity +{ + //... +} +```` + +只有前面提到的 `AbpAuditingOptions.EntityHistorySelector` 选择实体时才有必要禁用审计日志记录. + +你可以仅禁用实体的某些属性的审计,以审计日志记录进行精细控制: + +````csharp +[Audited] +public class MyUser : Entity +{ + public string Name { get; set; } + + public string Email { get; set; } + + [DisableAuditing] //Ignore the Passoword on audit logging + public string Password { get; set; } +} +```` + +审计日志系统保存 `MyUser` 实体的更改,出于安全的目的忽略 `Password` 属性. + +在某些情况下你可能要保存一些属性,但忽略所有其他属性. 为忽略的属性编写 `[DisableAuditing]` 将很乏味. 这种情况下将 `[Audited]` 用于所需的属性,使用 `[DisableAuditing]` 属性标记该实体: + +````csharp +[DisableAuditing] +public class MyUser : Entity +{ + [Audited] //Only log the Name change + public string Name { get; set; } + + public string Email { get; set; } + + public string Password { get; set; } +} +```` + +## IAuditingStore + +`IAuditingStore` 是一个接口,用于保存ABP框架的审计日志对象(下面说明). 如果需要将审计日志对象保存到自定义数据存储中,可以在自己的应用程序中实现 `IAuditingStore` 并在[依赖注入系统](Dependency-Injection.md)替换. + +如果没有注册审计存储,则使用 `SimpleLogAuditingStore`. 它只是将审计对象写入标准[日志系统](Logging.md). + +[审计日志模块](Modules/Audit-Logging.md)已在[启动模板](Startup-Templates/Index.md)中配置,它将审计日志对象保存到数据库中(支持多个数据库提供程序). 所以大多数时候你并不需要关心 `IAuditingStore` 是如何实现和使用的. + +## 审计日志对象 + +默认为每个**web请求**创建一个**审计日志对象**,审计日志对象可以由以下关系图表示: + +![**auditlog-object-diagram**](images/auditlog-object-diagram.png) + +* **AuditLogInfo**: 具有以下属性: + * `ApplicationName`: 当你保存不同的应用审计日志到同一个数据库,这个属性用来区分应用程序. + * `UserId`:当前用户的Id,用户未登录为 `null`. + * `UserName`:当前用户的用户名,如果用户已经登录(这里的值不依赖于标识模块/系统进行查找). + * `TenantId`: 当前租户的Id,对于多租户应用. + * `TenantName`: 当前租户的名称,对于多租户应用. + * `ExecutionTime`: 审计日志对象创建的时间. + * `ExecutionDuration`: 请求的总执行时间,以毫秒为单位. 可以用来观察应用程序的性能. + * `ClientId`: 当前客户端的Id,如果客户端已经通过认证.客户端通常是使用HTTP API的第三方应用程序. + * `ClientName`: 当前客户端的名称,如果有的话. + * `ClientIpAddress`: 客户端/用户设备的IP地址. + * `CorrelationId`: 当前[相关Id](CorrelationId.md). 相关Id用于在单个逻辑操作中关联由不同应用程序(或微服务)写入的审计日志. + * `BrowserInfo`: 当前用户的浏览器名称/版本信息,如果有的话. + * `HttpMethod`: 当前HTTP请求的方法(GET,POST,PUT,DELETE ...等). + * `HttpStatusCode`: HTTP响应状态码. + * `Url`: 请求的URL. +* **AuditLogActionInfo**: 一个 审计日志动作通常是web请求期间控制器动作或[应用服务](Application-Services.md)方法调用. 一个审计日志可以包含多个动作. 动作对象具有以下属性: + * `ServiceName`:执行的控制器/服务的名称. + * `MethodName`:控制器/服务执行的方法的名称. + * `Parameters`:传递给方法的参数的JSON格文本. + * `ExecutionTime`: 执行的时间. + * `ExecutionDuration`: 方法执行时长,以毫秒为单位. 可以用来观察方法的性能. +* **EntityChangeInfo**: 表示一个实体在Web请求中的变更. 审计日志可以包含0个或多个实体的变更. 实体变更具有以下属性: + * `ChangeTime`: 当实体被改变的时间. + * `ChangeType`:具有以下字段的枚举: `Created`(0), `Updated`(1)和 `Deleted`(2). + * `EntityId`: 更改实体的Id. + * `EntityTenantId`:实体所属的租户Id. + * `EntityTypeFullName`: 实体的类型(类)的完整命名空间名称(例如Book实体的*Acme.BookStore.Book*. +* **EntityPropertyChangeInfo**: 表示一个实体的属性的更改.一个实体的更改信息(上面已说明)可含有具有以下属性的一个或多个属性的更改: + * `NewValue`: 属性的新值. 如果实体已被删除为 `null`. + * `OriginalValue`:变更前旧/初始值. 如果实体是新创建为 `null`. + * `PropertyName`: 实体类的属性名称. + * `PropertyTypeFullName`:属性类型的完整命名空间名称. +* **Exception**: 审计日志对象可能包含零个或多个异常. 可以得到失败请求的异常信息. +* **Comment**:用于将自定义消息添加到审计日志条目的任意字符串值. 审计日志对象可能包含零个或多个注释. + +除了上面说明的标准属性之外,`AuditLogInfo`, `AuditLogActionInfo` 和 `EntityChangeInfo` 对象还实现了`IHasExtraProperties` 接口,你可以向这些对象添加自定义属性. + +## 审计日志贡献者 + +你可以创建类继承 `AuditLogContributor`类 来扩展审计系统,该类定义了 `PreContribute` 和 `PostContribute` 方法. + +唯一预构建的贡献者是 `AspNetCoreAuditLogContributor` 类,它设置HTTP请求的相关属性. + +贡献者可以设置 `AuditLogInfo` 类的属性和集合来添加更多信息. + +例: + +````csharp +public class MyAuditLogContributor : AuditLogContributor +{ + public override void PreContribute(AuditLogContributionContext context) + { + var currentUser = context.ServiceProvider.GetRequiredService(); + context.AuditInfo.SetProperty( + "MyCustomClaimValue", + currentUser.FindClaimValue("MyCustomClaim") + ); + } + + public override void PostContribute(AuditLogContributionContext context) + { + context.AuditInfo.Comments.Add("Some comment..."); + } +} +```` + +* `context.ServiceProvider` 可以从[依赖注入系统](Dependency-Injection.md)中解析服务. +* `context.AuditInfo` 可以用来访问当前审计日志的对象并进行操作. + +创建贡献者后,需要将其添加到 `AbpAuditingOptions.Contributors` 列表中: + +````csharp +Configure(options => +{ + options.Contributors.Add(new MyAuditLogContributor()); +}); +```` + +## IAuditLogScope & IAuditingManager + +本节介绍用于高级用例的 `IAuditLogScope` 和 `IAuditingManager` 服务. + +**审计日志范围**是**构建**和**保存**审计日志对象的[环境范围](Ambient-Context-Pattern.md)(前面解释过). 默认审计日志中间件会为Web请求创建审计日志范围(请参阅上面的 `UseAuditing()` 部分). + +### 获取当前审计日志范围 + +上面提到,审计日志贡献者是操作审计日志对象的全局方法. 你可从服务中获得值. + +如果需要在应用程序的任意位置上操作审计日志对象,可以访问当前审计日志范围并获取当前审计日志对象(与范围的管理方式无关). +例: + +````csharp +public class MyService : ITransientDependency +{ + private readonly IAuditingManager _auditingManager; + + public MyService(IAuditingManager auditingManager) + { + _auditingManager = auditingManager; + } + + public async Task DoItAsync() + { + var currentAuditLogScope = _auditingManager.Current; + if (currentAuditLogScope != null) + { + currentAuditLogScope.Log.Comments.Add( + "Executed the MyService.DoItAsync method :)" + ); + + currentAuditLogScope.Log.SetProperty("MyCustomProperty", 42); + } + } +} +```` + +总是检查 `_auditingManager.Current` 是否为空,因为它是在外部范围中控制的,在调用方法之前你不知道是否创建了审计日志范围. + +### 手动创建审计日志范围 + +你很少需要手动创建审计日志的范围,但如果你需要,可以使用 `IAuditingManager` 创建审计日志的范围. +例: + +````csharp +public class MyService : ITransientDependency +{ + private readonly IAuditingManager _auditingManager; + + public MyService(IAuditingManager auditingManager) + { + _auditingManager = auditingManager; + } + + public async Task DoItAsync() + { + using (var auditingScope = _auditingManager.BeginScope()) + { + try + { + //Call other services... + } + catch (Exception ex) + { + //Add exceptions + _auditingManager.Current.Log.Exceptions.Add(ex); + } + finally + { + //Always save the log + await auditingScope.SaveAsync(); + } + } + } +} +```` + +您可以调用其他服务,它们可能调用其他服务,它们可能更改实体,等等. 所有这些交互都保存为finally块中的一个审计日志对象. + +## 审计日志模块 + +审计日志模块基本上实现了 `IAuditingStore`, 将审计日志对象保存到数据库中并支持多个数据库提供程序. 默认此模块已添加到启动模板中. + +参见[审计日志模块文档](Modules/Audit-Logging.md)了解更多. \ No newline at end of file diff --git a/docs/zh-Hans/Background-Jobs-Hangfire.md b/docs/zh-Hans/Background-Jobs-Hangfire.md index 5ef9aad32d..d35d8482ca 100644 --- a/docs/zh-Hans/Background-Jobs-Hangfire.md +++ b/docs/zh-Hans/Background-Jobs-Hangfire.md @@ -1,3 +1,43 @@ -# Hangfire Background Job Manager +# Hangfire后台作业管理 -待添加 \ No newline at end of file +[Hangfire](https://www.hangfire.io/)是一个高级的后台作业管理. 你可以用ABP框架集成Hangfire代替[默认后台作业管理](Background-Jobs.md). 通过这种方式你可以使用相同的后台作业API,将你的代码独立于Hangfire. 如果你喜欢也可以直接使用Hangfire的API. + +> 参阅[后台作业文档](Background-Jobs.md),学习如何使用后台作业系统. 本文只介绍了如何安装和配置Hangfire集成. + +## 安装 + +建议使用[ABP CLI](CLI.md)安装包. + +### 使用ABP CLI + +在项目的文件夹(.csproj文件)中打开命令行窗口输入以下命令: + +````bash +abp add-package Volo.Abp.BackgroundJobs.HangFire +```` + +### 手动安装 + +如果你想手动安装; + +1. 添加 [Volo.Abp.BackgroundJobs.HangFire](https://www.nuget.org/packages/Volo.Abp.BackgroundJobs.HangFire) NuGet包添加到你的项目: + + ```` + Install-Package Volo.Abp.BackgroundJobs.HangFire + ```` + +2. 添加 `AbpBackgroundJobsHangfireModule` 到你的模块的依赖列表: + +````csharp +[DependsOn( + //...other dependencies + typeof(AbpBackgroundJobsHangfireModule) //Add the new module dependency + )] +public class YourModule : AbpModule +{ +} +```` + +## 配置 + +TODO... \ No newline at end of file diff --git a/docs/zh-Hans/Background-Jobs.md b/docs/zh-Hans/Background-Jobs.md index 30b6f0f1ad..7c2a694005 100644 --- a/docs/zh-Hans/Background-Jobs.md +++ b/docs/zh-Hans/Background-Jobs.md @@ -110,7 +110,7 @@ Enqueue方法接收一些可选参数用于控制后台作业: 你可能希望在你的应用程序中禁用后台作业执行. 如果你希望在另一个进程中执行后台作业并在当前进程中禁用它,通常可以使用以下命令. -使用 `BackgroundJobOptions` 配置作业执行: +使用 `AbpBackgroundJobOptions` 配置作业执行: ````csharp [DependsOn(typeof(AbpBackgroundJobsModule))] @@ -118,7 +118,7 @@ public class MyModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - Configure(options => + Configure(options => { options.IsJobExecutionEnabled = false; //禁用作业执行 }); @@ -142,7 +142,7 @@ ABP framework 包含一个简单的 `IBackgroundJobManager` 实现; ### 配置 -在你的[模块类](Module-Development-Basics.md)中使用 `BackgroundJobWorkerOptions` 配置默认作业管理器. +在你的[模块类](Module-Development-Basics.md)中使用 `AbpBackgroundJobWorkerOptions` 配置默认作业管理器. 示例中更改后台作业的的超时时间: ````csharp @@ -151,7 +151,7 @@ public class MyModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) { - Configure(options => + Configure(options => { options.DefaultTimeout = 864000; //10 days (as seconds) }); diff --git a/docs/zh-Hans/Blog-Posts/2019-02-22/Post.md b/docs/zh-Hans/Blog-Posts/2019-02-22/Post.md index 69a8603baf..30a5d691e9 100644 --- a/docs/zh-Hans/Blog-Posts/2019-02-22/Post.md +++ b/docs/zh-Hans/Blog-Posts/2019-02-22/Post.md @@ -1,12 +1,12 @@ # 微服务演示,项目状态和路线图 -在ABP vNext上的[第一个公告](https://cn.abp.io/blog/abp/Abp-vNext-Announcement)之后,我们对代码库进行了很多改进([GitHub存储库](https://github.com/abpframework/abp)上的1100多次提交).我们已经创建了功能,示例,文档等等.在这篇文章中,我想告诉你一些新闻和项目的状态. +在ABP vNext上的[第一个公告](https://abp.io/blog/abp/Abp-vNext-Announcement)之后,我们对代码库进行了很多改进([GitHub存储库](https://github.com/abpframework/abp)上的1100多次提交).我们已经创建了功能,示例,文档等等.在这篇文章中,我想告诉你一些新闻和项目的状态. ## 微服务演示解决方案 -ABP框架的主要目标之一是提供[创建微服务解决方案的便利基础设施](https://cn.abp.io/documents/abp/latest/Microservice-Architecture). +ABP框架的主要目标之一是提供[创建微服务解决方案的便利基础设施](https://abp.io/documents/abp/latest/Microservice-Architecture). -我们一直在努力开发微服务解决方案演示.初始版本已完成并[文档化](https://cn.abp.io/documents/abp/latest/Samples/Microservice-Demo).该示例解决方案旨在演示一个简单而完整的微服务解决方案; +我们一直在努力开发微服务解决方案演示.初始版本已完成并[文档化](https://abp.io/documents/abp/latest/Samples/Microservice-Demo).该示例解决方案旨在演示一个简单而完整的微服务解决方案; - 具有多个独立的,可自我部署的**微服务**. - 多个**Web应用程序**,每个都使用不同的API网关. @@ -20,7 +20,7 @@ ABP框架的主要目标之一是提供[创建微服务解决方案的便利基 - 使用[Docker](https://www.docker.com/)和[Kubernates](https://kubernetes.io/)**部署**并运行所有服务和应用程序. - 使用[Elasticsearch](https://www.elastic.co/products/elasticsearch)和[Kibana](https://www.elastic.co/products/kibana)存储和可视化日志(使用[Serilog](https://serilog.net/)编写). -有关解决方案的详细说明,请参阅[其文档](https://cn.abp.io/documents/abp/latest/Samples/Microservice-Demo). +有关解决方案的详细说明,请参阅[其文档](https://abp.io/documents/abp/latest/Samples/Microservice-Demo). ## 改进/功能 @@ -32,13 +32,13 @@ ABP框架的主要目标之一是提供[创建微服务解决方案的便利基 根据我们的估计,我们计划在2019年第二季度(可能在五月或六月)发布v1.0.所以,不用等待太长时间了.我们也对第一个稳定版本感到非常兴奋. -我们还将完善[文档](https://cn.abp.io/documents/abp/latest),因为它现在还远未完成. +我们还将完善[文档](https://abp.io/documents/abp/latest),因为它现在还远未完成. 第一个版本可能不包含SPA模板.但是,如果可能的话,我们想要准备一个简单些的.SPA框架还没有确定下来.备选有:**Angular,React和Blazor**.请将您的想法写为对此帖的评论. ## 中文网 -中国有一个大型的ABP社区.他们创建了一个中文版的abp.io网站:https://cn.abp.io/. 他们一直在保持更新.感谢中国的开发人员,特别是[Liming Ma](https://github.com/maliming). +中国有一个大型的ABP社区.他们创建了一个中文版的abp.io网站:https://abp.io/. 他们一直在保持更新.感谢中国的开发人员,特别是[Liming Ma](https://github.com/maliming). ## NDC {London} 2019 diff --git a/docs/zh-Hans/Blog-Posts/2020-01-15 v2_0_Release/Post.md b/docs/zh-Hans/Blog-Posts/2020-01-15 v2_0_Release/Post.md new file mode 100644 index 0000000000..b996bf23d3 --- /dev/null +++ b/docs/zh-Hans/Blog-Posts/2020-01-15 v2_0_Release/Post.md @@ -0,0 +1,164 @@ +# ABP框架v2.0 和 ABP商业版 + +ABP框架2.0版已经在本周公布.这篇文章解释了为什么我们发布了一个**抢先主版本**,和2.0版本中的变化. + +除了v2.0版本,我们很高兴地宣布**ABP商业版**,这是建立在开源ABP框架的之上的一套专业的模块,工具,主题和服务. + +## ABP框架V2.0 + +### 为什么2.0,而不是1.2? + +本来在[V1.1.2](https://github.com/abpframework/abp/releases/tag/1.1.2)发布后计划发布1.2版.然而,[有报告](https://github.com/abpframework/abp/issues/2026)称1.x版在Linux上有一些**性能**和**稳定性**问题,尤其是当应用程序部署在**低配CPU和内存**的**Linux**容器上. + +我们深入研究了这一问题,并已查明问题的根本原因与**拦截`async`方法**的实现有关.此外,也有一些 **`async`套`sync`** 的用法影响了线程池的优化. + +最后,在**社区**在大力协助下我们**解决了所有的问题**.但是,我们也有一些重要的**设计决策**导致了一些**破坏性变更**,因为[语义版本](https://semver.org/),我们不得不改变框架的主版号. + +大多数的应用程序不会受到[破坏性变更](https://github.com/abpframework/abp/releases)的影响,或者只需要做一些微小的修改. + +### 破坏性变更 + +#### 删除了一些同步的API + +一些拦截器需要使用`async`的API.当他们拦截`sync`方法时,他们需要调用`async`套`sync`.这最终导致了`async`套`sync`的问题.这就是为什么我们[删除了一些同步的API](https://github.com/abpframework/abp/pull/2464). + +当你需要**在`async`方法中调用`sync`方法**时, **`async`套`sync`** 这种模式是`C#`一个经典问题.虽然有一些解决方法,但是都有相应的**缺点**,并建议**不要写**这样的代码.你可以在网上找到关于这一话题的许多文档. + +为了避免这个问题,我们已经移除: + +- `sync`[仓储](https://docs.abp.io/en/abp/latest/Repositories)方法 (如`insert`, `update`, 等...), +- `sync`[工作单元](https://docs.abp.io/en/abp/latest/Unit-Of-Work)API, +- `sync`[后台作业](https://docs.abp.io/en/abp/latest/Background-Jobs)API, +- `sync`[审计日志](https://docs.abp.io/en/abp/latest/Audit-Logging)API, + - 其他一些很少使用的`sync`API. + +如果你遇到了编译错误,只需使用这些API的`async`版本. + +#### 始终async! + +从v2.0开始,ABP框架假设你以`async`方式编写你的应用程序代码.否则,一些框架的功能可能无法正常工作. + +建议你的所有[应用服务](https://docs.abp.io/en/abp/latest/Application-Services), [仓储方法](https://docs.abp.io/en/abp/latest/Repositories), 控制器动作(ontroller actions), 页面处理器(page handlers)都是`async`. + +即使你的应用服务方法并不需要是`async`,也将其设置为`async`,因为拦截器需要执行`async`操作(授权,工作单元等).你可以在不调用`async`的方法中返回`Task.Completed`. + +示例: + +````csharp +public Task GetValueAsync() +{ + //这个方法没有任何async调用 + return Task.CompletedTask(42); +} +```` + +上述例子通常并不需要是`async`因为它不执行`async`调用.然而,将它设置为`async`,这样可以帮助ABP框架运行拦截器时避免出现`async`套sync的调用. + +此规则不强制你写的每一个方法都是`async`.这样并不好而且很乏味.只在拦截的服务上需要(特别是[应用服务](https://docs.abp.io/en/abp/latest/Application-Services)和[仓库方法](https://docs.abp.io/en/abp/latest/Repositories)) + +#### 其他破坏性变更 + +查看[发行说明](https://github.com/abpframework/abp/releases/tag/2.0.0)中的破坏性变更.他们中的大多数都不会影响你的应用程序代码. + +### 新功能 + +本次发布还包含一些新的功能和一堆改进: + +- [#2597](https://github.com/abpframework/abp/pull/2597) 新的`Volo.Abp.AspNetCore.Serilog`包. +- [#2526](https://github.com/abpframework/abp/issues/2526) `C#`客户端代理的客户端验证. +- [#2374](https://github.com/abpframework/abp/issues/2374) `async`后台作业. +- [#265](https://github.com/abpframework/abp/issues/265) 管理应用程序关闭. +- [#2472](https://github.com/abpframework/abp/issues/2472) `IdentityServer`模块实现`DeviceFlowCodes`和`TokenCleanupService`. + +功能,改进和BUG修复的完整列表, 请查看[发布说明](https://github.com/abpframework/abp/releases/tag/2.0.0). + +### 文档 + +随着v2.0的发布,我们也完成了一些缺少的文档.在接下来的几周内,我们将主要关注文档和教程. + +## ABP商业版 + +[ABP商业版](https://commercial.abp.io/)是建立在开源ABP框架之上的一套专业的**模块,工具,主题和服务**. + + - 除了ABP框架免费和[开源模块](https://docs.abp.io/en/abp/latest/Modules/Index)之外, 提供[专业模块](https://commercial.abp.io/modules). +- 包含一个漂亮的[UI主题](https://commercial.abp.io/themes), 具有5种不同的样式. +- 提供[ABP套件](https://commercial.abp.io/tools/suite); 一个让开发更具有生产力的工具. 通过配置实体属性, 它可以在几秒内创建全栈的CRUD页面. 更多的功能陆续开发中. +- 为企业提供[高级支持](ttps://commercial.abp.io/support). + +除了这些标准的功能,我们会将提供定制服务.更多细节请参见[commercial.abp.io](https://commercial.abp.io/)网站. + +### ABP框架 vs ABP商业版 + +ABP商业版**不是付费版本**的ABP框架.可以把它当作为专业公司提供的**附加套餐**.你可以用它来节省时间和更快地开发产品. + +ABP框架将永远是**开源免费**的! + +一个原则是,我们创建的主要基础设施作为开源产品, 然后销售额外的预制应用程序功能,主题和工具.类似于[ASP.NET Boilerplate](https://aspnetboilerplate.com/)和[ASP.NET Zero](https://aspnetzero.com/)产品. + +购买商业版许可极大地节省你的时间和精力,你可以专注于自己的业务,此外也可获得专门的和优先的支持.同时,你也在支持ABP核心团队,因为我们花了大部分时间来开发,维护和支持开源的ABP框架. + +有了ABP商业版,ABP现在变为一个平台.我们称之为**ABP.IO平台**, 其中包括开源ABP框架和ABP商业版. + +### 演示 + +如果你想知道ABP商业版应用程序的启动模板是什么样,你可以很容易地[创建一个演示](https://commercial.abp.io/demo),并看到它的实际效果.该演示包括所有的预制模块和主题. + +下面是一张IdentityServer管理模块UI的截图: + +![abp-commercial-demo](abp-commercial-demo.png) + +这是一张来自使用material设计风格主题的演示应用程序的截图: + +![lepton-theme-material](lepton-theme-material.png) + +### 价格 + +你可以创建**无限个工程/产品**, 销售给**无限个客户**, 部署在**无限台服务器上**, 不受任何限制. 定价主要是基于**开发人员个数**,**支持等级**和**源代码**需求上.有三个标准包; + +- **团队许可**: 包括所有的模块,主题和工具.允许最多3个开发者开发产品.可购买额外的开发者许可. +- **商业许可**: 允许下载所有的模块和主题的源代码.此外,默认包含了5个开发者许可.可购买额外的开发者许可. +- **企业许可**: 在商业许可上, 提供无限的专属支持. + +请查看[价格页面](https://commercial.abp.io/pricing)了解详细信息.除了标准包以外,我们也提供定制服务和定制许可.如有任何问题,请[联系我们](https://commercial.abp.io/contact). + +#### 许可比较 + +许可价格是根据开发者数量,支持等级和源代码访问而变化的. + +##### 源代码 + +团队许可证不包括预制模块和主题的源代码.以**NuGet和NPM包**的方式使用所有这些模块.通过这种方式,你可以很容易地通过更新包的依赖得到**新功能和bug修复**仅.但是不能访问其源代码.所以不能嵌入模块的源代码到你的应用程序里,和随意修改源代码. + +预制模块提供一定等级的**定制**和**扩展**,并允许你覆盖服务,UI部分等.我们正在努力使他们更加可定制和可扩展.如果你无需在预制模块中做很大修改的话,团队许可是你理想的选择,因为它更便宜,并且可轻松获得新的功能和bug修复. + +商业和企业许可允许你在需要时**下载任何模块和主题的源代码**.它们使用与团队许可相同的启动模板,所以所有的模块都默认使用`NuGet`和`NPM`包.但是,在需要的情况下,你可以从一个模块中删除包的依赖,并嵌入它的源代码到你自己的解决方案中,然后完全定制它.在这种情况下,当一个新版本可用时, 升级模块将不会那么容易.当然, 你不必升级!但是,如果你愿意,你也可以使用一些合并工具或Git的分支系统来做到这一点. + +#### 许可周期 + +ABP商业版许可是**永久的**,这意味着你可以**永远使用**它继续开发应用程序. + +但是,下面的服务周期为一年: + +- 高级**支持**一年后结束.你可以继续得到社区支持. +- 一年后将不会得到模块和主题的**更新**.你可以继续使用最后获得的版本.甚至可以在主版本内得到BUG修复和改进. +- 你可使用**ABP套件**一年. + +如果想继续获得这些好处,可延长许可期限.续订价格比正常价格低20%. + +## NDC London 2020 + +与[去年](https://medium.com/volosoft/impressions-of-ndc-london-2019-f8f391bb7a9c)一样, 我们是著名的软件开发会议[NDC London](https://ndc-london.com/)的合作伙伴! 去年, 我们开展了[ASP.NET Boilerplate](https://aspnetboilerplate.com/)和[ASP.NET Zero](https://aspnetzero.com/)主题: + +![ndc-london-volosoft](ndc-london-volosoft.png) + +今年,我们将着重于**ABP.IO平台**(开源ABP框架和ABP商业版).我们的展位会是这样的: + +![ndc-london-volosoft](ndc-2020-volosoft-booth-wall.png) + +如果你参加会议,记得要参观我们的展位.我们将很高兴来谈一谈ABP平台的功能,目标和软件开发. + +### 你想见ABP团队吗? + +如果你在伦敦, 而且想和我们喝杯咖啡的话, 在2月1日的下午[@hibrahimkalkan](https://twitter.com/hibrahimkalkan)和[@ismcagdas](https://twitter.com/ismcagdas)会在那. + +想见面就给info@abp.io写个邮件 :) \ No newline at end of file diff --git a/docs/zh-Hans/Blog-Posts/2020-01-15 v2_0_Release/abp-commercial-demo.png b/docs/zh-Hans/Blog-Posts/2020-01-15 v2_0_Release/abp-commercial-demo.png new file mode 100644 index 0000000000..caddce27ab Binary files /dev/null and b/docs/zh-Hans/Blog-Posts/2020-01-15 v2_0_Release/abp-commercial-demo.png differ diff --git a/docs/zh-Hans/Blog-Posts/2020-01-15 v2_0_Release/lepton-theme-material.png b/docs/zh-Hans/Blog-Posts/2020-01-15 v2_0_Release/lepton-theme-material.png new file mode 100644 index 0000000000..72cb5c0639 Binary files /dev/null and b/docs/zh-Hans/Blog-Posts/2020-01-15 v2_0_Release/lepton-theme-material.png differ diff --git a/docs/zh-Hans/Blog-Posts/2020-01-15 v2_0_Release/ndc-2020-volosoft-booth-wall.png b/docs/zh-Hans/Blog-Posts/2020-01-15 v2_0_Release/ndc-2020-volosoft-booth-wall.png new file mode 100644 index 0000000000..70fb9d54f7 Binary files /dev/null and b/docs/zh-Hans/Blog-Posts/2020-01-15 v2_0_Release/ndc-2020-volosoft-booth-wall.png differ diff --git a/docs/zh-Hans/Blog-Posts/2020-01-15 v2_0_Release/ndc-london-volosoft.png b/docs/zh-Hans/Blog-Posts/2020-01-15 v2_0_Release/ndc-london-volosoft.png new file mode 100644 index 0000000000..afaed37a7a Binary files /dev/null and b/docs/zh-Hans/Blog-Posts/2020-01-15 v2_0_Release/ndc-london-volosoft.png differ diff --git a/docs/zh-Hans/Caching.md b/docs/zh-Hans/Caching.md index 7379104f51..0557ddcb4d 100644 --- a/docs/zh-Hans/Caching.md +++ b/docs/zh-Hans/Caching.md @@ -2,6 +2,32 @@ ABP框架扩展了ASP.NET Core的分布式缓存系统. +## Volo.Abp.Caching Package + +> 默认情况下启动模板已经安装了这个包,所以大部分情况下你不需要手动安装. + +Volo.Abp.Caching是缓存系统的核心包.使用包管理控制台(PMC)安装到项目: + +``` +Install-Package Volo.Abp.Caching +``` + +然后将 **AbpCachingModule** 依赖添加到你的模块: + +```c# +using Volo.Abp.Modularity; +using Volo.Abp.Caching; + +namespace MyCompany.MyProject +{ + [DependsOn(typeof(AbpCachingModule))] + public class MyModule : AbpModule + { + //... + } +} +``` + ## `IDistributedCache` 接口 ASP.NET Core 定义了 `IDistributedCache` 接口用于 get/set 缓存值 . 但是会有以下问题: diff --git a/docs/zh-Hans/Connection-Strings.md b/docs/zh-Hans/Connection-Strings.md new file mode 100644 index 0000000000..562ae700ce --- /dev/null +++ b/docs/zh-Hans/Connection-Strings.md @@ -0,0 +1,80 @@ +# 连接字符串 + +ABP框架的设计是[模块化](Module-Development-Basics.md), [微服务兼容](Microservice-Architecture.md) 和 [多租户](Multi-Tenancy.md). 同时设计了连接字符串管理来支持这些场景; + +* 允许为每个模块设置单独的连接字符串,这样每个模块都可以有自己的物理数据库. 甚至可以将模块配置为使用不同的DBMS. +* 允许为每个租户设置单独的连接字符串使用单独的数据库(在SaaS应用程序中). + +它还支持混合场景; + +* 允许将模块分组到数据库 (所有的模块分组到一个共享数据库, 两个模块使用数据库A, 3个模块使用数据库B, 一个数据库使用数据库C其余的数据库使用数据库D...等.) +* 允许将租户分组到数据库中,像模块一样. +* 允许为每个租户每个模块分离数据库 (数据库过多会增加维护成本,但ABP框架支持这种需求). + +所有[预构建应用模块](Modules/Index.md)已设计为与以上场景兼容. + +## 配置连接字符串 + +参见以下配置: + +````json +"ConnectionStrings": { + "Default": "Server=localhost;Database=MyMainDb;Trusted_Connection=True;", + "AbpIdentityServer": "Server=localhost;Database=MyIdsDb;Trusted_Connection=True;", + "AbpPermissionManagement": "Server=localhost;Database=MyPermissionDb;Trusted_Connection=True;" +} +```` + +> ABP使用 `IConfiguration` 服务获取应用程序配置. 虽然在 `appsettings.json` 文件中写入配置是最简单的方法, 但它不仅限于此文件. 你可以使用环境变量, user secrets, Azure Key Vault... 等. 更多信息参阅 [配置](Configuration.md) 文档. + +以上配置定义了三个不同的连接字符串: + +* `MyMainDb` (`Default` 连接字符串)是应用程序的主连接字符串. 如果没有为模块指定连接字符串,则回退到 `Default` 连接字符串. [应用程序启动模板](Startup-Templates/Application.md) 配置为使用单个字符串, 所以所有的模块都使用单个数据库. +* `MyIdsDb` 由 [IdentityServer](Modules/IdentityServer.md) 模块使用. +* `MyPermissionDb` 由 [权限管理](Modules/Permission-Management.md) 模块使用. + +[预构建的应用程序模块](Modules/Index.md) 为连接字符串名称定义常量. 例如IdentityServer模块在 `AbpIdentityServerDbProperties` 类(位于 `Volo.Abp.IdentityServer` 命名空间)定义了 `ConnectionStringName` 常量 . 其他的模块类似的定义常量,你可以查看连接字符串的名称. + +### AbpDbConnectionOptions + +ABP实际上使用 `AbpDbConnectionOptions` 获取连接字符串. 如果如上所述设置了连接字符串, `AbpDbConnectionOptions` 会被自动填充. 但是你也可以使用[选项模式](Options.md)设置或覆盖连接字符串. 你可以在[模块](Module-Development-Basics.md)的 `ConfigureServices` 方法配置`AbpDbConnectionOptions`). +如下所示: + +````csharp +public override void ConfigureServices(ServiceConfigurationContext context) +{ + Configure(options => + { + options.ConnectionStrings.Default = "..."; + options.ConnectionStrings["AbpPermissionManagement"] = "..."; + }); +} +```` + +## 设置连接字符串名称 + +模块通常使用 `ConnectionStringName` attribute 为 `DbContext` 类关联一个唯一的连接字符串名称. 示例: + +````csharp +[ConnectionStringName("AbpIdentityServer")] +public class IdentityServerDbContext + : AbpDbContext, IIdentityServerDbContext +{ +} +```` + +对于 [Entity Framework Core](Entity-Framework-Core.md) 和 [MongoDB](MongoDB.md), 写入到 `DbContext` 类 (和接口,如果有的话). + +> 如果你开发的是与数据库提供程序无关的可重用模块, 请参见 [最佳实践指南](Best-Practices/Index.md). + +## Entity Framework Core的数据库迁移 + +关系数据库需要在使用数据库之前创建数据库和数据库架构 (表, 视图...等). + +启动模板(使用 EF Core ORM) 带有一个数据库和一个 `.EntityFrameworkCore.DbMigrations` 项目,其中包含数据库的迁移文件. 该项目主要定义了一个*YourProjectName*MigrationsDbContext,它调用所有模块的 `Configure...()` 方法,例如 `builder.ConfigurePermissionManagement()`. + +一旦要分离模块的数据库,通常需要创建第二个迁移路径. 最简单的方法是创建一个带有 `DbContext` 的 `.EntityFrameworkCore.DbMigrations` 项目副本, 更改为只调用需要存储在第二个数据库中的模块的 `Configure...()` 方法并重新创建迁移. 这时你还需要更改 `.DbMigrator` 应用程序使其兼容第二个数据库,这样每个数据库将有一个单独的迁移DbContext. + +## 多租户 + +参阅 [多租户文档](Multi-Tenancy.md)了解如何为租户使用单独的数据库. \ No newline at end of file diff --git a/docs/zh-Hans/Contribution/Localization-Text-Files.md b/docs/zh-Hans/Contribution/Localization-Text-Files.md index 36bae2890a..8055d9cae2 100644 --- a/docs/zh-Hans/Contribution/Localization-Text-Files.md +++ b/docs/zh-Hans/Contribution/Localization-Text-Files.md @@ -3,7 +3,7 @@ 这是一个来自框架的本地化文本文件列表, 任何人都可以做出贡献. 我们会将此列表保持最新: * https://github.com/abpframework/abp/tree/master/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Localization/en.json -* https://github.com/abpframework/abp/tree/master/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpValidation/en.json +* https://github.com/abpframework/abp/blob/master/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/en.json * https://github.com/abpframework/abp/tree/master/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Localization/Resource/en.json * https://github.com/abpframework/abp/tree/master/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json * https://github.com/abpframework/abp/tree/master/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/Resource/en.json @@ -12,29 +12,20 @@ * https://github.com/abpframework/abp/tree/master/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/Base/Validation/en.json * https://github.com/abpframework/abp/tree/master/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/Source/en.json * https://github.com/abpframework/abp/tree/master/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/SourceExt/en.json -* https://github.com/abpframework/abp/tree/master/modules/account/src/Volo.Abp.Account.Web/Localization/Resources/AbpAccount/Web/en.json +* https://github.com/abpframework/abp/blob/master/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json * https://github.com/abpframework/abp/tree/master/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Localization/Resources/Blogging/ApplicationContracts/en.json -* https://github.com/abpframework/abp/tree/master/modules/blogging/src/Volo.Blogging.Web/Localization/Resources/Blogging/Web/en.json +* https://github.com/abpframework/abp/tree/master/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Localization/Resources/en.json * https://github.com/abpframework/abp/tree/master/modules/docs/app/VoloDocs.Web/Localization/Resources/VoloDocs/Web/en.json * https://github.com/abpframework/abp/tree/master/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/en.json -* https://github.com/abpframework/abp/tree/master/modules/docs/src/Volo.Docs.Admin.Web/Localization/Resources/Docs/Web/en.json * https://github.com/abpframework/abp/tree/master/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/en.json -* https://github.com/abpframework/abp/tree/master/modules/feature-management/src/Volo.Abp.FeatureManagement.Application.Contracts/Volo/Abp/FeatureManagement/Localization/ApplicationContracts/en.json -* https://github.com/abpframework/abp/tree/master/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/Localization/Domain/en.json -* https://github.com/abpframework/abp/tree/master/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Localization/Resources/FeatureManagement/en.json -* https://github.com/abpframework/abp/tree/master/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/Localization/ApplicationContracts/en.json -* https://github.com/abpframework/abp/tree/master/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/Localization/Domain/en.json -* https://github.com/abpframework/abp/tree/master/modules/identity/src/Volo.Abp.Identity.Web/Localization/Resources/AbpIdentity/en.json -* https://github.com/abpframework/abp/tree/master/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Localization/Resources/AbpPermissionManagement/en.json -* https://github.com/abpframework/abp/tree/master/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Localization/Resources/AbpSettingManagement/en.json -* https://github.com/abpframework/abp/tree/master/modules/tenant-management/src/Volo.Abp.TenantManagement.Application.Contracts/Volo/Abp/TenantManagement/Localization/ApplicationContracts/en.json -* https://github.com/abpframework/abp/tree/master/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Localization/Resources/AbpTenantManagement/Web/en.json +* https://github.com/abpframework/abp/tree/master/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/Localization/Domain/en.json +* https://github.com/abpframework/abp/tree/master/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en.json +* https://github.com/abpframework/abp/tree/master/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/en.json +* https://github.com/abpframework/abp/tree/master/modules/setting-management/src/Volo.Abp.SettingManagement.Domain.Shared/Volo/Abp/SettingManagement/Localization/Resources/AbpSettingManagement/en.json +* https://github.com/abpframework/abp/tree/master/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/Localization/Resources/en.json * https://github.com/abpframework/abp/tree/master/samples/BookStore/src/Acme.BookStore.Domain.Shared/Localization/BookStore/en.json -* https://github.com/abpframework/abp/tree/master/samples/DashboardDemo/src/DashboardDemo.Domain/Localization/DashboardDemo/en.json +* https://github.com/abpframework/abp/tree/master/samples/DashboardDemo/src/DashboardDemo.Domain.Shared/Localization/DashboardDemo/en.json * https://github.com/abpframework/abp/tree/master/samples/MicroserviceDemo/modules/product/src/ProductManagement.Application.Contracts/ProductManagement/Localization/ApplicationContracts/en.json * https://github.com/abpframework/abp/tree/master/samples/MicroserviceDemo/modules/product/src/ProductManagement.Domain/ProductManagement/Localization/Domain/en.json * https://github.com/abpframework/abp/tree/master/samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/Localization/Resources/ProductManagement/en.json -* https://github.com/abpframework/abp/tree/master/templates/mvc-module/src/MyCompanyName.MyProjectName.Application.Contracts/Localization/MyProjectName/ApplicationContracts/en.json -* https://github.com/abpframework/abp/tree/master/templates/mvc-module/src/MyCompanyName.MyProjectName.Domain.Shared/Localization/MyProjectName/DomainShared/en.json -* https://github.com/abpframework/abp/tree/master/templates/mvc-module/src/MyCompanyName.MyProjectName.Web/Localization/MyProjectName/Web/en.json -* https://github.com/abpframework/abp/tree/master/templates/mvc/src/MyCompanyName.MyProjectName.Domain.Shared/Localization/MyProjectName/en.json +* https://github.com/abpframework/abp/tree/master/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/Localization/MyProjectName/en.json \ No newline at end of file diff --git a/docs/zh-Hans/Dependency-Injection.md b/docs/zh-Hans/Dependency-Injection.md index 381b77ec35..2264a12930 100644 --- a/docs/zh-Hans/Dependency-Injection.md +++ b/docs/zh-Hans/Dependency-Injection.md @@ -319,4 +319,4 @@ public class AppModule : AbpModule ### 请参阅 -* [ASP.NET Core依赖注入最佳实践,提示和技巧](https://cn.abp.io/blog/Abp/asp-net-core-dependency-injection-best-practices-tips-tricks) +* [ASP.NET Core依赖注入最佳实践,提示和技巧](https://blog.abp.io/asp-net-core-dependency-injection-best-practices-tips-tricks) diff --git a/docs/zh-Hans/Entity-Framework-Core-MySQL.md b/docs/zh-Hans/Entity-Framework-Core-MySQL.md new file mode 100644 index 0000000000..5f9d8023ab --- /dev/null +++ b/docs/zh-Hans/Entity-Framework-Core-MySQL.md @@ -0,0 +1,58 @@ +# 切换到EF Core MySql提供程序 + +本文介绍如何将预配置为SqlServer提供程序的 **[应用程序启动模板](Startup-Templates/Application.md)** 切换到 **MySql** 数据库提供程序 + +## 替换Volo.Abp.EntityFrameworkCore.SqlServer包 + +解决方案中的 `.EntityFrameworkCore` 项目依赖于 [Volo.Abp.EntityFrameworkCore.SqlServer](https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore.SqlServer) NuGet包. 删除这个包并且添加相同版本的 [Volo.Abp.EntityFrameworkCore.MySQL](https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore.MySQL) 包. + +## 替换模块依赖项 + +在 `.EntityFrameworkCore` 项目中找到 **YourProjectName*EntityFrameworkCoreModule** 类, 删除 `DependsOn` attribute 上的`typeof(AbpEntityFrameworkCoreSqlServerModule)`, 添加 `typeof(AbpEntityFrameworkCoreMySQLModule)` (或者替换 `using Volo.Abp.EntityFrameworkCore.SqlServer;` 为 `using Volo.Abp.EntityFrameworkCore.MySQL;`). + +## UseMySQL() + +查找你的解决方案中 `UseSqlServer()`调用,替换为 `UseMySQL()`. 检查下列文件: + +* `.EntityFrameworkCore` 项目中的*YourProjectName*EntityFrameworkCoreModule.cs. +* `.EntityFrameworkCore` 项目中的*YourProjectName*MigrationsDbContextFactory.cs. + +> 根据你的解决方案的结构,你可能发现更多需要改变代码的文件. + +## 更改连接字符串 + +MySQL连接字符串与SQL Server连接字符串不同. 所以检查你的解决方案中所有的 `appsettings.json` 文件,更改其中的连接字符串. 有关MySQL连接字符串选项的详细内容请参见[connectionstrings.com](https://www.connectionstrings.com/mysql/). + +通常需要更改 `.DbMigrator` 和 `.Web` 项目里面的 `appsettings.json` ,但它取决于你的解决方案结构. + +## 更改迁移DbContext + +MySQL DBMS与SQL Server有一些细微的差异. 某些模块数据库映射配置(尤其是字段长度)会导致MySQL出现问题. 例如某些[IdentityServer模块](Modules/IdentityServer.md)表就存在这样的问题,它提供了一个选项可以根据您的DBMS配置字段. + +启动模板包含*YourProjectName*MigrationsDbContext,它负责维护和迁移数据库架构. 此DbContext基本上调用依赖模块的扩展方法来配置其数据库表. + +打开 *YourProjectName*MigrationsDbContext 更改 `builder.ConfigureIdentityServer();` 行,如下所示: + +````csharp +builder.ConfigureIdentityServer(options => +{ + options.DatabaseProvider = EfCoreDatabaseProvider.MySql; +}); +```` + +然后 `ConfigureIdentityServer()` 方法会将字段长度设置为不超过MySQL的限制. 如果在创建或执行数据库迁移时遇到任何问题请参考相关的模块文档. + +## 重新生成迁移 + +启动模板使用[Entity Framework Core的Code First迁移](https://docs.microsoft.com/zh-cn/ef/core/managing-schemas/migrations/). EF Core迁移取决于所选的DBMS提供程序. 因此更改DBMS提供程序会导致迁移失败. + +* 删除 `.EntityFrameworkCore.DbMigrations` 项目下的Migrations文件夹,并重新生成解决方案. +* 在包管理控制台中运行 `Add-Migration "Initial"`(在解决方案资源管理器选择 `.DbMigrator` (或 `.Web`) 做为启动项目并且选择 `.EntityFrameworkCore.DbMigrations` 做为默认项目). + +这将创建一个配置所有数据库对象(表)的数据库迁移. + +运行 `.DbMigrator` 项目创建数据库和初始种子数据. + +## 运行应用程序 + +它已准备就绪, 只需要运行该应用程序与享受编码. diff --git a/docs/zh-Hans/Entity-Framework-Core-Other-DBMS.md b/docs/zh-Hans/Entity-Framework-Core-Other-DBMS.md new file mode 100644 index 0000000000..943667eb55 --- /dev/null +++ b/docs/zh-Hans/Entity-Framework-Core-Other-DBMS.md @@ -0,0 +1,90 @@ +# 切换到EF Core 其它DBMS提供程序 + +**[应用程序启动模板](Startup-Templates/Application.md)** 为EF Core预配置了Sql Server提供程序,EF Core支持许多其它DBMS,你可以在基于ABP的应用程序使用它们. + +ABP框架为一些常见的DMBS提供了简化配置的集成包(有关可用集成包的列表,请参阅[EF Core文档](Entity-Framework-Core.md)),你也可以不使用集成包配置DBMS提供程序. + +虽然总是建议使用集成包(它也使不同模块之间的依赖版本成为标准版本),但是如果没有用于DBMS提供程序的集成包,也可以手动集成. + +本文介绍了如何在不使用[MySQL集成包](Entity-Framework-Core-MySQL.md)的情况下切换到MySQL. + +## 替换SQL Server依赖 + +* 删除 `.EntityFrameworkCore` 项目依赖的 [Volo.Abp.EntityFrameworkCore.SqlServer](https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore.SqlServer) NuGet 包. +* 添加 [Pomelo.EntityFrameworkCore.MySql](https://www.nuget.org/packages/Pomelo.EntityFrameworkCore.MySql/) NuGet 包到 `.EntityFrameworkCore` 项目. + +## 删除模块依赖项 + +从 ***YourProjectName*EntityFrameworkCoreModule** 类的依赖列表中删除`AbpEntityFrameworkCoreSqlServerModule`. + +## 更改UseSqlServer()调用 + +在*YourProjectName*EntityFrameworkCoreModule类中找到以下代码: + +````csharp +Configure(options => +{ + options.UseSqlServer(); +}); +```` + +替换成以下代码: + +````csharp +Configure(options => +{ + options.Configure(ctx => + { + if (ctx.ExistingConnection != null) + { + ctx.DbContextOptions.UseMySql(ctx.ExistingConnection); + } + else + { + ctx.DbContextOptions.UseMySql(ctx.ConnectionString); + } + }); +}); +```` + +* 调用的 `UseMySql` 代码是在 Pomelo.EntityFrameworkCore.MySql 包中定义的,方法还有附加选项,如果需要可以使用它. +* 这段代码首先检查当前请求中是否存在到相同数据库的现有(活动)连接,并在可能的情况下重用它. 这允许在不同的DbContext类型之间共享单个事务. ABP处理其余的事情. +* 如果没有活动的连接,它将把 `ctx.ConnectionString` 传递给UseMySql(这将创建新的数据库连接). 这里使用 `ctx.ConnectionString` 很重要. 不要传递静态连接字符串(或配置中的连接字符串). 因为ABP在多数据库或[多租户](Multi-Tenancy.md)环境中[动态确定正确的连接字符串](Connection-Strings.md). + +## 更改连接连接字符串 + +MySQL连接字符串与SQL Server连接字符串不同. 所以检查你的解决方案中所有的 `appsettings.json` 文件,更改其中的连接字符串. 有关MySQL连接字符串选项的详细内容请参见[connectionstrings.com](https://www.connectionstrings.com/mysql/). + +通常需要更改 `.DbMigrator` 和 `.Web` 项目里面的 `appsettings.json` ,但它取决于你的解决方案结构. + +## 更改迁移DbContext + +MySQL DBMS与SQL Server有一些细微的差异. 某些模块数据库映射配置(尤其是字段长度)会导致MySQL出现问题. 例如某些[IdentityServer模块](Modules/IdentityServer.md)表就存在这样的问题,它提供了一个选项可以根据您的DBMS配置字段. + +启动模板包含*YourProjectName*MigrationsDbContext,它负责维护和迁移数据库架构. 此DbContext基本上调用依赖模块的扩展方法来配置其数据库表. + +打开 *YourProjectName*MigrationsDbContext 更改 `builder.ConfigureIdentityServer();` 行,如下所示: + +````csharp +builder.ConfigureIdentityServer(options => +{ + options.DatabaseProvider = EfCoreDatabaseProvider.MySql; +}); +```` + +然后 `ConfigureIdentityServer()` 方法会将字段长度设置为超过MySQL的限制. 如果在创建或执行数据库迁移时遇到任何问题请参考相关的模块文档. + +## 重新生成迁移 + +启动模板使用[Entity Framework Core的Code First迁移](https://docs.microsoft.com/zh-cn/ef/core/managing-schemas/migrations/). EF Core迁移取决于所选的DBMS提供程序. 因此更改DBMS提供程序会导致迁移失败. + +* 删除 `.EntityFrameworkCore.DbMigrations` 项目下的Migrations文件夹,并重新生成解决方案. +* 在包管理控制台中运行 `Add-Migration "Initial"`(在解决方案资源管理器选择 `.DbMigrator` (或 `.Web`) 做为启动项目并且选择 `.EntityFrameworkCore.DbMigrations` 做为默认项目). + +这将创建一个配置所有数据库对象(表)的数据库迁移. + +运行 `.DbMigrator` 项目创建数据库和初始种子数据. + +## 运行应用程序 + +它已准备就绪, 只需要运行该应用程序与享受编码. \ No newline at end of file diff --git a/docs/zh-Hans/Entity-Framework-Core-PostgreSQL.md b/docs/zh-Hans/Entity-Framework-Core-PostgreSQL.md index 388367481f..bb1de20207 100644 --- a/docs/zh-Hans/Entity-Framework-Core-PostgreSQL.md +++ b/docs/zh-Hans/Entity-Framework-Core-PostgreSQL.md @@ -1,35 +1,41 @@ -## Entity Framework Core PostgreSQL 集成 +# 切换到EF Core PostgreSQL提供程序 -> 参阅 [Entity Framework Core 集成文档](../Entity-Framework-Core.md) 了解集成EF Core的基础知识. +本文介绍如何将预配置为SqlServer提供程序的 **[应用程序启动模板](Startup-Templates/Application.md)** 切换到 **PostgreSQL** 数据库提供程序 -### 更新 EntityFrameworkCore 项目 +## 替换Volo.Abp.EntityFrameworkCore.SqlServer包 -- 在 `Acme.BookStore.EntityFrameworkCore` 中将包 `Volo.Abp.EntityFrameworkCore.SqlServer` 替换为 `Volo.Abp.EntityFrameworkCore.PostgreSql` -- 打开 `BookStoreEntityFrameworkCoreModule` 模块类 - - 将 `AbpEntityFrameworkCoreSqlServerModule` 替换为 `AbpEntityFrameworkCorePostgreSqlModule` - - 将 `options.UseSqlServer()` 替换为 `options.UsePostgreSql()` -- 在其他的项目中将 `appsetting.json` 文件中的连接字符串更新为PostgreSQL链接字符串 +解决方案中的 `.EntityFrameworkCore` 项目依赖于 [Volo.Abp.EntityFrameworkCore.SqlServer](https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore.SqlServer) NuGet包. 删除这个包并且添加相同版本的 [Volo.Abp.EntityFrameworkCore.PostgreSql](https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore.PostgreSql) 包. -#### 删除现有迁移 +## 替换模块依赖项 -删除所有的现有迁移文件 (包括 `DbContextModelSnapshot`) +在 `.EntityFrameworkCore` 项目中找到 **YourProjectName*EntityFrameworkCoreModule** 类, 删除 `DependsOn` attribute 上的`typeof(AbpEntityFrameworkCoreSqlServerModule)`, 添加 `typeof(AbpEntityFrameworkCorePostgreSqlModule)` (或者替换 `using Volo.Abp.EntityFrameworkCore.SqlServer;` 为 `using Volo.Abp.EntityFrameworkCore.PostgreSql;`). -![postgresql-delete-initial-migrations](images/postgresql-delete-initial-migrations.png) +## UsePostgreSql() -#### 生成生成迁移并更新数据库 +查找你的解决方案中 `UseSqlServer()`调用,替换为 `UsePostgreSql()`. 检查下列文件: -设置正确的启动项目 (通常是Web项目), -打开 **程序包管理器控制台** (工具 -> Nuget包管理器 -> 程序包管理器控制台), 选择 `Acme.BookStore.EntityFrameworkCore.DbMigrations` 做为 **默认项目** 并执行以下命令: +* `.EntityFrameworkCore` 项目中的*YourProjectName*EntityFrameworkCoreModule.cs. +* `.EntityFrameworkCore` 项目中的*YourProjectName*MigrationsDbContextFactory.cs. -运行 `Add-Migration` 命令. -```` -PM> Add-Migration Initial -```` +> 根据你的解决方案的结构,你可能发现更多需要改变代码的文件. -然后执行 `Update-Database` 执行更新数据库: +## 更改连接字符串 -```` -PM> Update-Database -```` +PostgreSql连接字符串与SQL Server连接字符串不同. 所以检查你的解决方案中所有的 `appsettings.json` 文件,更改其中的连接字符串. 有关PostgreSql连接字符串选项的详细内容请参见[connectionstrings.com](https://www.connectionstrings.com/postgresql/). -![postgresql-update-database](images/postgresql-update-database.png) +通常需要更改 `.DbMigrator` 和 `.Web` 项目里面的 `appsettings.json` ,但它取决于你的解决方案结构. + +## 重新生成迁移 + +启动模板使用[Entity Framework Core的Code First迁移](https://docs.microsoft.com/zh-cn/ef/core/managing-schemas/migrations/). EF Core迁移取决于所选的DBMS提供程序. 因此更改DBMS提供程序会导致迁移失败. + +* 删除 `.EntityFrameworkCore.DbMigrations` 项目下的Migrations文件夹,并重新生成解决方案. +* 在包管理控制台中运行 `Add-Migration "Initial"`(在解决方案资源管理器选择 `.DbMigrator` (或 `.Web`) 做为启动项目并且选择 `.EntityFrameworkCore.DbMigrations` 做为默认项目). + +这将创建一个配置所有数据库对象(表)的数据库迁移. + +运行 `.DbMigrator` 项目创建数据库和初始种子数据. + +## 运行应用程序 + +它已准备就绪, 只需要运行该应用程序与享受编码. \ No newline at end of file diff --git a/docs/zh-Hans/Entity-Framework-Core-SQLite.md b/docs/zh-Hans/Entity-Framework-Core-SQLite.md new file mode 100644 index 0000000000..4b8e009fe4 --- /dev/null +++ b/docs/zh-Hans/Entity-Framework-Core-SQLite.md @@ -0,0 +1,41 @@ +# 切换到EF Core SQLite提供程序 + +本文介绍如何将预配置为SqlServer提供程序的 **[应用程序启动模板](Startup-Templates/Application.md)** 切换到 **SQLite** 数据库提供程序. + +## 替换Volo.Abp.EntityFrameworkCore.SqlServer包 + +解决方案中的 `.EntityFrameworkCore` 项目依赖于 [Volo.Abp.EntityFrameworkCore.SqlServer](https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore.SqlServer) NuGet包. 删除这个包并且添加相同版本的 [Volo.Abp.EntityFrameworkCore.SQLite](https://www.nuget.org/packages/Volo.Abp.EntityFrameworkCore.SQLite) 包. + +## 替换模块依赖项 + +在 `.EntityFrameworkCore` 项目中找到 **YourProjectName*EntityFrameworkCoreModule** 类, 删除 `DependsOn` attribute 上的`typeof(AbpEntityFrameworkCoreSqlServerModule)`, 添加 `typeof(AbpEntityFrameworkCoreSqliteModule)` (或者替换 `using Volo.Abp.EntityFrameworkCore.SqlServer;` 为 `using Volo.Abp.EntityFrameworkCore.Sqlite;`). + +## UseSqlite() + +查找你的解决方案中 `UseSqlServer()`调用,替换为 `UseSqlite()`. 检查下列文件: + +* `.EntityFrameworkCore` 项目中的*YourProjectName*EntityFrameworkCoreModule.cs. +* `.EntityFrameworkCore` 项目中的*YourProjectName*MigrationsDbContextFactory.cs. + +> 根据你的解决方案的结构,你可能发现更多需要改变代码的文件. + +## 更改连接字符串 + +SQLite连接字符串与SQL Server连接字符串不同. 所以检查你的解决方案中所有的 `appsettings.json` 文件,更改其中的连接字符串. 有关SQLite连接字符串选项的详细内容请参见[connectionstrings.com](https://www.connectionstrings.com/sqlite/). + +通常需要更改 `.DbMigrator` 和 `.Web` 项目里面的 `appsettings.json` ,但它取决于你的解决方案结构. + +## 重新生成迁移 + +启动模板使用[Entity Framework Core的Code First迁移](https://docs.microsoft.com/zh-cn/ef/core/managing-schemas/migrations/). EF Core迁移取决于所选的DBMS提供程序. 因此更改DBMS提供程序会导致迁移失败. + +* 删除 `.EntityFrameworkCore.DbMigrations` 项目下的Migrations文件夹,并重新生成解决方案. +* 在包管理控制台中运行 `Add-Migration "Initial"`(在解决方案资源管理器选择 `.DbMigrator` (或 `.Web`) 做为启动项目并且选择 `.EntityFrameworkCore.DbMigrations` 做为默认项目). + +这将创建一个配置所有数据库对象(表)的数据库迁移. + +运行 `.DbMigrator` 项目创建数据库和初始种子数据. + +## 运行应用程序 + +它已准备就绪, 只需要运行该应用程序与享受编码. \ No newline at end of file diff --git a/docs/zh-Hans/Entity-Framework-Core.md b/docs/zh-Hans/Entity-Framework-Core.md index 6a7f69c2aa..b70630e38f 100644 --- a/docs/zh-Hans/Entity-Framework-Core.md +++ b/docs/zh-Hans/Entity-Framework-Core.md @@ -1,8 +1,8 @@ -## Entity Framework Core 集成 +# Entity Framework Core 集成 本文介绍了如何将EF Core作为ORM提供程序集成到基于ABP的应用程序以及如何对其进行配置. -### 安装 +## 安装 `Volo.Abp.EntityFrameworkCore` 是EF Core 集成的主要nuget包. 将其安装到你的项目中(在分层应用程序中适用于 数据访问/基础设施层): @@ -26,7 +26,22 @@ namespace MyCompany.MyProject } ```` -### 创建 DbContext +> 注: 你可以直接下载预装EF Core的[启动模板](https://abp.io/Templates). + +### 数据库管理系统选择 + +EF Core支持多种数据库管理系统([查看全部](https://docs.microsoft.com/en-us/ef/core/providers/)). ABP框架和本文档不依赖于任何特定的DBMS. + +如果要创建一个可重用的库,应避免依赖于特定的DBMS包.但在最终的应用程序中,始终会选择一个DBMS. + +ABP框架为一些常见的DBMS提供了集成包,使配置变得更加简单. [启动模板](Startup-Templates/Index.md)附带**预先配置的SQL Server (localdb)**.请参阅以下文档,了解如何配置其他DBMS提供程序: + +* [MySQL](Entity-Framework-Core-MySQL.md) +* [PostgreSQL](Entity-Framework-Core-PostgreSQL.md) +* [SQLite](Entity-Framework-Core-SQLite.md) +* [Others](Entity-Framework-Core-Other-DBMS.md) + +## 创建 DbContext 你可以平常一样创建DbContext,它需要继承自 `AbpDbContext`. 如下所示: @@ -48,7 +63,22 @@ namespace MyCompany.MyProject } ```` -### 将DbContext注册到依赖注入 +### 配置连接字符串选择 + +如果你的应用程序有多个数据库,你可以使用 `connectionStringName]` Attribute为你的DbContext配置连接字符串名称. +例: + +```csharp +[ConnectionStringName("MySecondConnString")] +public class MyDbContext : AbpDbContext +{ + +} +``` + +如果不进行配置,则使用`Default`连接字符串. 如果你配置特定的连接字符串的名称,但在应用程序配置中没有定义这个连接字符串名称,那么它会回退到`Default`连接字符串(参阅[连接字符串文档](Connection-Strings.md)了解更多信息). + +## 将DbContext注册到依赖注入 在module中的ConfigureServices方法使用 `AddAbpDbContext` 在[依赖注入](Dependency-Injection.md)系统注册DbContext类. @@ -72,7 +102,7 @@ namespace MyCompany.MyProject } ```` -#### 添加默认仓储 +### 添加默认仓储 ABP会自动为DbContext中的实体创建[默认仓储](Repositories.md). 需要在注册的时使用options添加`AddDefaultRepositories()`: @@ -151,7 +181,7 @@ public interface IBookRepository : IRepository } ```` -你通常希望从IRepository派生以继承标准存储库方法. 然而,你没有必要这样做. 仓储接口在分层应用程序的领域层中定义,它在数据访问/基础设施层([启动模板](https://cn.abp.io/Templates)中的`EntityFrameworkCore`项目)中实现 +你通常希望从IRepository派生以继承标准存储库方法. 然而,你没有必要这样做. 仓储接口在分层应用程序的领域层中定义,它在数据访问/基础设施层([启动模板](https://abp.io/Templates)中的`EntityFrameworkCore`项目)中实现 IBookRepository接口的实现示例: @@ -165,7 +195,7 @@ public class BookRepository : EfCoreRepository, public async Task DeleteBooksByType(BookType type) { - await DbContext.Database.ExecuteSqlCommandAsync( + await DbContext.Database.ExecuteSqlRawAsync( $"DELETE FROM Books WHERE Type = {(int)type}" ); } @@ -174,7 +204,7 @@ public class BookRepository : EfCoreRepository, 现在可以在需要时[注入](Dependency-Injection.md)`IBookRepository`并使用`DeleteBooksByType`方法. -##### 覆盖默认通用仓储 +#### 覆盖默认通用仓储 即使创建了自定义仓储,仍可以注入使用默认通用仓储(在本例中是 `IRepository`). 默认仓储实现不会使用你创建的自定义仓储类. @@ -200,7 +230,7 @@ public override async Task DeleteAsync( } ```` -#### 访问 EF Core API +### 访问 EF Core API 大多数情况下应该隐藏仓储后面的EF Core API(这也是仓储的设计目地). 但是如果想要通过仓储访问DbContext实现,则可以使用`GetDbContext()`或`GetDbSet()`扩展方法. 例: @@ -226,9 +256,9 @@ public class BookService > 要点: 你必须在使用`DbContext`的项目里引用`Volo.Abp.EntityFrameworkCore`包. 这会破坏封装,但在这种情况下,这就是你需要的. -#### 高级主题 +### 高级主题 -##### 设置默认仓储类 +#### 设置默认仓储类 默认的通用仓储的默认实现是`EfCoreRepository`类,你可以创建自己的实现,并将其做为默认实现 @@ -273,7 +303,7 @@ context.Services.AddAbpDbContext(options => }); ``` -#### 为默认仓储设置Base DbContext类或接口 +### 为默认仓储设置Base DbContext类或接口 如果你的DbContext继承了另外一个DbContext或实现了一个接口,你可以使用这个基类或接口作为默认仓储的DbContext. 例: @@ -305,7 +335,7 @@ public class BookRepository : EfCoreRepository, 使用DbContext接口的一个优点是它可以被其他实现替换. -#### 替换其他仓储 +### 替换其他仓储 正确定义并使用DbContext接口后,任何其他实现都可以使用以下ReplaceDbContext options 替换它: @@ -317,4 +347,4 @@ context.Services.AddAbpDbContext(options => }); ```` -在这个例子中,`OtherDbContext`实现了`IBookStoreDbContext`. 此功能允许你在开发时使用多个DbContext(每个模块一个),但在运行时可以使用单个DbContext(实现所有DbContext的所有接口). \ No newline at end of file +在这个例子中,`OtherDbContext`实现了`IBookStoreDbContext`. 此功能允许你在开发时使用多个DbContext(每个模块一个),但在运行时可以使用单个DbContext(实现所有DbContext的所有接口). diff --git a/docs/zh-Hans/FluentValidation.md b/docs/zh-Hans/FluentValidation.md new file mode 100644 index 0000000000..265a2cc2ca --- /dev/null +++ b/docs/zh-Hans/FluentValidation.md @@ -0,0 +1,59 @@ +# FluentValidation 集成 + +ABP[验证](Validation.md)基础设施是可扩展的. [Volo.Abp.FluentValidation](https://www.nuget.org/packages/Volo.Abp.FluentValidation) NuGet 包扩展了验证系统使其与[FluentValidation](https://fluentvalidation.net/)库一起工作. + +## 安装 + +建议使用[ABP CLI](CLI.md)安装包. + +### 使用ABP CLI + +在项目(.csproj文件)的文件夹中打开命令行窗口并输入以下命令: + +````bash +abp add-package Volo.Abp.FluentValidation +```` + +### 手动安装 + +如果你想手动安装; + +1. 添加 [Volo.Abp.FluentValidation](https://www.nuget.org/packages/Volo.Abp.FluentValidation) NuGet包到你的项目: + + ```` + Install-Package Volo.Abp.FluentValidation + ```` + +2. 添加 `AbpFluentValidationModule` 到你的模块的依赖列表: + +````csharp +[DependsOn( + //...other dependencies + typeof(AbpFluentValidationModule) //Add the FluentValidation module + )] +public class YourModule : AbpModule +{ +} +```` + +## 使用 FluentValidation + +按照 [FluentValidation文档](https://fluentvalidation.net/) 创建验证器类. +例如: + +````csharp +public class CreateUpdateBookDtoValidator : AbstractValidator +{ + public CreateUpdateBookDtoValidator() + { + RuleFor(x => x.Name).Length(3, 10); + RuleFor(x => x.Price).ExclusiveBetween(0.0f, 999.0f); + } +} +```` + +ABP会自动找到这个类并在对象验证时与 `CreateUpdateBookDto` 关联. + +## 另请参阅 + +* [验证系统](Validation.md) \ No newline at end of file diff --git a/docs/zh-Hans/Getting-Started-AspNetCore-MVC-Template.md b/docs/zh-Hans/Getting-Started-AspNetCore-MVC-Template.md index 4d6695c79b..d65573d9db 100644 --- a/docs/zh-Hans/Getting-Started-AspNetCore-MVC-Template.md +++ b/docs/zh-Hans/Getting-Started-AspNetCore-MVC-Template.md @@ -2,7 +2,7 @@ ### 创建新项目 -本教程使用 **ABP CLI** 创建一个新项目. 更多选项, 请参阅[入门](https://cn.abp.io/get-started)页面. +本教程使用 **ABP CLI** 创建一个新项目. 更多选项, 请参阅[入门](https://abp.io/get-started)页面. 如果你之前未安装,请使用命令行安装ABP CLI: diff --git a/docs/zh-Hans/Logging.md b/docs/zh-Hans/Logging.md new file mode 100644 index 0000000000..247609fb41 --- /dev/null +++ b/docs/zh-Hans/Logging.md @@ -0,0 +1,5 @@ +# 日志 + +ABP框架没有实现任何日志基础设施. 它使用[ASP.NET Core日志系统](https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/logging). + +> .NET Core 的日志系统是独立于ASP.NET Core的,它可以在任何类型的应用程序中使用. \ No newline at end of file diff --git a/docs/zh-Hans/Microservice-Architecture.md b/docs/zh-Hans/Microservice-Architecture.md index 166591e779..3b96cdc7f6 100644 --- a/docs/zh-Hans/Microservice-Architecture.md +++ b/docs/zh-Hans/Microservice-Architecture.md @@ -23,7 +23,7 @@ ABP框架的主要目标之一就是提供**便捷的基础设施来创建微服 然而开发一个良好的模块化应用程序不是那么简单,因为很难像微服务那样**保持模块之间的隔离** (参阅 [Stefan Tilkov的文章](https://martinfowler.com/articles/dont-start-monolith.html)). 微服务架构会自然的让你开发隔离的服务,但是在模块化的单体应用程序中,模块很容易彼此紧密耦合并设计出**弱模块边界**和API约定. -ABP可以帮助你,它提供了与**与微服务兼容的严格模块架构** 在这个架构中你的模块被分割成多个层/项目,在自己的VS解决方案中进行开发,该解决方案完成独立于其它模块. 这种方式开发的模块是一种天然的微服务,但是它可以很容易的插入到单体应用程序中. 请参阅**微服务优先的模块设计**的[模块开发最佳实践指南](Best-Practices/Index.md). 所有[标准的ABP模块](https://github.com/abpframework/abp/tree/master/modules)都是基于本指南开发的. 因此你可以将这些模块嵌入到单体解决方案中使用它们,也可以单独部署通过远程API调用. 它们可以共享一个数据库,也可以通过简单配置使用自己的数据库. +ABP可以帮助你,它提供了与**与微服务兼容的严格模块架构** 在这个架构中你的模块被分割成多个层/项目,在自己的VS解决方案中进行开发,该解决方案完全独立于其它模块. 这种方式开发的模块是一种天然的微服务,但是它可以很容易的插入到单体应用程序中. 请参阅**微服务优先的模块设计**的[模块开发最佳实践指南](Best-Practices/Index.md). 所有[标准的ABP模块](https://github.com/abpframework/abp/tree/master/modules)都是基于本指南开发的. 因此你可以将这些模块嵌入到单体解决方案中使用它们,也可以单独部署通过远程API调用. 它们可以共享一个数据库,也可以通过简单配置使用自己的数据库. ## 微服务解决方案示例 diff --git a/docs/zh-Hans/Modules/Audit-Logging.md b/docs/zh-Hans/Modules/Audit-Logging.md new file mode 100644 index 0000000000..0748b27160 --- /dev/null +++ b/docs/zh-Hans/Modules/Audit-Logging.md @@ -0,0 +1,7 @@ +# 审计日志模块 + +审计日志模块实现了 `IAuditingStore` 将审计日志对象保存到数据库中. + +> [启动模板](../Startup-Templates/Index.md)已经安装并配置了审计日志模块,所以你不需要手动安装到你的应用程序. + +参阅[审计日志系统](../Audit-Logging.md)文档了解更多关于审计日志的内容. \ No newline at end of file diff --git a/docs/zh-Hans/Modules/Docs.md b/docs/zh-Hans/Modules/Docs.md index cfe287082b..f2a92334fb 100644 --- a/docs/zh-Hans/Modules/Docs.md +++ b/docs/zh-Hans/Modules/Docs.md @@ -14,21 +14,19 @@ ### 版本 -当你使用GitHub存储文档时,文档模块支持多版本. 如果你的文档具有多个版本, UI上有一个组合框,用于切换版本. 如果你选择使用文件系统存储文档, 那么它不支持多版本. +当你使用GitHub存储文档时,文档模块支持多版本. 如果你的文档具有多个版本, UI上有一个组合框,用于切换版本. 如果你选择使用文件系统存储文档, 那么它不支持多版本. -ABP框架的[文档](https://abp.io/documents/)也是使用的此模块. +ABP框架的[文档](docs.abp.io)也是使用的此模块. > 文档模块遵循 [模块化架构最佳实践](../Best-Practices/Module-Architecture.md) 指南. - - ## 安装 ### 1- 下载 -如果你没有现有的ABP项目, 这个步骤向你展示如何在[abp.io](https://cn.abp.io)创建一个新项目并添加文档模块. 如果你本地已经有了一个ABP项目, 那么你可以跳过这一步. +如果你没有现有的ABP项目, 这个步骤向你展示如何在[abp.io](https://abp.io)创建一个新项目并添加文档模块. 如果你本地已经有了一个ABP项目, 那么你可以跳过这一步. -打开 https://cn.abp.io/Templates. 输入项目名称为 `Acme.MyProject`, 选择 `ASP.NET Core Mvc Application` 和选择 `Entity Framework Core` 做为数据库提供者. +打开 https://abp.io/Templates. 输入项目名称为 `Acme.MyProject`, 选择 `ASP.NET Core Mvc Application` 和选择 `Entity Framework Core` 做为数据库提供者. 请注意,本文档包含了 `Entity Framework Core` 提供者 不过你也可以选择 `MongoDB` 做为数据库提供者. @@ -36,7 +34,7 @@ ABP框架的[文档](https://abp.io/documents/)也是使用的此模块. ### 2- 运行这个空项目 -下载项目后, 解压压缩文档并且打开 `Acme.MyProject.sln`. 你可以看到这个解决方案包含了 `Application`, `Domain `, `EntityFrameworkCore` 和 `Web` 项目. 右键选择 `Acme.MyProject.Web` 项目**设置为启动项目**. +下载项目后, 解压压缩文档并且打开 `Acme.MyProject.sln`. 你可以看到这个解决方案包含了 `Application`, `Domain`, `EntityFrameworkCore` 和 `Web` 项目. 右键选择 `Acme.MyProject.Web` 项目**设置为启动项目**. ![创建新项目](../images/docs-module_solution-explorer.png) @@ -67,31 +65,32 @@ ABP框架的[文档](https://abp.io/documents/)也是使用的此模块. ```csharp ``` + * [Volo.Docs.EntityFrameworkCore](https://www.nuget.org/packages/Volo.Docs.EntityFrameworkCore/) 需要安装到 `Acme.MyProject.EntityFrameworkCore` 项目. - - 修改 `Acme.MyProject.EntityFrameworkCore.csproj`文件并且添加以下行. 需要注意它要设置(v0.9.0)为Latest版本. + * 修改 `Acme.MyProject.EntityFrameworkCore.csproj` 文件并且添加以下行. 需要注意它要设置(v0.9.0)为Latest版本. ```csharp ``` + * [Volo.Docs.Application](https://www.nuget.org/packages/Volo.Docs.Application/) 需要安装到 `Acme.MyProject.Application` 项目. - * 修改 `Acme.MyProject.Application.csproj`文件并且添加以下行. 需要注意它要设置(v0.9.0)为Latest版本. + * 修改 `Acme.MyProject.Application.csproj` 文件并且添加以下行. 需要注意它要设置(v0.9.0)为Latest版本. ```csharp ``` -* [Volo.Docs.Web ](https://www.nuget.org/packages/Volo.Docs.Web/) 需要安装到 `Acme.MyProject.Web` 项目. - - 修改 `Acme.MyProject.Web.csproj`文件并且添加以下行. 需要注意它要设置(v0.9.0)为Latest版本. +* [Volo.Docs.Web](https://www.nuget.org/packages/Volo.Docs.Web/) 需要安装到 `Acme.MyProject.Web` 项目. + + * 修改 `Acme.MyProject.Web.csproj` 文件并且添加以下行. 需要注意它要设置(v0.9.0)为Latest版本. ```csharp ``` - - -### 3- 添加模块添加 +### 3- 添加模块依赖 一个ABP模块必须声明 `[DependsOn]` attribute 如果它依赖于另一个模块. 每个模块都必须在相关的项目的`[DependsOn]`Attribute 中添加. @@ -155,7 +154,6 @@ ABP框架的[文档](https://abp.io/documents/)也是使用的此模块. } ``` - * 打开 `MyProjectWebModule.cs`并且添加 `typeof(DocsWebModule)` 如下所示; ```csharp @@ -174,15 +172,13 @@ ABP框架的[文档](https://abp.io/documents/)也是使用的此模块. } ``` - - ### 4- 数据库集成 #### 4.1- Entity Framework 集成 如果你选择了Entity Framework 做为数据库供应者,你需要在DbContext中配置文档模块. 做以下操作; -- 打开 `MyProjectDbContext.cs` 并且添加 `modelBuilder.ConfigureDocs()` 到 `OnModelCreating()` 方法中 +* 打开 `MyProjectDbContext.cs` 并且添加 `modelBuilder.ConfigureDocs()` 到 `OnModelCreating()` 方法中 ```csharp [ConnectionStringName("Default")] @@ -195,7 +191,7 @@ ABP框架的[文档](https://abp.io/documents/)也是使用的此模块. } protected override void OnModelCreating(ModelBuilder modelBuilder) - { + { //... modelBuilder.ConfigureDocs(); } @@ -218,7 +214,6 @@ ABP框架的[文档](https://abp.io/documents/)也是使用的此模块. 最后你可以查看数据库中创建的新表,例如你可以看到 `DocsProjects` 表已经添加到数据库中. - ### 5- 链接文档模块 文档模块的默认路由是; @@ -262,7 +257,7 @@ ABP框架的[文档](https://abp.io/documents/)也是使用的此模块. "texts": { "Menu:Home": "首页", "Welcome": "欢迎", - "LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 cn.abp.io.", + "LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 abp.io.", "Menu:Docs": "文档" } } @@ -326,7 +321,7 @@ There are no projects yet! 对于 `SQL` 数据库,你可以使用下面的 `T-SQL` 命令将指定的示例插入到 `DocsProjects` 表中: ```mssql -INSERT [dbo].[DocsProjects] ([Id], [Name], [ShortName], [Format], [DefaultDocumentName], [NavigationDocumentName], [MinimumVersion], [DocumentStoreType], [ExtraProperties], [MainWebsiteUrl], [LatestVersionBranchName]) VALUES (N'12f21123-e08e-4f15-bedb-ae0b2d939658', N'ABP framework (GitHub)', N'abp', N'md', N'Index', N'docs-nav.json', NULL, N'GitHub', N'{"GitHubRootUrl":"https://github.com/abpframework/abp/tree/{version}/docs/zh-Hans/","GitHubAccessToken":"***"}', N'/', N'master') +INSERT [dbo].[DocsProjects] ([Id], [Name], [ShortName], [Format], [DefaultDocumentName], [NavigationDocumentName], [MinimumVersion], [DocumentStoreType], [ExtraProperties], [MainWebsiteUrl], [LatestVersionBranchName], [ParametersDocumentName]) VALUES (N'12f21123-e08e-4f15-bedb-ae0b2d939658', N'ABP framework (GitHub)', N'abp', N'md', N'Index', N'docs-nav.json', NULL, N'GitHub', N'{"GitHubRootUrl":"https://github.com/abpframework/abp/tree/{version}/docs","GitHubAccessToken":"***"}', N'/', N'master', N'') ``` 请注意,`GitHubAccessToken` 被屏蔽了.它是一个私人令牌,你必须获得自己的令牌并替换 `***` 字符串. @@ -352,10 +347,10 @@ INSERT [dbo].[DocsProjects] ([Id], [Name], [ShortName], [Format], [DefaultDocume - ExtraProperties: ```json - {"Path":"C:\\Github\\abp\\docs\\zh-Hans"} + {"Path":"C:\\Github\\abp\\docs"} ``` - 请注意 `Path` 必须使用本地docs目录替换. 你可以从https://github.com/abpframework/abp/tree/master/docs/zh-hans获取ABP Framework的文档并且复制到该目录 `C:\\Github\\abp\\docs\\zh-Hans` 使其正常工作. + 请注意 `Path` 必须使用本地docs目录替换. 你可以从https://github.com/abpframework/abp/tree/master/docs获取ABP Framework的文档并且复制到该目录 `C:\\Github\\abp\\docs` 使其正常工作. - MainWebsiteUrl: `/` @@ -364,7 +359,7 @@ INSERT [dbo].[DocsProjects] ([Id], [Name], [ShortName], [Format], [DefaultDocume 对于 `SQL` 数据库,你可以使用下面的 `T-SQL` 命令将指定的示例插入到 `DocsProjects` 表中: ```mssql -INSERT [dbo].[DocsProjects] ([Id], [Name], [ShortName], [Format], [DefaultDocumentName], [NavigationDocumentName], [MinimumVersion], [DocumentStoreType], [ExtraProperties], [MainWebsiteUrl], [LatestVersionBranchName]) VALUES (N'12f21123-e08e-4f15-bedb-ae0b2d939659', N'ABP framework (FileSystem)', N'abp', N'md', N'Index', N'docs-nav.json', NULL, N'FileSystem', N'{"Path":"C:\\Github\\abp\\docs\\zh-Hans"}', N'/', NULL) +INSERT [dbo].[DocsProjects] ([Id], [Name], [ShortName], [Format], [DefaultDocumentName], [NavigationDocumentName], [MinimumVersion], [DocumentStoreType], [ExtraProperties], [MainWebsiteUrl], [LatestVersionBranchName], [ParametersDocumentName]) VALUES (N'12f21123-e08e-4f15-bedb-ae0b2d939659', N'ABP framework (FileSystem)', N'abp', N'md', N'Index', N'docs-nav.json', NULL, N'FileSystem', N'{"Path":"C:\\Github\\abp\\docs"}', N'/', NULL, N'') ``` 添加上面的一个示例项目后运行该应用程序. 在菜单中你会看到`文档` 链接,点击菜单链接打开文档页面. @@ -408,6 +403,101 @@ public class Person [https://github.com/abpframework/abp/blob/master/docs/zh-Hans/](https://github.com/abpframework/abp/blob/master/docs/zh-Hans/) +#### 有条件的部分功能(使用Scriban) + +文档模块使用[Scriban]()有条件的显示或隐藏文档的某些部分. 使用该功能你需要为每一种语言创建一个JSON文件做为**参数文档**. 它包含所有键值以及它们的显示名称. + +例如 [en/docs-params.json](https://github.com/abpio/abp-commercial-docs/blob/master/en/docs-params.json): + +```json +{ + "parameters": [{ + "name": "UI", + "displayName": "UI", + "values": { + "MVC": "MVC / Razor Pages", + "NG": "Angular" + } + }, + { + "name": "DB", + "displayName": "Database", + "values": { + "EF": "Entity Framework Core", + "Mongo": "MongoDB" + } + }, + { + "name": "Tiered", + "displayName": "Tiered", + "values": { + "No": "Not Tiered", + "Yes": "Tiered" + } + }] +} +``` + +因为并不是项目中的每个文档都有章节或者不需要所有的参数,你必须声明哪些参数将用于对文档进行分段,在文档的任何地方都可以使用JSON块. + +例如 [Getting-Started.md](https://github.com/abpio/abp-commercial-docs/blob/master/en/getting-started.md): + +``` +..... + +​````json +//[doc-params] +{ + "UI": ["MVC","NG"], + "DB": ["EF", "Mongo"], + "Tiered": ["Yes", "No"] +} +​```` + +........ +``` + +这个部分会在渲染时自动删除.前提是这些键值必须与**参数文档**中的键值匹配. + +![Interface](../images/docs-section-ui.png) + +现在你可以使用 **Scriban** 语法在文档中创建章节. + +示例 : + +```` +{{ if UI == "NG" }} + +* `-u` argument specifies the UI framework, `angular` in this case. + +{{ end }} + +{{ if DB == "Mongo" }} + +* `-d` argument specifies the database provider, `mongodb` in this case. + +{{ end }} + +{{ if Tiered == "Yes" }} + +* `--tiered` argument is used to create N-tiered solution where authentication server, UI and API layers are physically separated. + +{{ end }} + +```` + +还可以在文本中使用变量,在其键中添加 **_Value** 后缀: + +```` +This document assumes that you prefer to use **{{ UI_Value }}** as the UI framework and **{{ DB_Value }}** as the database provider. +```` + +如果你想要得到的当前文档的语言或版本,可以使用预定义的 **Document_Language_Code** 和 **DOCUMENT_VERSION** 键(这对于创建重定向到另一个地区中另一个文档系统的链接很有用). + +------ + +**重要提示**: Scriban 的语法是 "{{" and "}}". 如果要在文档(如Angular文档)中使用转义,则必须使用转义块. 参阅 [Scriban文档]( ) 了解更多信息. + ### 8- 创建文档导航 导航文档是文档页面的主菜单. 它位于页面的左侧,是一个`JSON` 文件. 请查看以下示例导航文档以了解结构. @@ -464,4 +554,8 @@ public class Person ![Navigation menu](../images/docs-module_download-sample-navigation-menu.png) -最后,为您的项目添加了一个新的Docs模块, 该模块由GitHub提供. \ No newline at end of file +最后,为您的项目添加了一个新的Docs模块, 该模块由GitHub提供. + +## 下一步 + +文档模块也可以做为独立的应用程序. 查看 [VoloDocs](../Apps/VoloDocs). \ No newline at end of file diff --git a/docs/zh-Hans/Modules/Index.md b/docs/zh-Hans/Modules/Index.md index 8e5edf35b6..9b44967c53 100644 --- a/docs/zh-Hans/Modules/Index.md +++ b/docs/zh-Hans/Modules/Index.md @@ -11,16 +11,20 @@ ABP是一个 **模块化的应用程序框架** 由十多个 **nuget packages** 有一些由ABP社区开发和维护的 **开源免费** 的应用程序模块: -* **Account**: 用于用户登录/注册应用程序. -* **Audit Logging**: 用于将审计日志持久化到数据库. +* **Account**: 提供账户管理UI,并允许用户登录/注册应用程序. +* [**Audit Logging**](Audit-Logging.md): 用于将审计日志持久化到数据库. * **Background Jobs**: 用于在使用默认后台作业管理器时保存后台作业. -* **Blogging**: 用于创建精美的博客. ABP的[博客](https://abp.io/blog/abp/) 就使用了此模块. +* **Blogging**: 用于创建精美的博客. ABP的[博客](https://blog.abp.io/) 就使用了此模块. * [**Docs**](Docs.md): 用于创建技术文档页面. ABP的[文档](https://abp.io/documents/) 就使用了此模块. -* **Identity**: 用于管理角色,用户和他们的权限. +* **Identity**: 基于Microsoft Identity管理角色,用户和他们的权限. * **Identity Server**: 集成了IdentityServer4. * **Permission Management**: 用于保存权限. * **Setting Management**: 用于保存设置. -* **Tenant Management**: 用于管理[多租户](../Multi-Tenancy.md)应用程序的租户. -* **Users**: 用于抽象用户, 因此其他模块可以依赖此模块而不是Identity模块. +* **Tenant Management**: 管理[多租户](../Multi-Tenancy.md)应用程序的租户. +* **Users**: 抽象用户, 因此其他模块可以依赖此模块而不是Identity模块. -模块化文档正在编写中. 请参阅[这个仓库](https://github.com/abpframework/abp/tree/master/modules)获取所有模块的源代码. \ No newline at end of file +模块化文档正在编写中. 请参阅[这个仓库](https://github.com/abpframework/abp/tree/master/modules)获取所有模块的源代码. + +## 商业应用模块 + +[ABP商业](https://commercial.abp.io/)许可证在ABP框架上提供了额外的预构建应用程序模块. 参见ABP商业版提供的[模块列表](https://commercial.abp.io/module). \ No newline at end of file diff --git a/docs/zh-Hans/Modules/Setting-Management.md b/docs/zh-Hans/Modules/Setting-Management.md index 97e8c2f3e1..fd87dd734c 100644 --- a/docs/zh-Hans/Modules/Setting-Management.md +++ b/docs/zh-Hans/Modules/Setting-Management.md @@ -1,3 +1,86 @@ -# Setting Management Module +# 设置管理模块 -TODO \ No newline at end of file +设置管理模块实现了 `ISettingStore` (参阅 [设置系统](../Settings.md)) 将设置值存储在数据库中, 并提供 `ISettingManager` 管理 (更改) 数据库中设置值的功能. + +> [启动模板](../Startup-Templates/Index.md)默认安装并配置了设置管理模块. 大部分情况下你不需要手动的添加该到模块到应用程序中. + +## ISettingManager + +`ISettingManager` 用于获取和设定设置值. 示例: + +````csharp +using System; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.SettingManagement; + +namespace Demo +{ + public class MyService : ITransientDependency + { + private readonly ISettingManager _settingManager; + + //Inject ISettingManager service + public MyService(ISettingManager settingManager) + { + _settingManager = settingManager; + } + + public async Task FooAsync() + { + Guid user1Id = ...; + Guid tenant1Id = ...; + + //Get/set a setting value for the current user or the specified user + + string layoutType1 = + await _settingManager.GetOrNullForCurrentUserAsync("App.UI.LayoutType"); + string layoutType2 = + await _settingManager.GetOrNullForUserAsync("App.UI.LayoutType", user1Id); + + await _settingManager.SetForCurrentUserAsync("App.UI.LayoutType", "LeftMenu"); + await _settingManager.SetForUserAsync(user1Id, "App.UI.LayoutType", "LeftMenu"); + + //Get/set a setting value for the current tenant or the specified tenant + + string layoutType3 = + await _settingManager.GetOrNullForCurrentTenantAsync("App.UI.LayoutType"); + string layoutType4 = + await _settingManager.GetOrNullForTenantAsync("App.UI.LayoutType", tenant1Id); + + await _settingManager.SetForCurrentTenantAsync("App.UI.LayoutType", "LeftMenu"); + await _settingManager.SetForTenantAsync(tenant1Id, "App.UI.LayoutType", "LeftMenu"); + + //Get/set a global and default setting value + + string layoutType5 = + await _settingManager.GetOrNullGlobalAsync("App.UI.LayoutType"); + string layoutType6 = + await _settingManager.GetOrNullDefaultAsync("App.UI.LayoutType"); + + await _settingManager.SetGlobalAsync("App.UI.LayoutType", "TopMenu"); + } + } +} + +```` + +你可以从不同的设置值提供程序中(默认,全局,用户,租户...等)中获取或设定设置值. + +> 如果只需要读取设置值,建议使用 `ISettingProvider` 而不是`ISettingManager`,因为它实现了缓存并支持所有部署场景. 如果要创建设置管理UI,可以使用ISettingManager. + +### Setting Cache + +设置值缓存在 [分布式缓存](../Caching.md) 系统中. 建议始终使用 `ISettingManager` 更改设置值. + +## Setting Management Providers + +设置管理模块是可扩展的,像[设置系统](../Settings.md)一样. 你可以通过自定义设置管理提供程序进行扩展. 有5个预构建的设置管理程序程序按以下顺序注册: + +* `DefaultValueSettingManagementProvider`: 从设置定义的默认值中获取值,由于默认值是硬编码在设置定义上的,所以无法更改默认值. +* `ConfigurationSettingManagementProvider`:从 [IConfiguration 服务](../Configuration.md)中获取值. 由于无法在运行时更改配置值,所以无法更改配置值. +* `GlobalSettingManagementProvider`: 获取或设定设置的全局 (系统范围)值. +* `TenantSettingManagementProvider`: 获取或设定租户的设置值. +* `UserSettingManagementProvider`: 获取或设定用户的设置值. + +`ISettingManager` 在 `get/set` 方法中使用设置管理提供程序. 通常每个设置程序提供程序都在 `ISettingManagement` 服务上定义了模块方法 (比如用户设置管理程序提供定义了 `SetForUserAsync` 方法). \ No newline at end of file diff --git a/docs/zh-Hans/Multi-Tenancy.md b/docs/zh-Hans/Multi-Tenancy.md index 5f00c2c12c..83d190bb38 100644 --- a/docs/zh-Hans/Multi-Tenancy.md +++ b/docs/zh-Hans/Multi-Tenancy.md @@ -99,7 +99,7 @@ Volo.Abp.MultiTenancy只提供了用于确定当前租户的抽象(称为租户 ##### 自定义租户解析器 -你可以像下面这样,在你模块的ConfigureServices方法中将自定义解析器并添加到 **TenantResolveOptions**中: +你可以像下面这样,在你模块的ConfigureServices方法中将自定义解析器并添加到 **AbpTenantResolveOptions**中: ````C# using Microsoft.Extensions.DependencyInjection; @@ -113,7 +113,7 @@ namespace MyCompany.MyProject { public override void ConfigureServices(ServiceConfigurationContext context) { - Configure(options => + Configure(options => { options.TenantResolvers.Add(new MyCustomTenantResolveContributor()); }); @@ -323,7 +323,7 @@ services.Configure(options => ##### 域名租户解析器 -实际项目中,大多数情况下你想通过子域名(如mytenant1.mydomain.com)或全域名(如mytenant.com)中确定当前租户.如果是这样,你可以配置TenantResolveOptions添加一个域名租户解析器. +实际项目中,大多数情况下你想通过子域名(如mytenant1.mydomain.com)或全域名(如mytenant.com)中确定当前租户.如果是这样,你可以配置AbpTenantResolveOptions添加一个域名租户解析器. ###### 例子:添加子域名解析器 @@ -340,7 +340,7 @@ namespace MyCompany.MyProject { public override void ConfigureServices(ServiceConfigurationContext context) { - Configure(options => + Configure(options => { //子域名格式: {0}.mydomain.com (作为最高优先级解析器添加) options.TenantResolvers.Insert(0, new DomainTenantResolver("{0}.mydomain.com")); diff --git a/docs/zh-Hans/Options.md b/docs/zh-Hans/Options.md index a5206bce91..18ccd90bed 100644 --- a/docs/zh-Hans/Options.md +++ b/docs/zh-Hans/Options.md @@ -1,3 +1,121 @@ -# Options +# 选项 -TODO! +微软引入[选项模式](https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/configuration/options),它是用于配置框架服务使用的设置. 选项模式由[Microsoft.Extensions.Options](https://www.nuget.org/packages/Microsoft.Extensions.Options)NuGet包实现,除了ASP.NET Core应用,它还适用于任何类型的应用程序. + +ABP框架遵循选项模式,并定义了用于配置框架和模块的选项类(在相关功能文档中有详细的说明). + +由于[微软的文档](https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/configuration/options)详细解释了选项模式,本文中只会介绍ABP增加的一些功能. + +## 配置选项 + +通常配置选项在 `Startup` 类的 `ConfigureServices` 方法中. 但由于ABP框架提供了模块化基础设施,因此你可以在[模块](Module-Development-Basics.md)的`ConfigureServices` 方法配置选项. +例: + +````csharp +public override void ConfigureServices(ServiceConfigurationContext context) +{ + context.Services.Configure(options => + { + options.IsEnabled = false; + }); +} +```` + +* `AbpAuditingOptions` 是一个简单的类,定义了一些属性,例如这里使用的 `IsEnabled`. +* `AbpModule` 基类定义 `Configure` 方法简化代码. 你可以直接使用 `Configure<...>`,而不是`context.Services.Configure <...>`. + +如果你正在开发一个可重用的模块,你可能需要定义一个允许开发人员配置模块的选项类. 这时定义一个如下所示的普通类: + +````csharp +public class MyOptions +{ + public int Value1 { get; set; } + public bool Value2 { get; set; } +} +```` + +然后开发人员可以像上面 `AbpAuditingOptions` 示例一样配置你的选项: + +````csharp +public override void ConfigureServices(ServiceConfigurationContext context) +{ + Configure(options => + { + options.Value1 = 42; + options.Value2 = true; + }); +} +```` + +* 在本示例中,使用了简化的 `Configure<...>`方法. + +### 获取选项值 + +在你需要获得一个选项值时,将 `IOptions` 服务[注入](Dependency-Injection.md)到你的类中,使用它的 `.Value` 属性得到值. +例: + +````csharp +public class MyService : ITransientDependency +{ + private readonly MyOptions _options; + + public MyService(IOptions options) + { + _options = options.Value; //Notice the options.Value usage! + } + + public void DoIt() + { + var v1 = _options.Value1; + var v2 = _options.Value2; + } +} +```` + +阅读[微软文档](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/options)了解选择模式的所有细节. + +## 预配置 + +选项模式的限制之一是你只能解析(注入) `IOptions ` 并在依赖注入配置完成(即所有模块的`ConfigureServices`方法完成)后获取选项值. + +如果你正在开发一个模块,可能需要让开发者能够设置一些选项,并在依赖注入注册阶段使用这些选项. 你可能需要根据选项值配置其他服务或更改依赖注入的注册代码. + +对于此类情况,ABP为 `IServiceCollection` 引入了 `PreConfigure` 和 `ExecutePreConfiguredActions` 扩展方法. 该模式的工作原理如下所述。 + +1. 你的模块中定义计划选项类. 例: + +````csharp +public class MyPreOptions +{ + public bool MyValue { get; set; } +} +```` + +然后任何依赖于模块的模块类都可以在其 `PreConfigureServices` 方法中使用 `PreConfigure` 方法. +例: + +````csharp +public override void PreConfigureServices(ServiceConfigurationContext context) +{ + PreConfigure(options => + { + options.MyValue = true; + }); +} +```` + +> 多个模块可以预配置选项,并根据它们的依赖顺序覆盖选项值. + +最后在你的模块 `ConfigureServices` 方法中执行 `ExecutePreConfiguredActions` 方法来获得配置的选项值. +例: + +````csharp +public override void ConfigureServices(ServiceConfigurationContext context) +{ + var options = context.Services.ExecutePreConfiguredActions(); + if (options.MyValue) + { + //... + } +} +```` \ No newline at end of file diff --git a/docs/zh-Hans/Tutorials/AspNetCore-Mvc/Part-I.md b/docs/zh-Hans/Tutorials/AspNetCore-Mvc/Part-I.md index f9314e5030..5394890f8d 100644 --- a/docs/zh-Hans/Tutorials/AspNetCore-Mvc/Part-I.md +++ b/docs/zh-Hans/Tutorials/AspNetCore-Mvc/Part-I.md @@ -50,6 +50,18 @@ namespace Acme.BookStore public DateTime PublishDate { get; set; } public float Price { get; set; } + + protected Book() + { + } + public Book(Guid id, string name, BookType type, DateTime publishDate, float price) + :base(id) + { + Name = name; + Type = type; + PublishDate = publishDate; + Price = price; + } } } ```` @@ -349,7 +361,7 @@ successfully created the book with id: f3f03580-c1aa-d6a9-072d-39e75c69f5c7 ```` * 此代码更改了Razor View Page Model的默认继承,因此它从`BookStorePage`类(而不是`PageModel`)继承.启动模板附带的`BookStorePage`类,提供所有页面使用的一些共享属性/方法. -* 确保`IndexModel`(Index.cshtml.cs)具有`Acme.BookStore.Pages.Books`命名空间,或者在`Index.cshtml`中更新它. +* 确保`IndexModel`(Index.cshtml.cs)具有`Acme.BookStore.Web.Pages.Books`命名空间,或者在`Index.cshtml`中更新它. #### 将Books页面添加到主菜单 @@ -426,7 +438,7 @@ context.Menu.AddItem( ```` * `abp-script` [tag helper](https://docs.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/intro)用于将外部的 **脚本** 添加到页面中.它比标准的`script`标签多了很多额外的功能.它可以处理 **最小化**和 **版本**.查看[捆绑 & 压缩文档](../../AspNetCore/Bundling-Minification.md)获取更多信息. -* `abp-card` 和 `abp-table` 是为Twitter Bootstrap的[card component](http://getbootstrap.com/docs/4.1/components/card/)封装的 **tag helpers**.ABP中有很多tag helpers,可以很方便的使用大多数[bootstrap](https://getbootstrap.com/)组件.你也可以使用原生的HTML标签代替tag helpers.使用tag helper可以通过智能提示和编译时类型检查减少HTML代码并防止错误.查看[tag helpers 文档](../../AspNetCore/Tag-Helpers.md). +* `abp-card` 和 `abp-table` 是为Twitter Bootstrap的[card component](http://getbootstrap.com/docs/4.1/components/card/)封装的 **tag helpers**.ABP中有很多tag helpers,可以很方便的使用大多数[bootstrap](https://getbootstrap.com/)组件.你也可以使用原生的HTML标签代替tag helpers.使用tag helper可以通过智能提示和编译时类型检查减少HTML代码并防止错误.查看[tag helpers 文档](../../AspNetCore/Tag-Helpers/Index.md). * 你可以像上面本地化菜单一样 **本地化** 列名. #### 添加脚本文件 diff --git a/docs/zh-Hans/Tutorials/AspNetCore-Mvc/Part-II.md b/docs/zh-Hans/Tutorials/AspNetCore-Mvc/Part-II.md index dd86b5e119..2d4b344afa 100644 --- a/docs/zh-Hans/Tutorials/AspNetCore-Mvc/Part-II.md +++ b/docs/zh-Hans/Tutorials/AspNetCore-Mvc/Part-II.md @@ -421,7 +421,8 @@ $(function () { 打开`Acme.BookStore.Domain.Shared`项目中的`en.json`并添加以下行: ````json -"BookDeletionConfirmationMessage": "Are you sure to delete the book {0}?" +"BookDeletionConfirmationMessage": "Are you sure to delete the book {0}?", +"SuccessfullyDeleted": "Successfully deleted" ```` 运行程序并尝试删除一个book实体. diff --git a/docs/zh-Hans/Tutorials/AspNetCore-Mvc/Part-III.md b/docs/zh-Hans/Tutorials/AspNetCore-Mvc/Part-III.md index 5bbe0e3424..e48cf6b710 100644 --- a/docs/zh-Hans/Tutorials/AspNetCore-Mvc/Part-III.md +++ b/docs/zh-Hans/Tutorials/AspNetCore-Mvc/Part-III.md @@ -56,26 +56,12 @@ namespace Acme.BookStore public async Task SeedAsync(DataSeedContext context) { await _bookRepository.InsertAsync( - new Book - { - Id = _guidGenerator.Create(), - Name = "Test book 1", - Type = BookType.Fantastic, - PublishDate = new DateTime(2015, 05, 24), - Price = 21 - } - ); + new Book(_guidGenerator.Create(), "Test book 1", + BookType.Fantastic, new DateTime(2015, 05, 24), 21)); await _bookRepository.InsertAsync( - new Book - { - Id = _guidGenerator.Create(), - Name = "Test book 2", - Type = BookType.Science, - PublishDate = new DateTime(2014, 02, 11), - Price = 15 - } - ); + new Book(_guidGenerator.Create(), "Test book 2", + BookType.Science, new DateTime(2014, 02, 11), 15)); } } } diff --git a/docs/zh-Hans/Validation.md b/docs/zh-Hans/Validation.md index c2b128f0bc..8aa81351ec 100644 --- a/docs/zh-Hans/Validation.md +++ b/docs/zh-Hans/Validation.md @@ -1,3 +1,163 @@ -## Validation +# 验证 -待添加 +验证系统用于验证对于特定的控制器操作或服务的方法的用户输入或客户端请求. + +ABP与ASP.NET Core模型验证系统系统兼容,[模型验证文档](https://docs.microsoft.com/en-us/aspnet/core/mvc/models/validation)中的内容对于基于ABP应用程序同样有效.所以本文主要集中在ABP特征,而不是重复微软文档. + +ABP增加了以下优点: + +* 定义 `IValidationEnabled` 向任意类添加自动验证. 所有的[应用服务](Application-Services.md)都实现了该接口,所以它们会被自动验证. +* 自动将数据注解属性的验证错误信息本地化. +* 提供可扩展的服务来验证方法调用或对象的状态。 +* 提供[FluentValidation](https://fluentvalidation.net/)的集成. + +## 验证DTO + +本节简要介绍了验证系统.有关详细信息请参阅[ASP.NET Core验证文档](https://docs.microsoft.com/zh-cn/aspnet/core/mvc/models/validation). + +### 数据注解 Attribute + +使用数据注解是一种以声明式对[DTO](Data-Transfer-Objects.md)进行验证的简单方法. +示例 : + +````csharp +public class CreateBookDto +{ + [Required] + [StringLength(100)] + public string Name { get; set; } + + [Required] + [StringLength(1000)] + public string Description { get; set; } + + [Range(0, 999.99)] + public decimal Price { get; set; } +} +```` + +当使用该类作为[应用服务](Application-Services.md)或控制器的参数时,将对其自动验证并抛出本地化异常(由ABP框架[处理](Exception-Handling.md)). + +### IValidatableObject + +`IValidatableObject` can be implemented by a DTO to perform custom validation logic. `CreateBookDto` in the following example implements this interface and checks if the `Name` is equals to the `Description` and returns a validation error in this case. +可以将DTO实现 `IValidatableObject` 接口进行自定义验证逻辑. 下面的示例中 `CreateBookDto` 实现了这个接口,并检查 `Name` 是否等于 `Description` 并返回一个验证错误. + +````csharp +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace Acme.BookStore +{ + public class CreateBookDto : IValidatableObject + { + [Required] + [StringLength(100)] + public string Name { get; set; } + + [Required] + [StringLength(1000)] + public string Description { get; set; } + + [Range(0, 999.99)] + public decimal Price { get; set; } + + public IEnumerable Validate( + ValidationContext validationContext) + { + if (Name == Description) + { + yield return new ValidationResult( + "Name and Description can not be the same!", + new[] { "Name", "Description" } + ); + } + } + } +} +```` + +#### 解析服务 + +如果你需要从[依赖注入系统](Dependency-Injection.md)解析服务,可以使用 `ValidationContext` 对象. +例: + +````csharp +var myService = validationContext.GetRequiredService(); +```` + +> 虽然可以在 `Validate` 方法中解析服务实现任何可能性,但在DTO中实现领域验证逻辑不是一个很好的做法. 应保持简单的DTO,他们的目的是传输数据(DTO:数据传输对象). + +## 验证基础设施 + +本节介绍了ABP框架提供的一些额外的服务. + +### IValidationEnabled 接口 + +`IValidationEnabled` 是可以由任何类来实现的空标记接口(注册到[DI](Dependency-Injection.md)并从中解析),让ABP框架为该类执行验证系统. +示例 : + +````csharp +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Validation; + +namespace Acme.BookStore +{ + public class MyService : ITransientDependency, IValidationEnabled + { + public virtual async Task DoItAsync(MyInput input) + { + //... + } + } +} +```` + +> ABP框架使用[动态代理/拦截](Dynamic-Proxying-Interceptors.md)系统来执行验证.为了使其工作,你的方法应该是 **virtual** 的,服务应该被注入并通过接口(如`IMyService`)使用. + +### AbpValidationException + +一旦ABP确定了一个验证错误,它就会抛出类型为 `AbpValidationException` 的异常. 你的应用程序代码可以抛出 `AbpValidationException`,但大多数情况不会使用它. + +* `ValidationErrors` 是 `AbpValidationException` 的属性,它包含了验证错误列表. +* `AbpValidationException` 的日志级别设置为 `Warning`. 它将所有验证错误记录到[日志系统](Logging.md). +* `AbpValidationException` 由ABP框架自动捕获并将HTTP状态码设置为400转换成可用的错误响应. 参阅[异常处理](Exception-Handling.md)文档了解更多. + +## 高级主题 + +### IObjectValidator + +除了自动验证你可能需要手动验证对象,这种情况下[注入](Dependency-Injection.md)并使用 `IObjectValidator` 服务: + +* `Validate` 方法根据验证​​规则验证给定对象,如果对象没有被验证通过会抛出 `AbpValidationException` 异常. +* `GetErrors` 不会抛出异常,只返回验证错误. + +`IObjectValidator` 默认由 `ObjectValidator` 实现. `ObjectValidator`是可扩展的; 可以实现`IObjectValidationContributor`接口提供自定义逻辑. +示例 : + +````csharp +public class MyObjectValidationContributor + : IObjectValidationContributor, ITransientDependency +{ + public void AddErrors(ObjectValidationContext context) + { + //Get the validating object + var obj = context.ValidatingObject; + + //Add the validation errors if available + context.Errors.Add(...); + } +} +```` + +* 记录将类注册到[DI](Dependency-Injection.md)(实现`ITransientDependency` 如同本例) +* ABP会自动发现验证类,并用于任何类型的对象验证(包括自动方法调用验证). + +### IMethodInvocationValidator + +`IMethodInvocationValidator` 用于验证方法调用. 它在内部使用 `IObjectValidator` 来验证传递给方法调用的对象. 由于框架会自动使用此服务,通常你并不需要此服务,但在少数情况下你可能在应用程序中重用或替换它. + +## FluentValidation Integration + +Volo.Abp.FluentValidation 包将FluentValidation库集成到了验证系统(通过实现 `IObjectValidationContributor`). 请参阅[FluentValidation集成文档](FluentValidation.md)了解更多信息. \ No newline at end of file diff --git a/docs/zh-Hans/Virtual-File-System.md b/docs/zh-Hans/Virtual-File-System.md index 49c97c8162..97cf22c73e 100644 --- a/docs/zh-Hans/Virtual-File-System.md +++ b/docs/zh-Hans/Virtual-File-System.md @@ -39,7 +39,8 @@ namespace MyCompany.MyProject ````C# - + + ```` diff --git a/docs/zh-Hans/docs-nav.json b/docs/zh-Hans/docs-nav.json index 301af0fd6a..ad811cc5b3 100644 --- a/docs/zh-Hans/docs-nav.json +++ b/docs/zh-Hans/docs-nav.json @@ -52,6 +52,10 @@ "text": "配置", "path": "Configuration.md" }, + { + "text": "选项", + "path": "Options.md" + }, { "text": "依赖注入", "path": "Dependency-Injection.md", @@ -75,18 +79,31 @@ "path": "Exception-Handling.md" }, { - "text": "验证" + "text": "验证", + "path": "Validation.md", + "items": [ + { + "text": "FluentValidation集成", + "path": "FluentValidation.md" + } + ] }, { - "text": "授权" + "text": "授权", + "path": "Authorization.md" }, { "text": "缓存", "path": "Caching.md" }, { - "text": "审计" - }, + "text": "日志", + "path": "Logging.md" + }, + { + "text": "审计日志", + "path": "Audit-Logging.md" + }, { "text": "设置管理", "path": "Settings.md" @@ -249,22 +266,43 @@ "path":"Data-Access.md", "items": [ { - "text": "Entity Framework Core 集成", - "path": "Entity-Framework-Core.md", - "items": [ + "text": "连接字符串", + "path": "Connection-Strings.md" + }, + { + "text": "数据库提供程序", + "items": [ + { + "text": "Entity Framework Core", + "path": "Entity-Framework-Core.md", + "items": [ + { + "text": "切换到MySql", + "path": "Entity-Framework-Core-MySQL.md" + }, + { + "text": "切换到PostgreSQL", + "path": "Entity-Framework-Core-PostgreSQL.md" + }, + { + "text": "切换到SQLite", + "path": "Entity-Framework-Core-SQLite.md" + }, + { + "text": "切换到其他DBMS", + "path": "Entity-Framework-Core-Other-DBMS.md" + } + ] + }, + { + "text": "MongoDB", + "path": "MongoDB.md" + }, { - "text": "PostgreSQL 集成", - "path": "Entity-Framework-Core-PostgreSQL.md" + "text": "Dapper", + "path": "Dapper.md" } ] - }, - { - "text": "MongoDB 集成", - "path": "MongoDB.md" - }, - { - "text": "Dapper 集成", - "path": "Dapper.md" } ] }, diff --git a/docs/zh-Hans/images/auditlog-object-diagram.png b/docs/zh-Hans/images/auditlog-object-diagram.png new file mode 100644 index 0000000000..a7e86a2bb2 Binary files /dev/null and b/docs/zh-Hans/images/auditlog-object-diagram.png differ diff --git a/docs/zh-Hans/images/docs-section-ui.png b/docs/zh-Hans/images/docs-section-ui.png new file mode 100644 index 0000000000..7856454e5d Binary files /dev/null and b/docs/zh-Hans/images/docs-section-ui.png differ diff --git a/framework/Volo.Abp.sln b/framework/Volo.Abp.sln index 088a9437a8..b731aff187 100644 --- a/framework/Volo.Abp.sln +++ b/framework/Volo.Abp.sln @@ -1,4 +1,4 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 +Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.28922.388 MinimumVisualStudioVersion = 10.0.40219.1 @@ -256,6 +256,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Minify", "src\Volo EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Minify.Tests", "test\Volo.Abp.Minify.Tests\Volo.Abp.Minify.Tests.csproj", "{E69182B3-350A-43F5-A935-5EBBEBECEF97}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Serilog", "src\Volo.Abp.AspNetCore.Serilog\Volo.Abp.AspNetCore.Serilog.csproj", "{3B801003-BE74-49ED-9749-DA5E99F45EBF}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Serilog.Tests", "test\Volo.Abp.AspNetCore.Serilog.Tests\Volo.Abp.AspNetCore.Serilog.Tests.csproj", "{9CAA07ED-FE5C-4427-A6FA-6C6CB5B4CC62}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -762,6 +766,14 @@ Global {E69182B3-350A-43F5-A935-5EBBEBECEF97}.Debug|Any CPU.Build.0 = Debug|Any CPU {E69182B3-350A-43F5-A935-5EBBEBECEF97}.Release|Any CPU.ActiveCfg = Release|Any CPU {E69182B3-350A-43F5-A935-5EBBEBECEF97}.Release|Any CPU.Build.0 = Release|Any CPU + {3B801003-BE74-49ED-9749-DA5E99F45EBF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3B801003-BE74-49ED-9749-DA5E99F45EBF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3B801003-BE74-49ED-9749-DA5E99F45EBF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3B801003-BE74-49ED-9749-DA5E99F45EBF}.Release|Any CPU.Build.0 = Release|Any CPU + {9CAA07ED-FE5C-4427-A6FA-6C6CB5B4CC62}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9CAA07ED-FE5C-4427-A6FA-6C6CB5B4CC62}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9CAA07ED-FE5C-4427-A6FA-6C6CB5B4CC62}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9CAA07ED-FE5C-4427-A6FA-6C6CB5B4CC62}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -892,6 +904,8 @@ Global {73559227-EBF0-475F-835B-1FF0CD9132AA} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} {928DC30D-C078-4BB4-A9F8-FE7252C67DC6} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} {E69182B3-350A-43F5-A935-5EBBEBECEF97} = {447C8A77-E5F0-4538-8687-7383196D04EA} + {3B801003-BE74-49ED-9749-DA5E99F45EBF} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} + {9CAA07ED-FE5C-4427-A6FA-6C6CB5B4CC62} = {447C8A77-E5F0-4538-8687-7383196D04EA} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5} diff --git a/framework/src/Volo.Abp.ApiVersioning.Abstractions/FodyWeavers.xml b/framework/src/Volo.Abp.ApiVersioning.Abstractions/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.ApiVersioning.Abstractions/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.ApiVersioning.Abstractions/FodyWeavers.xsd b/framework/src/Volo.Abp.ApiVersioning.Abstractions/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.ApiVersioning.Abstractions/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.ApiVersioning.Abstractions/Volo.Abp.ApiVersioning.Abstractions.csproj b/framework/src/Volo.Abp.ApiVersioning.Abstractions/Volo.Abp.ApiVersioning.Abstractions.csproj index 43ebfb8230..365450cd73 100644 --- a/framework/src/Volo.Abp.ApiVersioning.Abstractions/Volo.Abp.ApiVersioning.Abstractions.csproj +++ b/framework/src/Volo.Abp.ApiVersioning.Abstractions/Volo.Abp.ApiVersioning.Abstractions.csproj @@ -1,5 +1,6 @@ + diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/FodyWeavers.xml b/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/FodyWeavers.xsd b/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Microsoft/AspNetCore/Builder/JwtTokenMiddleware.cs b/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Microsoft/AspNetCore/Builder/JwtTokenMiddleware.cs index e93f558afd..4ff54f39bf 100644 --- a/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Microsoft/AspNetCore/Builder/JwtTokenMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Microsoft/AspNetCore/Builder/JwtTokenMiddleware.cs @@ -11,14 +11,14 @@ namespace Microsoft.AspNetCore.Builder { if (ctx.User.Identity?.IsAuthenticated != true) { - var result = await ctx.AuthenticateAsync(schema).ConfigureAwait(false); + var result = await ctx.AuthenticateAsync(schema); if (result.Succeeded && result.Principal != null) { ctx.User = result.Principal; } } - await next().ConfigureAwait(false); + await next(); }); } } diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo.Abp.AspNetCore.Authentication.JwtBearer.csproj b/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo.Abp.AspNetCore.Authentication.JwtBearer.csproj index eb6908d0cd..e2392c2b53 100644 --- a/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo.Abp.AspNetCore.Authentication.JwtBearer.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Authentication.JwtBearer/Volo.Abp.AspNetCore.Authentication.JwtBearer.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/FodyWeavers.xml b/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/FodyWeavers.xsd b/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Volo.Abp.AspNetCore.Authentication.OAuth.csproj b/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Volo.Abp.AspNetCore.Authentication.OAuth.csproj index 6a5f7edb36..ae032e5b9e 100644 --- a/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Volo.Abp.AspNetCore.Authentication.OAuth.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Authentication.OAuth/Volo.Abp.AspNetCore.Authentication.OAuth.csproj @@ -1,5 +1,6 @@ - + + @@ -19,4 +20,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/FodyWeavers.xml b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/FodyWeavers.xsd b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo.Abp.AspNetCore.MultiTenancy.csproj b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo.Abp.AspNetCore.MultiTenancy.csproj index 6688526622..e9fa75d716 100644 --- a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo.Abp.AspNetCore.MultiTenancy.csproj +++ b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo.Abp.AspNetCore.MultiTenancy.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs index b260df4247..ba8802a80e 100644 --- a/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore.MultiTenancy/Volo/Abp/AspNetCore/MultiTenancy/MultiTenancyMiddleware.cs @@ -33,7 +33,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy TenantConfiguration tenant = null; if (resolveResult.TenantIdOrName != null) { - tenant = await FindTenantAsync(resolveResult.TenantIdOrName).ConfigureAwait(false); + tenant = await FindTenantAsync(resolveResult.TenantIdOrName); if (tenant == null) { //TODO: A better exception? @@ -45,7 +45,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy using (_currentTenant.Change(tenant?.Id, tenant?.Name)) { - await next(context).ConfigureAwait(false); + await next(context); } } @@ -53,11 +53,11 @@ namespace Volo.Abp.AspNetCore.MultiTenancy { if (Guid.TryParse(tenantIdOrName, out var parsedTenantId)) { - return await _tenantStore.FindAsync(parsedTenantId).ConfigureAwait(false); + return await _tenantStore.FindAsync(parsedTenantId); } else { - return await _tenantStore.FindAsync(tenantIdOrName).ConfigureAwait(false); + return await _tenantStore.FindAsync(tenantIdOrName); } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/FodyWeavers.xml b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/FodyWeavers.xsd b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo.Abp.AspNetCore.Mvc.Client.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo.Abp.AspNetCore.Mvc.Client.csproj index aa45445c43..87641365b2 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo.Abp.AspNetCore.Mvc.Client.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo.Abp.AspNetCore.Mvc.Client.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/CachedApplicationConfigurationClient.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/CachedApplicationConfigurationClient.cs index a4f7eb0567..1fbb72bb3e 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/CachedApplicationConfigurationClient.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/CachedApplicationConfigurationClient.cs @@ -43,12 +43,12 @@ namespace Volo.Abp.AspNetCore.Mvc.Client configuration = await Cache.GetOrAddAsync( cacheKey, - async () => await Proxy.Service.GetAsync().ConfigureAwait(false), + async () => await Proxy.Service.GetAsync(), () => new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(120) //TODO: Should be configurable. Default value should be higher (5 mins would be good). } - ).ConfigureAwait(false); + ); if (httpContext != null) { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteFeatureChecker.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteFeatureChecker.cs index 9671703db8..f769f512a5 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteFeatureChecker.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteFeatureChecker.cs @@ -15,7 +15,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Client public override async Task GetOrNullAsync(string name) { - var configuration = await ConfigurationClient.GetAsync().ConfigureAwait(false); + var configuration = await ConfigurationClient.GetAsync(); return configuration.Features.Values.GetOrDefault(name); } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteLanguageProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteLanguageProvider.cs index 42b6eeb543..02c97c0598 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteLanguageProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteLanguageProvider.cs @@ -16,7 +16,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Client public async Task> GetLanguagesAsync() { - var configuration = await ConfigurationClient.GetAsync().ConfigureAwait(false); + var configuration = await ConfigurationClient.GetAsync(); return configuration.Localization.Languages; } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemotePermissionChecker.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemotePermissionChecker.cs index 553160029b..18f5272e7b 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemotePermissionChecker.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemotePermissionChecker.cs @@ -16,7 +16,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Client public async Task IsGrantedAsync(string name) { - var configuration = await ConfigurationClient.GetAsync().ConfigureAwait(false); + var configuration = await ConfigurationClient.GetAsync(); return configuration.Auth.GrantedPolicies.ContainsKey(name); } @@ -24,7 +24,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Client public async Task IsGrantedAsync(ClaimsPrincipal claimsPrincipal, string name) { /* This provider always works for the current principal. */ - return await IsGrantedAsync(name).ConfigureAwait(false); + return await IsGrantedAsync(name); } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteSettingProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteSettingProvider.cs index d6526a0b7b..db3ea6e9a6 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteSettingProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteSettingProvider.cs @@ -17,13 +17,13 @@ namespace Volo.Abp.AspNetCore.Mvc.Client public async Task GetOrNullAsync(string name) { - var configuration = await ConfigurationClient.GetAsync().ConfigureAwait(false); + var configuration = await ConfigurationClient.GetAsync(); return configuration.Setting.Values.GetOrDefault(name); } public async Task> GetAllAsync() { - var configuration = await ConfigurationClient.GetAsync().ConfigureAwait(false); + var configuration = await ConfigurationClient.GetAsync(); return configuration .Setting.Values .Select(s => new SettingValue(s.Key, s.Value)) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteTenantStore.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteTenantStore.cs index 8e95376663..236387823c 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteTenantStore.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/RemoteTenantStore.cs @@ -39,13 +39,13 @@ namespace Volo.Abp.AspNetCore.Mvc.Client tenantConfiguration = await Cache.GetOrAddAsync( cacheKey, - async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByNameAsync(name).ConfigureAwait(false)), + async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByNameAsync(name)), () => new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(5) //TODO: Should be configurable. } - ).ConfigureAwait(false); + ); if (httpContext != null) { @@ -67,13 +67,13 @@ namespace Volo.Abp.AspNetCore.Mvc.Client tenantConfiguration = await Cache.GetOrAddAsync( cacheKey, - async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByIdAsync(id).ConfigureAwait(false)), + async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByIdAsync(id)), () => new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(5) //TODO: Should be configurable. } - ).ConfigureAwait(false); + ); if (httpContext != null) { @@ -95,7 +95,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Client tenantConfiguration = Cache.GetOrAdd( cacheKey, - () => AsyncHelper.RunSync(async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByNameAsync(name).ConfigureAwait(false))), + () => AsyncHelper.RunSync(async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByNameAsync(name))), () => new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = @@ -123,7 +123,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Client tenantConfiguration = Cache.GetOrAdd( cacheKey, - () => AsyncHelper.RunSync(async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByIdAsync(id).ConfigureAwait(false))), + () => AsyncHelper.RunSync(async () => CreateTenantConfiguration(await Proxy.Service.FindTenantByIdAsync(id))), () => new DistributedCacheEntryOptions { AbsoluteExpirationRelativeToNow = diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/FodyWeavers.xml b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/FodyWeavers.xsd b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo.Abp.AspNetCore.Mvc.Contracts.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo.Abp.AspNetCore.Mvc.Contracts.csproj index 9d3107e90c..a979cfa637 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo.Abp.AspNetCore.Mvc.Contracts.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo.Abp.AspNetCore.Mvc.Contracts.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/FodyWeavers.xml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/FodyWeavers.xsd b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Breadcrumb/AbpBreadcrumbTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Breadcrumb/AbpBreadcrumbTagHelperService.cs index 4b3a4dd471..8eeeb1e929 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Breadcrumb/AbpBreadcrumbTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Breadcrumb/AbpBreadcrumbTagHelperService.cs @@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Breadcrumb { var list = InitilizeFormGroupContentsContext(context, output); - await output.GetChildContentAsync().ConfigureAwait(false); + await output.GetChildContentAsync(); SetInnerOlTag(context, output); SetInnerList(context, output, list); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Carousel/AbpCarouselTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Carousel/AbpCarouselTagHelperService.cs index 65cffd8cb6..ffba80fb6f 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Carousel/AbpCarouselTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Carousel/AbpCarouselTagHelperService.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Carousel var itemList = InitilizeCarouselItemsContentsContext(context, output); - await output.GetChildContentAsync().ConfigureAwait(false); + await output.GetChildContentAsync(); SetOneItemAsActive(context, output, itemList); SetItems(context, output, itemList); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionItemTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionItemTagHelperService.cs index 509b801ba9..9dc279334b 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionItemTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionItemTagHelperService.cs @@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Collapse { SetRandomIdIfNotProvided(); - var innerContent = (await output.GetChildContentAsync().ConfigureAwait(false)).GetContent(); + var innerContent = (await output.GetChildContentAsync()).GetContent(); var html = GetAccordionHeaderItem(context, output) + GetAccordionContentItem(context, output, innerContent); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionTagHelperService.cs index c6c5c2eb5e..20e62604a9 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpAccordionTagHelperService.cs @@ -20,7 +20,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Collapse var items = InitilizeFormGroupContentsContext(context, output); - await output.GetChildContentAsync().ConfigureAwait(false); + await output.GetChildContentAsync(); var content = GetContent(items); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpCollapseBodyTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpCollapseBodyTagHelperService.cs index 2b81961f67..10e49b92a7 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpCollapseBodyTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Collapse/AbpCollapseBodyTagHelperService.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Collapse output.Attributes.AddClass("multi-collapse"); } - var innerContent = (await output.GetChildContentAsync().ConfigureAwait(false)).GetContent(); + var innerContent = (await output.GetChildContentAsync()).GetContent(); output.Content.SetHtmlContent(innerContent); } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Dropdown/AbpDropdownButtonTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Dropdown/AbpDropdownButtonTagHelperService.cs index 459a7be318..673204b302 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Dropdown/AbpDropdownButtonTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Dropdown/AbpDropdownButtonTagHelperService.cs @@ -26,9 +26,9 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { - var content = await output.GetChildContentAsync().ConfigureAwait(false); + var content = await output.GetChildContentAsync(); - var buttonsAsHtml = await GetButtonsAsHtmlAsync(context, output, content).ConfigureAwait(false); + var buttonsAsHtml = await GetButtonsAsHtmlAsync(context, output, content); output.PreElement.SetHtmlContent(buttonsAsHtml); @@ -43,13 +43,13 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown { var buttonBuilder = new StringBuilder(""); - var mainButton = await GetMainButtonAsync(context, output, content).ConfigureAwait(false); + var mainButton = await GetMainButtonAsync(context, output, content); buttonBuilder.AppendLine(mainButton); if (TagHelper.DropdownStyle == DropdownStyle.Split) { - var splitButton = await GetSplitButtonAsync(context, output).ConfigureAwait(false); + var splitButton = await GetSplitButtonAsync(context, output); buttonBuilder.AppendLine(splitButton); } @@ -68,7 +68,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown abpButtonTagHelper.ButtonType = TagHelper.ButtonType; var attributes = GetAttributesForMainButton(context, output); - var buttonTag = await abpButtonTagHelper.ProcessAndGetOutputAsync(attributes, context, "button", TagMode.StartTagAndEndTag).ConfigureAwait(false); + var buttonTag = await abpButtonTagHelper.ProcessAndGetOutputAsync(attributes, context, "button", TagMode.StartTagAndEndTag); buttonTag.PreContent.SetHtmlContent(content.GetContent()); @@ -89,7 +89,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Dropdown abpButtonTagHelper.ButtonType = TagHelper.ButtonType; var attributes = GetAttributesForSplitButton(context, output); - return await abpButtonTagHelper.RenderAsync(attributes, context, _htmlEncoder, "button", TagMode.StartTagAndEndTag).ConfigureAwait(false); + return await abpButtonTagHelper.RenderAsync(attributes, context, _htmlEncoder, "button", TagMode.StartTagAndEndTag); } protected virtual TagHelperAttributeList GetAttributesForMainButton(TagHelperContext context, TagHelperOutput output) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Extensions/TagHelperExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Extensions/TagHelperExtensions.cs index 6767e2bf1d..d925fd11e8 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Extensions/TagHelperExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Extensions/TagHelperExtensions.cs @@ -19,14 +19,14 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Extensions tagHelper.Init(context); - await tagHelper.ProcessAsync(innerContext, innerOutput).ConfigureAwait(false); + await tagHelper.ProcessAsync(innerContext, innerOutput); return innerOutput; } public static async Task RenderAsync(this TagHelper tagHelper, TagHelperAttributeList attributeList, TagHelperContext context, HtmlEncoder htmlEncoder, string tagName = "div", TagMode tagMode = TagMode.SelfClosing) { - var innerOutput = await tagHelper.ProcessAndGetOutputAsync(attributeList, context, tagName, tagMode).ConfigureAwait(false); + var innerOutput = await tagHelper.ProcessAndGetOutputAsync(attributeList, context, tagName, tagMode); return innerOutput.Render(htmlEncoder); } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs index 5fb439b6f7..ee2a920980 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpDynamicformTagHelperService.cs @@ -37,11 +37,11 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form NormalizeTagMode(context, output); - var childContent = (await output.GetChildContentAsync().ConfigureAwait(false)).GetContent(); + var childContent = (await output.GetChildContentAsync()).GetContent(); - await ConvertToMvcForm(context, output).ConfigureAwait(false); + await ConvertToMvcForm(context, output); - await ProcessFieldsAsync(context, output).ConfigureAwait(false); + await ProcessFieldsAsync(context, output); SetContent(context, output, list, childContent); @@ -67,9 +67,9 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form ViewContext = TagHelper.ViewContext }; - var formTagOutput = await formTagHelper.ProcessAndGetOutputAsync(output.Attributes, context, "form", TagMode.StartTagAndEndTag).ConfigureAwait(false); + var formTagOutput = await formTagHelper.ProcessAndGetOutputAsync(output.Attributes, context, "form", TagMode.StartTagAndEndTag); - await formTagOutput.GetChildContentAsync().ConfigureAwait(false); + await formTagOutput.GetChildContentAsync(); output.PostContent.SetHtmlContent(output.PostContent.GetContent() + formTagOutput.PostContent.GetContent()); output.PreContent.SetHtmlContent(output.PreContent.GetContent() + formTagOutput.PreContent.GetContent()); @@ -134,11 +134,11 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form { if (IsSelectGroup(context, model)) { - await ProcessSelectGroupAsync(context, output, model).ConfigureAwait(false); + await ProcessSelectGroupAsync(context, output, model); } else { - await ProcessInputGroupAsync(context, output, model).ConfigureAwait(false); + await ProcessInputGroupAsync(context, output, model); } } } @@ -147,7 +147,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form { var abpSelectTagHelper = GetSelectGroupTagHelper(context, output, model); - await abpSelectTagHelper.RenderAsync(new TagHelperAttributeList(), context, _htmlEncoder, "div", TagMode.StartTagAndEndTag).ConfigureAwait(false); + await abpSelectTagHelper.RenderAsync(new TagHelperAttributeList(), context, _htmlEncoder, "div", TagMode.StartTagAndEndTag); } protected virtual AbpTagHelper GetSelectGroupTagHelper(TagHelperContext context, TagHelperOutput output, ModelExpression model) @@ -185,7 +185,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form abpButtonTagHelper.Text = "Submit"; abpButtonTagHelper.ButtonType = AbpButtonType.Primary; - return await abpButtonTagHelper.RenderAsync(attributes, context, _htmlEncoder, "button", TagMode.StartTagAndEndTag).ConfigureAwait(false); + return await abpButtonTagHelper.RenderAsync(attributes, context, _htmlEncoder, "button", TagMode.StartTagAndEndTag); } protected virtual async Task ProcessInputGroupAsync(TagHelperContext context, TagHelperOutput output, ModelExpression model) @@ -195,7 +195,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form abpInputTagHelper.ViewContext = TagHelper.ViewContext; abpInputTagHelper.DisplayRequiredSymbol = TagHelper.RequiredSymbols ?? true; - await abpInputTagHelper.RenderAsync(new TagHelperAttributeList(), context, _htmlEncoder, "div", TagMode.StartTagAndEndTag).ConfigureAwait(false); + await abpInputTagHelper.RenderAsync(new TagHelperAttributeList(), context, _htmlEncoder, "div", TagMode.StartTagAndEndTag); } protected virtual List GetModels(TagHelperContext context, TagHelperOutput output) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs index b1195b729e..75fe4f23e7 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpInputTagHelperService.cs @@ -27,7 +27,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { - var (innerHtml, isCheckBox) = await GetFormInputGroupAsHtmlAsync(context, output).ConfigureAwait(false); + var (innerHtml, isCheckBox) = await GetFormInputGroupAsHtmlAsync(context, output); var order = TagHelper.AspFor.ModelExplorer.GetDisplayOrder(); @@ -57,12 +57,12 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form protected virtual async Task<(string, bool)> GetFormInputGroupAsHtmlAsync(TagHelperContext context, TagHelperOutput output) { - var (inputTag, isCheckBox) = await GetInputTagHelperOutputAsync(context, output).ConfigureAwait(false); + var (inputTag, isCheckBox) = await GetInputTagHelperOutputAsync(context, output); var inputHtml = inputTag.Render(_encoder); - var label = await GetLabelAsHtmlAsync(context, output, inputTag, isCheckBox).ConfigureAwait(false); + var label = await GetLabelAsHtmlAsync(context, output, inputTag, isCheckBox); var info = GetInfoAsHtml(context, output, inputTag, isCheckBox); - var validation = isCheckBox ? "" : await GetValidationAsHtmlAsync(context, output, inputTag).ConfigureAwait(false); + var validation = isCheckBox ? "" : await GetValidationAsHtmlAsync(context, output, inputTag); return (GetContent(context, output, label, inputHtml, validation, info, isCheckBox), isCheckBox); } @@ -82,7 +82,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form var attributeList = new TagHelperAttributeList { { "class", "text-danger" } }; - return await validationMessageTagHelper.RenderAsync(attributeList, context, _encoder, "span", TagMode.StartTagAndEndTag).ConfigureAwait(false); + return await validationMessageTagHelper.RenderAsync(attributeList, context, _encoder, "span", TagMode.StartTagAndEndTag); } protected virtual string GetContent(TagHelperContext context, TagHelperOutput output, string label, string inputHtml, string validation, string infoHtml, bool isCheckbox) @@ -125,7 +125,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form { var tagHelper = GetInputTagHelper(context, output); - var inputTagHelperOutput = await tagHelper.ProcessAndGetOutputAsync(GetInputAttributes(context, output), context, "input").ConfigureAwait(false); + var inputTagHelperOutput = await tagHelper.ProcessAndGetOutputAsync(GetInputAttributes(context, output), context, "input"); ConvertToTextAreaIfTextArea(inputTagHelperOutput); AddDisabledAttribute(inputTagHelperOutput); @@ -227,7 +227,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form if (string.IsNullOrEmpty(TagHelper.Label)) { - return await GetLabelAsHtmlUsingTagHelperAsync(context, output, isCheckbox).ConfigureAwait(false) + GetRequiredSymbol(context, output); + return await GetLabelAsHtmlUsingTagHelperAsync(context, output, isCheckbox) + GetRequiredSymbol(context, output); } var checkboxClass = isCheckbox ? "class=\"custom-control-label\" " : ""; @@ -301,7 +301,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form attributeList.AddClass("custom-control-label"); } - return await labelTagHelper.RenderAsync(attributeList, context, _encoder, "label", TagMode.StartTagAndEndTag).ConfigureAwait(false); + return await labelTagHelper.RenderAsync(attributeList, context, _encoder, "label", TagMode.StartTagAndEndTag); } protected virtual void ConvertToTextAreaIfTextArea(TagHelperOutput tagHelperOutput) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs index f1260883ef..b18bc6ed75 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Form/AbpSelectTagHelperService.cs @@ -30,7 +30,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { - var innerHtml = await GetFormInputGroupAsHtmlAsync(context, output).ConfigureAwait(false); + var innerHtml = await GetFormInputGroupAsHtmlAsync(context, output); var order = TagHelper.AspFor.ModelExplorer.GetDisplayOrder(); @@ -52,10 +52,10 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form protected virtual async Task GetFormInputGroupAsHtmlAsync(TagHelperContext context, TagHelperOutput output) { - var selectTag = await GetSelectTagAsync(context, output).ConfigureAwait(false); + var selectTag = await GetSelectTagAsync(context, output); var selectAsHtml = selectTag.Render(_encoder); - var label = await GetLabelAsHtmlAsync(context, output, selectTag).ConfigureAwait(false); - var validation = await GetValidationAsHtmlAsync(context, output, selectTag).ConfigureAwait(false); + var label = await GetLabelAsHtmlAsync(context, output, selectTag); + var validation = await GetValidationAsHtmlAsync(context, output, selectTag); var infoText = GetInfoAsHtml(context, output, selectTag); return label + Environment.NewLine + selectAsHtml + Environment.NewLine + infoText + Environment.NewLine + validation; @@ -75,7 +75,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form ViewContext = TagHelper.ViewContext }; - var selectTagHelperOutput = await selectTagHelper.ProcessAndGetOutputAsync(GetInputAttributes(context, output), context, "select", TagMode.StartTagAndEndTag).ConfigureAwait(false); + var selectTagHelperOutput = await selectTagHelper.ProcessAndGetOutputAsync(GetInputAttributes(context, output), context, "select", TagMode.StartTagAndEndTag); selectTagHelperOutput.Attributes.AddClass("form-control"); selectTagHelperOutput.Attributes.AddClass(GetSize(context, output)); @@ -123,7 +123,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form return "" + GetRequiredSymbol(context, output); } - return await GetLabelAsHtmlUsingTagHelperAsync(context, output).ConfigureAwait(false) + GetRequiredSymbol(context, output); + return await GetLabelAsHtmlUsingTagHelperAsync(context, output) + GetRequiredSymbol(context, output); } protected virtual string GetRequiredSymbol(TagHelperContext context, TagHelperOutput output) @@ -242,7 +242,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form ViewContext = TagHelper.ViewContext }; - return await labelTagHelper.RenderAsync(new TagHelperAttributeList(), context, _encoder, "label", TagMode.StartTagAndEndTag).ConfigureAwait(false); + return await labelTagHelper.RenderAsync(new TagHelperAttributeList(), context, _encoder, "label", TagMode.StartTagAndEndTag); } protected virtual async Task GetValidationAsHtmlAsync(TagHelperContext context, TagHelperOutput output, TagHelperOutput inputTag) @@ -255,7 +255,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form var attributeList = new TagHelperAttributeList { { "class", "text-danger" } }; - return await validationMessageTagHelper.RenderAsync(attributeList, context, _encoder, "span", TagMode.StartTagAndEndTag).ConfigureAwait(false); + return await validationMessageTagHelper.RenderAsync(attributeList, context, _encoder, "span", TagMode.StartTagAndEndTag); } protected virtual string GetSize(TagHelperContext context, TagHelperOutput output) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Grid/AbpColumnTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Grid/AbpColumnTagHelperService.cs index e78d59ee82..bb8107bc52 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Grid/AbpColumnTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Grid/AbpColumnTagHelperService.cs @@ -8,6 +8,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid public override void Process(TagHelperContext context, TagHelperOutput output) { output.TagName = "div"; + output.Attributes.AddClass("col"); ProcessSizeClasses(context, output); @@ -52,6 +53,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Grid classString += "-" + size.ToString("D"); } + output.Attributes.RemoveClass("col"); output.Attributes.AddClass(classString); } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Pagination/AbpPaginationTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Pagination/AbpPaginationTagHelperService.cs index f1d2f5c02f..25307c3fee 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Pagination/AbpPaginationTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Pagination/AbpPaginationTagHelperService.cs @@ -31,7 +31,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination } ProcessMainTag(context, output); - await SetContentAsHtmlAsync(context, output).ConfigureAwait(false); + await SetContentAsHtmlAsync(context, output); } protected virtual async Task SetContentAsHtmlAsync(TagHelperContext context, TagHelperOutput output) @@ -39,9 +39,9 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination var html = new StringBuilder(""); html.AppendLine(GetOpeningTags(context, output)); - html.AppendLine(await GetPreviousButtonAsync(context, output).ConfigureAwait(false)); - html.AppendLine(await GetPagesAsync(context, output).ConfigureAwait(false)); - html.AppendLine(await GetNextButton(context, output).ConfigureAwait(false)); + html.AppendLine(await GetPreviousButtonAsync(context, output)); + html.AppendLine(await GetPagesAsync(context, output)); + html.AppendLine(await GetNextButton(context, output)); html.AppendLine(GetClosingTags(context, output)); output.Content.SetHtmlContent(html.ToString()); @@ -61,7 +61,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination foreach (var page in TagHelper.Model.Pages) { - pagesHtml.AppendLine(await GetPageAsync(context, output, page).ConfigureAwait(false)); + pagesHtml.AppendLine(await GetPageAsync(context, output, page)); } return pagesHtml.ToString(); @@ -86,7 +86,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination } else { - pageHtml.AppendLine(await RenderAnchorTagHelperLinkHtmlAsync(context, output, page.Index.ToString(), page.Index.ToString()).ConfigureAwait(false)); + pageHtml.AppendLine(await RenderAnchorTagHelperLinkHtmlAsync(context, output, page.Index.ToString(), page.Index.ToString())); } pageHtml.AppendLine(""); @@ -102,7 +102,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination : (TagHelper.Model.CurrentPage - 1).ToString(); return "
  • \r\n" + - (await RenderAnchorTagHelperLinkHtmlAsync(context, output, currentPage, localizationKey).ConfigureAwait(false)) + "
  • "; + (await RenderAnchorTagHelperLinkHtmlAsync(context, output, currentPage, localizationKey)) + " "; } protected virtual async Task GetNextButton(TagHelperContext context, TagHelperOutput output) @@ -111,7 +111,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination var currentPage = (TagHelper.Model.CurrentPage + 1).ToString(); return "
  • = TagHelper.Model.TotalPageCount ? "disabled" : "") + "\">\r\n" + - (await RenderAnchorTagHelperLinkHtmlAsync(context, output, currentPage, localizationKey).ConfigureAwait(false)) + + (await RenderAnchorTagHelperLinkHtmlAsync(context, output, currentPage, localizationKey)) + "
  • "; } @@ -121,7 +121,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Pagination var anchorTagHelper = GetAnchorTagHelper(currentPage, out var attributeList); - var tagHelperOutput = await anchorTagHelper.ProcessAndGetOutputAsync(attributeList, context, "a", TagMode.StartTagAndEndTag).ConfigureAwait(false); + var tagHelperOutput = await anchorTagHelper.ProcessAndGetOutputAsync(attributeList, context, "a", TagMode.StartTagAndEndTag); tagHelperOutput.Content.SetHtmlContent(localizer[localizationKey]); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabDropdownTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabDropdownTagHelperService.cs index 1b74a338dd..fb724af9c8 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabDropdownTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabDropdownTagHelperService.cs @@ -15,7 +15,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Tab throw new Exception("Name of tab dropdown tag can not bu null or empty."); } - await output.GetChildContentAsync().ConfigureAwait(false); + await output.GetChildContentAsync(); var tabHeader = GetTabHeaderItem(context, output); var tabHeaderItems = context.GetValue>(TabItems); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabLinkTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabLinkTagHelperService.cs index ba5e3e811a..54a29bf691 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabLinkTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabLinkTagHelperService.cs @@ -7,7 +7,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Tab { public class AbpTabLinkTagHelperService : AbpTagHelperService { - public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) { SetPlaceholderForNameIfNotProvided(); @@ -18,6 +18,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Tab tabHeaderItems.Add(new TabItem(tabHeader, "", false, TagHelper.Name, TagHelper.ParentDropdownName, false)); output.SuppressOutput(); + + return Task.CompletedTask; } protected virtual string GetTabHeaderItem(TagHelperContext context, TagHelperOutput output) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabTagHelperService.cs index 7d8dc7224c..2de18d0592 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabTagHelperService.cs @@ -12,7 +12,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Tab { SetPlaceholderForNameIfNotProvided(); - var innerContent = await output.GetChildContentAsync().ConfigureAwait(false); + var innerContent = await output.GetChildContentAsync(); var tabHeader = GetTabHeaderItem(context, output); var tabContent = GetTabContentItem(context, output, innerContent.GetContent()); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabsTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabsTagHelperService.cs index 37d307ac05..a28e0c7057 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabsTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/TagHelpers/Tab/AbpTabsTagHelperService.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Tab var items = InitilizeFormGroupContentsContext(context, output); - await output.GetChildContentAsync().ConfigureAwait(false); + await output.GetChildContentAsync(); var headers = GetHeaders(context, output, items); var contents = GetConents(context, output, items); @@ -45,8 +45,8 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Tab var headerColumnSize = GetHeaderColumnSize(); var contentColumnSize = 12 - headerColumnSize; - headers = PlaceInsideColunm(headers, headerColumnSize); - contents = PlaceInsideColunm(contents, contentColumnSize); + headers = PlaceInsideColumn(headers, headerColumnSize); + contents = PlaceInsideColumn(contents, contentColumnSize); } @@ -79,9 +79,9 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Tab return surroundedContents; } - protected virtual string PlaceInsideColunm(string contents, int columnSize) + protected virtual string PlaceInsideColumn(string contents, int columnSize) { - var surroundedContents = "
    " + Environment.NewLine + + var surroundedContents = "
    " + Environment.NewLine + contents + "
    "; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj index c6ad85408b..2fb94ac218 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/FodyWeavers.xml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/FodyWeavers.xsd b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj index a1b83cbaef..84ea011233 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo.Abp.AspNetCore.Mvc.UI.Bundling.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs index 5683a2039f..f5806364f3 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/BundleManager.cs @@ -61,12 +61,12 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling public virtual async Task> GetStyleBundleFilesAsync(string bundleName) { - return await GetBundleFilesAsync(Options.StyleBundles, bundleName, StyleBundler).ConfigureAwait(false); + return await GetBundleFilesAsync(Options.StyleBundles, bundleName, StyleBundler); } public virtual async Task> GetScriptBundleFilesAsync(string bundleName) { - return await GetBundleFilesAsync(Options.ScriptBundles, bundleName, ScriptBundler).ConfigureAwait(false); + return await GetBundleFilesAsync(Options.ScriptBundles, bundleName, ScriptBundler); } protected virtual async Task> GetBundleFilesAsync(BundleConfigurationCollection bundles, string bundleName, IBundler bundler) @@ -185,17 +185,17 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling foreach (var contributor in contributors) { - await contributor.PreConfigureBundleAsync(context).ConfigureAwait(false); + await contributor.PreConfigureBundleAsync(context); } foreach (var contributor in contributors) { - await contributor.ConfigureBundleAsync(context).ConfigureAwait(false); + await contributor.ConfigureBundleAsync(context); } foreach (var contributor in contributors) { - await contributor.PostConfigureBundleAsync(context).ConfigureAwait(false); + await contributor.PostConfigureBundleAsync(context); } return context.Files; @@ -207,7 +207,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling foreach (var contributor in contributors) { - await contributor.ConfigureDynamicResourcesAsync(context).ConfigureAwait(false); + await contributor.ConfigureDynamicResourcesAsync(context); } return context.Files; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleItemTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleItemTagHelperService.cs index a7c504054c..fc59051720 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleItemTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleItemTagHelperService.cs @@ -33,7 +33,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers TagHelper.CreateBundleTagHelperItem() }, TagHelper.GetNameOrNull() - ).ConfigureAwait(false); + ); } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleTagHelperService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleTagHelperService.cs index 45aeffaf92..a8eadce1e8 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleTagHelperService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpBundleTagHelperService.cs @@ -20,16 +20,16 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers await ResourceService.ProcessAsync( context, output, - await GetBundleItems(context, output).ConfigureAwait(false), + await GetBundleItems(context, output), TagHelper.GetNameOrNull() - ).ConfigureAwait(false); + ); } protected virtual async Task> GetBundleItems(TagHelperContext context, TagHelperOutput output) { var bundleItems = new List(); context.Items[AbpTagHelperConsts.ContextBundleItemListKey] = bundleItems; - await output.GetChildContentAsync().ConfigureAwait(false); //TODO: Is there a way of executing children without getting content? + await output.GetChildContentAsync(); //TODO: Is there a way of executing children without getting content? return bundleItems; } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs index 9095fdf335..73b6e025ea 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperResourceService.cs @@ -56,7 +56,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers CreateBundle(bundleName, bundleItems); - var bundleFiles = await GetBundleFilesAsync(bundleName).ConfigureAwait(false); + var bundleFiles = await GetBundleFilesAsync(bundleName); output.Content.Clear(); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs index 8ab0dffc15..b087db517f 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperScriptService.cs @@ -36,7 +36,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers protected override async Task> GetBundleFilesAsync(string bundleName) { - return await BundleManager.GetScriptBundleFilesAsync(bundleName).ConfigureAwait(false); + return await BundleManager.GetScriptBundleFilesAsync(bundleName); } protected override void AddHtmlTag(TagHelperContext context, TagHelperOutput output, string file) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs index f82606fa03..2d273345cb 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/TagHelpers/AbpTagHelperStyleService.cs @@ -36,7 +36,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling.TagHelpers protected override async Task> GetBundleFilesAsync(string bundleName) { - return await BundleManager.GetStyleBundleFilesAsync(bundleName).ConfigureAwait(false); + return await BundleManager.GetStyleBundleFilesAsync(bundleName); } protected override void AddHtmlTag(TagHelperContext context, TagHelperOutput output, string file) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/FodyWeavers.xml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/FodyWeavers.xsd b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantAppService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantAppService.cs index 7cb02623f1..d0bea87196 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantAppService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantAppService.cs @@ -17,7 +17,7 @@ namespace Pages.Abp.MultiTenancy public async Task FindTenantByNameAsync(string name) { - var tenant = await TenantStore.FindAsync(name).ConfigureAwait(false); + var tenant = await TenantStore.FindAsync(name); if (tenant == null) { @@ -34,7 +34,7 @@ namespace Pages.Abp.MultiTenancy public async Task FindTenantByIdAsync(Guid id) { - var tenant = await TenantStore.FindAsync(id).ConfigureAwait(false); + var tenant = await TenantStore.FindAsync(id); if (tenant == null) { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantController.cs index c36d36f61f..b84ffc421f 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantController.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantController.cs @@ -17,18 +17,17 @@ namespace Pages.Abp.MultiTenancy } [HttpGet] - [Route("find-tenant/{name}")] //TODO: Remove on v1.0 [Route("tenants/by-name/{name}")] public async Task FindTenantByNameAsync(string name) { - return await _abpTenantAppService.FindTenantByNameAsync(name).ConfigureAwait(false); + return await _abpTenantAppService.FindTenantByNameAsync(name); } [HttpGet] [Route("tenants/by-id/{id}")] public async Task FindTenantByIdAsync(Guid id) { - return await _abpTenantAppService.FindTenantByIdAsync(id).ConfigureAwait(false); + return await _abpTenantAppService.FindTenantByIdAsync(id); } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/TenantSwitchModal.cshtml.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/TenantSwitchModal.cshtml.cs index da4d6d207d..bfdbb98db8 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/TenantSwitchModal.cshtml.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/TenantSwitchModal.cshtml.cs @@ -34,7 +34,7 @@ namespace Pages.Abp.MultiTenancy if (CurrentTenant.IsAvailable) { - var tenant = await TenantStore.FindAsync(CurrentTenant.GetId()).ConfigureAwait(false); + var tenant = await TenantStore.FindAsync(CurrentTenant.GetId()); Input.Name = tenant?.Name; } } @@ -47,7 +47,7 @@ namespace Pages.Abp.MultiTenancy } else { - var tenant = await TenantStore.FindAsync(Input.Name).ConfigureAwait(false); + var tenant = await TenantStore.FindAsync(Input.Name); if (tenant == null) { throw new UserFriendlyException(L["GivenTenantIsNotAvailable", Input.Name]); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj index 7a31569dda..2400b9c291 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Localization/zh-Hant.json b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Localization/zh-Hant.json new file mode 100644 index 0000000000..12eea67007 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Volo/Abp/AspNetCore/Mvc/UI/MultiTenancy/Localization/zh-Hant.json @@ -0,0 +1,12 @@ +{ + "culture": "zh-Hant", + "texts": { + "GivenTenantIsNotAvailable": "指定的租戶不可用: {0}", + "SwitchTenant": "切換租戶", + "Name": "名稱", + "SwitchTenantHint": "將name欄位留空以切換到主控端.", + "Tenant": "租戶", + "Switch": "切換", + "NotSelected": "尚未選定" + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/FodyWeavers.xml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/FodyWeavers.xsd b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo.Abp.AspNetCore.Mvc.UI.Packages.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo.Abp.AspNetCore.Mvc.UI.Packages.csproj index 7a86cbb464..6cb0a02153 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo.Abp.AspNetCore.Mvc.UI.Packages.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo.Abp.AspNetCore.Mvc.UI.Packages.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/FodyWeavers.xml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/FodyWeavers.xsd b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/MainNavbarMenuViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/MainNavbarMenuViewComponent.cs index bccd8e00de..0369457165 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/MainNavbarMenuViewComponent.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Menu/MainNavbarMenuViewComponent.cs @@ -15,7 +15,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Themes.Basic.Components.Menu public async Task InvokeAsync() { - var menu = await _menuManager.GetAsync(StandardMenus.Main).ConfigureAwait(false); + var menu = await _menuManager.GetAsync(StandardMenus.Main); return View("~/Themes/Basic/Components/Menu/Default.cshtml", menu); } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/LanguageSwitch/LanguageSwitchViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/LanguageSwitch/LanguageSwitchViewComponent.cs index e58190060b..c6921d3210 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/LanguageSwitch/LanguageSwitchViewComponent.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/LanguageSwitch/LanguageSwitchViewComponent.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Themes.Basic.Components.Toolbar public async Task InvokeAsync() { - var languages = await _languageProvider.GetLanguagesAsync().ConfigureAwait(false); + var languages = await _languageProvider.GetLanguagesAsync(); var currentLanguage = languages.FindByCulture( CultureInfo.CurrentCulture.Name, CultureInfo.CurrentUICulture.Name diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/MainNavbarToolsViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/MainNavbarToolsViewComponent.cs index 862dbe7e2f..bfd02bbf4a 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/MainNavbarToolsViewComponent.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/MainNavbarToolsViewComponent.cs @@ -15,7 +15,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Themes.Basic.Components.Toolbar public async Task InvokeAsync() { - var toolbar = await _toolbarManager.GetAsync(StandardToolbars.Main).ConfigureAwait(false); + var toolbar = await _toolbarManager.GetAsync(StandardToolbars.Main); return View("~/Themes/Basic/Components/Toolbar/Default.cshtml", toolbar); } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/UserMenu/UserMenuViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/UserMenu/UserMenuViewComponent.cs index feb7fb09a5..cde4208578 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/UserMenu/UserMenuViewComponent.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Themes/Basic/Components/Toolbar/UserMenu/UserMenuViewComponent.cs @@ -15,7 +15,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Themes.Basic.Components.Toolbar public async Task InvokeAsync() { - var menu = await _menuManager.GetAsync(StandardMenus.User).ConfigureAwait(false); + var menu = await _menuManager.GetAsync(StandardMenus.User); return View("~/Themes/Basic/Components/Toolbar/UserMenu/Default.cshtml", menu); } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Toolbars/BasicThemeMainTopToolbarContributor.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Toolbars/BasicThemeMainTopToolbarContributor.cs index 01e812adfe..1ed1d2d5d3 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Toolbars/BasicThemeMainTopToolbarContributor.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Toolbars/BasicThemeMainTopToolbarContributor.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.Toolbars var languageProvider = context.ServiceProvider.GetService(); //TODO: This duplicates GetLanguages() usage. Can we eleminate this? - var languages = await languageProvider.GetLanguagesAsync().ConfigureAwait(false); + var languages = await languageProvider.GetLanguagesAsync(); if (languages.Count > 1) { context.Toolbar.Items.Add(new ToolbarItem(typeof(LanguageSwitchViewComponent))); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj index 168ca481fd..43f5bc20bf 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic.csproj @@ -1,5 +1,6 @@ - + + @@ -36,4 +37,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/wwwroot/themes/basic/layout.css b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/wwwroot/themes/basic/layout.css index 4f25e603b8..c252bf55ef 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/wwwroot/themes/basic/layout.css +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic/wwwroot/themes/basic/layout.css @@ -56,4 +56,8 @@ .field-validation-error { font-size: 0.8em; } - \ No newline at end of file + + +.dataTables_scrollBody { + min-height: 248px; +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Controllers/ErrorController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Controllers/ErrorController.cs index 371b886382..1fb4c12cf2 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Controllers/ErrorController.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Controllers/ErrorController.cs @@ -61,7 +61,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Controllers if (string.IsNullOrWhiteSpace(page)) { - return "~/Pages/Error/Default.cshtml"; + return "~/Views/Error/Default.cshtml"; } return page; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/FodyWeavers.xml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/FodyWeavers.xsd b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/ToolbarManager.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/ToolbarManager.cs index e2d66a7d11..f1ac30779a 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/ToolbarManager.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/ToolbarManager.cs @@ -33,7 +33,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars foreach (var contributor in Options.Contributors) { - await contributor.ConfigureToolbarAsync(context).ConfigureAwait(false); + await contributor.ConfigureToolbarAsync(context); } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj index 0962057909..7c4147bba5 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.csproj @@ -1,5 +1,6 @@ - + + @@ -39,4 +40,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/FodyWeavers.xml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/FodyWeavers.xsd b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj index d26c12fc7a..06afcf3f3e 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo.Abp.AspNetCore.Mvc.UI.Widgets.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/AbpViewComponentHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/AbpViewComponentHelper.cs index e148947c77..826c7635cf 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/AbpViewComponentHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/AbpViewComponentHelper.cs @@ -33,10 +33,10 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets var widget = Options.Widgets.Find(name); if (widget == null) { - return await DefaultViewComponentHelper.InvokeAsync(name, arguments).ConfigureAwait(false); + return await DefaultViewComponentHelper.InvokeAsync(name, arguments); } - return await InvokeWidgetAsync(arguments, widget).ConfigureAwait(false); + return await InvokeWidgetAsync(arguments, widget); } public virtual async Task InvokeAsync(Type componentType, object arguments) @@ -44,10 +44,10 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets var widget = Options.Widgets.Find(componentType); if (widget == null) { - return await DefaultViewComponentHelper.InvokeAsync(componentType, arguments).ConfigureAwait(false); + return await DefaultViewComponentHelper.InvokeAsync(componentType, arguments); } - return await InvokeWidgetAsync(arguments, widget).ConfigureAwait(false); + return await InvokeWidgetAsync(arguments, widget); } public virtual void Contextualize(ViewContext viewContext) @@ -68,7 +68,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets return new HtmlContentBuilder() .AppendHtml($"
    ") - .AppendHtml(await DefaultViewComponentHelper.InvokeAsync(widget.ViewComponentType, arguments).ConfigureAwait(false)) + .AppendHtml(await DefaultViewComponentHelper.InvokeAsync(widget.ViewComponentType, arguments)) .AppendHtml("
    "); } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetManager.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetManager.cs index 2249090bd8..ffd03d28dc 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetManager.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets/Volo/Abp/AspNetCore/Mvc/UI/Widgets/WidgetManager.cs @@ -27,14 +27,14 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets { var widget = Options.Widgets.Find(widgetComponentType); - return await IsGrantedAsyncInternal(widget, widgetComponentType.FullName).ConfigureAwait(false); + return await IsGrantedAsyncInternal(widget, widgetComponentType.FullName); } public async Task IsGrantedAsync(string name) { var widget = Options.Widgets.Find(name); - return await IsGrantedAsyncInternal(widget, name).ConfigureAwait(false); + return await IsGrantedAsyncInternal(widget, name); } private async Task IsGrantedAsyncInternal(WidgetDefinition widget, string wantedWidgetName) @@ -48,7 +48,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Widgets { foreach (var requiredPolicy in widget.RequiredPolicies) { - if (!(await AuthorizationService.AuthorizeAsync(requiredPolicy).ConfigureAwait(false)).Succeeded) + if (!(await AuthorizationService.AuthorizeAsync(requiredPolicy)).Succeeded) { return false; } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/FodyWeavers.xml b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/FodyWeavers.xsd b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj index fb784efd44..ffdaf02d94 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo.Abp.AspNetCore.Mvc.UI.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/FodyWeavers.xml b/framework/src/Volo.Abp.AspNetCore.Mvc/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/FodyWeavers.xsd b/framework/src/Volo.Abp.AspNetCore.Mvc/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj index 0778c57747..dabe2e30d4 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo.Abp.AspNetCore.Mvc.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs index 1744658d41..69f75a31b2 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationAppService.cs @@ -56,12 +56,12 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations return new ApplicationConfigurationDto { - Auth = await GetAuthConfigAsync().ConfigureAwait(false), - Features = await GetFeaturesConfigAsync().ConfigureAwait(false), - Localization = await GetLocalizationConfigAsync().ConfigureAwait(false), + Auth = await GetAuthConfigAsync(), + Features = await GetFeaturesConfigAsync(), + Localization = await GetLocalizationConfigAsync(), CurrentUser = GetCurrentUser(), Setting = await GetSettingConfigAsync() -.ConfigureAwait(false) + }; } @@ -82,7 +82,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations var authConfig = new ApplicationAuthConfigurationDto(); - var policyNames = await _abpAuthorizationPolicyProvider.GetPoliciesNamesAsync().ConfigureAwait(false); + var policyNames = await _abpAuthorizationPolicyProvider.GetPoliciesNamesAsync(); Logger.LogDebug($"GetPoliciesNamesAsync returns {policyNames.Count} items."); @@ -92,7 +92,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations Logger.LogDebug($"_authorizationService.IsGrantedAsync? {policyName}"); - if (await _authorizationService.IsGrantedAsync(policyName).ConfigureAwait(false)) + if (await _authorizationService.IsGrantedAsync(policyName)) { authConfig.GrantedPolicies[policyName] = true; } @@ -175,7 +175,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations continue; } - result.Values[settingDefinition.Name] = await _settingProvider.GetOrNullAsync(settingDefinition.Name).ConfigureAwait(false); + result.Values[settingDefinition.Name] = await _settingProvider.GetOrNullAsync(settingDefinition.Name); } Logger.LogDebug("Executed AbpApplicationConfigurationAppService.GetSettingConfigAsync()"); @@ -196,7 +196,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations continue; } - result.Values[featureDefinition.Name] = await FeatureChecker.GetOrNullAsync(featureDefinition.Name).ConfigureAwait(false); + result.Values[featureDefinition.Name] = await FeatureChecker.GetOrNullAsync(featureDefinition.Name); } Logger.LogDebug("Executed AbpApplicationConfigurationAppService.GetFeaturesConfigAsync()"); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationController.cs index ae41e579c9..67672986be 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationController.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationController.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations [HttpGet] public async Task GetAsync() { - return await _applicationConfigurationAppService.GetAsync().ConfigureAwait(false); + return await _applicationConfigurationAppService.GetAsync(); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationScriptController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationScriptController.cs index 00cef65179..6cc01966a5 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationScriptController.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationScriptController.cs @@ -35,7 +35,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations [Produces(MimeTypes.Application.Javascript, MimeTypes.Text.Plain)] public async Task Get() { - var script = CreateAbpExtendScript(await _configurationAppService.GetAsync().ConfigureAwait(false)); + var script = CreateAbpExtendScript(await _configurationAppService.GetAsync()); return Content( _options.MinifyGeneratedScript == true diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs index d9cb936326..3069d72e9d 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs @@ -175,7 +175,10 @@ namespace Volo.Abp.AspNetCore.Mvc parameterDescription.RouteInfo?.IsOptional ?? false, parameterDescription.RouteInfo?.DefaultValue, parameterDescription.RouteInfo?.Constraints?.Select(c => c.GetType().Name).ToArray(), - parameterDescription.Source.Id + parameterDescription.Source.Id, + parameterDescription.ModelMetadata?.ContainerType != null + ? parameterDescription.ParameterDescriptor?.Name ?? string.Empty + : string.Empty ) ); } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditActionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditActionFilter.cs index 4699689d76..33932137cb 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditActionFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Auditing/AbpAuditActionFilter.cs @@ -27,7 +27,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Auditing { if (!ShouldSaveAudit(context, out var auditLog, out var auditLogAction)) { - await next().ConfigureAwait(false); + await next(); return; } @@ -37,7 +37,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Auditing try { - var result = await next().ConfigureAwait(false); + var result = await next(); if (result.Exception != null && !result.ExceptionHandled) { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Authentication/ChallengeAccountController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Authentication/ChallengeAccountController.cs index d3a8025813..36e0bebfd6 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Authentication/ChallengeAccountController.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Authentication/ChallengeAccountController.cs @@ -8,10 +8,12 @@ namespace Volo.Abp.AspNetCore.Mvc.Authentication public abstract class ChallengeAccountController : AbpController { protected string[] ChallengeAuthenticationSchemas { get; } + protected string AuthenticationType { get; } protected ChallengeAccountController(string[] challengeAuthenticationSchemas = null) { - ChallengeAuthenticationSchemas = challengeAuthenticationSchemas ?? new[]{ "oidc" }; + ChallengeAuthenticationSchemas = challengeAuthenticationSchemas ?? new[] { "oidc" }; + AuthenticationType = "Identity.Application"; } [HttpGet] @@ -40,9 +42,14 @@ namespace Volo.Abp.AspNetCore.Mvc.Authentication [HttpGet] public async Task Logout(string returnUrl = "", string returnUrlHash = "") { - await HttpContext.SignOutAsync().ConfigureAwait(false); + await HttpContext.SignOutAsync(); - return RedirectSafely(returnUrl, returnUrlHash); + if (HttpContext.User.Identity.AuthenticationType == AuthenticationType) + { + return RedirectSafely(returnUrl, returnUrlHash); + } + + return new SignOutResult(ChallengeAuthenticationSchemas); } protected RedirectResult RedirectSafely(string returnUrl, string returnUrlHash = null) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeatureActionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeatureActionFilter.cs index ffca5b12ee..577acda339 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeatureActionFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Features/AbpFeatureActionFilter.cs @@ -23,7 +23,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Features { if (!context.ActionDescriptor.IsControllerAction()) { - await next().ConfigureAwait(false); + await next(); return; } @@ -33,9 +33,9 @@ namespace Volo.Abp.AspNetCore.Mvc.Features { await _methodInvocationAuthorizationService.CheckAsync( new MethodInvocationFeatureCheckerContext(methodInfo) - ).ConfigureAwait(false); + ); - await next().ConfigureAwait(false); + await next(); } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/AbpDateTimeModelBinder.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/AbpDateTimeModelBinder.cs index 1e31da90f8..1916b9aa16 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/AbpDateTimeModelBinder.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ModelBinding/AbpDateTimeModelBinder.cs @@ -24,7 +24,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ModelBinding public async Task BindModelAsync(ModelBindingContext bindingContext) { - await _simpleTypeModelBinder.BindModelAsync(bindingContext).ConfigureAwait(false); + await _simpleTypeModelBinder.BindModelAsync(bindingContext); if (!bindingContext.Result.IsModelSet) { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowActionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowActionFilter.cs index 56153fedea..552ce7e04e 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowActionFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowActionFilter.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow { if (!context.ActionDescriptor.IsControllerAction()) { - await next().ConfigureAwait(false); + await next(); return; } @@ -39,7 +39,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow if (unitOfWorkAttr?.IsDisabled == true) { - await next().ConfigureAwait(false); + await next(); return; } @@ -48,10 +48,10 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow //Trying to begin a reserved UOW by AbpUnitOfWorkMiddleware if (_unitOfWorkManager.TryBeginReserved(AbpUnitOfWorkMiddleware.UnitOfWorkReservationName, options)) { - var result = await next().ConfigureAwait(false); + var result = await next(); if (!Succeed(result)) { - await RollbackAsync(context).ConfigureAwait(false); + await RollbackAsync(context); } return; @@ -60,10 +60,10 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow //Begin a new, independent unit of work using (var uow = _unitOfWorkManager.Begin(options)) { - var result = await next().ConfigureAwait(false); + var result = await next(); if (Succeed(result)) { - await uow.CompleteAsync(context.HttpContext.RequestAborted).ConfigureAwait(false); + await uow.CompleteAsync(context.HttpContext.RequestAborted); } } } @@ -89,7 +89,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow var currentUow = _unitOfWorkManager.Current; if (currentUow != null) { - await currentUow.RollbackAsync(context.HttpContext.RequestAborted).ConfigureAwait(false); + await currentUow.RollbackAsync(context.HttpContext.RequestAborted); } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/AbpValidationActionFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/AbpValidationActionFilter.cs index 963459ab58..8fe699f4ba 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/AbpValidationActionFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Validation/AbpValidationActionFilter.cs @@ -1,7 +1,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Filters; -using Volo.Abp.Aspects; using Volo.Abp.DependencyInjection; namespace Volo.Abp.AspNetCore.Mvc.Validation @@ -22,12 +21,12 @@ namespace Volo.Abp.AspNetCore.Mvc.Validation if (!context.ActionDescriptor.IsControllerAction() || !context.ActionDescriptor.HasObjectResult()) { - await next().ConfigureAwait(false); + await next(); return; } _validator.Validate(context.ModelState); - await next().ConfigureAwait(false); + await next(); } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Serilog/FodyWeavers.xml b/framework/src/Volo.Abp.AspNetCore.Serilog/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Serilog/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Serilog/FodyWeavers.xsd b/framework/src/Volo.Abp.AspNetCore.Serilog/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Serilog/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Serilog/Microsoft/AspNetCore/Builder/AbpAspNetCoreSerilogApplicationBuilderExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Serilog/Microsoft/AspNetCore/Builder/AbpAspNetCoreSerilogApplicationBuilderExtensions.cs new file mode 100644 index 0000000000..cf15367e15 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Serilog/Microsoft/AspNetCore/Builder/AbpAspNetCoreSerilogApplicationBuilderExtensions.cs @@ -0,0 +1,13 @@ +using Volo.Abp.AspNetCore.Serilog; + +namespace Microsoft.AspNetCore.Builder +{ + public static class AbpAspNetCoreSerilogApplicationBuilderExtensions + { + public static IApplicationBuilder UseAbpSerilogEnrichers(this IApplicationBuilder app) + { + return app + .UseMiddleware(); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Serilog/Properties/launchSettings.json b/framework/src/Volo.Abp.AspNetCore.Serilog/Properties/launchSettings.json new file mode 100644 index 0000000000..cb1bd6546c --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Serilog/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:61851/", + "sslPort": 44301 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Volo.Abp.AspNetCore.Serilog": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "https://localhost:5001;http://localhost:5000" + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Serilog/Volo.Abp.AspNetCore.Serilog.csproj b/framework/src/Volo.Abp.AspNetCore.Serilog/Volo.Abp.AspNetCore.Serilog.csproj new file mode 100644 index 0000000000..b0bb8930df --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Serilog/Volo.Abp.AspNetCore.Serilog.csproj @@ -0,0 +1,28 @@ + + + + + + + netcoreapp3.1 + Volo.Abp.AspNetCore.Serilog + Volo.Abp.AspNetCore.Serilog + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + false + false + false + true + Library + + + + + + + + + + + + + diff --git a/framework/src/Volo.Abp.AspNetCore.Serilog/Volo/Abp/AspNetCore/Serilog/AbpAspNetCoreSerilogModule.cs b/framework/src/Volo.Abp.AspNetCore.Serilog/Volo/Abp/AspNetCore/Serilog/AbpAspNetCoreSerilogModule.cs new file mode 100644 index 0000000000..dc8e7c1ce4 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Serilog/Volo/Abp/AspNetCore/Serilog/AbpAspNetCoreSerilogModule.cs @@ -0,0 +1,13 @@ +using Volo.Abp.Modularity; +using Volo.Abp.MultiTenancy; + +namespace Volo.Abp.AspNetCore.Serilog +{ + [DependsOn( + typeof(AbpMultiTenancyModule), + typeof(AbpAspNetCoreModule) + )] + public class AbpAspNetCoreSerilogModule : AbpModule + { + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Serilog/Volo/Abp/AspNetCore/Serilog/AbpAspNetCoreSerilogOptions.cs b/framework/src/Volo.Abp.AspNetCore.Serilog/Volo/Abp/AspNetCore/Serilog/AbpAspNetCoreSerilogOptions.cs new file mode 100644 index 0000000000..84f212ff4a --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Serilog/Volo/Abp/AspNetCore/Serilog/AbpAspNetCoreSerilogOptions.cs @@ -0,0 +1,30 @@ +namespace Volo.Abp.AspNetCore.Serilog +{ + public class AbpAspNetCoreSerilogOptions + { + public AllEnricherPropertyNames EnricherPropertyNames { get; } = new AllEnricherPropertyNames(); + + public class AllEnricherPropertyNames + { + /// + /// Default value: "TenantId". + /// + public string TenantId { get; set; } = "TenantId"; + + /// + /// Default value: "UserId". + /// + public string UserId { get; set; } = "UserId"; + + /// + /// Default value: "ClientId". + /// + public string ClientId { get; set; } = "ClientId"; + + /// + /// Default value: "CorrelationId". + /// + public string CorrelationId { get; set; } = "CorrelationId"; + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.Serilog/Volo/Abp/AspNetCore/Serilog/AbpSerilogMiddleware.cs b/framework/src/Volo.Abp.AspNetCore.Serilog/Volo/Abp/AspNetCore/Serilog/AbpSerilogMiddleware.cs new file mode 100644 index 0000000000..be84d552ad --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Serilog/Volo/Abp/AspNetCore/Serilog/AbpSerilogMiddleware.cs @@ -0,0 +1,69 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Options; +using Serilog.Context; +using Serilog.Core; +using Serilog.Core.Enrichers; +using Volo.Abp.Clients; +using Volo.Abp.DependencyInjection; +using Volo.Abp.MultiTenancy; +using Volo.Abp.Tracing; +using Volo.Abp.Users; + +namespace Volo.Abp.AspNetCore.Serilog +{ + public class AbpSerilogMiddleware : IMiddleware, ITransientDependency + { + private readonly ICurrentClient _currentClient; + private readonly ICurrentTenant _currentTenant; + private readonly ICurrentUser _currentUser; + private readonly ICorrelationIdProvider _correlationIdProvider; + private readonly AbpAspNetCoreSerilogOptions _options; + + public AbpSerilogMiddleware( + ICurrentTenant currentTenant, + ICurrentUser currentUser, + ICurrentClient currentClient, + ICorrelationIdProvider correlationIdProvider, + IOptions options) + { + _currentTenant = currentTenant; + _currentUser = currentUser; + _currentClient = currentClient; + _correlationIdProvider = correlationIdProvider; + _options = options.Value; + } + + public async Task InvokeAsync(HttpContext context, RequestDelegate next) + { + var enrichers = new List(); + + if (_currentTenant?.Id != null) + { + enrichers.Add(new PropertyEnricher(_options.EnricherPropertyNames.TenantId, _currentTenant.Id)); + } + + if (_currentUser?.Id != null) + { + enrichers.Add(new PropertyEnricher(_options.EnricherPropertyNames.UserId, _currentUser.Id)); + } + + if (_currentClient?.Id != null) + { + enrichers.Add(new PropertyEnricher(_options.EnricherPropertyNames.ClientId, _currentClient.Id)); + } + + var correlationId = _correlationIdProvider.Get(); + if (!string.IsNullOrEmpty(correlationId)) + { + enrichers.Add(new PropertyEnricher(_options.EnricherPropertyNames.CorrelationId, correlationId)); + } + + using (LogContext.Push(enrichers.ToArray())) + { + await next(context); + } + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.TestBase/FodyWeavers.xml b/framework/src/Volo.Abp.AspNetCore.TestBase/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.TestBase/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.TestBase/FodyWeavers.xsd b/framework/src/Volo.Abp.AspNetCore.TestBase/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.TestBase/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj index 2a9b1d394b..38d9a34867 100644 --- a/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj +++ b/framework/src/Volo.Abp.AspNetCore.TestBase/Volo.Abp.AspNetCore.TestBase.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.AspNetCore/FodyWeavers.xml b/framework/src/Volo.Abp.AspNetCore/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore/FodyWeavers.xsd b/framework/src/Volo.Abp.AspNetCore/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs index 22c0079571..295a8bd100 100644 --- a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs @@ -2,6 +2,7 @@ using JetBrains.Annotations; using Microsoft.AspNetCore.RequestLocalization; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; using Volo.Abp; using Volo.Abp.AspNetCore.Auditing; using Volo.Abp.AspNetCore.ExceptionHandling; @@ -20,7 +21,20 @@ namespace Microsoft.AspNetCore.Builder Check.NotNull(app, nameof(app)); app.ApplicationServices.GetRequiredService>().Value = app; - app.ApplicationServices.GetRequiredService().Initialize(app.ApplicationServices); + var application = app.ApplicationServices.GetRequiredService(); + var applicationLifetime = app.ApplicationServices.GetRequiredService(); + + applicationLifetime.ApplicationStopping.Register(() => + { + application.Shutdown(); + }); + + applicationLifetime.ApplicationStopped.Register(() => + { + application.Dispose(); + }); + + application.Initialize(app.ApplicationServices); } public static IApplicationBuilder UseAuditing(this IApplicationBuilder app) @@ -42,7 +56,8 @@ namespace Microsoft.AspNetCore.Builder .UseMiddleware(); } - public static IApplicationBuilder UseAbpRequestLocalization(this IApplicationBuilder app, Action optionsAction = null) + public static IApplicationBuilder UseAbpRequestLocalization(this IApplicationBuilder app, + Action optionsAction = null) { app.ApplicationServices .GetRequiredService() @@ -62,4 +77,4 @@ namespace Microsoft.AspNetCore.Builder return app.UseMiddleware(); } } -} +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestLocalizationMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestLocalizationMiddleware.cs index 32fed42dc2..2a8c48b1c5 100644 --- a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestLocalizationMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestLocalizationMiddleware.cs @@ -27,11 +27,11 @@ namespace Microsoft.AspNetCore.RequestLocalization next, new OptionsWrapper( await _requestLocalizationOptionsProvider.GetLocalizationOptionsAsync() -.ConfigureAwait(false)), +), _loggerFactory ); - await middleware.Invoke(context).ConfigureAwait(false); + await middleware.Invoke(context); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestLocalizationOptionsFactory.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestLocalizationOptionsFactory.cs new file mode 100644 index 0000000000..10cce6a776 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestLocalizationOptionsFactory.cs @@ -0,0 +1,28 @@ +using System.Collections.Generic; +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.Options; +using Volo.Abp.Options; + +namespace Microsoft.AspNetCore.RequestLocalization +{ + public class AbpRequestLocalizationOptionsFactory : AbpOptionsFactory + { + private readonly IAbpRequestLocalizationOptionsProvider _abpRequestLocalizationOptionsProvider; + + public AbpRequestLocalizationOptionsFactory( + IAbpRequestLocalizationOptionsProvider abpRequestLocalizationOptionsProvider, + IEnumerable> setups, + IEnumerable> postConfigures) + : base( + setups, + postConfigures) + { + _abpRequestLocalizationOptionsProvider = abpRequestLocalizationOptionsProvider; + } + + public override RequestLocalizationOptions Create(string name) + { + return _abpRequestLocalizationOptionsProvider.GetLocalizationOptions(); + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/DefaultAbpRequestLocalizationOptionsProvider.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/DefaultAbpRequestLocalizationOptionsProvider.cs index 51932953ed..64f339ffce 100644 --- a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/DefaultAbpRequestLocalizationOptionsProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/DefaultAbpRequestLocalizationOptionsProvider.cs @@ -5,12 +5,14 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Localization; using Microsoft.Extensions.DependencyInjection; using Nito.AsyncEx; using Volo.Abp.DependencyInjection; using Volo.Abp.Localization; using Volo.Abp.Settings; +using Volo.Abp.Threading; namespace Microsoft.AspNetCore.RequestLocalization { @@ -32,19 +34,29 @@ namespace Microsoft.AspNetCore.RequestLocalization _optionsAction = optionsAction; } + public RequestLocalizationOptions GetLocalizationOptions() + { + if (_requestLocalizationOptions != null) + { + return _requestLocalizationOptions; + } + + return AsyncHelper.RunSync(GetLocalizationOptionsAsync); + } + public async Task GetLocalizationOptionsAsync() { if (_requestLocalizationOptions == null) { - using (await _syncSemaphore.LockAsync().ConfigureAwait(false)) + using (await _syncSemaphore.LockAsync()) { using (var serviceScope = _serviceProviderFactory.CreateScope()) { var languageProvider = serviceScope.ServiceProvider.GetRequiredService(); var settingProvider = serviceScope.ServiceProvider.GetRequiredService(); - var languages = await languageProvider.GetLanguagesAsync().ConfigureAwait(false); - var defaultLanguage = await settingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage).ConfigureAwait(false); + var languages = await languageProvider.GetLanguagesAsync(); + var defaultLanguage = await settingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage); var options = !languages.Any() ? new RequestLocalizationOptions() diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/IAbpRequestLocalizationOptionsProvider.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/IAbpRequestLocalizationOptionsProvider.cs index 86cd3153f7..cb4daec7f2 100644 --- a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/IAbpRequestLocalizationOptionsProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/IAbpRequestLocalizationOptionsProvider.cs @@ -8,6 +8,8 @@ namespace Microsoft.AspNetCore.RequestLocalization { void InitLocalizationOptions(Action optionsAction = null); + RequestLocalizationOptions GetLocalizationOptions(); + Task GetLocalizationOptionsAsync(); } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.AspNetCore/Volo.Abp.AspNetCore.csproj b/framework/src/Volo.Abp.AspNetCore/Volo.Abp.AspNetCore.csproj index 3ae691a1fc..a3089646d2 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo.Abp.AspNetCore.csproj +++ b/framework/src/Volo.Abp.AspNetCore/Volo.Abp.AspNetCore.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs index 298fffd20e..279601387d 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/AbpAspNetCoreModule.cs @@ -1,5 +1,8 @@ using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.RequestLocalization; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; +using Microsoft.Extensions.Options; using Volo.Abp.AspNetCore.Auditing; using Volo.Abp.Auditing; using Volo.Abp.Authorization; @@ -38,6 +41,8 @@ namespace Volo.Abp.AspNetCore AddAspNetServices(context.Services); context.Services.AddObjectAccessor(); + + context.Services.Replace(ServiceDescriptor.Transient, AbpRequestLocalizationOptionsFactory>()); } private static void AddAspNetServices(IServiceCollection services) diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs index d56c29709a..f59c5b6b3a 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Auditing/AbpAuditingMiddleware.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Options; @@ -28,38 +29,50 @@ namespace Volo.Abp.AspNetCore.Auditing public async Task InvokeAsync(HttpContext context, RequestDelegate next) { - if (!ShouldWriteAuditLog(context)) - { - await next(context).ConfigureAwait(false); - return; - } - + bool hasError = false; using (var scope = _auditingManager.BeginScope()) { try { - await next(context).ConfigureAwait(false); + await next(context); + if (_auditingManager.Current.Log.Exceptions.Any()) + { + hasError = true; + } + } + catch (Exception) + { + hasError = true; + throw; } finally { - await scope.SaveAsync().ConfigureAwait(false); + if (ShouldWriteAuditLog(context, hasError)) + { + await scope.SaveAsync(); + } } } } - private bool ShouldWriteAuditLog(HttpContext httpContext) + private bool ShouldWriteAuditLog(HttpContext httpContext, bool hasError = false) { if (!Options.IsEnabled) { return false; } + if (Options.AlwaysLogOnException && hasError) + { + return true; + } + if (!Options.IsEnabledForAnonymousUsers && !CurrentUser.IsAuthenticated) { return false; } - if (!Options.IsEnabledForGetRequests && + if (!Options.IsEnabledForGetRequests && string.Equals(httpContext.Request.Method, HttpMethods.Get, StringComparison.OrdinalIgnoreCase)) { return false; diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs index d9954dc424..cdd921dae4 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/ExceptionHandling/AbpExceptionHandlingMiddleware.cs @@ -29,7 +29,7 @@ namespace Volo.Abp.AspNetCore.ExceptionHandling { try { - await next(context).ConfigureAwait(false); + await next(context); } catch (Exception ex) { @@ -44,7 +44,7 @@ namespace Volo.Abp.AspNetCore.ExceptionHandling { if (actionInfo.IsObjectResult) //TODO: Align with AbpExceptionFilter.ShouldHandleException! { - await HandleAndWrapException(context, ex).ConfigureAwait(false); + await HandleAndWrapException(context, ex); return; } } @@ -72,7 +72,7 @@ namespace Volo.Abp.AspNetCore.ExceptionHandling errorInfoConverter.Convert(exception) ) ) - ).ConfigureAwait(false); + ); } private Task ClearCacheHeaders(object state) diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Tracing/AbpCorrelationIdMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Tracing/AbpCorrelationIdMiddleware.cs index 068adffefb..b3ee565100 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Tracing/AbpCorrelationIdMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Tracing/AbpCorrelationIdMiddleware.cs @@ -24,7 +24,7 @@ namespace Volo.Abp.AspNetCore.Tracing try { - await next(context).ConfigureAwait(false); + await next(context); } finally { diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Uow/AbpUnitOfWorkMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Uow/AbpUnitOfWorkMiddleware.cs index 46572b4450..c9ac1be509 100644 --- a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Uow/AbpUnitOfWorkMiddleware.cs +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Uow/AbpUnitOfWorkMiddleware.cs @@ -20,8 +20,8 @@ namespace Volo.Abp.AspNetCore.Uow { using (var uow = _unitOfWorkManager.Reserve(UnitOfWorkReservationName)) { - await next(context).ConfigureAwait(false); - await uow.CompleteAsync(context.RequestAborted).ConfigureAwait(false); + await next(context); + await uow.CompleteAsync(context.RequestAborted); } } } diff --git a/framework/src/Volo.Abp.Auditing/FodyWeavers.xml b/framework/src/Volo.Abp.Auditing/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Auditing/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Auditing/FodyWeavers.xsd b/framework/src/Volo.Abp.Auditing/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Auditing/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Auditing/Volo.Abp.Auditing.csproj b/framework/src/Volo.Abp.Auditing/Volo.Abp.Auditing.csproj index cca8e99545..4ac2420c8f 100644 --- a/framework/src/Volo.Abp.Auditing/Volo.Abp.Auditing.csproj +++ b/framework/src/Volo.Abp.Auditing/Volo.Abp.Auditing.csproj @@ -1,5 +1,6 @@ + diff --git a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AbpAuditingOptions.cs b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AbpAuditingOptions.cs index da406fa490..58a0713014 100644 --- a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AbpAuditingOptions.cs +++ b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AbpAuditingOptions.cs @@ -31,6 +31,12 @@ namespace Volo.Abp.Auditing /// public bool IsEnabledForAnonymousUsers { get; set; } + /// + /// Audit log on exceptions. + /// Default: true. + /// + public bool AlwaysLogOnException { get; set; } + public List Contributors { get; } public List IgnoredTypes { get; } @@ -48,6 +54,7 @@ namespace Volo.Abp.Auditing IsEnabled = true; IsEnabledForAnonymousUsers = true; HideErrors = true; + AlwaysLogOnException = true; Contributors = new List(); diff --git a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptor.cs b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptor.cs index a49145298a..5a401a218e 100644 --- a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptor.cs +++ b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptor.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.Auditing { if (!ShouldIntercept(invocation, out var auditLog, out var auditLogAction)) { - await invocation.ProceedAsync().ConfigureAwait(false); + await invocation.ProceedAsync(); return; } @@ -30,7 +30,7 @@ namespace Volo.Abp.Auditing try { - await invocation.ProceedAsync().ConfigureAwait(false); + await invocation.ProceedAsync(); } catch (Exception ex) { diff --git a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptorRegistrar.cs b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptorRegistrar.cs index 546d54299c..94920fe1be 100644 --- a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptorRegistrar.cs +++ b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingInterceptorRegistrar.cs @@ -32,6 +32,8 @@ namespace Volo.Abp.Auditing //TODO: Move to a better place public static bool ShouldAuditTypeByDefault(Type type) { + //TODO: In an inheritance chain, it would be better to check the attributes on the top class first. + if (type.IsDefined(typeof(AuditedAttribute), true)) { return true; diff --git a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingManager.cs b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingManager.cs index 25738843c0..2a9dd8bf5a 100644 --- a/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingManager.cs +++ b/framework/src/Volo.Abp.Auditing/Volo/Abp/Auditing/AuditingManager.cs @@ -23,8 +23,8 @@ namespace Volo.Abp.Auditing private readonly IAuditingStore _auditingStore; public AuditingManager( - IAmbientScopeProvider ambientScopeProvider, - IAuditingHelper auditingHelper, + IAmbientScopeProvider ambientScopeProvider, + IAuditingHelper auditingHelper, IAuditingStore auditingStore, IServiceProvider serviceProvider, IOptions options) @@ -84,7 +84,7 @@ namespace Volo.Abp.Auditing { var changeGroups = auditLog.EntityChanges .Where(e => e.ChangeType == EntityChangeType.Updated) - .GroupBy(e => new {e.EntityTypeFullName, e.EntityId}) + .GroupBy(e => new { e.EntityTypeFullName, e.EntityId }) .ToList(); foreach (var changeGroup in changeGroups) @@ -116,7 +116,7 @@ namespace Volo.Abp.Auditing if (ShouldSave(saveHandle.AuditLog)) { - await _auditingStore.SaveAsync(saveHandle.AuditLog).ConfigureAwait(false); + await _auditingStore.SaveAsync(saveHandle.AuditLog); } } @@ -141,7 +141,7 @@ namespace Volo.Abp.Auditing public DisposableSaveHandle( AuditingManager auditingManager, IDisposable scope, - AuditLogInfo auditLog, + AuditLogInfo auditLog, Stopwatch stopWatch) { _auditingManager = auditingManager; @@ -152,7 +152,7 @@ namespace Volo.Abp.Auditing public async Task SaveAsync() { - await _auditingManager.SaveAsync(this).ConfigureAwait(false); + await _auditingManager.SaveAsync(this); } public void Dispose() diff --git a/framework/src/Volo.Abp.Authorization/FodyWeavers.xml b/framework/src/Volo.Abp.Authorization/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Authorization/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Authorization/FodyWeavers.xsd b/framework/src/Volo.Abp.Authorization/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Authorization/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs b/framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs index ef033170f6..45650b06a4 100644 --- a/framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs +++ b/framework/src/Volo.Abp.Authorization/Microsoft/AspNetCore/Authorization/AbpAuthorizationServiceExtensions.cs @@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Authorization authorizationService, null, policyName - ).ConfigureAwait(false); + ); } public static async Task AuthorizeAsync(this IAuthorizationService authorizationService, object resource, IAuthorizationRequirement requirement) @@ -22,7 +22,7 @@ namespace Microsoft.AspNetCore.Authorization authorizationService.AsAbpAuthorizationService().CurrentPrincipal, resource, requirement - ).ConfigureAwait(false); + ); } public static async Task AuthorizeAsync(this IAuthorizationService authorizationService, object resource, AuthorizationPolicy policy) @@ -31,16 +31,16 @@ namespace Microsoft.AspNetCore.Authorization authorizationService.AsAbpAuthorizationService().CurrentPrincipal, resource, policy - ).ConfigureAwait(false); + ); } public static async Task AuthorizeAsync(this IAuthorizationService authorizationService, AuthorizationPolicy policy) { return await AuthorizeAsync( - authorizationService, + authorizationService, null, policy - ).ConfigureAwait(false); + ); } public static async Task AuthorizeAsync(this IAuthorizationService authorizationService, object resource, IEnumerable requirements) @@ -49,7 +49,7 @@ namespace Microsoft.AspNetCore.Authorization authorizationService.AsAbpAuthorizationService().CurrentPrincipal, resource, requirements - ).ConfigureAwait(false); + ); } public static async Task AuthorizeAsync(this IAuthorizationService authorizationService, object resource, string policyName) @@ -58,42 +58,42 @@ namespace Microsoft.AspNetCore.Authorization authorizationService.AsAbpAuthorizationService().CurrentPrincipal, resource, policyName - ).ConfigureAwait(false); + ); } public static async Task IsGrantedAsync(this IAuthorizationService authorizationService, string policyName) { - return (await authorizationService.AuthorizeAsync(policyName).ConfigureAwait(false)).Succeeded; + return (await authorizationService.AuthorizeAsync(policyName)).Succeeded; } public static async Task IsGrantedAsync(this IAuthorizationService authorizationService, object resource, IAuthorizationRequirement requirement) { - return (await authorizationService.AuthorizeAsync(resource, requirement).ConfigureAwait(false)).Succeeded; + return (await authorizationService.AuthorizeAsync(resource, requirement)).Succeeded; } public static async Task IsGrantedAsync(this IAuthorizationService authorizationService, object resource, AuthorizationPolicy policy) { - return (await authorizationService.AuthorizeAsync(resource, policy).ConfigureAwait(false)).Succeeded; + return (await authorizationService.AuthorizeAsync(resource, policy)).Succeeded; } public static async Task IsGrantedAsync(this IAuthorizationService authorizationService, AuthorizationPolicy policy) { - return (await authorizationService.AuthorizeAsync(policy).ConfigureAwait(false)).Succeeded; + return (await authorizationService.AuthorizeAsync(policy)).Succeeded; } public static async Task IsGrantedAsync(this IAuthorizationService authorizationService, object resource, IEnumerable requirements) { - return (await authorizationService.AuthorizeAsync(resource, requirements).ConfigureAwait(false)).Succeeded; + return (await authorizationService.AuthorizeAsync(resource, requirements)).Succeeded; } public static async Task IsGrantedAsync(this IAuthorizationService authorizationService, object resource, string policyName) { - return (await authorizationService.AuthorizeAsync(resource, policyName).ConfigureAwait(false)).Succeeded; + return (await authorizationService.AuthorizeAsync(resource, policyName)).Succeeded; } public static async Task CheckAsync(this IAuthorizationService authorizationService, string policyName) { - if (!await authorizationService.IsGrantedAsync(policyName).ConfigureAwait(false)) + if (!await authorizationService.IsGrantedAsync(policyName)) { throw new AbpAuthorizationException("Authorization failed! Given policy has not granted: " + policyName); } @@ -101,7 +101,7 @@ namespace Microsoft.AspNetCore.Authorization public static async Task CheckAsync(this IAuthorizationService authorizationService, object resource, IAuthorizationRequirement requirement) { - if (!await authorizationService.IsGrantedAsync(resource, requirement).ConfigureAwait(false)) + if (!await authorizationService.IsGrantedAsync(resource, requirement)) { throw new AbpAuthorizationException("Authorization failed! Given requirement has not granted for given resource: " + resource); } @@ -109,7 +109,7 @@ namespace Microsoft.AspNetCore.Authorization public static async Task CheckAsync(this IAuthorizationService authorizationService, object resource, AuthorizationPolicy policy) { - if (!await authorizationService.IsGrantedAsync(resource, policy).ConfigureAwait(false)) + if (!await authorizationService.IsGrantedAsync(resource, policy)) { throw new AbpAuthorizationException("Authorization failed! Given policy has not granted for given resource: " + resource); } @@ -117,7 +117,7 @@ namespace Microsoft.AspNetCore.Authorization public static async Task CheckAsync(this IAuthorizationService authorizationService, AuthorizationPolicy policy) { - if (!await authorizationService.IsGrantedAsync(policy).ConfigureAwait(false)) + if (!await authorizationService.IsGrantedAsync(policy)) { throw new AbpAuthorizationException("Authorization failed! Given policy has not granted."); } @@ -125,7 +125,7 @@ namespace Microsoft.AspNetCore.Authorization public static async Task CheckAsync(this IAuthorizationService authorizationService, object resource, IEnumerable requirements) { - if (!await authorizationService.IsGrantedAsync(resource, requirements).ConfigureAwait(false)) + if (!await authorizationService.IsGrantedAsync(resource, requirements)) { throw new AbpAuthorizationException("Authorization failed! Given requirements have not granted for given resource: " + resource); } @@ -133,7 +133,7 @@ namespace Microsoft.AspNetCore.Authorization public static async Task CheckAsync(this IAuthorizationService authorizationService, object resource, string policyName) { - if (!await authorizationService.IsGrantedAsync(resource, policyName).ConfigureAwait(false)) + if (!await authorizationService.IsGrantedAsync(resource, policyName)) { throw new AbpAuthorizationException("Authorization failed! Given polist has not granted for given resource: " + resource); } diff --git a/framework/src/Volo.Abp.Authorization/Volo.Abp.Authorization.csproj b/framework/src/Volo.Abp.Authorization/Volo.Abp.Authorization.csproj index 616436707f..8c6482837f 100644 --- a/framework/src/Volo.Abp.Authorization/Volo.Abp.Authorization.csproj +++ b/framework/src/Volo.Abp.Authorization/Volo.Abp.Authorization.csproj @@ -1,5 +1,6 @@ + diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationPolicyProvider.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationPolicyProvider.cs index 61454b76e1..f636877fc1 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationPolicyProvider.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AbpAuthorizationPolicyProvider.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.Authorization public override async Task GetPolicyAsync(string policyName) { - var policy = await base.GetPolicyAsync(policyName).ConfigureAwait(false); + var policy = await base.GetPolicyAsync(policyName); if (policy != null) { return policy; diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AuthorizationInterceptor.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AuthorizationInterceptor.cs index 5c7afbd7c7..44466884dd 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AuthorizationInterceptor.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/AuthorizationInterceptor.cs @@ -15,8 +15,8 @@ namespace Volo.Abp.Authorization public override async Task InterceptAsync(IAbpMethodInvocation invocation) { - await AuthorizeAsync(invocation).ConfigureAwait(false); - await invocation.ProceedAsync().ConfigureAwait(false); + await AuthorizeAsync(invocation); + await invocation.ProceedAsync(); } protected virtual async Task AuthorizeAsync(IAbpMethodInvocation invocation) @@ -25,7 +25,7 @@ namespace Volo.Abp.Authorization new MethodInvocationAuthorizationContext( invocation.Method ) - ).ConfigureAwait(false); + ); } } } diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs index 1e063f1f0e..56baba8ce4 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/MethodInvocationAuthorizationService.cs @@ -34,7 +34,7 @@ namespace Volo.Abp.Authorization foreach (var authorizationAttribute in GetAuthorizationDataAttributes(context.Method)) { - await CheckAsync(authorizationAttribute).ConfigureAwait(false); + await CheckAsync(authorizationAttribute); } } @@ -74,7 +74,7 @@ namespace Volo.Abp.Authorization } else { - await _authorizationService.CheckAsync(authorizationAttribute.Policy).ConfigureAwait(false); + await _authorizationService.CheckAsync(authorizationAttribute.Policy); } //TODO: What about roles and other props? diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/PermissionRequirementHandler.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/PermissionRequirementHandler.cs index 89c0a1f71b..d4ec7c1d3c 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/PermissionRequirementHandler.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/PermissionRequirementHandler.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.Authorization AuthorizationHandlerContext context, PermissionRequirement requirement) { - if (await _permissionChecker.IsGrantedAsync(context.User, requirement.PermissionName).ConfigureAwait(false)) + if (await _permissionChecker.IsGrantedAsync(context.User, requirement.PermissionName)) { context.Succeed(requirement); } diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/ClientPermissionValueProvider.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/ClientPermissionValueProvider.cs index 33aeb568b2..38c29b1ddf 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/ClientPermissionValueProvider.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/ClientPermissionValueProvider.cs @@ -24,8 +24,8 @@ namespace Volo.Abp.Authorization.Permissions return PermissionGrantResult.Undefined; } - return await PermissionStore.IsGrantedAsync(context.Permission.Name, Name, clientId) -.ConfigureAwait(false) ? PermissionGrantResult.Granted + return await PermissionStore.IsGrantedAsync(context.Permission.Name, Name, clientId) + ? PermissionGrantResult.Granted : PermissionGrantResult.Undefined; } } diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionChecker.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionChecker.cs index 165a354743..51c8530ee6 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionChecker.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/PermissionChecker.cs @@ -29,7 +29,7 @@ namespace Volo.Abp.Authorization.Permissions public virtual async Task IsGrantedAsync(string name) { - return await IsGrantedAsync(PrincipalAccessor.Principal, name).ConfigureAwait(false); + return await IsGrantedAsync(PrincipalAccessor.Principal, name); } public virtual async Task IsGrantedAsync(ClaimsPrincipal claimsPrincipal, string name) @@ -56,7 +56,7 @@ namespace Volo.Abp.Authorization.Permissions continue; } - var result = await provider.CheckAsync(context).ConfigureAwait(false); + var result = await provider.CheckAsync(context); if (result == PermissionGrantResult.Granted) { diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/RolePermissionValueProvider.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/RolePermissionValueProvider.cs index f5322b4f12..b98867a78e 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/RolePermissionValueProvider.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/RolePermissionValueProvider.cs @@ -27,7 +27,7 @@ namespace Volo.Abp.Authorization.Permissions foreach (var role in roles) { - if (await PermissionStore.IsGrantedAsync(context.Permission.Name, Name, role).ConfigureAwait(false)) + if (await PermissionStore.IsGrantedAsync(context.Permission.Name, Name, role)) { return PermissionGrantResult.Granted; } diff --git a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/UserPermissionValueProvider.cs b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/UserPermissionValueProvider.cs index 49a1eec366..c7f327c40c 100644 --- a/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/UserPermissionValueProvider.cs +++ b/framework/src/Volo.Abp.Authorization/Volo/Abp/Authorization/Permissions/UserPermissionValueProvider.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.Authorization.Permissions } return await PermissionStore.IsGrantedAsync(context.Permission.Name, Name, userId) -.ConfigureAwait(false) ? PermissionGrantResult.Granted + ? PermissionGrantResult.Granted : PermissionGrantResult.Undefined; } } diff --git a/framework/src/Volo.Abp.AutoMapper/FodyWeavers.xml b/framework/src/Volo.Abp.AutoMapper/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.AutoMapper/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AutoMapper/FodyWeavers.xsd b/framework/src/Volo.Abp.AutoMapper/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.AutoMapper/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.AutoMapper/Volo.Abp.AutoMapper.csproj b/framework/src/Volo.Abp.AutoMapper/Volo.Abp.AutoMapper.csproj index ae6d39c61c..e6146fedde 100644 --- a/framework/src/Volo.Abp.AutoMapper/Volo.Abp.AutoMapper.csproj +++ b/framework/src/Volo.Abp.AutoMapper/Volo.Abp.AutoMapper.csproj @@ -1,5 +1,6 @@ - + + @@ -21,4 +22,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.Autofac/Autofac/Extensions/DependencyInjection/AutofacServiceProvider.cs b/framework/src/Volo.Abp.Autofac/Autofac/Extensions/DependencyInjection/AutofacServiceProvider.cs index ff2d45b2a4..1c1a24ff66 100644 --- a/framework/src/Volo.Abp.Autofac/Autofac/Extensions/DependencyInjection/AutofacServiceProvider.cs +++ b/framework/src/Volo.Abp.Autofac/Autofac/Extensions/DependencyInjection/AutofacServiceProvider.cs @@ -1,6 +1,6 @@ // This software is part of the Autofac IoC container // Copyright © 2015 Autofac Contributors -// http://autofac.org +// https://autofac.org // // Permission is hereby granted, free of charge, to any person // obtaining a copy of this software and associated documentation @@ -33,19 +33,21 @@ namespace Autofac.Extensions.DependencyInjection /// /// /// - public class AutofacServiceProvider : IServiceProvider, ISupportRequiredService + public class AutofacServiceProvider : IServiceProvider, ISupportRequiredService, IDisposable { - private readonly IComponentContext _componentContext; + private readonly ILifetimeScope _lifetimeScope; + + private bool _disposed = false; /// /// Initializes a new instance of the class. /// - /// - /// The component context from which services should be resolved. + /// + /// The lifetime scope from which services will be resolved. /// - public AutofacServiceProvider(IComponentContext componentContext) + public AutofacServiceProvider(ILifetimeScope lifetimeScope) { - this._componentContext = componentContext; + this._lifetimeScope = lifetimeScope; } /// @@ -66,7 +68,7 @@ namespace Autofac.Extensions.DependencyInjection /// public object GetRequiredService(Type serviceType) { - return this._componentContext.Resolve(serviceType); + return this._lifetimeScope.Resolve(serviceType); } /// @@ -81,7 +83,40 @@ namespace Autofac.Extensions.DependencyInjection /// public object GetService(Type serviceType) { - return this._componentContext.ResolveOptional(serviceType); + return this._lifetimeScope.ResolveOptional(serviceType); + } + + /// + /// Gets the underlying instance of . + /// + public ILifetimeScope LifetimeScope => _lifetimeScope; + + /// + /// Releases unmanaged and - optionally - managed resources. + /// + /// + /// to release both managed and unmanaged resources; + /// to release only unmanaged resources. + /// + protected virtual void Dispose(bool disposing) + { + if (!this._disposed) + { + this._disposed = true; + if (disposing) + { + this._lifetimeScope.Dispose(); + } + } + } + + /// + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// + public void Dispose() + { + this.Dispose(true); + GC.SuppressFinalize(this); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Autofac/FodyWeavers.xml b/framework/src/Volo.Abp.Autofac/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Autofac/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Autofac/FodyWeavers.xsd b/framework/src/Volo.Abp.Autofac/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Autofac/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj b/framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj index 8caf74b672..868f7e6719 100644 --- a/framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj +++ b/framework/src/Volo.Abp.Autofac/Volo.Abp.Autofac.csproj @@ -1,5 +1,6 @@ - + + @@ -23,4 +24,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/FodyWeavers.xml b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/FodyWeavers.xsd b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo.Abp.BackgroundJobs.Abstractions.csproj b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo.Abp.BackgroundJobs.Abstractions.csproj index f85081f15a..1788867e39 100644 --- a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo.Abp.BackgroundJobs.Abstractions.csproj +++ b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo.Abp.BackgroundJobs.Abstractions.csproj @@ -1,5 +1,6 @@ - + + @@ -17,4 +18,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobExecuter.cs b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobExecuter.cs index ec0ac8ee3f..d4ce5cd03a 100644 --- a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobExecuter.cs +++ b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/BackgroundJobExecuter.cs @@ -4,7 +4,6 @@ using Microsoft.Extensions.Options; using System; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; -using Volo.Abp.Threading; namespace Volo.Abp.BackgroundJobs { @@ -21,7 +20,7 @@ namespace Volo.Abp.BackgroundJobs Logger = NullLogger.Instance; } - public virtual void Execute(JobExecutionContext context) + public virtual async Task ExecuteAsync(JobExecutionContext context) { var job = context.ServiceProvider.GetService(context.JobType); if (job == null) @@ -41,7 +40,7 @@ namespace Volo.Abp.BackgroundJobs { if (jobExecuteMethod.Name == nameof(IAsyncBackgroundJob.ExecuteAsync)) { - AsyncHelper.RunSync(() => (Task) jobExecuteMethod.Invoke(job, new[] {context.JobArgs})); + await ((Task) jobExecuteMethod.Invoke(job, new[] {context.JobArgs})); } else { diff --git a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/IBackgroundJobExecuter.cs b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/IBackgroundJobExecuter.cs index 2470b2945b..eaea1764f3 100644 --- a/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/IBackgroundJobExecuter.cs +++ b/framework/src/Volo.Abp.BackgroundJobs.Abstractions/Volo/Abp/BackgroundJobs/IBackgroundJobExecuter.cs @@ -1,7 +1,9 @@ -namespace Volo.Abp.BackgroundJobs +using System.Threading.Tasks; + +namespace Volo.Abp.BackgroundJobs { public interface IBackgroundJobExecuter { - void Execute(JobExecutionContext context); + Task ExecuteAsync(JobExecutionContext context); } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundJobs.HangFire/FodyWeavers.xml b/framework/src/Volo.Abp.BackgroundJobs.HangFire/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.HangFire/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundJobs.HangFire/FodyWeavers.xsd b/framework/src/Volo.Abp.BackgroundJobs.HangFire/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.HangFire/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundJobs.HangFire/Volo.Abp.BackgroundJobs.HangFire.csproj b/framework/src/Volo.Abp.BackgroundJobs.HangFire/Volo.Abp.BackgroundJobs.HangFire.csproj index e47408ca4b..9a197ef095 100644 --- a/framework/src/Volo.Abp.BackgroundJobs.HangFire/Volo.Abp.BackgroundJobs.HangFire.csproj +++ b/framework/src/Volo.Abp.BackgroundJobs.HangFire/Volo.Abp.BackgroundJobs.HangFire.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.BackgroundJobs.HangFire/Volo/Abp/BackgroundJobs/Hangfire/HangfireJobExecutionAdapter.cs b/framework/src/Volo.Abp.BackgroundJobs.HangFire/Volo/Abp/BackgroundJobs/Hangfire/HangfireJobExecutionAdapter.cs index 4a61aa2845..676a3eaafc 100644 --- a/framework/src/Volo.Abp.BackgroundJobs.HangFire/Volo/Abp/BackgroundJobs/Hangfire/HangfireJobExecutionAdapter.cs +++ b/framework/src/Volo.Abp.BackgroundJobs.HangFire/Volo/Abp/BackgroundJobs/Hangfire/HangfireJobExecutionAdapter.cs @@ -1,5 +1,6 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; +using Volo.Abp.Threading; namespace Volo.Abp.BackgroundJobs.Hangfire { @@ -25,7 +26,7 @@ namespace Volo.Abp.BackgroundJobs.Hangfire { var jobType = Options.GetJob(typeof(TArgs)).JobType; var context = new JobExecutionContext(scope.ServiceProvider, jobType, args); - JobExecuter.Execute(context); + AsyncHelper.RunSync(() => JobExecuter.ExecuteAsync(context)); } } } diff --git a/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/FodyWeavers.xml b/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/FodyWeavers.xsd b/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo.Abp.BackgroundJobs.RabbitMQ.csproj b/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo.Abp.BackgroundJobs.RabbitMQ.csproj index 8ee2c499b6..a74903bad4 100644 --- a/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo.Abp.BackgroundJobs.RabbitMQ.csproj +++ b/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo.Abp.BackgroundJobs.RabbitMQ.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueue.cs b/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueue.cs index 7675a64ca0..4cb4f04a09 100644 --- a/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueue.cs +++ b/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueue.cs @@ -10,6 +10,7 @@ using Nito.AsyncEx; using RabbitMQ.Client; using RabbitMQ.Client.Events; using Volo.Abp.RabbitMQ; +using Volo.Abp.Threading; namespace Volo.Abp.BackgroundJobs.RabbitMQ { @@ -71,11 +72,11 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ { CheckDisposed(); - using (await SyncObj.LockAsync().ConfigureAwait(false)) + using (await SyncObj.LockAsync()) { - await EnsureInitializedAsync().ConfigureAwait(false); + await EnsureInitializedAsync(); - await PublishAsync(args, priority, delay).ConfigureAwait(false); + await PublishAsync(args, priority, delay); return null; } @@ -90,9 +91,9 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ return; } - using (await SyncObj.LockAsync().ConfigureAwait(false)) + using (await SyncObj.LockAsync()) { - await EnsureInitializedAsync().ConfigureAwait(false); + await EnsureInitializedAsync(); } } @@ -181,7 +182,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ try { - JobExecuter.Execute(context); + AsyncHelper.RunSync(() => JobExecuter.ExecuteAsync(context)); ChannelAccessor.Channel.BasicAck(deliveryTag: ea.DeliveryTag, multiple: false); } catch (BackgroundJobExecutionException) diff --git a/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueueManager.cs b/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueueManager.cs index 6c50460003..f07564ad5a 100644 --- a/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueueManager.cs +++ b/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/JobQueueManager.cs @@ -40,7 +40,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ foreach (var jobConfiguration in Options.GetJobs()) { var jobQueue = (IRunnable)ServiceProvider.GetRequiredService(typeof(IJobQueue<>).MakeGenericType(jobConfiguration.ArgsType)); - await jobQueue.StartAsync(cancellationToken).ConfigureAwait(false); + await jobQueue.StartAsync(cancellationToken); JobQueues[jobConfiguration.JobName] = jobQueue; } } @@ -49,7 +49,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ { foreach (var jobQueue in JobQueues.Values) { - await jobQueue.StopAsync(cancellationToken).ConfigureAwait(false); + await jobQueue.StopAsync(cancellationToken); } JobQueues.Clear(); @@ -64,7 +64,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ return (IJobQueue)jobQueue; } - using (await SyncSemaphore.LockAsync().ConfigureAwait(false)) + using (await SyncSemaphore.LockAsync()) { if (JobQueues.TryGetValue(jobConfiguration.JobName, out jobQueue)) { @@ -74,7 +74,7 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ jobQueue = (IJobQueue)ServiceProvider .GetRequiredService(typeof(IJobQueue<>).MakeGenericType(typeof(TArgs))); - await jobQueue.StartAsync().ConfigureAwait(false); + await jobQueue.StartAsync(); JobQueues.TryAdd(jobConfiguration.JobName, jobQueue); diff --git a/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/RabbitMqBackgroundJobManager.cs b/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/RabbitMqBackgroundJobManager.cs index 8945beb6cb..f70d553128 100644 --- a/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/RabbitMqBackgroundJobManager.cs +++ b/framework/src/Volo.Abp.BackgroundJobs.RabbitMQ/Volo/Abp/BackgroundJobs/RabbitMQ/RabbitMqBackgroundJobManager.cs @@ -19,8 +19,8 @@ namespace Volo.Abp.BackgroundJobs.RabbitMQ BackgroundJobPriority priority = BackgroundJobPriority.Normal, TimeSpan? delay = null) { - var jobQueue = await _jobQueueManager.GetAsync().ConfigureAwait(false); - return await jobQueue.EnqueueAsync(args, priority, delay).ConfigureAwait(false); + var jobQueue = await _jobQueueManager.GetAsync(); + return await jobQueue.EnqueueAsync(args, priority, delay); } } } diff --git a/framework/src/Volo.Abp.BackgroundJobs/FodyWeavers.xml b/framework/src/Volo.Abp.BackgroundJobs/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundJobs/FodyWeavers.xsd b/framework/src/Volo.Abp.BackgroundJobs/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundJobs/Volo.Abp.BackgroundJobs.csproj b/framework/src/Volo.Abp.BackgroundJobs/Volo.Abp.BackgroundJobs.csproj index a39b8bbbee..858038e5df 100644 --- a/framework/src/Volo.Abp.BackgroundJobs/Volo.Abp.BackgroundJobs.csproj +++ b/framework/src/Volo.Abp.BackgroundJobs/Volo.Abp.BackgroundJobs.csproj @@ -1,5 +1,6 @@ - + + @@ -21,4 +22,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorker.cs b/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorker.cs index 74a3f6128f..fdf0b8c90d 100644 --- a/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorker.cs +++ b/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/BackgroundJobWorker.cs @@ -1,5 +1,6 @@ using System; using System.Linq; +using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; @@ -9,92 +10,88 @@ using Volo.Abp.Timing; namespace Volo.Abp.BackgroundJobs { - public class BackgroundJobWorker : PeriodicBackgroundWorkerBase, IBackgroundJobWorker + public class BackgroundJobWorker : AsyncPeriodicBackgroundWorkerBase, IBackgroundJobWorker { protected AbpBackgroundJobOptions JobOptions { get; } protected AbpBackgroundJobWorkerOptions WorkerOptions { get; } - protected IServiceScopeFactory ServiceScopeFactory { get; } - public BackgroundJobWorker( AbpTimer timer, IOptions jobOptions, IOptions workerOptions, IServiceScopeFactory serviceScopeFactory) - : base(timer) + : base( + timer, + serviceScopeFactory) { - ServiceScopeFactory = serviceScopeFactory; WorkerOptions = workerOptions.Value; JobOptions = jobOptions.Value; Timer.Period = WorkerOptions.JobPollPeriod; } - protected override void DoWork() + protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) { - using (var scope = ServiceScopeFactory.CreateScope()) - { - var store = scope.ServiceProvider.GetRequiredService(); + var store = workerContext.ServiceProvider.GetRequiredService(); - var waitingJobs = AsyncHelper.RunSync(() => store.GetWaitingJobsAsync(WorkerOptions.MaxJobFetchCount)); + var waitingJobs = await store.GetWaitingJobsAsync(WorkerOptions.MaxJobFetchCount); - if (!waitingJobs.Any()) - { - return; - } + if (!waitingJobs.Any()) + { + return; + } + + var jobExecuter = workerContext.ServiceProvider.GetRequiredService(); + var clock = workerContext.ServiceProvider.GetRequiredService(); + var serializer = workerContext.ServiceProvider.GetRequiredService(); - var jobExecuter = scope.ServiceProvider.GetRequiredService(); - var clock = scope.ServiceProvider.GetRequiredService(); - var serializer = scope.ServiceProvider.GetRequiredService(); + foreach (var jobInfo in waitingJobs) + { + jobInfo.TryCount++; + jobInfo.LastTryTime = clock.Now; - foreach (var jobInfo in waitingJobs) + try { - jobInfo.TryCount++; - jobInfo.LastTryTime = clock.Now; + var jobConfiguration = JobOptions.GetJob(jobInfo.JobName); + var jobArgs = serializer.Deserialize(jobInfo.JobArgs, jobConfiguration.ArgsType); + var context = new JobExecutionContext(workerContext.ServiceProvider, jobConfiguration.JobType, jobArgs); try { - var jobConfiguration = JobOptions.GetJob(jobInfo.JobName); - var jobArgs = serializer.Deserialize(jobInfo.JobArgs, jobConfiguration.ArgsType); - var context = new JobExecutionContext(scope.ServiceProvider, jobConfiguration.JobType, jobArgs); + await jobExecuter.ExecuteAsync(context); - try - { - jobExecuter.Execute(context); + await store.DeleteAsync(jobInfo.Id); + } + catch (BackgroundJobExecutionException) + { + var nextTryTime = CalculateNextTryTime(jobInfo, clock); - AsyncHelper.RunSync(() => store.DeleteAsync(jobInfo.Id)); + if (nextTryTime.HasValue) + { + jobInfo.NextTryTime = nextTryTime.Value; } - catch (BackgroundJobExecutionException) + else { - var nextTryTime = CalculateNextTryTime(jobInfo, clock); - - if (nextTryTime.HasValue) - { - jobInfo.NextTryTime = nextTryTime.Value; - } - else - { - jobInfo.IsAbandoned = true; - } - - TryUpdate(store, jobInfo); + jobInfo.IsAbandoned = true; } + + await TryUpdateAsync(store, jobInfo); } - catch (Exception ex) - { - Logger.LogException(ex); - jobInfo.IsAbandoned = true; - TryUpdate(store, jobInfo); - } + } + catch (Exception ex) + { + Logger.LogException(ex); + jobInfo.IsAbandoned = true; + await TryUpdateAsync(store, jobInfo); } } } - protected virtual void TryUpdate(IBackgroundJobStore store, BackgroundJobInfo jobInfo) + protected virtual async Task TryUpdateAsync(IBackgroundJobStore store, BackgroundJobInfo jobInfo) { try { - AsyncHelper.RunSync(() => store.UpdateAsync(jobInfo)); + await store.UpdateAsync(jobInfo); } catch (Exception updateEx) { diff --git a/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/DefaultBackgroundJobManager.cs b/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/DefaultBackgroundJobManager.cs index 266bb37fde..0994029f70 100644 --- a/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/DefaultBackgroundJobManager.cs +++ b/framework/src/Volo.Abp.BackgroundJobs/Volo/Abp/BackgroundJobs/DefaultBackgroundJobManager.cs @@ -32,7 +32,7 @@ namespace Volo.Abp.BackgroundJobs public virtual async Task EnqueueAsync(TArgs args, BackgroundJobPriority priority = BackgroundJobPriority.Normal, TimeSpan? delay = null) { var jobName = BackgroundJobNameAttribute.GetName(); - var jobId = await EnqueueAsync(jobName, args, priority, delay).ConfigureAwait(false); + var jobId = await EnqueueAsync(jobName, args, priority, delay); return jobId.ToString(); } @@ -53,7 +53,7 @@ namespace Volo.Abp.BackgroundJobs jobInfo.NextTryTime = Clock.Now.Add(delay.Value); } - await Store.InsertAsync(jobInfo).ConfigureAwait(false); + await Store.InsertAsync(jobInfo); return jobInfo.Id; } diff --git a/framework/src/Volo.Abp.BackgroundWorkers/FodyWeavers.xml b/framework/src/Volo.Abp.BackgroundWorkers/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundWorkers/FodyWeavers.xsd b/framework/src/Volo.Abp.BackgroundWorkers/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundWorkers/Volo.Abp.BackgroundWorkers.csproj b/framework/src/Volo.Abp.BackgroundWorkers/Volo.Abp.BackgroundWorkers.csproj index 61bc5af316..c8e518c4d3 100644 --- a/framework/src/Volo.Abp.BackgroundWorkers/Volo.Abp.BackgroundWorkers.csproj +++ b/framework/src/Volo.Abp.BackgroundWorkers/Volo.Abp.BackgroundWorkers.csproj @@ -1,5 +1,6 @@ - + + @@ -17,4 +18,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/AsyncPeriodicBackgroundWorkerBase.cs b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/AsyncPeriodicBackgroundWorkerBase.cs new file mode 100644 index 0000000000..62da163eb9 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/AsyncPeriodicBackgroundWorkerBase.cs @@ -0,0 +1,55 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; +using Volo.Abp.Threading; + +namespace Volo.Abp.BackgroundWorkers +{ + public abstract class AsyncPeriodicBackgroundWorkerBase : BackgroundWorkerBase + { + protected IServiceScopeFactory ServiceScopeFactory { get; } + protected AbpTimer Timer { get; } + + protected AsyncPeriodicBackgroundWorkerBase( + AbpTimer timer, + IServiceScopeFactory serviceScopeFactory) + { + ServiceScopeFactory = serviceScopeFactory; + Timer = timer; + Timer.Elapsed += Timer_Elapsed; + } + + public override async Task StartAsync(CancellationToken cancellationToken = default) + { + await base.StartAsync(cancellationToken); + Timer.Start(cancellationToken); + } + + public override async Task StopAsync(CancellationToken cancellationToken = default) + { + Timer.Stop(cancellationToken); + await base.StopAsync(cancellationToken); + } + + private void Timer_Elapsed(object sender, System.EventArgs e) + { + try + { + using (var scope = ServiceScopeFactory.CreateScope()) + { + AsyncHelper.RunSync( + () => DoWorkAsync(new PeriodicBackgroundWorkerContext(scope.ServiceProvider)) + ); + } + } + catch (Exception ex) + { + Logger.LogException(ex); + } + } + + protected abstract Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext); + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerContext.cs b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerContext.cs new file mode 100644 index 0000000000..dc5635ae88 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerContext.cs @@ -0,0 +1,14 @@ +using System; + +namespace Volo.Abp.BackgroundWorkers +{ + public class PeriodicBackgroundWorkerContext + { + public IServiceProvider ServiceProvider { get; } + + public PeriodicBackgroundWorkerContext(IServiceProvider serviceProvider) + { + ServiceProvider = serviceProvider; + } + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerManager.cs b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerManager.cs index 27a0b05173..a8b884e096 100644 --- a/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerManager.cs +++ b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/BackgroundWorkerManager.cs @@ -56,7 +56,7 @@ namespace Volo.Abp.BackgroundWorkers foreach (var worker in _backgroundWorkers) { - await worker.StartAsync(cancellationToken).ConfigureAwait(false); + await worker.StartAsync(cancellationToken); } } @@ -66,7 +66,7 @@ namespace Volo.Abp.BackgroundWorkers foreach (var worker in _backgroundWorkers) { - await worker.StopAsync(cancellationToken).ConfigureAwait(false); + await worker.StopAsync(cancellationToken); } } } diff --git a/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/PeriodicBackgroundWorkerBase.cs b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/PeriodicBackgroundWorkerBase.cs index e2b0f5b53a..091bcc917f 100644 --- a/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/PeriodicBackgroundWorkerBase.cs +++ b/framework/src/Volo.Abp.BackgroundWorkers/Volo/Abp/BackgroundWorkers/PeriodicBackgroundWorkerBase.cs @@ -1,6 +1,7 @@ using System; using System.Threading; using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Volo.Abp.Threading; @@ -11,35 +12,38 @@ namespace Volo.Abp.BackgroundWorkers /// public abstract class PeriodicBackgroundWorkerBase : BackgroundWorkerBase { - protected readonly AbpTimer Timer; + protected IServiceScopeFactory ServiceScopeFactory { get; } + protected AbpTimer Timer { get; } - /// - /// Initializes a new instance of the class. - /// - /// A timer. - protected PeriodicBackgroundWorkerBase(AbpTimer timer) + protected PeriodicBackgroundWorkerBase( + AbpTimer timer, + IServiceScopeFactory serviceScopeFactory) { + ServiceScopeFactory = serviceScopeFactory; Timer = timer; Timer.Elapsed += Timer_Elapsed; } public override async Task StartAsync(CancellationToken cancellationToken = default) { - await base.StartAsync(cancellationToken).ConfigureAwait(false); + await base.StartAsync(cancellationToken); Timer.Start(cancellationToken); } public override async Task StopAsync(CancellationToken cancellationToken = default) { Timer.Stop(cancellationToken); - await base.StopAsync(cancellationToken).ConfigureAwait(false); + await base.StopAsync(cancellationToken); } - + private void Timer_Elapsed(object sender, System.EventArgs e) { try { - DoWork(); + using (var scope = ServiceScopeFactory.CreateScope()) + { + DoWork(new PeriodicBackgroundWorkerContext(scope.ServiceProvider)); + } } catch (Exception ex) { @@ -50,6 +54,6 @@ namespace Volo.Abp.BackgroundWorkers /// /// Periodic works should be done by implementing this method. /// - protected abstract void DoWork(); + protected abstract void DoWork(PeriodicBackgroundWorkerContext workerContext); } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Caching/FodyWeavers.xml b/framework/src/Volo.Abp.Caching/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Caching/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Caching/FodyWeavers.xsd b/framework/src/Volo.Abp.Caching/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Caching/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Caching/Volo.Abp.Caching.csproj b/framework/src/Volo.Abp.Caching/Volo.Abp.Caching.csproj index 054f41c28e..f59d9fe116 100644 --- a/framework/src/Volo.Abp.Caching/Volo.Abp.Caching.csproj +++ b/framework/src/Volo.Abp.Caching/Volo.Abp.Caching.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs index daa64060f7..c23fb05aa7 100644 --- a/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs +++ b/framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs @@ -41,7 +41,7 @@ namespace Volo.Abp.Caching /// The type of cache key being used. public class DistributedCache : IDistributedCache where TCacheItem : class - { + { public ILogger> Logger { get; set; } protected string CacheName { get; set; } @@ -124,7 +124,7 @@ namespace Volo.Abp.Caching /// Indicates to throw or hide the exceptions for the distributed cache. /// The cache item, or null. public virtual TCacheItem Get( - TCacheKey key, + TCacheKey key, bool? hideErrors = null) { hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; @@ -162,8 +162,8 @@ namespace Volo.Abp.Caching /// The for the task. /// The cache item, or null. public virtual async Task GetAsync( - TCacheKey key, - bool? hideErrors = null, + TCacheKey key, + bool? hideErrors = null, CancellationToken token = default) { hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; @@ -175,7 +175,7 @@ namespace Volo.Abp.Caching cachedBytes = await Cache.GetAsync( NormalizeKey(key), CancellationTokenProvider.FallbackToProvider(token) - ).ConfigureAwait(false); + ); } catch (Exception ex) { @@ -206,9 +206,9 @@ namespace Volo.Abp.Caching /// Indicates to throw or hide the exceptions for the distributed cache. /// The cache item. public virtual TCacheItem GetOrAdd( - TCacheKey key, - Func factory, - Func optionsFactory = null, + TCacheKey key, + Func factory, + Func optionsFactory = null, bool? hideErrors = null) { var value = Get(key, hideErrors); @@ -243,29 +243,29 @@ namespace Volo.Abp.Caching /// The for the task. /// The cache item. public virtual async Task GetOrAddAsync( - TCacheKey key, - Func> factory, - Func optionsFactory = null, - bool? hideErrors = null, + TCacheKey key, + Func> factory, + Func optionsFactory = null, + bool? hideErrors = null, CancellationToken token = default) { token = CancellationTokenProvider.FallbackToProvider(token); - var value = await GetAsync(key, hideErrors, token).ConfigureAwait(false); + var value = await GetAsync(key, hideErrors, token); if (value != null) { return value; } - using (await SyncSemaphore.LockAsync(token).ConfigureAwait(false)) + using (await SyncSemaphore.LockAsync(token)) { - value = await GetAsync(key, hideErrors, token).ConfigureAwait(false); + value = await GetAsync(key, hideErrors, token); if (value != null) { return value; } - value = await factory().ConfigureAwait(false); - await SetAsync(key, value, optionsFactory?.Invoke(), hideErrors, token).ConfigureAwait(false); + value = await factory(); + await SetAsync(key, value, optionsFactory?.Invoke(), hideErrors, token); } return value; @@ -279,9 +279,9 @@ namespace Volo.Abp.Caching /// The cache options for the value. /// Indicates to throw or hide the exceptions for the distributed cache. public virtual void Set( - TCacheKey key, - TCacheItem value, - DistributedCacheEntryOptions options = null, + TCacheKey key, + TCacheItem value, + DistributedCacheEntryOptions options = null, bool? hideErrors = null) { hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; @@ -316,10 +316,10 @@ namespace Volo.Abp.Caching /// The for the task. /// The indicating that the operation is asynchronous. public virtual async Task SetAsync( - TCacheKey key, - TCacheItem value, - DistributedCacheEntryOptions options = null, - bool? hideErrors = null, + TCacheKey key, + TCacheItem value, + DistributedCacheEntryOptions options = null, + bool? hideErrors = null, CancellationToken token = default) { hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; @@ -331,7 +331,7 @@ namespace Volo.Abp.Caching Serializer.Serialize(value), options ?? DefaultCacheOptions, CancellationTokenProvider.FallbackToProvider(token) - ).ConfigureAwait(false); + ); } catch (Exception ex) { @@ -351,7 +351,7 @@ namespace Volo.Abp.Caching /// The key of cached item to be retrieved from the cache. /// Indicates to throw or hide the exceptions for the distributed cache. public virtual void Refresh( - TCacheKey key, bool? + TCacheKey key, bool? hideErrors = null) { hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; @@ -379,15 +379,15 @@ namespace Volo.Abp.Caching /// The for the task. /// The indicating that the operation is asynchronous. public virtual async Task RefreshAsync( - TCacheKey key, - bool? hideErrors = null, + TCacheKey key, + bool? hideErrors = null, CancellationToken token = default) { hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; try { - await Cache.RefreshAsync(NormalizeKey(key), CancellationTokenProvider.FallbackToProvider(token)).ConfigureAwait(false); + await Cache.RefreshAsync(NormalizeKey(key), CancellationTokenProvider.FallbackToProvider(token)); } catch (Exception ex) { @@ -407,7 +407,7 @@ namespace Volo.Abp.Caching /// The key of cached item to be retrieved from the cache. /// Indicates to throw or hide the exceptions for the distributed cache. public virtual void Remove( - TCacheKey key, + TCacheKey key, bool? hideErrors = null) { hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; @@ -435,15 +435,15 @@ namespace Volo.Abp.Caching /// The for the task. /// The indicating that the operation is asynchronous. public virtual async Task RemoveAsync( - TCacheKey key, - bool? hideErrors = null, + TCacheKey key, + bool? hideErrors = null, CancellationToken token = default) { hideErrors = hideErrors ?? _distributedCacheOption.HideErrors; try { - await Cache.RemoveAsync(NormalizeKey(key), CancellationTokenProvider.FallbackToProvider(token)).ConfigureAwait(false); + await Cache.RemoveAsync(NormalizeKey(key), CancellationTokenProvider.FallbackToProvider(token)); } catch (Exception ex) { @@ -455,6 +455,6 @@ namespace Volo.Abp.Caching throw; } - } - } + } + } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Castle.Core/FodyWeavers.xml b/framework/src/Volo.Abp.Castle.Core/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Castle.Core/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Castle.Core/FodyWeavers.xsd b/framework/src/Volo.Abp.Castle.Core/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Castle.Core/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Castle.Core/Volo.Abp.Castle.Core.csproj b/framework/src/Volo.Abp.Castle.Core/Volo.Abp.Castle.Core.csproj index 3d01363064..24f7fbe682 100644 --- a/framework/src/Volo.Abp.Castle.Core/Volo.Abp.Castle.Core.csproj +++ b/framework/src/Volo.Abp.Castle.Core/Volo.Abp.Castle.Core.csproj @@ -1,5 +1,6 @@ - + + @@ -22,4 +23,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpMethodInvocationAdapter.cs b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpMethodInvocationAdapter.cs index 7fbc9fdf0a..89f3713521 100644 --- a/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpMethodInvocationAdapter.cs +++ b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAbpMethodInvocationAdapter.cs @@ -20,7 +20,7 @@ namespace Volo.Abp.Castle.DynamicProxy public override async Task ProceedAsync() { - await Proceed(Invocation, ProceedInfo).ConfigureAwait(false); + await Proceed(Invocation, ProceedInfo); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAsyncAbpInterceptorAdapter.cs b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAsyncAbpInterceptorAdapter.cs index bd379f442d..8a0c4fdd45 100644 --- a/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAsyncAbpInterceptorAdapter.cs +++ b/framework/src/Volo.Abp.Castle.Core/Volo/Abp/Castle/DynamicProxy/CastleAsyncAbpInterceptorAdapter.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.Castle.DynamicProxy { await _abpInterceptor.InterceptAsync( new CastleAbpMethodInvocationAdapter(invocation, proceedInfo, proceed) - ).ConfigureAwait(false); + ); } protected override async Task InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func> proceed) @@ -28,7 +28,7 @@ namespace Volo.Abp.Castle.DynamicProxy await _abpInterceptor.InterceptAsync( adapter - ).ConfigureAwait(false); + ); return (TResult)adapter.ReturnValue; } diff --git a/framework/src/Volo.Abp.Cli.Core/FodyWeavers.xml b/framework/src/Volo.Abp.Cli.Core/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/FodyWeavers.xsd b/framework/src/Volo.Abp.Cli.Core/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Cli.Core/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj b/framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj index 1ddfe2abec..0b9306be91 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj +++ b/framework/src/Volo.Abp.Cli.Core/Volo.Abp.Cli.Core.csproj @@ -1,5 +1,6 @@ - + + @@ -30,4 +31,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Auth/AuthService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Auth/AuthService.cs index 3fdd0aae1d..9125a0c8ab 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Auth/AuthService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Auth/AuthService.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.Cli.Auth { var configuration = new IdentityClientConfiguration( CliUrls.AccountAbpIo, - "role email abpio abpio_www abpio_commercial", + "role email abpio abpio_www abpio_commercial offline_access", "abp-cli", "1q2w3e*", OidcConstants.GrantTypes.Password, @@ -35,7 +35,7 @@ namespace Volo.Abp.Cli.Auth configuration["[o]abp-organization-name"] = organizationName; } - var accessToken = await AuthenticationService.GetAccessTokenAsync(configuration).ConfigureAwait(false); + var accessToken = await AuthenticationService.GetAccessTokenAsync(configuration); File.WriteAllText(CliPaths.AccessToken, accessToken, Encoding.UTF8); } @@ -45,5 +45,10 @@ namespace Volo.Abp.Cli.Auth FileHelper.DeleteIfExists(CliPaths.AccessToken); return Task.CompletedTask; } + + public static bool IsLoggedIn() + { + return File.Exists(CliPaths.AccessToken); + } } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliConsts.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliConsts.cs index e4ddf2a3ee..b062388c7a 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliConsts.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliConsts.cs @@ -5,5 +5,7 @@ public const string Command = "AbpCliCommand"; public const string BranchPrefix = "branch@"; + + public const string DocsLink = "https://docs.abp.io"; } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs index b53327cba3..436e169aad 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/CliService.cs @@ -41,7 +41,7 @@ namespace Volo.Abp.Cli { Logger.LogInformation("ABP CLI (https://abp.io)"); - await CheckCliVersionAsync().ConfigureAwait(false); + await CheckCliVersionAsync(); var commandLineArgs = CommandLineArgumentParser.Parse(args); var commandType = CommandSelector.Select(commandLineArgs); @@ -52,7 +52,7 @@ namespace Volo.Abp.Cli try { - await command.ExecuteAsync(commandLineArgs).ConfigureAwait(false); + await command.ExecuteAsync(commandLineArgs); } catch (CliUsageException usageException) { @@ -69,14 +69,14 @@ namespace Volo.Abp.Cli { var assembly = typeof(CliService).Assembly; var toolPath = GetToolPath(assembly); - var currentCliVersion = await GetCurrentCliVersion(assembly).ConfigureAwait(false); + var currentCliVersion = await GetCurrentCliVersion(assembly); var updateChannel = GetUpdateChannel(currentCliVersion); Logger.LogInformation($"Version {currentCliVersion} ({updateChannel} channel)"); try { - var latestVersion = await GetLatestVersion(updateChannel).ConfigureAwait(false); + var latestVersion = await GetLatestVersion(updateChannel); if (latestVersion != null && latestVersion > currentCliVersion) { @@ -106,7 +106,7 @@ namespace Volo.Abp.Cli var consoleOutput = new StringReader(CmdHelper.RunCmdAndGetOutput($"dotnet tool list -g")); string line; - while ((line = await consoleOutput.ReadLineAsync().ConfigureAwait(false)) != null) + while ((line = await consoleOutput.ReadLineAsync()) != null) { if (line.StartsWith("volo.abp.cli", StringComparison.InvariantCultureIgnoreCase)) { @@ -155,13 +155,13 @@ namespace Volo.Abp.Cli switch (updateChannel) { case UpdateChannel.Stable: - return await NuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Cli").ConfigureAwait(false); + return await NuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Cli"); case UpdateChannel.Prerelease: - return await NuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Cli", includePreviews: true).ConfigureAwait(false); + return await NuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Cli", includePreviews: true); case UpdateChannel.Nightly: - return await NuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Cli", includeNightly: true).ConfigureAwait(false); + return await NuGetService.GetLatestVersionOrNullAsync("Volo.Abp.Cli", includeNightly: true); default: return default; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs index d8715c2700..58adc65fc4 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddModuleCommand.cs @@ -42,7 +42,7 @@ namespace Volo.Abp.Cli.Commands commandLineArgs.Target, commandLineArgs.Options.GetOrNull(Options.StartupProject.Short, Options.StartupProject.Long), skipDbMigrations - ).ConfigureAwait(false); + ); } public string GetUsageInfo() diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs index cbfde5610f..03e228f255 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/AddPackageCommand.cs @@ -37,7 +37,7 @@ namespace Volo.Abp.Cli.Commands await ProjectNugetPackageAdder.AddAsync( GetProjectFile(commandLineArgs), commandLineArgs.Target - ).ConfigureAwait(false); + ); } public string GetUsageInfo() diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs index edd7bd985a..e1536c2973 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/GetSourceCommand.cs @@ -79,7 +79,7 @@ namespace Volo.Abp.Cli.Commands gitHubLocalRepositoryPath, commandLineArgs.Options ) - ).ConfigureAwait(false); + ); using (var templateFileStream = new MemoryStream(result.ZipContent)) { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs index 2da6b82c8a..70d5112e95 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/HelpCommand.cs @@ -24,12 +24,19 @@ namespace Volo.Abp.Cli.Commands AbpCliOptions = cliOptions.Value; } - public async Task ExecuteAsync(CommandLineArgs commandLineArgs) + public Task ExecuteAsync(CommandLineArgs commandLineArgs) { if (string.IsNullOrWhiteSpace(commandLineArgs.Target)) { Logger.LogInformation(GetUsageInfo()); - return; + return Task.CompletedTask; + } + + if (!AbpCliOptions.Commands.ContainsKey(commandLineArgs.Target)) + { + Logger.LogWarning($"There is no command named {commandLineArgs.Target}."); + Logger.LogInformation(GetUsageInfo()); + return Task.CompletedTask; } var commandType = AbpCliOptions.Commands[commandLineArgs.Target]; @@ -39,6 +46,8 @@ namespace Volo.Abp.Cli.Commands var command = (IConsoleCommand) scope.ServiceProvider.GetRequiredService(commandType); Logger.LogInformation(command.GetUsageInfo()); } + + return Task.CompletedTask; } public string GetUsageInfo() diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LoginCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LoginCommand.cs index 175f45aa75..32bc6671bf 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LoginCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/LoginCommand.cs @@ -33,22 +33,26 @@ namespace Volo.Abp.Cli.Commands ); } - Console.Write("Password: "); - var password = ConsoleHelper.ReadSecret(); - if (password.IsNullOrWhiteSpace()) + var password = commandLineArgs.Options.GetOrNull(Options.Password.Short, Options.Password.Long); + if (password == null) { - throw new CliUsageException( - "Password is missing!" + - Environment.NewLine + Environment.NewLine + - GetUsageInfo() - ); + Console.Write("Password: "); + password = ConsoleHelper.ReadSecret(); + if (password.IsNullOrWhiteSpace()) + { + throw new CliUsageException( + "Password is missing!" + + Environment.NewLine + Environment.NewLine + + GetUsageInfo() + ); + } } await AuthService.LoginAsync( commandLineArgs.Target, password, commandLineArgs.Options.GetOrNull(Options.Organization.Short, Options.Organization.Long) - ).ConfigureAwait(false); + ); Logger.LogInformation($"Successfully logged in as '{commandLineArgs.Target}'"); } @@ -60,10 +64,12 @@ namespace Volo.Abp.Cli.Commands sb.AppendLine(""); sb.AppendLine("Usage:"); sb.AppendLine(" abp login "); + sb.AppendLine(" abp login -p "); sb.AppendLine(""); sb.AppendLine("Example:"); sb.AppendLine(""); sb.AppendLine(" abp login john"); + sb.AppendLine(" abp login john -p 1234"); sb.AppendLine(""); sb.AppendLine("See the documentation for more info: https://docs.abp.io/en/abp/latest/CLI"); @@ -82,6 +88,12 @@ namespace Volo.Abp.Cli.Commands public const string Short = "o"; public const string Long = "organization"; } + + public static class Password + { + public const string Short = "p"; + public const string Long = "password"; + } } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs index 1314f058c2..9cfa702fd7 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/NewCommand.cs @@ -97,7 +97,7 @@ namespace Volo.Abp.Cli.Commands gitHubLocalRepositoryPath, commandLineArgs.Options ) - ).ConfigureAwait(false); + ); using (var templateFileStream = new MemoryStream(result.ZipContent)) { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs index 1697489d71..a13621ea22 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/SuiteCommand.cs @@ -36,12 +36,12 @@ namespace Volo.Abp.Cli.Commands case "install": Logger.LogInformation("Installing ABP Suite..."); - await InstallSuiteAsync().ConfigureAwait(false); + await InstallSuiteAsync(); break; case "update": Logger.LogInformation("Updating ABP Suite..."); - await UpdateSuiteAsync().ConfigureAwait(false); + await UpdateSuiteAsync(); break; case "remove": @@ -53,8 +53,8 @@ namespace Volo.Abp.Cli.Commands private async Task InstallSuiteAsync() { - var nugetIndexUrl = await GetNuGetIndexUrlAsync().ConfigureAwait(false); - + var nugetIndexUrl = await GetNuGetIndexUrlAsync(); + if (nugetIndexUrl == null) { return; @@ -71,7 +71,7 @@ namespace Volo.Abp.Cli.Commands private async Task UpdateSuiteAsync() { - var nugetIndexUrl = await GetNuGetIndexUrlAsync().ConfigureAwait(false); + var nugetIndexUrl = await GetNuGetIndexUrlAsync(); if (nugetIndexUrl == null) { @@ -106,15 +106,23 @@ namespace Volo.Abp.Cli.Commands private async Task GetNuGetIndexUrlAsync() { - var apiKeyResult = await _apiKeyService.GetApiKeyOrNullAsync().ConfigureAwait(false); + var apiKeyResult = await _apiKeyService.GetApiKeyOrNullAsync(); + + if (apiKeyResult == null) + { + Logger.LogWarning("You are not signed in! Use the CLI command \"abp login \" to sign in, then try again."); + return null; + } - if (apiKeyResult == null || string.IsNullOrEmpty(apiKeyResult.ApiKey)) + if (!string.IsNullOrWhiteSpace(apiKeyResult.ErrorMessage)) { - Logger.LogError("Couldn't retrieve your NuGet API key!"); - Logger.LogWarning(File.Exists(CliPaths.AccessToken) - ? "Make sure you have an active session and license on commercial.abp.io. To re-sign in you can use the CLI command \"abp login \"." - : "You are not signed in to commercial.abp.io. Use the CLI command \"abp login \" to sign in."); + Logger.LogWarning(apiKeyResult.ErrorMessage); + return null; + } + if (string.IsNullOrEmpty(apiKeyResult.ApiKey)) + { + Logger.LogError("Couldn't retrieve your NuGet API key! You can re-sign in with the CLI command \"abp login \"."); return null; } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs index 166720c64e..d201790c94 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Commands/UpdateCommand.cs @@ -37,7 +37,7 @@ namespace Volo.Abp.Cli.Commands if (updateNuget || !updateNpm) { - await UpdateNugetPackages(commandLineArgs, directory).ConfigureAwait(false); + await UpdateNugetPackages(commandLineArgs, directory); } if (updateNpm || !updateNuget) @@ -62,7 +62,7 @@ namespace Volo.Abp.Cli.Commands { var solutionName = Path.GetFileName(solution).RemovePostFix(".sln"); - await _nugetPackagesVersionUpdater.UpdateSolutionAsync(solution, includePreviews).ConfigureAwait(false); + await _nugetPackagesVersionUpdater.UpdateSolutionAsync(solution, includePreviews); Logger.LogInformation($"Volo packages are updated in {solutionName} solution."); return; @@ -74,7 +74,7 @@ namespace Volo.Abp.Cli.Commands { var projectName = Path.GetFileName(project).RemovePostFix(".csproj"); - await _nugetPackagesVersionUpdater.UpdateProjectAsync(project, includePreviews).ConfigureAwait(false); + await _nugetPackagesVersionUpdater.UpdateProjectAsync(project, includePreviews); Logger.LogInformation($"Volo packages are updated in {projectName} project."); return; diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Http/CliHttpClient.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Http/CliHttpClient.cs index 81c64a3b5f..ca1a23fcfc 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Http/CliHttpClient.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Http/CliHttpClient.cs @@ -3,6 +3,7 @@ using System.IO; using System.Net.Http; using System.Text; using IdentityModel.Client; +using Volo.Abp.Cli.Auth; namespace Volo.Abp.Cli.Http { @@ -29,7 +30,7 @@ namespace Volo.Abp.Cli.Http private static void AddAuthentication(HttpClient client) { - if (!File.Exists(CliPaths.AccessToken)) + if (!AuthService.IsLoggedIn()) { return; } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/AbpIoApiKeyService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/AbpIoApiKeyService.cs index 4ed8746ce6..cddead548f 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/AbpIoApiKeyService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/AbpIoApiKeyService.cs @@ -8,6 +8,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Polly; using Polly.Extensions.Http; +using Volo.Abp.Cli.Auth; using Volo.Abp.Cli.Http; using Volo.Abp.Cli.ProjectBuilding; using Volo.Abp.DependencyInjection; @@ -31,6 +32,11 @@ namespace Volo.Abp.Cli.Licensing public async Task GetApiKeyOrNullAsync(bool invalidateCache = false) { + if (!AuthService.IsLoggedIn()) + { + return null; + } + if (invalidateCache) { _apiKeyResult = null; @@ -69,29 +75,18 @@ namespace Volo.Abp.Cli.Licensing $"Waiting {timeSpan.TotalSeconds} secs for the next try..."); } }) - .ExecuteAsync(async () => await client.GetAsync(url).ConfigureAwait(false)).ConfigureAwait(false); + .ExecuteAsync(async () => await client.GetAsync(url)); if (!response.IsSuccessStatusCode) { throw new Exception($"ERROR: Remote server returns '{response.StatusCode}'"); } - await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response).ConfigureAwait(false); + await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response); - var responseContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + var responseContent = await response.Content.ReadAsStringAsync(); var apiKeyResult = JsonSerializer.Deserialize(responseContent); - if (apiKeyResult == null || - string.IsNullOrEmpty(apiKeyResult.ApiKey)) - { - _logger.LogError("Couldn't retrieve your NuGet API key!"); - _logger.LogWarning(File.Exists(CliPaths.AccessToken) - ? "Make sure you have an active session and license on commercial.abp.io. To re-sign in you can use the CLI command \"abp login \"." - : "You are not signed in to commercial.abp.io. Use the CLI command \"abp login \" to sign in."); - - return null; - } - return apiKeyResult; } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/DeveloperApiKeyResult.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/DeveloperApiKeyResult.cs index 0b1fe54c2f..eb781c27b1 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/DeveloperApiKeyResult.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/Licensing/DeveloperApiKeyResult.cs @@ -7,7 +7,18 @@ namespace Volo.Abp.Cli.Licensing public bool HasActiveLicense { get; set; } public string OrganizationName { get; set; } public string ApiKey { get; set; } - public DateTime LicenseEndTime { get; set; } + public DateTime? LicenseEndTime { get; set; } + public bool CanDownloadSourceCode { get; set; } public string LicenseCode { get; set; } + public string ErrorMessage { get; set; } + public LicenseErrorType? ErrorType { get; set; } + + public enum LicenseErrorType + { + NotAuthenticated = 1, + NotMemberOfAnOrganization = 2, + NoActiveLicense = 3, + NotDeveloperOfTheOrganization = 4 + } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/NuGet/NuGetService.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/NuGet/NuGetService.cs index 37d487f106..3cdd658403 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/NuGet/NuGetService.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/NuGet/NuGetService.cs @@ -50,12 +50,12 @@ namespace Volo.Abp.Cli.NuGet using (var client = new CliHttpClient(setBearerToken: false)) { - var responseMessage = await GetHttpResponseMessageWithRetryAsync(client, url).ConfigureAwait(false); + var responseMessage = await GetHttpResponseMessageWithRetryAsync(client, url); if (responseMessage.StatusCode == HttpStatusCode.NotFound) { - var commercialNuGetUrl = await GetNuGetUrlForCommercialPackage(packageId).ConfigureAwait(false); - responseMessage = await GetHttpResponseMessageWithRetryAsync(client, commercialNuGetUrl).ConfigureAwait(false); + var commercialNuGetUrl = await GetNuGetUrlForCommercialPackage(packageId); + responseMessage = await GetHttpResponseMessageWithRetryAsync(client, commercialNuGetUrl); } if (!responseMessage.IsSuccessStatusCode) @@ -63,9 +63,9 @@ namespace Volo.Abp.Cli.NuGet throw new Exception($"ERROR: Remote server returns '{responseMessage.StatusCode}'"); } - await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(responseMessage).ConfigureAwait(false); + await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(responseMessage); - var responseContent = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); + var responseContent = await responseMessage.Content.ReadAsStringAsync(); var versions = JsonSerializer .Deserialize(responseContent) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs index a422f0ff44..fd0a0e5246 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/AbpIoSourceCodeStore.cs @@ -49,7 +49,7 @@ namespace Volo.Abp.Cli.ProjectBuilding string version = null) { - var latestVersion = await GetLatestSourceCodeVersionAsync(name, type).ConfigureAwait(false); + var latestVersion = await GetLatestSourceCodeVersionAsync(name, type); if (version == null) { version = latestVersion; @@ -73,7 +73,7 @@ namespace Volo.Abp.Cli.ProjectBuilding Type = type, Version = version } - ).ConfigureAwait(false); + ); if (Options.CacheTemplates) { @@ -98,11 +98,11 @@ namespace Volo.Abp.Cli.ProjectBuilding MimeTypes.Application.Json ), CancellationTokenProvider.Token - ).ConfigureAwait(false); + ); - await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response).ConfigureAwait(false); + await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response); - var result = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + var result = await response.Content.ReadAsStringAsync(); return JsonSerializer.Deserialize(result).Version; } @@ -118,11 +118,11 @@ namespace Volo.Abp.Cli.ProjectBuilding $"{CliUrls.WwwAbpIo}api/download/{input.Type}/", new StringContent(postData, Encoding.UTF8, MimeTypes.Application.Json), CancellationTokenProvider.Token - ).ConfigureAwait(false); + ); - await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(responseMessage).ConfigureAwait(false); + await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(responseMessage); - return await responseMessage.Content.ReadAsByteArrayAsync().ConfigureAwait(false); + return await responseMessage.Content.ReadAsByteArrayAsync(); } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Analyticses/CliAnalyticsCollect.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Analyticses/CliAnalyticsCollect.cs index 79fc70cfcc..fdfbb8b5d3 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Analyticses/CliAnalyticsCollect.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Analyticses/CliAnalyticsCollect.cs @@ -38,12 +38,12 @@ namespace Volo.Abp.Cli.ProjectBuilding.Analyticses $"{CliUrls.WwwAbpIo}api/clianalytics/collect", new StringContent(postData, Encoding.UTF8, MimeTypes.Application.Json), _cancellationTokenProvider.Token - ).ConfigureAwait(false); + ); if (!responseMessage.IsSuccessStatusCode) { var exceptionMessage = "Remote server returns '" + (int)responseMessage.StatusCode + "-" + responseMessage.ReasonPhrase + "'. "; - var remoteServiceErrorMessage = await _remoteServiceExceptionHandler.GetAbpRemoteServiceErrorAsync(responseMessage).ConfigureAwait(false); + var remoteServiceErrorMessage = await _remoteServiceExceptionHandler.GetAbpRemoteServiceErrorAsync(responseMessage); if (remoteServiceErrorMessage != null) { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleInfo.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleInfo.cs index dfeabf6aed..fadd830c93 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleInfo.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/ModuleInfo.cs @@ -7,5 +7,19 @@ public string Namespace { get; set; } public string DocumentUrl { get; set; } + + public string DisplayName { get; set; } + + public string ShortDescription { get; set; } + + public bool IsPro { get; set; } + + public bool EfCoreSupport { get; set; } + + public bool MongoDBSupport { get; set; } + + public bool AngularUi { get; set; } + + public bool MvcUi { get; set; } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveFolderStep.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveFolderStep.cs index ddf7010dd7..636175f0b1 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveFolderStep.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Building/Steps/RemoveFolderStep.cs @@ -1,4 +1,5 @@ -using System.Linq; +using System; +using System.Linq; namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps { @@ -14,7 +15,7 @@ namespace Volo.Abp.Cli.ProjectBuilding.Building.Steps public override void Execute(ProjectBuildContext context) { //Remove the folder content - var folderPathWithSlash = _folderPath + "/"; + var folderPathWithSlash = _folderPath.EnsureEndsWith('/'); context.Files.RemoveAll(file => file.Name.StartsWith(folderPathWithSlash)); //Remove the folder diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/IModuleInfoProvider.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/IModuleInfoProvider.cs index bb8d0d72cb..e9504ca3ef 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/IModuleInfoProvider.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/IModuleInfoProvider.cs @@ -1,4 +1,5 @@ -using System.Threading.Tasks; +using System.Collections.Generic; +using System.Threading.Tasks; using Volo.Abp.Cli.ProjectBuilding.Building; namespace Volo.Abp.Cli.ProjectBuilding @@ -6,5 +7,7 @@ namespace Volo.Abp.Cli.ProjectBuilding public interface IModuleInfoProvider { Task GetAsync(string name); + + Task> GetModuleListAsync(); } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleInfoProvider.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleInfoProvider.cs index 8f8310977e..f0472ad4df 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleInfoProvider.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleInfoProvider.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.Cli.ProjectBuilding public async Task GetAsync(string name) { - var moduleList = await GetModuleListAsync().ConfigureAwait(false); + var moduleList = await GetModuleListInternalAsync(); var module = moduleList.FirstOrDefault(m => m.Name == name); @@ -40,17 +40,22 @@ namespace Volo.Abp.Cli.ProjectBuilding return module; } - private async Task> GetModuleListAsync() + public async Task> GetModuleListAsync() + { + return await GetModuleListInternalAsync(); + } + + private async Task> GetModuleListInternalAsync() { using (var client = new CliHttpClient()) { var responseMessage = await client.GetAsync( $"{CliUrls.WwwAbpIo}api/download/modules/", CancellationTokenProvider.Token - ).ConfigureAwait(false); + ); - await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(responseMessage).ConfigureAwait(false); - var result = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false); + await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(responseMessage); + var result = await responseMessage.Content.ReadAsStringAsync(); return JsonSerializer.Deserialize>(result); } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs index f853a9ec15..48f109e1d3 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/ModuleProjectBuilder.cs @@ -43,15 +43,15 @@ namespace Volo.Abp.Cli.ProjectBuilding public async Task BuildAsync(ProjectBuildArgs args) { - var moduleInfo = await GetModuleInfoAsync(args).ConfigureAwait(false); + var moduleInfo = await GetModuleInfoAsync(args); var templateFile = await SourceCodeStore.GetAsync( args.TemplateName, SourceCodeTypes.Module, args.Version - ).ConfigureAwait(false); + ); - var apiKeyResult = await ApiKeyService.GetApiKeyOrNullAsync().ConfigureAwait(false); + var apiKeyResult = await ApiKeyService.GetApiKeyOrNullAsync(); if (apiKeyResult?.ApiKey != null) { args.ExtraProperties["api-key"] = apiKeyResult.ApiKey; @@ -96,14 +96,14 @@ namespace Volo.Abp.Cli.ProjectBuilding ProjectName = null, TemplateName = args.TemplateName, TemplateVersion = templateFile.Version - }).ConfigureAwait(false); + }); return new ProjectBuildResult(context.Result.ZipContent, args.TemplateName); } private async Task GetModuleInfoAsync(ProjectBuildArgs args) { - return await ModuleInfoProvider.GetAsync(args.TemplateName).ConfigureAwait(false); + return await ModuleInfoProvider.GetAsync(args.TemplateName); } } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/RemoteServiceExceptionHandler.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/RemoteServiceExceptionHandler.cs index 8a1af93f23..744641bb8a 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/RemoteServiceExceptionHandler.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/RemoteServiceExceptionHandler.cs @@ -35,7 +35,7 @@ namespace Volo.Abp.Cli.ProjectBuilding var exceptionMessage = "Remote server returns '" + (int) responseMessage.StatusCode + "-" + responseMessage.ReasonPhrase + "'. "; - var remoteServiceErrorMessage = await GetAbpRemoteServiceErrorAsync(responseMessage).ConfigureAwait(false); + var remoteServiceErrorMessage = await GetAbpRemoteServiceErrorAsync(responseMessage); if (remoteServiceErrorMessage != null) { exceptionMessage += remoteServiceErrorMessage; @@ -52,7 +52,7 @@ namespace Volo.Abp.Cli.ProjectBuilding errorResult = _jsonSerializer.Deserialize ( await responseMessage.Content.ReadAsStringAsync() -.ConfigureAwait(false)); + ); } catch (JsonReaderException) { diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs index 87c399181d..9d31e10200 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/TemplateProjectBuilder.cs @@ -51,9 +51,9 @@ namespace Volo.Abp.Cli.ProjectBuilding args.TemplateName, SourceCodeTypes.Template, args.Version - ).ConfigureAwait(false); + ); - var apiKeyResult = await ApiKeyService.GetApiKeyOrNullAsync().ConfigureAwait(false); + var apiKeyResult = await ApiKeyService.GetApiKeyOrNullAsync(); if (apiKeyResult?.ApiKey != null) { args.ExtraProperties["api-key"] = apiKeyResult.ApiKey; @@ -103,7 +103,7 @@ namespace Volo.Abp.Cli.ProjectBuilding ProjectName = args.SolutionName.FullName, TemplateName = args.TemplateName, TemplateVersion = templateFile.Version - }).ConfigureAwait(false); + }); return new ProjectBuildResult(context.Result.ZipContent, args.SolutionName.ProjectName); } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppProTemplate.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppProTemplate.cs index 1b05b887c5..20f7fb84c9 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppProTemplate.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppProTemplate.cs @@ -10,7 +10,7 @@ public AppProTemplate() : base(TemplateName) { - + DocumentUrl = CliConsts.DocsLink + "/en/commercial/latest"; } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplate.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplate.cs index 030a0a8752..c4a9f7b6da 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplate.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplate.cs @@ -10,7 +10,7 @@ public AppTemplate() : base(TemplateName) { - + DocumentUrl = CliConsts.DocsLink + "/en/abp/latest/Startup-Templates/Application"; } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs index 1ca4a7f287..254e8d80ae 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/App/AppTemplateBase.cs @@ -10,7 +10,6 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.App protected AppTemplateBase(string templateName) : base(templateName, DatabaseProvider.EntityFrameworkCore, UiFramework.Mvc) { - DocumentUrl = "https://docs.abp.io/en/abp/latest/Startup-Templates/Application"; } public static bool IsAppTemplate(string templateName) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs index 09b75ac0e2..3faf920ab0 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectBuilding/Templates/Module/ModuleTemplateBase.cs @@ -43,6 +43,8 @@ namespace Volo.Abp.Cli.ProjectBuilding.Templates.Module "MyCompanyName.MyProjectName.Web.Unified", projectFolderPath: "/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified" )); + + steps.Add(new RemoveFolderStep("/angular")); } private void RandomizeSslPorts(ProjectBuildContext context, List steps) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationAdder.cs index 1c8727852b..b125c55648 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/EfCoreMigrationAdder.cs @@ -12,7 +12,7 @@ namespace Volo.Abp.Cli.ProjectModification var moduleName = ParseModuleName(module); var migrationName = "Added_" + moduleName + "_Module" + GetUniquePostFix(); - CmdHelper.RunCmd("cd \"" + Path.GetDirectoryName(csprojFile) + "\" & dotnet ef migrations add " + migrationName + GetStartupProjectOption(startupProject)); + CmdHelper.RunCmd("cd \"" + Path.GetDirectoryName(csprojFile) + "\" && dotnet ef migrations add " + migrationName + GetStartupProjectOption(startupProject)); if (updateDatabase) { @@ -22,7 +22,7 @@ namespace Volo.Abp.Cli.ProjectModification protected void UpdateDatabase(string csprojFile, string startupProject) { - CmdHelper.RunCmd("cd \"" + Path.GetDirectoryName(csprojFile) + "\" & dotnet ef database update" + GetStartupProjectOption(startupProject)); + CmdHelper.RunCmd("cd \"" + Path.GetDirectoryName(csprojFile) + "\" && dotnet ef database update" + GetStartupProjectOption(startupProject)); } protected virtual string ParseModuleName(string fullModuleName) diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NuGetPackageTarget.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NuGetPackageTarget.cs index 66467bfa36..9af114dfff 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NuGetPackageTarget.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/NuGetPackageTarget.cs @@ -2,6 +2,7 @@ { public enum NuGetPackageTarget : byte { + Undefined = 0, DomainShared = 1, Domain = 2, ApplicationContracts = 3, diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectFinder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectFinder.cs index 9c6edf479d..9d155ba079 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectFinder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectFinder.cs @@ -2,11 +2,13 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using JetBrains.Annotations; namespace Volo.Abp.Cli.ProjectModification { public static class ProjectFinder { + [CanBeNull] public static string FindNuGetTargetProjectFile(string[] projectFiles, NuGetPackageTarget target) { if (!projectFiles.Any()) @@ -40,7 +42,7 @@ namespace Volo.Abp.Cli.ProjectModification case NuGetPackageTarget.HttpApiClient: return FindProjectEndsWith(projectFiles, assemblyNames, ".HttpApi.Client"); default: - throw new ApplicationException($"{nameof(NuGetPackageTarget)}.{target} has not implemented!"); + return null; } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs index 4bfe3ef4b8..62dee30344 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/ProjectNugetPackageAdder.cs @@ -45,10 +45,10 @@ namespace Volo.Abp.Cli.ProjectModification await AddAsync( projectFile, await FindNugetPackageInfoAsync(packageName) -.ConfigureAwait(false)).ConfigureAwait(false); + ); } - public async Task AddAsync(string projectFile, NugetPackageInfo package) + public Task AddAsync(string projectFile, NugetPackageInfo package) { using (DirectoryHelper.ChangeCurrentDirectory(Path.GetDirectoryName(projectFile))) { @@ -71,6 +71,8 @@ namespace Volo.Abp.Cli.ProjectModification Logger.LogInformation("Successfully installed."); } + + return Task.CompletedTask; } protected virtual async Task FindNugetPackageInfoAsync(string moduleName) @@ -79,7 +81,7 @@ namespace Volo.Abp.Cli.ProjectModification { var url = $"{CliUrls.WwwAbpIo}api/app/nugetPackage/byName/?name=" + moduleName; - var response = await client.GetAsync(url).ConfigureAwait(false); + var response = await client.GetAsync(url); if (!response.IsSuccessStatusCode) { @@ -88,10 +90,10 @@ namespace Volo.Abp.Cli.ProjectModification throw new CliUsageException($"'{moduleName}' nuget package could not be found!"); } - await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response).ConfigureAwait(false); + await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response); } - var responseContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + var responseContent = await response.Content.ReadAsStringAsync(); return JsonSerializer.Deserialize(responseContent); } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs index 5e20904812..d8a376eb02 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/SolutionModuleAdder.cs @@ -57,7 +57,7 @@ namespace Volo.Abp.Cli.ProjectModification Check.NotNull(solutionFile, nameof(solutionFile)); Check.NotNull(moduleName, nameof(moduleName)); - var module = await FindModuleInfoAsync(moduleName).ConfigureAwait(false); + var module = await FindModuleInfoAsync(moduleName); Logger.LogInformation($"Installing module '{module.Name}' to the solution '{Path.GetFileNameWithoutExtension(solutionFile)}'"); @@ -68,11 +68,11 @@ namespace Volo.Abp.Cli.ProjectModification var targetProjectFile = ProjectFinder.FindNuGetTargetProjectFile(projectFiles, nugetPackage.Target); if (targetProjectFile == null) { - Logger.LogDebug($"Target project is not available for NuGet package '{nugetPackage.Name}'"); + Logger.LogDebug($"Target project is not available for this NuGet package '{nugetPackage.Name}'"); continue; } - await ProjectNugetPackageAdder.AddAsync(targetProjectFile, nugetPackage).ConfigureAwait(false); + await ProjectNugetPackageAdder.AddAsync(targetProjectFile, nugetPackage); } if (!module.NpmPackages.IsNullOrEmpty()) @@ -86,7 +86,7 @@ namespace Volo.Abp.Cli.ProjectModification { foreach (var npmPackage in module.NpmPackages.Where(p => p.ApplicationType.HasFlag(NpmApplicationType.Mvc))) { - await ProjectNpmPackageAdder.AddAsync(Path.GetDirectoryName(targetProject), npmPackage).ConfigureAwait(false); + await ProjectNpmPackageAdder.AddAsync(Path.GetDirectoryName(targetProject), npmPackage); } } } @@ -106,6 +106,11 @@ namespace Volo.Abp.Cli.ProjectModification return; } + if (string.IsNullOrWhiteSpace(startupProject)) + { + startupProject = projectFiles.FirstOrDefault(p => p.EndsWith(".DbMigrator.csproj")); + } + var dbMigrationsProject = projectFiles.FirstOrDefault(p => p.EndsWith(".DbMigrations.csproj")); if (dbMigrationsProject == null) @@ -137,7 +142,7 @@ namespace Volo.Abp.Cli.ProjectModification { var url = $"{CliUrls.WwwAbpIo}api/app/module/byName/?name=" + moduleName; - var response = await client.GetAsync(url).ConfigureAwait(false); + var response = await client.GetAsync(url); if (!response.IsSuccessStatusCode) { @@ -146,10 +151,10 @@ namespace Volo.Abp.Cli.ProjectModification throw new CliUsageException($"ERROR: '{moduleName}' module could not be found!"); } - await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response).ConfigureAwait(false); + await RemoteServiceExceptionHandler.EnsureSuccessfulHttpResponseAsync(response); } - var responseContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + var responseContent = await response.Content.ReadAsStringAsync(); return JsonSerializer.Deserialize(responseContent); } } diff --git a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs index 4137c7b645..d5756a4566 100644 --- a/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs +++ b/framework/src/Volo.Abp.Cli.Core/Volo/Abp/Cli/ProjectModification/VoloNugetPackagesVersionUpdater.cs @@ -27,20 +27,20 @@ namespace Volo.Abp.Cli.ProjectModification foreach (var filePath in projectPaths) { - await UpdateInternalAsync(filePath, includePreviews).ConfigureAwait(false); + await UpdateInternalAsync(filePath, includePreviews); } } public async Task UpdateProjectAsync(string projectPath, bool includePreviews) { - await UpdateInternalAsync(projectPath, includePreviews).ConfigureAwait(false); + await UpdateInternalAsync(projectPath, includePreviews); } protected virtual async Task UpdateInternalAsync(string projectPath, bool includePreviews) { var fileContent = File.ReadAllText(projectPath); - File.WriteAllText(projectPath, await UpdateVoloPackagesAsync(fileContent, includePreviews).ConfigureAwait(false)); + File.WriteAllText(projectPath, await UpdateVoloPackagesAsync(fileContent, includePreviews)); } private async Task UpdateVoloPackagesAsync(string content, bool includePreviews) @@ -74,7 +74,7 @@ namespace Volo.Abp.Cli.ProjectModification Logger.LogDebug("Checking package: \"{0}\" - Current version: {1}", packageId, packageVersion); - var latestVersion = await _nuGetService.GetLatestVersionOrNullAsync(packageId, includePreviews).ConfigureAwait(false); + var latestVersion = await _nuGetService.GetLatestVersionOrNullAsync(packageId, includePreviews); if (latestVersion != null && packageVersion < latestVersion) { diff --git a/framework/src/Volo.Abp.Cli/FodyWeavers.xml b/framework/src/Volo.Abp.Cli/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Cli/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli/FodyWeavers.xsd b/framework/src/Volo.Abp.Cli/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Cli/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj b/framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj index 333311afd2..f6bcbd5def 100644 --- a/framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj +++ b/framework/src/Volo.Abp.Cli/Volo.Abp.Cli.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.Core/FodyWeavers.xml b/framework/src/Volo.Abp.Core/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Core/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Core/FodyWeavers.xsd b/framework/src/Volo.Abp.Core/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Core/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Core/System/IO/AbpStreamExtensions.cs b/framework/src/Volo.Abp.Core/System/IO/AbpStreamExtensions.cs index 206de7be0d..e87ab67527 100644 --- a/framework/src/Volo.Abp.Core/System/IO/AbpStreamExtensions.cs +++ b/framework/src/Volo.Abp.Core/System/IO/AbpStreamExtensions.cs @@ -17,7 +17,7 @@ namespace System.IO { using (var memoryStream = new MemoryStream()) { - await stream.CopyToAsync(memoryStream).ConfigureAwait(false); + await stream.CopyToAsync(memoryStream); return memoryStream.ToArray(); } } diff --git a/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj b/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj index 42c60785ba..5ffc15d19f 100644 --- a/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj +++ b/framework/src/Volo.Abp.Core/Volo.Abp.Core.csproj @@ -1,5 +1,6 @@ - - + + + netstandard2.0 Volo.Abp.Core @@ -29,4 +30,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationWithExternalServiceProvider.cs b/framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationWithExternalServiceProvider.cs index 1becd3be9b..58f75f3b96 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationWithExternalServiceProvider.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/AbpApplicationWithExternalServiceProvider.cs @@ -26,5 +26,15 @@ namespace Volo.Abp InitializeModules(); } + + public override void Dispose() + { + base.Dispose(); + + if (ServiceProvider is IDisposable disposableServiceProvider) + { + disposableServiceProvider.Dispose(); + } + } } } diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/IO/FileHelper.cs b/framework/src/Volo.Abp.Core/Volo/Abp/IO/FileHelper.cs index 49a86c388a..21ca7c2086 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/IO/FileHelper.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/IO/FileHelper.cs @@ -54,7 +54,7 @@ namespace Volo.Abp.IO { using (var reader = File.OpenText(path)) { - return await reader.ReadToEndAsync().ConfigureAwait(false); + return await reader.ReadToEndAsync(); } } @@ -68,7 +68,7 @@ namespace Volo.Abp.IO using (var stream = File.Open(path, FileMode.Open)) { var result = new byte[stream.Length]; - await stream.ReadAsync(result, 0, (int)stream.Length).ConfigureAwait(false); + await stream.ReadAsync(result, 0, (int)stream.Length); return result; } } diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/AbpModule.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/AbpModule.cs index 6153f4be97..f40c6caf12 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/AbpModule.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Modularity/AbpModule.cs @@ -121,5 +121,17 @@ namespace Volo.Abp.Modularity { ServiceConfigurationContext.Services.PreConfigure(configureOptions); } + + protected void PostConfigure(Action configureOptions) + where TOptions : class + { + ServiceConfigurationContext.Services.PostConfigure(configureOptions); + } + + protected void PostConfigureAll(Action configureOptions) + where TOptions : class + { + ServiceConfigurationContext.Services.PostConfigureAll(configureOptions); + } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Threading/AsyncOneTimeRunner.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Threading/AsyncOneTimeRunner.cs index 44bd73c074..7b440ebfe6 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Threading/AsyncOneTimeRunner.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Threading/AsyncOneTimeRunner.cs @@ -21,14 +21,14 @@ namespace Volo.Abp.Threading return; } - using (await _semaphore.LockAsync().ConfigureAwait(false)) + using (await _semaphore.LockAsync()) { if (_runBefore) { return; } - await action().ConfigureAwait(false); + await action(); _runBefore = true; } diff --git a/framework/src/Volo.Abp.Core/Volo/Abp/Threading/InternalAsyncHelper.cs b/framework/src/Volo.Abp.Core/Volo/Abp/Threading/InternalAsyncHelper.cs index ce04a02479..3697d59e3f 100644 --- a/framework/src/Volo.Abp.Core/Volo/Abp/Threading/InternalAsyncHelper.cs +++ b/framework/src/Volo.Abp.Core/Volo/Abp/Threading/InternalAsyncHelper.cs @@ -14,8 +14,8 @@ namespace Volo.Abp.Threading Exception exception = null; try - { - await actualReturnValue.ConfigureAwait(false); + { + await actualReturnValue; } catch (Exception ex) { @@ -33,9 +33,9 @@ namespace Volo.Abp.Threading Exception exception = null; try - { - await actualReturnValue.ConfigureAwait(false); - await postAction().ConfigureAwait(false); + { + await actualReturnValue; + await postAction(); } catch (Exception ex) { @@ -55,15 +55,15 @@ namespace Volo.Abp.Threading try { if (preAction != null) - { - await preAction().ConfigureAwait(false); - } - - await actualReturnValue().ConfigureAwait(false); + { + await preAction(); + } + + await actualReturnValue(); if (postAction != null) - { - await postAction().ConfigureAwait(false); + { + await postAction(); } } catch (Exception ex) @@ -86,7 +86,7 @@ namespace Volo.Abp.Threading try { - return await actualReturnValue.ConfigureAwait(false); + return await actualReturnValue; } catch (Exception ex) { @@ -114,8 +114,8 @@ namespace Volo.Abp.Threading try { - var result = await actualReturnValue.ConfigureAwait(false); - await postAction().ConfigureAwait(false); + var result = await actualReturnValue; + await postAction(); return result; } catch (Exception ex) @@ -145,15 +145,15 @@ namespace Volo.Abp.Threading try { if (preAction != null) - { - await preAction().ConfigureAwait(false); + { + await preAction(); } - var result = await actualReturnValue().ConfigureAwait(false); + var result = await actualReturnValue(); if (postAction != null) - { - await postAction().ConfigureAwait(false); + { + await postAction(); } return result; diff --git a/framework/src/Volo.Abp.Dapper/FodyWeavers.xml b/framework/src/Volo.Abp.Dapper/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Dapper/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Dapper/FodyWeavers.xsd b/framework/src/Volo.Abp.Dapper/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Dapper/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Dapper/Volo.Abp.Dapper.csproj b/framework/src/Volo.Abp.Dapper/Volo.Abp.Dapper.csproj index f7b9d76169..27a92976e5 100644 --- a/framework/src/Volo.Abp.Dapper/Volo.Abp.Dapper.csproj +++ b/framework/src/Volo.Abp.Dapper/Volo.Abp.Dapper.csproj @@ -1,9 +1,10 @@ - + + - netstandard2.1 + netstandard2.0 Volo.Abp.Dapper Volo.Abp.Dapper $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; @@ -21,4 +22,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.Data/FodyWeavers.xml b/framework/src/Volo.Abp.Data/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Data/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Data/FodyWeavers.xsd b/framework/src/Volo.Abp.Data/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Data/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Data/Volo.Abp.Data.csproj b/framework/src/Volo.Abp.Data/Volo.Abp.Data.csproj index d2734cb119..7a53782ae1 100644 --- a/framework/src/Volo.Abp.Data/Volo.Abp.Data.csproj +++ b/framework/src/Volo.Abp.Data/Volo.Abp.Data.csproj @@ -1,5 +1,6 @@ + diff --git a/framework/src/Volo.Abp.Data/Volo/Abp/Data/DataSeeder.cs b/framework/src/Volo.Abp.Data/Volo/Abp/Data/DataSeeder.cs index a6a073b67b..c20badbeb7 100644 --- a/framework/src/Volo.Abp.Data/Volo/Abp/Data/DataSeeder.cs +++ b/framework/src/Volo.Abp.Data/Volo/Abp/Data/DataSeeder.cs @@ -31,7 +31,7 @@ namespace Volo.Abp.Data .ServiceProvider .GetRequiredService(contributorType); - await contributor.SeedAsync(context).ConfigureAwait(false); + await contributor.SeedAsync(context); } } } diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/FodyWeavers.xml b/framework/src/Volo.Abp.Ddd.Application.Contracts/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/FodyWeavers.xsd b/framework/src/Volo.Abp.Ddd.Application.Contracts/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo.Abp.Ddd.Application.Contracts.csproj b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo.Abp.Ddd.Application.Contracts.csproj index 6f1674f8ce..6668f9c649 100644 --- a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo.Abp.Ddd.Application.Contracts.csproj +++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo.Abp.Ddd.Application.Contracts.csproj @@ -1,5 +1,6 @@ - + + @@ -15,12 +16,12 @@ + - - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Localization/Resources/AbpDdd/zh-Hant.json b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Localization/Resources/AbpDdd/zh-Hant.json new file mode 100644 index 0000000000..97a615e901 --- /dev/null +++ b/framework/src/Volo.Abp.Ddd.Application.Contracts/Volo/Abp/Application/Localization/Resources/AbpDdd/zh-Hant.json @@ -0,0 +1,6 @@ +{ + "culture": "zh-Hant", + "texts": { + "MaxResultCountExceededExceptionMessage": "{0}禁止超過{1}! 請在伺服器端增加{2}.{3}以獲得更多結果." + } +} diff --git a/framework/src/Volo.Abp.Ddd.Application/FodyWeavers.xml b/framework/src/Volo.Abp.Ddd.Application/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Ddd.Application/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Ddd.Application/FodyWeavers.xsd b/framework/src/Volo.Abp.Ddd.Application/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Ddd.Application/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Ddd.Application/Volo.Abp.Ddd.Application.csproj b/framework/src/Volo.Abp.Ddd.Application/Volo.Abp.Ddd.Application.csproj index 09198e47f6..f88e0f4795 100644 --- a/framework/src/Volo.Abp.Ddd.Application/Volo.Abp.Ddd.Application.csproj +++ b/framework/src/Volo.Abp.Ddd.Application/Volo.Abp.Ddd.Application.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs index 038ba0cf29..32c90677b8 100644 --- a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs +++ b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/ApplicationService.cs @@ -9,7 +9,6 @@ using System.Collections.Generic; using System.Threading.Tasks; using Volo.Abp.Aspects; using Volo.Abp.Auditing; -using Volo.Abp.Authorization; using Volo.Abp.DependencyInjection; using Volo.Abp.Features; using Volo.Abp.Guids; @@ -146,7 +145,7 @@ namespace Volo.Abp.Application.Services return; } - await AuthorizationService.CheckAsync(policyName).ConfigureAwait(false); + await AuthorizationService.CheckAsync(policyName); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs index e5febca25b..4134b59a4c 100644 --- a/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs +++ b/framework/src/Volo.Abp.Ddd.Application/Volo/Abp/Application/Services/CrudAppService.cs @@ -93,24 +93,24 @@ namespace Volo.Abp.Application.Services public virtual async Task GetAsync(TKey id) { - await CheckGetPolicyAsync().ConfigureAwait(false); + await CheckGetPolicyAsync(); - var entity = await GetEntityByIdAsync(id).ConfigureAwait(false); + var entity = await GetEntityByIdAsync(id); return MapToGetOutputDto(entity); } public virtual async Task> GetListAsync(TGetListInput input) { - await CheckGetListPolicyAsync().ConfigureAwait(false); + await CheckGetListPolicyAsync(); var query = CreateFilteredQuery(input); - var totalCount = await AsyncQueryableExecuter.CountAsync(query).ConfigureAwait(false); + var totalCount = await AsyncQueryableExecuter.CountAsync(query); query = ApplySorting(query, input); query = ApplyPaging(query, input); - var entities = await AsyncQueryableExecuter.ToListAsync(query).ConfigureAwait(false); + var entities = await AsyncQueryableExecuter.ToListAsync(query); return new PagedResultDto( totalCount, @@ -120,34 +120,34 @@ namespace Volo.Abp.Application.Services public virtual async Task CreateAsync(TCreateInput input) { - await CheckCreatePolicyAsync().ConfigureAwait(false); + await CheckCreatePolicyAsync(); var entity = MapToEntity(input); TryToSetTenantId(entity); - await Repository.InsertAsync(entity, autoSave: true).ConfigureAwait(false); + await Repository.InsertAsync(entity, autoSave: true); return MapToGetOutputDto(entity); } public virtual async Task UpdateAsync(TKey id, TUpdateInput input) { - await CheckUpdatePolicyAsync().ConfigureAwait(false); + await CheckUpdatePolicyAsync(); - var entity = await GetEntityByIdAsync(id).ConfigureAwait(false); + var entity = await GetEntityByIdAsync(id); //TODO: Check if input has id different than given id and normalize if it's default value, throw ex otherwise MapToEntity(input, entity); - await Repository.UpdateAsync(entity, autoSave: true).ConfigureAwait(false); + await Repository.UpdateAsync(entity, autoSave: true); return MapToGetOutputDto(entity); } public virtual async Task DeleteAsync(TKey id) { - await CheckDeletePolicyAsync().ConfigureAwait(false); + await CheckDeletePolicyAsync(); - await Repository.DeleteAsync(id).ConfigureAwait(false); + await Repository.DeleteAsync(id); } protected virtual Task GetEntityByIdAsync(TKey id) @@ -157,27 +157,27 @@ namespace Volo.Abp.Application.Services protected virtual async Task CheckGetPolicyAsync() { - await CheckPolicyAsync(GetPolicyName).ConfigureAwait(false); + await CheckPolicyAsync(GetPolicyName); } protected virtual async Task CheckGetListPolicyAsync() { - await CheckPolicyAsync(GetListPolicyName).ConfigureAwait(false); + await CheckPolicyAsync(GetListPolicyName); } protected virtual async Task CheckCreatePolicyAsync() { - await CheckPolicyAsync(CreatePolicyName).ConfigureAwait(false); + await CheckPolicyAsync(CreatePolicyName); } protected virtual async Task CheckUpdatePolicyAsync() { - await CheckPolicyAsync(UpdatePolicyName).ConfigureAwait(false); + await CheckPolicyAsync(UpdatePolicyName); } protected virtual async Task CheckDeletePolicyAsync() { - await CheckPolicyAsync(DeletePolicyName).ConfigureAwait(false); + await CheckPolicyAsync(DeletePolicyName); } /// diff --git a/framework/src/Volo.Abp.Ddd.Domain/FodyWeavers.xml b/framework/src/Volo.Abp.Ddd.Domain/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Ddd.Domain/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Ddd.Domain/FodyWeavers.xsd b/framework/src/Volo.Abp.Ddd.Domain/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Ddd.Domain/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo.Abp.Ddd.Domain.csproj b/framework/src/Volo.Abp.Ddd.Domain/Volo.Abp.Ddd.Domain.csproj index cc1cb1494f..ab162e60c7 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo.Abp.Ddd.Domain.csproj +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo.Abp.Ddd.Domain.csproj @@ -1,5 +1,6 @@ + diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedAggregateRootWithUser.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedAggregateRootWithUser.cs index cb0be46421..b2dbb8c280 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedAggregateRootWithUser.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Auditing/FullAuditedAggregateRootWithUser.cs @@ -4,12 +4,12 @@ using Volo.Abp.Auditing; namespace Volo.Abp.Domain.Entities.Auditing { /// - /// Implements to be a base class for full-audited aggregate roots. + /// Implements to be a base class for full-audited aggregate roots. /// /// Type of the user [Serializable] public abstract class FullAuditedAggregateRootWithUser : FullAuditedAggregateRoot, IFullAuditedObject - where TUser : IEntity + where TUser : IEntity { /// public virtual TUser Deleter { get; set; } @@ -22,13 +22,13 @@ namespace Volo.Abp.Domain.Entities.Auditing } /// - /// Implements to be a base class for full-audited aggregate roots. + /// Implements to be a base class for full-audited aggregate roots. /// /// Type of the primary key of the entity /// Type of the user [Serializable] public abstract class FullAuditedAggregateRootWithUser : FullAuditedAggregateRoot, IFullAuditedObject - where TUser : IEntity + where TUser : IEntity { /// public virtual TUser Deleter { get; set; } diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/EntityHelper.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/EntityHelper.cs index 92ebdd4568..a33c5f56ec 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/EntityHelper.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/EntityHelper.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.Linq.Expressions; using System.Reflection; using JetBrains.Annotations; +using Volo.Abp.MultiTenancy; +using Volo.Abp.Reflection; namespace Volo.Abp.Domain.Entities { @@ -11,6 +13,7 @@ namespace Volo.Abp.Domain.Entities /// public static class EntityHelper { + public static bool IsEntity([NotNull] Type type) { return typeof(IEntity).IsAssignableFrom(type); @@ -82,10 +85,10 @@ namespace Volo.Abp.Domain.Entities var lambdaBody = Expression.Equal(leftExpression, rightExpression); return Expression.Lambda>(lambdaBody, lambdaParam); } - + public static void TrySetId( - IEntity entity, - Func idFactory, + IEntity entity, + Func idFactory, bool checkForDisableGuidGenerationAttribute = false) { //TODO: Can be optimized (by caching per entity type)? diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/EntityChangeEventHelper.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/EntityChangeEventHelper.cs index 47e3571ffd..c9219feffc 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/EntityChangeEventHelper.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Entities/Events/EntityChangeEventHelper.cs @@ -36,14 +36,14 @@ namespace Volo.Abp.Domain.Entities.Events public async Task TriggerEventsAsync(EntityChangeReport changeReport) { - await TriggerEventsInternalAsync(changeReport).ConfigureAwait(false); + await TriggerEventsInternalAsync(changeReport); if (changeReport.IsEmpty() || UnitOfWorkManager.Current == null) { return; } - await UnitOfWorkManager.Current.SaveChangesAsync().ConfigureAwait(false); + await UnitOfWorkManager.Current.SaveChangesAsync(); } public virtual async Task TriggerEntityCreatingEventAsync(object entity) @@ -53,7 +53,7 @@ namespace Volo.Abp.Domain.Entities.Events typeof(EntityCreatingEventData<>), entity, true - ).ConfigureAwait(false); + ); } public virtual async Task TriggerEntityCreatedEventOnUowCompletedAsync(object entity) @@ -63,7 +63,7 @@ namespace Volo.Abp.Domain.Entities.Events typeof(EntityCreatedEventData<>), entity, false - ).ConfigureAwait(false); + ); var eto = EntityToEtoMapper.Map(entity); if (eto != null) @@ -73,7 +73,7 @@ namespace Volo.Abp.Domain.Entities.Events typeof(EntityCreatedEto<>), eto, false - ).ConfigureAwait(false); + ); } } @@ -84,7 +84,7 @@ namespace Volo.Abp.Domain.Entities.Events typeof(EntityUpdatingEventData<>), entity, true - ).ConfigureAwait(false); + ); } public virtual async Task TriggerEntityUpdatedEventOnUowCompletedAsync(object entity) @@ -94,7 +94,7 @@ namespace Volo.Abp.Domain.Entities.Events typeof(EntityUpdatedEventData<>), entity, false - ).ConfigureAwait(false); + ); var eto = EntityToEtoMapper.Map(entity); if (eto != null) @@ -104,7 +104,7 @@ namespace Volo.Abp.Domain.Entities.Events typeof(EntityUpdatedEto<>), eto, false - ).ConfigureAwait(false); + ); } } @@ -115,7 +115,7 @@ namespace Volo.Abp.Domain.Entities.Events typeof(EntityDeletingEventData<>), entity, true - ).ConfigureAwait(false); + ); } public virtual async Task TriggerEntityDeletedEventOnUowCompletedAsync(object entity) @@ -125,7 +125,7 @@ namespace Volo.Abp.Domain.Entities.Events typeof(EntityDeletedEventData<>), entity, false - ).ConfigureAwait(false); + ); var eto = EntityToEtoMapper.Map(entity); if (eto != null) @@ -135,15 +135,15 @@ namespace Volo.Abp.Domain.Entities.Events typeof(EntityDeletedEto<>), EntityToEtoMapper.Map(entity), false - ).ConfigureAwait(false); + ); } } protected virtual async Task TriggerEventsInternalAsync(EntityChangeReport changeReport) { - await TriggerEntityChangeEvents(changeReport.ChangedEntities).ConfigureAwait(false); - await TriggerLocalEvents(changeReport.DomainEvents).ConfigureAwait(false); - await TriggerDistributedEvents(changeReport.DistributedEvents).ConfigureAwait(false); + await TriggerEntityChangeEvents(changeReport.ChangedEntities); + await TriggerLocalEvents(changeReport.DomainEvents); + await TriggerDistributedEvents(changeReport.DistributedEvents); } protected virtual async Task TriggerEntityChangeEvents(List changedEntities) @@ -153,16 +153,16 @@ namespace Volo.Abp.Domain.Entities.Events switch (changedEntity.ChangeType) { case EntityChangeType.Created: - await TriggerEntityCreatingEventAsync(changedEntity.Entity).ConfigureAwait(false); - await TriggerEntityCreatedEventOnUowCompletedAsync(changedEntity.Entity).ConfigureAwait(false); + await TriggerEntityCreatingEventAsync(changedEntity.Entity); + await TriggerEntityCreatedEventOnUowCompletedAsync(changedEntity.Entity); break; case EntityChangeType.Updated: - await TriggerEntityUpdatingEventAsync(changedEntity.Entity).ConfigureAwait(false); - await TriggerEntityUpdatedEventOnUowCompletedAsync(changedEntity.Entity).ConfigureAwait(false); + await TriggerEntityUpdatingEventAsync(changedEntity.Entity); + await TriggerEntityUpdatedEventOnUowCompletedAsync(changedEntity.Entity); break; case EntityChangeType.Deleted: - await TriggerEntityDeletingEventAsync(changedEntity.Entity).ConfigureAwait(false); - await TriggerEntityDeletedEventOnUowCompletedAsync(changedEntity.Entity).ConfigureAwait(false); + await TriggerEntityDeletingEventAsync(changedEntity.Entity); + await TriggerEntityDeletedEventOnUowCompletedAsync(changedEntity.Entity); break; default: throw new AbpException("Unknown EntityChangeType: " + changedEntity.ChangeType); @@ -174,7 +174,7 @@ namespace Volo.Abp.Domain.Entities.Events { foreach (var localEvent in localEvents) { - await LocalEventBus.PublishAsync(localEvent.EventData.GetType(), localEvent.EventData).ConfigureAwait(false); + await LocalEventBus.PublishAsync(localEvent.EventData.GetType(), localEvent.EventData); } } @@ -182,7 +182,7 @@ namespace Volo.Abp.Domain.Entities.Events { foreach (var distributedEvent in distributedEvents) { - await DistributedEventBus.PublishAsync(distributedEvent.EventData.GetType(), distributedEvent.EventData).ConfigureAwait(false); + await DistributedEventBus.PublishAsync(distributedEvent.EventData.GetType(), distributedEvent.EventData); } } @@ -193,7 +193,7 @@ namespace Volo.Abp.Domain.Entities.Events if (triggerInCurrentUnitOfWork || UnitOfWorkManager.Current == null) { - await eventPublisher.PublishAsync(eventType, Activator.CreateInstance(eventType, entity)).ConfigureAwait(false); + await eventPublisher.PublishAsync(eventType, Activator.CreateInstance(eventType, entity)); return; } diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs index ae438fdd01..d13d52ed97 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/BasicRepositoryBase.cs @@ -46,7 +46,7 @@ namespace Volo.Abp.Domain.Repositories { public virtual async Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default) { - var entity = await FindAsync(id, includeDetails, cancellationToken).ConfigureAwait(false); + var entity = await FindAsync(id, includeDetails, cancellationToken); if (entity == null) { @@ -60,13 +60,13 @@ namespace Volo.Abp.Domain.Repositories public virtual async Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default) { - var entity = await FindAsync(id, cancellationToken: cancellationToken).ConfigureAwait(false); + var entity = await FindAsync(id, cancellationToken: cancellationToken); if (entity == null) { return; } - await DeleteAsync(entity, autoSave, cancellationToken).ConfigureAwait(false); + await DeleteAsync(entity, autoSave, cancellationToken); } } } diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryBase.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryBase.cs index 358d36733e..3ade403017 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryBase.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryBase.cs @@ -8,16 +8,19 @@ using System.Threading.Tasks; using Volo.Abp.Data; using Volo.Abp.Domain.Entities; using Volo.Abp.MultiTenancy; +using Volo.Abp.Uow; namespace Volo.Abp.Domain.Repositories { - public abstract class RepositoryBase : BasicRepositoryBase, IRepository + public abstract class RepositoryBase : BasicRepositoryBase, IRepository, IUnitOfWorkManagerAccessor where TEntity : class, IEntity { public IDataFilter DataFilter { get; set; } public ICurrentTenant CurrentTenant { get; set; } + public IUnitOfWorkManager UnitOfWorkManager { get; set; } + public virtual Type ElementType => GetQueryable().ElementType; public virtual Expression Expression => GetQueryable().Expression; @@ -75,13 +78,13 @@ namespace Volo.Abp.Domain.Repositories public virtual async Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default) { - var entity = await FindAsync(id, cancellationToken: cancellationToken).ConfigureAwait(false); + var entity = await FindAsync(id, cancellationToken: cancellationToken); if (entity == null) { return; } - await DeleteAsync(entity, autoSave, cancellationToken).ConfigureAwait(false); + await DeleteAsync(entity, autoSave, cancellationToken); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs index 915b97a7d4..ef44d6830d 100644 --- a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/RepositoryExtensions.cs @@ -5,6 +5,7 @@ using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Entities; using Volo.Abp.DynamicProxy; +using Volo.Abp.Uow; namespace Volo.Abp.Domain.Repositories { @@ -22,7 +23,7 @@ namespace Volo.Abp.Domain.Repositories var repo = ProxyHelper.UnProxy(repository) as ISupportsExplicitLoading; if (repo != null) { - await repo.EnsureCollectionLoadedAsync(entity, propertyExpression, cancellationToken).ConfigureAwait(false); + await repo.EnsureCollectionLoadedAsync(entity, propertyExpression, cancellationToken); } } @@ -38,8 +39,59 @@ namespace Volo.Abp.Domain.Repositories var repo = ProxyHelper.UnProxy(repository) as ISupportsExplicitLoading; if (repo != null) { - await repo.EnsurePropertyLoadedAsync(entity, propertyExpression, cancellationToken).ConfigureAwait(false); + await repo.EnsurePropertyLoadedAsync(entity, propertyExpression, cancellationToken); } } + + public static async Task HardDeleteAsync( + this IBasicRepository repository, + TEntity entity, + bool autoSave = false, + CancellationToken cancellationToken = default + ) + where TEntity : class, IEntity, ISoftDelete + { + if (!(ProxyHelper.UnProxy(repository) is IUnitOfWorkManagerAccessor unitOfWorkManagerAccessor)) + { + throw new AbpException($"The given repository (of type {repository.GetType().AssemblyQualifiedName}) should implement the {typeof(IUnitOfWorkManagerAccessor).AssemblyQualifiedName} interface in order to invoke the {nameof(HardDeleteAsync)} method!"); + } + + var uowManager = unitOfWorkManagerAccessor.UnitOfWorkManager; + if (uowManager == null) + { + throw new AbpException($"{nameof(unitOfWorkManagerAccessor.UnitOfWorkManager)} property of the given {nameof(repository)} object is null!"); + } + + if (uowManager.Current == null) + { + using (var uow = uowManager.Begin()) + { + await HardDeleteWithUnitOfWorkAsync(repository, entity, autoSave, cancellationToken, uowManager.Current); + await uow.CompleteAsync(cancellationToken); + } + } + else + { + await HardDeleteWithUnitOfWorkAsync(repository, entity, autoSave, cancellationToken, uowManager.Current); + } + } + + private static async Task HardDeleteWithUnitOfWorkAsync( + IBasicRepository repository, + TEntity entity, + bool autoSave, + CancellationToken cancellationToken, IUnitOfWork currentUow + ) + where TEntity : class, IEntity, ISoftDelete + { + var hardDeleteEntities = (HashSet) currentUow.Items.GetOrAdd( + UnitOfWorkItemNames.HardDeletedEntities, + () => new HashSet() + ); + + hardDeleteEntities.Add(entity); + + await repository.DeleteAsync(entity, autoSave, cancellationToken); + } } } diff --git a/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/UnitOfWorkItemNames.cs b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/UnitOfWorkItemNames.cs new file mode 100644 index 0000000000..4ec067ceec --- /dev/null +++ b/framework/src/Volo.Abp.Ddd.Domain/Volo/Abp/Domain/Repositories/UnitOfWorkItemNames.cs @@ -0,0 +1,7 @@ +namespace Volo.Abp.Domain.Repositories +{ + public static class UnitOfWorkItemNames + { + public const string HardDeletedEntities = "AbpHardDeletedEntities"; + } +} diff --git a/framework/src/Volo.Abp.Emailing/FodyWeavers.xml b/framework/src/Volo.Abp.Emailing/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Emailing/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Emailing/FodyWeavers.xsd b/framework/src/Volo.Abp.Emailing/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Emailing/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj b/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj index 40fe0b3610..be953a1f26 100644 --- a/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj +++ b/framework/src/Volo.Abp.Emailing/Volo.Abp.Emailing.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderBase.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderBase.cs index aa38f874d6..f6588de9fb 100644 --- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderBase.cs +++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderBase.cs @@ -32,29 +32,29 @@ namespace Volo.Abp.Emailing Subject = subject, Body = body, IsBodyHtml = isBodyHtml - }).ConfigureAwait(false); + }); } public virtual async Task SendAsync(string from, string to, string subject, string body, bool isBodyHtml = true) { - await SendAsync(new MailMessage(from, to, subject, body) { IsBodyHtml = isBodyHtml }).ConfigureAwait(false); + await SendAsync(new MailMessage(from, to, subject, body) { IsBodyHtml = isBodyHtml }); } public virtual async Task SendAsync(MailMessage mail, bool normalize = true) { if (normalize) { - await NormalizeMailAsync(mail).ConfigureAwait(false); + await NormalizeMailAsync(mail); } - await SendEmailAsync(mail).ConfigureAwait(false); + await SendEmailAsync(mail); } public virtual async Task QueueAsync(string to, string subject, string body, bool isBodyHtml = true) { if (!BackgroundJobManager.IsAvailable()) { - await SendAsync(to, subject, body, isBodyHtml).ConfigureAwait(false); + await SendAsync(to, subject, body, isBodyHtml); return; } @@ -66,7 +66,7 @@ namespace Volo.Abp.Emailing Body = body, IsBodyHtml = isBodyHtml } - ).ConfigureAwait(false); + ); } /// @@ -86,8 +86,8 @@ namespace Volo.Abp.Emailing if (mail.From == null || mail.From.Address.IsNullOrEmpty()) { mail.From = new MailAddress( - await Configuration.GetDefaultFromAddressAsync().ConfigureAwait(false), - await Configuration.GetDefaultFromDisplayNameAsync().ConfigureAwait(false), + await Configuration.GetDefaultFromAddressAsync(), + await Configuration.GetDefaultFromDisplayNameAsync(), Encoding.UTF8 ); } diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderConfiguration.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderConfiguration.cs index dafd5b8a4f..e02b78badd 100644 --- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderConfiguration.cs +++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/EmailSenderConfiguration.cs @@ -37,7 +37,7 @@ namespace Volo.Abp.Emailing /// Value of the setting protected async Task GetNotEmptySettingValueAsync(string name) { - var value = await SettingProvider.GetOrNullAsync(name).ConfigureAwait(false); + var value = await SettingProvider.GetOrNullAsync(name); if (value.IsNullOrEmpty()) { diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/cs.json b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/cs.json new file mode 100644 index 0000000000..c4b1aaad40 --- /dev/null +++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/cs.json @@ -0,0 +1,24 @@ +{ + "culture": "cs", + "texts": { + "DisplayName:Abp.Mailing.DefaultFromAddress": "Výchozí adresa odesílatele", + "DisplayName:Abp.Mailing.DefaultFromDisplayName": "Výchozí zobrazované jméno odesilátele", + "DisplayName:Abp.Mailing.Smtp.Host": "Hostitel", + "DisplayName:Abp.Mailing.Smtp.Port": "Port", + "DisplayName:Abp.Mailing.Smtp.UserName": "Uživatelské jméno", + "DisplayName:Abp.Mailing.Smtp.Password": "Heslo", + "DisplayName:Abp.Mailing.Smtp.Domain": "Doména", + "DisplayName:Abp.Mailing.Smtp.EnableSsl": "Povolit SSL", + "DisplayName:Abp.Mailing.Smtp.UseDefaultCredentials": "Použít výchozí přihlašovací údaje", + "Description:Abp.Mailing.DefaultFromAddress": "Výchozí adresa odesílatele", + "Description:Abp.Mailing.DefaultFromDisplayName": "Výchozí zobrazované jméno odesilátele", + "Description:Abp.Mailing.Smtp.Host": "Název nebo IP adresa hostitele použitého pro SMTP transakce.", + "Description:Abp.Mailing.Smtp.Port": "Port použitý pro SMTP tansakce", + "Description:Abp.Mailing.Smtp.UserName": "Uživatelské jméno spojené s přihlašovacími údaji.", + "Description:Abp.Mailing.Smtp.Password": "Heslo pro uživatelské jméno spojené s přihlašovacími údaji.", + "Description:Abp.Mailing.Smtp.Domain": "Název domény nebo počítače, který ověřuje přihlašovací údaje.", + "Description:Abp.Mailing.Smtp.EnableSsl": "Zda SmtpClient používá SSL k šifrování připojení.", + "Description:Abp.Mailing.Smtp.UseDefaultCredentials": "Zda jsou výchozí přihlašovací údaje odesílány s požadavky." + } +} + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/zh-Hant.json b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/zh-Hant.json new file mode 100644 index 0000000000..a66a6d2ff8 --- /dev/null +++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Localization/zh-Hant.json @@ -0,0 +1,23 @@ +{ + "culture": "zh-Hant", + "texts": { + "DisplayName:Abp.Mailing.DefaultFromAddress": "預設發信者地址", + "DisplayName:Abp.Mailing.DefaultFromDisplayName": "預設發信者名稱", + "DisplayName:Abp.Mailing.Smtp.Host": "主機", + "DisplayName:Abp.Mailing.Smtp.Port": "埠號", + "DisplayName:Abp.Mailing.Smtp.UserName": "使用者名稱", + "DisplayName:Abp.Mailing.Smtp.Password": "密碼", + "DisplayName:Abp.Mailing.Smtp.Domain": "網域", + "DisplayName:Abp.Mailing.Smtp.EnableSsl": "啟用SSL", + "DisplayName:Abp.Mailing.Smtp.UseDefaultCredentials": "使用預設憑證", + "Description:Abp.Mailing.DefaultFromAddress": "預設的發信者地址.", + "Description:Abp.Mailing.DefaultFromDisplayName": "預設的發信者名稱.", + "Description:Abp.Mailing.Smtp.Host": "SMTP 服務的主機名稱或主機IP位址.", + "Description:Abp.Mailing.Smtp.Port": "SMTP 服務的埠號.", + "Description:Abp.Mailing.Smtp.UserName": "憑證使用者名稱.", + "Description:Abp.Mailing.Smtp.Password": "憑證使用者密碼.", + "Description:Abp.Mailing.Smtp.Domain": "驗證憑證的網域名稱或電腦名稱.", + "Description:Abp.Mailing.Smtp.EnableSsl": "設定 SmtpClient 是否使用安全通訊協定.", + "Description:Abp.Mailing.Smtp.UseDefaultCredentials": "設定是否使用預設憑證." + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/SmtpEmailSender.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/SmtpEmailSender.cs index 84af1bf348..f97fd57b18 100644 --- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/SmtpEmailSender.cs +++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Smtp/SmtpEmailSender.cs @@ -28,19 +28,19 @@ namespace Volo.Abp.Emailing.Smtp public async Task BuildClientAsync() { - var host = await SmtpConfiguration.GetHostAsync().ConfigureAwait(false); - var port = await SmtpConfiguration.GetPortAsync().ConfigureAwait(false); + var host = await SmtpConfiguration.GetHostAsync(); + var port = await SmtpConfiguration.GetPortAsync(); var smtpClient = new SmtpClient(host, port); try { - if (await SmtpConfiguration.GetEnableSslAsync().ConfigureAwait(false)) + if (await SmtpConfiguration.GetEnableSslAsync()) { smtpClient.EnableSsl = true; } - if (await SmtpConfiguration.GetUseDefaultCredentialsAsync().ConfigureAwait(false)) + if (await SmtpConfiguration.GetUseDefaultCredentialsAsync()) { smtpClient.UseDefaultCredentials = true; } @@ -48,11 +48,11 @@ namespace Volo.Abp.Emailing.Smtp { smtpClient.UseDefaultCredentials = false; - var userName = await SmtpConfiguration.GetUserNameAsync().ConfigureAwait(false); + var userName = await SmtpConfiguration.GetUserNameAsync(); if (!userName.IsNullOrEmpty()) { - var password = await SmtpConfiguration.GetPasswordAsync().ConfigureAwait(false); - var domain = await SmtpConfiguration.GetDomainAsync().ConfigureAwait(false); + var password = await SmtpConfiguration.GetPasswordAsync(); + var domain = await SmtpConfiguration.GetDomainAsync(); smtpClient.Credentials = !domain.IsNullOrEmpty() ? new NetworkCredential(userName, password, domain) : new NetworkCredential(userName, password); @@ -70,9 +70,9 @@ namespace Volo.Abp.Emailing.Smtp protected override async Task SendEmailAsync(MailMessage mail) { - using (var smtpClient = await BuildClientAsync().ConfigureAwait(false)) + using (var smtpClient = await BuildClientAsync()) { - await smtpClient.SendMailAsync(mail).ConfigureAwait(false); + await smtpClient.SendMailAsync(mail); } } } diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Templates/EmailTemplateProvider.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Templates/EmailTemplateProvider.cs index 61db6dec2e..29fcf08664 100644 --- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Templates/EmailTemplateProvider.cs +++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Templates/EmailTemplateProvider.cs @@ -27,12 +27,12 @@ namespace Volo.Abp.Emailing.Templates public async Task GetAsync(string name) { - return await GetAsync(name, CultureInfo.CurrentUICulture.Name).ConfigureAwait(false); + return await GetAsync(name, CultureInfo.CurrentUICulture.Name); } public async Task GetAsync(string name, string cultureName) { - return await GetInternalAsync(name, cultureName).ConfigureAwait(false); + return await GetInternalAsync(name, cultureName); } protected virtual async Task GetInternalAsync(string name, string cultureName) @@ -59,11 +59,11 @@ namespace Volo.Abp.Emailing.Templates { var emailTemplate = new EmailTemplate(emailTemplateString, emailTemplateDefinition); - await SetLayoutAsync(emailTemplateDefinition, emailTemplate, cultureName).ConfigureAwait(false); + await SetLayoutAsync(emailTemplateDefinition, emailTemplate, cultureName); if (emailTemplateDefinition.SingleTemplateFile) { - await LocalizeAsync(emailTemplateDefinition, emailTemplate, cultureName).ConfigureAwait(false); + await LocalizeAsync(emailTemplateDefinition, emailTemplate, cultureName); } return emailTemplate; @@ -87,7 +87,7 @@ namespace Volo.Abp.Emailing.Templates layout = Options.DefaultLayout; } - var layoutTemplate = await GetInternalAsync(layout, cultureName).ConfigureAwait(false); + var layoutTemplate = await GetInternalAsync(layout, cultureName); emailTemplate.SetLayout(layoutTemplate); } diff --git a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Templates/TemplateRender.cs b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Templates/TemplateRender.cs index 1713cf9f3f..8c4e24017c 100644 --- a/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Templates/TemplateRender.cs +++ b/framework/src/Volo.Abp.Emailing/Volo/Abp/Emailing/Templates/TemplateRender.cs @@ -9,7 +9,7 @@ namespace Volo.Abp.Emailing.Templates public async Task RenderAsync(string template, object model = null) { var scribanTemplate = Template.Parse(template); - return await scribanTemplate.RenderAsync(model).ConfigureAwait(false); + return await scribanTemplate.RenderAsync(model); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/FodyWeavers.xml b/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/FodyWeavers.xsd b/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo.Abp.EntityFrameworkCore.MySQL.csproj b/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo.Abp.EntityFrameworkCore.MySQL.csproj index b63a2ae7cb..ebad209a50 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo.Abp.EntityFrameworkCore.MySQL.csproj +++ b/framework/src/Volo.Abp.EntityFrameworkCore.MySQL/Volo.Abp.EntityFrameworkCore.MySQL.csproj @@ -1,9 +1,10 @@ - - + + + - netstandard2.1 + netstandard2.0 Volo.Abp.EntityFrameworkCore.MySQL Volo.Abp.EntityFrameworkCore.MySQL $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; @@ -18,7 +19,7 @@ - + diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/FodyWeavers.xml b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/FodyWeavers.xsd b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj index 0154d1b773..ced9c624ad 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj +++ b/framework/src/Volo.Abp.EntityFrameworkCore.PostgreSql/Volo.Abp.EntityFrameworkCore.PostgreSql.csproj @@ -1,9 +1,10 @@ - + + - netstandard2.1 + netstandard2.0 Volo.Abp.EntityFrameworkCore.PostgreSql Volo.Abp.EntityFrameworkCore.PostgreSql $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/FodyWeavers.xml b/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/FodyWeavers.xsd b/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo.Abp.EntityFrameworkCore.SqlServer.csproj b/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo.Abp.EntityFrameworkCore.SqlServer.csproj index d0d338be9d..bc88ef83d1 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo.Abp.EntityFrameworkCore.SqlServer.csproj +++ b/framework/src/Volo.Abp.EntityFrameworkCore.SqlServer/Volo.Abp.EntityFrameworkCore.SqlServer.csproj @@ -1,9 +1,10 @@ - + + - netstandard2.1 + netstandard2.0 Volo.Abp.EntityFrameworkCore.SqlServer Volo.Abp.EntityFrameworkCore.SqlServer $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/FodyWeavers.xml b/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/FodyWeavers.xsd b/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo.Abp.EntityFrameworkCore.Sqlite.csproj b/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo.Abp.EntityFrameworkCore.Sqlite.csproj index d3c5313898..7747d7faf2 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo.Abp.EntityFrameworkCore.Sqlite.csproj +++ b/framework/src/Volo.Abp.EntityFrameworkCore.Sqlite/Volo.Abp.EntityFrameworkCore.Sqlite.csproj @@ -1,9 +1,10 @@ - + + - netstandard2.1 + netstandard2.0 Volo.Abp.EntityFrameworkCore.Sqlite Volo.Abp.EntityFrameworkCore.Sqlite $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/FodyWeavers.xml b/framework/src/Volo.Abp.EntityFrameworkCore/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.EntityFrameworkCore/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/FodyWeavers.xsd b/framework/src/Volo.Abp.EntityFrameworkCore/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.EntityFrameworkCore/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo.Abp.EntityFrameworkCore.csproj b/framework/src/Volo.Abp.EntityFrameworkCore/Volo.Abp.EntityFrameworkCore.csproj index 3e83001eb2..d0d0c58601 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo.Abp.EntityFrameworkCore.csproj +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo.Abp.EntityFrameworkCore.csproj @@ -1,9 +1,10 @@ - + + - netstandard2.1 + netstandard2.0 Volo.Abp.EntityFrameworkCore Volo.Abp.EntityFrameworkCore $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs index 7890b9b50d..106e00f77a 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/Domain/Repositories/EntityFrameworkCore/EfCoreRepository.cs @@ -46,7 +46,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore if (autoSave) { - await DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + await DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken)); } return savedEntity; @@ -60,7 +60,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore if (autoSave) { - await DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + await DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken)); } return updatedEntity; @@ -72,7 +72,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore if (autoSave) { - await DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + await DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken)); } } @@ -80,12 +80,12 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore { return includeDetails ? await WithDetails().ToListAsync(GetCancellationToken(cancellationToken)) -.ConfigureAwait(false) : await DbSet.ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + : await DbSet.ToListAsync(GetCancellationToken(cancellationToken)); } public override async Task GetCountAsync(CancellationToken cancellationToken = default) { - return await DbSet.LongCountAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + return await DbSet.LongCountAsync(GetCancellationToken(cancellationToken)); } protected override IQueryable GetQueryable() @@ -97,7 +97,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore { var entities = await GetQueryable() .Where(predicate) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); foreach (var entity in entities) { @@ -106,7 +106,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore if (autoSave) { - await DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + await DbContext.SaveChangesAsync(GetCancellationToken(cancellationToken)); } } @@ -119,7 +119,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore await DbContext .Entry(entity) .Collection(propertyExpression) - .LoadAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .LoadAsync(GetCancellationToken(cancellationToken)); } public virtual async Task EnsurePropertyLoadedAsync( @@ -131,7 +131,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore await DbContext .Entry(entity) .Reference(propertyExpression) - .LoadAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .LoadAsync(GetCancellationToken(cancellationToken)); } public override IQueryable WithDetails() @@ -187,7 +187,7 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore public virtual async Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default) { - var entity = await FindAsync(id, includeDetails, GetCancellationToken(cancellationToken)).ConfigureAwait(false); + var entity = await FindAsync(id, includeDetails, GetCancellationToken(cancellationToken)); if (entity == null) { @@ -208,18 +208,18 @@ namespace Volo.Abp.Domain.Repositories.EntityFrameworkCore { return includeDetails ? await WithDetails().FirstOrDefaultAsync(e => e.Id.Equals(id), GetCancellationToken(cancellationToken)) -.ConfigureAwait(false) : await DbSet.FindAsync(new object[] { id }, GetCancellationToken(cancellationToken)).ConfigureAwait(false); + : await DbSet.FindAsync(new object[] {id}, GetCancellationToken(cancellationToken)); } public virtual async Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default) { - var entity = await FindAsync(id, cancellationToken: cancellationToken).ConfigureAwait(false); + var entity = await FindAsync(id, cancellationToken: cancellationToken); if (entity == null) { return; } - await DeleteAsync(entity, autoSave, cancellationToken).ConfigureAwait(false); + await DeleteAsync(entity, autoSave, cancellationToken); } } } diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs index dea620f1e9..ba9cee70ee 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/AbpDbContext.cs @@ -11,18 +11,20 @@ using Microsoft.EntityFrameworkCore.ChangeTracking; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; -using Newtonsoft.Json; using Volo.Abp.Auditing; using Volo.Abp.Data; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Entities; using Volo.Abp.Domain.Entities.Events; +using Volo.Abp.Domain.Repositories; using Volo.Abp.EntityFrameworkCore.EntityHistory; +using Volo.Abp.EntityFrameworkCore.Modeling; using Volo.Abp.EntityFrameworkCore.ValueConverters; using Volo.Abp.Guids; using Volo.Abp.MultiTenancy; using Volo.Abp.Reflection; using Volo.Abp.Timing; +using Volo.Abp.Uow; namespace Volo.Abp.EntityFrameworkCore { @@ -49,6 +51,8 @@ namespace Volo.Abp.EntityFrameworkCore public IAuditingManager AuditingManager { get; set; } + public IUnitOfWorkManager UnitOfWorkManager { get; set; } + public IClock Clock { get; set; } public ILogger> Logger { get; set; } @@ -102,7 +106,7 @@ namespace Volo.Abp.EntityFrameworkCore .Invoke(this, new object[] { modelBuilder, entityType }); } } - + public override async Task SaveChangesAsync(bool acceptAllChangesOnSuccess, CancellationToken cancellationToken = default) { try @@ -117,9 +121,9 @@ namespace Volo.Abp.EntityFrameworkCore var changeReport = ApplyAbpConcepts(); - var result = await base.SaveChangesAsync(acceptAllChangesOnSuccess, cancellationToken).ConfigureAwait(false); + var result = await base.SaveChangesAsync(acceptAllChangesOnSuccess, cancellationToken); - await EntityChangeEventHelper.TriggerEventsAsync(changeReport).ConfigureAwait(false); + await EntityChangeEventHelper.TriggerEventsAsync(changeReport); if (auditLog != null) { @@ -196,12 +200,26 @@ namespace Volo.Abp.EntityFrameworkCore protected virtual void ApplyAbpConceptsForDeletedEntity(EntityEntry entry, EntityChangeReport changeReport) { - CancelDeletionForSoftDelete(entry); - UpdateConcurrencyStamp(entry); - SetDeletionAuditProperties(entry); + if (TryCancelDeletionForSoftDelete(entry)) + { + UpdateConcurrencyStamp(entry); + SetDeletionAuditProperties(entry); + } + changeReport.ChangedEntities.Add(new EntityChangeEntry(entry.Entity, EntityChangeType.Deleted)); } + protected virtual bool IsHardDeleted(EntityEntry entry) + { + var hardDeletedEntities = UnitOfWorkManager?.Current?.Items.GetOrDefault(UnitOfWorkItemNames.HardDeletedEntities) as HashSet; + if (hardDeletedEntities == null) + { + return false; + } + + return hardDeletedEntities.Contains(entry.Entity); + } + protected virtual void AddDomainEvents(EntityChangeReport changeReport, object entityAsObj) { var generatesDomainEventsEntity = entityAsObj as IGeneratesDomainEvents; @@ -253,16 +271,22 @@ namespace Volo.Abp.EntityFrameworkCore entity.ConcurrencyStamp = Guid.NewGuid().ToString("N"); } - protected virtual void CancelDeletionForSoftDelete(EntityEntry entry) + protected virtual bool TryCancelDeletionForSoftDelete(EntityEntry entry) { if (!(entry.Entity is ISoftDelete)) { - return; + return false; + } + + if (IsHardDeleted(entry)) + { + return false; } entry.Reload(); entry.State = EntityState.Modified; entry.Entity.As().IsDeleted = true; + return true; } protected virtual void CheckAndSetId(EntityEntry entry) @@ -323,147 +347,9 @@ namespace Volo.Abp.EntityFrameworkCore return; } - ConfigureConcurrencyStampProperty(modelBuilder, mutableEntityType); - ConfigureExtraProperties(modelBuilder, mutableEntityType); - ConfigureAuditProperties(modelBuilder, mutableEntityType); - ConfigureTenantIdProperty(modelBuilder, mutableEntityType); - ConfigureGlobalFilters(modelBuilder, mutableEntityType); - } - - protected virtual void ConfigureConcurrencyStampProperty(ModelBuilder modelBuilder, IMutableEntityType mutableEntityType) - where TEntity : class - { - if (!typeof(IHasConcurrencyStamp).IsAssignableFrom(typeof(TEntity))) - { - return; - } - - modelBuilder.Entity(b => - { - b.Property(x => ((IHasConcurrencyStamp) x).ConcurrencyStamp) - .IsConcurrencyToken() - .HasColumnName(nameof(IHasConcurrencyStamp.ConcurrencyStamp)); - }); - } - - protected virtual void ConfigureExtraProperties(ModelBuilder modelBuilder, IMutableEntityType mutableEntityType) - where TEntity : class - { - if (!typeof(IHasExtraProperties).IsAssignableFrom(typeof(TEntity))) - { - return; - } - - modelBuilder.Entity(b => - { - b.Property(x => ((IHasExtraProperties) x).ExtraProperties) - .HasConversion( - d => JsonConvert.SerializeObject(d, Formatting.None), - s => JsonConvert.DeserializeObject>(s) - ) - .HasColumnName(nameof(IHasExtraProperties.ExtraProperties)); - }); - } - - protected virtual void ConfigureAuditProperties(ModelBuilder modelBuilder, IMutableEntityType mutableEntityType) - where TEntity : class - { - if (typeof(TEntity).IsAssignableTo()) - { - modelBuilder.Entity(b => - { - b.Property(x => ((IHasCreationTime)x).CreationTime) - .IsRequired() - .HasColumnName(nameof(IHasCreationTime.CreationTime)); - }); - } - - if (typeof(TEntity).IsAssignableTo()) - { - modelBuilder.Entity(b => - { - b.Property(x => ((IMayHaveCreator)x).CreatorId) - .IsRequired(false) - .HasColumnName(nameof(IMayHaveCreator.CreatorId)); - }); - } - - if (typeof(TEntity).IsAssignableTo()) - { - modelBuilder.Entity(b => - { - b.Property(x => ((IMustHaveCreator)x).CreatorId) - .IsRequired() - .HasColumnName(nameof(IMustHaveCreator.CreatorId)); - }); - } - - if (typeof(TEntity).IsAssignableTo()) - { - modelBuilder.Entity(b => - { - b.Property(x => ((IHasModificationTime)x).LastModificationTime) - .IsRequired(false) - .HasColumnName(nameof(IHasModificationTime.LastModificationTime)); - }); - } - - if (typeof(TEntity).IsAssignableTo()) - { - modelBuilder.Entity(b => - { - b.Property(x => ((IModificationAuditedObject)x).LastModifierId) - .IsRequired(false) - .HasColumnName(nameof(IModificationAuditedObject.LastModifierId)); - }); - } - - if (typeof(TEntity).IsAssignableTo()) - { - modelBuilder.Entity(b => - { - b.Property(x => ((ISoftDelete) x).IsDeleted) - .IsRequired() - .HasDefaultValue(false) - .HasColumnName(nameof(ISoftDelete.IsDeleted)); - }); - } - - if (typeof(TEntity).IsAssignableTo()) - { - modelBuilder.Entity(b => - { - b.Property(x => ((IHasDeletionTime)x).DeletionTime) - .IsRequired(false) - .HasColumnName(nameof(IHasDeletionTime.DeletionTime)); - }); - } - - if (typeof(TEntity).IsAssignableTo()) - { - modelBuilder.Entity(b => - { - b.Property(x => ((IDeletionAuditedObject)x).DeleterId) - .IsRequired(false) - .HasColumnName(nameof(IDeletionAuditedObject.DeleterId)); - }); - } - } - - protected virtual void ConfigureTenantIdProperty(ModelBuilder modelBuilder, IMutableEntityType mutableEntityType) - where TEntity : class - { - if (!typeof(TEntity).IsAssignableTo()) - { - return; - } + modelBuilder.Entity().ConfigureByConvention(); - modelBuilder.Entity(b => - { - b.Property(x => ((IMultiTenant)x).TenantId) - .IsRequired(false) - .HasColumnName(nameof(IMultiTenant.TenantId)); - }); + ConfigureGlobalFilters(modelBuilder, mutableEntityType); } protected virtual void ConfigureGlobalFilters(ModelBuilder modelBuilder, IMutableEntityType mutableEntityType) @@ -520,7 +406,7 @@ namespace Volo.Abp.EntityFrameworkCore return; } - var idPropertyBuilder = modelBuilder.Entity().Property(x => ((IEntity) x).Id); + var idPropertyBuilder = modelBuilder.Entity().Property(x => ((IEntity)x).Id); if (idPropertyBuilder.Metadata.PropertyInfo.IsDefined(typeof(DatabaseGeneratedAttribute), true)) { return; diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/EntityHistory/EntityHistoryHelper.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/EntityHistory/EntityHistoryHelper.cs index d28468f306..155e639bff 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/EntityHistory/EntityHistoryHelper.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/EntityHistory/EntityHistoryHelper.cs @@ -224,18 +224,18 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory return true; } - if (entityType.IsDefined(typeof(DisableAuditingAttribute), true)) + if (entityEntry.Metadata.GetProperties() + .Any(p => p.PropertyInfo?.IsDefined(typeof(AuditedAttribute)) ?? false)) { - return false; + return true; } - if (Options.EntityHistorySelectors.Any(selector => selector.Predicate(entityType))) + if (entityType.IsDefined(typeof(DisableAuditingAttribute), true)) { - return true; + return false; } - var properties = entityEntry.Metadata.GetProperties(); - if (properties.Any(p => p.PropertyInfo?.IsDefined(typeof(AuditedAttribute)) ?? false)) + if (Options.EntityHistorySelectors.Any(selector => selector.Predicate(entityType))) { return true; } @@ -265,8 +265,7 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory } } - var isModified = !(propertyEntry.OriginalValue?.Equals(propertyEntry.CurrentValue) ?? propertyEntry.CurrentValue == null); - if (isModified) + if (propertyEntry.IsModified) { return true; } diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/Modeling/AbpEntityTypeBuilderExtensions.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/Modeling/AbpEntityTypeBuilderExtensions.cs index 132e91c079..6db09d4d17 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/Modeling/AbpEntityTypeBuilderExtensions.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/Modeling/AbpEntityTypeBuilderExtensions.cs @@ -2,11 +2,11 @@ using System.Collections.Generic; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; -using Newtonsoft.Json; using Volo.Abp.Auditing; using Volo.Abp.Data; using Volo.Abp.Domain.Entities; -using Volo.Abp.Domain.Entities.Auditing; +using Volo.Abp.EntityFrameworkCore.ValueComparers; +using Volo.Abp.EntityFrameworkCore.ValueConverters; using Volo.Abp.MultiTenancy; namespace Volo.Abp.EntityFrameworkCore.Modeling @@ -57,11 +57,9 @@ namespace Volo.Abp.EntityFrameworkCore.Modeling if (b.Metadata.ClrType.IsAssignableTo()) { b.Property>(nameof(IHasExtraProperties.ExtraProperties)) - .HasConversion( - d => JsonConvert.SerializeObject(d, Formatting.None), - s => JsonConvert.DeserializeObject>(s) - ) - .HasColumnName(nameof(IHasExtraProperties.ExtraProperties)); + .HasColumnName(nameof(IHasExtraProperties.ExtraProperties)) + .HasConversion(new AbpJsonValueConverter>()) + .Metadata.SetValueComparer(new AbpDictionaryValueComparer()); } } diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/ValueComparers/AbpDictionaryValueComparer.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/ValueComparers/AbpDictionaryValueComparer.cs new file mode 100644 index 0000000000..c6959b0801 --- /dev/null +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/ValueComparers/AbpDictionaryValueComparer.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.EntityFrameworkCore.ChangeTracking; + +namespace Volo.Abp.EntityFrameworkCore.ValueComparers +{ + public class AbpDictionaryValueComparer : ValueComparer> + { + public AbpDictionaryValueComparer() + : base( + (d1, d2) => d1.SequenceEqual(d2), + d => d.Aggregate(0, (k, v) => HashCode.Combine(k, v.GetHashCode())), + d => d.ToDictionary(k => k.Key, v => v.Value)) + { + } + } +} diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/ValueConverters/AbpJsonValueConverter.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/ValueConverters/AbpJsonValueConverter.cs new file mode 100644 index 0000000000..e77b2842a8 --- /dev/null +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/ValueConverters/AbpJsonValueConverter.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Newtonsoft.Json; + +namespace Volo.Abp.EntityFrameworkCore.ValueConverters +{ + public class AbpJsonValueConverter : ValueConverter + { + public AbpJsonValueConverter() + : base( + d => JsonConvert.SerializeObject(d, Formatting.None), + s => JsonConvert.DeserializeObject(s)) + { + } + } +} diff --git a/framework/src/Volo.Abp.EventBus.RabbitMQ/FodyWeavers.xml b/framework/src/Volo.Abp.EventBus.RabbitMQ/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.EventBus.RabbitMQ/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.EventBus.RabbitMQ/FodyWeavers.xsd b/framework/src/Volo.Abp.EventBus.RabbitMQ/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.EventBus.RabbitMQ/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo.Abp.EventBus.RabbitMQ.csproj b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo.Abp.EventBus.RabbitMQ.csproj index c9bab15898..40787f3fb2 100644 --- a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo.Abp.EventBus.RabbitMQ.csproj +++ b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo.Abp.EventBus.RabbitMQ.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs index 9df352837a..c530437e6f 100644 --- a/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs +++ b/framework/src/Volo.Abp.EventBus.RabbitMQ/Volo/Abp/EventBus/RabbitMq/RabbitMqDistributedEventBus.cs @@ -85,7 +85,7 @@ namespace Volo.Abp.EventBus.RabbitMq var eventData = Serializer.Deserialize(ea.Body, eventType); - await TriggerHandlersAsync(eventType, eventData).ConfigureAwait(false); + await TriggerHandlersAsync(eventType, eventData); } public IDisposable Subscribe(IDistributedEventHandler handler) where TEvent : class diff --git a/framework/src/Volo.Abp.EventBus/FodyWeavers.xml b/framework/src/Volo.Abp.EventBus/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.EventBus/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.EventBus/FodyWeavers.xsd b/framework/src/Volo.Abp.EventBus/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.EventBus/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.EventBus/Volo.Abp.EventBus.csproj b/framework/src/Volo.Abp.EventBus/Volo.Abp.EventBus.csproj index ccce953cce..566767e111 100644 --- a/framework/src/Volo.Abp.EventBus/Volo.Abp.EventBus.csproj +++ b/framework/src/Volo.Abp.EventBus/Volo.Abp.EventBus.csproj @@ -1,5 +1,6 @@ + diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/ActionEventHandler.cs b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/ActionEventHandler.cs index 3594ce3c96..a8763edd89 100644 --- a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/ActionEventHandler.cs +++ b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/ActionEventHandler.cs @@ -32,7 +32,7 @@ namespace Volo.Abp.EventBus /// public async Task HandleEventAsync(TEvent eventData) { - await Action(eventData).ConfigureAwait(false); + await Action(eventData); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/EventBusBase.cs b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/EventBusBase.cs index b77ed00945..a7883950d1 100644 --- a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/EventBusBase.cs +++ b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/EventBusBase.cs @@ -89,7 +89,7 @@ namespace Volo.Abp.EventBus { var exceptions = new List(); - await TriggerHandlersAsync(eventType, eventData, exceptions).ConfigureAwait(false); + await TriggerHandlersAsync(eventType, eventData, exceptions); if (exceptions.Any()) { @@ -110,7 +110,7 @@ namespace Volo.Abp.EventBus { foreach (var handlerFactory in handlerFactories.EventHandlerFactories) { - await TriggerHandlerAsync(handlerFactory, handlerFactories.EventType, eventData, exceptions).ConfigureAwait(false); + await TriggerHandlerAsync(handlerFactory, handlerFactories.EventType, eventData, exceptions); } } @@ -126,7 +126,7 @@ namespace Volo.Abp.EventBus var baseEventType = eventType.GetGenericTypeDefinition().MakeGenericType(baseArg); var constructorArgs = ((IEventDataWithInheritableGenericArgument)eventData).GetConstructorArgs(); var baseEventData = Activator.CreateInstance(baseEventType, constructorArgs); - await PublishAsync(baseEventType, baseEventData).ConfigureAwait(false); + await PublishAsync(baseEventType, baseEventData); } } } @@ -171,7 +171,7 @@ namespace Volo.Abp.EventBus new[] { eventType } ); - await ((Task)method.Invoke(eventHandlerWrapper.EventHandler, new[] { eventData })).ConfigureAwait(false); + await ((Task)method.Invoke(eventHandlerWrapper.EventHandler, new[] { eventData })); } else if (ReflectionHelper.IsAssignableToGenericType(handlerType, typeof(IDistributedEventHandler<>))) { @@ -182,7 +182,7 @@ namespace Volo.Abp.EventBus new[] { eventType } ); - await ((Task)method.Invoke(eventHandlerWrapper.EventHandler, new[] { eventData })).ConfigureAwait(false); + await ((Task)method.Invoke(eventHandlerWrapper.EventHandler, new[] { eventData })); } else { diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/ILocalEventHandler.cs b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/ILocalEventHandler.cs index e3501294be..006097825c 100644 --- a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/ILocalEventHandler.cs +++ b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/ILocalEventHandler.cs @@ -2,6 +2,7 @@ using System.Threading.Tasks; namespace Volo.Abp.EventBus { + //TODO: Move to the right namespace in v3.0 public interface ILocalEventHandler : IEventHandler { /// diff --git a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/LocalEventBus.cs b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/LocalEventBus.cs index 117eeeb06f..7db5c18f01 100644 --- a/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/LocalEventBus.cs +++ b/framework/src/Volo.Abp.EventBus/Volo/Abp/EventBus/Local/LocalEventBus.cs @@ -119,7 +119,7 @@ namespace Volo.Abp.EventBus.Local { var exceptions = new List(); - await TriggerHandlersAsync(eventType, eventData, exceptions).ConfigureAwait(false); + await TriggerHandlersAsync(eventType, eventData, exceptions); if (exceptions.Any()) { diff --git a/framework/src/Volo.Abp.Features/FodyWeavers.xml b/framework/src/Volo.Abp.Features/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Features/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Features/FodyWeavers.xsd b/framework/src/Volo.Abp.Features/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Features/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Features/Volo.Abp.Features.csproj b/framework/src/Volo.Abp.Features/Volo.Abp.Features.csproj index 269f447fdf..a2d098f970 100644 --- a/framework/src/Volo.Abp.Features/Volo.Abp.Features.csproj +++ b/framework/src/Volo.Abp.Features/Volo.Abp.Features.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/EditionFeatureValueProvider.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/EditionFeatureValueProvider.cs index 75c9c7ae5f..49ea1b3f4c 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/EditionFeatureValueProvider.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/EditionFeatureValueProvider.cs @@ -26,7 +26,7 @@ namespace Volo.Abp.Features return null; } - return await FeatureStore.GetOrNullAsync(feature.Name, Name, editionId.Value.ToString()).ConfigureAwait(false); + return await FeatureStore.GetOrNullAsync(feature.Name, Name, editionId.Value.ToString()); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureChecker.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureChecker.cs index 0c90ea7573..0c653c3448 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureChecker.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureChecker.cs @@ -46,7 +46,7 @@ namespace Volo.Abp.Features providers = providers.Where(p => featureDefinition.AllowedProviders.Contains(p.Name)); } - return await GetOrNullValueFromProvidersAsync(providers, featureDefinition).ConfigureAwait(false); + return await GetOrNullValueFromProvidersAsync(providers, featureDefinition); } protected virtual async Task GetOrNullValueFromProvidersAsync( @@ -55,7 +55,7 @@ namespace Volo.Abp.Features { foreach (var provider in providers) { - var value = await provider.GetOrNullAsync(feature).ConfigureAwait(false); + var value = await provider.GetOrNullAsync(feature); if (value != null) { return value; diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerBase.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerBase.cs index 23c5c37431..a24e0901f7 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerBase.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerBase.cs @@ -10,7 +10,7 @@ namespace Volo.Abp.Features public virtual async Task IsEnabledAsync(string name) { - var value = await GetOrNullAsync(name).ConfigureAwait(false); + var value = await GetOrNullAsync(name); if (value == null) { return false; diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerExtensions.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerExtensions.cs index d26f7be841..8850408df0 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerExtensions.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureCheckerExtensions.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.Features Check.NotNull(featureChecker, nameof(featureChecker)); Check.NotNull(name, nameof(name)); - var value = await featureChecker.GetOrNullAsync(name).ConfigureAwait(false); + var value = await featureChecker.GetOrNullAsync(name); return value?.To() ?? defaultValue; } @@ -32,7 +32,7 @@ namespace Volo.Abp.Features { foreach (var featureName in featureNames) { - if (!(await featureChecker.IsEnabledAsync(featureName).ConfigureAwait(false))) + if (!(await featureChecker.IsEnabledAsync(featureName))) { return false; } @@ -43,7 +43,7 @@ namespace Volo.Abp.Features foreach (var featureName in featureNames) { - if (await featureChecker.IsEnabledAsync(featureName).ConfigureAwait(false)) + if (await featureChecker.IsEnabledAsync(featureName)) { return true; } @@ -54,7 +54,7 @@ namespace Volo.Abp.Features public static async Task CheckEnabledAsync(this IFeatureChecker featureChecker, string featureName) { - if (!(await featureChecker.IsEnabledAsync(featureName).ConfigureAwait(false))) + if (!(await featureChecker.IsEnabledAsync(featureName))) { throw new AbpAuthorizationException("Feature is not enabled: " + featureName); } @@ -71,7 +71,7 @@ namespace Volo.Abp.Features { foreach (var featureName in featureNames) { - if (!(await featureChecker.IsEnabledAsync(featureName).ConfigureAwait(false))) + if (!(await featureChecker.IsEnabledAsync(featureName))) { throw new AbpAuthorizationException( "Required features are not enabled. All of these features must be enabled: " + @@ -84,7 +84,7 @@ namespace Volo.Abp.Features { foreach (var featureName in featureNames) { - if (await featureChecker.IsEnabledAsync(featureName).ConfigureAwait(false)) + if (await featureChecker.IsEnabledAsync(featureName)) { return; } diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureInterceptor.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureInterceptor.cs index 9f3d5dc356..9986af6275 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureInterceptor.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/FeatureInterceptor.cs @@ -19,12 +19,12 @@ namespace Volo.Abp.Features { if (AbpCrossCuttingConcerns.IsApplied(invocation.TargetObject, AbpCrossCuttingConcerns.FeatureChecking)) { - await invocation.ProceedAsync().ConfigureAwait(false); + await invocation.ProceedAsync(); return; } - await CheckFeaturesAsync(invocation).ConfigureAwait(false); - await invocation.ProceedAsync().ConfigureAwait(false); + await CheckFeaturesAsync(invocation); + await invocation.ProceedAsync(); } protected virtual async Task CheckFeaturesAsync(IAbpMethodInvocation invocation) @@ -33,7 +33,7 @@ namespace Volo.Abp.Features new MethodInvocationFeatureCheckerContext( invocation.Method ) - ).ConfigureAwait(false); + ); } } } diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/MethodInvocationFeatureCheckerService.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/MethodInvocationFeatureCheckerService.cs index bff6405d57..da7becc61f 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/MethodInvocationFeatureCheckerService.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/MethodInvocationFeatureCheckerService.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.Features foreach (var requiresFeatureAttribute in GetRequiredFeatureAttributes(context.Method)) { - await _featureChecker.CheckEnabledAsync(requiresFeatureAttribute.RequiresAll, requiresFeatureAttribute.Features).ConfigureAwait(false); + await _featureChecker.CheckEnabledAsync(requiresFeatureAttribute.RequiresAll, requiresFeatureAttribute.Features); } } diff --git a/framework/src/Volo.Abp.Features/Volo/Abp/Features/TenantFeatureValueProvider.cs b/framework/src/Volo.Abp.Features/Volo/Abp/Features/TenantFeatureValueProvider.cs index 71cdfe3f59..5ae4b5f876 100644 --- a/framework/src/Volo.Abp.Features/Volo/Abp/Features/TenantFeatureValueProvider.cs +++ b/framework/src/Volo.Abp.Features/Volo/Abp/Features/TenantFeatureValueProvider.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.Features public override async Task GetOrNullAsync(FeatureDefinition feature) { - return await FeatureStore.GetOrNullAsync(feature.Name, Name, CurrentTenant.Id?.ToString()).ConfigureAwait(false); + return await FeatureStore.GetOrNullAsync(feature.Name, Name, CurrentTenant.Id?.ToString()); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.FluentValidation/FodyWeavers.xml b/framework/src/Volo.Abp.FluentValidation/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.FluentValidation/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.FluentValidation/FodyWeavers.xsd b/framework/src/Volo.Abp.FluentValidation/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.FluentValidation/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.FluentValidation/Volo.Abp.FluentValidation.csproj b/framework/src/Volo.Abp.FluentValidation/Volo.Abp.FluentValidation.csproj index 5510af3e25..52cee1ade7 100644 --- a/framework/src/Volo.Abp.FluentValidation/Volo.Abp.FluentValidation.csproj +++ b/framework/src/Volo.Abp.FluentValidation/Volo.Abp.FluentValidation.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.Guids/FodyWeavers.xml b/framework/src/Volo.Abp.Guids/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Guids/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Guids/FodyWeavers.xsd b/framework/src/Volo.Abp.Guids/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Guids/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Guids/Volo.Abp.Guids.csproj b/framework/src/Volo.Abp.Guids/Volo.Abp.Guids.csproj index 86f8e3243f..6c8c4c4916 100644 --- a/framework/src/Volo.Abp.Guids/Volo.Abp.Guids.csproj +++ b/framework/src/Volo.Abp.Guids/Volo.Abp.Guids.csproj @@ -1,5 +1,6 @@ + @@ -17,4 +18,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.HangFire/FodyWeavers.xml b/framework/src/Volo.Abp.HangFire/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.HangFire/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.HangFire/FodyWeavers.xsd b/framework/src/Volo.Abp.HangFire/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.HangFire/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.HangFire/Volo.Abp.HangFire.csproj b/framework/src/Volo.Abp.HangFire/Volo.Abp.HangFire.csproj index c87b39d494..eb6172b111 100644 --- a/framework/src/Volo.Abp.HangFire/Volo.Abp.HangFire.csproj +++ b/framework/src/Volo.Abp.HangFire/Volo.Abp.HangFire.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.Http.Abstractions/FodyWeavers.xml b/framework/src/Volo.Abp.Http.Abstractions/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Http.Abstractions/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Http.Abstractions/FodyWeavers.xsd b/framework/src/Volo.Abp.Http.Abstractions/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Http.Abstractions/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Http.Abstractions/Volo.Abp.Http.Abstractions.csproj b/framework/src/Volo.Abp.Http.Abstractions/Volo.Abp.Http.Abstractions.csproj index 5c5ec94603..59de087fc4 100644 --- a/framework/src/Volo.Abp.Http.Abstractions/Volo.Abp.Http.Abstractions.csproj +++ b/framework/src/Volo.Abp.Http.Abstractions/Volo.Abp.Http.Abstractions.csproj @@ -1,5 +1,6 @@ + @@ -17,4 +18,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel/FodyWeavers.xml b/framework/src/Volo.Abp.Http.Client.IdentityModel/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel/FodyWeavers.xsd b/framework/src/Volo.Abp.Http.Client.IdentityModel/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo.Abp.Http.Client.IdentityModel.csproj b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo.Abp.Http.Client.IdentityModel.csproj index 84413c7764..e62293964a 100644 --- a/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo.Abp.Http.Client.IdentityModel.csproj +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo.Abp.Http.Client.IdentityModel.csproj @@ -1,5 +1,6 @@ - + + @@ -20,4 +21,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/IdentityModel/IdentityModelRemoteServiceHttpClientAuthenticator.cs b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/IdentityModel/IdentityModelRemoteServiceHttpClientAuthenticator.cs index efc61907dc..25763efbd5 100644 --- a/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/IdentityModel/IdentityModelRemoteServiceHttpClientAuthenticator.cs +++ b/framework/src/Volo.Abp.Http.Client.IdentityModel/Volo/Abp/Http/Client/IdentityModel/IdentityModelRemoteServiceHttpClientAuthenticator.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.Http.Client.IdentityModel { if (context.RemoteService.GetUseCurrentAccessToken() != false) { - var accessToken = await GetAccessTokenFromHttpContextOrNullAsync().ConfigureAwait(false); + var accessToken = await GetAccessTokenFromHttpContextOrNullAsync(); if (accessToken != null) { context.Request.SetBearerToken(accessToken); @@ -36,7 +36,7 @@ namespace Volo.Abp.Http.Client.IdentityModel await IdentityModelAuthenticationService.TryAuthenticateAsync( context.Client, context.RemoteService.GetIdentityClient() - ).ConfigureAwait(false); + ); } protected virtual async Task GetAccessTokenFromHttpContextOrNullAsync() @@ -47,7 +47,7 @@ namespace Volo.Abp.Http.Client.IdentityModel return null; } - return await httpContext.GetTokenAsync("access_token").ConfigureAwait(false); + return await httpContext.GetTokenAsync("access_token"); } } } diff --git a/framework/src/Volo.Abp.Http.Client/FodyWeavers.xml b/framework/src/Volo.Abp.Http.Client/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Http.Client/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Http.Client/FodyWeavers.xsd b/framework/src/Volo.Abp.Http.Client/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Http.Client/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Http.Client/Microsoft/Extensions/DependencyInjection/ServiceCollectionDynamicHttpClientProxyExtensions.cs b/framework/src/Volo.Abp.Http.Client/Microsoft/Extensions/DependencyInjection/ServiceCollectionDynamicHttpClientProxyExtensions.cs index f34a732cb0..e3fd273026 100644 --- a/framework/src/Volo.Abp.Http.Client/Microsoft/Extensions/DependencyInjection/ServiceCollectionDynamicHttpClientProxyExtensions.cs +++ b/framework/src/Volo.Abp.Http.Client/Microsoft/Extensions/DependencyInjection/ServiceCollectionDynamicHttpClientProxyExtensions.cs @@ -8,6 +8,7 @@ using Volo.Abp; using Volo.Abp.Castle.DynamicProxy; using Volo.Abp.Http.Client; using Volo.Abp.Http.Client.DynamicProxying; +using Volo.Abp.Validation; namespace Microsoft.Extensions.DependencyInjection { @@ -154,6 +155,9 @@ namespace Microsoft.Extensions.DependencyInjection services.AddTransient(interceptorType); var interceptorAdapterType = typeof(AbpAsyncDeterminationInterceptor<>).MakeGenericType(interceptorType); + + var validationInterceptorAdapterType = + typeof(AbpAsyncDeterminationInterceptor<>).MakeGenericType(typeof(ValidationInterceptor)); if (asDefaultService) { @@ -162,6 +166,7 @@ namespace Microsoft.Extensions.DependencyInjection serviceProvider => ProxyGeneratorInstance .CreateInterfaceProxyWithoutTarget( type, + (IInterceptor)serviceProvider.GetRequiredService(validationInterceptorAdapterType), (IInterceptor)serviceProvider.GetRequiredService(interceptorAdapterType) ) ); @@ -174,6 +179,7 @@ namespace Microsoft.Extensions.DependencyInjection var service = ProxyGeneratorInstance .CreateInterfaceProxyWithoutTarget( type, + (IInterceptor)serviceProvider.GetRequiredService(validationInterceptorAdapterType), (IInterceptor)serviceProvider.GetRequiredService(interceptorAdapterType) ); diff --git a/framework/src/Volo.Abp.Http.Client/Volo.Abp.Http.Client.csproj b/framework/src/Volo.Abp.Http.Client/Volo.Abp.Http.Client.csproj index 8a5172db8b..461a0c35f5 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo.Abp.Http.Client.csproj +++ b/framework/src/Volo.Abp.Http.Client/Volo.Abp.Http.Client.csproj @@ -1,5 +1,6 @@ - + + @@ -24,6 +25,7 @@ + - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/AbpHttpClientModule.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/AbpHttpClientModule.cs index f2a7540956..e98c0738fd 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/AbpHttpClientModule.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/AbpHttpClientModule.cs @@ -3,6 +3,7 @@ using Volo.Abp.Castle; using Volo.Abp.Modularity; using Volo.Abp.MultiTenancy; using Volo.Abp.Threading; +using Volo.Abp.Validation; namespace Volo.Abp.Http.Client { @@ -10,7 +11,8 @@ namespace Volo.Abp.Http.Client typeof(AbpHttpModule), typeof(AbpCastleCoreModule), typeof(AbpThreadingModule), - typeof(AbpMultiTenancyModule) + typeof(AbpMultiTenancyModule), + typeof(AbpValidationModule) )] public class AbpHttpClientModule : AbpModule { diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionCache.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionCache.cs index b9932124be..9d1ea2dbbe 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionCache.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionCache.cs @@ -27,12 +27,12 @@ namespace Volo.Abp.Http.Client.DynamicProxying string baseUrl, Func> factory) { - using (await _semaphore.LockAsync(CancellationTokenProvider.Token).ConfigureAwait(false)) + using (await _semaphore.LockAsync(CancellationTokenProvider.Token)) { var model = _cache.GetOrDefault(baseUrl); if (model == null) { - _cache[baseUrl] = model = await factory().ConfigureAwait(false); + _cache[baseUrl] = model = await factory(); } return model; diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs index eb57641c28..9b9c8e804c 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/ApiDescriptionFinder.cs @@ -34,7 +34,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying public async Task FindActionAsync(string baseUrl, Type serviceType, MethodInfo method) { - var apiDescription = await GetApiDescriptionAsync(baseUrl).ConfigureAwait(false); + var apiDescription = await GetApiDescriptionAsync(baseUrl); //TODO: Cache finding? @@ -78,7 +78,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying public virtual async Task GetApiDescriptionAsync(string baseUrl) { - return await Cache.GetAsync(baseUrl, () => GetApiDescriptionFromServerAsync(baseUrl)).ConfigureAwait(false); + return await Cache.GetAsync(baseUrl, () => GetApiDescriptionFromServerAsync(baseUrl)); } protected virtual async Task GetApiDescriptionFromServerAsync(string baseUrl) @@ -88,14 +88,14 @@ namespace Volo.Abp.Http.Client.DynamicProxying var response = await client.GetAsync( baseUrl.EnsureEndsWith('/') + "api/abp/api-definition", CancellationTokenProvider.Token - ).ConfigureAwait(false); + ); if (!response.IsSuccessStatusCode) { throw new AbpException("Remote service returns error! StatusCode = " + response.StatusCode); } - var content = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + var content = await response.Content.ReadAsStringAsync(); var result = JsonConvert.DeserializeObject( content, diff --git a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs index d60b79b3a5..3e0124237f 100644 --- a/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs +++ b/framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/DynamicProxying/DynamicHttpProxyInterceptor.cs @@ -78,7 +78,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying { if (invocation.Method.ReturnType.GenericTypeArguments.IsNullOrEmpty()) { - await MakeRequestAsync(invocation).ConfigureAwait(false); + await MakeRequestAsync(invocation); } else { @@ -89,14 +89,14 @@ namespace Volo.Abp.Http.Client.DynamicProxying invocation.ReturnValue = await GetResultAsync( result, invocation.Method.ReturnType.GetGenericArguments()[0] - ).ConfigureAwait(false); + ); } } private async Task GetResultAsync(Task task, Type resultType) { - await task.ConfigureAwait(false); + await task; return typeof(Task<>) .MakeGenericType(resultType) .GetProperty(nameof(Task.Result), BindingFlags.Instance | BindingFlags.Public) @@ -105,7 +105,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying private async Task MakeRequestAndGetResultAsync(IAbpMethodInvocation invocation) { - var responseAsString = await MakeRequestAsync(invocation).ConfigureAwait(false); + var responseAsString = await MakeRequestAsync(invocation); //TODO: Think on that if (TypeHelper.IsPrimitiveExtended(typeof(T), true)) @@ -123,7 +123,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying var client = HttpClientFactory.Create(clientConfig.RemoteServiceName); - var action = await ApiDescriptionFinder.FindActionAsync(remoteServiceConfig.BaseUrl, typeof(TService), invocation.Method).ConfigureAwait(false); + var action = await ApiDescriptionFinder.FindActionAsync(remoteServiceConfig.BaseUrl, typeof(TService), invocation.Method); var apiVersion = GetApiVersionInfo(action); var url = remoteServiceConfig.BaseUrl.EnsureEndsWith('/') + UrlBuilder.GenerateUrlWithParameters(action, invocation.ArgumentsDictionary, apiVersion); @@ -141,16 +141,16 @@ namespace Volo.Abp.Http.Client.DynamicProxying remoteServiceConfig, clientConfig.RemoteServiceName ) - ).ConfigureAwait(false); + ); - var response = await client.SendAsync(requestMessage, GetCancellationToken()).ConfigureAwait(false); + var response = await client.SendAsync(requestMessage, GetCancellationToken()); if (!response.IsSuccessStatusCode) { - await ThrowExceptionForResponseAsync(response).ConfigureAwait(false); + await ThrowExceptionForResponseAsync(response); } - return await response.Content.ReadAsStringAsync().ConfigureAwait(false); + return await response.Content.ReadAsStringAsync(); } private ApiVersionInfo GetApiVersionInfo(ActionApiDescriptionModel action) @@ -240,7 +240,7 @@ namespace Volo.Abp.Http.Client.DynamicProxying { var errorResponse = JsonSerializer.Deserialize( await response.Content.ReadAsStringAsync() -.ConfigureAwait(false)); + ); throw new AbpRemoteCallException(errorResponse.Error); } diff --git a/framework/src/Volo.Abp.Http/FodyWeavers.xml b/framework/src/Volo.Abp.Http/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Http/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Http/FodyWeavers.xsd b/framework/src/Volo.Abp.Http/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Http/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Http/Volo.Abp.Http.csproj b/framework/src/Volo.Abp.Http/Volo.Abp.Http.csproj index 57f447604e..d707299f21 100644 --- a/framework/src/Volo.Abp.Http/Volo.Abp.Http.csproj +++ b/framework/src/Volo.Abp.Http/Volo.Abp.Http.csproj @@ -1,5 +1,6 @@ + @@ -19,4 +20,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs index d1de33258f..257f06d3db 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ParameterApiDescriptionModel.cs @@ -1,4 +1,4 @@ -using System; +using System; namespace Volo.Abp.Http.Modeling { @@ -19,12 +19,14 @@ namespace Volo.Abp.Http.Modeling public string BindingSourceId { get; set; } + public string DescriptorName { get; set; } + private ParameterApiDescriptionModel() { } - public static ParameterApiDescriptionModel Create(string name, string nameOnMethod, Type type, bool isOptional = false, object defaultValue = null, string[] constraintTypes = null, string bindingSourceId = null) + public static ParameterApiDescriptionModel Create(string name, string nameOnMethod, Type type, bool isOptional = false, object defaultValue = null, string[] constraintTypes = null, string bindingSourceId = null, string descriptorName = null) { return new ParameterApiDescriptionModel { @@ -34,7 +36,8 @@ namespace Volo.Abp.Http.Modeling IsOptional = isOptional, DefaultValue = defaultValue, ConstraintTypes = constraintTypes, - BindingSourceId = bindingSourceId + BindingSourceId = bindingSourceId, + DescriptorName = descriptorName }; } } diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs index 169e9b8764..b267c26296 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/JQuery/JQueryProxyScriptGenerator.cs @@ -96,7 +96,11 @@ namespace Volo.Abp.Http.ProxyScripting.Generators.JQuery AddAjaxCallParameters(script, action); - script.AppendLine(" }, ajaxParams));;"); + var ajaxParamsIsFromForm = action.Parameters.Any(x => x.BindingSourceId == ParameterBindingSources.Form); + script.AppendLine(ajaxParamsIsFromForm + ? " }, $.extend(true, {}, ajaxParams, { contentType: 'application/x-www-form-urlencoded; charset=UTF-8' })));" + : " }, ajaxParams));"); + script.AppendLine(" };"); } diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/ProxyScriptingHelper.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/ProxyScriptingHelper.cs index 64d1515574..700dc4e290 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/ProxyScriptingHelper.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/ProxyScriptingHelper.cs @@ -66,7 +66,7 @@ namespace Volo.Abp.Http.ProxyScripting.Generators return null; } - return ProxyScriptingJsFuncHelper.CreateJsObjectLiteral(parameters, indent); + return ProxyScriptingJsFuncHelper.CreateJsFormPostData(parameters, indent); } private static string ReplacePathVariables(string url, IList actionParameters) diff --git a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/ProxyScriptingJsFuncHelper.cs b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/ProxyScriptingJsFuncHelper.cs index baa52f3155..0fd80203df 100644 --- a/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/ProxyScriptingJsFuncHelper.cs +++ b/framework/src/Volo.Abp.Http/Volo/Abp/Http/ProxyScripting/Generators/ProxyScriptingJsFuncHelper.cs @@ -111,8 +111,8 @@ namespace Volo.Abp.Http.ProxyScripting.Generators public static string GetParamNameInJsFunc(ParameterApiDescriptionModel parameterInfo) { return parameterInfo.Name == parameterInfo.NameOnMethod - ? NormalizeJsVariableName(parameterInfo.Name.ToCamelCase(), ".") - : NormalizeJsVariableName(parameterInfo.NameOnMethod.ToCamelCase()) + "." + NormalizeJsVariableName(parameterInfo.Name.ToCamelCase(), "."); + ? NormalizeJsVariableName(parameterInfo.Name.ToCamelCase(), ".") + : NormalizeJsVariableName(parameterInfo.NameOnMethod.ToCamelCase()) + "." + NormalizeJsVariableName(parameterInfo.Name.ToCamelCase(), "."); } public static string CreateJsObjectLiteral(ParameterApiDescriptionModel[] parameters, int indent = 0) @@ -131,9 +131,37 @@ namespace Volo.Abp.Http.ProxyScripting.Generators return sb.ToString(); } + public static string GetFormPostParamNameInJsFunc(ParameterApiDescriptionModel parameterInfo) + { + return parameterInfo.Name == parameterInfo.NameOnMethod + ? NormalizeJsVariableName((parameterInfo.DescriptorName + parameterInfo.Name).ToCamelCase(), ".") + : NormalizeJsVariableName(parameterInfo.NameOnMethod.ToCamelCase()) + "." + NormalizeJsVariableName((parameterInfo.DescriptorName + parameterInfo.Name).ToCamelCase(), "."); + } + + public static string CreateJsFormPostData(ParameterApiDescriptionModel[] parameters, int indent) + { + var sb = new StringBuilder(); + + for (var i = 0; i < parameters.Length; i++) + { + var and = i < parameters.Length - 1 ? " + '&' + " : string.Empty; + + var parameterName = parameters[i].DescriptorName.IsNullOrWhiteSpace() + ? parameters[i].Name + : $"{parameters[i].DescriptorName}.{parameters[i].Name}"; + + sb.Append($"'{parameterName}=' + {GetFormPostParamNameInJsFunc(parameters[i])}{and}"); + } + + return sb.ToString(); + } + public static string GenerateJsFuncParameterList(ActionApiDescriptionModel action, string ajaxParametersName) { - var methodParamNames = action.ParametersOnMethod.Select(p => p.Name).Distinct().ToList(); + var paramsIsFromForm = action.Parameters.Any(x => x.BindingSourceId == ParameterBindingSources.Form); + var methodParamNames = paramsIsFromForm + ? action.Parameters.Select(p => p.DescriptorName + p.Name).Distinct().ToList() + : action.ParametersOnMethod.Select(p => p.Name).Distinct().ToList(); methodParamNames.Add(ajaxParametersName); return methodParamNames.Select(prmName => NormalizeJsVariableName(prmName.ToCamelCase())).JoinAsString(", "); } diff --git a/framework/src/Volo.Abp.IdentityModel/FodyWeavers.xml b/framework/src/Volo.Abp.IdentityModel/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.IdentityModel/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.IdentityModel/FodyWeavers.xsd b/framework/src/Volo.Abp.IdentityModel/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.IdentityModel/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj b/framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj index 886e092fdd..3e4ae78b91 100644 --- a/framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj +++ b/framework/src/Volo.Abp.IdentityModel/Volo.Abp.IdentityModel.csproj @@ -1,5 +1,6 @@ - + + @@ -18,4 +19,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs index 488745836e..ca6e41d60d 100644 --- a/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs +++ b/framework/src/Volo.Abp.IdentityModel/Volo/Abp/IdentityModel/IdentityModelAuthenticationService.cs @@ -35,7 +35,7 @@ namespace Volo.Abp.IdentityModel [NotNull] HttpClient client, string identityClientName = null) { - var accessToken = await GetAccessTokenOrNullAsync(identityClientName).ConfigureAwait(false); + var accessToken = await GetAccessTokenOrNullAsync(identityClientName); if (accessToken == null) { return false; @@ -55,18 +55,18 @@ namespace Volo.Abp.IdentityModel return null; } - return await GetAccessTokenAsync(configuration).ConfigureAwait(false); + return await GetAccessTokenAsync(configuration); } public virtual async Task GetAccessTokenAsync(IdentityClientConfiguration configuration) { - var discoveryResponse = await GetDiscoveryResponse(configuration).ConfigureAwait(false); + var discoveryResponse = await GetDiscoveryResponse(configuration); if (discoveryResponse.IsError) { throw new AbpException($"Could not retrieve the OpenId Connect discovery document! ErrorType: {discoveryResponse.ErrorType}. Error: {discoveryResponse.Error}"); } - var tokenResponse = await GetTokenResponse(discoveryResponse, configuration).ConfigureAwait(false); + var tokenResponse = await GetTokenResponse(discoveryResponse, configuration); if (tokenResponse.IsError) { throw new AbpException($"Could not get token from the OpenId Connect server! ErrorType: {tokenResponse.ErrorType}. Error: {tokenResponse.Error}. ErrorDescription: {tokenResponse.ErrorDescription}. HttpStatusCode: {tokenResponse.HttpStatusCode}"); @@ -104,7 +104,7 @@ namespace Volo.Abp.IdentityModel { RequireHttps = configuration.RequireHttps } - }).ConfigureAwait(false); + }); } } @@ -118,14 +118,14 @@ namespace Volo.Abp.IdentityModel { case OidcConstants.GrantTypes.ClientCredentials: return await httpClient.RequestClientCredentialsTokenAsync( - await CreateClientCredentialsTokenRequestAsync(discoveryResponse, configuration).ConfigureAwait(false), + await CreateClientCredentialsTokenRequestAsync(discoveryResponse, configuration), CancellationTokenProvider.Token - ).ConfigureAwait(false); + ); case OidcConstants.GrantTypes.Password: return await httpClient.RequestPasswordTokenAsync( - await CreatePasswordTokenRequestAsync(discoveryResponse, configuration).ConfigureAwait(false), + await CreatePasswordTokenRequestAsync(discoveryResponse, configuration), CancellationTokenProvider.Token - ).ConfigureAwait(false); + ); default: throw new AbpException("Grant type was not implemented: " + configuration.GrantType); } diff --git a/framework/src/Volo.Abp.Json/FodyWeavers.xml b/framework/src/Volo.Abp.Json/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Json/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Json/FodyWeavers.xsd b/framework/src/Volo.Abp.Json/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Json/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Json/Volo.Abp.Json.csproj b/framework/src/Volo.Abp.Json/Volo.Abp.Json.csproj index d5407991c1..8af6ecc68f 100644 --- a/framework/src/Volo.Abp.Json/Volo.Abp.Json.csproj +++ b/framework/src/Volo.Abp.Json/Volo.Abp.Json.csproj @@ -1,5 +1,6 @@ - + + @@ -21,4 +22,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.Ldap/FodyWeavers.xml b/framework/src/Volo.Abp.Ldap/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Ldap/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Ldap/FodyWeavers.xsd b/framework/src/Volo.Abp.Ldap/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Ldap/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Ldap/Volo.Abp.Ldap.csproj b/framework/src/Volo.Abp.Ldap/Volo.Abp.Ldap.csproj index 6b1cba1094..229f3c6c7d 100644 --- a/framework/src/Volo.Abp.Ldap/Volo.Abp.Ldap.csproj +++ b/framework/src/Volo.Abp.Ldap/Volo.Abp.Ldap.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.Localization.Abstractions/FodyWeavers.xml b/framework/src/Volo.Abp.Localization.Abstractions/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Localization.Abstractions/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Localization.Abstractions/FodyWeavers.xsd b/framework/src/Volo.Abp.Localization.Abstractions/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Localization.Abstractions/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Localization.Abstractions/Volo.Abp.Localization.Abstractions.csproj b/framework/src/Volo.Abp.Localization.Abstractions/Volo.Abp.Localization.Abstractions.csproj index b4df348774..b883ae7011 100644 --- a/framework/src/Volo.Abp.Localization.Abstractions/Volo.Abp.Localization.Abstractions.csproj +++ b/framework/src/Volo.Abp.Localization.Abstractions/Volo.Abp.Localization.Abstractions.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.Localization/FodyWeavers.xml b/framework/src/Volo.Abp.Localization/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Localization/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Localization/FodyWeavers.xsd b/framework/src/Volo.Abp.Localization/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Localization/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj b/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj index aad9dcf58d..0fd10d94ca 100644 --- a/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj +++ b/framework/src/Volo.Abp.Localization/Volo.Abp.Localization.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/cs.json b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/cs.json new file mode 100644 index 0000000000..bea8d0379b --- /dev/null +++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/cs.json @@ -0,0 +1,7 @@ +{ + "culture": "cs", + "texts": { + "DisplayName:Abp.Localization.DefaultLanguage": "Výchozí jazyk", + "Description:Abp.Localization.DefaultLanguage": "Váchozí jazyk aplikace." + } +} diff --git a/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/zh-Hant.json b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/zh-Hant.json new file mode 100644 index 0000000000..9ff62f43bb --- /dev/null +++ b/framework/src/Volo.Abp.Localization/Volo/Abp/Localization/Resources/AbpLocalization/zh-Hant.json @@ -0,0 +1,7 @@ +{ + "culture": "zh-Hant", + "texts": { + "DisplayName:Abp.Localization.DefaultLanguage": "預設語系", + "Description:Abp.Localization.DefaultLanguage": "應用程式的預設語系." + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.MailKit/FodyWeavers.xml b/framework/src/Volo.Abp.MailKit/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.MailKit/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.MailKit/FodyWeavers.xsd b/framework/src/Volo.Abp.MailKit/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.MailKit/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.MailKit/Volo.Abp.MailKit.csproj b/framework/src/Volo.Abp.MailKit/Volo.Abp.MailKit.csproj index d96ab22fbe..8aa654922a 100644 --- a/framework/src/Volo.Abp.MailKit/Volo.Abp.MailKit.csproj +++ b/framework/src/Volo.Abp.MailKit/Volo.Abp.MailKit.csproj @@ -1,5 +1,6 @@ - + + @@ -21,4 +22,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.MailKit/Volo/Abp/MailKit/MailKitSmtpEmailSender.cs b/framework/src/Volo.Abp.MailKit/Volo/Abp/MailKit/MailKitSmtpEmailSender.cs index f798ebf01e..a3cb4ea499 100644 --- a/framework/src/Volo.Abp.MailKit/Volo/Abp/MailKit/MailKitSmtpEmailSender.cs +++ b/framework/src/Volo.Abp.MailKit/Volo/Abp/MailKit/MailKitSmtpEmailSender.cs @@ -30,11 +30,11 @@ namespace Volo.Abp.MailKit protected override async Task SendEmailAsync(MailMessage mail) { - using (var client = await BuildClientAsync().ConfigureAwait(false)) + using (var client = await BuildClientAsync()) { var message = MimeMessage.CreateFromMailMessage(mail); - await client.SendAsync(message).ConfigureAwait(false); - await client.DisconnectAsync(true).ConfigureAwait(false); + await client.SendAsync(message); + await client.DisconnectAsync(true); } } @@ -44,7 +44,7 @@ namespace Volo.Abp.MailKit try { - await ConfigureClient(client).ConfigureAwait(false); + await ConfigureClient(client); return client; } catch @@ -57,20 +57,20 @@ namespace Volo.Abp.MailKit protected virtual async Task ConfigureClient(SmtpClient client) { client.Connect( - await SmtpConfiguration.GetHostAsync().ConfigureAwait(false), - await SmtpConfiguration.GetPortAsync().ConfigureAwait(false), + await SmtpConfiguration.GetHostAsync(), + await SmtpConfiguration.GetPortAsync(), await GetSecureSocketOption() -.ConfigureAwait(false)); + ); - if (await SmtpConfiguration.GetUseDefaultCredentialsAsync().ConfigureAwait(false)) + if (await SmtpConfiguration.GetUseDefaultCredentialsAsync()) { return; } client.Authenticate( - await SmtpConfiguration.GetUserNameAsync().ConfigureAwait(false), + await SmtpConfiguration.GetUserNameAsync(), await SmtpConfiguration.GetPasswordAsync() -.ConfigureAwait(false)); + ); } protected virtual async Task GetSecureSocketOption() @@ -81,7 +81,7 @@ namespace Volo.Abp.MailKit } return await SmtpConfiguration.GetEnableSslAsync() -.ConfigureAwait(false) ? SecureSocketOptions.SslOnConnect + ? SecureSocketOptions.SslOnConnect : SecureSocketOptions.StartTlsWhenAvailable; } } diff --git a/framework/src/Volo.Abp.MemoryDb/FodyWeavers.xml b/framework/src/Volo.Abp.MemoryDb/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.MemoryDb/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.MemoryDb/FodyWeavers.xsd b/framework/src/Volo.Abp.MemoryDb/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.MemoryDb/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.MemoryDb/Volo.Abp.MemoryDb.csproj b/framework/src/Volo.Abp.MemoryDb/Volo.Abp.MemoryDb.csproj index ad7b834c7c..1a896b8891 100644 --- a/framework/src/Volo.Abp.MemoryDb/Volo.Abp.MemoryDb.csproj +++ b/framework/src/Volo.Abp.MemoryDb/Volo.Abp.MemoryDb.csproj @@ -1,5 +1,6 @@ + @@ -17,4 +18,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs b/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs index d554e09de1..b81aa7ae87 100644 --- a/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs +++ b/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs @@ -101,7 +101,7 @@ namespace Volo.Abp.Domain.Repositories.MemoryDb public virtual async Task GetAsync(TKey id, bool includeDetails = true, CancellationToken cancellationToken = default) { - var entity = await FindAsync(id, includeDetails, cancellationToken).ConfigureAwait(false); + var entity = await FindAsync(id, includeDetails, cancellationToken); if (entity == null) { @@ -118,13 +118,13 @@ namespace Volo.Abp.Domain.Repositories.MemoryDb public virtual async Task DeleteAsync(TKey id, bool autoSave = false, CancellationToken cancellationToken = default) { - var entity = await FindAsync(id, cancellationToken: cancellationToken).ConfigureAwait(false); + var entity = await FindAsync(id, cancellationToken: cancellationToken); if (entity == null) { return; } - await DeleteAsync(entity, autoSave, cancellationToken).ConfigureAwait(false); + await DeleteAsync(entity, autoSave, cancellationToken); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Minify/FodyWeavers.xml b/framework/src/Volo.Abp.Minify/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Minify/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Minify/FodyWeavers.xsd b/framework/src/Volo.Abp.Minify/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Minify/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Minify/Volo.Abp.Minify.csproj b/framework/src/Volo.Abp.Minify/Volo.Abp.Minify.csproj index 6abb3fcc37..ee2ecc23e6 100644 --- a/framework/src/Volo.Abp.Minify/Volo.Abp.Minify.csproj +++ b/framework/src/Volo.Abp.Minify/Volo.Abp.Minify.csproj @@ -1,5 +1,6 @@ - + + @@ -21,4 +22,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.MongoDB/FodyWeavers.xml b/framework/src/Volo.Abp.MongoDB/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.MongoDB/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.MongoDB/FodyWeavers.xsd b/framework/src/Volo.Abp.MongoDB/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.MongoDB/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj b/framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj index 5cf143f99a..7e14eb9a9e 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj +++ b/framework/src/Volo.Abp.MongoDB/Volo.Abp.MongoDB.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs index 1ee3cbf80d..3333f1d505 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs @@ -58,12 +58,12 @@ namespace Volo.Abp.Domain.Repositories.MongoDB bool autoSave = false, CancellationToken cancellationToken = default) { - await ApplyAbpConceptsForAddedEntityAsync(entity).ConfigureAwait(false); + await ApplyAbpConceptsForAddedEntityAsync(entity); await Collection.InsertOneAsync( entity, cancellationToken: GetCancellationToken(cancellationToken) - ).ConfigureAwait(false); + ); return entity; } @@ -78,14 +78,14 @@ namespace Volo.Abp.Domain.Repositories.MongoDB if (entity is ISoftDelete softDeleteEntity && softDeleteEntity.IsDeleted) { SetDeletionAuditProperties(entity); - await TriggerEntityDeleteEventsAsync(entity).ConfigureAwait(false); + await TriggerEntityDeleteEventsAsync(entity); } else { - await TriggerEntityUpdateEventsAsync(entity).ConfigureAwait(false); + await TriggerEntityUpdateEventsAsync(entity); } - await TriggerDomainEventsAsync(entity).ConfigureAwait(false); + await TriggerDomainEventsAsync(entity); var oldConcurrencyStamp = SetNewConcurrencyStamp(entity); @@ -93,7 +93,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB CreateEntityFilter(entity, true, oldConcurrencyStamp), entity, cancellationToken: GetCancellationToken(cancellationToken) - ).ConfigureAwait(false); + ); if (result.MatchedCount <= 0) { @@ -108,17 +108,17 @@ namespace Volo.Abp.Domain.Repositories.MongoDB bool autoSave = false, CancellationToken cancellationToken = default) { - await ApplyAbpConceptsForDeletedEntityAsync(entity).ConfigureAwait(false); + await ApplyAbpConceptsForDeletedEntityAsync(entity); var oldConcurrencyStamp = SetNewConcurrencyStamp(entity); - if (entity is ISoftDelete softDeleteEntity) + if (entity is ISoftDelete softDeleteEntity && !IsHardDeleted(entity)) { softDeleteEntity.IsDeleted = true; var result = await Collection.ReplaceOneAsync( CreateEntityFilter(entity, true, oldConcurrencyStamp), entity, cancellationToken: GetCancellationToken(cancellationToken) - ).ConfigureAwait(false); + ); if (result.MatchedCount <= 0) { @@ -130,7 +130,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB var result = await Collection.DeleteOneAsync( CreateEntityFilter(entity, true, oldConcurrencyStamp), GetCancellationToken(cancellationToken) - ).ConfigureAwait(false); + ); if (result.DeletedCount <= 0) { @@ -141,12 +141,12 @@ namespace Volo.Abp.Domain.Repositories.MongoDB public override async Task> GetListAsync(bool includeDetails = false, CancellationToken cancellationToken = default) { - return await GetMongoQueryable().ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + return await GetMongoQueryable().ToListAsync(GetCancellationToken(cancellationToken)); } public override async Task GetCountAsync(CancellationToken cancellationToken = default) { - return await GetMongoQueryable().LongCountAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + return await GetMongoQueryable().LongCountAsync(GetCancellationToken(cancellationToken)); } public override async Task DeleteAsync( @@ -156,11 +156,11 @@ namespace Volo.Abp.Domain.Repositories.MongoDB { var entities = await GetMongoQueryable() .Where(predicate) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); foreach (var entity in entities) { - await DeleteAsync(entity, autoSave, cancellationToken).ConfigureAwait(false); + await DeleteAsync(entity, autoSave, cancellationToken); } } @@ -175,11 +175,21 @@ namespace Volo.Abp.Domain.Repositories.MongoDB Collection.AsQueryable() ); } + protected virtual bool IsHardDeleted(TEntity entity) + { + var hardDeletedEntities = UnitOfWorkManager?.Current?.Items.GetOrDefault(UnitOfWorkItemNames.HardDeletedEntities) as HashSet; + if (hardDeletedEntities == null) + { + return false; + } + + return hardDeletedEntities.Contains(entity); + } protected virtual FilterDefinition CreateEntityFilter(TEntity entity, bool withConcurrencyStamp = false, string concurrencyStamp = null) { throw new NotImplementedException( - $"{nameof(CreateEntityFilter)} is not implemented for MongoDB by default. It should be overrided and implemented by the deriving class!" + $"{nameof(CreateEntityFilter)} is not implemented for MongoDB by default. It should be overriden and implemented by the deriving class!" ); } @@ -187,33 +197,33 @@ namespace Volo.Abp.Domain.Repositories.MongoDB { CheckAndSetId(entity); SetCreationAuditProperties(entity); - await TriggerEntityCreateEvents(entity).ConfigureAwait(false); - await TriggerDomainEventsAsync(entity).ConfigureAwait(false); + await TriggerEntityCreateEvents(entity); + await TriggerDomainEventsAsync(entity); } private async Task TriggerEntityCreateEvents(TEntity entity) { - await EntityChangeEventHelper.TriggerEntityCreatedEventOnUowCompletedAsync(entity).ConfigureAwait(false); - await EntityChangeEventHelper.TriggerEntityCreatingEventAsync(entity).ConfigureAwait(false); + await EntityChangeEventHelper.TriggerEntityCreatedEventOnUowCompletedAsync(entity); + await EntityChangeEventHelper.TriggerEntityCreatingEventAsync(entity); } protected virtual async Task TriggerEntityUpdateEventsAsync(TEntity entity) { - await EntityChangeEventHelper.TriggerEntityUpdatedEventOnUowCompletedAsync(entity).ConfigureAwait(false); - await EntityChangeEventHelper.TriggerEntityUpdatingEventAsync(entity).ConfigureAwait(false); + await EntityChangeEventHelper.TriggerEntityUpdatedEventOnUowCompletedAsync(entity); + await EntityChangeEventHelper.TriggerEntityUpdatingEventAsync(entity); } protected virtual async Task ApplyAbpConceptsForDeletedEntityAsync(TEntity entity) { SetDeletionAuditProperties(entity); - await TriggerEntityDeleteEventsAsync(entity).ConfigureAwait(false); - await TriggerDomainEventsAsync(entity).ConfigureAwait(false); + await TriggerEntityDeleteEventsAsync(entity); + await TriggerDomainEventsAsync(entity); } protected virtual async Task TriggerEntityDeleteEventsAsync(TEntity entity) { - await EntityChangeEventHelper.TriggerEntityDeletedEventOnUowCompletedAsync(entity).ConfigureAwait(false); - await EntityChangeEventHelper.TriggerEntityDeletingEventAsync(entity).ConfigureAwait(false); + await EntityChangeEventHelper.TriggerEntityDeletedEventOnUowCompletedAsync(entity); + await EntityChangeEventHelper.TriggerEntityDeletingEventAsync(entity); } protected virtual void CheckAndSetId(TEntity entity) @@ -266,7 +276,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB { foreach (var localEvent in localEvents) { - await LocalEventBus.PublishAsync(localEvent.GetType(), localEvent).ConfigureAwait(false); + await LocalEventBus.PublishAsync(localEvent.GetType(), localEvent); } generatesDomainEventsEntity.ClearLocalEvents(); @@ -277,7 +287,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB { foreach (var distributedEvent in distributedEvents) { - await DistributedEventBus.PublishAsync(distributedEvent.GetType(), distributedEvent).ConfigureAwait(false); + await DistributedEventBus.PublishAsync(distributedEvent.GetType(), distributedEvent); } generatesDomainEventsEntity.ClearDistributedEvents(); @@ -324,7 +334,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB bool includeDetails = true, CancellationToken cancellationToken = default) { - var entity = await FindAsync(id, includeDetails, cancellationToken).ConfigureAwait(false); + var entity = await FindAsync(id, includeDetails, cancellationToken); if (entity == null) { @@ -341,7 +351,7 @@ namespace Volo.Abp.Domain.Repositories.MongoDB { return await Collection .Find(CreateEntityFilter(id, true)) - .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); } public virtual Task DeleteAsync( diff --git a/framework/src/Volo.Abp.MultiTenancy/FodyWeavers.xml b/framework/src/Volo.Abp.MultiTenancy/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.MultiTenancy/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.MultiTenancy/FodyWeavers.xsd b/framework/src/Volo.Abp.MultiTenancy/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.MultiTenancy/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.MultiTenancy/Volo.Abp.MultiTenancy.csproj b/framework/src/Volo.Abp.MultiTenancy/Volo.Abp.MultiTenancy.csproj index b67e76c459..951712c7f0 100644 --- a/framework/src/Volo.Abp.MultiTenancy/Volo.Abp.MultiTenancy.csproj +++ b/framework/src/Volo.Abp.MultiTenancy/Volo.Abp.MultiTenancy.csproj @@ -1,5 +1,6 @@ + diff --git a/framework/src/Volo.Abp.ObjectMapping/FodyWeavers.xml b/framework/src/Volo.Abp.ObjectMapping/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.ObjectMapping/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.ObjectMapping/FodyWeavers.xsd b/framework/src/Volo.Abp.ObjectMapping/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.ObjectMapping/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.ObjectMapping/Volo.Abp.ObjectMapping.csproj b/framework/src/Volo.Abp.ObjectMapping/Volo.Abp.ObjectMapping.csproj index 5c08dd7ed7..163fd6d534 100644 --- a/framework/src/Volo.Abp.ObjectMapping/Volo.Abp.ObjectMapping.csproj +++ b/framework/src/Volo.Abp.ObjectMapping/Volo.Abp.ObjectMapping.csproj @@ -1,5 +1,6 @@ + diff --git a/framework/src/Volo.Abp.RabbitMQ/FodyWeavers.xml b/framework/src/Volo.Abp.RabbitMQ/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.RabbitMQ/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.RabbitMQ/FodyWeavers.xsd b/framework/src/Volo.Abp.RabbitMQ/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.RabbitMQ/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.RabbitMQ/Volo.Abp.RabbitMQ.csproj b/framework/src/Volo.Abp.RabbitMQ/Volo.Abp.RabbitMQ.csproj index 2f268c964b..1a7860deeb 100644 --- a/framework/src/Volo.Abp.RabbitMQ/Volo.Abp.RabbitMQ.csproj +++ b/framework/src/Volo.Abp.RabbitMQ/Volo.Abp.RabbitMQ.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs index 8e136fc2ac..1214a82a99 100644 --- a/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs +++ b/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/RabbitMqMessageConsumer.cs @@ -63,13 +63,13 @@ namespace Volo.Abp.RabbitMQ public virtual async Task BindAsync(string routingKey) { QueueBindCommands.Enqueue(new QueueBindCommand(QueueBindType.Bind, routingKey)); - await TrySendQueueBindCommandsAsync().ConfigureAwait(false); + await TrySendQueueBindCommandsAsync(); } public virtual async Task UnbindAsync(string routingKey) { QueueBindCommands.Enqueue(new QueueBindCommand(QueueBindType.Unbind, routingKey)); - await TrySendQueueBindCommandsAsync().ConfigureAwait(false); + await TrySendQueueBindCommandsAsync(); } protected virtual void TrySendQueueBindCommands() @@ -166,7 +166,7 @@ namespace Volo.Abp.RabbitMQ var consumer = new EventingBasicConsumer(channel); consumer.Received += async (model, basicDeliverEventArgs) => { - await HandleIncomingMessage(channel, basicDeliverEventArgs).ConfigureAwait(false); + await HandleIncomingMessage(channel, basicDeliverEventArgs); }; channel.BasicConsume( @@ -189,7 +189,7 @@ namespace Volo.Abp.RabbitMQ { foreach (var callback in Callbacks) { - await callback(channel, basicDeliverEventArgs).ConfigureAwait(false); + await callback(channel, basicDeliverEventArgs); } channel.BasicAck(basicDeliverEventArgs.DeliveryTag, multiple: false); diff --git a/framework/src/Volo.Abp.Security/FodyWeavers.xml b/framework/src/Volo.Abp.Security/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Security/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Security/FodyWeavers.xsd b/framework/src/Volo.Abp.Security/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Security/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Security/Volo.Abp.Security.csproj b/framework/src/Volo.Abp.Security/Volo.Abp.Security.csproj index 792aaf98ff..65aca85c88 100644 --- a/framework/src/Volo.Abp.Security/Volo.Abp.Security.csproj +++ b/framework/src/Volo.Abp.Security/Volo.Abp.Security.csproj @@ -1,5 +1,6 @@ + diff --git a/framework/src/Volo.Abp.Serialization/FodyWeavers.xml b/framework/src/Volo.Abp.Serialization/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Serialization/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Serialization/FodyWeavers.xsd b/framework/src/Volo.Abp.Serialization/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Serialization/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Serialization/Volo.Abp.Serialization.csproj b/framework/src/Volo.Abp.Serialization/Volo.Abp.Serialization.csproj index 62ba5b9b14..b23178d760 100644 --- a/framework/src/Volo.Abp.Serialization/Volo.Abp.Serialization.csproj +++ b/framework/src/Volo.Abp.Serialization/Volo.Abp.Serialization.csproj @@ -1,5 +1,6 @@ + diff --git a/framework/src/Volo.Abp.Settings/FodyWeavers.xml b/framework/src/Volo.Abp.Settings/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Settings/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Settings/FodyWeavers.xsd b/framework/src/Volo.Abp.Settings/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Settings/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Settings/Volo.Abp.Settings.csproj b/framework/src/Volo.Abp.Settings/Volo.Abp.Settings.csproj index 15a41c3672..65f985a87b 100644 --- a/framework/src/Volo.Abp.Settings/Volo.Abp.Settings.csproj +++ b/framework/src/Volo.Abp.Settings/Volo.Abp.Settings.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingProvider.cs b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingProvider.cs index 7694ca219f..6f5372a4cf 100644 --- a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingProvider.cs +++ b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingProvider.cs @@ -34,7 +34,7 @@ namespace Volo.Abp.Settings //TODO: How to implement setting.IsInherited? - var value = await GetOrNullValueFromProvidersAsync(providers, setting).ConfigureAwait(false); + var value = await GetOrNullValueFromProvidersAsync(providers, setting); if (setting.IsEncrypted) { value = SettingEncryptionService.Decrypt(setting, value); @@ -52,7 +52,7 @@ namespace Volo.Abp.Settings { foreach (var setting in settingDefinitions) { - var value = await provider.GetOrNullAsync(setting).ConfigureAwait(false); + var value = await provider.GetOrNullAsync(setting); if (value != null) { if (setting.IsEncrypted) @@ -74,7 +74,7 @@ namespace Volo.Abp.Settings { foreach (var provider in providers) { - var value = await provider.GetOrNullAsync(setting).ConfigureAwait(false); + var value = await provider.GetOrNullAsync(setting); if (value != null) { return value; diff --git a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingProviderExtensions.cs b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingProviderExtensions.cs index eb7e3c341c..fb67c4ae77 100644 --- a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingProviderExtensions.cs +++ b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/SettingProviderExtensions.cs @@ -12,7 +12,7 @@ namespace Volo.Abp.Settings Check.NotNull(name, nameof(name)); return string.Equals( - await settingProvider.GetOrNullAsync(name).ConfigureAwait(false), + await settingProvider.GetOrNullAsync(name), "true", StringComparison.OrdinalIgnoreCase ); @@ -24,7 +24,7 @@ namespace Volo.Abp.Settings Check.NotNull(settingProvider, nameof(settingProvider)); Check.NotNull(name, nameof(name)); - var value = await settingProvider.GetOrNullAsync(name).ConfigureAwait(false); + var value = await settingProvider.GetOrNullAsync(name); return value?.To() ?? defaultValue; } } diff --git a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/TenantSettingValueProvider.cs b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/TenantSettingValueProvider.cs index 408f70aac9..eab23b7258 100644 --- a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/TenantSettingValueProvider.cs +++ b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/TenantSettingValueProvider.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.Settings public override async Task GetOrNullAsync(SettingDefinition setting) { - return await SettingStore.GetOrNullAsync(setting.Name, Name, CurrentTenant.Id?.ToString()).ConfigureAwait(false); + return await SettingStore.GetOrNullAsync(setting.Name, Name, CurrentTenant.Id?.ToString()); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/UserSettingValueProvider.cs b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/UserSettingValueProvider.cs index a3df714c00..01125f3201 100644 --- a/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/UserSettingValueProvider.cs +++ b/framework/src/Volo.Abp.Settings/Volo/Abp/Settings/UserSettingValueProvider.cs @@ -24,7 +24,7 @@ namespace Volo.Abp.Settings return null; } - return await SettingStore.GetOrNullAsync(setting.Name, Name, CurrentUser.Id.ToString()).ConfigureAwait(false); + return await SettingStore.GetOrNullAsync(setting.Name, Name, CurrentUser.Id.ToString()); } } } \ No newline at end of file diff --git a/framework/src/Volo.Abp.Sms/FodyWeavers.xml b/framework/src/Volo.Abp.Sms/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Sms/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Sms/FodyWeavers.xsd b/framework/src/Volo.Abp.Sms/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Sms/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Sms/Volo.Abp.Sms.csproj b/framework/src/Volo.Abp.Sms/Volo.Abp.Sms.csproj index 33ef1dbf23..35adb7e62c 100644 --- a/framework/src/Volo.Abp.Sms/Volo.Abp.Sms.csproj +++ b/framework/src/Volo.Abp.Sms/Volo.Abp.Sms.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.Specifications/FodyWeavers.xml b/framework/src/Volo.Abp.Specifications/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Specifications/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Specifications/FodyWeavers.xsd b/framework/src/Volo.Abp.Specifications/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Specifications/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Specifications/Volo.Abp.Specifications.csproj b/framework/src/Volo.Abp.Specifications/Volo.Abp.Specifications.csproj index 97c236cfc5..6e17993ba1 100644 --- a/framework/src/Volo.Abp.Specifications/Volo.Abp.Specifications.csproj +++ b/framework/src/Volo.Abp.Specifications/Volo.Abp.Specifications.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.TestBase/FodyWeavers.xml b/framework/src/Volo.Abp.TestBase/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.TestBase/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.TestBase/FodyWeavers.xsd b/framework/src/Volo.Abp.TestBase/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.TestBase/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.TestBase/Volo.Abp.TestBase.csproj b/framework/src/Volo.Abp.TestBase/Volo.Abp.TestBase.csproj index a8b967561e..004a0fa4d6 100644 --- a/framework/src/Volo.Abp.TestBase/Volo.Abp.TestBase.csproj +++ b/framework/src/Volo.Abp.TestBase/Volo.Abp.TestBase.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.Threading/FodyWeavers.xml b/framework/src/Volo.Abp.Threading/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Threading/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Threading/FodyWeavers.xsd b/framework/src/Volo.Abp.Threading/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Threading/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Threading/Volo.Abp.Threading.csproj b/framework/src/Volo.Abp.Threading/Volo.Abp.Threading.csproj index b4e53162d5..0f5fbf3e9a 100644 --- a/framework/src/Volo.Abp.Threading/Volo.Abp.Threading.csproj +++ b/framework/src/Volo.Abp.Threading/Volo.Abp.Threading.csproj @@ -1,5 +1,6 @@ + diff --git a/framework/src/Volo.Abp.Timing/FodyWeavers.xml b/framework/src/Volo.Abp.Timing/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Timing/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Timing/FodyWeavers.xsd b/framework/src/Volo.Abp.Timing/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Timing/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Timing/Volo.Abp.Timing.csproj b/framework/src/Volo.Abp.Timing/Volo.Abp.Timing.csproj index dbaa8d11dd..4f9eb21f2f 100644 --- a/framework/src/Volo.Abp.Timing/Volo.Abp.Timing.csproj +++ b/framework/src/Volo.Abp.Timing/Volo.Abp.Timing.csproj @@ -1,5 +1,6 @@ + @@ -17,4 +18,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.UI.Navigation/FodyWeavers.xml b/framework/src/Volo.Abp.UI.Navigation/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.UI.Navigation/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.UI.Navigation/FodyWeavers.xsd b/framework/src/Volo.Abp.UI.Navigation/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.UI.Navigation/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.UI.Navigation/Volo.Abp.UI.Navigation.csproj b/framework/src/Volo.Abp.UI.Navigation/Volo.Abp.UI.Navigation.csproj index c218698017..5236bf0404 100644 --- a/framework/src/Volo.Abp.UI.Navigation/Volo.Abp.UI.Navigation.csproj +++ b/framework/src/Volo.Abp.UI.Navigation/Volo.Abp.UI.Navigation.csproj @@ -1,5 +1,6 @@ - + + @@ -22,4 +23,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Localization/Resource/zh-Hant.json b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Localization/Resource/zh-Hant.json new file mode 100644 index 0000000000..a592b42fff --- /dev/null +++ b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Localization/Resource/zh-Hant.json @@ -0,0 +1,6 @@ +{ + "culture": "zh-Hant", + "texts": { + "Menu:Administration": "管理" + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/MenuManager.cs b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/MenuManager.cs index 7ca2baa6b0..5c33866aa2 100644 --- a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/MenuManager.cs +++ b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/MenuManager.cs @@ -30,7 +30,7 @@ namespace Volo.Abp.UI.Navigation foreach (var contributor in Options.MenuContributors) { - await contributor.ConfigureMenuAsync(context).ConfigureAwait(false); + await contributor.ConfigureMenuAsync(context); } } diff --git a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs index fed4235087..ffa31e66a2 100644 --- a/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs +++ b/framework/src/Volo.Abp.UI.Navigation/Volo/Abp/Ui/Navigation/Urls/AppUrlProvider.cs @@ -33,7 +33,7 @@ namespace Volo.Abp.UI.Navigation.Urls appName, urlName ) -.ConfigureAwait(false)).ConfigureAwait(false); + ); } protected virtual Task GetConfiguredUrl(string appName, string urlName) @@ -89,7 +89,7 @@ namespace Volo.Abp.UI.Navigation.Urls if (CurrentTenant.Id.HasValue) { - url = url.Replace(tenantNamePlaceHolder, await GetCurrentTenantNameAsync().ConfigureAwait(false)); + url = url.Replace(tenantNamePlaceHolder, await GetCurrentTenantNameAsync()); } else { @@ -103,7 +103,7 @@ namespace Volo.Abp.UI.Navigation.Urls { if (CurrentTenant.Id.HasValue && CurrentTenant.Name.IsNullOrEmpty()) { - var tenantConfiguration = await TenantStore.FindAsync(CurrentTenant.Id.Value).ConfigureAwait(false); + var tenantConfiguration = await TenantStore.FindAsync(CurrentTenant.Id.Value); return tenantConfiguration.Name; } diff --git a/framework/src/Volo.Abp.UI/FodyWeavers.xml b/framework/src/Volo.Abp.UI/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.UI/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.UI/FodyWeavers.xsd b/framework/src/Volo.Abp.UI/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.UI/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json index 0bd6ba5462..c4dcb99b1b 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/en.json @@ -13,11 +13,13 @@ "DefaultErrorMessage404": "Resource not found!", "DefaultErrorMessage404Detail": "The resource requested could not found on the server!", "EntityNotFoundErrorMessage": "There is no entity {0} with id = {1}!", + "Languages": "Languages", "Error": "Error", "AreYouSure": "Are you sure?", "Cancel": "Cancel", "Yes": "Yes", "No": "No", + "Ok": "Ok", "Close": "Close", "Save": "Save", "SavingWithThreeDot": "Saving...", @@ -25,6 +27,8 @@ "Delete": "Delete", "Edit": "Edit", "Refresh": "Refresh", + "Language": "Language", + "LoadMore": "Load more", "ProcessingWithThreeDot": "Processing...", "LoadingWithThreeDot": "Loading...", "Welcome": "Welcome", diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/tr.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/tr.json index 2ebd7e06df..4fe44a40c6 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/tr.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/tr.json @@ -13,11 +13,13 @@ "DefaultErrorMessage404": "Kaynak bulunamadı!", "DefaultErrorMessage404Detail": "İstenilen kaynak sunucuda bulunamadı.", "EntityNotFoundErrorMessage": "Id değeri {1} olan {0} türünden bir nesne bulunamadı!", + "Languages": "Diller", "Error": "Hata", "AreYouSure": "Emin misiniz?", "Cancel": "Vazgeç", "Yes": "Evet", "No": "Hayır", + "Ok": "Tamam", "Close": "Kapat", "Save": "Kaydet", "SavingWithThreeDot": "Kaydediliyor...", @@ -25,6 +27,8 @@ "Delete": "Sil", "Edit": "Düzenle", "Refresh": "Yenile", + "Language": "Dil", + "LoadMore": "Daha fazla yükle", "ProcessingWithThreeDot": "İşleniyor...", "LoadingWithThreeDot": "Yükleniyor...", "Welcome": "Hoşgeldiniz", diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/zh-Hans.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/zh-Hans.json index 1030a3860f..d71cac388c 100644 --- a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/zh-Hans.json +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/zh-Hans.json @@ -13,6 +13,7 @@ "DefaultErrorMessage404": "未找到资源!", "DefaultErrorMessage404Detail": "未在服务中找到请求的资源!", "EntityNotFoundErrorMessage": "实体 {0} 不存在,id = {1}!", + "Languages": "语言", "Error": "错误", "AreYouSure": "你确定吗?", "Cancel": "取消", diff --git a/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/zh-Hant.json b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/zh-Hant.json new file mode 100644 index 0000000000..d19dc7cbc6 --- /dev/null +++ b/framework/src/Volo.Abp.UI/Localization/Resources/AbpUi/zh-Hant.json @@ -0,0 +1,58 @@ +{ + "culture": "zh-Hant", + "texts": { + "InternalServerErrorMessage": "對不起,在處理你的請求期間,產生了一個伺服器內部錯誤!", + "ValidationErrorMessage": "你的請求無效!", + "ValidationNarrativeErrorMessageTitle": "驗證時發現以下錯誤.", + "DefaultErrorMessage": "發生錯誤!", + "DefaultErrorMessageDetail": "伺服器未發送錯誤的詳細信息.", + "DefaultErrorMessage401": "未通過身份驗證!", + "DefaultErrorMessage401Detail": "你需要進行身份認證(登入)後再執行此操作.", + "DefaultErrorMessage403": "你沒有權限!", + "DefaultErrorMessage403Detail": "你不能執行此操作!", + "DefaultErrorMessage404": "未找到資源!", + "DefaultErrorMessage404Detail": "未在服務中找到請求的資源!", + "EntityNotFoundErrorMessage": "實體 {0} 不存在,id = {1}!", + "Error": "錯誤", + "AreYouSure": "你確定嗎?", + "Cancel": "取消", + "Yes": "是", + "No": "否", + "Close": "關閉", + "Save": "保存", + "SavingWithThreeDot": "保存中...", + "Actions": "操作", + "Delete": "刪除", + "Edit": "修改", + "Refresh": "刷新", + "ProcessingWithThreeDot": "處理中...", + "LoadingWithThreeDot": "載入中...", + "Welcome": "歡迎", + "Login": "登入", + "Register": "註冊", + "Logout": "登出", + "Submit": "提交", + "Back": "返回", + "PagerSearch": "搜尋", + "PagerNext": "下一頁", + "PagerPrevious": "上一頁", + "PagerFirst": "首頁", + "PagerLast": "末頁", + "PagerInfo": "顯示 _TOTAL_ 個紀錄的 _START_ 到 _END_ 個.", + "PagerInfoEmpty": "顯示0個紀錄中的0到0", + "PagerInfoFiltered": "(從 _MAX_ 所有紀錄中過濾掉)", + "NoDataAvailableInDatatable": "資料表中沒有資料", + "PagerShowMenuEntries": "顯示 _MENU_ 實體", + "DatatableActionDropdownDefaultText": "操作", + "ChangePassword": "修改密碼", + "PersonalInfo": "個人資料", + "AreYouSureYouWantToCancelEditingWarningMessage": "你有未保存的更改.", + "UnhandledException": "未處理的異常!", + "401Message": "未授權", + "403Message": "禁止訪問", + "404Message": "網頁未找到", + "500Message": "內部伺服器錯誤", + "GoHomePage": "返回首頁", + "GoBack": "返回" + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.UI/Volo.Abp.UI.csproj b/framework/src/Volo.Abp.UI/Volo.Abp.UI.csproj index 8716d7a210..acff7d004b 100644 --- a/framework/src/Volo.Abp.UI/Volo.Abp.UI.csproj +++ b/framework/src/Volo.Abp.UI/Volo.Abp.UI.csproj @@ -1,5 +1,6 @@ - + + @@ -22,4 +23,4 @@ - \ No newline at end of file + diff --git a/framework/src/Volo.Abp.Uow/FodyWeavers.xml b/framework/src/Volo.Abp.Uow/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Uow/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Uow/FodyWeavers.xsd b/framework/src/Volo.Abp.Uow/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Uow/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Uow/Volo.Abp.Uow.csproj b/framework/src/Volo.Abp.Uow/Volo.Abp.Uow.csproj index 00e4ad77d4..1c5552d1da 100644 --- a/framework/src/Volo.Abp.Uow/Volo.Abp.Uow.csproj +++ b/framework/src/Volo.Abp.Uow/Volo.Abp.Uow.csproj @@ -1,5 +1,6 @@ + diff --git a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/AbpUnitOfWorkDefaultOptions.cs b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/AbpUnitOfWorkDefaultOptions.cs index 789e4f8e58..02d80e82a5 100644 --- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/AbpUnitOfWorkDefaultOptions.cs +++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/AbpUnitOfWorkDefaultOptions.cs @@ -10,7 +10,10 @@ namespace Volo.Abp.Uow /// public class AbpUnitOfWorkDefaultOptions { - public UnitOfWorkTransactionBehavior TransactionBehavior { get; set; } + /// + /// Default value: . + /// + public UnitOfWorkTransactionBehavior TransactionBehavior { get; set; } = UnitOfWorkTransactionBehavior.Auto; public IsolationLevel? IsolationLevel { get; set; } diff --git a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/AbpUnitOfWorkOptions.cs b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/AbpUnitOfWorkOptions.cs index dd39612921..a8f3f75a11 100644 --- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/AbpUnitOfWorkOptions.cs +++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/AbpUnitOfWorkOptions.cs @@ -14,6 +14,18 @@ namespace Volo.Abp.Uow public TimeSpan? Timeout { get; set; } + public AbpUnitOfWorkOptions() + { + + } + + public AbpUnitOfWorkOptions(bool isTransactional = false, IsolationLevel? isolationLevel = null, TimeSpan? timeout = null) + { + IsTransactional = isTransactional; + IsolationLevel = isolationLevel; + Timeout = timeout; + } + public AbpUnitOfWorkOptions Clone() { return new AbpUnitOfWorkOptions diff --git a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/ChildUnitOfWork.cs b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/ChildUnitOfWork.cs index d1d90b6f6f..882c8d6a70 100644 --- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/ChildUnitOfWork.cs +++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/ChildUnitOfWork.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using JetBrains.Annotations; @@ -26,6 +27,8 @@ namespace Volo.Abp.Uow public IServiceProvider ServiceProvider => _parent.ServiceProvider; + public Dictionary Items => _parent.Items; + private readonly IUnitOfWork _parent; public ChildUnitOfWork([NotNull] IUnitOfWork parent) diff --git a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/IUnitOfWork.cs b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/IUnitOfWork.cs index 32ef781133..ee5baa58bc 100644 --- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/IUnitOfWork.cs +++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/IUnitOfWork.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using JetBrains.Annotations; @@ -9,6 +10,8 @@ namespace Volo.Abp.Uow { Guid Id { get; } + Dictionary Items { get; } + //TODO: Switch to OnFailed (sync) and OnDisposed (sync) methods to be compatible with OnCompleted event EventHandler Failed; diff --git a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/IUnitOfWorkManagerAccessor.cs b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/IUnitOfWorkManagerAccessor.cs new file mode 100644 index 0000000000..a12b77855e --- /dev/null +++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/IUnitOfWorkManagerAccessor.cs @@ -0,0 +1,7 @@ +namespace Volo.Abp.Uow +{ + public interface IUnitOfWorkManagerAccessor + { + IUnitOfWorkManager UnitOfWorkManager { get; } + } +} diff --git a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWork.cs b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWork.cs index 18010136b2..05f49df180 100644 --- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWork.cs +++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWork.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; +using JetBrains.Annotations; using Microsoft.Extensions.Options; using Volo.Abp.DependencyInjection; @@ -31,6 +32,9 @@ namespace Volo.Abp.Uow public IServiceProvider ServiceProvider { get; } + [NotNull] + public Dictionary Items { get; } + private readonly Dictionary _databaseApis; private readonly Dictionary _transactionApis; private readonly AbpUnitOfWorkDefaultOptions _defaultOptions; @@ -46,6 +50,8 @@ namespace Volo.Abp.Uow _databaseApis = new Dictionary(); _transactionApis = new Dictionary(); + + Items = new Dictionary(); } public virtual void Initialize(AbpUnitOfWorkOptions options) @@ -80,7 +86,7 @@ namespace Volo.Abp.Uow { if (databaseApi is ISupportsSavingChanges) { - await (databaseApi as ISupportsSavingChanges).SaveChangesAsync(cancellationToken).ConfigureAwait(false); + await (databaseApi as ISupportsSavingChanges).SaveChangesAsync(cancellationToken); } } } @@ -107,10 +113,10 @@ namespace Volo.Abp.Uow try { _isCompleting = true; - await SaveChangesAsync(cancellationToken).ConfigureAwait(false); - await CommitTransactionsAsync().ConfigureAwait(false); + await SaveChangesAsync(cancellationToken); + await CommitTransactionsAsync(); IsCompleted = true; - await OnCompletedAsync().ConfigureAwait(false); + await OnCompletedAsync(); } catch (Exception ex) { @@ -128,7 +134,7 @@ namespace Volo.Abp.Uow _isRolledback = true; - await RollbackAllAsync(cancellationToken).ConfigureAwait(false); + await RollbackAllAsync(cancellationToken); } public IDatabaseApi FindDatabaseApi(string key) @@ -194,7 +200,7 @@ namespace Volo.Abp.Uow { foreach (var handler in CompletedHandlers) { - await handler.Invoke().ConfigureAwait(false); + await handler.Invoke(); } } @@ -278,7 +284,7 @@ namespace Volo.Abp.Uow { try { - await (databaseApi as ISupportsRollback).RollbackAsync(cancellationToken).ConfigureAwait(false); + await (databaseApi as ISupportsRollback).RollbackAsync(cancellationToken); } catch { } } @@ -290,7 +296,7 @@ namespace Volo.Abp.Uow { try { - await (transactionApi as ISupportsRollback).RollbackAsync(cancellationToken).ConfigureAwait(false); + await (transactionApi as ISupportsRollback).RollbackAsync(cancellationToken); } catch { } } @@ -309,7 +315,7 @@ namespace Volo.Abp.Uow { foreach (var transaction in GetAllActiveTransactionApis()) { - await transaction.CommitAsync().ConfigureAwait(false); + await transaction.CommitAsync(); } } diff --git a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs index d08c9b943e..81bd132a5e 100644 --- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs +++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkInterceptor.cs @@ -22,14 +22,14 @@ namespace Volo.Abp.Uow { if (!UnitOfWorkHelper.IsUnitOfWorkMethod(invocation.Method, out var unitOfWorkAttribute)) { - await invocation.ProceedAsync().ConfigureAwait(false); + await invocation.ProceedAsync(); return; } using (var uow = _unitOfWorkManager.Begin(CreateOptions(invocation, unitOfWorkAttribute))) { - await invocation.ProceedAsync().ConfigureAwait(false); - await uow.CompleteAsync().ConfigureAwait(false); + await invocation.ProceedAsync(); + await uow.CompleteAsync(); } } diff --git a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManagerExtensions.cs b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManagerExtensions.cs index bf8859d6ac..a0c52a49f4 100644 --- a/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManagerExtensions.cs +++ b/framework/src/Volo.Abp.Uow/Volo/Abp/Uow/UnitOfWorkManagerExtensions.cs @@ -1,15 +1,27 @@ -using JetBrains.Annotations; +using System; +using System.Data; +using JetBrains.Annotations; namespace Volo.Abp.Uow { public static class UnitOfWorkManagerExtensions { [NotNull] - public static IUnitOfWork Begin([NotNull] this IUnitOfWorkManager unitOfWorkManager, bool requiresNew = false) + public static IUnitOfWork Begin( + [NotNull] this IUnitOfWorkManager unitOfWorkManager, + bool requiresNew = false, + bool isTransactional = false, + IsolationLevel? isolationLevel = null, + TimeSpan? timeout = null) { Check.NotNull(unitOfWorkManager, nameof(unitOfWorkManager)); - return unitOfWorkManager.Begin(new AbpUnitOfWorkOptions(), requiresNew); + return unitOfWorkManager.Begin(new AbpUnitOfWorkOptions + { + IsTransactional = isTransactional, + IsolationLevel = isolationLevel, + Timeout = timeout + }, requiresNew); } public static void BeginReserved([NotNull] this IUnitOfWorkManager unitOfWorkManager, [NotNull] string reservationName) diff --git a/framework/src/Volo.Abp.Validation/FodyWeavers.xml b/framework/src/Volo.Abp.Validation/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.Validation/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Validation/FodyWeavers.xsd b/framework/src/Volo.Abp.Validation/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.Validation/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.Validation/Volo.Abp.Validation.csproj b/framework/src/Volo.Abp.Validation/Volo.Abp.Validation.csproj index 86017b9628..edbcf2f04d 100644 --- a/framework/src/Volo.Abp.Validation/Volo.Abp.Validation.csproj +++ b/framework/src/Volo.Abp.Validation/Volo.Abp.Validation.csproj @@ -1,5 +1,6 @@ - + + diff --git a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/zh-Hans.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/zh-Hans.json index ac0c014967..282423a44a 100644 --- a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/zh-Hans.json +++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/zh-Hans.json @@ -8,7 +8,7 @@ "The {0} field only accepts files with the following extensions: {1}": "{0}字段只允许以下扩展名的文件: {1}", "The field {0} must be a string or array type with a maximum length of '{1}'.": "字段{0}必须是最大长度为'{1}'的字符串或数组.", "The field {0} must be a string or array type with a minimum length of '{1}'.": "字段{0}必须是最小长度为'{1}'的字符串或数组.", - "The {0} field is not a valid phone number.": "字段{0}不是有效的身份证号码.", + "The {0} field is not a valid phone number.": "字段{0}不是有效的手机号码.", "The field {0} must be between {1} and {2}.": "字段{0}值必须在{1}和{2}范围内.", "The field {0} must match the regular expression '{1}'.": "字段{0}必须匹配正则表达式'{1}'.", "The {0} field is required.": "字段{0}不可为空.", @@ -22,7 +22,7 @@ "ThisFieldOnlyAcceptsFilesWithTheFollowingExtensions:{0}": "字段只允许以下扩展名的文件: {0}", "ThisFieldMustBeAStringOrArrayTypeWithAMaximumLengthoOf{0}": "字段必须是最大长度为'{0}'的字符串或数组.", "ThisFieldMustBeAStringOrArrayTypeWithAMinimumLengthOf{0}": "字段必须是最小长度为'{0}'的字符串或数组.", - "ThisFieldIsNotAValidPhoneNumber.": "字段不是有效的身份证号码.", + "ThisFieldIsNotAValidPhoneNumber.": "字段不是有效的手机号码.", "ThisFieldMustBeBetween{0}And{1}": "字段值必须在{0}和{1}范围内.", "ThisFieldMustMatchTheRegularExpression{0}": "字段必须匹配正则表达式'{0}'.", "ThisFieldIsRequired.": "字段不可为空.", diff --git a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/zh-Hant.json b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/zh-Hant.json new file mode 100644 index 0000000000..1e7e419625 --- /dev/null +++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/Localization/zh-Hant.json @@ -0,0 +1,34 @@ +{ + "culture": "zh-Hant", + "texts": { + "'{0}' and '{1}' do not match.": "'{0}'與'{1}'不匹配.", + "The {0} field is not a valid credit card number.": "欄位{0}不是有效的信用卡號碼.", + "{0} is not valid.": "{0}驗證未通過.", + "The {0} field is not a valid e-mail address.": "欄位{0}不是有效的電子郵件地址.", + "The {0} field only accepts files with the following extensions: {1}": "{0}欄位只允許以下副檔名的文件: {1}", + "The field {0} must be a string or array type with a maximum length of '{1}'.": "欄位{0}必須是最大長度為'{1}'的字串或陣列.", + "The field {0} must be a string or array type with a minimum length of '{1}'.": "欄位{0}必須是最小長度為'{1}'的字串或陣列.", + "The {0} field is not a valid phone number.": "欄位{0}不是有效的電話號碼.", + "The field {0} must be between {1} and {2}.": "欄位{0}值必須在{1}和{2}範圍內.", + "The field {0} must match the regular expression '{1}'.": "欄位{0}必須匹配正規表示式'{1}'.", + "The {0} field is required.": "欄位{0}不可為空.", + "The field {0} must be a string with a maximum length of {1}.": "欄位{0}必須是長度為{1}的字串.", + "The field {0} must be a string with a minimum length of {2} and a maximum length of {1}.": "欄位{0}必須是最小長度為{2}並且最大長度{1}的字串.", + "The {0} field is not a valid fully-qualified http, https, or ftp URL.": "欄位{0}不是有效的完全限定的http,https或ftp URL.", + "The field {0} is invalid.": "此欄位{0}是無效值.", + "ThisFieldIsNotAValidCreditCardNumber.": "此欄位不是有效的信用卡號碼.", + "ThisFieldIsNotValid.": "此驗證未通過.", + "ThisFieldIsNotAValidEmailAddress.": "此欄位不是有效的郵箱地址.", + "ThisFieldOnlyAcceptsFilesWithTheFollowingExtensions:{0}": "此欄位只允許以下副檔名的文件: {0}", + "ThisFieldMustBeAStringOrArrayTypeWithAMaximumLengthoOf{0}": "此欄位必須是最大長度為'{0}'的字串或陣列.", + "ThisFieldMustBeAStringOrArrayTypeWithAMinimumLengthOf{0}": "此欄位必須是最小長度為'{0}'的字串或陣列.", + "ThisFieldIsNotAValidPhoneNumber.": "此欄位不是有效的電話號碼.", + "ThisFieldMustBeBetween{0}And{1}": "此欄位值必須在{0}和{1}範圍內.", + "ThisFieldMustMatchTheRegularExpression{0}": "此欄位必須匹配正規表示式'{0}'.", + "ThisFieldIsRequired.": "此欄位不可為空.", + "ThisFieldMustBeAStringWithAMaximumLengthOf{0}": "此欄位必須是長度為{0}的字串.", + "ThisFieldMustBeAStringWithAMinimumLengthOf{1}AndAMaximumLengthOf{0}": "此欄位必須是最小長度為{1}並且最大長度{0}的字串.", + "ThisFieldIsNotAValidFullyQualifiedHttpHttpsOrFtpUrl": "此欄位不是有效的完全限定的http,https或ftp URL.", + "ThisFieldIsInvalid.": "此欄位是無效值." + } +} \ No newline at end of file diff --git a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationHandler.cs b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationHelper.cs similarity index 94% rename from framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationHandler.cs rename to framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationHelper.cs index 5570f04e7d..d46281d2e9 100644 --- a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationHandler.cs +++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationHelper.cs @@ -2,7 +2,7 @@ namespace Volo.Abp.Validation { - public class ValidationHandler + public class ValidationHelper { private const string EmailRegEx = @"[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?"; diff --git a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationInterceptor.cs b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationInterceptor.cs index 24581c54d9..b4ce642471 100644 --- a/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationInterceptor.cs +++ b/framework/src/Volo.Abp.Validation/Volo/Abp/Validation/ValidationInterceptor.cs @@ -16,7 +16,7 @@ namespace Volo.Abp.Validation public override async Task InterceptAsync(IAbpMethodInvocation invocation) { Validate(invocation); - await invocation.ProceedAsync().ConfigureAwait(false); + await invocation.ProceedAsync(); } protected virtual void Validate(IAbpMethodInvocation invocation) diff --git a/framework/src/Volo.Abp.VirtualFileSystem/FodyWeavers.xml b/framework/src/Volo.Abp.VirtualFileSystem/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp.VirtualFileSystem/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.VirtualFileSystem/FodyWeavers.xsd b/framework/src/Volo.Abp.VirtualFileSystem/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp.VirtualFileSystem/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.VirtualFileSystem/Microsoft/Extensions/FileProviders/AbpFileInfoExtensions.cs b/framework/src/Volo.Abp.VirtualFileSystem/Microsoft/Extensions/FileProviders/AbpFileInfoExtensions.cs index 9186e4d9e2..7d3505d616 100644 --- a/framework/src/Volo.Abp.VirtualFileSystem/Microsoft/Extensions/FileProviders/AbpFileInfoExtensions.cs +++ b/framework/src/Volo.Abp.VirtualFileSystem/Microsoft/Extensions/FileProviders/AbpFileInfoExtensions.cs @@ -56,7 +56,7 @@ namespace Microsoft.Extensions.FileProviders using (var stream = fileInfo.CreateReadStream()) { - return await stream.GetAllBytesAsync().ConfigureAwait(false); + return await stream.GetAllBytesAsync(); } } diff --git a/framework/src/Volo.Abp.VirtualFileSystem/Volo.Abp.VirtualFileSystem.csproj b/framework/src/Volo.Abp.VirtualFileSystem/Volo.Abp.VirtualFileSystem.csproj index 512c901b69..2ba15cae3d 100644 --- a/framework/src/Volo.Abp.VirtualFileSystem/Volo.Abp.VirtualFileSystem.csproj +++ b/framework/src/Volo.Abp.VirtualFileSystem/Volo.Abp.VirtualFileSystem.csproj @@ -1,5 +1,6 @@ + diff --git a/framework/src/Volo.Abp/FodyWeavers.xml b/framework/src/Volo.Abp/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/framework/src/Volo.Abp/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp/FodyWeavers.xsd b/framework/src/Volo.Abp/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/framework/src/Volo.Abp/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp/Volo.Abp.csproj b/framework/src/Volo.Abp/Volo.Abp.csproj index b3cf4f5752..37f9ded71c 100644 --- a/framework/src/Volo.Abp/Volo.Abp.csproj +++ b/framework/src/Volo.Abp/Volo.Abp.csproj @@ -1,5 +1,6 @@ - - + + + @@ -16,4 +17,4 @@ - \ No newline at end of file + diff --git a/framework/test/AbpTestBase/AbpTestBase.csproj b/framework/test/AbpTestBase/AbpTestBase.csproj index 566bfde770..e1a625580d 100644 --- a/framework/test/AbpTestBase/AbpTestBase.csproj +++ b/framework/test/AbpTestBase/AbpTestBase.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/SimpleConsoleDemo/Program.cs b/framework/test/SimpleConsoleDemo/Program.cs index 82e6d0a660..3ac0c8b23b 100644 --- a/framework/test/SimpleConsoleDemo/Program.cs +++ b/framework/test/SimpleConsoleDemo/Program.cs @@ -10,7 +10,7 @@ namespace SimpleConsoleDemo { class Program { - static async Task Main(string[] args) + static void Main(string[] args) { using (var application = AbpApplicationFactory.Create(options => { @@ -42,7 +42,6 @@ namespace SimpleConsoleDemo writer.Write(); } - Console.WriteLine(); Console.WriteLine("Press ENTER to exit!"); Console.ReadLine(); diff --git a/framework/test/SimpleConsoleDemo/SimpleConsoleDemo.csproj b/framework/test/SimpleConsoleDemo/SimpleConsoleDemo.csproj index 133f84bd10..6cd2465068 100644 --- a/framework/test/SimpleConsoleDemo/SimpleConsoleDemo.csproj +++ b/framework/test/SimpleConsoleDemo/SimpleConsoleDemo.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/framework/test/Volo.Abp.AspNetCore.Authentication.OAuth.Tests/Volo.Abp.AspNetCore.Authentication.OAuth.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.Authentication.OAuth.Tests/Volo.Abp.AspNetCore.Authentication.OAuth.Tests.csproj index 2e6a7187fd..e1253f04c3 100644 --- a/framework/test/Volo.Abp.AspNetCore.Authentication.OAuth.Tests/Volo.Abp.AspNetCore.Authentication.OAuth.Tests.csproj +++ b/framework/test/Volo.Abp.AspNetCore.Authentication.OAuth.Tests/Volo.Abp.AspNetCore.Authentication.OAuth.Tests.csproj @@ -1,5 +1,5 @@ - - + + diff --git a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo.Abp.AspNetCore.MultiTenancy.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo.Abp.AspNetCore.MultiTenancy.Tests.csproj index 06b6fbcd94..a24f7796c9 100644 --- a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo.Abp.AspNetCore.MultiTenancy.Tests.csproj +++ b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo.Abp.AspNetCore.MultiTenancy.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/App/AppModule.cs b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/App/AppModule.cs index 8ec04b23a6..44e2e38380 100644 --- a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/App/AppModule.cs +++ b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/App/AppModule.cs @@ -41,7 +41,7 @@ namespace Volo.Abp.AspNetCore.App }; var result = jsonSerializer.Serialize(dictionary, camelCase: false); - await ctx.Response.WriteAsync(result).ConfigureAwait(false); + await ctx.Response.WriteAsync(result); }); } } diff --git a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_WithDomainResolver_Tests.cs b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_WithDomainResolver_Tests.cs index 437240971d..e2ac111f5d 100644 --- a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_WithDomainResolver_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_WithDomainResolver_Tests.cs @@ -46,14 +46,14 @@ namespace Volo.Abp.AspNetCore.MultiTenancy [Fact] public async Task Should_Use_Host_If_Tenant_Is_Not_Specified() { - var result = await GetResponseAsObjectAsync>("http://abp.io").ConfigureAwait(false); + var result = await GetResponseAsObjectAsync>("http://abp.io"); result["TenantId"].ShouldBe(""); } [Fact] public async Task Should_Use_Domain_If_Specified() { - var result = await GetResponseAsObjectAsync>("http://acme.abp.io").ConfigureAwait(false); + var result = await GetResponseAsObjectAsync>("http://acme.abp.io"); result["TenantId"].ShouldBe(_testTenantId.ToString()); } @@ -62,7 +62,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy { Client.DefaultRequestHeaders.Add(_options.TenantKey, Guid.NewGuid().ToString()); - var result = await GetResponseAsObjectAsync>("http://acme.abp.io").ConfigureAwait(false); + var result = await GetResponseAsObjectAsync>("http://acme.abp.io"); result["TenantId"].ShouldBe(_testTenantId.ToString()); } } diff --git a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_Without_DomainResolver_Tests.cs b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_Without_DomainResolver_Tests.cs index 64f7ed2892..37365089af 100644 --- a/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_Without_DomainResolver_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.MultiTenancy.Tests/Volo/Abp/AspNetCore/MultiTenancy/AspNetCoreMultiTenancy_Without_DomainResolver_Tests.cs @@ -42,7 +42,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy [Fact] public async Task Should_Use_Host_If_Tenant_Is_Not_Specified() { - var result = await GetResponseAsObjectAsync>("http://abp.io").ConfigureAwait(false); + var result = await GetResponseAsObjectAsync>("http://abp.io"); result["TenantId"].ShouldBe(""); } @@ -50,7 +50,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy public async Task Should_Use_QueryString_Tenant_Id_If_Specified() { - var result = await GetResponseAsObjectAsync>($"http://abp.io?{_options.TenantKey}={_testTenantName}").ConfigureAwait(false); + var result = await GetResponseAsObjectAsync>($"http://abp.io?{_options.TenantKey}={_testTenantName}"); result["TenantId"].ShouldBe(_testTenantId.ToString()); } @@ -59,7 +59,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy { Client.DefaultRequestHeaders.Add(_options.TenantKey, _testTenantId.ToString()); - var result = await GetResponseAsObjectAsync>("http://abp.io").ConfigureAwait(false); + var result = await GetResponseAsObjectAsync>("http://abp.io"); result["TenantId"].ShouldBe(_testTenantId.ToString()); } @@ -68,7 +68,7 @@ namespace Volo.Abp.AspNetCore.MultiTenancy { Client.DefaultRequestHeaders.Add("Cookie", new CookieHeaderValue(_options.TenantKey, _testTenantId.ToString()).ToString()); - var result = await GetResponseAsObjectAsync>("http://abp.io").ConfigureAwait(false); + var result = await GetResponseAsObjectAsync>("http://abp.io"); result["TenantId"].ShouldBe(_testTenantId.ToString()); } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj index 4dad128d56..ddb3f5bc44 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo.Abp.AspNetCore.Mvc.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpApiDefinitionController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpApiDefinitionController_Tests.cs index f141cf89c1..44b206e462 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpApiDefinitionController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpApiDefinitionController_Tests.cs @@ -10,7 +10,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApiExploring [Fact] public async Task GetAsync() { - var model = await GetResponseAsObjectAsync("/api/abp/api-definition").ConfigureAwait(false); + var model = await GetResponseAsObjectAsync("/api/abp/api-definition"); model.ShouldNotBeNull(); } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationConfigurationBuilder_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationConfigurationBuilder_Tests.cs index 590aa1a142..c5f53e4721 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationConfigurationBuilder_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ApplicationConfigurationBuilder_Tests.cs @@ -11,7 +11,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations { var applicationConfigurationBuilder = GetRequiredService(); - var config = await applicationConfigurationBuilder.GetAsync().ConfigureAwait(false); + var config = await applicationConfigurationBuilder.GetAsync(); config.Auth.ShouldNotBeNull(); config.Localization.ShouldNotBeNull(); diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestController.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestController.cs new file mode 100644 index 0000000000..3c8d5dc4db --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestController.cs @@ -0,0 +1,35 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Options; +using Volo.Abp.Auditing; + +namespace Volo.Abp.AspNetCore.Mvc.Auditing +{ + [Route("api/audit-test")] + [Audited] + public class AuditTestController : AbpController + { + private readonly AbpAuditingOptions _options; + + public AuditTestController(IOptions options) + { + _options = options.Value; + } + + [Route("audit-success")] + public IActionResult AuditSuccessForGetRequests() + { + return Ok(); + } + + [Route("audit-fail")] + public IActionResult AuditFailForGetRequests() + { + throw new UserFriendlyException("Exception occurred!"); + } + [Route("audit-fail-object")] + public object AuditFailForGetRequestsReturningObject() + { + throw new UserFriendlyException("Exception occurred!"); + } + } +} diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestController_Tests.cs new file mode 100644 index 0000000000..49bc689e14 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Auditing/AuditTestController_Tests.cs @@ -0,0 +1,65 @@ +using System; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Options; +using NSubstitute; +using System.Threading.Tasks; +using Volo.Abp.Auditing; +using Xunit; + +namespace Volo.Abp.AspNetCore.Mvc.Auditing +{ + public class AuditTestController_Tests : AspNetCoreMvcTestBase + { + private readonly AbpAuditingOptions _options; + private IAuditingStore _auditingStore; + + public AuditTestController_Tests() + { + _options = ServiceProvider.GetRequiredService>().Value; + _auditingStore = ServiceProvider.GetRequiredService(); + } + + protected override void ConfigureServices(HostBuilderContext context, IServiceCollection services) + { + _auditingStore = Substitute.For(); + services.Replace(ServiceDescriptor.Singleton(_auditingStore)); + base.ConfigureServices(context, services); + } + + [Fact] + public async Task Should_Trigger_Middleware_And_AuditLog_Success_For_GetRequests() + { + _options.IsEnabledForGetRequests = true; + _options.AlwaysLogOnException = false; + await GetResponseAsync("api/audit-test/audit-success"); + await _auditingStore.Received().SaveAsync(Arg.Any()); + } + + [Fact] + public async Task Should_Trigger_Middleware_And_AuditLog_Exception_Always() + { + _options.IsEnabled = true; + _options.AlwaysLogOnException = true; + + try + { + await GetResponseAsync("api/audit-test/audit-fail", System.Net.HttpStatusCode.Forbidden); + } + catch { } + + await _auditingStore.Received().SaveAsync(Arg.Any()); + } + [Fact] + public async Task Should_Trigger_Middleware_And_AuditLog_Exception_When_Returns_Object() + { + _options.IsEnabled = true; + _options.AlwaysLogOnException = true; + + await GetResponseAsync("api/audit-test/audit-fail-object", System.Net.HttpStatusCode.Forbidden); + + await _auditingStore.Received().SaveAsync(Arg.Any()); + } + } +} diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Authorization/AuthTestController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Authorization/AuthTestController_Tests.cs index 2937fd6759..8caf59d0c0 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Authorization/AuthTestController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Authorization/AuthTestController_Tests.cs @@ -29,7 +29,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Authorization [Fact] public async Task Should_Call_Anonymous_Method_Without_Authentication() { - var result = await GetResponseAsStringAsync("/AuthTest/AnonymousTest").ConfigureAwait(false); + var result = await GetResponseAsStringAsync("/AuthTest/AnonymousTest"); result.ShouldBe("OK"); } @@ -41,7 +41,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Authorization new Claim(AbpClaimTypes.UserId, AuthTestController.FakeUserId.ToString()) }); - var result = await GetResponseAsStringAsync("/AuthTest/SimpleAuthorizationTest").ConfigureAwait(false); + var result = await GetResponseAsStringAsync("/AuthTest/SimpleAuthorizationTest"); result.ShouldBe("OK"); } @@ -54,7 +54,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Authorization new Claim("MyCustomClaimType", "42") }); - var result = await GetResponseAsStringAsync("/AuthTest/CustomPolicyTest").ConfigureAwait(false); + var result = await GetResponseAsStringAsync("/AuthTest/CustomPolicyTest"); result.ShouldBe("OK"); } @@ -70,7 +70,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Authorization //TODO: We can get a real exception if we properly configure authentication schemas for this project await Assert.ThrowsAsync(async () => await GetResponseAsStringAsync("/AuthTest/CustomPolicyTest") -.ConfigureAwait(false)).ConfigureAwait(false); + ); } [Fact] @@ -81,7 +81,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Authorization new Claim(AbpClaimTypes.UserId, AuthTestController.FakeUserId.ToString()) }); - var result = await GetResponseAsStringAsync("/AuthTest/PermissionTest").ConfigureAwait(false); + var result = await GetResponseAsStringAsync("/AuthTest/PermissionTest"); result.ShouldBe("OK"); } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Authorization/FakeAuthenticationMiddleware.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Authorization/FakeAuthenticationMiddleware.cs index 1952ef22b9..b9caa1d7cb 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Authorization/FakeAuthenticationMiddleware.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Authorization/FakeAuthenticationMiddleware.cs @@ -26,7 +26,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Authorization }); } - await next(context).ConfigureAwait(false); + await next(context); } } } \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/ExceptionTestController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/ExceptionTestController_Tests.cs index 1d11103c6f..5243307116 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/ExceptionTestController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/ExceptionTestController_Tests.cs @@ -11,7 +11,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ExceptionHandling [Fact] public async Task Should_Return_RemoteServiceErrorResponse_For_UserFriendlyException_For_Void_Return_Value() { - var result = await GetResponseAsObjectAsync("/api/exception-test/UserFriendlyException1", HttpStatusCode.Forbidden).ConfigureAwait(false); + var result = await GetResponseAsObjectAsync("/api/exception-test/UserFriendlyException1", HttpStatusCode.Forbidden); result.Error.ShouldNotBeNull(); result.Error.Message.ShouldBe("This is a sample exception!"); } @@ -23,7 +23,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ExceptionHandling async () => await GetResponseAsObjectAsync( "/api/exception-test/UserFriendlyException2" ) -.ConfigureAwait(false)).ConfigureAwait(false); + ); } } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Features/FeatureTestController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Features/FeatureTestController_Tests.cs index 8b8ad14da4..c017841548 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Features/FeatureTestController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Features/FeatureTestController_Tests.cs @@ -10,8 +10,8 @@ namespace Volo.Abp.AspNetCore.Mvc.Features public async Task Should_Allow_Enabled_Features() { await GetResponseAsStringAsync( - "/api/feature-test/allowed-feature" - ).ConfigureAwait(false); + "/api/feature-test/allowed-feature", HttpStatusCode.NoContent + ); } [Fact] @@ -20,7 +20,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Features await GetResponseAsStringAsync( "/api/feature-test/not-allowed-feature", HttpStatusCode.Unauthorized - ).ConfigureAwait(false); + ); } [Fact] @@ -28,7 +28,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Features { await GetResponseAsStringAsync( "/api/feature-test/no-feature" - ).ConfigureAwait(false); + ); } } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Json/JsonResultController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Json/JsonResultController_Tests.cs index eeb47ea0a3..3e365cde3e 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Json/JsonResultController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Json/JsonResultController_Tests.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Json { var time = await GetResponseAsStringAsync( "/api/json-result-test/json-result-action" - ).ConfigureAwait(false); + ); time.ShouldContain("2019*01*01"); } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/MvcLocalization_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/MvcLocalization_Tests.cs index 2f5ad74df9..4d9a4f4624 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/MvcLocalization_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/MvcLocalization_Tests.cs @@ -27,7 +27,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Localization [Fact] public async Task Should_Get_Same_Text_If_Not_Defined_In_Razor_View() { - var result = await GetResponseAsStringAsync("/LocalizationTest/HelloJohn").ConfigureAwait(false); + var result = await GetResponseAsStringAsync("/LocalizationTest/HelloJohn"); result.ShouldBe("Hello John."); } @@ -36,13 +36,13 @@ namespace Volo.Abp.AspNetCore.Mvc.Localization { using (CultureHelper.Use("en")) { - var result = await GetResponseAsStringAsync("/LocalizationTest/PersonForm").ConfigureAwait(false); + var result = await GetResponseAsStringAsync("/LocalizationTest/PersonForm"); result.ShouldContain(""); } using (CultureHelper.Use("tr")) { - var result = await GetResponseAsStringAsync("/LocalizationTest/PersonForm").ConfigureAwait(false); + var result = await GetResponseAsStringAsync("/LocalizationTest/PersonForm"); result.ShouldContain(""); } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/Resource/zh-Hant.json b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/Resource/zh-Hant.json new file mode 100644 index 0000000000..c70842f0b2 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Localization/Resource/zh-Hant.json @@ -0,0 +1,7 @@ +{ + "culture": "zh-Hant", + "texts": { + "BirthDate": "生日", + "Value1": "值1" + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ModelBinding/ModelBindingController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ModelBinding/ModelBindingController_Tests.cs index 45f8410eee..632a02194f 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ModelBinding/ModelBindingController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ModelBinding/ModelBindingController_Tests.cs @@ -21,10 +21,10 @@ namespace Volo.Abp.AspNetCore.Mvc.ModelBinding [Fact] public async Task DateTimeKind_Test() { - var response = await Client.GetAsync("/api/model-Binding-test/DateTimeKind?input=2010-01-01T00:00:00Z").ConfigureAwait(false); + var response = await Client.GetAsync("/api/model-Binding-test/DateTimeKind?input=2010-01-01T00:00:00Z"); response.StatusCode.ShouldBe(HttpStatusCode.OK); - var resultAsString = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + var resultAsString = await response.Content.ReadAsStringAsync(); resultAsString.ShouldBe(DateTimeKind.ToString().ToLower()); } @@ -32,10 +32,10 @@ namespace Volo.Abp.AspNetCore.Mvc.ModelBinding public async Task NullableDateTimeKind_Test() { var response = - await Client.GetAsync("/api/model-Binding-test/NullableDateTimeKind?input=2010-01-01T00:00:00Z").ConfigureAwait(false); + await Client.GetAsync("/api/model-Binding-test/NullableDateTimeKind?input=2010-01-01T00:00:00Z"); response.StatusCode.ShouldBe(HttpStatusCode.OK); - var resultAsString = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + var resultAsString = await response.Content.ReadAsStringAsync(); resultAsString.ShouldBe(DateTimeKind.ToString().ToLower()); } @@ -44,10 +44,10 @@ namespace Volo.Abp.AspNetCore.Mvc.ModelBinding { var response = await Client.GetAsync( - "/api/model-Binding-test/DisableDateTimeNormalizationDateTimeKind?input=2010-01-01T00:00:00Z").ConfigureAwait(false); + "/api/model-Binding-test/DisableDateTimeNormalizationDateTimeKind?input=2010-01-01T00:00:00Z"); response.StatusCode.ShouldBe(HttpStatusCode.OK); - var resultAsString = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + var resultAsString = await response.Content.ReadAsStringAsync(); //Time parameter(2010-01-01T00:00:00Z) with time zone information, so the default Kind is Local. resultAsString.ShouldBe(DateTimeKind.Local.ToString().ToLower()); } @@ -57,10 +57,10 @@ namespace Volo.Abp.AspNetCore.Mvc.ModelBinding { var response = await Client.GetAsync( - "/api/model-Binding-test/DisableDateTimeNormalizationNullableDateTimeKind?input=2010-01-01T00:00:00Z").ConfigureAwait(false); + "/api/model-Binding-test/DisableDateTimeNormalizationNullableDateTimeKind?input=2010-01-01T00:00:00Z"); response.StatusCode.ShouldBe(HttpStatusCode.OK); - var resultAsString = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + var resultAsString = await response.Content.ReadAsStringAsync(); //Time parameter(2010-01-01T00:00:00Z) with time zone information, so the default Kind is Local. resultAsString.ShouldBe(DateTimeKind.Local.ToString().ToLower()); } @@ -72,10 +72,10 @@ namespace Volo.Abp.AspNetCore.Mvc.ModelBinding "Time1=2010-01-01T00:00:00Z&" + "Time2=2010-01-01T00:00:00Z&" + "Time3=2010-01-01T00:00:00Z&" + - "InnerModel.Time4=2010-01-01T00:00:00Z").ConfigureAwait(false); + "InnerModel.Time4=2010-01-01T00:00:00Z"); response.StatusCode.ShouldBe(HttpStatusCode.OK); - var resultAsString = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + var resultAsString = await response.Content.ReadAsStringAsync(); //Time parameter(2010-01-01T00:00:00Z) with time zone information, so the default Kind is Local. resultAsString.ShouldBe( $"local_{DateTimeKind.ToString().ToLower()}_{DateTimeKind.ToString().ToLower()}_local"); diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PeopleAppService_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PeopleAppService_Tests.cs index c3c90d02f7..96a79d8971 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PeopleAppService_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/PeopleAppService_Tests.cs @@ -35,7 +35,7 @@ namespace Volo.Abp.AspNetCore.Mvc [Fact] public async Task GetAll_Test() { - var result = await GetResponseAsObjectAsync>("/api/app/people").ConfigureAwait(false); + var result = await GetResponseAsObjectAsync>("/api/app/people"); result.Items.Count.ShouldBeGreaterThan(0); } @@ -44,7 +44,7 @@ namespace Volo.Abp.AspNetCore.Mvc { var firstPerson = (await _personRepository.GetListAsync()).First(); - var result = await GetResponseAsObjectAsync($"/api/app/people/{firstPerson.Id}").ConfigureAwait(false); + var result = await GetResponseAsObjectAsync($"/api/app/people/{firstPerson.Id}"); result.Name.ShouldBe(firstPerson.Name); } @@ -53,9 +53,9 @@ namespace Volo.Abp.AspNetCore.Mvc { var firstPerson = (await _personRepository.GetListAsync()).First(); - await Client.DeleteAsync($"/api/app/people/{firstPerson.Id}").ConfigureAwait(false); + await Client.DeleteAsync($"/api/app/people/{firstPerson.Id}"); - (await _personRepository.FindAsync(firstPerson.Id).ConfigureAwait(false)).ShouldBeNull(); + (await _personRepository.FindAsync(firstPerson.Id)).ShouldBeNull(); } [Fact] @@ -68,10 +68,10 @@ namespace Volo.Abp.AspNetCore.Mvc var response = await Client.PostAsync( "/api/app/people", new StringContent(postData, Encoding.UTF8, MimeTypes.Application.Json) - ).ConfigureAwait(false); + ); response.StatusCode.ShouldBe(HttpStatusCode.OK); - var resultAsString = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + var resultAsString = await response.Content.ReadAsStringAsync(); PersonDto resultDto = _jsonSerializer.Deserialize(resultAsString); //Assert @@ -80,7 +80,7 @@ namespace Volo.Abp.AspNetCore.Mvc resultDto.Name.ShouldBe("John"); resultDto.Age.ShouldBe(33); - (await _personRepository.FindAsync(resultDto.Id).ConfigureAwait(false)).ShouldNotBeNull(); + (await _personRepository.FindAsync(resultDto.Id)).ShouldNotBeNull(); } @@ -100,10 +100,10 @@ namespace Volo.Abp.AspNetCore.Mvc var response = await Client.PutAsync( $"/api/app/people/{updateDto.Id}", new StringContent(putData, Encoding.UTF8, MimeTypes.Application.Json) - ).ConfigureAwait(false); + ); response.StatusCode.ShouldBe(HttpStatusCode.OK); - var resultAsString = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + var resultAsString = await response.Content.ReadAsStringAsync(); PersonDto resultDto = _jsonSerializer.Deserialize(resultAsString); //Assert @@ -112,7 +112,7 @@ namespace Volo.Abp.AspNetCore.Mvc resultDto.Name.ShouldBe(firstPerson.Name); resultDto.Age.ShouldBe(firstPersonAge + 1); - var personInDb = (await _personRepository.FindAsync(resultDto.Id).ConfigureAwait(false)); + var personInDb = (await _personRepository.FindAsync(resultDto.Id)); personInDb.ShouldNotBeNull(); personInDb.Name.ShouldBe(firstPerson.Name); personInDb.Age.ShouldBe(firstPersonAge + 1); @@ -133,10 +133,10 @@ namespace Volo.Abp.AspNetCore.Mvc var response = await Client.PostAsync( $"/api/app/people/{personToAddNewPhone.Id}/phones", new StringContent(postData, Encoding.UTF8, MimeTypes.Application.Json) - ).ConfigureAwait(false); + ); response.StatusCode.ShouldBe(HttpStatusCode.OK); - var resultAsString = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + var resultAsString = await response.Content.ReadAsStringAsync(); var resultDto = _jsonSerializer.Deserialize(resultAsString); //Assert @@ -144,7 +144,7 @@ namespace Volo.Abp.AspNetCore.Mvc resultDto.Type.ShouldBe(PhoneType.Mobile); resultDto.Number.ShouldBe(phoneNumberToAdd); - var personInDb = await _personRepository.FindAsync(personToAddNewPhone.Id).ConfigureAwait(false); + var personInDb = await _personRepository.FindAsync(personToAddNewPhone.Id); personInDb.ShouldNotBeNull(); personInDb.Phones.Any(p => p.Number == phoneNumberToAdd).ShouldBeTrue(); } @@ -154,7 +154,7 @@ namespace Volo.Abp.AspNetCore.Mvc { var douglas = (await _personRepository.GetListAsync()).First(p => p.Name == "Douglas"); - var result = await GetResponseAsObjectAsync>($"/api/app/people/{douglas.Id}/phones").ConfigureAwait(false); + var result = await GetResponseAsObjectAsync>($"/api/app/people/{douglas.Id}/phones"); result.Items.Count.ShouldBe(douglas.Phones.Count); } @@ -164,7 +164,7 @@ namespace Volo.Abp.AspNetCore.Mvc var douglas = (await _personRepository.GetListAsync()).First(p => p.Name == "Douglas"); var firstPhone = douglas.Phones.First(); - await Client.DeleteAsync($"/api/app/people/{douglas.Id}/phones?number={firstPhone.Number}").ConfigureAwait(false); + await Client.DeleteAsync($"/api/app/people/{douglas.Id}/phones?number={firstPhone.Number}"); douglas = (await _personRepository.GetListAsync()).First(p => p.Name == "Douglas"); douglas.Phones.Any(p => p.Number == firstPhone.Number).ShouldBeFalse(); diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ProxyScripting/AbpServiceProxiesController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ProxyScripting/AbpServiceProxiesController_Tests.cs index 2af719ae4d..c7dce93b3a 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ProxyScripting/AbpServiceProxiesController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/ProxyScripting/AbpServiceProxiesController_Tests.cs @@ -10,7 +10,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ProxyScripting [Fact] public async Task GetAll() { - var script = await GetResponseAsStringAsync("/Abp/ServiceProxyScript?minify=true").ConfigureAwait(false); + var script = await GetResponseAsStringAsync("/Abp/ServiceProxyScript?minify=true"); script.Length.ShouldBeGreaterThan(0); } @@ -18,10 +18,10 @@ namespace Volo.Abp.AspNetCore.Mvc.ProxyScripting public async Task GetAllWithMinify() { GetRequiredService>().Value.MinifyGeneratedScript = false; - var script = await GetResponseAsStringAsync("/Abp/ServiceProxyScript").ConfigureAwait(false); + var script = await GetResponseAsStringAsync("/Abp/ServiceProxyScript"); GetRequiredService>().Value.MinifyGeneratedScript = true; - var minifyScript = await GetResponseAsStringAsync("/Abp/ServiceProxyScript?minify=true").ConfigureAwait(false); + var minifyScript = await GetResponseAsStringAsync("/Abp/ServiceProxyScript?minify=true"); script.Length.ShouldBeGreaterThan(0); minifyScript.Length.ShouldBeGreaterThan(0); diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Response/NoContentTestController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Response/NoContentTestController_Tests.cs index 6c68c13f07..0002a4801b 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Response/NoContentTestController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Response/NoContentTestController_Tests.cs @@ -11,7 +11,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Response public async Task Should_Set_No_Content_For_Void_Action() { var result = await GetResponseAsync("/api/NoContent-Test/TestMethod", HttpStatusCode.NoContent) - .ConfigureAwait(false); + ; result.StatusCode.ShouldBe(HttpStatusCode.NoContent); } @@ -19,7 +19,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Response public async Task Should_Not_Set_No_Content_For_Not_Void_Action() { var result = await GetResponseAsync("/api/NoContent-Test/TestMethodWithReturn") - .ConfigureAwait(false); + ; result.StatusCode.ShouldBe(HttpStatusCode.OK); } @@ -27,7 +27,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Response public async Task Should_Not_Set_No_Content_For_Custom_Http_Status_Code_Action() { var result = await GetResponseAsync("/api/NoContent-Test/TestCustomHttpStatusCodeMethod", HttpStatusCode.Redirect) - .ConfigureAwait(false); + ; result.StatusCode.ShouldBe(HttpStatusCode.Redirect); } @@ -35,7 +35,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Response public async Task Should_Set_No_Content_For_Task_Action() { var result = await GetResponseAsync("/api/NoContent-Test/TestAsyncMethod", HttpStatusCode.NoContent) - .ConfigureAwait(false); + ; result.StatusCode.ShouldBe(HttpStatusCode.NoContent); } @@ -43,7 +43,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Response public async Task Should_Not_Set_No_Content_For_Not_Task_Action() { var result = await GetResponseAsync("/api/NoContent-Test/TestAsyncMethodWithReturn") - .ConfigureAwait(false); + ; result.StatusCode.ShouldBe(HttpStatusCode.OK); } @@ -51,7 +51,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Response public async Task Should_Not_Set_No_Content_For_Custom_Http_Status_Code_Async_Action() { var result = await GetResponseAsync("/api/NoContent-Test/TestAsyncCustomHttpStatusCodeMethod", HttpStatusCode.Redirect) - .ConfigureAwait(false); + ; result.StatusCode.ShouldBe(HttpStatusCode.Redirect); } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/SimpleController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/SimpleController_Tests.cs index aa111be2f8..cda64b2323 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/SimpleController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/SimpleController_Tests.cs @@ -13,7 +13,7 @@ namespace Volo.Abp.AspNetCore.Mvc { var result = await GetResponseAsStringAsync( GetUrl(nameof(SimpleController.Index)) - ).ConfigureAwait(false); + ); result.ShouldBe("Index-Result"); } @@ -23,7 +23,7 @@ namespace Volo.Abp.AspNetCore.Mvc { var result = await GetResponseAsStringAsync( GetUrl(nameof(SimpleController.About)) - ).ConfigureAwait(false); + ); result.Trim().ShouldBe("

    About

    "); } @@ -35,8 +35,8 @@ namespace Volo.Abp.AspNetCore.Mvc { await GetResponseAsStringAsync( GetUrl(nameof(SimpleController.ExceptionOnRazor)) - ).ConfigureAwait(false); - }).ConfigureAwait(false); + ); + }); } } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkMiddleware_Exception_Rollback_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkMiddleware_Exception_Rollback_Tests.cs index 81d1c88bee..6400ecb88e 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkMiddleware_Exception_Rollback_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkMiddleware_Exception_Rollback_Tests.cs @@ -14,7 +14,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow [Fact] public async Task Should_Rollback_Transaction_For_Handled_Exceptions() { - var result = await GetResponseAsObjectAsync("/api/unitofwork-test/HandledException", HttpStatusCode.Forbidden).ConfigureAwait(false); + var result = await GetResponseAsObjectAsync("/api/unitofwork-test/HandledException", HttpStatusCode.Forbidden); result.Error.ShouldNotBeNull(); result.Error.Message.ShouldBe("This is a sample exception!"); } @@ -22,11 +22,11 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow [Fact] public async Task Should_Gracefully_Handle_Exceptions_On_Complete() { - var response = await GetResponseAsync("/api/unitofwork-test/ExceptionOnComplete", HttpStatusCode.Forbidden).ConfigureAwait(false); + var response = await GetResponseAsync("/api/unitofwork-test/ExceptionOnComplete", HttpStatusCode.Forbidden); response.Headers.GetValues(AbpHttpConsts.AbpErrorFormat).FirstOrDefault().ShouldBe("true"); - var resultAsString = await response.Content.ReadAsStringAsync().ConfigureAwait(false); + var resultAsString = await response.Content.ReadAsStringAsync(); var result = ServiceProvider.GetRequiredService().Deserialize(resultAsString); diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkMiddleware_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkMiddleware_Tests.cs index 192d1f0e06..abd666e3f5 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkMiddleware_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Uow/UnitOfWorkMiddleware_Tests.cs @@ -9,13 +9,13 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow [Fact] public async Task Get_Actions_Should_Not_Be_Transactional() { - await GetResponseAsStringAsync("/api/unitofwork-test/ActionRequiresUow").ConfigureAwait(false); + await GetResponseAsStringAsync("/api/unitofwork-test/ActionRequiresUow"); } [Fact] public async Task Non_Get_Actions_Should_Be_Transactional() { - var result = await Client.PostAsync("/api/unitofwork-test/ActionRequiresUowPost", null).ConfigureAwait(false); + var result = await Client.PostAsync("/api/unitofwork-test/ActionRequiresUowPost", null); result.IsSuccessStatusCode.ShouldBeTrue(); } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Validation/ValidationTestController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Validation/ValidationTestController_Tests.cs index 9d5cbfa012..361db7845a 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Validation/ValidationTestController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/Validation/ValidationTestController_Tests.cs @@ -12,14 +12,14 @@ namespace Volo.Abp.AspNetCore.Mvc.Validation [Fact] public async Task Should_Validate_Object_Result_Success() { - var result = await GetResponseAsStringAsync("/api/validation-test/object-result-action?value1=hello").ConfigureAwait(false); + var result = await GetResponseAsStringAsync("/api/validation-test/object-result-action?value1=hello"); result.ShouldBe("hello"); } [Fact] public async Task Should_Validate_Object_Result_Failing() { - var result = await GetResponseAsObjectAsync("/api/validation-test/object-result-action?value1=a", HttpStatusCode.BadRequest).ConfigureAwait(false); //value1 has min length of 2 chars. + var result = await GetResponseAsObjectAsync("/api/validation-test/object-result-action?value1=a", HttpStatusCode.BadRequest); //value1 has min length of 2 chars. result.Error.ValidationErrors.Length.ShouldBeGreaterThan(0); } @@ -28,7 +28,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Validation { using (CultureHelper.Use("tr")) { - var result = await GetResponseAsObjectAsync("/api/validation-test/object-result-action?value1=a", HttpStatusCode.BadRequest).ConfigureAwait(false); //value1 has min length of 2 chars. + var result = await GetResponseAsObjectAsync("/api/validation-test/object-result-action?value1=a", HttpStatusCode.BadRequest); //value1 has min length of 2 chars. result.Error.ValidationErrors.Length.ShouldBeGreaterThan(0); result.Error.ValidationErrors[0].Message.ShouldBe("Değer Bir alanı en az '2' uzunluğunda bir metin ya da dizi olmalıdır."); } @@ -37,14 +37,14 @@ namespace Volo.Abp.AspNetCore.Mvc.Validation [Fact] public async Task Should_Not_Validate_Action_Result_Success() { - var result = await GetResponseAsStringAsync("/api/validation-test/action-result-action?value1=hello").ConfigureAwait(false); + var result = await GetResponseAsStringAsync("/api/validation-test/action-result-action?value1=hello"); result.ShouldBe("ModelState.IsValid: true"); } [Fact] public async Task Should_Not_Validate_Action_Result_Failing() { - var result = await GetResponseAsStringAsync("/api/validation-test/action-result-action").ConfigureAwait(false); //Missed the value1 + var result = await GetResponseAsStringAsync("/api/validation-test/action-result-action"); //Missed the value1 result.ShouldBe("ModelState.IsValid: false"); } @@ -52,7 +52,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Validation public async Task Should_Return_Custom_Validate_Errors() { var result = await GetResponseAsObjectAsync( - "/api/validation-test/object-result-action-with-custom_validate?value1=abc", HttpStatusCode.BadRequest).ConfigureAwait(false); //value1 should be hello. + "/api/validation-test/object-result-action-with-custom_validate?value1=abc", HttpStatusCode.BadRequest); //value1 should be hello. result.Error.ValidationErrors.Length.ShouldBeGreaterThan(0); result.Error.ValidationErrors.ShouldContain(x => x.Message == "Value1 should be hello"); diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests.csproj index 8a76a15f5d..53e92dc13a 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests.csproj +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo/Abp/AspNetCore/Mvc/UI/Bootstrap/Demo/Components/Card_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo/Abp/AspNetCore/Mvc/UI/Bootstrap/Demo/Components/Card_Tests.cs index 89d9028fc4..9fcac03459 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo/Abp/AspNetCore/Mvc/UI/Bootstrap/Demo/Components/Card_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Tests/Volo/Abp/AspNetCore/Mvc/UI/Bootstrap/Demo/Components/Card_Tests.cs @@ -9,7 +9,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.Components [Fact(Skip = "This test project is not completed yet")] public async Task Index() { - var result = await GetResponseAsStringAsync("/Components/Cards").ConfigureAwait(false); + var result = await GetResponseAsStringAsync("/Components/Cards"); result.ShouldNotBeNullOrEmpty(); } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj index 3384fcf332..f0301e04fe 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo/Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.Demo.csproj @@ -1,4 +1,4 @@ - + @@ -9,7 +9,7 @@ - + diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo.Abp.AspNetCore.Mvc.UI.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo.Abp.AspNetCore.Mvc.UI.Tests.csproj index 0a19e5dbdf..fb8b7abd07 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo.Abp.AspNetCore.Mvc.UI.Tests.csproj +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.UI.Tests/Volo.Abp.AspNetCore.Mvc.UI.Tests.csproj @@ -1,5 +1,5 @@ - - + + diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo.Abp.AspNetCore.Mvc.Versioning.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo.Abp.AspNetCore.Mvc.Versioning.Tests.csproj index 9ed9312919..1d3fbf892f 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo.Abp.AspNetCore.Mvc.Versioning.Tests.csproj +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo.Abp.AspNetCore.Mvc.Versioning.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/HelloController_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/HelloController_Tests.cs index a5db492a39..0dc4057bde 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/HelloController_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/HelloController_Tests.cs @@ -18,19 +18,19 @@ namespace Volo.Abp.AspNetCore.Mvc.Versioning.Test [Fact] public async Task GetAsync() { - (await _helloController.GetAsync().ConfigureAwait(false)).ShouldBe("Get-2.0"); + (await _helloController.GetAsync()).ShouldBe("Get-2.0"); } [Fact] public async Task PostAsyncV1() { - (await _helloController.PostAsyncV1().ConfigureAwait(false)).ShouldBe("Post-1.0"); + (await _helloController.PostAsyncV1()).ShouldBe("Post-1.0"); } [Fact] public async Task PostAsyncV2() { - (await _helloController.PostAsyncV2().ConfigureAwait(false)).ShouldBe("Post-2.0"); + (await _helloController.PostAsyncV2()).ShouldBe("Post-2.0"); } } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v1/TodoAppService_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v1/TodoAppService_Tests.cs index 4db9f235be..f5b86cf7d7 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v1/TodoAppService_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v1/TodoAppService_Tests.cs @@ -18,7 +18,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Versioning.Test.v1 [Fact] public async Task GetAsync() { - (await _todoAppService.GetAsync(42).ConfigureAwait(false)).ShouldBe("Compat-42-1.0"); + (await _todoAppService.GetAsync(42)).ShouldBe("Compat-42-1.0"); } } } diff --git a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v2/TodoAppService_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v2/TodoAppService_Tests.cs index 2bfecc2664..d6b681aa2e 100644 --- a/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v2/TodoAppService_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Mvc.Versioning.Tests/Volo/Abp/AspNetCore/Mvc/Versioning/Test/v2/TodoAppService_Tests.cs @@ -18,7 +18,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Versioning.Test.v2 [Fact] public async Task GetAsync() { - (await _todoAppService.GetAsync(42).ConfigureAwait(false)).ShouldBe("42-2.0"); + (await _todoAppService.GetAsync(42)).ShouldBe("42-2.0"); } } } diff --git a/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo.Abp.AspNetCore.Serilog.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo.Abp.AspNetCore.Serilog.Tests.csproj new file mode 100644 index 0000000000..02cf2264a4 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo.Abp.AspNetCore.Serilog.Tests.csproj @@ -0,0 +1,24 @@ + + + + + + netcoreapp3.1 + Volo.Abp.AspNetCore.Serilog.Tests + Volo.Abp.AspNetCore.Serilog.Tests + + + + + + + + + + + + + + + + diff --git a/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/App/AbpSerilogTestModule.cs b/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/App/AbpSerilogTestModule.cs new file mode 100644 index 0000000000..557288cd7d --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/App/AbpSerilogTestModule.cs @@ -0,0 +1,39 @@ +using Microsoft.AspNetCore.Builder; +using Volo.Abp.AspNetCore.MultiTenancy; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Serilog; +using Volo.Abp.AspNetCore.TestBase; +using Volo.Abp.Autofac; +using Volo.Abp.Modularity; +using Volo.Abp.MultiTenancy; + +namespace Volo.Abp.AspNetCore.App +{ + [DependsOn( + typeof(AbpAspNetCoreTestBaseModule), + typeof(AbpAspNetCoreMvcModule), + typeof(AbpAspNetCoreMultiTenancyModule), + typeof(AbpAspNetCoreSerilogModule), + typeof(AbpAutofacModule) + )] + public class AbpSerilogTestModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + Configure(options => { options.IsEnabled = true; }); + } + + public override void OnApplicationInitialization(ApplicationInitializationContext context) + { + var app = context.GetApplicationBuilder(); + + app.UseCorrelationId(); + app.UseRouting(); + app.UseAuthorization(); + app.UseMultiTenancy(); + app.UseAuditing(); + app.UseAbpSerilogEnrichers(); + app.UseMvcWithDefaultRouteAndArea(); + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/App/CollectingSink.cs b/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/App/CollectingSink.cs new file mode 100644 index 0000000000..fe403e02ef --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/App/CollectingSink.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using System.Linq; +using Serilog.Core; +using Serilog.Events; + +namespace Volo.Abp.AspNetCore.App +{ + public class CollectingSink : ILogEventSink + { + public List Events { get; } = new List(); + + public LogEvent SingleEvent => Events.Single(); + + public void Emit(LogEvent logEvent) + { + Events.Add(logEvent); + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/App/SerilogTestController.cs b/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/App/SerilogTestController.cs new file mode 100644 index 0000000000..972af4c801 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/App/SerilogTestController.cs @@ -0,0 +1,27 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.Tracing; + +namespace Volo.Abp.AspNetCore.App +{ + public class SerilogTestController : AbpController + { + private readonly ICorrelationIdProvider _correlationIdProvider; + + public SerilogTestController(ICorrelationIdProvider correlationIdProvider) + { + _correlationIdProvider = correlationIdProvider; + } + + public ActionResult Index() + { + return Content("Index-Result"); + } + + public ActionResult CorrelationId() + { + return Content(_correlationIdProvider.Get()); + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/App/Startup.cs b/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/App/Startup.cs new file mode 100644 index 0000000000..a1a58100d5 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/App/Startup.cs @@ -0,0 +1,20 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Logging; + +namespace Volo.Abp.AspNetCore.App +{ + public class Startup + { + public void ConfigureServices(IServiceCollection services) + { + services.AddApplication(); + } + + public void Configure(IApplicationBuilder app, IWebHostEnvironment env,ILoggerFactory loggerFactory) + { + app.InitializeApplication(); + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/Serilog/AbpSerilogTestBase.cs b/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/Serilog/AbpSerilogTestBase.cs new file mode 100644 index 0000000000..96a13ac45b --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/Serilog/AbpSerilogTestBase.cs @@ -0,0 +1,31 @@ +using System.Linq; +using Microsoft.Extensions.Hosting; +using Serilog; +using Serilog.Events; +using Volo.Abp.AspNetCore.App; + +namespace Volo.Abp.AspNetCore.Serilog +{ + public class AbpSerilogTestBase : AbpAspNetCoreTestBase + { + protected readonly CollectingSink CollectingSink = new CollectingSink(); + + protected override IHostBuilder CreateHostBuilder() + { + Log.Logger = new LoggerConfiguration() + .MinimumLevel.Information() + .MinimumLevel.Override("Microsoft", LogEventLevel.Information) + .Enrich.FromLogContext() + .WriteTo.Sink(CollectingSink) + .CreateLogger(); + + return base.CreateHostBuilder() + .UseSerilog(); + } + + protected LogEvent GetLogEvent(string text) + { + return CollectingSink.Events.FirstOrDefault(m => m.MessageTemplate.Text == text); + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/Serilog/Serilog_Enrichers_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/Serilog/Serilog_Enrichers_Tests.cs new file mode 100644 index 0000000000..77de765f51 --- /dev/null +++ b/framework/test/Volo.Abp.AspNetCore.Serilog.Tests/Volo/Abp/AspNetCore/Serilog/Serilog_Enrichers_Tests.cs @@ -0,0 +1,97 @@ +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using Serilog.Events; +using Shouldly; +using Volo.Abp.AspNetCore.App; +using Volo.Abp.AspNetCore.MultiTenancy; +using Volo.Abp.MultiTenancy; +using Volo.Abp.MultiTenancy.ConfigurationStore; +using Xunit; + +namespace Volo.Abp.AspNetCore.Serilog +{ + public class Serilog_Enrichers_Tests : AbpSerilogTestBase + { + private const string ExecutedEndpointLogEventText = "Executed endpoint '{EndpointName}'"; + + private readonly Guid _testTenantId = Guid.NewGuid(); + private readonly string _testTenantName = "acme"; + + private readonly AbpAspNetCoreMultiTenancyOptions _tenancyOptions; + private readonly AbpAspNetCoreSerilogOptions _serilogOptions; + private readonly ILogger _logger; + + public Serilog_Enrichers_Tests() + { + _tenancyOptions = ServiceProvider.GetRequiredService>().Value; + _serilogOptions = + ServiceProvider.GetRequiredService>().Value; + _logger = ServiceProvider.GetRequiredService>(); + } + + protected override IHostBuilder CreateHostBuilder() + { + return base.CreateHostBuilder().ConfigureServices(services => + { + services.Configure(options => + { + options.Tenants = new[] + { + new TenantConfiguration(_testTenantId, _testTenantName) + }; + }); + }); + } + + [Fact] + public async Task TenantId_Not_Set_Test() + { + var url = GetUrl(nameof(SerilogTestController.Index)); + var result = await GetResponseAsStringAsync(url); + + var executedLogEvent = GetLogEvent(ExecutedEndpointLogEventText); + + executedLogEvent.ShouldNotBeNull(); + executedLogEvent.Properties.ContainsKey(_serilogOptions.EnricherPropertyNames.TenantId) + .ShouldBe(false); + } + + [Fact] + public async Task TenantId_Set_Test() + { + var url = + GetUrl(nameof(SerilogTestController.Index)) + + $"?{_tenancyOptions.TenantKey}={_testTenantName}"; + var result = await GetResponseAsStringAsync(url); + + var executedLogEvent = GetLogEvent(ExecutedEndpointLogEventText); + + executedLogEvent.ShouldNotBeNull(); + executedLogEvent.Properties.ContainsKey(_serilogOptions.EnricherPropertyNames.TenantId) + .ShouldBe(true); + ((ScalarValue) executedLogEvent.Properties[_serilogOptions.EnricherPropertyNames.TenantId]).Value + .ShouldBe(_testTenantId); + } + + [Fact] + public async Task CorrelationId_Enrichers_Test() + { + var url = GetUrl(nameof(SerilogTestController.CorrelationId)); + var result = await GetResponseAsStringAsync(url); + + var executedLogEvent = GetLogEvent(ExecutedEndpointLogEventText); + + executedLogEvent.ShouldNotBeNull(); + + executedLogEvent.Properties.ContainsKey(_serilogOptions.EnricherPropertyNames.CorrelationId) + .ShouldNotBeNull(); + + ((ScalarValue) executedLogEvent.Properties[_serilogOptions.EnricherPropertyNames.CorrelationId]).Value + .ShouldBe(result); + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.AspNetCore.Tests/Volo.Abp.AspNetCore.Tests.csproj b/framework/test/Volo.Abp.AspNetCore.Tests/Volo.Abp.AspNetCore.Tests.csproj index dd8b1fc805..8dc3153efb 100644 --- a/framework/test/Volo.Abp.AspNetCore.Tests/Volo.Abp.AspNetCore.Tests.csproj +++ b/framework/test/Volo.Abp.AspNetCore.Tests/Volo.Abp.AspNetCore.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/AbpAspNetCoreTestBase.cs b/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/AbpAspNetCoreTestBase.cs index 2c647d0556..dd5edff807 100644 --- a/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/AbpAspNetCoreTestBase.cs +++ b/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/AbpAspNetCoreTestBase.cs @@ -26,15 +26,15 @@ namespace Volo.Abp.AspNetCore protected virtual async Task GetResponseAsObjectAsync(string url, HttpStatusCode expectedStatusCode = HttpStatusCode.OK) { - var strResponse = await GetResponseAsStringAsync(url, expectedStatusCode).ConfigureAwait(false); + var strResponse = await GetResponseAsStringAsync(url, expectedStatusCode); return JsonConvert.DeserializeObject(strResponse, SharedJsonSerializerSettings); } protected virtual async Task GetResponseAsStringAsync(string url, HttpStatusCode expectedStatusCode = HttpStatusCode.OK) { - using (var response = await GetResponseAsync(url, expectedStatusCode).ConfigureAwait(false)) + using (var response = await GetResponseAsync(url, expectedStatusCode)) { - return await response.Content.ReadAsStringAsync().ConfigureAwait(false); + return await response.Content.ReadAsStringAsync(); } } @@ -43,7 +43,7 @@ namespace Volo.Abp.AspNetCore using (var requestMessage = new HttpRequestMessage(HttpMethod.Get, url)) { requestMessage.Headers.Add("Accept-Language", CultureInfo.CurrentUICulture.Name); - var response = await Client.SendAsync(requestMessage).ConfigureAwait(false); + var response = await Client.SendAsync(requestMessage); response.StatusCode.ShouldBe(expectedStatusCode); return response; } diff --git a/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/VirtualFileSystem/VirtualFileSystem_Tests.cs b/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/VirtualFileSystem/VirtualFileSystem_Tests.cs index 88399bd9a7..142d44baec 100644 --- a/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/VirtualFileSystem/VirtualFileSystem_Tests.cs +++ b/framework/test/Volo.Abp.AspNetCore.Tests/Volo/Abp/AspNetCore/VirtualFileSystem/VirtualFileSystem_Tests.cs @@ -11,7 +11,7 @@ namespace Volo.Abp.AspNetCore.VirtualFileSystem { var result = await GetResponseAsStringAsync( "/SampleFiles/test1.js" - ).ConfigureAwait(false); + ); result.ShouldBe("test1.js-content"); } diff --git a/framework/test/Volo.Abp.Auditing.Tests/Volo.Abp.Auditing.Tests.csproj b/framework/test/Volo.Abp.Auditing.Tests/Volo.Abp.Auditing.Tests.csproj index 770ad82870..d7c8d84149 100644 --- a/framework/test/Volo.Abp.Auditing.Tests/Volo.Abp.Auditing.Tests.csproj +++ b/framework/test/Volo.Abp.Auditing.Tests/Volo.Abp.Auditing.Tests.csproj @@ -1,5 +1,5 @@ - - + + @@ -11,10 +11,12 @@ + + - + diff --git a/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/AbpAuditingTestBase.cs b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/AbpAuditingTestBase.cs new file mode 100644 index 0000000000..6d61ea10e5 --- /dev/null +++ b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/AbpAuditingTestBase.cs @@ -0,0 +1,12 @@ +using Volo.Abp.Testing; + +namespace Volo.Abp.Auditing +{ + public class AbpAuditingTestBase : AbpIntegratedTest + { + protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options) + { + options.UseAutofac(); + } + } +} diff --git a/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/AbpAuditingTestModule.cs b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/AbpAuditingTestModule.cs new file mode 100644 index 0000000000..077658ab83 --- /dev/null +++ b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/AbpAuditingTestModule.cs @@ -0,0 +1,64 @@ +using Microsoft.Data.Sqlite; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Auditing.App.Entities; +using Volo.Abp.Auditing.App.EntityFrameworkCore; +using Volo.Abp.Autofac; +using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.Modularity; + +namespace Volo.Abp.Auditing +{ + [DependsOn( + typeof(AbpTestBaseModule), + typeof(AbpAutofacModule), + typeof(AbpEntityFrameworkCoreModule) + )] + public class AbpAuditingTestModule : AbpModule + { + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddAbpDbContext(options => + { + options.AddDefaultRepositories(true); + }); + + var sqliteConnection = CreateDatabaseAndGetConnection(); + + Configure(options => + { + options.Configure(abpDbContextConfigurationContext => + { + abpDbContextConfigurationContext.DbContextOptions.UseSqlite(sqliteConnection); + }); + }); + + Configure(options => + { + options.EntityHistorySelectors.Add( + new NamedTypeSelector( + "AppEntityWithSelector", + type => type == typeof(AppEntityWithSelector)) + ); + }); + + context.Services.AddType(); + } + + private static SqliteConnection CreateDatabaseAndGetConnection() + { + var connection = new SqliteConnection("Data Source=:memory:"); + connection.Open(); + + using (var context = new AbpAuditingTestDbContext(new DbContextOptionsBuilder() + .UseSqlite(connection).Options)) + { + context.GetService().CreateTables(); + } + + return connection; + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/Entities/AppEntityWithAudited.cs b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/Entities/AppEntityWithAudited.cs new file mode 100644 index 0000000000..6c206aea54 --- /dev/null +++ b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/Entities/AppEntityWithAudited.cs @@ -0,0 +1,22 @@ +using System; +using Volo.Abp.Domain.Entities; + +namespace Volo.Abp.Auditing.App.Entities +{ + [Audited] + public class AppEntityWithAudited : AggregateRoot + { + protected AppEntityWithAudited() + { + + } + + public AppEntityWithAudited(Guid id, string name) + : base(id) + { + Name = name; + } + + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/Entities/AppEntityWithAuditedAndPropertyHasDisableAuditing.cs b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/Entities/AppEntityWithAuditedAndPropertyHasDisableAuditing.cs new file mode 100644 index 0000000000..c35372a688 --- /dev/null +++ b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/Entities/AppEntityWithAuditedAndPropertyHasDisableAuditing.cs @@ -0,0 +1,26 @@ +using System; +using Volo.Abp.Domain.Entities; + +namespace Volo.Abp.Auditing.App.Entities +{ + [Audited] + public class AppEntityWithAuditedAndPropertyHasDisableAuditing : AggregateRoot + { + protected AppEntityWithAuditedAndPropertyHasDisableAuditing() + { + + } + + public AppEntityWithAuditedAndPropertyHasDisableAuditing(Guid id, string name, string name2) + : base(id) + { + Name = name; + Name2 = name2; + } + + public string Name { get; set; } + + [DisableAuditing] + public string Name2 { get; set; } + } +} diff --git a/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/Entities/AppEntityWithDisableAuditing.cs b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/Entities/AppEntityWithDisableAuditing.cs new file mode 100644 index 0000000000..446733ec98 --- /dev/null +++ b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/Entities/AppEntityWithDisableAuditing.cs @@ -0,0 +1,22 @@ +using System; +using Volo.Abp.Domain.Entities; + +namespace Volo.Abp.Auditing.App.Entities +{ + [DisableAuditing] + public class AppEntityWithDisableAuditing : AggregateRoot + { + protected AppEntityWithDisableAuditing() + { + + } + + public AppEntityWithDisableAuditing(Guid id, string name) + : base(id) + { + Name = name; + } + + public string Name { get; set; } + } +} diff --git a/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/Entities/AppEntityWithDisableAuditingAndPropertyHasAudited.cs b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/Entities/AppEntityWithDisableAuditingAndPropertyHasAudited.cs new file mode 100644 index 0000000000..28a98bac8e --- /dev/null +++ b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/Entities/AppEntityWithDisableAuditingAndPropertyHasAudited.cs @@ -0,0 +1,26 @@ +using System; +using Volo.Abp.Domain.Entities; + +namespace Volo.Abp.Auditing.App.Entities +{ + [DisableAuditing] + public class AppEntityWithDisableAuditingAndPropertyHasAudited : AggregateRoot + { + protected AppEntityWithDisableAuditingAndPropertyHasAudited() + { + + } + + public AppEntityWithDisableAuditingAndPropertyHasAudited(Guid id, string name, string name2) + : base(id) + { + Name = name; + Name2 = name2; + } + + [Audited] + public string Name { get; set; } + + public string Name2 { get; set; } + } +} diff --git a/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/Entities/AppEntityWithPropertyHasAudited.cs b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/Entities/AppEntityWithPropertyHasAudited.cs new file mode 100644 index 0000000000..53207cc27c --- /dev/null +++ b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/Entities/AppEntityWithPropertyHasAudited.cs @@ -0,0 +1,22 @@ +using System; +using Volo.Abp.Domain.Entities; + +namespace Volo.Abp.Auditing.App.Entities +{ + public class AppEntityWithPropertyHasAudited : AggregateRoot + { + protected AppEntityWithPropertyHasAudited() + { + + } + + public AppEntityWithPropertyHasAudited(Guid id, string name) + : base(id) + { + Name = name; + } + + [Audited] + public string Name { get; set; } + } +} diff --git a/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/Entities/AppEntityWithSelector.cs b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/Entities/AppEntityWithSelector.cs new file mode 100644 index 0000000000..6c4269a8c2 --- /dev/null +++ b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/Entities/AppEntityWithSelector.cs @@ -0,0 +1,16 @@ +using System; +using Volo.Abp.Domain.Entities; + +namespace Volo.Abp.Auditing.App.Entities +{ + public class AppEntityWithSelector : AggregateRoot + { + public AppEntityWithSelector(Guid id, string name) + : base(id) + { + Name = name; + } + + public string Name { get; set; } + } +} diff --git a/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/EntityFrameworkCore/AbpAuditingTestDbContext.cs b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/EntityFrameworkCore/AbpAuditingTestDbContext.cs new file mode 100644 index 0000000000..0968bf2cc2 --- /dev/null +++ b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/App/EntityFrameworkCore/AbpAuditingTestDbContext.cs @@ -0,0 +1,27 @@ +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Auditing.App.Entities; +using Volo.Abp.EntityFrameworkCore; + +namespace Volo.Abp.Auditing.App.EntityFrameworkCore +{ + public class AbpAuditingTestDbContext : AbpDbContext + { + public DbSet AppEntityWithAudited { get; set; } + + public DbSet AppEntityWithAuditedAndPropertyHasDisableAuditing { get; set; } + + public DbSet AppEntityWithDisableAuditing { get; set; } + + public DbSet AppEntityWithDisableAuditingAndPropertyHasAudited { get; set; } + + public DbSet AppEntityWithPropertyHasAudited { get; set; } + + public DbSet AppEntityWithSelector { get; set; } + + public AbpAuditingTestDbContext(DbContextOptions options) + : base(options) + { + + } + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/AuditingInterceptor_Tests.cs b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/AuditingInterceptor_Tests.cs deleted file mode 100644 index 516310b781..0000000000 --- a/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/AuditingInterceptor_Tests.cs +++ /dev/null @@ -1,93 +0,0 @@ -using System.Threading.Tasks; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.DependencyInjection.Extensions; -using NSubstitute; -using Volo.Abp.Autofac; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Modularity; -using Volo.Abp.Testing; -using Xunit; - -namespace Volo.Abp.Auditing -{ - public class AuditingInterceptor_Tests : AbpIntegratedTest - { - private IAuditingStore _auditingStore; - private IAuditingManager _auditingManager; - - public AuditingInterceptor_Tests() - { - _auditingManager = GetRequiredService(); - } - - protected override void SetAbpApplicationCreationOptions(AbpApplicationCreationOptions options) - { - options.UseAutofac(); - } - - protected override void AfterAddApplication(IServiceCollection services) - { - _auditingStore = Substitute.For(); - services.Replace(ServiceDescriptor.Singleton(_auditingStore)); - } - - [Fact] - public async Task Should_Write_AuditLog_For_Classes_That_Implement_IAuditingEnabled() - { - var myAuditedObject1 = GetRequiredService(); - - using (var scope = _auditingManager.BeginScope()) - { - await myAuditedObject1.DoItAsync(new InputObject { Value1 = "forty-two", Value2 = 42 }).ConfigureAwait(false); - await scope.SaveAsync().ConfigureAwait(false); - } - -#pragma warning disable 4014 - _auditingStore.Received().SaveAsync(Arg.Any()); -#pragma warning restore 4014 - } - - [DependsOn( - typeof(AbpAuditingModule), - typeof(AbpAutofacModule) - )] - public class TestModule : AbpModule - { - public override void ConfigureServices(ServiceConfigurationContext context) - { - context.Services.AddType(); - } - } - - public interface IMyAuditedObject : ITransientDependency, IAuditingEnabled - { - - } - - public class MyAuditedObject1 : IMyAuditedObject - { - public async virtual Task DoItAsync(InputObject inputObject) - { - return new ResultObject - { - Value1 = inputObject.Value1 + "-result", - Value2 = inputObject.Value2 + 1 - }; - } - } - - public class ResultObject - { - public string Value1 { get; set; } - - public int Value2 { get; set; } - } - - public class InputObject - { - public string Value1 { get; set; } - - public int Value2 { get; set; } - } - } -} diff --git a/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/Auditing_Tests.cs b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/Auditing_Tests.cs new file mode 100644 index 0000000000..bc41f3bcde --- /dev/null +++ b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/Auditing_Tests.cs @@ -0,0 +1,173 @@ +using System; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; +using NSubstitute; +using Volo.Abp.Auditing.App.Entities; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Repositories; +using Xunit; + +namespace Volo.Abp.Auditing +{ + public class Auditing_Tests : AbpAuditingTestBase + { + private IAuditingStore _auditingStore; + private IAuditingManager _auditingManager; + + public Auditing_Tests() + { + _auditingManager = GetRequiredService(); + } + + protected override void AfterAddApplication(IServiceCollection services) + { + _auditingStore = Substitute.For(); + services.Replace(ServiceDescriptor.Singleton(_auditingStore)); + } + + [Fact] + public async Task Should_Write_AuditLog_For_Classes_That_Implement_IAuditingEnabled() + { + var myAuditedObject1 = GetRequiredService(); + + using (var scope = _auditingManager.BeginScope()) + { + await myAuditedObject1.DoItAsync(new InputObject { Value1 = "forty-two", Value2 = 42 }).ConfigureAwait(false); + await scope.SaveAsync().ConfigureAwait(false); + } + +#pragma warning disable 4014 + _auditingStore.Received().SaveAsync(Arg.Any()); +#pragma warning restore 4014 + } + + public interface IMyAuditedObject : ITransientDependency, IAuditingEnabled + { + + } + + public class MyAuditedObject1 : IMyAuditedObject + { + public async virtual Task DoItAsync(InputObject inputObject) + { + return new ResultObject + { + Value1 = inputObject.Value1 + "-result", + Value2 = inputObject.Value2 + 1 + }; + } + } + + public class ResultObject + { + public string Value1 { get; set; } + + public int Value2 { get; set; } + } + + public class InputObject + { + public string Value1 { get; set; } + + public int Value2 { get; set; } + } + + [Fact] + public virtual async Task Should_Write_AuditLog_For_Entity_That_Has_Audited_Attribute() + { + using (var scope = _auditingManager.BeginScope()) + { + var repository = ServiceProvider.GetRequiredService>(); + await repository.InsertAsync(new AppEntityWithAudited(Guid.NewGuid(), "test name")).ConfigureAwait(false); + await scope.SaveAsync().ConfigureAwait(false); + } + +#pragma warning disable 4014 + _auditingStore.Received().SaveAsync(Arg.Any()); +#pragma warning restore 4014 + } + + [Fact] + public virtual async Task Should_Not_Write_AuditLog_For_Property_That_Has_DisableAuditing_Attribute() + { + using (var scope = _auditingManager.BeginScope()) + { + var repository = ServiceProvider.GetRequiredService>(); + await repository.InsertAsync(new AppEntityWithAuditedAndPropertyHasDisableAuditing(Guid.NewGuid(), "test name", "test name2")).ConfigureAwait(false); + await scope.SaveAsync().ConfigureAwait(false); + } + +#pragma warning disable 4014 + _auditingStore.Received().SaveAsync(Arg.Is(x => + x.EntityChanges.Count == 1 && + !(x.EntityChanges[0].PropertyChanges.Any(p => + p.PropertyName == nameof(AppEntityWithDisableAuditingAndPropertyHasAudited.Name2))))); +#pragma warning restore 4014 + } + + [Fact] + public virtual async Task Should_Not_Write_AuditLog_For_Entity_That_Has_DisableAuditing_Attribute() + { + using (var scope = _auditingManager.BeginScope()) + { + var repository = ServiceProvider.GetRequiredService>(); + await repository.InsertAsync(new AppEntityWithDisableAuditing(Guid.NewGuid(), "test name")).ConfigureAwait(false); + await scope.SaveAsync().ConfigureAwait(false); + } + +#pragma warning disable 4014 + _auditingStore.DidNotReceive().SaveAsync(Arg.Any()); +#pragma warning restore 4014 + } + + [Fact] + public virtual async Task Should_Write_AuditLog_For_Entity_That_Meet_Selectors() + { + using (var scope = _auditingManager.BeginScope()) + { + var repository = ServiceProvider.GetRequiredService>(); + await repository.InsertAsync(new AppEntityWithSelector(Guid.NewGuid(), "test name")).ConfigureAwait(false); + await scope.SaveAsync().ConfigureAwait(false); + } + +#pragma warning disable 4014 + _auditingStore.Received().SaveAsync(Arg.Any()); +#pragma warning restore 4014 + } + + [Fact] + public virtual async Task Should_Write_AuditLog_For_Entity_That_Property_Has_Audited_Attribute() + { + using (var scope = _auditingManager.BeginScope()) + { + var repository = ServiceProvider.GetRequiredService>(); + await repository.InsertAsync(new AppEntityWithPropertyHasAudited(Guid.NewGuid(), "test name")).ConfigureAwait(false); + await scope.SaveAsync().ConfigureAwait(false); + } + +#pragma warning disable 4014 + _auditingStore.Received().SaveAsync(Arg.Any()); +#pragma warning restore 4014 + } + + [Fact] + public virtual async Task Should_Write_AuditLog_For_Entity_That_Property_Has_Audited_Attribute_Even_Entity_Has_DisableAuditing_Attribute() + { + using (var scope = _auditingManager.BeginScope()) + { + var repository = ServiceProvider.GetRequiredService>(); + await repository.InsertAsync(new AppEntityWithDisableAuditingAndPropertyHasAudited(Guid.NewGuid(), "test name", "test name2")).ConfigureAwait(false); + await scope.SaveAsync().ConfigureAwait(false); + } + +#pragma warning disable 4014 + _auditingStore.Received().SaveAsync(Arg.Is(x => + x.EntityChanges.Count == 1 && x.EntityChanges[0].PropertyChanges.Count == 1 && + x.EntityChanges[0].PropertyChanges[0].PropertyName == + nameof(AppEntityWithDisableAuditingAndPropertyHasAudited.Name))); +#pragma warning restore 4014 + } + } +} diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo.Abp.Authorization.Tests.csproj b/framework/test/Volo.Abp.Authorization.Tests/Volo.Abp.Authorization.Tests.csproj index 5abc0fc670..3249de2c50 100644 --- a/framework/test/Volo.Abp.Authorization.Tests/Volo.Abp.Authorization.Tests.csproj +++ b/framework/test/Volo.Abp.Authorization.Tests/Volo.Abp.Authorization.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/Authorization_Tests.cs b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/Authorization_Tests.cs index 2950c7c92a..104d75c11b 100644 --- a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/Authorization_Tests.cs +++ b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/Authorization_Tests.cs @@ -22,8 +22,8 @@ namespace Volo.Abp.Authorization { await Assert.ThrowsAsync(async () => { - await _myAuthorizedService1.ProtectedByClass().ConfigureAwait(false); - }).ConfigureAwait(false); + await _myAuthorizedService1.ProtectedByClass(); + }); } [Fact] @@ -31,20 +31,20 @@ namespace Volo.Abp.Authorization { await Assert.ThrowsAsync(async () => { - await _myAuthorizedService1.ProtectedByClassAsync().ConfigureAwait(false); - }).ConfigureAwait(false); + await _myAuthorizedService1.ProtectedByClassAsync(); + }); } [Fact] public async Task Should_Allow_To_Call_Anonymous_Method() { - (await _myAuthorizedService1.Anonymous().ConfigureAwait(false)).ShouldBe(42); + (await _myAuthorizedService1.Anonymous()).ShouldBe(42); } [Fact] public async Task Should_Allow_To_Call_Anonymous_Method_Async() { - (await _myAuthorizedService1.AnonymousAsync().ConfigureAwait(false)).ShouldBe(42); + (await _myAuthorizedService1.AnonymousAsync()).ShouldBe(42); } [Fact] diff --git a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/MyAuthorizedService1.cs b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/MyAuthorizedService1.cs index 6d64ed80dd..b1b2a4c43f 100644 --- a/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/MyAuthorizedService1.cs +++ b/framework/test/Volo.Abp.Authorization.Tests/Volo/Abp/Authorization/TestServices/MyAuthorizedService1.cs @@ -16,7 +16,7 @@ namespace Volo.Abp.Authorization.TestServices [AllowAnonymous] public virtual async Task AnonymousAsync() { - await Task.Delay(10).ConfigureAwait(false); + await Task.Delay(10); return 42; } @@ -27,7 +27,7 @@ namespace Volo.Abp.Authorization.TestServices public virtual async Task ProtectedByClassAsync() { - await Task.Delay(10).ConfigureAwait(false); + await Task.Delay(10); return 42; } } diff --git a/framework/test/Volo.Abp.AutoMapper.Tests/Volo.Abp.AutoMapper.Tests.csproj b/framework/test/Volo.Abp.AutoMapper.Tests/Volo.Abp.AutoMapper.Tests.csproj index 4bf0661800..acdd6fac6b 100644 --- a/framework/test/Volo.Abp.AutoMapper.Tests/Volo.Abp.AutoMapper.Tests.csproj +++ b/framework/test/Volo.Abp.AutoMapper.Tests/Volo.Abp.AutoMapper.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -15,4 +15,4 @@ - \ No newline at end of file + diff --git a/framework/test/Volo.Abp.Autofac.Tests/Volo.Abp.Autofac.Tests.csproj b/framework/test/Volo.Abp.Autofac.Tests/Volo.Abp.Autofac.Tests.csproj index bbbee3bbbb..7854d82b82 100644 --- a/framework/test/Volo.Abp.Autofac.Tests/Volo.Abp.Autofac.Tests.csproj +++ b/framework/test/Volo.Abp.Autofac.Tests/Volo.Abp.Autofac.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -17,4 +17,4 @@ - \ No newline at end of file + diff --git a/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo.Abp.BackgroundJobs.Tests.csproj b/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo.Abp.BackgroundJobs.Tests.csproj index b352c05455..c8763de75d 100644 --- a/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo.Abp.BackgroundJobs.Tests.csproj +++ b/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo.Abp.BackgroundJobs.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -16,4 +16,4 @@ - \ No newline at end of file + diff --git a/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/BackgroundJobExecuter_Tests.cs b/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/BackgroundJobExecuter_Tests.cs index 81c76f2559..50d90d0196 100644 --- a/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/BackgroundJobExecuter_Tests.cs +++ b/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/BackgroundJobExecuter_Tests.cs @@ -23,7 +23,7 @@ namespace Volo.Abp.BackgroundJobs //Act - _backgroundJobExecuter.Execute( + await _backgroundJobExecuter.ExecuteAsync( new JobExecutionContext( ServiceProvider, typeof(MyJob), @@ -46,7 +46,7 @@ namespace Volo.Abp.BackgroundJobs //Act - _backgroundJobExecuter.Execute( + await _backgroundJobExecuter.ExecuteAsync( new JobExecutionContext( ServiceProvider, typeof(MyAsyncJob), diff --git a/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/BackgroundJobManager_Tests.cs b/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/BackgroundJobManager_Tests.cs index 2cd76620ff..3a84e38df1 100644 --- a/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/BackgroundJobManager_Tests.cs +++ b/framework/test/Volo.Abp.BackgroundJobs.Tests/Volo/Abp/BackgroundJobs/BackgroundJobManager_Tests.cs @@ -19,17 +19,17 @@ namespace Volo.Abp.BackgroundJobs [Fact] public async Task Should_Store_Jobs() { - var jobIdAsString = await _backgroundJobManager.EnqueueAsync(new MyJobArgs("42")).ConfigureAwait(false); + var jobIdAsString = await _backgroundJobManager.EnqueueAsync(new MyJobArgs("42")); jobIdAsString.ShouldNotBe(default); - (await _backgroundJobStore.FindAsync(Guid.Parse(jobIdAsString)).ConfigureAwait(false)).ShouldNotBeNull(); + (await _backgroundJobStore.FindAsync(Guid.Parse(jobIdAsString))).ShouldNotBeNull(); } [Fact] public async Task Should_Store_Async_Jobs() { - var jobIdAsString = await _backgroundJobManager.EnqueueAsync(new MyAsyncJobArgs("42")).ConfigureAwait(false); + var jobIdAsString = await _backgroundJobManager.EnqueueAsync(new MyAsyncJobArgs("42")); jobIdAsString.ShouldNotBe(default); - (await _backgroundJobStore.FindAsync(Guid.Parse(jobIdAsString)).ConfigureAwait(false)).ShouldNotBeNull(); + (await _backgroundJobStore.FindAsync(Guid.Parse(jobIdAsString))).ShouldNotBeNull(); } } } diff --git a/framework/test/Volo.Abp.Caching.Tests/Volo.Abp.Caching.Tests.csproj b/framework/test/Volo.Abp.Caching.Tests/Volo.Abp.Caching.Tests.csproj index 4301d8c1f4..698278ee4c 100644 --- a/framework/test/Volo.Abp.Caching.Tests/Volo.Abp.Caching.Tests.csproj +++ b/framework/test/Volo.Abp.Caching.Tests/Volo.Abp.Caching.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_ConfigureOptions_Test.cs b/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_ConfigureOptions_Test.cs index d3afb3addf..0a0509df6c 100644 --- a/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_ConfigureOptions_Test.cs +++ b/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_ConfigureOptions_Test.cs @@ -26,7 +26,7 @@ namespace Volo.Abp.Caching var cacheKey = Guid.NewGuid().ToString(); //Get (not exists yet) - var cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); + var cacheItem = await personCache.GetAsync(cacheKey); cacheItem.ShouldBeNull(); GetDefaultCachingOptions(personCache).SlidingExpiration.ShouldBe(TimeSpan.FromMinutes(20)); diff --git a/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_Tests.cs b/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_Tests.cs index 3db7fa9aaf..14677a73bd 100644 --- a/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_Tests.cs +++ b/framework/test/Volo.Abp.Caching.Tests/Volo/Abp/Caching/DistributedCache_Tests.cs @@ -17,28 +17,28 @@ namespace Volo.Abp.Caching const string personName = "john nash"; //Get (not exists yet) - var cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); + var cacheItem = await personCache.GetAsync(cacheKey); cacheItem.ShouldBeNull(); //Set cacheItem = new PersonCacheItem(personName); - await personCache.SetAsync(cacheKey, cacheItem).ConfigureAwait(false); + await personCache.SetAsync(cacheKey, cacheItem); //Get (it should be available now - cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); + cacheItem = await personCache.GetAsync(cacheKey); cacheItem.ShouldNotBeNull(); cacheItem.Name.ShouldBe(personName); //Remove - await personCache.RemoveAsync(cacheKey).ConfigureAwait(false); + await personCache.RemoveAsync(cacheKey); //Get (not exists since removed) - cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); + cacheItem = await personCache.GetAsync(cacheKey); cacheItem.ShouldBeNull(); } [Fact] - public async Task GetOrAddAsync() + public void GetOrAdd() { var personCache = GetRequiredService>(); @@ -49,12 +49,12 @@ namespace Volo.Abp.Caching bool factoryExecuted = false; - var cacheItem = await personCache.GetOrAddAsync(cacheKey, - async () => + var cacheItem = personCache.GetOrAdd(cacheKey, + () => { factoryExecuted = true; return new PersonCacheItem(personName); - }).ConfigureAwait(false); + }); factoryExecuted.ShouldBeTrue(); cacheItem.Name.ShouldBe(personName); @@ -63,12 +63,12 @@ namespace Volo.Abp.Caching factoryExecuted = false; - cacheItem = await personCache.GetOrAddAsync(cacheKey, - async () => + cacheItem = personCache.GetOrAdd(cacheKey, + () => { factoryExecuted = true; return new PersonCacheItem(personName); - }).ConfigureAwait(false); + }); factoryExecuted.ShouldBeFalse(); cacheItem.Name.ShouldBe(personName); @@ -85,41 +85,41 @@ namespace Volo.Abp.Caching const string personName = "john nash"; //Get (not exists yet) - var cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); + var cacheItem = await personCache.GetAsync(cacheKey); cacheItem.ShouldBeNull(); - var cacheItem1 = await otherPersonCache.GetAsync(cacheKey).ConfigureAwait(false); + var cacheItem1 = await otherPersonCache.GetAsync(cacheKey); cacheItem1.ShouldBeNull(); //Set cacheItem = new PersonCacheItem(personName); - await personCache.SetAsync(cacheKey, cacheItem).ConfigureAwait(false); + await personCache.SetAsync(cacheKey, cacheItem); //Get (it should be available now, but otherPersonCache not exists now. - cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); + cacheItem = await personCache.GetAsync(cacheKey); cacheItem.ShouldNotBeNull(); cacheItem.Name.ShouldBe(personName); - cacheItem1 = await otherPersonCache.GetAsync(cacheKey).ConfigureAwait(false); + cacheItem1 = await otherPersonCache.GetAsync(cacheKey); cacheItem1.ShouldBeNull(); //set other person cache cacheItem1 = new Sail.Testing.Caching.PersonCacheItem(personName); - await otherPersonCache.SetAsync(cacheKey, cacheItem1).ConfigureAwait(false); + await otherPersonCache.SetAsync(cacheKey, cacheItem1); - cacheItem1 = await otherPersonCache.GetAsync(cacheKey).ConfigureAwait(false); + cacheItem1 = await otherPersonCache.GetAsync(cacheKey); cacheItem1.ShouldNotBeNull(); cacheItem1.Name.ShouldBe(personName); //Remove - await personCache.RemoveAsync(cacheKey).ConfigureAwait(false); + await personCache.RemoveAsync(cacheKey); //Get (not exists since removed) - cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); + cacheItem = await personCache.GetAsync(cacheKey); cacheItem.ShouldBeNull(); - cacheItem1 = await otherPersonCache.GetAsync(cacheKey).ConfigureAwait(false); + cacheItem1 = await otherPersonCache.GetAsync(cacheKey); cacheItem1.ShouldNotBeNull(); } @@ -133,23 +133,23 @@ namespace Volo.Abp.Caching const string personName = "john nash"; //Get (not exists yet) - var cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); + var cacheItem = await personCache.GetAsync(cacheKey); cacheItem.ShouldBeNull(); //Set cacheItem = new PersonCacheItem(personName); - await personCache.SetAsync(cacheKey, cacheItem).ConfigureAwait(false); + await personCache.SetAsync(cacheKey, cacheItem); //Get (it should be available now - cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); + cacheItem = await personCache.GetAsync(cacheKey); cacheItem.ShouldNotBeNull(); cacheItem.Name.ShouldBe(personName); //Remove - await personCache.RemoveAsync(cacheKey).ConfigureAwait(false); + await personCache.RemoveAsync(cacheKey); //Get (not exists since removed) - cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); + cacheItem = await personCache.GetAsync(cacheKey); cacheItem.ShouldBeNull(); } @@ -165,12 +165,12 @@ namespace Volo.Abp.Caching bool factoryExecuted = false; - var cacheItem = await personCache.GetOrAddAsync(cacheKey, - async () => + var cacheItem = personCache.GetOrAdd(cacheKey, + () => { factoryExecuted = true; return new PersonCacheItem(personName); - }).ConfigureAwait(false); + }); factoryExecuted.ShouldBeTrue(); cacheItem.Name.ShouldBe(personName); @@ -184,7 +184,7 @@ namespace Volo.Abp.Caching { factoryExecuted = true; return new PersonCacheItem(personName); - }).ConfigureAwait(false); + }); factoryExecuted.ShouldBeFalse(); cacheItem.Name.ShouldBe(personName); @@ -201,41 +201,41 @@ namespace Volo.Abp.Caching const string personName = "john nash"; //Get (not exists yet) - var cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); + var cacheItem = await personCache.GetAsync(cacheKey); cacheItem.ShouldBeNull(); - var cacheItem1 = await otherPersonCache.GetAsync(cacheKey).ConfigureAwait(false); + var cacheItem1 = await otherPersonCache.GetAsync(cacheKey); cacheItem1.ShouldBeNull(); //Set cacheItem = new PersonCacheItem(personName); - await personCache.SetAsync(cacheKey, cacheItem).ConfigureAwait(false); + await personCache.SetAsync(cacheKey, cacheItem); //Get (it should be available now, but otherPersonCache not exists now. - cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); + cacheItem = await personCache.GetAsync(cacheKey); cacheItem.ShouldNotBeNull(); cacheItem.Name.ShouldBe(personName); - cacheItem1 = await otherPersonCache.GetAsync(cacheKey).ConfigureAwait(false); + cacheItem1 = await otherPersonCache.GetAsync(cacheKey); cacheItem1.ShouldBeNull(); //set other person cache cacheItem1 = new Sail.Testing.Caching.PersonCacheItem(personName); - await otherPersonCache.SetAsync(cacheKey, cacheItem1).ConfigureAwait(false); + await otherPersonCache.SetAsync(cacheKey, cacheItem1); - cacheItem1 = await otherPersonCache.GetAsync(cacheKey).ConfigureAwait(false); + cacheItem1 = await otherPersonCache.GetAsync(cacheKey); cacheItem1.ShouldNotBeNull(); cacheItem1.Name.ShouldBe(personName); //Remove - await personCache.RemoveAsync(cacheKey).ConfigureAwait(false); + await personCache.RemoveAsync(cacheKey); //Get (not exists since removed) - cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); + cacheItem = await personCache.GetAsync(cacheKey); cacheItem.ShouldBeNull(); - cacheItem1 = await otherPersonCache.GetAsync(cacheKey).ConfigureAwait(false); + cacheItem1 = await otherPersonCache.GetAsync(cacheKey); cacheItem1.ShouldNotBeNull(); } @@ -249,23 +249,23 @@ namespace Volo.Abp.Caching const string personName = "john nash"; //Get (not exists yet) - var cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); + var cacheItem = await personCache.GetAsync(cacheKey); cacheItem.ShouldBeNull(); //Set cacheItem = new PersonCacheItem(personName); - await personCache.SetAsync(cacheKey, cacheItem).ConfigureAwait(false); + await personCache.SetAsync(cacheKey, cacheItem); //Get (it should be available now - cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); + cacheItem = await personCache.GetAsync(cacheKey); cacheItem.ShouldNotBeNull(); cacheItem.Name.ShouldBe(personName); //Remove - await personCache.RemoveAsync(cacheKey).ConfigureAwait(false); + await personCache.RemoveAsync(cacheKey); //Get (not exists since removed) - cacheItem = await personCache.GetAsync(cacheKey).ConfigureAwait(false); + cacheItem = await personCache.GetAsync(cacheKey); cacheItem.ShouldBeNull(); } @@ -279,34 +279,34 @@ namespace Volo.Abp.Caching const string personName = "john nash"; //Get (not exists yet) - var cacheItem1 = await personCache.GetAsync(cache1Key).ConfigureAwait(false); - var cacheItem2 = await personCache.GetAsync(cache2Key).ConfigureAwait(false); + var cacheItem1 = await personCache.GetAsync(cache1Key); + var cacheItem2 = await personCache.GetAsync(cache2Key); cacheItem1.ShouldBeNull(); cacheItem2.ShouldBeNull(); //Set cacheItem1 = new PersonCacheItem(personName); cacheItem2 = new PersonCacheItem(personName); - await personCache.SetAsync(cache1Key, cacheItem1).ConfigureAwait(false); - await personCache.SetAsync(cache2Key, cacheItem2).ConfigureAwait(false); + await personCache.SetAsync(cache1Key, cacheItem1); + await personCache.SetAsync(cache2Key, cacheItem2); //Get (it should be available now - cacheItem1 = await personCache.GetAsync(cache1Key).ConfigureAwait(false); + cacheItem1 = await personCache.GetAsync(cache1Key); cacheItem1.ShouldNotBeNull(); cacheItem1.Name.ShouldBe(personName); - cacheItem2 = await personCache.GetAsync(cache2Key).ConfigureAwait(false); + cacheItem2 = await personCache.GetAsync(cache2Key); cacheItem2.ShouldNotBeNull(); cacheItem2.Name.ShouldBe(personName); //Remove - await personCache.RemoveAsync(cache1Key).ConfigureAwait(false); - await personCache.RemoveAsync(cache2Key).ConfigureAwait(false); + await personCache.RemoveAsync(cache1Key); + await personCache.RemoveAsync(cache2Key); //Get (not exists since removed) - cacheItem1 = await personCache.GetAsync(cache1Key).ConfigureAwait(false); + cacheItem1 = await personCache.GetAsync(cache1Key); cacheItem1.ShouldBeNull(); - cacheItem2 = await personCache.GetAsync(cache2Key).ConfigureAwait(false); + cacheItem2 = await personCache.GetAsync(cache2Key); cacheItem2.ShouldBeNull(); } diff --git a/framework/test/Volo.Abp.Castle.Core.Tests/Volo.Abp.Castle.Core.Tests.csproj b/framework/test/Volo.Abp.Castle.Core.Tests/Volo.Abp.Castle.Core.Tests.csproj index 9911775a60..23564716da 100644 --- a/framework/test/Volo.Abp.Castle.Core.Tests/Volo.Abp.Castle.Core.Tests.csproj +++ b/framework/test/Volo.Abp.Castle.Core.Tests/Volo.Abp.Castle.Core.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -13,4 +13,4 @@ - \ No newline at end of file + diff --git a/framework/test/Volo.Abp.Cli.Core.Tests/Volo.Abp.Cli.Core.Tests.csproj b/framework/test/Volo.Abp.Cli.Core.Tests/Volo.Abp.Cli.Core.Tests.csproj index 76de07406a..97aaa8a83f 100644 --- a/framework/test/Volo.Abp.Cli.Core.Tests/Volo.Abp.Cli.Core.Tests.csproj +++ b/framework/test/Volo.Abp.Cli.Core.Tests/Volo.Abp.Cli.Core.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.Core.Tests/Volo.Abp.Core.Tests.csproj b/framework/test/Volo.Abp.Core.Tests/Volo.Abp.Core.Tests.csproj index 5a5d49e9e0..bd646adf95 100644 --- a/framework/test/Volo.Abp.Core.Tests/Volo.Abp.Core.Tests.csproj +++ b/framework/test/Volo.Abp.Core.Tests/Volo.Abp.Core.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/AbpInterceptionTestBase.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/AbpInterceptionTestBase.cs index 781a128191..fd57da9a3d 100644 --- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/AbpInterceptionTestBase.cs +++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/AbpInterceptionTestBase.cs @@ -39,11 +39,11 @@ namespace Volo.Abp.DynamicProxy { //Arrange - var target = ServiceProvider.GetService(); - - //Act - - await target.DoItAsync().ConfigureAwait(false); + var target = ServiceProvider.GetService(); + + //Act + + await target.DoItAsync(); //Assert @@ -66,7 +66,7 @@ namespace Volo.Abp.DynamicProxy //Act - var result = await target.GetValueAsync().ConfigureAwait(false); + var result = await target.GetValueAsync(); //Assert @@ -90,9 +90,9 @@ namespace Volo.Abp.DynamicProxy //Act & Assert - (await target.GetValueAsync(42).ConfigureAwait(false)).ShouldBe(42); //First run, not cached yet - (await target.GetValueAsync(43).ConfigureAwait(false)).ShouldBe(42); //First run, cached previous value - (await target.GetValueAsync(44).ConfigureAwait(false)).ShouldBe(42); //First run, cached previous value + (await target.GetValueAsync(42)).ShouldBe(42); //First run, not cached yet + (await target.GetValueAsync(43)).ShouldBe(42); //First run, cached previous value + (await target.GetValueAsync(44)).ShouldBe(42); //First run, cached previous value } } } \ No newline at end of file diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/CachedTestObject.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/CachedTestObject.cs index 8c7a797c7b..aec9d9d596 100644 --- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/CachedTestObject.cs +++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/CachedTestObject.cs @@ -12,8 +12,8 @@ namespace Volo.Abp.DynamicProxy } public virtual async Task GetValueAsync(int v) - { - await Task.Delay(5).ConfigureAwait(false); + { + await Task.Delay(5); return v; } } diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleAsyncInterceptor.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleAsyncInterceptor.cs index 41438d1543..ac5f6beb16 100644 --- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleAsyncInterceptor.cs +++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleAsyncInterceptor.cs @@ -6,12 +6,12 @@ namespace Volo.Abp.DynamicProxy public class SimpleAsyncInterceptor : AbpInterceptor { public override async Task InterceptAsync(IAbpMethodInvocation invocation) - { - await Task.Delay(5).ConfigureAwait(false); + { + await Task.Delay(5); (invocation.TargetObject as ICanLogOnObject)?.Logs?.Add($"{GetType().Name}_InterceptAsync_BeforeInvocation"); - await invocation.ProceedAsync().ConfigureAwait(false); + await invocation.ProceedAsync(); (invocation.TargetObject as ICanLogOnObject)?.Logs?.Add($"{GetType().Name}_InterceptAsync_AfterInvocation"); - await Task.Delay(5).ConfigureAwait(false); + await Task.Delay(5); } } } \ No newline at end of file diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleInterceptionTargetClass.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleInterceptionTargetClass.cs index e683e074d8..d1f23ea34c 100644 --- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleInterceptionTargetClass.cs +++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleInterceptionTargetClass.cs @@ -22,9 +22,9 @@ namespace Volo.Abp.DynamicProxy public virtual async Task GetValueAsync() { Logs.Add("EnterGetValueAsync"); - await Task.Delay(5).ConfigureAwait(false); + await Task.Delay(5); Logs.Add("MiddleGetValueAsync"); - await Task.Delay(5).ConfigureAwait(false); + await Task.Delay(5); Logs.Add("ExitGetValueAsync"); return 42; } @@ -32,9 +32,9 @@ namespace Volo.Abp.DynamicProxy public virtual async Task DoItAsync() { Logs.Add("EnterDoItAsync"); - await Task.Delay(5).ConfigureAwait(false); + await Task.Delay(5); Logs.Add("MiddleDoItAsync"); - await Task.Delay(5).ConfigureAwait(false); + await Task.Delay(5); Logs.Add("ExitDoItAsync"); } } diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleResultCacheTestInterceptor.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleResultCacheTestInterceptor.cs index 06c3d096fe..15bcf4631b 100644 --- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleResultCacheTestInterceptor.cs +++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/DynamicProxy/SimpleResultCacheTestInterceptor.cs @@ -19,9 +19,9 @@ namespace Volo.Abp.DynamicProxy { invocation.ReturnValue = _cache[invocation.Method]; return; - } - - await invocation.ProceedAsync().ConfigureAwait(false); + } + + await invocation.ProceedAsync(); _cache[invocation.Method] = invocation.ReturnValue; } } diff --git a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Threading/AsyncHelper_Tests.cs b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Threading/AsyncHelper_Tests.cs index 53a4516560..1b7b7eacd2 100644 --- a/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Threading/AsyncHelper_Tests.cs +++ b/framework/test/Volo.Abp.Core.Tests/Volo/Abp/Threading/AsyncHelper_Tests.cs @@ -41,12 +41,12 @@ namespace Volo.Abp.Threading private static async Task MyTaskWithoutReturnValueAsync() { - await Task.Delay(1).ConfigureAwait(false); + await Task.Delay(1); } private static async Task MyTaskWithReturnValueAsync(int aNumber) { - await Task.Delay(1).ConfigureAwait(false); + await Task.Delay(1); return aNumber; } diff --git a/framework/test/Volo.Abp.Dapper.Tests/Volo.Abp.Dapper.Tests.csproj b/framework/test/Volo.Abp.Dapper.Tests/Volo.Abp.Dapper.Tests.csproj index 33bdd870e2..a845149b32 100644 --- a/framework/test/Volo.Abp.Dapper.Tests/Volo.Abp.Dapper.Tests.csproj +++ b/framework/test/Volo.Abp.Dapper.Tests/Volo.Abp.Dapper.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -17,4 +17,4 @@ - \ No newline at end of file + diff --git a/framework/test/Volo.Abp.Dapper.Tests/Volo/Abp/Dapper/Repositories/PersonDapperRepository.cs b/framework/test/Volo.Abp.Dapper.Tests/Volo/Abp/Dapper/Repositories/PersonDapperRepository.cs index f7a01649de..b5127e3d7e 100644 --- a/framework/test/Volo.Abp.Dapper.Tests/Volo/Abp/Dapper/Repositories/PersonDapperRepository.cs +++ b/framework/test/Volo.Abp.Dapper.Tests/Volo/Abp/Dapper/Repositories/PersonDapperRepository.cs @@ -17,14 +17,14 @@ namespace Volo.Abp.Dapper.Repositories public virtual async Task> GetAllPersonNames() { - return (await DbConnection.QueryAsync("select Name from People", transaction: DbTransaction).ConfigureAwait(false)) + return (await DbConnection.QueryAsync("select Name from People", transaction: DbTransaction)) .ToList(); } public virtual async Task UpdatePersonNames(string name) { return await DbConnection.ExecuteAsync("update People set Name = @NewName", new { NewName = name }, - DbTransaction).ConfigureAwait(false); + DbTransaction); } } } \ No newline at end of file diff --git a/framework/test/Volo.Abp.Dapper.Tests/Volo/Abp/Dapper/Repositories/PersonDapperRepository_Tests.cs b/framework/test/Volo.Abp.Dapper.Tests/Volo/Abp/Dapper/Repositories/PersonDapperRepository_Tests.cs index cf085b2298..28734c1fd0 100644 --- a/framework/test/Volo.Abp.Dapper.Tests/Volo/Abp/Dapper/Repositories/PersonDapperRepository_Tests.cs +++ b/framework/test/Volo.Abp.Dapper.Tests/Volo/Abp/Dapper/Repositories/PersonDapperRepository_Tests.cs @@ -11,7 +11,7 @@ namespace Volo.Abp.Dapper.Repositories [Fact] public async Task GetAllPersonNames_Test() { - var allNames = await GetRequiredService().GetAllPersonNames().ConfigureAwait(false); + var allNames = await GetRequiredService().GetAllPersonNames(); allNames.ShouldNotBeEmpty(); allNames.ShouldContain(x => x == "Douglas"); allNames.ShouldContain(x => x == "John-Deleted"); @@ -23,9 +23,9 @@ namespace Volo.Abp.Dapper.Repositories public async Task UpdatePersonNames_Test() { var personDapperRepository = GetRequiredService(); - await personDapperRepository.UpdatePersonNames("test").ConfigureAwait(false); + await personDapperRepository.UpdatePersonNames("test"); - var allNames = await personDapperRepository.GetAllPersonNames().ConfigureAwait(false); + var allNames = await personDapperRepository.GetAllPersonNames(); allNames.ShouldNotBeEmpty(); allNames.ShouldAllBe(x => x == "test"); } @@ -41,11 +41,11 @@ namespace Volo.Abp.Dapper.Repositories IsTransactional = true })) { - await personDapperRepository.UpdatePersonNames("test").ConfigureAwait(false); - await uow.RollbackAsync().ConfigureAwait(false); + await personDapperRepository.UpdatePersonNames("test"); + await uow.RollbackAsync(); } - var allNames = await personDapperRepository.GetAllPersonNames().ConfigureAwait(false); + var allNames = await personDapperRepository.GetAllPersonNames(); allNames.ShouldAllBe(x => x != "test"); } } diff --git a/framework/test/Volo.Abp.Data.Tests/Volo.Abp.Data.Tests.csproj b/framework/test/Volo.Abp.Data.Tests/Volo.Abp.Data.Tests.csproj index 9e7cb21644..35d7ad3950 100644 --- a/framework/test/Volo.Abp.Data.Tests/Volo.Abp.Data.Tests.csproj +++ b/framework/test/Volo.Abp.Data.Tests/Volo.Abp.Data.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.Ddd.Tests/Volo.Abp.Ddd.Tests.csproj b/framework/test/Volo.Abp.Ddd.Tests/Volo.Abp.Ddd.Tests.csproj index 6c7bcc9ca5..cb917cea72 100644 --- a/framework/test/Volo.Abp.Ddd.Tests/Volo.Abp.Ddd.Tests.csproj +++ b/framework/test/Volo.Abp.Ddd.Tests/Volo.Abp.Ddd.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.Emailing.Tests/Volo.Abp.Emailing.Tests.csproj b/framework/test/Volo.Abp.Emailing.Tests/Volo.Abp.Emailing.Tests.csproj index 3a1b803370..a86ea9f051 100644 --- a/framework/test/Volo.Abp.Emailing.Tests/Volo.Abp.Emailing.Tests.csproj +++ b/framework/test/Volo.Abp.Emailing.Tests/Volo.Abp.Emailing.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/EmailTemplateRender_Tests.cs b/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/EmailTemplateRender_Tests.cs index 8c02b765e0..24d7298f6c 100644 --- a/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/EmailTemplateRender_Tests.cs +++ b/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/EmailTemplateRender_Tests.cs @@ -44,7 +44,7 @@ namespace Volo.Abp.Emailing } }; - var result = await _templateRender.RenderAsync(template, model).ConfigureAwait(false); + var result = await _templateRender.RenderAsync(template, model); result.ShouldBe("Hello john@abp.io 1:iphone,2:ipad,"); } diff --git a/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/EmailTemplateStore_Tests.cs b/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/EmailTemplateStore_Tests.cs index 90aa9563ea..1e4ea8c090 100644 --- a/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/EmailTemplateStore_Tests.cs +++ b/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/EmailTemplateStore_Tests.cs @@ -24,21 +24,21 @@ namespace Volo.Abp.Emailing [Fact] public async Task Should_Get_Registered_Template() { - var template = await _emailTemplateProvider.GetAsync("template1", "tr").ConfigureAwait(false); + var template = await _emailTemplateProvider.GetAsync("template1", "tr"); template.Content.ShouldContain("Lütfen aşağıdaki bağlantıya tıklayarak e-posta adresinizi onaylayın."); } [Fact] public async Task Should_Get_Default_Culture_Template() { - var template = await _emailTemplateProvider.GetAsync("template1", "zh-Hans").ConfigureAwait(false); + var template = await _emailTemplateProvider.GetAsync("template1", "zh-Hans"); template.Content.ShouldContain("Please confirm your email address by clicking the link below."); } [Fact] public async Task Should_Get_Registered_Template_With_Layout() { - var template = await _emailTemplateProvider.GetAsync("template2", "en").ConfigureAwait(false); + var template = await _emailTemplateProvider.GetAsync("template2", "en"); template.Content.ShouldContain($"{Environment.NewLine} " + "Please confirm your email address by clicking the link below."); } @@ -47,7 +47,7 @@ namespace Volo.Abp.Emailing [Fact] public async Task Should_Get_Registered_Template_With_Localize() { - var template = await _emailTemplateProvider.GetAsync("template3", "tr").ConfigureAwait(false); + var template = await _emailTemplateProvider.GetAsync("template3", "tr"); template.Content.ShouldContain("Merhaba Abp"); } } diff --git a/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/Localization/zh-Hant.json b/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/Localization/zh-Hant.json new file mode 100644 index 0000000000..dd12964f70 --- /dev/null +++ b/framework/test/Volo.Abp.Emailing.Tests/Volo/Abp/Emailing/Localization/zh-Hant.json @@ -0,0 +1,6 @@ +{ + "culture": "zh-Hant", + "texts": { + "hello": "哈囉" + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo.Abp.EntityFrameworkCore.Tests.SecondContext.csproj b/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo.Abp.EntityFrameworkCore.Tests.SecondContext.csproj index 14d04a597a..e60435ce25 100644 --- a/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo.Abp.EntityFrameworkCore.Tests.SecondContext.csproj +++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo.Abp.EntityFrameworkCore.Tests.SecondContext.csproj @@ -1,4 +1,4 @@ - + @@ -16,4 +16,4 @@ - \ No newline at end of file + diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/SecondContextTestDataBuilder.cs b/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/SecondContextTestDataBuilder.cs index 1f69263f5c..3bdd15b5ae 100644 --- a/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/SecondContextTestDataBuilder.cs +++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests.SecondContext/Volo/Abp/EntityFrameworkCore/TestApp/SecondContext/SecondContextTestDataBuilder.cs @@ -19,12 +19,12 @@ namespace Volo.Abp.EntityFrameworkCore.TestApp.SecondContext public async Task BuildAsync() { - await _bookRepository.InsertAsync( + await _bookRepository.InsertAsync( new BookInSecondDbContext( _guidGenerator.Create(), "TestBook1" ) - ).ConfigureAwait(false); + ); } } } \ No newline at end of file diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo.Abp.EntityFrameworkCore.Tests.csproj b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo.Abp.EntityFrameworkCore.Tests.csproj index a01e3d111a..f2d2ca162c 100644 --- a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo.Abp.EntityFrameworkCore.Tests.csproj +++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo.Abp.EntityFrameworkCore.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -20,4 +20,4 @@ - \ No newline at end of file + diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/DataFiltering/HardDelete_Tests.cs b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/DataFiltering/HardDelete_Tests.cs new file mode 100644 index 0000000000..df3fd98b62 --- /dev/null +++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/DataFiltering/HardDelete_Tests.cs @@ -0,0 +1,8 @@ +using Volo.Abp.TestApp.Testing; + +namespace Volo.Abp.EntityFrameworkCore.DataFiltering +{ + public class HardDelete_Tests : HardDelete_Tests + { + } +} diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/DbContext_Replace_Tests.cs b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/DbContext_Replace_Tests.cs index 5ee320742c..7bc4af2e31 100644 --- a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/DbContext_Replace_Tests.cs +++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/DbContext_Replace_Tests.cs @@ -31,7 +31,7 @@ namespace Volo.Abp.EntityFrameworkCore (_dummyRepository.GetDbContext() is IThirdDbContext).ShouldBeTrue(); (_dummyRepository.GetDbContext() is TestAppDbContext).ShouldBeTrue(); - await _unitOfWorkManager.Current.CompleteAsync().ConfigureAwait(false); + await _unitOfWorkManager.Current.CompleteAsync(); } } } diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/Repositories/Repository_Queryable_Tests.cs b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/Repositories/Repository_Queryable_Tests.cs index d178ff7965..a5b8aa0577 100644 --- a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/Repositories/Repository_Queryable_Tests.cs +++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/Repositories/Repository_Queryable_Tests.cs @@ -30,7 +30,7 @@ namespace Volo.Abp.EntityFrameworkCore.Repositories { _bookRepository.Any().ShouldBeTrue(); return Task.CompletedTask; - }).ConfigureAwait(false); + }); } [Fact] @@ -40,7 +40,7 @@ namespace Volo.Abp.EntityFrameworkCore.Repositories { _phoneInSecondDbContextRepository.Any().ShouldBeTrue(); return Task.CompletedTask; - }).ConfigureAwait(false); + }); } [Fact] @@ -52,7 +52,7 @@ namespace Volo.Abp.EntityFrameworkCore.Repositories person.Name.ShouldBe("Douglas"); person.Phones.Count.ShouldBe(2); return Task.CompletedTask; - }).ConfigureAwait(false); + }); } } } diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/Transactions/Transaction_Tests.cs b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/Transactions/Transaction_Tests.cs index db4a376ae4..7d89da1a08 100644 --- a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/Transactions/Transaction_Tests.cs +++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/EntityFrameworkCore/Transactions/Transaction_Tests.cs @@ -34,16 +34,16 @@ namespace Volo.Abp.EntityFrameworkCore.Transactions { await WithUnitOfWorkAsync(new AbpUnitOfWorkOptions { IsTransactional = true }, async () => { - await _personRepository.InsertAsync(new Person(personId, "Adam", 42)).ConfigureAwait(false); + await _personRepository.InsertAsync(new Person(personId, "Adam", 42)); throw new Exception(exceptionMessage); - }).ConfigureAwait(false); + }); } catch (Exception e) when (e.Message == exceptionMessage) { } - var person = await _personRepository.FindAsync(personId).ConfigureAwait(false); + var person = await _personRepository.FindAsync(personId); person.ShouldBeNull(); } @@ -56,12 +56,12 @@ namespace Volo.Abp.EntityFrameworkCore.Transactions { _unitOfWorkManager.Current.ShouldNotBeNull(); - await _personRepository.InsertAsync(new Person(personId, "Adam", 42)).ConfigureAwait(false); + await _personRepository.InsertAsync(new Person(personId, "Adam", 42)); - await _unitOfWorkManager.Current.RollbackAsync().ConfigureAwait(false); - }).ConfigureAwait(false); + await _unitOfWorkManager.Current.RollbackAsync(); + }); - var person = await _personRepository.FindAsync(personId).ConfigureAwait(false); + var person = await _personRepository.FindAsync(personId); person.ShouldBeNull(); } @@ -79,17 +79,17 @@ namespace Volo.Abp.EntityFrameworkCore.Transactions { _unitOfWorkManager.Current.ShouldNotBeNull(); - await _personRepository.InsertAsync(new Person(personId, "Adam", 42)).ConfigureAwait(false); - await _bookRepository.InsertAsync(new BookInSecondDbContext(bookId, bookId.ToString())).ConfigureAwait(false); + await _personRepository.InsertAsync(new Person(personId, "Adam", 42)); + await _bookRepository.InsertAsync(new BookInSecondDbContext(bookId, bookId.ToString())); - await _unitOfWorkManager.Current.SaveChangesAsync().ConfigureAwait(false); + await _unitOfWorkManager.Current.SaveChangesAsync(); //Will automatically rollback since not called the Complete! } } - (await _personRepository.FindAsync(personId).ConfigureAwait(false)).ShouldBeNull(); - (await _bookRepository.FindAsync(bookId).ConfigureAwait(false)).ShouldBeNull(); + (await _personRepository.FindAsync(personId)).ShouldBeNull(); + (await _bookRepository.FindAsync(bookId)).ShouldBeNull(); } } } diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/TestApp/EntityFrameworkCore/CityRepository.cs b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/TestApp/EntityFrameworkCore/CityRepository.cs index 05becda1d3..027f54a03a 100644 --- a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/TestApp/EntityFrameworkCore/CityRepository.cs +++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/TestApp/EntityFrameworkCore/CityRepository.cs @@ -18,13 +18,13 @@ namespace Volo.Abp.TestApp.EntityFrameworkCore public async Task FindByNameAsync(string name) { - return await this.FirstOrDefaultAsync(c => c.Name == name).ConfigureAwait(false); + return await this.FirstOrDefaultAsync(c => c.Name == name); } public async Task> GetPeopleInTheCityAsync(string cityName) { - var city = await FindByNameAsync(cityName).ConfigureAwait(false); - return await DbContext.People.Where(p => p.CityId == city.Id).ToListAsync().ConfigureAwait(false); + var city = await FindByNameAsync(cityName); + return await DbContext.People.Where(p => p.CityId == city.Id).ToListAsync(); } } } diff --git a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/TestApp/EntityFrameworkCore/PersonRepository.cs b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/TestApp/EntityFrameworkCore/PersonRepository.cs index 01b949015a..ab8c1920a7 100644 --- a/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/TestApp/EntityFrameworkCore/PersonRepository.cs +++ b/framework/test/Volo.Abp.EntityFrameworkCore.Tests/Volo/Abp/TestApp/EntityFrameworkCore/PersonRepository.cs @@ -18,7 +18,7 @@ namespace Volo.Abp.TestApp.EntityFrameworkCore public async Task GetViewAsync(string name) { - return await DbContext.PersonView.Where(x => x.Name == name).FirstOrDefaultAsync().ConfigureAwait(false); + return await DbContext.PersonView.Where(x => x.Name == name).FirstOrDefaultAsync(); } } } \ No newline at end of file diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo.Abp.EventBus.Tests.csproj b/framework/test/Volo.Abp.EventBus.Tests/Volo.Abp.EventBus.Tests.csproj index 6a7a017f4e..adeefbd45b 100644 --- a/framework/test/Volo.Abp.EventBus.Tests/Volo.Abp.EventBus.Tests.csproj +++ b/framework/test/Volo.Abp.EventBus.Tests/Volo.Abp.EventBus.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Distributed/LocalDistributedEventBus_Test.cs b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Distributed/LocalDistributedEventBus_Test.cs index 19e61e5afb..47649ad3c3 100644 --- a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Distributed/LocalDistributedEventBus_Test.cs +++ b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Distributed/LocalDistributedEventBus_Test.cs @@ -10,9 +10,9 @@ namespace Volo.Abp.EventBus.Distributed { DistributedEventBus.Subscribe(); - await DistributedEventBus.PublishAsync(new MySimpleEventData(1)).ConfigureAwait(false); - await DistributedEventBus.PublishAsync(new MySimpleEventData(2)).ConfigureAwait(false); - await DistributedEventBus.PublishAsync(new MySimpleEventData(3)).ConfigureAwait(false); + await DistributedEventBus.PublishAsync(new MySimpleEventData(1)); + await DistributedEventBus.PublishAsync(new MySimpleEventData(2)); + await DistributedEventBus.PublishAsync(new MySimpleEventData(3)); Assert.Equal(3, MySimpleDistributedTransientEventHandler.HandleCount); Assert.Equal(3, MySimpleDistributedTransientEventHandler.DisposeCount); diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/ActionBasedEventHandlerTest.cs b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/ActionBasedEventHandlerTest.cs index 8e41a26eae..6e6bae2fae 100644 --- a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/ActionBasedEventHandlerTest.cs +++ b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/ActionBasedEventHandlerTest.cs @@ -19,10 +19,10 @@ namespace Volo.Abp.EventBus.Local return Task.CompletedTask; }); - await LocalEventBus.PublishAsync(new MySimpleEventData(1)).ConfigureAwait(false); - await LocalEventBus.PublishAsync(new MySimpleEventData(2)).ConfigureAwait(false); - await LocalEventBus.PublishAsync(new MySimpleEventData(3)).ConfigureAwait(false); - await LocalEventBus.PublishAsync(new MySimpleEventData(4)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(1)); + await LocalEventBus.PublishAsync(new MySimpleEventData(2)); + await LocalEventBus.PublishAsync(new MySimpleEventData(3)); + await LocalEventBus.PublishAsync(new MySimpleEventData(4)); Assert.Equal(10, totalData); } @@ -39,10 +39,10 @@ namespace Volo.Abp.EventBus.Local return Task.CompletedTask; }); - await LocalEventBus.PublishAsync(typeof(MySimpleEventData), new MySimpleEventData(1)).ConfigureAwait(false); - await LocalEventBus.PublishAsync(typeof(MySimpleEventData), new MySimpleEventData(2)).ConfigureAwait(false); - await LocalEventBus.PublishAsync(typeof(MySimpleEventData), new MySimpleEventData(3)).ConfigureAwait(false); - await LocalEventBus.PublishAsync(typeof(MySimpleEventData), new MySimpleEventData(4)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(typeof(MySimpleEventData), new MySimpleEventData(1)); + await LocalEventBus.PublishAsync(typeof(MySimpleEventData), new MySimpleEventData(2)); + await LocalEventBus.PublishAsync(typeof(MySimpleEventData), new MySimpleEventData(3)); + await LocalEventBus.PublishAsync(typeof(MySimpleEventData), new MySimpleEventData(4)); Assert.Equal(10, totalData); } @@ -59,13 +59,13 @@ namespace Volo.Abp.EventBus.Local return Task.CompletedTask; }); - await LocalEventBus.PublishAsync(new MySimpleEventData(1)).ConfigureAwait(false); - await LocalEventBus.PublishAsync(new MySimpleEventData(2)).ConfigureAwait(false); - await LocalEventBus.PublishAsync(new MySimpleEventData(3)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(1)); + await LocalEventBus.PublishAsync(new MySimpleEventData(2)); + await LocalEventBus.PublishAsync(new MySimpleEventData(3)); registerDisposer.Dispose(); - await LocalEventBus.PublishAsync(new MySimpleEventData(4)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(4)); Assert.Equal(6, totalData); } @@ -84,13 +84,13 @@ namespace Volo.Abp.EventBus.Local LocalEventBus.Subscribe(action); - await LocalEventBus.PublishAsync(new MySimpleEventData(1)).ConfigureAwait(false); - await LocalEventBus.PublishAsync(new MySimpleEventData(2)).ConfigureAwait(false); - await LocalEventBus.PublishAsync(new MySimpleEventData(3)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(1)); + await LocalEventBus.PublishAsync(new MySimpleEventData(2)); + await LocalEventBus.PublishAsync(new MySimpleEventData(3)); LocalEventBus.Unsubscribe(action); - await LocalEventBus.PublishAsync(new MySimpleEventData(4)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(4)); Assert.Equal(6, totalData); } @@ -103,15 +103,15 @@ namespace Volo.Abp.EventBus.Local LocalEventBus.Subscribe( async eventData => { - await Task.Delay(20).ConfigureAwait(false); + await Task.Delay(20); Interlocked.Add(ref totalData, eventData.Value); - await Task.Delay(20).ConfigureAwait(false); + await Task.Delay(20); }); - await LocalEventBus.PublishAsync(new MySimpleEventData(1)).ConfigureAwait(false); - await LocalEventBus.PublishAsync(new MySimpleEventData(2)).ConfigureAwait(false); - await LocalEventBus.PublishAsync(new MySimpleEventData(3)).ConfigureAwait(false); - await LocalEventBus.PublishAsync(new MySimpleEventData(4)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(1)); + await LocalEventBus.PublishAsync(new MySimpleEventData(2)); + await LocalEventBus.PublishAsync(new MySimpleEventData(3)); + await LocalEventBus.PublishAsync(new MySimpleEventData(4)); Assert.Equal(10, totalData); } diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_DI_Services_Test.cs b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_DI_Services_Test.cs index 4ae07d8dc6..e66deb0e1c 100644 --- a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_DI_Services_Test.cs +++ b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_DI_Services_Test.cs @@ -9,10 +9,10 @@ namespace Volo.Abp.EventBus.Local [Fact] public async Task Should_Automatically_Register_EventHandlers_From_Services() { - await LocalEventBus.PublishAsync(new MySimpleEventData(1)).ConfigureAwait(false); - await LocalEventBus.PublishAsync(new MySimpleEventData(2)).ConfigureAwait(false); - await LocalEventBus.PublishAsync(new MySimpleEventData(3)).ConfigureAwait(false); - await LocalEventBus.PublishAsync(new MySimpleEventData(4)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(1)); + await LocalEventBus.PublishAsync(new MySimpleEventData(2)); + await LocalEventBus.PublishAsync(new MySimpleEventData(3)); + await LocalEventBus.PublishAsync(new MySimpleEventData(4)); GetRequiredService().TotalData.ShouldBe(10); } diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_Exception_Test.cs b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_Exception_Test.cs index 951a9f841d..446825c697 100644 --- a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_Exception_Test.cs +++ b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_Exception_Test.cs @@ -14,8 +14,8 @@ namespace Volo.Abp.EventBus.Local var appException = await Assert.ThrowsAsync(async () => { - await LocalEventBus.PublishAsync(new MySimpleEventData(1)).ConfigureAwait(false); - }).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(1)); + }); appException.Message.ShouldBe("This exception is intentionally thrown!"); } @@ -31,8 +31,8 @@ namespace Volo.Abp.EventBus.Local var aggrException = await Assert.ThrowsAsync(async () => { - await LocalEventBus.PublishAsync(new MySimpleEventData(1)).ConfigureAwait(false); - }).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(1)); + }); aggrException.InnerExceptions.Count.ShouldBe(2); aggrException.InnerExceptions[0].Message.ShouldBe("This exception is intentionally thrown #1!"); diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_MultipleHandle_Test.cs b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_MultipleHandle_Test.cs index 5880dd3662..d20692fa01 100644 --- a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_MultipleHandle_Test.cs +++ b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/EventBus_MultipleHandle_Test.cs @@ -16,7 +16,7 @@ namespace Volo.Abp.EventBus.Local LocalEventBus.Subscribe>(handler); LocalEventBus.Subscribe>(handler); - await LocalEventBus.PublishAsync(new EntityCreatedEventData(new MyEntity())).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new EntityCreatedEventData(new MyEntity())); handler.EntityCreatedEventCount.ShouldBe(1); handler.EntityChangedEventCount.ShouldBe(1); diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/GenericInheritanceTest.cs b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/GenericInheritanceTest.cs index 316de4a396..eeec26b166 100644 --- a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/GenericInheritanceTest.cs +++ b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/GenericInheritanceTest.cs @@ -21,7 +21,7 @@ namespace Volo.Abp.EventBus.Local return Task.CompletedTask; }); - await LocalEventBus.PublishAsync(new EntityUpdatedEventData(new Person(42))).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new EntityUpdatedEventData(new Person(42))); triggeredEvent.ShouldBe(true); } @@ -39,7 +39,7 @@ namespace Volo.Abp.EventBus.Local return Task.CompletedTask; }); - await LocalEventBus.PublishAsync(new EntityChangedEventData(new Student(42))).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new EntityChangedEventData(new Student(42))); triggeredEvent.ShouldBe(true); } diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/InheritanceTest.cs b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/InheritanceTest.cs index 17474be1d9..c3b1dd4283 100644 --- a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/InheritanceTest.cs +++ b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/InheritanceTest.cs @@ -17,10 +17,10 @@ namespace Volo.Abp.EventBus.Local return Task.CompletedTask; }); - await LocalEventBus.PublishAsync(new MySimpleEventData(1)).ConfigureAwait(false); //Should handle directly registered class - await LocalEventBus.PublishAsync(new MySimpleEventData(2)).ConfigureAwait(false); //Should handle directly registered class - await LocalEventBus.PublishAsync(new MyDerivedEventData(3)).ConfigureAwait(false); //Should handle derived class too - await LocalEventBus.PublishAsync(new MyDerivedEventData(4)).ConfigureAwait(false); //Should handle derived class too + await LocalEventBus.PublishAsync(new MySimpleEventData(1)); //Should handle directly registered class + await LocalEventBus.PublishAsync(new MySimpleEventData(2)); //Should handle directly registered class + await LocalEventBus.PublishAsync(new MyDerivedEventData(3)); //Should handle derived class too + await LocalEventBus.PublishAsync(new MyDerivedEventData(4)); //Should handle derived class too Assert.Equal(10, totalData); } @@ -37,10 +37,10 @@ namespace Volo.Abp.EventBus.Local return Task.CompletedTask; }); - await LocalEventBus.PublishAsync(new MySimpleEventData(1)).ConfigureAwait(false); //Should not handle - await LocalEventBus.PublishAsync(new MySimpleEventData(2)).ConfigureAwait(false); //Should not handle - await LocalEventBus.PublishAsync(new MyDerivedEventData(3)).ConfigureAwait(false); //Should handle - await LocalEventBus.PublishAsync(new MyDerivedEventData(4)).ConfigureAwait(false); //Should handle + await LocalEventBus.PublishAsync(new MySimpleEventData(1)); //Should not handle + await LocalEventBus.PublishAsync(new MySimpleEventData(2)); //Should not handle + await LocalEventBus.PublishAsync(new MyDerivedEventData(3)); //Should handle + await LocalEventBus.PublishAsync(new MyDerivedEventData(4)); //Should handle Assert.Equal(7, totalData); } diff --git a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/TransientDisposableEventHandlerTest.cs b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/TransientDisposableEventHandlerTest.cs index bfc731f5bf..5ab7ed51af 100644 --- a/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/TransientDisposableEventHandlerTest.cs +++ b/framework/test/Volo.Abp.EventBus.Tests/Volo/Abp/EventBus/Local/TransientDisposableEventHandlerTest.cs @@ -10,9 +10,9 @@ namespace Volo.Abp.EventBus.Local { LocalEventBus.Subscribe(); - await LocalEventBus.PublishAsync(new MySimpleEventData(1)).ConfigureAwait(false); - await LocalEventBus.PublishAsync(new MySimpleEventData(2)).ConfigureAwait(false); - await LocalEventBus.PublishAsync(new MySimpleEventData(3)).ConfigureAwait(false); + await LocalEventBus.PublishAsync(new MySimpleEventData(1)); + await LocalEventBus.PublishAsync(new MySimpleEventData(2)); + await LocalEventBus.PublishAsync(new MySimpleEventData(3)); Assert.Equal(3, MySimpleTransientEventHandler.HandleCount); Assert.Equal(3, MySimpleTransientEventHandler.DisposeCount); diff --git a/framework/test/Volo.Abp.Features.Tests/Volo.Abp.Features.Tests.csproj b/framework/test/Volo.Abp.Features.Tests/Volo.Abp.Features.Tests.csproj index 7cf1656de6..bc375d9406 100644 --- a/framework/test/Volo.Abp.Features.Tests/Volo.Abp.Features.Tests.csproj +++ b/framework/test/Volo.Abp.Features.Tests/Volo.Abp.Features.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/FeatureChecker_Tests.cs b/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/FeatureChecker_Tests.cs index dc849d9b50..7ea01268a0 100644 --- a/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/FeatureChecker_Tests.cs +++ b/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/FeatureChecker_Tests.cs @@ -20,16 +20,16 @@ namespace Volo.Abp.Features public async Task IsEnabledAsync() { //Tenant is unknown - (await _featureChecker.IsEnabledAsync("BooleanTestFeature1").ConfigureAwait(false)).ShouldBeFalse(); + (await _featureChecker.IsEnabledAsync("BooleanTestFeature1")).ShouldBeFalse(); using (_currentTenant.Change(TestFeatureStore.Tenant1Id)) { - (await _featureChecker.IsEnabledAsync("BooleanTestFeature1").ConfigureAwait(false)).ShouldBeTrue(); + (await _featureChecker.IsEnabledAsync("BooleanTestFeature1")).ShouldBeTrue(); } using (_currentTenant.Change(TestFeatureStore.Tenant2Id)) { - (await _featureChecker.IsEnabledAsync("BooleanTestFeature1").ConfigureAwait(false)).ShouldBeFalse(); + (await _featureChecker.IsEnabledAsync("BooleanTestFeature1")).ShouldBeFalse(); } } @@ -37,16 +37,16 @@ namespace Volo.Abp.Features public async Task GetOrNullAsync() { //Tenant is unknown - (await _featureChecker.GetOrNullAsync("IntegerTestFeature1").ConfigureAwait(false)).ShouldBe("1"); + (await _featureChecker.GetOrNullAsync("IntegerTestFeature1")).ShouldBe("1"); using (_currentTenant.Change(TestFeatureStore.Tenant1Id)) { - (await _featureChecker.GetOrNullAsync("IntegerTestFeature1").ConfigureAwait(false)).ShouldBe("1"); + (await _featureChecker.GetOrNullAsync("IntegerTestFeature1")).ShouldBe("1"); } using (_currentTenant.Change(TestFeatureStore.Tenant2Id)) { - (await _featureChecker.GetOrNullAsync("IntegerTestFeature1").ConfigureAwait(false)).ShouldBe("34"); + (await _featureChecker.GetOrNullAsync("IntegerTestFeature1")).ShouldBe("34"); } } } diff --git a/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/FeatureInterceptor_Tests.cs b/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/FeatureInterceptor_Tests.cs index eb10664239..bdc17a1d5f 100644 --- a/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/FeatureInterceptor_Tests.cs +++ b/framework/test/Volo.Abp.Features.Tests/Volo/Abp/Features/FeatureInterceptor_Tests.cs @@ -29,18 +29,18 @@ namespace Volo.Abp.Features { await Assert.ThrowsAsync(async () => { - await _classFeatureTestService.NoAdditionalFeatureAsync().ConfigureAwait(false); - }).ConfigureAwait(false); + await _classFeatureTestService.NoAdditionalFeatureAsync(); + }); await Assert.ThrowsAsync(async () => { - await _classFeatureTestService.Feature2Async().ConfigureAwait(false); - }).ConfigureAwait(false); + await _classFeatureTestService.Feature2Async(); + }); await Assert.ThrowsAsync(async () => { - await _methodFeatureTestService.Feature1Async().ConfigureAwait(false); - }).ConfigureAwait(false); + await _methodFeatureTestService.Feature1Async(); + }); } } @@ -50,9 +50,9 @@ namespace Volo.Abp.Features //Features were enabled for Tenant 1 using (_currentTenant.Change(TestFeatureStore.Tenant1Id)) { - await _classFeatureTestService.NoAdditionalFeatureAsync().ConfigureAwait(false); - (await _classFeatureTestService.Feature2Async().ConfigureAwait(false)).ShouldBe(42); - (await _methodFeatureTestService.Feature1Async().ConfigureAwait(false)).ShouldBe(42); + await _classFeatureTestService.NoAdditionalFeatureAsync(); + (await _classFeatureTestService.Feature2Async()).ShouldBe(42); + (await _methodFeatureTestService.Feature1Async()).ShouldBe(42); } } @@ -64,7 +64,7 @@ namespace Volo.Abp.Features { using (_currentTenant.Change(ParseNullableGuid(tenantIdValue))) { - await _methodFeatureTestService.NonFeatureAsync().ConfigureAwait(false); + await _methodFeatureTestService.NonFeatureAsync(); } } diff --git a/framework/test/Volo.Abp.FluentValidation.Tests/Volo.Abp.FluentValidation.Tests.csproj b/framework/test/Volo.Abp.FluentValidation.Tests/Volo.Abp.FluentValidation.Tests.csproj index 7f62578e7d..3c91d940e5 100644 --- a/framework/test/Volo.Abp.FluentValidation.Tests/Volo.Abp.FluentValidation.Tests.csproj +++ b/framework/test/Volo.Abp.FluentValidation.Tests/Volo.Abp.FluentValidation.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.FluentValidation.Tests/Volo/Abp/FluentValidation/ApplicationService_FluentValidation_Tests.cs b/framework/test/Volo.Abp.FluentValidation.Tests/Volo/Abp/FluentValidation/ApplicationService_FluentValidation_Tests.cs index ba7a424ee7..5bf11b6d5e 100644 --- a/framework/test/Volo.Abp.FluentValidation.Tests/Volo/Abp/FluentValidation/ApplicationService_FluentValidation_Tests.cs +++ b/framework/test/Volo.Abp.FluentValidation.Tests/Volo/Abp/FluentValidation/ApplicationService_FluentValidation_Tests.cs @@ -40,7 +40,7 @@ namespace Volo.Abp.FluentValidation { MyStringValue3 = "ccc" } - }).ConfigureAwait(false); + }); asyncOutput.ShouldBe("aaabbbccc"); } @@ -65,7 +65,7 @@ namespace Volo.Abp.FluentValidation } } ) -.ConfigureAwait(false)).ConfigureAwait(false); + ); exception.ValidationErrors.ShouldContain(x => x.MemberNames.Contains("MyStringValue")); exception.ValidationErrors.ShouldContain(x => x.MemberNames.Contains("MyMethodInput2.MyStringValue2")); @@ -83,7 +83,7 @@ namespace Volo.Abp.FluentValidation { MyStringValue3 = "c" } - }).ConfigureAwait(false)).ConfigureAwait(false); + })); exception.ValidationErrors.ShouldContain(x => x.MemberNames.Contains("MyStringValue")); exception.ValidationErrors.ShouldContain(x => x.MemberNames.Contains("MyMethodInput2.MyStringValue2")); exception.ValidationErrors.ShouldContain(x => x.MemberNames.Contains("MyMethodInput3.MyStringValue3")); @@ -95,7 +95,7 @@ namespace Volo.Abp.FluentValidation var output = await _myAppService.NotValidateMyMethod(new MyMethodInput4 { MyStringValue4 = "444" - }).ConfigureAwait(false); + }); output.ShouldBe("444"); } diff --git a/framework/test/Volo.Abp.Http.Client.Tests/Volo.Abp.Http.Client.Tests.csproj b/framework/test/Volo.Abp.Http.Client.Tests/Volo.Abp.Http.Client.Tests.csproj index db0f9d45bf..193df5db4f 100644 --- a/framework/test/Volo.Abp.Http.Client.Tests/Volo.Abp.Http.Client.Tests.csproj +++ b/framework/test/Volo.Abp.Http.Client.Tests/Volo.Abp.Http.Client.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -14,4 +14,4 @@ - \ No newline at end of file + diff --git a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/PersonAppServiceClientProxy_Tests.cs b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/PersonAppServiceClientProxy_Tests.cs index 80a68e5a18..5fa3d4ab66 100644 --- a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/PersonAppServiceClientProxy_Tests.cs +++ b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/PersonAppServiceClientProxy_Tests.cs @@ -2,6 +2,7 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; +using NSubstitute.Extensions; using Shouldly; using Volo.Abp.Application.Dtos; using Volo.Abp.Domain.Repositories; @@ -9,6 +10,7 @@ using Volo.Abp.Http.Client; using Volo.Abp.TestApp.Application; using Volo.Abp.TestApp.Application.Dto; using Volo.Abp.TestApp.Domain; +using Volo.Abp.Validation; using Xunit; namespace Volo.Abp.Http.DynamicProxying @@ -29,7 +31,7 @@ namespace Volo.Abp.Http.DynamicProxying { var firstPerson = (await _personRepository.GetListAsync()).First(); - var person = await _peopleAppService.GetAsync(firstPerson.Id).ConfigureAwait(false); + var person = await _peopleAppService.GetAsync(firstPerson.Id); person.ShouldNotBeNull(); person.Id.ShouldBe(firstPerson.Id); person.Name.ShouldBe(firstPerson.Name); @@ -38,7 +40,8 @@ namespace Volo.Abp.Http.DynamicProxying [Fact] public async Task GetList() { - var people = await _peopleAppService.GetListAsync(new PagedAndSortedResultRequestDto()).ConfigureAwait(false); + var people = await _peopleAppService.GetListAsync(new PagedAndSortedResultRequestDto()) + ; people.TotalCount.ShouldBeGreaterThan(0); people.Items.Count.ShouldBe((int) people.TotalCount); } @@ -48,7 +51,7 @@ namespace Volo.Abp.Http.DynamicProxying { var firstPerson = (await _personRepository.GetListAsync()).First(); - await _peopleAppService.DeleteAsync(firstPerson.Id).ConfigureAwait(false); + await _peopleAppService.DeleteAsync(firstPerson.Id); firstPerson = (await _personRepository.GetListAsync()).FirstOrDefault(p => p.Id == firstPerson.Id); firstPerson.ShouldBeNull(); @@ -59,12 +62,12 @@ namespace Volo.Abp.Http.DynamicProxying { var uniquePersonName = Guid.NewGuid().ToString(); - var person = await _peopleAppService.CreateAsync(new PersonDto - { - Name = uniquePersonName, - Age = 42 - } - ).ConfigureAwait(false); + var person = await _peopleAppService.CreateAsync(new PersonDto + { + Name = uniquePersonName, + Age = 42 + } + ); person.ShouldNotBeNull(); person.Id.ShouldNotBe(Guid.Empty); @@ -74,7 +77,20 @@ namespace Volo.Abp.Http.DynamicProxying personInDb.ShouldNotBeNull(); personInDb.Id.ShouldBe(person.Id); } - + + [Fact] + public async Task Create_Validate_Exception() + { + await Assert.ThrowsAsync(async () => + { + var person = await _peopleAppService.CreateAsync(new PersonDto + { + Age = 42 + } + ); + }); + } + [Fact] public async Task Update() { @@ -89,7 +105,7 @@ namespace Volo.Abp.Http.DynamicProxying Name = uniquePersonName, Age = firstPerson.Age } - ).ConfigureAwait(false); + ); person.ShouldNotBeNull(); person.Id.ShouldBe(firstPerson.Id); @@ -108,8 +124,8 @@ namespace Volo.Abp.Http.DynamicProxying { await Assert.ThrowsAnyAsync(async () => { - await _peopleAppService.GetWithAuthorized().ConfigureAwait(false); - }).ConfigureAwait(false); + await _peopleAppService.GetWithAuthorized(); + }); } [Fact] @@ -128,11 +144,11 @@ namespace Volo.Abp.Http.DynamicProxying } } } - ).ConfigureAwait(false); + ); result.Value1.ShouldBe("value one"); result.Inner1.Value2.ShouldBe("value two"); result.Inner1.Inner2.Value3.ShouldBe("value three"); } } -} +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/RegularTestControllerClientProxy_Tests.cs b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/RegularTestControllerClientProxy_Tests.cs index fdf422d585..28a024f68e 100644 --- a/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/RegularTestControllerClientProxy_Tests.cs +++ b/framework/test/Volo.Abp.Http.Client.Tests/Volo/Abp/Http/DynamicProxying/RegularTestControllerClientProxy_Tests.cs @@ -20,41 +20,41 @@ namespace Volo.Abp.Http.DynamicProxying [Fact] public async Task IncrementValueAsync() { - (await _controller.IncrementValueAsync(42).ConfigureAwait(false)).ShouldBe(43); + (await _controller.IncrementValueAsync(42)).ShouldBe(43); } [Fact] public async Task GetException1Async() { - var exception = await Assert.ThrowsAsync(async () => await _controller.GetException1Async().ConfigureAwait(false)).ConfigureAwait(false); + var exception = await Assert.ThrowsAsync(async () => await _controller.GetException1Async()); exception.Error.Message.ShouldBe("This is an error message!"); } [Fact] public async Task PostValueWithHeaderAndQueryStringAsync() { - var result = await _controller.PostValueWithHeaderAndQueryStringAsync("myheader", "myqs").ConfigureAwait(false); + var result = await _controller.PostValueWithHeaderAndQueryStringAsync("myheader", "myqs"); result.ShouldBe("myheader#myqs"); } [Fact] public async Task PostValueWithBodyAsync() { - var result = await _controller.PostValueWithBodyAsync("mybody").ConfigureAwait(false); + var result = await _controller.PostValueWithBodyAsync("mybody"); result.ShouldBe("mybody"); } [Fact] public async Task PutValueWithBodyAsync() { - var result = await _controller.PutValueWithBodyAsync("mybody").ConfigureAwait(false); + var result = await _controller.PutValueWithBodyAsync("mybody"); result.ShouldBe("mybody"); } [Fact] public async Task PostObjectWithBodyAsync() { - var result = await _controller.PostObjectWithBodyAsync(new Car { Year = 1976, Model = "Ford" }).ConfigureAwait(false); + var result = await _controller.PostObjectWithBodyAsync(new Car { Year = 1976, Model = "Ford" }); result.Year.ShouldBe(1976); result.Model.ShouldBe("Ford"); } @@ -62,7 +62,7 @@ namespace Volo.Abp.Http.DynamicProxying [Fact] public async Task PostObjectWithQueryAsync() { - var result = await _controller.PostObjectWithQueryAsync(new Car { Year = 1976, Model = "Ford" }).ConfigureAwait(false); + var result = await _controller.PostObjectWithQueryAsync(new Car { Year = 1976, Model = "Ford" }); result.Year.ShouldBe(1976); result.Model.ShouldBe("Ford"); } @@ -70,7 +70,7 @@ namespace Volo.Abp.Http.DynamicProxying [Fact] public async Task GetObjectWithUrlAsync() { - var result = await _controller.GetObjectWithUrlAsync(new Car { Year = 1976, Model = "Ford" }).ConfigureAwait(false); + var result = await _controller.GetObjectWithUrlAsync(new Car { Year = 1976, Model = "Ford" }); result.Year.ShouldBe(1976); result.Model.ShouldBe("Ford"); } @@ -78,7 +78,7 @@ namespace Volo.Abp.Http.DynamicProxying [Fact] public async Task GetObjectandIdAsync() { - var result = await _controller.GetObjectandIdAsync(42, new Car { Year = 1976, Model = "Ford" }).ConfigureAwait(false); + var result = await _controller.GetObjectandIdAsync(42, new Car { Year = 1976, Model = "Ford" }); result.Year.ShouldBe(42); result.Model.ShouldBe("Ford"); } @@ -86,7 +86,7 @@ namespace Volo.Abp.Http.DynamicProxying [Fact] public async Task GetObjectAndIdWithQueryAsync() { - var result = await _controller.GetObjectAndIdWithQueryAsync(42, new Car { Year = 1976, Model = "Ford" }).ConfigureAwait(false); + var result = await _controller.GetObjectAndIdWithQueryAsync(42, new Car { Year = 1976, Model = "Ford" }); result.Year.ShouldBe(42); result.Model.ShouldBe("Ford"); } @@ -94,28 +94,28 @@ namespace Volo.Abp.Http.DynamicProxying [Fact] public async Task PatchValueWithBodyAsync() { - var result = await _controller.PatchValueWithBodyAsync("mybody").ConfigureAwait(false); + var result = await _controller.PatchValueWithBodyAsync("mybody"); result.ShouldBe("mybody"); } [Fact] public async Task PutValueWithHeaderAndQueryStringAsync() { - var result = await _controller.PutValueWithHeaderAndQueryStringAsync("myheader", "myqs").ConfigureAwait(false); + var result = await _controller.PutValueWithHeaderAndQueryStringAsync("myheader", "myqs"); result.ShouldBe("myheader#myqs"); } [Fact] public async Task PatchValueWithHeaderAndQueryStringAsync() { - var result = await _controller.PatchValueWithHeaderAndQueryStringAsync("myheader", "myqs").ConfigureAwait(false); + var result = await _controller.PatchValueWithHeaderAndQueryStringAsync("myheader", "myqs"); result.ShouldBe("myheader#myqs"); } [Fact] public async Task DeleteByIdAsync() { - (await _controller.DeleteByIdAsync(42).ConfigureAwait(false)).ShouldBe(43); + (await _controller.DeleteByIdAsync(42)).ShouldBe(43); } } diff --git a/framework/test/Volo.Abp.Ldap.Tests/Volo.Abp.Ldap.Tests.csproj b/framework/test/Volo.Abp.Ldap.Tests/Volo.Abp.Ldap.Tests.csproj index 8f803774b2..c0854a7633 100644 --- a/framework/test/Volo.Abp.Ldap.Tests/Volo.Abp.Ldap.Tests.csproj +++ b/framework/test/Volo.Abp.Ldap.Tests/Volo.Abp.Ldap.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.Localization.Tests/Volo.Abp.Localization.Tests.csproj b/framework/test/Volo.Abp.Localization.Tests/Volo.Abp.Localization.Tests.csproj index b3afc78948..20c92c8cf8 100644 --- a/framework/test/Volo.Abp.Localization.Tests/Volo.Abp.Localization.Tests.csproj +++ b/framework/test/Volo.Abp.Localization.Tests/Volo.Abp.Localization.Tests.csproj @@ -1,5 +1,5 @@ - - + + diff --git a/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/Base/CountryNames/zh-Hant.json b/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/Base/CountryNames/zh-Hant.json new file mode 100644 index 0000000000..8ce2ad288a --- /dev/null +++ b/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/Base/CountryNames/zh-Hant.json @@ -0,0 +1,7 @@ +{ + "culture": "zh-Hant", + "texts": { + "USA": "美國", + "Brazil": "巴西" + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/Base/Validation/zh-Hant.json b/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/Base/Validation/zh-Hant.json new file mode 100644 index 0000000000..1c0f506d34 --- /dev/null +++ b/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/Base/Validation/zh-Hant.json @@ -0,0 +1,7 @@ +{ + "culture": "zh-Hant", + "texts": { + "ThisFieldIsRequired": "此欄位為必填欄位", + "MaxLenghtErrorMessage": "此欄位最多可包含'{0}'個字元" + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/Source/zh-Hant.json b/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/Source/zh-Hant.json new file mode 100644 index 0000000000..1aeb9cdf6f --- /dev/null +++ b/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/Source/zh-Hant.json @@ -0,0 +1,11 @@ +{ + "culture": "zh-Hant", + "texts": { + "Hello {0}.": "您好 {0}.", + "Car": "汽車", + "CarPlural": "汽車", + "MaxLenghtErrorMessage": "此欄位的長度最多'{0}'個字元", + "Universe": "宇宙", + "FortyTwo": "四十二" + } +} diff --git a/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/SourceExt/zh-Hant.json b/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/SourceExt/zh-Hant.json new file mode 100644 index 0000000000..c779d77a25 --- /dev/null +++ b/framework/test/Volo.Abp.Localization.Tests/Volo/Abp/Localization/TestResources/SourceExt/zh-Hant.json @@ -0,0 +1,6 @@ +{ + "culture": "zh-Hant", + "texts": { + "SeeYou": "再會" + } +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.MailKit.Tests/Volo.Abp.MailKit.Tests.csproj b/framework/test/Volo.Abp.MailKit.Tests/Volo.Abp.MailKit.Tests.csproj index b8f417d384..bc5d991884 100644 --- a/framework/test/Volo.Abp.MailKit.Tests/Volo.Abp.MailKit.Tests.csproj +++ b/framework/test/Volo.Abp.MailKit.Tests/Volo.Abp.MailKit.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -14,4 +14,4 @@ - \ No newline at end of file + diff --git a/framework/test/Volo.Abp.MailKit.Tests/Volo/Abp/MailKit/MailKitSmtpEmailSender_Tests.cs b/framework/test/Volo.Abp.MailKit.Tests/Volo/Abp/MailKit/MailKitSmtpEmailSender_Tests.cs index e323b1150e..39fd4ea78f 100644 --- a/framework/test/Volo.Abp.MailKit.Tests/Volo/Abp/MailKit/MailKitSmtpEmailSender_Tests.cs +++ b/framework/test/Volo.Abp.MailKit.Tests/Volo/Abp/MailKit/MailKitSmtpEmailSender_Tests.cs @@ -18,7 +18,7 @@ namespace Volo.Abp.MailKit var mailMessage = new MailMessage("from_mail_address@asd.com", "to_mail_address@asd.com", "subject", "body") { IsBodyHtml = true }; - await mailSender.SendAsync(mailMessage).ConfigureAwait(false); + await mailSender.SendAsync(mailMessage); } //[Fact] @@ -30,7 +30,7 @@ namespace Volo.Abp.MailKit IsBodyHtml = true }; - await mailSender.SendAsync(mailMessage).ConfigureAwait(false); + await mailSender.SendAsync(mailMessage); } private static MailKitSmtpEmailSender CreateMailKitEmailSender() diff --git a/framework/test/Volo.Abp.MemoryDb.Tests/Volo.Abp.MemoryDb.Tests.csproj b/framework/test/Volo.Abp.MemoryDb.Tests/Volo.Abp.MemoryDb.Tests.csproj index ad478b062a..9b6adc9442 100644 --- a/framework/test/Volo.Abp.MemoryDb.Tests/Volo.Abp.MemoryDb.Tests.csproj +++ b/framework/test/Volo.Abp.MemoryDb.Tests/Volo.Abp.MemoryDb.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -15,4 +15,4 @@ - \ No newline at end of file + diff --git a/framework/test/Volo.Abp.MemoryDb.Tests/Volo/Abp/TestApp/MemoryDb/CityRepository.cs b/framework/test/Volo.Abp.MemoryDb.Tests/Volo/Abp/TestApp/MemoryDb/CityRepository.cs index c83a28871f..b6d43dc875 100644 --- a/framework/test/Volo.Abp.MemoryDb.Tests/Volo/Abp/TestApp/MemoryDb/CityRepository.cs +++ b/framework/test/Volo.Abp.MemoryDb.Tests/Volo/Abp/TestApp/MemoryDb/CityRepository.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.TestApp.MemoryDb public async Task> GetPeopleInTheCityAsync(string cityName) { - var city = await FindByNameAsync(cityName).ConfigureAwait(false); + var city = await FindByNameAsync(cityName); return Database.Collection().Where(p => p.CityId == city.Id).ToList(); } diff --git a/framework/test/Volo.Abp.Minify.Tests/Volo.Abp.Minify.Tests.csproj b/framework/test/Volo.Abp.Minify.Tests/Volo.Abp.Minify.Tests.csproj index 5d07377aa1..69b159dd0f 100644 --- a/framework/test/Volo.Abp.Minify.Tests/Volo.Abp.Minify.Tests.csproj +++ b/framework/test/Volo.Abp.Minify.Tests/Volo.Abp.Minify.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -13,4 +13,4 @@ - \ No newline at end of file + diff --git a/framework/test/Volo.Abp.MongoDB.Tests/Volo.Abp.MongoDB.Tests.csproj b/framework/test/Volo.Abp.MongoDB.Tests/Volo.Abp.MongoDB.Tests.csproj index cc1cb52a96..dc35828937 100644 --- a/framework/test/Volo.Abp.MongoDB.Tests/Volo.Abp.MongoDB.Tests.csproj +++ b/framework/test/Volo.Abp.MongoDB.Tests/Volo.Abp.MongoDB.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -19,4 +19,4 @@ - \ No newline at end of file + diff --git a/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/DataFiltering/HardDelete_Tests.cs b/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/DataFiltering/HardDelete_Tests.cs new file mode 100644 index 0000000000..66c6e58b5c --- /dev/null +++ b/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/DataFiltering/HardDelete_Tests.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Volo.Abp.TestApp.Testing; + +namespace Volo.Abp.MongoDB.DataFiltering +{ + public class HardDelete_Tests : HardDelete_Tests + { + } +} diff --git a/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs b/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs index 7458f85417..efa64b3617 100644 --- a/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs +++ b/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/MongoDB/Repositories/Repository_Basic_Tests.cs @@ -19,20 +19,20 @@ namespace Volo.Abp.MongoDB.Repositories PersonRepository.FirstOrDefault(p => p.Name == "Douglas").ShouldNotBeNull(); PersonRepository.Count().ShouldBeGreaterThan(0); return Task.CompletedTask; - }).ConfigureAwait(false); + }); } [Fact] public async Task UpdateAsync() { - var person = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); + var person = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId); person.ChangeName("Douglas-Updated"); person.Phones.Add(new Phone(person.Id, "6667778899", PhoneType.Office)); - await PersonRepository.UpdateAsync(person).ConfigureAwait(false); + await PersonRepository.UpdateAsync(person); - person = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); + person = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); person.ShouldNotBeNull(); person.Name.ShouldBe("Douglas-Updated"); person.Phones.Count.ShouldBe(3); @@ -45,9 +45,9 @@ namespace Volo.Abp.MongoDB.Repositories var person = new Person(Guid.NewGuid(), "New Person", 35); person.Phones.Add(new Phone(person.Id, "1234567890")); - await PersonRepository.InsertAsync(person).ConfigureAwait(false); + await PersonRepository.InsertAsync(person); - person = await PersonRepository.FindAsync(person.Id).ConfigureAwait(false); + person = await PersonRepository.FindAsync(person.Id); person.ShouldNotBeNull(); person.Name.ShouldBe("New Person"); person.Phones.Count.ShouldBe(1); diff --git a/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/TestApp/MongoDb/CityRepository.cs b/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/TestApp/MongoDb/CityRepository.cs index 27381a14da..bb31883010 100644 --- a/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/TestApp/MongoDb/CityRepository.cs +++ b/framework/test/Volo.Abp.MongoDB.Tests/Volo/Abp/TestApp/MongoDb/CityRepository.cs @@ -19,13 +19,13 @@ namespace Volo.Abp.TestApp.MongoDB public async Task FindByNameAsync(string name) { - return await (await Collection.FindAsync(c => c.Name == name).ConfigureAwait(false)).FirstOrDefaultAsync().ConfigureAwait(false); + return await (await Collection.FindAsync(c => c.Name == name)).FirstOrDefaultAsync(); } public async Task> GetPeopleInTheCityAsync(string cityName) { - var city = await FindByNameAsync(cityName).ConfigureAwait(false); - return await DbContext.People.AsQueryable().Where(p => p.CityId == city.Id).ToListAsync().ConfigureAwait(false); + var city = await FindByNameAsync(cityName); + return await DbContext.People.AsQueryable().Where(p => p.CityId == city.Id).ToListAsync(); } } } diff --git a/framework/test/Volo.Abp.MultiTenancy.Tests/Volo.Abp.MultiTenancy.Tests.csproj b/framework/test/Volo.Abp.MultiTenancy.Tests/Volo.Abp.MultiTenancy.Tests.csproj index 808b58409e..1c9ab1ab4b 100644 --- a/framework/test/Volo.Abp.MultiTenancy.Tests/Volo.Abp.MultiTenancy.Tests.csproj +++ b/framework/test/Volo.Abp.MultiTenancy.Tests/Volo.Abp.MultiTenancy.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.ObjectMapping.Tests/Volo.Abp.ObjectMapping.Tests.csproj b/framework/test/Volo.Abp.ObjectMapping.Tests/Volo.Abp.ObjectMapping.Tests.csproj index a77a4e3301..c4b54f9efd 100644 --- a/framework/test/Volo.Abp.ObjectMapping.Tests/Volo.Abp.ObjectMapping.Tests.csproj +++ b/framework/test/Volo.Abp.ObjectMapping.Tests/Volo.Abp.ObjectMapping.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.Security.Tests/Volo.Abp.Security.Tests.csproj b/framework/test/Volo.Abp.Security.Tests/Volo.Abp.Security.Tests.csproj index 7688e0c040..6e99e2d1e8 100644 --- a/framework/test/Volo.Abp.Security.Tests/Volo.Abp.Security.Tests.csproj +++ b/framework/test/Volo.Abp.Security.Tests/Volo.Abp.Security.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.Serialization.Tests/Volo.Abp.Serialization.Tests.csproj b/framework/test/Volo.Abp.Serialization.Tests/Volo.Abp.Serialization.Tests.csproj index c973b4fcd1..36df9d0a60 100644 --- a/framework/test/Volo.Abp.Serialization.Tests/Volo.Abp.Serialization.Tests.csproj +++ b/framework/test/Volo.Abp.Serialization.Tests/Volo.Abp.Serialization.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.Settings.Tests/Volo.Abp.Settings.Tests.csproj b/framework/test/Volo.Abp.Settings.Tests/Volo.Abp.Settings.Tests.csproj index 183b0b6c81..70d52138a3 100644 --- a/framework/test/Volo.Abp.Settings.Tests/Volo.Abp.Settings.Tests.csproj +++ b/framework/test/Volo.Abp.Settings.Tests/Volo.Abp.Settings.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingProvider_Tests.cs b/framework/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingProvider_Tests.cs index 47df3f6db1..8508daec12 100644 --- a/framework/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingProvider_Tests.cs +++ b/framework/test/Volo.Abp.Settings.Tests/Volo/Abp/Settings/SettingProvider_Tests.cs @@ -22,14 +22,14 @@ namespace Volo.Abp.Settings [Fact] public async Task Should_Get_Null_If_No_Value_Provided_And_No_Default_Value() { - (await _settingProvider.GetOrNullAsync(TestSettingNames.TestSettingWithoutDefaultValue).ConfigureAwait(false)) + (await _settingProvider.GetOrNullAsync(TestSettingNames.TestSettingWithoutDefaultValue)) .ShouldBeNull(); } [Fact] public async Task Should_Get_Default_Value_If_No_Value_Provided_And_There_Is_A_Default_Value() { - (await _settingProvider.GetOrNullAsync(TestSettingNames.TestSettingWithDefaultValue).ConfigureAwait(false)) + (await _settingProvider.GetOrNullAsync(TestSettingNames.TestSettingWithDefaultValue)) .ShouldBe("default-value"); } } diff --git a/framework/test/Volo.Abp.Specifications.Tests/Volo.Abp.Specifications.Tests.csproj b/framework/test/Volo.Abp.Specifications.Tests/Volo.Abp.Specifications.Tests.csproj index 6b836d2efe..0ddc58ea96 100644 --- a/framework/test/Volo.Abp.Specifications.Tests/Volo.Abp.Specifications.Tests.csproj +++ b/framework/test/Volo.Abp.Specifications.Tests/Volo.Abp.Specifications.Tests.csproj @@ -1,4 +1,4 @@ - + @@ -13,4 +13,4 @@ - \ No newline at end of file + diff --git a/framework/test/Volo.Abp.TestApp.Tests/Volo.Abp.TestApp.Tests.csproj b/framework/test/Volo.Abp.TestApp.Tests/Volo.Abp.TestApp.Tests.csproj index 1d54a745ab..b733889bf0 100644 --- a/framework/test/Volo.Abp.TestApp.Tests/Volo.Abp.TestApp.Tests.csproj +++ b/framework/test/Volo.Abp.TestApp.Tests/Volo.Abp.TestApp.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.TestApp.Tests/Volo/Abp/TestApp/Application/PersonAppService_Tests.cs b/framework/test/Volo.Abp.TestApp.Tests/Volo/Abp/TestApp/Application/PersonAppService_Tests.cs index fc38b437b8..8d205df899 100644 --- a/framework/test/Volo.Abp.TestApp.Tests/Volo/Abp/TestApp/Application/PersonAppService_Tests.cs +++ b/framework/test/Volo.Abp.TestApp.Tests/Volo/Abp/TestApp/Application/PersonAppService_Tests.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.TestApp.Application public PersonAppService_Tests() { - _peopleAppService = ServiceProvider.GetRequiredService(); + _peopleAppService = ServiceProvider.GetRequiredService(); } protected override void AfterAddApplication(IServiceCollection services) @@ -31,17 +31,19 @@ namespace Volo.Abp.TestApp.Application [Fact] public async Task GetList() { - var people = await _peopleAppService.GetListAsync(new PagedAndSortedResultRequestDto()).ConfigureAwait(false); + var people = await _peopleAppService.GetListAsync(new PagedAndSortedResultRequestDto()) + ; people.Items.Count.ShouldBeGreaterThan(0); } [Fact] public async Task Create() { - var personDto = await _peopleAppService.CreateAsync(new PersonDto()).ConfigureAwait(false); + var uniquePersonName = Guid.NewGuid().ToString(); + var personDto = await _peopleAppService.CreateAsync(new PersonDto {Name = uniquePersonName}); var repository = ServiceProvider.GetService>(); - var person = await repository.FindAsync(personDto.Id).ConfigureAwait(false); + var person = await repository.FindAsync(personDto.Id); person.ShouldNotBeNull(); person.TenantId.ShouldBeNull(); @@ -52,10 +54,11 @@ namespace Volo.Abp.TestApp.Application { _fakeCurrentTenant.Id.Returns(TestDataBuilder.TenantId1); - var personDto = await _peopleAppService.CreateAsync(new PersonDto()).ConfigureAwait(false); + var uniquePersonName = Guid.NewGuid().ToString(); + var personDto = await _peopleAppService.CreateAsync(new PersonDto {Name = uniquePersonName}); var repository = ServiceProvider.GetService>(); - var person = await repository.FindAsync(personDto.Id).ConfigureAwait(false); + var person = await repository.FindAsync(personDto.Id); person.ShouldNotBeNull(); person.TenantId.ShouldNotBeNull(); @@ -63,4 +66,4 @@ namespace Volo.Abp.TestApp.Application person.TenantId.ShouldBe(TestDataBuilder.TenantId1); } } -} +} \ No newline at end of file diff --git a/framework/test/Volo.Abp.TestApp/Volo.Abp.TestApp.csproj b/framework/test/Volo.Abp.TestApp/Volo.Abp.TestApp.csproj index 522d166014..c2d9ab2007 100644 --- a/framework/test/Volo.Abp.TestApp/Volo.Abp.TestApp.csproj +++ b/framework/test/Volo.Abp.TestApp/Volo.Abp.TestApp.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/Dto/PersonDto.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/Dto/PersonDto.cs index b878b4f9c4..88ed3452af 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/Dto/PersonDto.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/Dto/PersonDto.cs @@ -1,4 +1,5 @@ using System; +using System.ComponentModel.DataAnnotations; using Volo.Abp.Application.Dtos; using Volo.Abp.MultiTenancy; @@ -6,6 +7,7 @@ namespace Volo.Abp.TestApp.Application.Dto { public class PersonDto : EntityDto, IMultiTenant { + [Required] public string Name { get; set; } public int Age { get; set; } diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/PeopleAppService.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/PeopleAppService.cs index 6d5c2136f3..522f8d9794 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/PeopleAppService.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Application/PeopleAppService.cs @@ -21,7 +21,7 @@ namespace Volo.Abp.TestApp.Application public async Task> GetPhones(Guid id, GetPersonPhonesFilter filter) { - var phones = (await GetEntityByIdAsync(id).ConfigureAwait(false)).Phones + var phones = (await GetEntityByIdAsync(id)).Phones .WhereIf(filter.Type.HasValue, p => p.Type == filter.Type) .ToList(); @@ -32,19 +32,19 @@ namespace Volo.Abp.TestApp.Application public async Task AddPhone(Guid id, PhoneDto phoneDto) { - var person = await GetEntityByIdAsync(id).ConfigureAwait(false); + var person = await GetEntityByIdAsync(id); var phone = new Phone(person.Id, phoneDto.Number, phoneDto.Type); person.Phones.Add(phone); - await Repository.UpdateAsync(person).ConfigureAwait(false); + await Repository.UpdateAsync(person); return ObjectMapper.Map(phone); } public async Task RemovePhone(Guid id, string number) { - var person = await GetEntityByIdAsync(id).ConfigureAwait(false); + var person = await GetEntityByIdAsync(id); person.Phones.RemoveAll(p => p.Number == number); - await Repository.UpdateAsync(person).ConfigureAwait(false); + await Repository.UpdateAsync(person); } [Authorize] diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Domain/Phone.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Domain/Phone.cs index 20292e3de8..c5522cf53a 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Domain/Phone.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Domain/Phone.cs @@ -7,7 +7,7 @@ using Volo.Abp.Domain.Entities; namespace Volo.Abp.TestApp.Domain { [Table("AppPhones")] - public class Phone : Entity + public class Phone : Entity { public virtual Guid PersonId { get; set; } @@ -17,11 +17,12 @@ namespace Volo.Abp.TestApp.Domain private Phone() { - + } public Phone(Guid personId, string number, PhoneType type = PhoneType.Mobile) { + Id = Guid.NewGuid(); PersonId = personId; Number = number; Type = type; @@ -29,7 +30,7 @@ namespace Volo.Abp.TestApp.Domain public override object[] GetKeys() { - return new object[] {PersonId, Number}; + return new object[] { PersonId, Number }; } } @@ -45,7 +46,7 @@ namespace Volo.Abp.TestApp.Domain protected Order() { - + } public Order(Guid id, string referenceNo) @@ -104,7 +105,7 @@ namespace Volo.Abp.TestApp.Domain public override object[] GetKeys() { - return new object[] {OrderId, ProductId}; + return new object[] { OrderId, ProductId }; } } } \ No newline at end of file diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestDataBuilder.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestDataBuilder.cs index 7e2be35de0..6d1be41f31 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestDataBuilder.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/TestDataBuilder.cs @@ -32,29 +32,29 @@ namespace Volo.Abp.TestApp public async Task BuildAsync() { - await AddCities().ConfigureAwait(false); - await AddPeople().ConfigureAwait(false); - await AddEntitiesWithPks().ConfigureAwait(false); + await AddCities(); + await AddPeople(); + await AddEntitiesWithPks(); } private async Task AddCities() { var istanbul = new City(IstanbulCityId, "Istanbul"); istanbul.Districts.Add(new District(istanbul.Id, "Bakirkoy", 1283999)); - istanbul.Districts.Add(new District(istanbul.Id, "Mecidiyeky", 2222321)); + istanbul.Districts.Add(new District(istanbul.Id, "Mecidiyek�y", 2222321)); istanbul.Districts.Add(new District(istanbul.Id, "Uskudar", 726172)); - await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Tokyo")).ConfigureAwait(false); - await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Madrid")).ConfigureAwait(false); - await _cityRepository.InsertAsync(new City(LondonCityId, "London") { ExtraProperties = { { "Population", 10_470_000 } } }).ConfigureAwait(false); - await _cityRepository.InsertAsync(istanbul).ConfigureAwait(false); - await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Paris")).ConfigureAwait(false); - await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Washington")).ConfigureAwait(false); - await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Sao Paulo")).ConfigureAwait(false); - await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Berlin")).ConfigureAwait(false); - await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Amsterdam")).ConfigureAwait(false); - await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Beijing")).ConfigureAwait(false); - await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Rome")).ConfigureAwait(false); + await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Tokyo")); + await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Madrid")); + await _cityRepository.InsertAsync(new City(LondonCityId, "London") { ExtraProperties = { { "Population", 10_470_000 } } }); + await _cityRepository.InsertAsync(istanbul); + await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Paris")); + await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Washington")); + await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Sao Paulo")); + await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Berlin")); + await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Amsterdam")); + await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Beijing")); + await _cityRepository.InsertAsync(new City(Guid.NewGuid(), "Rome")); } private async Task AddPeople() @@ -63,20 +63,20 @@ namespace Volo.Abp.TestApp douglas.Phones.Add(new Phone(douglas.Id, "123456789")); douglas.Phones.Add(new Phone(douglas.Id, "123456780", PhoneType.Home)); - await _personRepository.InsertAsync(douglas).ConfigureAwait(false); + await _personRepository.InsertAsync(douglas); - await _personRepository.InsertAsync(new Person(UserJohnDeletedId, "John-Deleted", 33) { IsDeleted = true }).ConfigureAwait(false); + await _personRepository.InsertAsync(new Person(UserJohnDeletedId, "John-Deleted", 33) { IsDeleted = true }); var tenant1Person1 = new Person(Guid.NewGuid(), TenantId1 + "-Person1", 42, TenantId1); var tenant1Person2 = new Person(Guid.NewGuid(), TenantId1 + "-Person2", 43, TenantId1); - await _personRepository.InsertAsync(tenant1Person1).ConfigureAwait(false); - await _personRepository.InsertAsync(tenant1Person2).ConfigureAwait(false); + await _personRepository.InsertAsync(tenant1Person1); + await _personRepository.InsertAsync(tenant1Person2); } private async Task AddEntitiesWithPks() { - await _entityWithIntPksRepository.InsertAsync(new EntityWithIntPk("Entity1")).ConfigureAwait(false); + await _entityWithIntPksRepository.InsertAsync(new EntityWithIntPk("Entity1")); } } } \ No newline at end of file diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/AbpDateTimeValueConverter_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/AbpDateTimeValueConverter_Tests.cs index 782f61830a..e36225e53c 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/AbpDateTimeValueConverter_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/AbpDateTimeValueConverter_Tests.cs @@ -28,9 +28,9 @@ namespace Volo.Abp.TestApp.Testing { Birthday = DateTime.Parse("2020-01-01 00:00:00"), LastActive = DateTime.Parse("2020-01-01 00:00:00"), - }, true).ConfigureAwait(false); + }, true); - var person = await _personRepository.GetAsync(personId).ConfigureAwait(false); + var person = await _personRepository.GetAsync(personId); person.ShouldNotBeNull(); person.CreationTime.Kind.ShouldBe(DateTimeKind.Utc); @@ -53,9 +53,9 @@ namespace Volo.Abp.TestApp.Testing { Birthday = DateTime.Parse("2020-01-01 00:00:00"), LastActive = DateTime.Parse("2020-01-01 00:00:00"), - }, true).ConfigureAwait(false); + }, true); - var person = await _personRepository.GetViewAsync(personName).ConfigureAwait(false); + var person = await _personRepository.GetViewAsync(personName); person.ShouldNotBeNull(); person.CreationTime.Kind.ShouldBe(DateTimeKind.Utc); diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Auditing_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Auditing_Tests.cs index dcbfdaf045..41ef7ce076 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Auditing_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Auditing_Tests.cs @@ -49,9 +49,9 @@ namespace Volo.Abp.TestApp.Testing var personId = Guid.NewGuid(); - await PersonRepository.InsertAsync(new Person(personId, "Adam", 42)).ConfigureAwait(false); + await PersonRepository.InsertAsync(new Person(personId, "Adam", 42)); - var person = await PersonRepository.FindAsync(personId).ConfigureAwait(false); + var person = await PersonRepository.FindAsync(personId); person.ShouldNotBeNull(); person.CreationTime.ShouldBeLessThanOrEqualTo(Clock.Now); @@ -68,14 +68,14 @@ namespace Volo.Abp.TestApp.Testing CurrentUserId = Guid.Parse(currentUserId); } - var douglas = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); + var douglas = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId); douglas.LastModificationTime.ShouldBeNull(); douglas.Age++; - await PersonRepository.UpdateAsync(douglas).ConfigureAwait(false); + await PersonRepository.UpdateAsync(douglas); - douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); douglas.ShouldNotBeNull(); douglas.LastModificationTime.ShouldNotBeNull(); @@ -93,17 +93,17 @@ namespace Volo.Abp.TestApp.Testing CurrentUserId = Guid.Parse(currentUserId); } - var douglas = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); + var douglas = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId); - await PersonRepository.DeleteAsync(douglas).ConfigureAwait(false); + await PersonRepository.DeleteAsync(douglas); - douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); douglas.ShouldBeNull(); using (DataFilter.Disable()) { - douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); douglas.ShouldNotBeNull(); douglas.DeletionTime.ShouldNotBeNull(); diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/ConcurrencyStamp_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/ConcurrencyStamp_Tests.cs index 1f7c927251..2c5a5d89ab 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/ConcurrencyStamp_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/ConcurrencyStamp_Tests.cs @@ -20,37 +20,37 @@ namespace Volo.Abp.TestApp.Testing public async Task Should_Not_Allow_To_Update_If_The_Entity_Has_Changed() { //Got an entity from database, changed its value, but not updated in the database yet - var london1 = await CityRepository.FindByNameAsync("London").ConfigureAwait(false); + var london1 = await CityRepository.FindByNameAsync("London"); london1.Name = "London-1"; //Another user has changed it just before I update - var london2 = await CityRepository.FindByNameAsync("London").ConfigureAwait(false); + var london2 = await CityRepository.FindByNameAsync("London"); london2.Name = "London-2"; - await CityRepository.UpdateAsync(london2).ConfigureAwait(false); + await CityRepository.UpdateAsync(london2); //And updating my old entity throws exception! await Assert.ThrowsAsync(async () => { - await CityRepository.UpdateAsync(london1).ConfigureAwait(false); - }).ConfigureAwait(false); + await CityRepository.UpdateAsync(london1); + }); } [Fact] public async Task Should_Not_Allow_To_Delete_If_The_Entity_Has_Changed() { //Got an entity from database, but not deleted in the database yet - var london1 = await CityRepository.FindByNameAsync("London").ConfigureAwait(false); + var london1 = await CityRepository.FindByNameAsync("London"); //Another user has changed it just before I delete - var london2 = await CityRepository.FindByNameAsync("London").ConfigureAwait(false); + var london2 = await CityRepository.FindByNameAsync("London"); london2.Name = "London-updated"; - await CityRepository.UpdateAsync(london2).ConfigureAwait(false); + await CityRepository.UpdateAsync(london2); //And deleting my old entity throws exception! await Assert.ThrowsAsync(async () => { - await CityRepository.DeleteAsync(london1).ConfigureAwait(false); - }).ConfigureAwait(false); + await CityRepository.DeleteAsync(london1); + }); } } } diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/DomainEvents_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/DomainEvents_Tests.cs index 2c6982de6a..3ca7eaf8e4 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/DomainEvents_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/DomainEvents_Tests.cs @@ -55,8 +55,8 @@ namespace Volo.Abp.TestApp.Testing { var dougles = PersonRepository.Single(b => b.Name == "Douglas"); dougles.ChangeName("Douglas-Changed"); - await PersonRepository.UpdateAsync(dougles).ConfigureAwait(false); - }).ConfigureAwait(false); + await PersonRepository.UpdateAsync(dougles); + }); //Assert diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/EntityChangeEvents_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/EntityChangeEvents_Tests.cs index bc38257683..fe4e0862f3 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/EntityChangeEvents_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/EntityChangeEvents_Tests.cs @@ -75,9 +75,9 @@ namespace Volo.Abp.TestApp.Testing return Task.CompletedTask; }); - await PersonRepository.InsertAsync(new Person(Guid.NewGuid(), personName, 15)).ConfigureAwait(false); + await PersonRepository.InsertAsync(new Person(Guid.NewGuid(), personName, 15)); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } creatingEventTriggered.ShouldBeTrue(); diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/ExtraProperties_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/ExtraProperties_Tests.cs index a52ddbee3a..67eff13572 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/ExtraProperties_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/ExtraProperties_Tests.cs @@ -20,7 +20,7 @@ namespace Volo.Abp.TestApp.Testing [Fact] public async Task Should_Get_An_Extra_Property() { - var london = await CityRepository.FindByNameAsync("London").ConfigureAwait(false); + var london = await CityRepository.FindByNameAsync("London"); london.HasProperty("Population").ShouldBeTrue(); london.GetProperty("Population").ShouldBe(10_470_000); } @@ -28,11 +28,11 @@ namespace Volo.Abp.TestApp.Testing [Fact] public async Task Should_Add_An_Extra_Property() { - var london = await CityRepository.FindByNameAsync("London").ConfigureAwait(false); + var london = await CityRepository.FindByNameAsync("London"); london.SetProperty("AreaAsKm", 1572); - await CityRepository.UpdateAsync(london).ConfigureAwait(false); + await CityRepository.UpdateAsync(london); - var london2 = await CityRepository.FindByNameAsync("London").ConfigureAwait(false); + var london2 = await CityRepository.FindByNameAsync("London"); london2.HasProperty("AreaAsKm").ShouldBeTrue(); london2.GetProperty("AreaAsKm").ShouldBe(1572); } @@ -40,12 +40,12 @@ namespace Volo.Abp.TestApp.Testing [Fact] public async Task Should_Update_An_Existing_Extra_Property() { - var london = await CityRepository.FindByNameAsync("London").ConfigureAwait(false); + var london = await CityRepository.FindByNameAsync("London"); london.ExtraProperties["Population"] = 11_000_042; - await CityRepository.UpdateAsync(london).ConfigureAwait(false); + await CityRepository.UpdateAsync(london); - var london2 = await CityRepository.FindByNameAsync("London").ConfigureAwait(false); + var london2 = await CityRepository.FindByNameAsync("London"); london2.HasProperty("Population").ShouldBeTrue(); london2.GetProperty("Population").ShouldBe(11_000_042); } diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/HardDelete_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/HardDelete_Tests.cs new file mode 100644 index 0000000000..1eac79fd7c --- /dev/null +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/HardDelete_Tests.cs @@ -0,0 +1,69 @@ +using Shouldly; +using System; +using System.Threading.Tasks; +using Volo.Abp.Data; +using Volo.Abp.Domain.Repositories; +using Volo.Abp.Modularity; +using Volo.Abp.TestApp.Domain; +using Volo.Abp.Uow; +using Xunit; + +namespace Volo.Abp.TestApp.Testing +{ + public abstract class HardDelete_Tests : TestAppTestBase + where TStartupModule : IAbpModule + { + protected readonly IRepository PersonRepository; + protected readonly IDataFilter DataFilter; + protected readonly IUnitOfWorkManager UnitOfWorkManager; + + protected HardDelete_Tests() + { + PersonRepository = GetRequiredService>(); + DataFilter = GetRequiredService(); + UnitOfWorkManager = GetRequiredService(); + } + + [Fact] + public async Task Should_HardDelete_Entities() + { + var douglas = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId); + await PersonRepository.HardDeleteAsync(douglas); + + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); + douglas.ShouldBeNull(); + } + + [Fact] + public async Task Should_HardDelete_Soft_Deleted_Entities() + { + var douglas = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId); + await PersonRepository.DeleteAsync(douglas); + + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); + douglas.ShouldBeNull(); + + using (DataFilter.Disable()) + { + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); + douglas.ShouldNotBeNull(); + douglas.IsDeleted.ShouldBeTrue(); + douglas.DeletionTime.ShouldNotBeNull(); + } + + using (var uow = UnitOfWorkManager.Begin()) + { + using (DataFilter.Disable()) + { + douglas = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId); + } + + await PersonRepository.HardDeleteAsync(douglas); + await uow.CompleteAsync(); + } + + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); + douglas.ShouldBeNull(); + } + } +} diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/MultiTenant_Creation_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/MultiTenant_Creation_Tests.cs index af910aefba..b8a3e8449c 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/MultiTenant_Creation_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/MultiTenant_Creation_Tests.cs @@ -42,9 +42,9 @@ namespace Volo.Abp.TestApp.Testing Id = personId, Name = "Person1", Age = 21 - }).ConfigureAwait(false); + }); - var person = await _personRepository.FindAsync(personId).ConfigureAwait(false); + var person = await _personRepository.FindAsync(personId); person.ShouldNotBeNull(); person.TenantId.ShouldNotBeNull(); @@ -63,9 +63,9 @@ namespace Volo.Abp.TestApp.Testing Id = personId, Name = "Person1", Age = 21 - }).ConfigureAwait(false); + }); - var person = await _personRepository.FindAsync(personId).ConfigureAwait(false); + var person = await _personRepository.FindAsync(personId); person.ShouldNotBeNull(); person.TenantId.ShouldBeNull(); diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/MultiTenant_Filter_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/MultiTenant_Filter_Tests.cs index 10ce8e1605..da3e33ffea 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/MultiTenant_Filter_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/MultiTenant_Filter_Tests.cs @@ -63,7 +63,7 @@ namespace Volo.Abp.TestApp.Testing people.Count.ShouldBe(0); return Task.CompletedTask; - }).ConfigureAwait(false); + }); } [Fact] @@ -85,7 +85,7 @@ namespace Volo.Abp.TestApp.Testing people.Count.ShouldBe(1); return Task.CompletedTask; - }).ConfigureAwait(false); + }); } } } diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Basic_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Basic_Tests.cs index 7571c4fecd..07e6211c09 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Basic_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Basic_Tests.cs @@ -23,7 +23,7 @@ namespace Volo.Abp.TestApp.Testing [Fact] public async Task GetAsync() { - var person = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); + var person = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId); person.Name.ShouldBe("Douglas"); person.Phones.Count.ShouldBe(2); } @@ -31,29 +31,29 @@ namespace Volo.Abp.TestApp.Testing [Fact] public async Task FindAsync_Should_Return_Null_For_Not_Found_Entity() { - var person = await PersonRepository.FindAsync(Guid.NewGuid()).ConfigureAwait(false); + var person = await PersonRepository.FindAsync(Guid.NewGuid()); person.ShouldBeNull(); } [Fact] public async Task DeleteAsync() { - await PersonRepository.DeleteAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); + await PersonRepository.DeleteAsync(TestDataBuilder.UserDouglasId); - (await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false)).ShouldBeNull(); + (await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId)).ShouldBeNull(); } [Fact] public async Task Should_Access_To_Other_Collections_In_Same_Context_In_A_Custom_Method() { - var people = await CityRepository.GetPeopleInTheCityAsync("London").ConfigureAwait(false); + var people = await CityRepository.GetPeopleInTheCityAsync("London"); people.Count.ShouldBeGreaterThan(0); } [Fact] public async Task Custom_Repository_Method() { - var city = await CityRepository.FindByNameAsync("Istanbul").ConfigureAwait(false); + var city = await CityRepository.FindByNameAsync("Istanbul"); city.ShouldNotBeNull(); city.Name.ShouldBe("Istanbul"); } @@ -63,9 +63,9 @@ namespace Volo.Abp.TestApp.Testing { var personId = Guid.NewGuid(); - await PersonRepository.InsertAsync(new Person(personId, "Adam", 42)).ConfigureAwait(false); + await PersonRepository.InsertAsync(new Person(personId, "Adam", 42)); - var person = await PersonRepository.FindAsync(personId).ConfigureAwait(false); + var person = await PersonRepository.FindAsync(personId); person.ShouldNotBeNull(); } } diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Basic_Tests_With_Int_Pk.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Basic_Tests_With_Int_Pk.cs index 0c3bc5e290..f873fe4265 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Basic_Tests_With_Int_Pk.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Basic_Tests_With_Int_Pk.cs @@ -27,7 +27,7 @@ namespace Volo.Abp.TestApp.Testing entity.ShouldNotBeNull(); entity.Name.ShouldBe("Entity1"); return Task.CompletedTask; - }).ConfigureAwait(false); + }); } [Fact] @@ -35,10 +35,10 @@ namespace Volo.Abp.TestApp.Testing { await WithUnitOfWorkAsync(async () => { - var entity = await EntityWithIntPkRepository.GetAsync(1).ConfigureAwait(false); + var entity = await EntityWithIntPkRepository.GetAsync(1); entity.ShouldNotBeNull(); entity.Name.ShouldBe("Entity1"); - }).ConfigureAwait(false); + }); } } } diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Queryable_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Queryable_Tests.cs index 0e7bf2f7df..6078236380 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Queryable_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Queryable_Tests.cs @@ -27,7 +27,7 @@ namespace Volo.Abp.TestApp.Testing { PersonRepository.Any().ShouldBeTrue(); return Task.CompletedTask; - }).ConfigureAwait(false); + }); } [Fact] @@ -38,7 +38,7 @@ namespace Volo.Abp.TestApp.Testing var person = PersonRepository.Single(p => p.Id == TestDataBuilder.UserDouglasId); person.Name.ShouldBe("Douglas"); return Task.CompletedTask; - }).ConfigureAwait(false); + }); } [Fact] @@ -50,7 +50,7 @@ namespace Volo.Abp.TestApp.Testing person.Name.ShouldBe("Douglas"); person.Phones.Count.ShouldBe(2); return Task.CompletedTask; - }).ConfigureAwait(false); + }); } [Fact] @@ -62,7 +62,7 @@ namespace Volo.Abp.TestApp.Testing person.Name.ShouldBe("Douglas"); person.Phones.Count.ShouldBe(2); return Task.CompletedTask; - }).ConfigureAwait(false); + }); } } } diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Specifications_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Specifications_Tests.cs index 49880535f2..c26134b27c 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Specifications_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Repository_Specifications_Tests.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.TestApp.Testing { CityRepository.Count(new CitySpecification().ToExpression()).ShouldBe(1); return Task.CompletedTask; - }).ConfigureAwait(false); + }); } } diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Filter_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Filter_Tests.cs index 6daba040a4..f3ac8c301f 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Filter_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Filter_Tests.cs @@ -30,7 +30,7 @@ namespace Volo.Abp.TestApp.Testing var person = PersonRepository.FirstOrDefault(p => p.Name == "John-Deleted"); person.ShouldBeNull(); return Task.CompletedTask; - }).ConfigureAwait(false); + }); } [Fact] @@ -38,9 +38,9 @@ namespace Volo.Abp.TestApp.Testing { await WithUnitOfWorkAsync(async () => { - var person = await PersonRepository.FindAsync(TestDataBuilder.UserJohnDeletedId).ConfigureAwait(false); + var person = await PersonRepository.FindAsync(TestDataBuilder.UserJohnDeletedId); person.ShouldBeNull(); - }).ConfigureAwait(false); + }); } [Fact] @@ -52,7 +52,7 @@ namespace Volo.Abp.TestApp.Testing people.Count.ShouldBe(1); people.Any(p => p.Name == "Douglas").ShouldBeTrue(); return Task.CompletedTask; - }).ConfigureAwait(false); + }); } [Fact] @@ -92,7 +92,7 @@ namespace Volo.Abp.TestApp.Testing people.Any(p => p.IsDeleted).ShouldBeFalse(); return Task.CompletedTask; - }).ConfigureAwait(false); + }); } } } diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Tests.cs index e1f4bc56a7..0059a39a11 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/SoftDelete_Tests.cs @@ -24,15 +24,15 @@ namespace Volo.Abp.TestApp.Testing [Fact] public async Task Should_Cancel_Deletion_For_Soft_Delete_Entities() { - var douglas = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); - await PersonRepository.DeleteAsync(douglas).ConfigureAwait(false); + var douglas = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId); + await PersonRepository.DeleteAsync(douglas); - douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); douglas.ShouldBeNull(); using (DataFilter.Disable()) { - douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); douglas.ShouldNotBeNull(); douglas.IsDeleted.ShouldBeTrue(); douglas.DeletionTime.ShouldNotBeNull(); @@ -42,18 +42,18 @@ namespace Volo.Abp.TestApp.Testing [Fact] public async Task Should_Handle_Deletion_On_Update_For_Soft_Delete_Entities() { - var douglas = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); + var douglas = await PersonRepository.GetAsync(TestDataBuilder.UserDouglasId); douglas.Age = 42; douglas.IsDeleted = true; - await PersonRepository.UpdateAsync(douglas).ConfigureAwait(false); + await PersonRepository.UpdateAsync(douglas); - douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); douglas.ShouldBeNull(); using (DataFilter.Disable()) { - douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId).ConfigureAwait(false); + douglas = await PersonRepository.FindAsync(TestDataBuilder.UserDouglasId); douglas.ShouldNotBeNull(); douglas.IsDeleted.ShouldBeTrue(); douglas.DeletionTime.ShouldNotBeNull(); diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/TestAppTestBase.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/TestAppTestBase.cs index 3f80bfb74b..f21cc7371b 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/TestAppTestBase.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/TestAppTestBase.cs @@ -30,9 +30,9 @@ namespace Volo.Abp.TestApp.Testing using (var uow = uowManager.Begin(options)) { - await action().ConfigureAwait(false); + await action(); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } } @@ -50,8 +50,8 @@ namespace Volo.Abp.TestApp.Testing using (var uow = uowManager.Begin(options)) { - var result = await func().ConfigureAwait(false); - await uow.CompleteAsync().ConfigureAwait(false); + var result = await func(); + await uow.CompleteAsync(); return result; } } diff --git a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Uow_Completed_Tests.cs b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Uow_Completed_Tests.cs index a101e64ea6..1b169bbe97 100644 --- a/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Uow_Completed_Tests.cs +++ b/framework/test/Volo.Abp.TestApp/Volo/Abp/TestApp/Testing/Uow_Completed_Tests.cs @@ -25,15 +25,15 @@ namespace Volo.Abp.TestApp.Testing using (var uow = _unitOfWorkManager.Begin()) { //Perform an arbitrary database operation - await _cityRepository.InsertAsync(new City(Guid.NewGuid(), Guid.NewGuid().ToString())).ConfigureAwait(false); + await _cityRepository.InsertAsync(new City(Guid.NewGuid(), Guid.NewGuid().ToString())); uow.OnCompleted(async () => { //Perform another database operation inside the OnCompleted handler - await _cityRepository.InsertAsync(new City(Guid.NewGuid(), Guid.NewGuid().ToString())).ConfigureAwait(false); + await _cityRepository.InsertAsync(new City(Guid.NewGuid(), Guid.NewGuid().ToString())); }); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } } diff --git a/framework/test/Volo.Abp.UI.Navigation.Tests/Volo.Abp.UI.Navigation.Tests.csproj b/framework/test/Volo.Abp.UI.Navigation.Tests/Volo.Abp.UI.Navigation.Tests.csproj index 51beb181a1..bf48039303 100644 --- a/framework/test/Volo.Abp.UI.Navigation.Tests/Volo.Abp.UI.Navigation.Tests.csproj +++ b/framework/test/Volo.Abp.UI.Navigation.Tests/Volo.Abp.UI.Navigation.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.UI.Navigation.Tests/Volo/Abp/Ui/Navigation/MenuManager_Tests.cs b/framework/test/Volo.Abp.UI.Navigation.Tests/Volo/Abp/Ui/Navigation/MenuManager_Tests.cs index 1f5190a9eb..96db1622b5 100644 --- a/framework/test/Volo.Abp.UI.Navigation.Tests/Volo/Abp/Ui/Navigation/MenuManager_Tests.cs +++ b/framework/test/Volo.Abp.UI.Navigation.Tests/Volo/Abp/Ui/Navigation/MenuManager_Tests.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.UI.Navigation [Fact] public async Task Should_Get_Menu() { - var mainMenu = await _menuManager.GetAsync(StandardMenus.Main).ConfigureAwait(false); + var mainMenu = await _menuManager.GetAsync(StandardMenus.Main); mainMenu.Name.ShouldBe(StandardMenus.Main); mainMenu.DisplayName.ShouldBe("Main Menu"); diff --git a/framework/test/Volo.Abp.Uow.Tests/Volo.Abp.Uow.Tests.csproj b/framework/test/Volo.Abp.Uow.Tests/Volo.Abp.Uow.Tests.csproj index 256dd07ed6..32bd3e4af5 100644 --- a/framework/test/Volo.Abp.Uow.Tests/Volo.Abp.Uow.Tests.csproj +++ b/framework/test/Volo.Abp.Uow.Tests/Volo.Abp.Uow.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Ambient_Scope_Tests.cs b/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Ambient_Scope_Tests.cs index 6b1bc2f98d..e0810467b3 100644 --- a/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Ambient_Scope_Tests.cs +++ b/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Ambient_Scope_Tests.cs @@ -30,13 +30,13 @@ namespace Volo.Abp.Uow _unitOfWorkManager.Current.ShouldNotBeNull(); _unitOfWorkManager.Current.Id.ShouldBe(uow1.Id); - await uow2.CompleteAsync().ConfigureAwait(false); + await uow2.CompleteAsync(); } _unitOfWorkManager.Current.ShouldNotBeNull(); _unitOfWorkManager.Current.ShouldBe(uow1); - await uow1.CompleteAsync().ConfigureAwait(false); + await uow1.CompleteAsync(); } _unitOfWorkManager.Current.ShouldBeNull(); @@ -56,7 +56,7 @@ namespace Volo.Abp.Uow _unitOfWorkManager.Current.ShouldNotBeNull(); _unitOfWorkManager.Current.Id.ShouldNotBe(uow1.Id); - await uow2.CompleteAsync().ConfigureAwait(false); + await uow2.CompleteAsync(); } _unitOfWorkManager.Current.ShouldBeNull(); @@ -66,7 +66,7 @@ namespace Volo.Abp.Uow _unitOfWorkManager.Current.ShouldNotBeNull(); _unitOfWorkManager.Current.Id.ShouldBe(uow1.Id); - await uow1.CompleteAsync().ConfigureAwait(false); + await uow1.CompleteAsync(); } _unitOfWorkManager.Current.ShouldBeNull(); diff --git a/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Events_Tests.cs b/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Events_Tests.cs index 9ee2cae2f3..bf120d2e33 100644 --- a/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Events_Tests.cs +++ b/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Events_Tests.cs @@ -24,10 +24,15 @@ namespace Volo.Abp.Uow using (var uow = _unitOfWorkManager.Begin()) { - uow.OnCompleted(async () => completed = true); + uow.OnCompleted(() => + { + completed = true; + return Task.CompletedTask; + }); + uow.Disposed += (sender, args) => disposed = true; - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); completed.ShouldBeTrue(); } @@ -48,7 +53,7 @@ namespace Volo.Abp.Uow childUow.OnCompleted(async () => completed = true); uow.Disposed += (sender, args) => disposed = true; - await childUow.CompleteAsync().ConfigureAwait(false); + await childUow.CompleteAsync(); completed.ShouldBeFalse(); //Parent has not been completed yet! disposed.ShouldBeFalse(); @@ -57,7 +62,7 @@ namespace Volo.Abp.Uow completed.ShouldBeFalse(); //Parent has not been completed yet! disposed.ShouldBeFalse(); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); completed.ShouldBeTrue(); //It's completed now! disposed.ShouldBeFalse(); //But not disposed yet! @@ -124,11 +129,11 @@ namespace Volo.Abp.Uow uow.Failed += (sender, args) => { failed = true; args.IsRolledback.ShouldBeTrue(); }; uow.Disposed += (sender, args) => disposed = true; - await uow.RollbackAsync().ConfigureAwait(false); + await uow.RollbackAsync(); if (callComplete) { - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } diff --git a/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Nested_Tests.cs b/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Nested_Tests.cs index efa4a7540e..31ce688d84 100644 --- a/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Nested_Tests.cs +++ b/framework/test/Volo.Abp.Uow.Tests/Volo/Abp/Uow/UnitOfWork_Nested_Tests.cs @@ -30,13 +30,13 @@ namespace Volo.Abp.Uow _unitOfWorkManager.Current.ShouldNotBeNull(); _unitOfWorkManager.Current.Id.ShouldNotBe(uow1.Id); - await uow2.CompleteAsync().ConfigureAwait(false); + await uow2.CompleteAsync(); } _unitOfWorkManager.Current.ShouldNotBeNull(); _unitOfWorkManager.Current.ShouldBe(uow1); - await uow1.CompleteAsync().ConfigureAwait(false); + await uow1.CompleteAsync(); } _unitOfWorkManager.Current.ShouldBeNull(); diff --git a/framework/test/Volo.Abp.Validation.Tests/Volo.Abp.Validation.Tests.csproj b/framework/test/Volo.Abp.Validation.Tests/Volo.Abp.Validation.Tests.csproj index a16495ccda..7bf3df7ca5 100644 --- a/framework/test/Volo.Abp.Validation.Tests/Volo.Abp.Validation.Tests.csproj +++ b/framework/test/Volo.Abp.Validation.Tests/Volo.Abp.Validation.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/framework/test/Volo.Abp.Validation.Tests/Volo/Abp/Validation/ApplicationService_Validation_Tests.cs b/framework/test/Volo.Abp.Validation.Tests/Volo/Abp/Validation/ApplicationService_Validation_Tests.cs index 78848591e7..0d13867819 100644 --- a/framework/test/Volo.Abp.Validation.Tests/Volo/Abp/Validation/ApplicationService_Validation_Tests.cs +++ b/framework/test/Volo.Abp.Validation.Tests/Volo/Abp/Validation/ApplicationService_Validation_Tests.cs @@ -31,15 +31,15 @@ namespace Volo.Abp.Validation [Fact] public async Task Should_Work_Proper_With_Right_Inputs() { - var output = await _myAppService.MyMethod(new MyMethodInput { MyStringValue = "test" }).ConfigureAwait(false); + var output = await _myAppService.MyMethod(new MyMethodInput { MyStringValue = "test" }); output.Result.ShouldBe(42); } [Fact] public async Task Should_Not_Work_With_Wrong_Inputs() { - await Assert.ThrowsAsync(async () => await _myAppService.MyMethod(new MyMethodInput()).ConfigureAwait(false)).ConfigureAwait(false); //MyStringValue is not supplied! - await Assert.ThrowsAsync(async () => await _myAppService.MyMethod(new MyMethodInput { MyStringValue = "a" }).ConfigureAwait(false)).ConfigureAwait(false); //MyStringValue's min length should be 3! + await Assert.ThrowsAsync(async () => await _myAppService.MyMethod(new MyMethodInput())); //MyStringValue is not supplied! + await Assert.ThrowsAsync(async () => await _myAppService.MyMethod(new MyMethodInput { MyStringValue = "a" })); //MyStringValue's min length should be 3! } [Fact] @@ -50,7 +50,7 @@ namespace Volo.Abp.Validation MyStringValue2 = "test 1", Input1 = new MyMethodInput { MyStringValue = "test 2" }, DateTimeValue = DateTime.Now - }).ConfigureAwait(false); + }); output.Result.ShouldBe(42); } @@ -63,7 +63,7 @@ namespace Volo.Abp.Validation { MyStringValue2 = "test 1", Input1 = new MyMethodInput() //MyStringValue is not set - }).ConfigureAwait(false)).ConfigureAwait(false); + })); } [Fact] @@ -73,7 +73,7 @@ namespace Volo.Abp.Validation await _myAppService.MyMethod2(new MyMethod2Input //Input1 is not set { MyStringValue2 = "test 1" - }).ConfigureAwait(false)).ConfigureAwait(false); + })); } [Fact] @@ -88,7 +88,7 @@ namespace Volo.Abp.Validation { new MyClassInList {ValueInList = null} } - }).ConfigureAwait(false)).ConfigureAwait(false); + })); } [Fact] @@ -103,27 +103,27 @@ namespace Volo.Abp.Validation { new MyClassInList {ValueInList = null} } - }).ConfigureAwait(false)).ConfigureAwait(false); + })); } [Fact] public async Task Should_Not_Work_If_Array_Is_Null() { await Assert.ThrowsAsync(async () => - await _myAppService.MyMethod4(new MyMethod4Input()) //ArrayItems is null! -.ConfigureAwait(false)).ConfigureAwait(false); + await _myAppService.MyMethod4(new MyMethod4Input()) //ArrayItems is null! + ); } [Fact] public async Task Should_Work_If_Array_Is_Null_But_DisabledValidation_For_Method() { - await _myAppService.MyMethod4_2(new MyMethod4Input()).ConfigureAwait(false); + await _myAppService.MyMethod4_2(new MyMethod4Input()); } [Fact] public async Task Should_Work_If_Array_Is_Null_But_DisabledValidation_For_Property() { - await _myAppService.MyMethod5(new MyMethod5Input()).ConfigureAwait(false); + await _myAppService.MyMethod5(new MyMethod5Input()); } [Fact] @@ -134,8 +134,8 @@ namespace Volo.Abp.Validation await _myAppService.MyMethod6(new MyMethod6Input { MyStringValue = "test value" //MyIntValue has not set! - }).ConfigureAwait(false); - }).ConfigureAwait(false); + }); + }); } //TODO: Create a Volo.Abp.Ddd.Application.Contracts.Tests project and move this to there and remove Volo.Abp.Ddd.Application.Contracts dependency from this project. @@ -147,8 +147,8 @@ namespace Volo.Abp.Validation await _myAppService.MyMethodWithLimitedResult(new LimitedResultRequestDto { MaxResultCount = LimitedResultRequestDto.MaxMaxResultCount + 1 - }).ConfigureAwait(false); - }).ConfigureAwait(false); + }); + }); exception.ValidationErrors.ShouldContain(e => e.MemberNames.Contains(nameof(LimitedResultRequestDto.MaxResultCount))); } @@ -159,35 +159,35 @@ namespace Volo.Abp.Validation await _myAppService.MyMethodWithLimitedResult(new LimitedResultRequestDto { MaxResultCount = LimitedResultRequestDto.MaxMaxResultCount - 1 - }).ConfigureAwait(false); + }); } [Fact] public async Task Should_Stop_Recursive_Validation_In_A_Constant_Depth() { - (await _myAppService.MyMethod8(new MyClassWithRecursiveReference { Value = "42" }).ConfigureAwait(false)).Result.ShouldBe(42); + (await _myAppService.MyMethod8(new MyClassWithRecursiveReference { Value = "42" })).Result.ShouldBe(42); } [Fact] public async Task Should_Allow_Null_For_Nullable_Enums() { - await _myAppService.MyMethodWithNullableEnum(null).ConfigureAwait(false); + await _myAppService.MyMethodWithNullableEnum(null); } [Fact] public void Should_Validate_Emails() { //Valid - ValidationHandler.IsValidEmailAddress("john.doe@domain.com").ShouldBe(true); - ValidationHandler.IsValidEmailAddress("ip@1.2.3.123").ShouldBe(true); - ValidationHandler.IsValidEmailAddress("pharaoh@egyptian.museum").ShouldBe(true); - ValidationHandler.IsValidEmailAddress("john.doe+regexbuddy@gmail.com").ShouldBe(true); - ValidationHandler.IsValidEmailAddress("Mike.O'Dell@ireland.com").ShouldBe(true); + ValidationHelper.IsValidEmailAddress("john.doe@domain.com").ShouldBe(true); + ValidationHelper.IsValidEmailAddress("ip@1.2.3.123").ShouldBe(true); + ValidationHelper.IsValidEmailAddress("pharaoh@egyptian.museum").ShouldBe(true); + ValidationHelper.IsValidEmailAddress("john.doe+regexbuddy@gmail.com").ShouldBe(true); + ValidationHelper.IsValidEmailAddress("Mike.O'Dell@ireland.com").ShouldBe(true); //Invalid - ValidationHandler.IsValidEmailAddress("1024x768@60Hz").ShouldBe(false); - ValidationHandler.IsValidEmailAddress("not.a.valid.email").ShouldBe(false); - ValidationHandler.IsValidEmailAddress("john@aol...com").ShouldBe(false); + ValidationHelper.IsValidEmailAddress("1024x768@60Hz").ShouldBe(false); + ValidationHelper.IsValidEmailAddress("not.a.valid.email").ShouldBe(false); + ValidationHelper.IsValidEmailAddress("john@aol...com").ShouldBe(false); } [DependsOn(typeof(AbpAutofacModule))] diff --git a/framework/test/Volo.Abp.VirtualFileSystem.Tests/Volo.Abp.VirtualFileSystem.Tests.csproj b/framework/test/Volo.Abp.VirtualFileSystem.Tests/Volo.Abp.VirtualFileSystem.Tests.csproj index 63617f36c0..7dcfdc83c5 100644 --- a/framework/test/Volo.Abp.VirtualFileSystem.Tests/Volo.Abp.VirtualFileSystem.Tests.csproj +++ b/framework/test/Volo.Abp.VirtualFileSystem.Tests/Volo.Abp.VirtualFileSystem.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/FodyWeavers.xml b/modules/account/src/Volo.Abp.Account.Application.Contracts/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/FodyWeavers.xsd b/modules/account/src/Volo.Abp.Account.Application.Contracts/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo.Abp.Account.Application.Contracts.csproj b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo.Abp.Account.Application.Contracts.csproj index 039c559860..58b2266340 100644 --- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo.Abp.Account.Application.Contracts.csproj +++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo.Abp.Account.Application.Contracts.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/cs.json b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/cs.json index b2d6fa9130..ac8b58ee1e 100644 --- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/cs.json +++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/cs.json @@ -35,6 +35,10 @@ "PasswordChanged": "Heslo změněno", "NewPasswordConfirmFailed": "Potvrďte nové heslo.", "Manage": "Spravovat", - "ManageYourProfile": "Spravujte svůj profil" + "ManageYourProfile": "Spravujte svůj profil", + "DisplayName:Abp.Account.IsSelfRegistrationEnabled": "Je povolena automatická registrace", + "Description:Abp.Account.IsSelfRegistrationEnabled": "Zda si uživatel může účet zaregistrovat sám.", + "DisplayName:Abp.Account.EnableLocalLogin": "Ověření pomocí místního účtu", + "Description:Abp.Account.EnableLocalLogin": "Označuje, zda server umožní uživatelům ověřovat se pomocí místního účtu." } } \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json index 1f8c0f2eca..7cf2cf7be6 100644 --- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json +++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json @@ -1,16 +1,17 @@ { "culture": "en", "texts": { - "UserName": "User name", + "UserName": "Username", "EmailAddress": "Email address", - "UserNameOrEmailAddress": "User name or email address", + "UserNameOrEmailAddress": "Username or email address", "Password": "Password", "RememberMe": "Remember me", "UseAnotherServiceToLogin": "Use another service to log in", "UserLockedOutMessage": "The user account has been locked out due to invalid login attempts. Please wait a while and try again.", "InvalidUserNameOrPassword": "Invalid username or password!", "LoginIsNotAllowed": "You are not allowed to login! You need to confirm your email/phone number.", - "SelfRegistrationDisabledMessage": "Self user registration is disabled for this application. Contact to the application administrator to register a new user.", + "SelfRegistrationDisabledMessage": "Self-registration is disabled for this application. Please contact the application administrator to register a new user.", + "LocalLoginDisabledMessage": "Local login is disabled for this application.", "Login": "Login", "Cancel": "Cancel", "Register": "Register", @@ -23,7 +24,7 @@ "DisplayName:NewPassword": "New password", "DisplayName:NewPasswordConfirm": "Confirm new password", "PasswordChangedMessage": "Your password has been changed successfully.", - "DisplayName:UserName": "User name", + "DisplayName:UserName": "Username", "DisplayName:Email": "Email", "DisplayName:Name": "Name", "DisplayName:Surname": "Surname", @@ -39,6 +40,6 @@ "DisplayName:Abp.Account.IsSelfRegistrationEnabled": "Is self-registration enabled", "Description:Abp.Account.IsSelfRegistrationEnabled": "Whether a user can register the account by him or herself.", "DisplayName:Abp.Account.EnableLocalLogin": "Authenticate with a local account", - "Description:Abp.Account.EnableLocalLogin": "Indicates if Server will allow users to authenticate with a local account." + "Description:Abp.Account.EnableLocalLogin": "Indicates if the server will allow users to authenticate with a local account." } -} \ No newline at end of file +} diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json index 391dee0531..c02ff8669b 100644 --- a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json +++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json @@ -11,6 +11,7 @@ "InvalidUserNameOrPassword": "用户名或密码错误!", "LoginIsNotAllowed": "无法登录!你需要验证邮箱地址/手机号.", "SelfRegistrationDisabledMessage": "应用程序未开放注册,请联系管理员添加新用户.", + "LocalLoginDisabledMessage": "应用程序未开放本地账户登录.", "Login": "登录", "Cancel": "取消", "Register": "注册", @@ -29,7 +30,7 @@ "DisplayName:Surname": "姓", "DisplayName:Password": "密码", "DisplayName:EmailAddress": "电子邮件地址", - "DisplayName:PhoneNumber": "电话号码", + "DisplayName:PhoneNumber": "手机号码", "PersonalSettings": "个人设置", "PersonalSettingsSaved": "个人设置已保存", "PasswordChanged": "修改密码", diff --git a/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hant.json b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hant.json new file mode 100644 index 0000000000..b75be0f73a --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hant.json @@ -0,0 +1,45 @@ +{ + "culture": "zh-Hant", + "texts": { + "UserName": "使用者名稱", + "EmailAddress": "電子信箱地址", + "UserNameOrEmailAddress": "使用者名稱或電子信箱地址", + "Password": "密碼", + "RememberMe": "記住我", + "UseAnotherServiceToLogin": "使用另一個服務登入", + "UserLockedOutMessage": "登入失敗,使用者帳號已被鎖定.請稍後再試.", + "InvalidUserNameOrPassword": "使用者名稱或密碼錯誤!", + "LoginIsNotAllowed": "無法登入!你需要驗證電子信箱地址/手機號碼.", + "SelfRegistrationDisabledMessage": "應用程式未開放註冊,請聯絡管理員以加入新使用者.", + "LocalLoginDisabledMessage": "應用程序未開放本地賬戶登錄.", + "Login": "登入", + "Cancel": "取消", + "Register": "註冊", + "AreYouANewUser": "你是新使用者嗎?", + "AlreadyRegistered": "已經註冊過了?", + "InvalidLoginRequest": "登入請求無效", + "ThereAreNoLoginSchemesConfiguredForThisClient": "沒有為此客戶端配置登入方案.", + "LogInUsingYourProviderAccount": "使用你的{0}帳號登入", + "DisplayName:CurrentPassword": "目前密碼", + "DisplayName:NewPassword": "新密碼", + "DisplayName:NewPasswordConfirm": "確認新密碼", + "PasswordChangedMessage": "你的密碼已修改成功.", + "DisplayName:UserName": "使用者名稱", + "DisplayName:Email": "電子信箱", + "DisplayName:Name": "名字", + "DisplayName:Surname": "姓", + "DisplayName:Password": "密碼", + "DisplayName:EmailAddress": "電子信箱地址", + "DisplayName:PhoneNumber": "電話號碼", + "PersonalSettings": "個人設置", + "PersonalSettingsSaved": "個人設置已保存", + "PasswordChanged": "修改密碼", + "NewPasswordConfirmFailed": "請確認新密碼", + "Manage": "管理", + "ManageYourProfile": "管理你的個人資料", + "DisplayName:Abp.Account.IsSelfRegistrationEnabled": "啟用自行註冊", + "Description:Abp.Account.IsSelfRegistrationEnabled": "是否允許使用者自行註冊帳號.", + "DisplayName:Abp.Account.EnableLocalLogin": "使用本地帳號進行身分驗證", + "Description:Abp.Account.EnableLocalLogin": "伺服器是否允許使用者使用本地帳號進行身份驗證。" + } +} diff --git a/modules/account/src/Volo.Abp.Account.Application/FodyWeavers.xml b/modules/account/src/Volo.Abp.Account.Application/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.Application/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.Application/FodyWeavers.xsd b/modules/account/src/Volo.Abp.Account.Application/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.Application/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.Application/Volo.Abp.Account.Application.csproj b/modules/account/src/Volo.Abp.Account.Application/Volo.Abp.Account.Application.csproj index f5966d7e30..1ddc2323d1 100644 --- a/modules/account/src/Volo.Abp.Account.Application/Volo.Abp.Account.Application.csproj +++ b/modules/account/src/Volo.Abp.Account.Application/Volo.Abp.Account.Application.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AccountAppService.cs b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AccountAppService.cs index 9935078fe1..695d9b233f 100644 --- a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AccountAppService.cs +++ b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/AccountAppService.cs @@ -1,4 +1,5 @@ -using System.Threading.Tasks; +using System.Linq; +using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Volo.Abp.Account.Settings; using Volo.Abp.Application.Services; @@ -9,28 +10,42 @@ namespace Volo.Abp.Account { public class AccountAppService : ApplicationService, IAccountAppService { + private readonly IIdentityRoleRepository _roleRepository; protected IdentityUserManager UserManager { get; } public AccountAppService( - IdentityUserManager userManager) + IdentityUserManager userManager, + IIdentityRoleRepository roleRepository) { + _roleRepository = roleRepository; UserManager = userManager; } public virtual async Task RegisterAsync(RegisterDto input) { - await CheckSelfRegistrationAsync().ConfigureAwait(false); + await CheckSelfRegistrationAsync(); var user = new IdentityUser(GuidGenerator.Create(), input.UserName, input.EmailAddress, CurrentTenant.Id); - (await UserManager.CreateAsync(user, input.Password).ConfigureAwait(false)).CheckErrors(); + (await UserManager.CreateAsync(user, input.Password)).CheckErrors(); + + await UserManager.SetEmailAsync(user,input.EmailAddress).ConfigureAwait(false); + + await SetDefaultRolesAsync(user); return ObjectMapper.Map(user); } + protected virtual async Task SetDefaultRolesAsync(IdentityUser user) + { + var defaultRoles = await _roleRepository.GetDefaultOnesAsync().ConfigureAwait(false); + + await UserManager.SetRolesAsync(user, defaultRoles.Select(r => r.Name)).ConfigureAwait(false); + } + protected virtual async Task CheckSelfRegistrationAsync() { - if (!await SettingProvider.IsTrueAsync(AccountSettingNames.IsSelfRegistrationEnabled).ConfigureAwait(false)) + if (!await SettingProvider.IsTrueAsync(AccountSettingNames.IsSelfRegistrationEnabled)) { throw new UserFriendlyException(L["SelfRegistrationDisabledMessage"]); } diff --git a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Settings/AccountSettingDefinitionProvider.cs b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Settings/AccountSettingDefinitionProvider.cs index 034b2b1a01..907100c61a 100644 --- a/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Settings/AccountSettingDefinitionProvider.cs +++ b/modules/account/src/Volo.Abp.Account.Application/Volo/Abp/Account/Settings/AccountSettingDefinitionProvider.cs @@ -13,7 +13,7 @@ namespace Volo.Abp.Account.Settings AccountSettingNames.IsSelfRegistrationEnabled, "true", L("DisplayName:Abp.Account.IsSelfRegistrationEnabled"), - L("Description:Abp.Account.IsSelfRegistrationEnabled")) + L("Description:Abp.Account.IsSelfRegistrationEnabled"), isVisibleToClients : true) ); context.Add( @@ -21,7 +21,7 @@ namespace Volo.Abp.Account.Settings AccountSettingNames.EnableLocalLogin, "true", L("DisplayName:Abp.Account.EnableLocalLogin"), - L("Description:Abp.Account.EnableLocalLogin")) + L("Description:Abp.Account.EnableLocalLogin"), isVisibleToClients : true) ); } diff --git a/modules/account/src/Volo.Abp.Account.HttpApi.Client/FodyWeavers.xml b/modules/account/src/Volo.Abp.Account.HttpApi.Client/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.HttpApi.Client/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.HttpApi.Client/FodyWeavers.xsd b/modules/account/src/Volo.Abp.Account.HttpApi.Client/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.HttpApi.Client/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.HttpApi.Client/Volo.Abp.Account.HttpApi.Client.csproj b/modules/account/src/Volo.Abp.Account.HttpApi.Client/Volo.Abp.Account.HttpApi.Client.csproj index 4a7602754a..89679b3e22 100644 --- a/modules/account/src/Volo.Abp.Account.HttpApi.Client/Volo.Abp.Account.HttpApi.Client.csproj +++ b/modules/account/src/Volo.Abp.Account.HttpApi.Client/Volo.Abp.Account.HttpApi.Client.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/account/src/Volo.Abp.Account.HttpApi/FodyWeavers.xml b/modules/account/src/Volo.Abp.Account.HttpApi/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.HttpApi/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.HttpApi/FodyWeavers.xsd b/modules/account/src/Volo.Abp.Account.HttpApi/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.HttpApi/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.HttpApi/Volo.Abp.Account.HttpApi.csproj b/modules/account/src/Volo.Abp.Account.HttpApi/Volo.Abp.Account.HttpApi.csproj index 3459ab0294..2e074722b2 100644 --- a/modules/account/src/Volo.Abp.Account.HttpApi/Volo.Abp.Account.HttpApi.csproj +++ b/modules/account/src/Volo.Abp.Account.HttpApi/Volo.Abp.Account.HttpApi.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/FodyWeavers.xml b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/FodyWeavers.xsd b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs index 2fa2aa5778..c2e50a2317 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLoginModel.cs @@ -46,7 +46,7 @@ namespace Volo.Abp.Account.Web.Pages.Account { LoginInput = new LoginInputModel(); - var context = await Interaction.GetAuthorizationContextAsync(ReturnUrl).ConfigureAwait(false); + var context = await Interaction.GetAuthorizationContextAsync(ReturnUrl); if (context != null) { @@ -68,7 +68,7 @@ namespace Volo.Abp.Account.Web.Pages.Account return Page(); } - var schemes = await _schemeProvider.GetAllSchemesAsync().ConfigureAwait(false); + var schemes = await _schemeProvider.GetAllSchemesAsync(); var providers = schemes .Where(x => x.DisplayName != null || x.Name.Equals(_accountOptions.WindowsAuthenticationSchemeName, StringComparison.OrdinalIgnoreCase)) @@ -79,10 +79,10 @@ namespace Volo.Abp.Account.Web.Pages.Account }) .ToList(); - EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin).ConfigureAwait(false); + EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin); if (context?.ClientId != null) { - var client = await ClientStore.FindEnabledClientByIdAsync(context.ClientId).ConfigureAwait(false); + var client = await ClientStore.FindEnabledClientByIdAsync(context.ClientId); if (client != null) { EnableLocalLogin = client.EnableLocalLogin; @@ -98,7 +98,7 @@ namespace Volo.Abp.Account.Web.Pages.Account if (IsExternalLoginOnly) { - return await base.OnPostExternalLogin(providers.First().AuthenticationScheme).ConfigureAwait(false); + return await base.OnPostExternalLogin(providers.First().AuthenticationScheme); } return Page(); @@ -107,31 +107,31 @@ namespace Volo.Abp.Account.Web.Pages.Account [UnitOfWork] //TODO: Will be removed when we implement action filter public override async Task OnPostAsync(string action) { - EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin).ConfigureAwait(false); - if (action == "Cancel") { - var context = await Interaction.GetAuthorizationContextAsync(ReturnUrl).ConfigureAwait(false); + var context = await Interaction.GetAuthorizationContextAsync(ReturnUrl); if (context == null) { return Redirect("~/"); } - await Interaction.GrantConsentAsync(context, ConsentResponse.Denied).ConfigureAwait(false); + await Interaction.GrantConsentAsync(context, ConsentResponse.Denied); return Redirect(ReturnUrl); } + await CheckLocalLoginAsync(); + ValidateModel(); - await ReplaceEmailToUsernameOfInputIfNeeds().ConfigureAwait(false); + await ReplaceEmailToUsernameOfInputIfNeeds(); var result = await SignInManager.PasswordSignInAsync( LoginInput.UserNameOrEmailAddress, LoginInput.Password, LoginInput.RememberMe, true - ).ConfigureAwait(false); + ); if (result.RequiresTwoFactor) { @@ -162,11 +162,11 @@ namespace Volo.Abp.Account.Web.Pages.Account } //TODO: Find a way of getting user's id from the logged in user and do not query it again like that! - var user = await UserManager.FindByNameAsync(LoginInput.UserNameOrEmailAddress).ConfigureAwait(false) ?? - await UserManager.FindByEmailAsync(LoginInput.UserNameOrEmailAddress).ConfigureAwait(false); + var user = await UserManager.FindByNameAsync(LoginInput.UserNameOrEmailAddress) ?? + await UserManager.FindByEmailAsync(LoginInput.UserNameOrEmailAddress); Debug.Assert(user != null, nameof(user) + " != null"); - await IdentityServerEvents.RaiseAsync(new UserLoginSuccessEvent(user.UserName, user.Id.ToString(), user.UserName)).ConfigureAwait(false); //TODO: Use user's name once implemented + await IdentityServerEvents.RaiseAsync(new UserLoginSuccessEvent(user.UserName, user.Id.ToString(), user.UserName)); //TODO: Use user's name once implemented return RedirectSafely(ReturnUrl, ReturnUrlHash); } @@ -176,15 +176,15 @@ namespace Volo.Abp.Account.Web.Pages.Account { if (_accountOptions.WindowsAuthenticationSchemeName == provider) { - return await ProcessWindowsLoginAsync().ConfigureAwait(false); + return await ProcessWindowsLoginAsync(); } - return await base.OnPostExternalLogin(provider).ConfigureAwait(false); + return await base.OnPostExternalLogin(provider); } private async Task ProcessWindowsLoginAsync() { - var result = await HttpContext.AuthenticateAsync(_accountOptions.WindowsAuthenticationSchemeName).ConfigureAwait(false); + var result = await HttpContext.AuthenticateAsync(_accountOptions.WindowsAuthenticationSchemeName); if (!(result?.Principal is WindowsPrincipal windowsPrincipal)) { return Challenge(_accountOptions.WindowsAuthenticationSchemeName); @@ -219,7 +219,7 @@ namespace Volo.Abp.Account.Web.Pages.Account IdentityServer4.IdentityServerConstants.ExternalCookieAuthenticationScheme, new ClaimsPrincipal(identity), props - ).ConfigureAwait(false); + ); return RedirectSafely(props.RedirectUri); } diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLogoutModel.cs b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLogoutModel.cs new file mode 100644 index 0000000000..ab403ea5a1 --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Account/IdentityServerSupportedLogoutModel.cs @@ -0,0 +1,44 @@ +using IdentityServer4.Services; +using Microsoft.AspNetCore.Mvc; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.Account.Web.Pages.Account +{ + [ExposeServices(typeof(LogoutModel))] + public class IdentityServerSupportedLogoutModel : LogoutModel + { + protected IIdentityServerInteractionService Interaction { get; } + + public IdentityServerSupportedLogoutModel(IIdentityServerInteractionService interaction) + { + Interaction = interaction; + } + + public override async Task OnGetAsync() + { + await SignInManager.SignOutAsync(); + + var logoutId = Request.Query["logoutId"].ToString(); + + if (!string.IsNullOrEmpty(logoutId)) + { + var logoutContext = await Interaction.GetLogoutContextAsync(logoutId); + + var postLogoutUri = logoutContext.PostLogoutRedirectUri; + + if (!string.IsNullOrEmpty(postLogoutUri)) + { + return Redirect(postLogoutUri); + } + } + + if (ReturnUrl != null) + { + return LocalRedirect(ReturnUrl); + } + + return RedirectToPage("/Account/Login"); + } + } +} diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs index e34f6e98f1..3fb68feaca 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Pages/Consent.cshtml.cs @@ -44,19 +44,19 @@ namespace Volo.Abp.Account.Web.Pages public virtual async Task OnGet() { - var request = await _interaction.GetAuthorizationContextAsync(ReturnUrl).ConfigureAwait(false); + var request = await _interaction.GetAuthorizationContextAsync(ReturnUrl); if (request == null) { throw new ApplicationException($"No consent request matching request: {ReturnUrl}"); } - var client = await _clientStore.FindEnabledClientByIdAsync(request.ClientId).ConfigureAwait(false); + var client = await _clientStore.FindEnabledClientByIdAsync(request.ClientId); if (client == null) { throw new ApplicationException($"Invalid client id: {request.ClientId}"); } - var resources = await _resourceStore.FindEnabledResourcesByScopeAsync(request.ScopesRequested).ConfigureAwait(false); + var resources = await _resourceStore.FindEnabledResourcesByScopeAsync(request.ScopesRequested); if (resources == null || (!resources.IdentityResources.Any() && !resources.ApiResources.Any())) { throw new ApplicationException($"No scopes matching: {request.ScopesRequested.Aggregate((x, y) => x + ", " + y)}"); @@ -78,7 +78,7 @@ namespace Volo.Abp.Account.Web.Pages public virtual async Task OnPost(string userDecision) { - var result = await ProcessConsentAsync().ConfigureAwait(false); + var result = await ProcessConsentAsync(); if (result.IsRedirect) { @@ -122,13 +122,13 @@ namespace Volo.Abp.Account.Web.Pages if (grantedConsent != null) { - var request = await _interaction.GetAuthorizationContextAsync(ReturnUrl).ConfigureAwait(false); + var request = await _interaction.GetAuthorizationContextAsync(ReturnUrl); if (request == null) { return result; } - await _interaction.GrantConsentAsync(request, grantedConsent).ConfigureAwait(false); + await _interaction.GrantConsentAsync(request, grantedConsent); result.RedirectUri = ReturnUrl; //TODO: ReturnUrlHash? } diff --git a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Volo.Abp.Account.Web.IdentityServer.csproj b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Volo.Abp.Account.Web.IdentityServer.csproj index 81f0ee4375..2ab190b724 100644 --- a/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Volo.Abp.Account.Web.IdentityServer.csproj +++ b/modules/account/src/Volo.Abp.Account.Web.IdentityServer/Volo.Abp.Account.Web.IdentityServer.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs b/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs index 12960920c8..48b8da5c38 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs @@ -1,10 +1,13 @@ -using System; +using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; +using Volo.Abp.Account.Localization; +using Volo.Abp.Account.Settings; using Volo.Abp.Account.Web.Areas.Account.Controllers.Models; using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.Identity; +using Volo.Abp.Settings; using Volo.Abp.Validation; using SignInResult = Microsoft.AspNetCore.Identity.SignInResult; using UserLoginInfo = Volo.Abp.Account.Web.Areas.Account.Controllers.Models.UserLoginInfo; @@ -21,27 +24,40 @@ namespace Volo.Abp.Account.Web.Areas.Account.Controllers { private readonly SignInManager _signInManager; private readonly IdentityUserManager _userManager; + private readonly ISettingProvider _settingProvider; - public AccountController(SignInManager signInManager, IdentityUserManager userManager) + public AccountController(SignInManager signInManager, IdentityUserManager userManager, ISettingProvider settingProvider) { + LocalizationResource = typeof(AccountResource); + _signInManager = signInManager; _userManager = userManager; + _settingProvider = settingProvider; } [HttpPost] [Route("login")] public virtual async Task Login(UserLoginInfo login) { - ValidateLoginInfo(login); + await CheckLocalLoginAsync(); - await ReplaceEmailToUsernameOfInputIfNeeds(login).ConfigureAwait(false); + ValidateLoginInfo(login); + await ReplaceEmailToUsernameOfInputIfNeeds(login); + return GetAbpLoginResult(await _signInManager.PasswordSignInAsync( login.UserNameOrEmailAddress, login.Password, login.RememberMe, true - ).ConfigureAwait(false)); + )); + } + + [HttpGet] + [Route("logout")] + public virtual async Task Logout() + { + await _signInManager.SignOutAsync(); } [HttpPost] @@ -50,32 +66,32 @@ namespace Volo.Abp.Account.Web.Areas.Account.Controllers { ValidateLoginInfo(login); - await ReplaceEmailToUsernameOfInputIfNeeds(login).ConfigureAwait(false); + await ReplaceEmailToUsernameOfInputIfNeeds(login); - var identityUser = await _userManager.FindByNameAsync(login.UserNameOrEmailAddress).ConfigureAwait(false); + var identityUser = await _userManager.FindByNameAsync(login.UserNameOrEmailAddress); if (identityUser == null) { return new AbpLoginResult(LoginResultType.InvalidUserNameOrPassword); } - return GetAbpLoginResult(await _signInManager.CheckPasswordSignInAsync(identityUser, login.Password, true).ConfigureAwait(false)); + return GetAbpLoginResult(await _signInManager.CheckPasswordSignInAsync(identityUser, login.Password, true)); } protected virtual async Task ReplaceEmailToUsernameOfInputIfNeeds(UserLoginInfo login) { - if (!ValidationHandler.IsValidEmailAddress(login.UserNameOrEmailAddress)) + if (!ValidationHelper.IsValidEmailAddress(login.UserNameOrEmailAddress)) { return; } - var userByUsername = await _userManager.FindByNameAsync(login.UserNameOrEmailAddress).ConfigureAwait(false); + var userByUsername = await _userManager.FindByNameAsync(login.UserNameOrEmailAddress); if (userByUsername != null) { return; } - var userByEmail = await _userManager.FindByEmailAsync(login.UserNameOrEmailAddress).ConfigureAwait(false); + var userByEmail = await _userManager.FindByEmailAsync(login.UserNameOrEmailAddress); if (userByEmail == null) { return; @@ -126,5 +142,13 @@ namespace Volo.Abp.Account.Web.Areas.Account.Controllers throw new ArgumentNullException(nameof(login.Password)); } } + + private async Task CheckLocalLoginAsync() + { + if (!await _settingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin).ConfigureAwait(false)) + { + throw new UserFriendlyException(L["LocalLoginDisabledMessage"]); + } + } } } diff --git a/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/LogoutController.cs b/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/LogoutController.cs deleted file mode 100644 index 878f2aa2d5..0000000000 --- a/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/LogoutController.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Threading.Tasks; -using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.AspNetCore.Mvc; -using IdentityUser = Volo.Abp.Identity.IdentityUser; - -namespace Volo.Abp.Account.Web.Areas.Account.Controllers -{ - [Area("Account")] - public class LogoutController : AbpController - { - private readonly SignInManager _signInManager; - - public LogoutController(SignInManager signInManager) - { - _signInManager = signInManager; - } - - //todo@alper: this method can be moved to AccountController like "account/logout" - public async Task Index(string returnUrl = null) - { - await _signInManager.SignOutAsync().ConfigureAwait(false); - - if (returnUrl != null) - { - return LocalRedirect(returnUrl); - } - - return RedirectToPage("/Account/Login"); - } - } -} diff --git a/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/Models/UserLoginInfo.cs b/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/Models/UserLoginInfo.cs index 03231a0717..fe86445a85 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/Models/UserLoginInfo.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/Models/UserLoginInfo.cs @@ -1,5 +1,6 @@ using System; using System.ComponentModel.DataAnnotations; +using Volo.Abp.Auditing; namespace Volo.Abp.Account.Web.Areas.Account.Controllers.Models { @@ -12,6 +13,7 @@ namespace Volo.Abp.Account.Web.Areas.Account.Controllers.Models [Required] [StringLength(32)] [DataType(DataType.Password)] + [DisableAuditing] public string Password { get; set; } public bool RememberMe { get; set; } diff --git a/modules/account/src/Volo.Abp.Account.Web/FodyWeavers.xml b/modules/account/src/Volo.Abp.Account.Web/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.Web/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.Web/FodyWeavers.xsd b/modules/account/src/Volo.Abp.Account.Web/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.Web/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml index 94ef0e45a2..fca4622a29 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml @@ -1,5 +1,6 @@ @page @using Volo.Abp.Account.Settings +@using Volo.Abp.Settings @model Volo.Abp.Account.Web.Pages.Account.LoginModel @inherits Volo.Abp.Account.Web.Pages.Account.AccountPage @inject Volo.Abp.Settings.ISettingProvider SettingProvider @@ -7,8 +8,8 @@ {
    -

    @L["Login"]

    - @if (string.Equals(await SettingProvider.GetOrNullAsync(AccountSettingNames.IsSelfRegistrationEnabled), "true", StringComparison.OrdinalIgnoreCase)) +

    @L["Login"]

    + @if (await SettingProvider.IsTrueAsync(AccountSettingNames.IsSelfRegistrationEnabled)) { @L["AreYouANewUser"] diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs index 9e4427a2b6..53954fd9e4 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Login.cshtml.cs @@ -11,6 +11,7 @@ using System.Linq; using System.Security.Claims; using System.Threading.Tasks; using Volo.Abp.Account.Settings; +using Volo.Abp.Auditing; using Volo.Abp.Identity; using Volo.Abp.Security.Claims; using Volo.Abp.Settings; @@ -62,7 +63,7 @@ namespace Volo.Abp.Account.Web.Pages.Account { LoginInput = new LoginInputModel(); - var schemes = await _schemeProvider.GetAllSchemesAsync().ConfigureAwait(false); + var schemes = await _schemeProvider.GetAllSchemesAsync(); var providers = schemes .Where(x => x.DisplayName != null || x.Name.Equals(_accountOptions.WindowsAuthenticationSchemeName, StringComparison.OrdinalIgnoreCase)) @@ -73,7 +74,7 @@ namespace Volo.Abp.Account.Web.Pages.Account }) .ToList(); - EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin).ConfigureAwait(false); + EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin); ExternalProviders = providers.ToArray(); @@ -89,18 +90,18 @@ namespace Volo.Abp.Account.Web.Pages.Account [UnitOfWork] //TODO: Will be removed when we implement action filter public virtual async Task OnPostAsync(string action) { - EnableLocalLogin = await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin).ConfigureAwait(false); + await CheckLocalLoginAsync(); ValidateModel(); - await ReplaceEmailToUsernameOfInputIfNeeds().ConfigureAwait(false); + await ReplaceEmailToUsernameOfInputIfNeeds(); var result = await SignInManager.PasswordSignInAsync( LoginInput.UserNameOrEmailAddress, LoginInput.Password, LoginInput.RememberMe, true - ).ConfigureAwait(false); + ); if (result.RequiresTwoFactor) { @@ -131,8 +132,8 @@ namespace Volo.Abp.Account.Web.Pages.Account } //TODO: Find a way of getting user's id from the logged in user and do not query it again like that! - var user = await UserManager.FindByNameAsync(LoginInput.UserNameOrEmailAddress).ConfigureAwait(false) ?? - await UserManager.FindByEmailAsync(LoginInput.UserNameOrEmailAddress).ConfigureAwait(false); + var user = await UserManager.FindByNameAsync(LoginInput.UserNameOrEmailAddress) ?? + await UserManager.FindByEmailAsync(LoginInput.UserNameOrEmailAddress); Debug.Assert(user != null, nameof(user) + " != null"); @@ -163,7 +164,7 @@ namespace Volo.Abp.Account.Web.Pages.Account return RedirectToPage("./Login"); } - var loginInfo = await SignInManager.GetExternalLoginInfoAsync().ConfigureAwait(false); + var loginInfo = await SignInManager.GetExternalLoginInfoAsync(); if (loginInfo == null) { Logger.LogWarning("External login info is not available"); @@ -175,7 +176,7 @@ namespace Volo.Abp.Account.Web.Pages.Account loginInfo.ProviderKey, isPersistent: false, bypassTwoFactor: true - ).ConfigureAwait(false); + ); if (result.IsLockedOut) { @@ -190,15 +191,15 @@ namespace Volo.Abp.Account.Web.Pages.Account //TODO: Handle other cases for result! // Get the information about the user from the external login provider - var info = await SignInManager.GetExternalLoginInfoAsync().ConfigureAwait(false); + var info = await SignInManager.GetExternalLoginInfoAsync(); if (info == null) { throw new ApplicationException("Error loading external login information during confirmation."); } - var user = await CreateExternalUserAsync(info).ConfigureAwait(false); + var user = await CreateExternalUserAsync(info); - await SignInManager.SignInAsync(user, false).ConfigureAwait(false); + await SignInManager.SignInAsync(user, false); return RedirectSafely(returnUrl, returnUrlHash); } @@ -208,27 +209,27 @@ namespace Volo.Abp.Account.Web.Pages.Account var user = new IdentityUser(GuidGenerator.Create(), emailAddress, emailAddress, CurrentTenant.Id); - CheckIdentityErrors(await UserManager.CreateAsync(user).ConfigureAwait(false)); - CheckIdentityErrors(await UserManager.SetEmailAsync(user, emailAddress).ConfigureAwait(false)); - CheckIdentityErrors(await UserManager.AddLoginAsync(user, info).ConfigureAwait(false)); + CheckIdentityErrors(await UserManager.CreateAsync(user)); + CheckIdentityErrors(await UserManager.SetEmailAsync(user, emailAddress)); + CheckIdentityErrors(await UserManager.AddLoginAsync(user, info)); return user; } protected virtual async Task ReplaceEmailToUsernameOfInputIfNeeds() { - if (!ValidationHandler.IsValidEmailAddress(LoginInput.UserNameOrEmailAddress)) + if (!ValidationHelper.IsValidEmailAddress(LoginInput.UserNameOrEmailAddress)) { return; } - var userByUsername = await UserManager.FindByNameAsync(LoginInput.UserNameOrEmailAddress).ConfigureAwait(false); + var userByUsername = await UserManager.FindByNameAsync(LoginInput.UserNameOrEmailAddress); if (userByUsername != null) { return; } - var userByEmail = await UserManager.FindByEmailAsync(LoginInput.UserNameOrEmailAddress).ConfigureAwait(false); + var userByEmail = await UserManager.FindByEmailAsync(LoginInput.UserNameOrEmailAddress); if (userByEmail == null) { return; @@ -237,6 +238,14 @@ namespace Volo.Abp.Account.Web.Pages.Account LoginInput.UserNameOrEmailAddress = userByEmail.UserName; } + protected virtual async Task CheckLocalLoginAsync() + { + if (!await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin).ConfigureAwait(false)) + { + throw new UserFriendlyException(L["LocalLoginDisabledMessage"]); + } + } + public class LoginInputModel { [Required] @@ -246,6 +255,7 @@ namespace Volo.Abp.Account.Web.Pages.Account [Required] [StringLength(IdentityUserConsts.MaxPasswordLength)] [DataType(DataType.Password)] + [DisableAuditing] public string Password { get; set; } public bool RememberMe { get; set; } diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Logout.cshtml b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Logout.cshtml new file mode 100644 index 0000000000..f57c7258d1 --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Logout.cshtml @@ -0,0 +1,3 @@ +@page "/Account/Logout" +@inherits Volo.Abp.Account.Web.Pages.Account.AccountPage +@model Volo.Abp.Account.Web.Pages.Account.LogoutModel \ No newline at end of file diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Logout.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Logout.cshtml.cs new file mode 100644 index 0000000000..8245cc5a77 --- /dev/null +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Logout.cshtml.cs @@ -0,0 +1,27 @@ +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; + +namespace Volo.Abp.Account.Web.Pages.Account +{ + public class LogoutModel : AccountPageModel + { + [HiddenInput] + [BindProperty(SupportsGet = true)] + public string ReturnUrl { get; set; } + + [HiddenInput] + [BindProperty(SupportsGet = true)] + public string ReturnUrlHash { get; set; } + + public virtual async Task OnGetAsync() + { + await SignInManager.SignOutAsync(); + if (ReturnUrl != null) + { + return RedirectSafely(ReturnUrl, ReturnUrlHash); + } + + return RedirectToPage("/Account/Login"); + } + } +} diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml index 1ff0686f55..cd601649db 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml @@ -1,11 +1,12 @@ @page -@model Volo.Abp.Account.Web.Pages.Account.ManageModel +@using Volo.Abp.Account.Web.Pages.Account @using Volo.Abp.Identity.Settings @using Volo.Abp.Settings @using Volo.Abp.AspNetCore.Mvc.UI.Theming @inject ISettingProvider SettingManager @inject IThemeManager ThemeManager @inherits Volo.Abp.Account.Web.Pages.Account.AccountPage +@model ManageModel @{ Layout = ThemeManager.CurrentTheme.GetApplicationLayout(); var isUserNameUpdateEnabled = string.Equals(await SettingManager.GetOrNullAsync(IdentitySettingNames.User.IsUserNameUpdateEnabled), "true", @@ -15,10 +16,12 @@ StringComparison.OrdinalIgnoreCase); } @section scripts { - + + + } - +

    @L["ChangePassword"].Value


    diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml.cs index 7c94f747cd..9fba470929 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Manage.cshtml.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.Account.Web.Pages.Account public async Task OnGetAsync() { - var user = await _profileAppService.GetAsync().ConfigureAwait(false); + var user = await _profileAppService.GetAsync(); PersonalSettingsInfoModel = ObjectMapper.Map(user); } diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs index 4d95613fe1..7e47c55367 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/Register.cshtml.cs @@ -1,8 +1,12 @@ -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations; +using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Volo.Abp.Account.Settings; +using Volo.Abp.Auditing; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Identity; using Volo.Abp.Settings; using Volo.Abp.Uow; using IdentityUser = Volo.Abp.Identity.IdentityUser; @@ -11,6 +15,8 @@ namespace Volo.Abp.Account.Web.Pages.Account { public class RegisterModel : AccountPageModel { + private readonly IAccountAppService _accountAppService; + [BindProperty(SupportsGet = true)] public string ReturnUrl { get; set; } @@ -20,9 +26,14 @@ namespace Volo.Abp.Account.Web.Pages.Account [BindProperty] public PostInput Input { get; set; } - public virtual async Task OnGet() + public RegisterModel(IAccountAppService accountAppService) + { + _accountAppService = accountAppService; + } + + public virtual async Task OnGetAsync() { - await CheckSelfRegistrationAsync().ConfigureAwait(false); + await CheckSelfRegistrationAsync(); } [UnitOfWork] //TODO: Will be removed when we implement action filter @@ -30,22 +41,30 @@ namespace Volo.Abp.Account.Web.Pages.Account { ValidateModel(); - await CheckSelfRegistrationAsync().ConfigureAwait(false); + await CheckSelfRegistrationAsync(); + + var registerDto = new RegisterDto + { + AppName = "MVC", + EmailAddress = Input.EmailAddress, + Password = Input.Password, + UserName = Input.UserName + }; - var user = new IdentityUser(GuidGenerator.Create(), Input.UserName, Input.EmailAddress, CurrentTenant.Id); + var userDto = await _accountAppService.RegisterAsync(registerDto); + var user = await UserManager.GetByIdAsync(userDto.Id); - (await UserManager.CreateAsync(user, Input.Password).ConfigureAwait(false)).CheckErrors(); - - await UserManager.SetEmailAsync(user, Input.EmailAddress).ConfigureAwait(false); + await UserManager.SetEmailAsync(user, Input.EmailAddress); - await SignInManager.SignInAsync(user, isPersistent: false).ConfigureAwait(false); + await SignInManager.SignInAsync(user, isPersistent: false); return Redirect(ReturnUrl ?? "/"); //TODO: How to ensure safety? IdentityServer requires it however it should be checked somehow! } protected virtual async Task CheckSelfRegistrationAsync() { - if (!await SettingProvider.IsTrueAsync(AccountSettingNames.IsSelfRegistrationEnabled).ConfigureAwait(false)) + if (!await SettingProvider.IsTrueAsync(AccountSettingNames.IsSelfRegistrationEnabled) || + !await SettingProvider.IsTrueAsync(AccountSettingNames.EnableLocalLogin)) { throw new UserFriendlyException(L["SelfRegistrationDisabledMessage"]); } @@ -54,17 +73,18 @@ namespace Volo.Abp.Account.Web.Pages.Account public class PostInput { [Required] - [StringLength(32)] + [StringLength(IdentityUserConsts.MaxUserNameLength)] public string UserName { get; set; } [Required] [EmailAddress] - [StringLength(255)] + [StringLength(IdentityUserConsts.MaxEmailLength)] public string EmailAddress { get; set; } [Required] - [StringLength(32)] + [StringLength(IdentityUserConsts.MaxPasswordLength)] [DataType(DataType.Password)] + [DisableAuditing] public string Password { get; set; } } } diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/SendSecurityCode.cshtml.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/SendSecurityCode.cshtml.cs index ab8abd4853..5923d8972c 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/SendSecurityCode.cshtml.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/SendSecurityCode.cshtml.cs @@ -14,7 +14,7 @@ namespace Volo.Abp.Account.Web.Pages.Account public async Task OnGetAsync() { - var user = await SignInManager.GetTwoFactorAuthenticationUserAsync().ConfigureAwait(false); + var user = await SignInManager.GetTwoFactorAuthenticationUserAsync(); if (user == null) { return RedirectToPage("./Login"); diff --git a/modules/account/src/Volo.Abp.Account.Web/Volo.Abp.Account.Web.csproj b/modules/account/src/Volo.Abp.Account.Web/Volo.Abp.Account.Web.csproj index 880353ceab..09e4b2cc6f 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Volo.Abp.Account.Web.csproj +++ b/modules/account/src/Volo.Abp.Account.Web/Volo.Abp.Account.Web.csproj @@ -1,5 +1,6 @@ - + + @@ -29,7 +30,6 @@ - diff --git a/modules/account/test/Volo.Abp.Account.Application.Tests/Volo.Abp.Account.Application.Tests.csproj b/modules/account/test/Volo.Abp.Account.Application.Tests/Volo.Abp.Account.Application.Tests.csproj index 2055dfc4ef..027e32bd09 100644 --- a/modules/account/test/Volo.Abp.Account.Application.Tests/Volo.Abp.Account.Application.Tests.csproj +++ b/modules/account/test/Volo.Abp.Account.Application.Tests/Volo.Abp.Account.Application.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/account/test/Volo.Abp.Account.Application.Tests/Volo/Abp/Account/AccountAppService_Tests.cs b/modules/account/test/Volo.Abp.Account.Application.Tests/Volo/Abp/Account/AccountAppService_Tests.cs index 14d257993c..b11d19b7a6 100644 --- a/modules/account/test/Volo.Abp.Account.Application.Tests/Volo/Abp/Account/AccountAppService_Tests.cs +++ b/modules/account/test/Volo.Abp.Account.Application.Tests/Volo/Abp/Account/AccountAppService_Tests.cs @@ -32,16 +32,16 @@ namespace Volo.Abp.Account AppName = "MVC" }; - await _accountAppService.RegisterAsync(registerDto).ConfigureAwait(false); + await _accountAppService.RegisterAsync(registerDto); var user = await _identityUserRepository.FindByNormalizedUserNameAsync( - _lookupNormalizer.NormalizeName("bob.lee")).ConfigureAwait(false); + _lookupNormalizer.NormalizeName("bob.lee")); user.ShouldNotBeNull(); user.UserName.ShouldBe("bob.lee"); user.Email.ShouldBe("bob.lee@abp.io"); - (await _userManager.CheckPasswordAsync(user, "P@ssW0rd").ConfigureAwait(false)).ShouldBeTrue(); + (await _userManager.CheckPasswordAsync(user, "P@ssW0rd")).ShouldBeTrue(); } } } diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/FodyWeavers.xml b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/FodyWeavers.xsd b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo.Abp.AuditLogging.Domain.Shared.csproj b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo.Abp.AuditLogging.Domain.Shared.csproj index 44c36fd1d1..ce65a161ce 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo.Abp.AuditLogging.Domain.Shared.csproj +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo.Abp.AuditLogging.Domain.Shared.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/FodyWeavers.xml b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/FodyWeavers.xsd b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo.Abp.AuditLogging.Domain.csproj b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo.Abp.AuditLogging.Domain.csproj index f33375143a..161e952593 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo.Abp.AuditLogging.Domain.csproj +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo.Abp.AuditLogging.Domain.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditingStore.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditingStore.cs index 6674233de6..8aaed79d5f 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditingStore.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditingStore.cs @@ -37,16 +37,17 @@ namespace Volo.Abp.AuditLogging { if (!Options.HideErrors) { - await SaveLogAsync(auditInfo).ConfigureAwait(false); + await SaveLogAsync(auditInfo); return; } try { - await SaveLogAsync(auditInfo).ConfigureAwait(false); + await SaveLogAsync(auditInfo); } catch (Exception ex) { + Logger.LogWarning("Could not save the audit log object: " + Environment.NewLine + auditInfo.ToString()); Logger.LogException(ex, LogLevel.Error); } } @@ -55,8 +56,8 @@ namespace Volo.Abp.AuditLogging { using (var uow = _unitOfWorkManager.Begin(true)) { - await _auditLogRepository.InsertAsync(new AuditLog(_guidGenerator, auditInfo)).ConfigureAwait(false); - await uow.SaveChangesAsync().ConfigureAwait(false); + await _auditLogRepository.InsertAsync(new AuditLog(_guidGenerator, auditInfo)); + await uow.SaveChangesAsync(); } } } diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/FodyWeavers.xml b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/FodyWeavers.xsd b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo.Abp.AuditLogging.EntityFrameworkCore.csproj b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo.Abp.AuditLogging.EntityFrameworkCore.csproj index 93422d8f3f..d94e707ba0 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo.Abp.AuditLogging.EntityFrameworkCore.csproj +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo.Abp.AuditLogging.EntityFrameworkCore.csproj @@ -1,9 +1,10 @@ - + + - netstandard2.1 + netstandard2.0 diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs index 0b68932224..094f946777 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/EfCoreAuditLogRepository.cs @@ -54,7 +54,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore var auditLogs = await query.OrderBy(sorting ?? "executionTime desc") .PageBy(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); return auditLogs; } @@ -87,7 +87,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore httpStatusCode ); - var totalCount = await query.LongCountAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + var totalCount = await query.LongCountAsync(GetCancellationToken(cancellationToken)); return totalCount; } @@ -129,7 +129,7 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore .OrderBy(t => t.ExecutionTime) .GroupBy(t => new { t.ExecutionTime.Date }) .Select(g => new { Day = g.Min(t => t.ExecutionTime), avgExecutionTime = g.Average(t => t.ExecutionDuration) }) - .ToListAsync().ConfigureAwait(false); + .ToListAsync(); return result.ToDictionary(element => element.Day.ClearTime(), element => element.avgExecutionTime); } diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/FodyWeavers.xml b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/FodyWeavers.xsd b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo.Abp.AuditLogging.MongoDB.csproj b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo.Abp.AuditLogging.MongoDB.csproj index 0e86989a77..c22202f7f9 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo.Abp.AuditLogging.MongoDB.csproj +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo.Abp.AuditLogging.MongoDB.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs index 51ae55d86a..8beeff86a3 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs @@ -55,7 +55,7 @@ namespace Volo.Abp.AuditLogging.MongoDB return await query.OrderBy(sorting ?? "executionTime desc").As>() .PageBy>(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public async Task GetCountAsync( @@ -87,7 +87,7 @@ namespace Volo.Abp.AuditLogging.MongoDB ); var count = await query.As>() - .LongCountAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .LongCountAsync(GetCancellationToken(cancellationToken)); return count; } @@ -134,7 +134,7 @@ namespace Volo.Abp.AuditLogging.MongoDB t.ExecutionTime.Day }) .Select(g => new { Day = g.Min(t => t.ExecutionTime), avgExecutionTime = g.Average(t => t.ExecutionDuration) }) - .ToListAsync().ConfigureAwait(false); + .ToListAsync(); return result.ToDictionary(element => element.Day.ClearTime(), element => element.avgExecutionTime); } diff --git a/modules/audit-logging/test/Volo.Abp.AuditLogging.EntityFrameworkCore.Tests/Volo.Abp.AuditLogging.EntityFrameworkCore.Tests.csproj b/modules/audit-logging/test/Volo.Abp.AuditLogging.EntityFrameworkCore.Tests/Volo.Abp.AuditLogging.EntityFrameworkCore.Tests.csproj index 8ee9a2e2f6..8868a88e37 100644 --- a/modules/audit-logging/test/Volo.Abp.AuditLogging.EntityFrameworkCore.Tests/Volo.Abp.AuditLogging.EntityFrameworkCore.Tests.csproj +++ b/modules/audit-logging/test/Volo.Abp.AuditLogging.EntityFrameworkCore.Tests/Volo.Abp.AuditLogging.EntityFrameworkCore.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/modules/audit-logging/test/Volo.Abp.AuditLogging.MongoDB.Tests/Volo.Abp.AuditLogging.MongoDB.Tests.csproj b/modules/audit-logging/test/Volo.Abp.AuditLogging.MongoDB.Tests/Volo.Abp.AuditLogging.MongoDB.Tests.csproj index b5c7084cf2..ffc1906dce 100644 --- a/modules/audit-logging/test/Volo.Abp.AuditLogging.MongoDB.Tests/Volo.Abp.AuditLogging.MongoDB.Tests.csproj +++ b/modules/audit-logging/test/Volo.Abp.AuditLogging.MongoDB.Tests/Volo.Abp.AuditLogging.MongoDB.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo.Abp.AuditLogging.TestBase.csproj b/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo.Abp.AuditLogging.TestBase.csproj index 157301aecb..ced62e3c1b 100644 --- a/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo.Abp.AuditLogging.TestBase.csproj +++ b/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo.Abp.AuditLogging.TestBase.csproj @@ -1,4 +1,4 @@ - + diff --git a/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLogRepository_Tests.cs b/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLogRepository_Tests.cs index e1878bdcc8..f88c10c079 100644 --- a/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLogRepository_Tests.cs +++ b/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLogRepository_Tests.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Net; using System.Threading.Tasks; @@ -117,11 +118,11 @@ namespace Volo.Abp.AuditLogging } }; - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)).ConfigureAwait(false); - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)).ConfigureAwait(false); + await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); + await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); //Assert - var logs = await AuditLogRepository.GetListAsync().ConfigureAwait(false); + var logs = await AuditLogRepository.GetListAsync(); logs.ShouldNotBeNull(); logs.ShouldContain(x => x.UserId == userId); logs.ShouldContain(x => x.UserId == userId2); @@ -221,11 +222,11 @@ namespace Volo.Abp.AuditLogging } }; - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)).ConfigureAwait(false); - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)).ConfigureAwait(false); + await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); + await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); //Assert - var logs = await AuditLogRepository.GetCountAsync().ConfigureAwait(false); + var logs = await AuditLogRepository.GetCountAsync(); logs.ShouldBe(2); } @@ -243,7 +244,7 @@ namespace Volo.Abp.AuditLogging UserId = userId, ImpersonatorUserId = Guid.NewGuid(), ImpersonatorTenantId = Guid.NewGuid(), - ExecutionTime = DateTime.Parse("2020-01-01 01:00:00"), + ExecutionTime = DateTime.SpecifyKind(DateTime.Parse("2020-01-01 01:00:00"), DateTimeKind.Utc), ExecutionDuration = 45, ClientIpAddress = ipAddress, ClientName = "MyDesktop", @@ -294,7 +295,7 @@ namespace Volo.Abp.AuditLogging UserId = userId2, ImpersonatorUserId = Guid.NewGuid(), ImpersonatorTenantId = Guid.NewGuid(), - ExecutionTime = DateTime.Parse("2020-01-01 03:00:00"), + ExecutionTime = DateTime.SpecifyKind(DateTime.Parse("2020-01-01 03:00:00"), DateTimeKind.Utc), ExecutionDuration = 55, ClientIpAddress = ipAddress, ClientName = "MyDesktop", @@ -323,12 +324,12 @@ namespace Volo.Abp.AuditLogging } }; - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)).ConfigureAwait(false); - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)).ConfigureAwait(false); + await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); + await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); //Assert var date = DateTime.Parse("2020-01-01"); - var results = await AuditLogRepository.GetAverageExecutionDurationPerDayAsync(date, date).ConfigureAwait(false); + var results = await AuditLogRepository.GetAverageExecutionDurationPerDayAsync(date, date); results.Count.ShouldBe(1); results.Values.First().ShouldBe(50); // (45 + 55) / 2 } diff --git a/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditStore_Basic_Tests.cs b/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditStore_Basic_Tests.cs index 9744930c09..05dc829440 100644 --- a/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditStore_Basic_Tests.cs +++ b/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditStore_Basic_Tests.cs @@ -64,7 +64,7 @@ namespace Volo.Abp.AuditLogging }; //Act - await _auditingStore.SaveAsync(auditLog).ConfigureAwait(false); + await _auditingStore.SaveAsync(auditLog); //Assert @@ -170,14 +170,14 @@ namespace Volo.Abp.AuditLogging } }; - await _auditingStore.SaveAsync(log1).ConfigureAwait(false); - await _auditingStore.SaveAsync(log2).ConfigureAwait(false); + await _auditingStore.SaveAsync(log1); + await _auditingStore.SaveAsync(log2); - var allLogsCount = await _auditLogRepository.GetCountAsync().ConfigureAwait(false); + var allLogsCount = await _auditLogRepository.GetCountAsync(); - var onlyLog1QueryResult = await _auditLogRepository.GetListAsync(includeDetails: true, userName: "Douglas").ConfigureAwait(false); + var onlyLog1QueryResult = await _auditLogRepository.GetListAsync(includeDetails: true, userName: "Douglas"); - var onlyLog2QueryResult = await _auditLogRepository.GetListAsync(includeDetails: true, httpStatusCode: HttpStatusCode.BadGateway).ConfigureAwait(false); + var onlyLog2QueryResult = await _auditLogRepository.GetListAsync(includeDetails: true, httpStatusCode: HttpStatusCode.BadGateway); allLogsCount.ShouldBe(2); diff --git a/modules/audit-logging/test/Volo.Abp.AuditLogging.Tests/Volo.Abp.AuditLogging.Tests.csproj b/modules/audit-logging/test/Volo.Abp.AuditLogging.Tests/Volo.Abp.AuditLogging.Tests.csproj index 31a70aa5b1..ccfb554d58 100644 --- a/modules/audit-logging/test/Volo.Abp.AuditLogging.Tests/Volo.Abp.AuditLogging.Tests.csproj +++ b/modules/audit-logging/test/Volo.Abp.AuditLogging.Tests/Volo.Abp.AuditLogging.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/modules/audit-logging/test/Volo.Abp.AuditLogging.Tests/Volo/Abp/AuditLogging/MultiTenantAuditLog_Tests.cs b/modules/audit-logging/test/Volo.Abp.AuditLogging.Tests/Volo/Abp/AuditLogging/MultiTenantAuditLog_Tests.cs index 04c885be20..6e92bc6f7f 100644 --- a/modules/audit-logging/test/Volo.Abp.AuditLogging.Tests/Volo/Abp/AuditLogging/MultiTenantAuditLog_Tests.cs +++ b/modules/audit-logging/test/Volo.Abp.AuditLogging.Tests/Volo/Abp/AuditLogging/MultiTenantAuditLog_Tests.cs @@ -59,12 +59,12 @@ namespace Volo.Abp.AuditLogging } ); - await scope.SaveAsync().ConfigureAwait(false); + await scope.SaveAsync(); } //Assert - var auditLogs = await _auditLogRepository.GetListAsync(applicationName: applicationName, includeDetails: true).ConfigureAwait(false); + var auditLogs = await _auditLogRepository.GetListAsync(applicationName: applicationName, includeDetails: true); auditLogs.Count.ShouldBe(1); var auditLog = auditLogs.First(); auditLog.EntityChanges.ShouldNotBeNull(); diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/FodyWeavers.xml b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/FodyWeavers.xsd b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/Volo.Abp.BackgroundJobs.DemoApp.HangFire.csproj b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/Volo.Abp.BackgroundJobs.DemoApp.HangFire.csproj index 3490b31f67..f27272bd28 100644 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/Volo.Abp.BackgroundJobs.DemoApp.HangFire.csproj +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.HangFire/Volo.Abp.BackgroundJobs.DemoApp.HangFire.csproj @@ -1,4 +1,6 @@ - + + + Exe diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/FodyWeavers.xml b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/FodyWeavers.xsd b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq.csproj b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq.csproj index adcf9be1aa..460716fb26 100644 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq.csproj +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq/Volo.Abp.BackgroundJobs.DemoApp.RabbitMq.csproj @@ -1,4 +1,6 @@ - + + + Exe diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/FodyWeavers.xml b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/FodyWeavers.xsd b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/Jobs/SampleJobCreator.cs b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/Jobs/SampleJobCreator.cs index 3c05c4abd3..b131c5943d 100644 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/Jobs/SampleJobCreator.cs +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/Jobs/SampleJobCreator.cs @@ -20,10 +20,10 @@ namespace Volo.Abp.BackgroundJobs.DemoApp.Shared.Jobs public async Task CreateJobsAsync() { - await _backgroundJobManager.EnqueueAsync(new WriteToConsoleGreenJobArgs { Value = "test 1 (green)" }).ConfigureAwait(false); - await _backgroundJobManager.EnqueueAsync(new WriteToConsoleGreenJobArgs { Value = "test 2 (green)" }).ConfigureAwait(false); - await _backgroundJobManager.EnqueueAsync(new WriteToConsoleYellowJobArgs { Value = "test 1 (yellow)" }).ConfigureAwait(false); - await _backgroundJobManager.EnqueueAsync(new WriteToConsoleYellowJobArgs { Value = "test 2 (yellow)" }).ConfigureAwait(false); + await _backgroundJobManager.EnqueueAsync(new WriteToConsoleGreenJobArgs { Value = "test 1 (green)" }); + await _backgroundJobManager.EnqueueAsync(new WriteToConsoleGreenJobArgs { Value = "test 2 (green)" }); + await _backgroundJobManager.EnqueueAsync(new WriteToConsoleYellowJobArgs { Value = "test 1 (yellow)" }); + await _backgroundJobManager.EnqueueAsync(new WriteToConsoleYellowJobArgs { Value = "test 2 (yellow)" }); } } } diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/Volo.Abp.BackgroundJobs.DemoApp.Shared.csproj b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/Volo.Abp.BackgroundJobs.DemoApp.Shared.csproj index 3bd6feee59..582cc3d634 100644 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/Volo.Abp.BackgroundJobs.DemoApp.Shared.csproj +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/Volo.Abp.BackgroundJobs.DemoApp.Shared.csproj @@ -1,4 +1,6 @@ - + + + netstandard2.0 diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/FodyWeavers.xml b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/FodyWeavers.xsd b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Volo.Abp.BackgroundJobs.DemoApp.csproj b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Volo.Abp.BackgroundJobs.DemoApp.csproj index b3bc53a2ed..6c9c118af4 100644 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Volo.Abp.BackgroundJobs.DemoApp.csproj +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp/Volo.Abp.BackgroundJobs.DemoApp.csproj @@ -1,4 +1,6 @@ - + + + Exe diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/FodyWeavers.xml b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/FodyWeavers.xsd b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo.Abp.BackgroundJobs.Domain.Shared.csproj b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo.Abp.BackgroundJobs.Domain.Shared.csproj index e7334e2348..4c79e9bcfd 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo.Abp.BackgroundJobs.Domain.Shared.csproj +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain.Shared/Volo.Abp.BackgroundJobs.Domain.Shared.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/FodyWeavers.xml b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/FodyWeavers.xsd b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo.Abp.BackgroundJobs.Domain.csproj b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo.Abp.BackgroundJobs.Domain.csproj index 82fd254232..7eb9015b73 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo.Abp.BackgroundJobs.Domain.csproj +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo.Abp.BackgroundJobs.Domain.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobStore.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobStore.cs index 2fe3a0fdda..b8d30b6940 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobStore.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobStore.cs @@ -24,38 +24,38 @@ namespace Volo.Abp.BackgroundJobs { return ObjectMapper.Map( await BackgroundJobRepository.FindAsync(jobId) -.ConfigureAwait(false)); + ); } public virtual async Task InsertAsync(BackgroundJobInfo jobInfo) { await BackgroundJobRepository.InsertAsync( ObjectMapper.Map(jobInfo) - ).ConfigureAwait(false); + ); } public virtual async Task> GetWaitingJobsAsync(int maxResultCount) { return ObjectMapper.Map, List>( await BackgroundJobRepository.GetWaitingListAsync(maxResultCount) -.ConfigureAwait(false)); + ); } public virtual async Task DeleteAsync(Guid jobId) { - await BackgroundJobRepository.DeleteAsync(jobId).ConfigureAwait(false); + await BackgroundJobRepository.DeleteAsync(jobId); } public virtual async Task UpdateAsync(BackgroundJobInfo jobInfo) { - var backgroundJobRecord = await BackgroundJobRepository.FindAsync(jobInfo.Id).ConfigureAwait(false); + var backgroundJobRecord = await BackgroundJobRepository.FindAsync(jobInfo.Id); if (backgroundJobRecord == null) { return; } ObjectMapper.Map(jobInfo, backgroundJobRecord); - await BackgroundJobRepository.UpdateAsync(backgroundJobRecord).ConfigureAwait(false); + await BackgroundJobRepository.UpdateAsync(backgroundJobRecord); } } } diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/FodyWeavers.xml b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/FodyWeavers.xsd b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp.BackgroundJobs.EntityFrameworkCore.csproj b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp.BackgroundJobs.EntityFrameworkCore.csproj index eb92972675..7103c0570e 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp.BackgroundJobs.EntityFrameworkCore.csproj +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo.Abp.BackgroundJobs.EntityFrameworkCore.csproj @@ -1,9 +1,10 @@ - + + - netstandard2.1 + netstandard2.0 diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/EfCoreBackgroundJobRepository.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/EfCoreBackgroundJobRepository.cs index 22b8e6ab46..8c786c9f37 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/EfCoreBackgroundJobRepository.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.EntityFrameworkCore/Volo/Abp/BackgroundJobs/EntityFrameworkCore/EfCoreBackgroundJobRepository.cs @@ -24,7 +24,7 @@ namespace Volo.Abp.BackgroundJobs.EntityFrameworkCore public async Task> GetWaitingListAsync(int maxResultCount) { return await GetWaitingListQuery(maxResultCount) - .ToListAsync().ConfigureAwait(false); + .ToListAsync(); } private IQueryable GetWaitingListQuery(int maxResultCount) diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/FodyWeavers.xml b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/FodyWeavers.xsd b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp.BackgroundJobs.MongoDB.csproj b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp.BackgroundJobs.MongoDB.csproj index 4b3184d0ab..56c1391ab9 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp.BackgroundJobs.MongoDB.csproj +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo.Abp.BackgroundJobs.MongoDB.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/MongoBackgroundJobRepository.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/MongoBackgroundJobRepository.cs index cd266eeac4..33903c1e9f 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/MongoBackgroundJobRepository.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.MongoDB/Volo/Abp/BackgroundJobs/MongoDB/MongoBackgroundJobRepository.cs @@ -24,7 +24,7 @@ namespace Volo.Abp.BackgroundJobs.MongoDB public async Task> GetWaitingListAsync(int maxResultCount) { return await GetWaitingListQuery(maxResultCount) - .ToListAsync().ConfigureAwait(false); + .ToListAsync(); } private IMongoQueryable GetWaitingListQuery(int maxResultCount) diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo.Abp.BackgroundJobs.Domain.Tests.csproj b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo.Abp.BackgroundJobs.Domain.Tests.csproj index c7d43a8e71..1326240199 100644 --- a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo.Abp.BackgroundJobs.Domain.Tests.csproj +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo.Abp.BackgroundJobs.Domain.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo/Abp/BackgroundJobs/BackgroundJobStore_Tests.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo/Abp/BackgroundJobs/BackgroundJobStore_Tests.cs index 94b9375d83..caa9a3c445 100644 --- a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo/Abp/BackgroundJobs/BackgroundJobStore_Tests.cs +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.Domain.Tests/Volo/Abp/BackgroundJobs/BackgroundJobStore_Tests.cs @@ -26,9 +26,9 @@ namespace Volo.Abp.BackgroundJobs await _backgroundJobStore.InsertAsync( jobInfo - ).ConfigureAwait(false); + ); - var jobInfo2 = await _backgroundJobStore.FindAsync(jobInfo.Id).ConfigureAwait(false); + var jobInfo2 = await _backgroundJobStore.FindAsync(jobInfo.Id); jobInfo2.ShouldNotBeNull(); jobInfo2.Id.ShouldBe(jobInfo.Id); jobInfo2.JobArgs.ShouldBe(jobInfo.JobArgs); diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests.csproj b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests.csproj index 25434f3b06..e37ab4380f 100644 --- a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests.csproj +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests/Volo.Abp.BackgroundJobs.EntityFrameworkCore.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo.Abp.BackgroundJobs.MongoDB.Tests.csproj b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo.Abp.BackgroundJobs.MongoDB.Tests.csproj index faece9ea33..3878875e65 100644 --- a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo.Abp.BackgroundJobs.MongoDB.Tests.csproj +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.MongoDB.Tests/Volo.Abp.BackgroundJobs.MongoDB.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp.BackgroundJobs.TestBase.csproj b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp.BackgroundJobs.TestBase.csproj index 538f9376fb..8563f2b04a 100644 --- a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp.BackgroundJobs.TestBase.csproj +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo.Abp.BackgroundJobs.TestBase.csproj @@ -1,4 +1,4 @@ - + diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/BackgroundJobRepository_Tests.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/BackgroundJobRepository_Tests.cs index 2187db533e..59a2709edd 100644 --- a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/BackgroundJobRepository_Tests.cs +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/BackgroundJobRepository_Tests.cs @@ -23,7 +23,7 @@ namespace Volo.Abp.BackgroundJobs [InlineData(5)] public async Task GetWaitingListAsync(int maxResultCount) { - var backgroundJobs = await _backgroundJobRepository.GetWaitingListAsync(maxResultCount).ConfigureAwait(false); + var backgroundJobs = await _backgroundJobRepository.GetWaitingListAsync(maxResultCount); backgroundJobs.Count.ShouldBeGreaterThan(0); backgroundJobs.Count.ShouldBeLessThanOrEqualTo(maxResultCount); diff --git a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/BackgroundJobsTestDataBuilder.cs b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/BackgroundJobsTestDataBuilder.cs index 90ec92ea35..16bcc667f5 100644 --- a/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/BackgroundJobsTestDataBuilder.cs +++ b/modules/background-jobs/test/Volo.Abp.BackgroundJobs.TestBase/Volo/Abp/BackgroundJobs/BackgroundJobsTestDataBuilder.cs @@ -35,7 +35,7 @@ namespace Volo.Abp.BackgroundJobs CreationTime = _clock.Now.Subtract(TimeSpan.FromMinutes(2)), TryCount = 0 } - ).ConfigureAwait(false); + ); await _backgroundJobRepository.InsertAsync( new BackgroundJobRecord(_testData.JobId2) @@ -49,7 +49,7 @@ namespace Volo.Abp.BackgroundJobs CreationTime = _clock.Now.Subtract(TimeSpan.FromDays(2)), TryCount = 3 } - ).ConfigureAwait(false); + ); await _backgroundJobRepository.InsertAsync( new BackgroundJobRecord(_testData.JobId3) @@ -63,7 +63,7 @@ namespace Volo.Abp.BackgroundJobs CreationTime = _clock.Now.Subtract(TimeSpan.FromMinutes(90)), TryCount = 2 } - ).ConfigureAwait(false); + ); } } } \ No newline at end of file diff --git a/modules/blogging/README.md b/modules/blogging/README.md index 9eda941757..716713666f 100644 --- a/modules/blogging/README.md +++ b/modules/blogging/README.md @@ -1,3 +1,10 @@ # Blogging Module -This module is used for ABP blog: https://abp.io/blog/abp/ +This module adds a simple blog to your ABP application; + +* Allows to create multiple blogs in a single application. +* Supports the Markdown format. +* Allows to write comment for a post. +* Allows to assign tags to the blog posts. + +See the [blog.abp.io](https://blog.abp.io/) website as a live example of the blogging module. \ No newline at end of file diff --git a/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/FodyWeavers.xml b/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/FodyWeavers.xsd b/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Volo.BloggingTestApp.EntityFrameworkCore.csproj b/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Volo.BloggingTestApp.EntityFrameworkCore.csproj index 27fa209d2c..341f5fdc14 100644 --- a/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Volo.BloggingTestApp.EntityFrameworkCore.csproj +++ b/modules/blogging/app/Volo.BloggingTestApp.EntityFrameworkCore/Volo.BloggingTestApp.EntityFrameworkCore.csproj @@ -1,7 +1,9 @@ - + + + - netstandard2.1 + netstandard2.0 diff --git a/modules/blogging/app/Volo.BloggingTestApp.MongoDB/FodyWeavers.xml b/modules/blogging/app/Volo.BloggingTestApp.MongoDB/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/blogging/app/Volo.BloggingTestApp.MongoDB/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/blogging/app/Volo.BloggingTestApp.MongoDB/FodyWeavers.xsd b/modules/blogging/app/Volo.BloggingTestApp.MongoDB/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/blogging/app/Volo.BloggingTestApp.MongoDB/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/blogging/app/Volo.BloggingTestApp.MongoDB/Volo.BloggingTestApp.MongoDB.csproj b/modules/blogging/app/Volo.BloggingTestApp.MongoDB/Volo.BloggingTestApp.MongoDB.csproj index 0f21d360e4..cf886e234f 100644 --- a/modules/blogging/app/Volo.BloggingTestApp.MongoDB/Volo.BloggingTestApp.MongoDB.csproj +++ b/modules/blogging/app/Volo.BloggingTestApp.MongoDB/Volo.BloggingTestApp.MongoDB.csproj @@ -1,4 +1,6 @@ - + + + netstandard2.0 diff --git a/modules/blogging/app/Volo.BloggingTestApp/FodyWeavers.xml b/modules/blogging/app/Volo.BloggingTestApp/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/blogging/app/Volo.BloggingTestApp/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/blogging/app/Volo.BloggingTestApp/FodyWeavers.xsd b/modules/blogging/app/Volo.BloggingTestApp/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/blogging/app/Volo.BloggingTestApp/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/blogging/app/Volo.BloggingTestApp/Volo.BloggingTestApp.csproj b/modules/blogging/app/Volo.BloggingTestApp/Volo.BloggingTestApp.csproj index c1bb7c8a85..918c42c1ad 100644 --- a/modules/blogging/app/Volo.BloggingTestApp/Volo.BloggingTestApp.csproj +++ b/modules/blogging/app/Volo.BloggingTestApp/Volo.BloggingTestApp.csproj @@ -1,4 +1,6 @@ - + + + netcoreapp3.1 @@ -12,9 +14,11 @@ - + - + + + diff --git a/modules/blogging/app/Volo.BloggingTestApp/wwwroot/libs/squire-rte/squire.js b/modules/blogging/app/Volo.BloggingTestApp/wwwroot/libs/squire-rte/squire.js index 7ce7ef2258..870905984b 100644 --- a/modules/blogging/app/Volo.BloggingTestApp/wwwroot/libs/squire-rte/squire.js +++ b/modules/blogging/app/Volo.BloggingTestApp/wwwroot/libs/squire-rte/squire.js @@ -1,2 +1,2 @@ -!function(e,t){"use strict";function n(e,t,n){this.root=this.currentNode=e,this.nodeType=t,this.filter=n||ue}function o(e,t){for(var n=e.length;n--;)if(!t(e[n]))return!1;return!0}function i(e){return e.nodeType===M&&!!pe[e.nodeName]}function r(e){switch(e.nodeType){case H:return me;case M:case z:if(de&&Ce.has(e))return Ce.get(e);break;default:return ge}var t;return t=o(e.childNodes,a)?fe.test(e.nodeName)?me:ve:Ne,de&&Ce.set(e,t),t}function a(e){return r(e)===me}function s(e){return r(e)===ve}function d(e){return r(e)===Ne}function l(e,t){var o=new n(t,q,s);return o.currentNode=e,o}function c(e,t){return e=l(e,t).previousNode(),e!==t?e:null}function h(e,t){return e=l(e,t).nextNode(),e!==t?e:null}function u(e){return!e.textContent&&!e.querySelector("IMG")}function f(e,t){return!i(e)&&e.nodeType===t.nodeType&&e.nodeName===t.nodeName&&"A"!==e.nodeName&&e.className===t.className&&(!e.style&&!t.style||e.style.cssText===t.style.cssText)}function p(e,t,n){if(e.nodeName!==t)return!1;for(var o in n)if(e.getAttribute(o)!==n[o])return!1;return!0}function g(e,t,n,o){for(;e&&e!==t;){if(p(e,n,o))return e;e=e.parentNode}return null}function m(e,t,n){for(;e&&e!==t;){if(n.test(e.nodeName))return e;e=e.parentNode}return null}function v(e,t){for(;t;){if(t===e)return!0;t=t.parentNode}return!1}function N(e,t,n){var o,i,r,a,s,d="";return e&&e!==t&&(d=N(e.parentNode,t,n),e.nodeType===M&&(d+=(d?">":"")+e.nodeName,(o=e.id)&&(d+="#"+o),(i=e.className.trim())&&(r=i.split(/\s\s*/),r.sort(),d+=".",d+=r.join(".")),(a=e.dir)&&(d+="[dir="+a+"]"),r&&(s=n.classNames,ce.call(r,s.highlight)>-1&&(d+="[backgroundColor="+e.style.backgroundColor.replace(/ /g,"")+"]"),ce.call(r,s.colour)>-1&&(d+="[color="+e.style.color.replace(/ /g,"")+"]"),ce.call(r,s.fontFamily)>-1&&(d+="[fontFamily="+e.style.fontFamily.replace(/ /g,"")+"]"),ce.call(r,s.fontSize)>-1&&(d+="[fontSize="+e.style.fontSize+"]")))),d}function C(e){var t=e.nodeType;return t===M||t===z?e.childNodes.length:e.length||0}function _(e){var t=e.parentNode;return t&&t.removeChild(e),e}function S(e,t){var n=e.parentNode;n&&n.replaceChild(t,e)}function y(e){for(var t=e.ownerDocument.createDocumentFragment(),n=e.childNodes,o=n?n.length:0;o--;)t.appendChild(e.firstChild);return t}function T(e,n,o,i){var r,a,s,d=e.createElement(n);if(o instanceof Array&&(i=o,o=null),o)for(r in o)o[r]!==t&&d.setAttribute(r,o[r]);if(i)for(a=0,s=i.length;as?t.startOffset-=1:t.startOffset===s&&(t.startContainer=o,t.startOffset=C(o))),t.endContainer===e&&(t.endOffset>s?t.endOffset-=1:t.endOffset===s&&(t.endContainer=o,t.endOffset=C(o))),_(n),n.nodeType===H?o.appendData(n.data):d.push(y(n));else if(n.nodeType===M){for(i=d.length;i--;)n.appendChild(d.pop());k(n,t)}}function A(e,t){if(e.nodeType===H&&(e=e.parentNode),e.nodeType===M){var n={startContainer:t.startContainer,startOffset:t.startOffset,endContainer:t.endContainer,endOffset:t.endOffset};k(e,n),t.setStart(n.startContainer,n.startOffset),t.setEnd(n.endContainer,n.endOffset)}}function L(e){var t=e.nodeName;return"TD"===t||"TH"===t||"TR"===t||"TBODY"===t||"THEAD"===t}function O(e,t,n,o){var i,r,a,s=t;if(!L(e)||!L(t)){for(;(i=s.parentNode)&&i!==o&&i.nodeType===M&&1===i.childNodes.length;)s=i;_(s),a=e.childNodes.length,r=e.lastChild,r&&"BR"===r.nodeName&&(e.removeChild(r),a-=1),e.appendChild(y(t)),n.setStart(e,a),n.collapse(!0),A(e,n),J&&(r=e.lastChild)&&"BR"===r.nodeName&&e.removeChild(r)}}function B(e,t){var n,o,i=e.previousSibling,r=e.firstChild,a=e.ownerDocument,s="LI"===e.nodeName;if((!s||r&&/^[OU]L$/.test(r.nodeName))&&!L(e))if(i&&f(i,e)&&i.isContentEditable&&e.isContentEditable){if(!d(i)){if(!s)return;o=T(a,"DIV"),o.appendChild(y(i)),i.appendChild(o)}_(e),n=!d(e),i.appendChild(y(e)),n&&b(i,t),r&&B(r,t)}else s&&(i=T(a,"DIV"),e.insertBefore(i,r),E(i,t))}function D(e){this.isShiftDown=e.shiftKey}function R(e,t,n){var o,i;if(e||(e={}),t)for(o in t)!n&&o in e||(i=t[o],e[o]=i&&i.constructor===Object?R(e[o],i,n):i);return e}function P(e,t){e.nodeType===W&&(e=e.body);var n,o=e.ownerDocument,i=o.defaultView;this._win=i,this._doc=o,this._root=e,this._events={},this._isFocused=!1,this._lastSelection=null,ae&&this.addEventListener("beforedeactivate",this.getSelection),this._hasZWS=!1,this._lastAnchorNode=null,this._lastFocusNode=null,this._path="",this._willUpdatePath=!1,"onselectionchange"in o?this.addEventListener("selectionchange",this._updatePathOnEvent):(this.addEventListener("keyup",this._updatePathOnEvent),this.addEventListener("mouseup",this._updatePathOnEvent)),this._undoIndex=-1,this._undoStack=[],this._undoStackLength=0,this._isInUndoState=!1,this._ignoreChange=!1,this._ignoreAllChanges=!1,se?(n=new MutationObserver(this._docWasChanged.bind(this)),n.observe(e,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),this._mutation=n):this.addEventListener("keyup",this._keyUpDetectChange),this._restoreSelection=!1,this.addEventListener("blur",U),this.addEventListener("mousedown",I),this.addEventListener("touchstart",I),this.addEventListener("focus",w),this._awaitingPaste=!1,this.addEventListener(X?"beforecut":"cut",tt),this.addEventListener("copy",nt),this.addEventListener("keydown",D),this.addEventListener("keyup",D),this.addEventListener(X?"beforepaste":"paste",ot),this.addEventListener("drop",it),this.addEventListener(J?"keypress":"keydown",Ie),this._keyHandlers=Object.create(He),this.setConfig(t),X&&(i.Text.prototype.splitText=function(e){var t=this.ownerDocument.createTextNode(this.data.slice(e)),n=this.nextSibling,o=this.parentNode,i=this.length-e;return n?o.insertBefore(t,n):o.appendChild(t),i&&this.deleteData(e,i),t}),e.setAttribute("contenteditable","true");try{o.execCommand("enableObjectResizing",!1,"false"),o.execCommand("enableInlineTableEditing",!1,"false")}catch(e){}e.__squire__=this,this.setHTML("")}function U(){this._restoreSelection=!0}function I(){this._restoreSelection=!1}function w(){this._restoreSelection&&this.setSelection(this._lastSelection)}function F(e,t,n){var o,i;for(o=t.firstChild;o;o=i){if(i=o.nextSibling,a(o)){if(o.nodeType===H||"BR"===o.nodeName||"IMG"===o.nodeName){n.appendChild(o);continue}}else if(s(o)){n.appendChild(e.createDefaultBlock([F(e,o,e._doc.createDocumentFragment())]));continue}F(e,o,n)}return n}var M=1,H=3,W=9,z=11,q=1,K="​",G=e.defaultView,Z=navigator.userAgent,j=/Android/.test(Z),Q=/iP(?:ad|hone|od)/.test(Z),$=/Mac OS X/.test(Z),V=/Windows NT/.test(Z),Y=/Gecko\//.test(Z),X=/Trident\/[456]\./.test(Z),J=!!G.opera,ee=/Edge\//.test(Z),te=!ee&&/WebKit\//.test(Z),ne=/Trident\/[4567]\./.test(Z),oe=$?"meta-":"ctrl-",ie=X||J,re=X||te,ae=X,se="undefined"!=typeof MutationObserver,de="undefined"!=typeof WeakMap,le=/[^ \t\r\n]/,ce=Array.prototype.indexOf;Object.create||(Object.create=function(e){var t=function(){};return t.prototype=e,new t});var he={1:1,2:2,3:4,8:128,9:256,11:1024},ue=function(){return!0};n.prototype.nextNode=function(){for(var e,t=this.currentNode,n=this.root,o=this.nodeType,i=this.filter;;){for(e=t.firstChild;!e&&t&&t!==n;)(e=t.nextSibling)||(t=t.parentNode);if(!e)return null;if(he[e.nodeType]&o&&i(e))return this.currentNode=e,e;t=e}},n.prototype.previousNode=function(){for(var e,t=this.currentNode,n=this.root,o=this.nodeType,i=this.filter;;){if(t===n)return null;if(e=t.previousSibling)for(;t=e.lastChild;)e=t;else e=t.parentNode;if(!e)return null;if(he[e.nodeType]&o&&i(e))return this.currentNode=e,e;t=e}},n.prototype.previousPONode=function(){for(var e,t=this.currentNode,n=this.root,o=this.nodeType,i=this.filter;;){for(e=t.lastChild;!e&&t&&t!==n;)(e=t.previousSibling)||(t=t.parentNode);if(!e)return null;if(he[e.nodeType]&o&&i(e))return this.currentNode=e,e;t=e}};var fe=/^(?:#text|A(?:BBR|CRONYM)?|B(?:R|D[IO])?|C(?:ITE|ODE)|D(?:ATA|EL|FN)|EM|FONT|I(?:FRAME|MG|NPUT|NS)?|KBD|Q|R(?:P|T|UBY)|S(?:AMP|MALL|PAN|TR(?:IKE|ONG)|U[BP])?|TIME|U|VAR|WBR)$/,pe={BR:1,HR:1,IFRAME:1,IMG:1,INPUT:1},ge=0,me=1,ve=2,Ne=3,Ce=de?new WeakMap:null,_e=function(e,t){for(var n=e.childNodes;t&&e.nodeType===M;)e=n[t-1],n=e.childNodes,t=n.length;return e},Se=function(e,t){if(e.nodeType===M){var n=e.childNodes;if(t-1,r=e.compareBoundaryPoints(1,o)<1;return!i&&!r}var a=e.compareBoundaryPoints(0,o)<1,s=e.compareBoundaryPoints(2,o)>-1;return a&&s},ke=function(e){for(var t,n=e.startContainer,o=e.startOffset,r=e.endContainer,a=e.endOffset,s=!0;n.nodeType!==H&&(t=n.childNodes[o])&&!i(t);)n=t,o=0;if(a)for(;r.nodeType!==H;){if(!(t=r.childNodes[a-1])||i(t)){if(s&&t&&"BR"===t.nodeName){a-=1,s=!1;continue}break}r=t,a=C(r)}else for(;r.nodeType!==H&&(t=r.firstChild)&&!i(t);)r=t;e.collapsed?(e.setStart(r,a),e.setEnd(n,o)):(e.setStart(n,o),e.setEnd(r,a))},Ae=function(e,t,n,o){var i,r=e.startContainer,a=e.startOffset,s=e.endContainer,d=e.endOffset,l=!0;for(t||(t=e.commonAncestorContainer),n||(n=t);!a&&r!==t&&r!==o;)i=r.parentNode,a=ce.call(i.childNodes,r),r=i;for(;;){if(l&&s.nodeType!==H&&s.childNodes[d]&&"BR"===s.childNodes[d].nodeName&&(d+=1,l=!1),s===n||s===o||d!==C(s))break;i=s.parentNode,d=ce.call(i.childNodes,s)+1,s=i}e.setStart(r,a),e.setEnd(s,d)},Le=function(e,t){var n,o=e.startContainer;return a(o)?n=c(o,t):o!==t&&s(o)?n=o:(n=_e(o,e.startOffset),n=h(n,t)),n&&xe(e,n,!0)?n:null},Oe=function(e,t){var n,o,i=e.endContainer;if(a(i))n=c(i,t);else if(i!==t&&s(i))n=i;else{if(!(n=Se(i,e.endOffset))||!v(t,n))for(n=t;o=n.lastChild;)n=o;n=c(n,t)}return n&&xe(e,n,!0)?n:null},Be=new n(null,4|q,function(e){return e.nodeType===H?le.test(e.data):"IMG"===e.nodeName}),De=function(e,t){var n,o=e.startContainer,i=e.startOffset;if(Be.root=null,o.nodeType===H){if(i)return!1;n=o}else if(n=Se(o,i),n&&!v(t,n)&&(n=null),!n&&(n=_e(o,i),n.nodeType===H&&n.length))return!1;return Be.currentNode=n,Be.root=Le(e,t),!Be.previousNode()},Re=function(e,t){var n,o=e.endContainer,i=e.endOffset;if(Be.root=null,o.nodeType===H){if((n=o.data.length)&&i-1||!Y&&ce.call(i,"text/plain")>-1&&ce.call(i,"text/rtf")<0))return e.preventDefault(),void(!d&&(r=a.getData("text/html"))?this.insertHTML(r,!0):((r=a.getData("text/plain"))||(r=a.getData("text/uri-list")))&&this.insertPlainText(r,!0));this._awaitingPaste=!0;var f=this._doc.body,p=this.getSelection(),g=p.startContainer,m=p.startOffset,v=p.endContainer,N=p.endOffset,C=this.createElement("DIV",{contenteditable:"true",style:"position:fixed; overflow:hidden; top:0; right:100%; width:1px; height:1px;"});f.appendChild(C),p.selectNodeContents(C),this.setSelection(p),setTimeout(function(){try{u._awaitingPaste=!1;for(var e,t,n="",o=C;C=o;)o=C.nextSibling,_(C),e=C.firstChild,e&&e===C.lastChild&&"DIV"===e.nodeName&&(C=e),n+=C.innerHTML;t=u.createRange(g,m,v,N),u.setSelection(t),n&&u.insertHTML(n,!0)}catch(e){u.didError(e)}},0)},it=function(e){for(var t=e.dataTransfer.types,n=t.length,o=!1,i=!1;n--;)switch(t[n]){case"text/plain":o=!0;break;case"text/html":i=!0;break;default:return}(i||o)&&this.saveUndoState()},rt=P.prototype,at=function(e,t,n){var o=n._doc,i=e?DOMPurify.sanitize(e,{ALLOW_UNKNOWN_PROTOCOLS:!0,WHOLE_DOCUMENT:!1,RETURN_DOM:!0,RETURN_DOM_FRAGMENT:!0}):null;return i?o.importNode(i,!0):o.createDocumentFragment()};rt.setConfig=function(e){return e=R({blockTag:"DIV",blockAttributes:null,tagAttributes:{blockquote:null,ul:null,ol:null,li:null,a:null},classNames:{colour:"colour",fontFamily:"font",fontSize:"size",highlight:"highlight"},leafNodeNames:pe,undo:{documentSizeThreshold:-1,undoLimit:-1},isInsertedHTMLSanitized:!0,isSetHTMLSanitized:!0,sanitizeToDOMFragment:"undefined"!=typeof DOMPurify&&DOMPurify.isSupported?at:null,willCutCopy:null},e,!0),e.blockTag=e.blockTag.toUpperCase(),this._config=e,this},rt.createElement=function(e,t,n){return T(this._doc,e,t,n)},rt.createDefaultBlock=function(e){var t=this._config;return E(this.createElement(t.blockTag,t.blockAttributes,e),this._root)},rt.didError=function(e){console.log(e)},rt.getDocument=function(){return this._doc},rt.getRoot=function(){return this._root},rt.modifyDocument=function(e){var t=this._mutation;t&&(t.takeRecords().length&&this._docWasChanged(),t.disconnect()),this._ignoreAllChanges=!0,e(),this._ignoreAllChanges=!1,t&&(t.observe(this._root,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),this._ignoreChange=!1)};var st={pathChange:1,select:1,input:1,undoStateChange:1};rt.fireEvent=function(e,t){var n,o,i,r=this._events[e];if(/^(?:focus|blur)/.test(e))if(n=this._root===this._doc.activeElement,"focus"===e){if(!n||this._isFocused)return this;this._isFocused=!0}else{if(n||!this._isFocused)return this;this._isFocused=!1}if(r)for(t||(t={}),t.type!==e&&(t.type=e),r=r.slice(),o=r.length;o--;){i=r[o];try{i.handleEvent?i.handleEvent(t):i.call(this,t)}catch(t){t.details="Squire: fireEvent error. Event type: "+e,this.didError(t)}}return this},rt.destroy=function(){var e,t=this._events;for(e in t)this.removeEventListener(e);this._mutation&&this._mutation.disconnect(),delete this._root.__squire__,this._undoIndex=-1,this._undoStack=[],this._undoStackLength=0},rt.handleEvent=function(e){this.fireEvent(e.type,e)},rt.addEventListener=function(e,t){var n=this._events[e],o=this._root;return t?(n||(n=this._events[e]=[],st[e]||("selectionchange"===e&&(o=this._doc),o.addEventListener(e,this,!0))),n.push(t),this):(this.didError({name:"Squire: addEventListener with null or undefined fn",message:"Event type: "+e}),this)},rt.removeEventListener=function(e,t){var n,o=this._events[e],i=this._root;if(o){if(t)for(n=o.length;n--;)o[n]===t&&o.splice(n,1);else o.length=0;o.length||(delete this._events[e],st[e]||("selectionchange"===e&&(i=this._doc),i.removeEventListener(e,this,!0)))}return this},rt.createRange=function(e,t,n,o){if(e instanceof this._win.Range)return e.cloneRange();var i=this._doc.createRange();return i.setStart(e,t),n?i.setEnd(n,o):i.setEnd(e,t),i},rt.getCursorPosition=function(e){if(!e&&!(e=this.getSelection())||!e.getBoundingClientRect)return null;var t,n,o=e.getBoundingClientRect();return o&&!o.top&&(this._ignoreChange=!0,t=this._doc.createElement("SPAN"),t.textContent=K,ye(e,t),o=t.getBoundingClientRect(),n=t.parentNode,n.removeChild(t),A(n,e)),o},rt._moveCursorTo=function(e){var t=this._root,n=this.createRange(t,e?0:t.childNodes.length);return ke(n),this.setSelection(n),this},rt.moveCursorToStart=function(){return this._moveCursorTo(!0)},rt.moveCursorToEnd=function(){return this._moveCursorTo(!1)};var dt=function(e){return e._win.getSelection()||null};rt.setSelection=function(e){if(e)if(this._lastSelection=e,this._isFocused)if(j&&!this._restoreSelection)U.call(this),this.blur(),this.focus();else{Q&&this._win.focus();var t=dt(this);t&&(t.removeAllRanges(),t.addRange(e))}else U.call(this);return this},rt.getSelection=function(){var e,t,n,o,r=dt(this),a=this._root;return this._isFocused&&r&&r.rangeCount&&(e=r.getRangeAt(0).cloneRange(),t=e.startContainer,n=e.endContainer,t&&i(t)&&e.setStartBefore(t),n&&i(n)&&e.setEndBefore(n)),e&&v(a,e.commonAncestorContainer)?this._lastSelection=e:(e=this._lastSelection,o=e.commonAncestorContainer,v(o.ownerDocument,o)||(e=null)),e||(e=this.createRange(a.firstChild,0)),e},rt.getSelectedText=function(){var e=this.getSelection();if(!e||e.collapsed)return"";var t,o=new n(e.commonAncestorContainer,4|q,function(t){return xe(e,t,!0)}),i=e.startContainer,r=e.endContainer,s=o.currentNode=i,d="",l=!1;for(o.filter(s)||(s=o.nextNode());s;)s.nodeType===H?(t=s.data)&&/\S/.test(t)&&(s===r&&(t=t.slice(0,e.endOffset)),s===i&&(t=t.slice(e.startOffset)),d+=t,l=!0):("BR"===s.nodeName||l&&!a(s))&&(d+="\n",l=!1),s=o.nextNode();return d},rt.getPath=function(){return this._path};var lt=function(e,t){for(var o,i,r,s=new n(e,4);i=s.nextNode();)for(;(r=i.data.indexOf(K))>-1&&(!t||i.parentNode!==t);){if(1===i.length){do{o=i.parentNode,o.removeChild(i),i=o,s.currentNode=o}while(a(i)&&!C(i));break}i.deleteData(r,1)}};rt._didAddZWS=function(){this._hasZWS=!0},rt._removeZWS=function(){this._hasZWS&&(lt(this._root),this._hasZWS=!1)},rt._updatePath=function(e,t){if(e){var n,o=e.startContainer,i=e.endContainer;(t||o!==this._lastAnchorNode||i!==this._lastFocusNode)&&(this._lastAnchorNode=o,this._lastFocusNode=i,n=o&&i?o===i?N(i,this._root,this._config):"(selection)":"",this._path!==n&&(this._path=n,this.fireEvent("pathChange",{path:n}))),this.fireEvent(e.collapsed?"cursor":"select",{range:e})}}, -rt._updatePathOnEvent=function(e){var t=this;t._isFocused&&!t._willUpdatePath&&(t._willUpdatePath=!0,setTimeout(function(){t._willUpdatePath=!1,t._updatePath(t.getSelection())},0))},rt.focus=function(){if(ne){try{this._root.setActive()}catch(e){}this.fireEvent("focus")}else this._root.focus();return this},rt.blur=function(){return this._root.blur(),ne&&this.fireEvent("blur"),this};var ct="squire-selection-end";rt._saveRangeToBookmark=function(e){var t,n=this.createElement("INPUT",{id:"squire-selection-start",type:"hidden"}),o=this.createElement("INPUT",{id:ct,type:"hidden"});ye(e,n),e.collapse(!1),ye(e,o),2&n.compareDocumentPosition(o)&&(n.id=ct,o.id="squire-selection-start",t=n,n=o,o=t),e.setStartAfter(n),e.setEndBefore(o)},rt._getRangeAndRemoveBookmark=function(e){var t=this._root,n=t.querySelector("#squire-selection-start"),o=t.querySelector("#"+ct);if(n&&o){var i=n.parentNode,r=o.parentNode,a=ce.call(i.childNodes,n),s=ce.call(r.childNodes,o);i===r&&(s-=1),_(n),_(o),e||(e=this._doc.createRange()),e.setStart(i,a),e.setEnd(r,s),A(i,e),i!==r&&A(r,e),e.collapsed&&(i=e.startContainer,i.nodeType===H&&(r=i.childNodes[e.startOffset],r&&r.nodeType===H||(r=i.childNodes[e.startOffset-1]),r&&r.nodeType===H&&(e.setStart(r,0),e.collapse(!0))))}return e||null},rt._keyUpDetectChange=function(e){var t=e.keyCode;e.ctrlKey||e.metaKey||e.altKey||!(t<16||t>20)||!(t<33||t>45)||this._docWasChanged()},rt._docWasChanged=function(){if(de&&(Ce=new WeakMap),!this._ignoreAllChanges){if(se&&this._ignoreChange)return void(this._ignoreChange=!1);this._isInUndoState&&(this._isInUndoState=!1,this.fireEvent("undoStateChange",{canUndo:!0,canRedo:!1})),this.fireEvent("input")}},rt._recordUndoState=function(e,t){if(!this._isInUndoState||t){var n,o=this._undoIndex,i=this._undoStack,r=this._config.undo,a=r.documentSizeThreshold,s=r.undoLimit;t||(o+=1),o-1&&2*n.length>a&&s>-1&&o>s&&(i.splice(0,o-s),o=s,this._undoStackLength=s),i[o]=n,this._undoIndex=o,this._undoStackLength+=1,this._isInUndoState=!0}},rt.saveUndoState=function(e){return e===t&&(e=this.getSelection()),this._recordUndoState(e,this._isInUndoState),this._getRangeAndRemoveBookmark(e),this},rt.undo=function(){if(0!==this._undoIndex||!this._isInUndoState){this._recordUndoState(this.getSelection(),!1),this._undoIndex-=1,this._setHTML(this._undoStack[this._undoIndex]);var e=this._getRangeAndRemoveBookmark();e&&this.setSelection(e),this._isInUndoState=!0,this.fireEvent("undoStateChange",{canUndo:0!==this._undoIndex,canRedo:!0}),this.fireEvent("input")}return this},rt.redo=function(){var e=this._undoIndex,t=this._undoStackLength;if(e+1c&&h.splitText(c),h===s&&l&&(h=h.splitText(l),d===s&&(d=h,c-=l),s=h,l=0),i=this.createElement(e,t),S(h,i),i.appendChild(h))}while(r.nextNode());d.nodeType!==H&&(h.nodeType===H?(d=h,c=h.length):(d=h.parentNode,c=1)),o=this.createRange(s,l,d,c)}return o},rt._removeFormat=function(e,t,n,o){this._saveRangeToBookmark(n);var i,r=this._doc;n.collapsed&&(re?(i=r.createTextNode(K),this._didAddZWS()):i=r.createTextNode(""),ye(n,i));for(var s=n.commonAncestorContainer;a(s);)s=s.parentNode;var d=n.startContainer,l=n.startOffset,c=n.endContainer,h=n.endOffset,u=[],f=function(e,t){if(!xe(n,e,!1)){var o,i,r=e.nodeType===H;if(!xe(n,e,!0))return void("INPUT"===e.nodeName||r&&!e.data||u.push([t,e]));if(r)e===c&&h!==e.length&&u.push([t,e.splitText(h)]),e===d&&l&&(e.splitText(l),u.push([t,e]));else for(o=e.firstChild;o;o=i)i=o.nextSibling,f(o,t)}},g=Array.prototype.filter.call(s.getElementsByTagName(e),function(o){return xe(n,o,!0)&&p(o,e,t)});return o||g.forEach(function(e){f(e,e)}),u.forEach(function(e){var t=e[0].cloneNode(!1),n=e[1];S(n,t),t.appendChild(n)}),g.forEach(function(e){S(e,y(e))}),this._getRangeAndRemoveBookmark(n),i&&n.collapse(!1),A(s,n),n},rt.changeFormat=function(e,t,n,o){return n||(n=this.getSelection())?(this.saveUndoState(n),t&&(n=this._removeFormat(t.tag.toUpperCase(),t.attributes||{},n,o)),e&&(n=this._addFormat(e.tag.toUpperCase(),e.attributes||{},n)),this.setSelection(n),this._updatePath(n,!0),se||this._docWasChanged(),this):this};var ht={DT:"DD",DD:"DT",LI:"LI",PRE:"PRE"},ut=function(e,t,n,o){var i=ht[t.nodeName],r=null,a=x(n,o,t.parentNode,e._root),s=e._config;return i||(i=s.blockTag,r=s.blockAttributes),p(a,i,r)||(t=T(a.ownerDocument,i,r),a.dir&&(t.dir=a.dir),S(a,t),t.appendChild(y(a)),a=t),a};rt.forEachBlock=function(e,t,n){if(!n&&!(n=this.getSelection()))return this;t&&this.saveUndoState(n);var o=this._root,i=Le(n,o),r=Oe(n,o);if(i&&r)do{if(e(i)||i===r)break}while(i=h(i,o));return t&&(this.setSelection(n),this._updatePath(n,!0),se||this._docWasChanged()),this},rt.modifyBlocks=function(e,t){if(!t&&!(t=this.getSelection()))return this;this._recordUndoState(t,this._isInUndoState);var n,o=this._root;return Pe(t,o),Ae(t,o,o,o),n=Te(t,o,o),ye(t,e.call(this,n)),t.endOffset]+|\([^\s()<>]+\))+(?:\((?:[^\s()<>]+|(?:\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))|([\w\-.%+]+@(?:[\w\-]+\.)+[A-Z]{2,}\b)(?:\?[^&?\s]+=[^&?\s]+(?:&[^&?\s]+=[^&?\s]+)*)?/i;var St=function(e,t,o){var i,r,a,s,d,l,c,h=e.ownerDocument,u=new n(e,4,function(e){return!g(e,t,"A")}),f=o.linkRegExp,p=o._config.tagAttributes.a;if(f)for(;i=u.nextNode();)for(r=i.data,a=i.parentNode;s=f.exec(r);)d=s.index,l=d+s[0].length,d&&(c=h.createTextNode(r.slice(0,d)),a.insertBefore(c,i)),c=o.createElement("A",R({href:s[1]?/^(?:ht|f)tps?:/i.test(s[1])?s[1]:"http://"+s[1]:"mailto:"+s[0]},p,!1)),c.textContent=r.slice(d,l),a.insertBefore(c,i),i.data=r=r.slice(l)};rt.insertHTML=function(e,t){var n,o,i,r,a,s,d,l=this._config,c=l.isInsertedHTMLSanitized?l.sanitizeToDOMFragment:null,u=this.getSelection(),f=this._doc;"function"==typeof c?r=c(e,t,this):(t&&(n=e.indexOf("\x3c!--StartFragment--\x3e"),o=e.lastIndexOf("\x3c!--EndFragment--\x3e"),n>-1&&o>-1&&(e=e.slice(n+20,o))),/<\/td>((?!<\/tr>)[\s\S])*$/i.test(e)&&(e=""+e+""),/<\/tr>((?!<\/table>)[\s\S])*$/i.test(e)&&(e=""+e+"
    "),i=this.createElement("DIV"),i.innerHTML=e,r=f.createDocumentFragment(),r.appendChild(y(i))),this.saveUndoState(u);try{for(a=this._root,s=r,d={fragment:r,preventDefault:function(){this.defaultPrevented=!0},defaultPrevented:!1},St(r,r,this),$e(r,l),Je(r,a,!1),Ve(r),r.normalize();s=h(s,r);)E(s,a);t&&this.fireEvent("willPaste",d),d.defaultPrevented||(be(u,d.fragment,a),se||this._docWasChanged(),u.collapse(!1),this._ensureBottomLine()),this.setSelection(u),this._updatePath(u,!0),t&&this.focus()}catch(e){this.didError(e)}return this};var yt=function(e){return e.split("&").join("&").split("<").join("<").split(">").join(">").split('"').join(""")};rt.insertPlainText=function(e,t){var n=this.getSelection();if(n.collapsed&&g(n.startContainer,this._root,"PRE")){var o,i,r=n.startContainer,a=n.startOffset;return r&&r.nodeType===H||(o=this._doc.createTextNode(""),r.insertBefore(o,r.childNodes[a]),r=o,a=0),i={text:e,preventDefault:function(){this.defaultPrevented=!0},defaultPrevented:!1},t&&this.fireEvent("willPaste",i),i.defaultPrevented||(e=i.text,r.insertData(a,e),n.setStart(r,a+e.length),n.collapse(!0)),this.setSelection(n),this}var s,d,l,c,h=e.split("\n"),u=this._config,f=u.blockTag,p=u.blockAttributes,m="",v="<"+f;for(s in p)v+=" "+s+'="'+yt(p[s])+'"';for(v+=">",d=0,l=h.length;d")+m;return this.insertHTML(h.join(""),t)};var Tt=function(e,t,n){return function(){return this[e](t,n),this.focus()}};rt.addStyles=function(e){if(e){var t=this._doc.documentElement.firstChild,n=this.createElement("STYLE",{type:"text/css"});n.appendChild(this._doc.createTextNode(e)),t.appendChild(n)}return this},rt.bold=Tt("changeFormat",{tag:"B"}),rt.italic=Tt("changeFormat",{tag:"I"}),rt.underline=Tt("changeFormat",{tag:"U"}),rt.strikethrough=Tt("changeFormat",{tag:"S"}),rt.subscript=Tt("changeFormat",{tag:"SUB"},{tag:"SUP"}),rt.superscript=Tt("changeFormat",{tag:"SUP"},{tag:"SUB"}),rt.removeBold=Tt("changeFormat",null,{tag:"B"}),rt.removeItalic=Tt("changeFormat",null,{tag:"I"}),rt.removeUnderline=Tt("changeFormat",null,{tag:"U"}),rt.removeStrikethrough=Tt("changeFormat",null,{tag:"S"}),rt.removeSubscript=Tt("changeFormat",null,{tag:"SUB"}),rt.removeSuperscript=Tt("changeFormat",null,{tag:"SUP"}),rt.makeLink=function(e,t){var n=this.getSelection();if(n.collapsed){var o=e.indexOf(":")+1;if(o)for(;"/"===e[o];)o+=1;ye(n,this._doc.createTextNode(e.slice(o)))}return t=R(R({href:e},t,!0),this._config.tagAttributes.a,!1),this.changeFormat({tag:"A",attributes:t},{tag:"A"},n),this.focus()},rt.removeLink=function(){return this.changeFormat(null,{tag:"A"},this.getSelection(),!0),this.focus()},rt.setFontFace=function(e){var t=this._config.classNames.fontFamily;return this.changeFormat(e?{tag:"SPAN",attributes:{class:t,style:"font-family: "+e+", sans-serif;"}}:null,{tag:"SPAN",attributes:{class:t}}),this.focus()},rt.setFontSize=function(e){var t=this._config.classNames.fontSize;return this.changeFormat(e?{tag:"SPAN",attributes:{class:t,style:"font-size: "+("number"==typeof e?e+"px":e)}}:null,{tag:"SPAN",attributes:{class:t}}),this.focus()},rt.setTextColour=function(e){var t=this._config.classNames.colour;return this.changeFormat(e?{tag:"SPAN",attributes:{class:t,style:"color:"+e}}:null,{tag:"SPAN",attributes:{class:t}}),this.focus()},rt.setHighlightColour=function(e){var t=this._config.classNames.highlight;return this.changeFormat(e?{tag:"SPAN",attributes:{class:t,style:"background-color:"+e}}:e,{tag:"SPAN",attributes:{class:t}}),this.focus()},rt.setTextAlignment=function(e){return this.forEachBlock(function(t){var n=t.className.split(/\s+/).filter(function(e){return!!e&&!/^align/.test(e)}).join(" ");e?(t.className=n+" align-"+e,t.style.textAlign=e):(t.className=n,t.style.textAlign="")},!0),this.focus()},rt.setTextDirection=function(e){return this.forEachBlock(function(t){e?t.dir=e:t.removeAttribute("dir")},!0),this.focus()};var Et=function(e){for(var t,o=this._root,i=this._doc,r=i.createDocumentFragment(),a=l(e,o);t=a.nextNode();){var s,d,c=t.querySelectorAll("BR"),h=[],u=c.length;for(s=0;s-1;)a.appendChild(d.createTextNode(r.slice(0,s))),a.appendChild(d.createElement("BR")),r=r.slice(s+1);i.parentNode.insertBefore(a,i),i.data=r}b(t,l),S(t,y(t))}return e};rt.code=function(){var e=this.getSelection();return e.collapsed||d(e.commonAncestorContainer)?this.modifyBlocks(Et,e):this.changeFormat({tag:"CODE",attributes:this._config.tagAttributes.code},null,e),this.focus()},rt.removeCode=function(){var e=this.getSelection();return g(e.commonAncestorContainer,this._root,"PRE")?this.modifyBlocks(bt,e):this.changeFormat(null,{tag:"CODE"},e),this.focus()},rt.toggleCode=function(){return this.hasFormat("PRE")||this.hasFormat("CODE")?this.removeCode():this.code(),this},rt.removeAllFormatting=function(e){if(!e&&!(e=this.getSelection())||e.collapsed)return this;for(var t=this._root,n=e.commonAncestorContainer;n&&!s(n);)n=n.parentNode;if(n||(Pe(e,t),n=t),n.nodeType===H)return this;this.saveUndoState(e),Ae(e,n,n,t);for(var o,i,r=n.ownerDocument,a=e.startContainer,d=e.startOffset,l=e.endContainer,c=e.endOffset,h=r.createDocumentFragment(),u=r.createDocumentFragment(),f=x(l,c,n,t),p=x(a,d,n,t);p!==f;)o=p.nextSibling,h.appendChild(p),p=o;return F(this,h,u),u.normalize(),p=u.firstChild,o=u.lastChild,i=n.childNodes,p?(n.insertBefore(u,f),d=ce.call(i,p),c=ce.call(i,o)+1):(d=ce.call(i,f),c=d),e.setStart(n,d),e.setEnd(n,c),A(n,e),ke(e),this.setSelection(e),this._updatePath(e,!0),this.focus()},rt.increaseQuoteLevel=Tt("modifyBlocks",ft),rt.decreaseQuoteLevel=Tt("modifyBlocks",pt),rt.makeUnorderedList=Tt("modifyBlocks",vt),rt.makeOrderedList=Tt("modifyBlocks",Nt),rt.removeList=Tt("modifyBlocks",Ct),P.isInline=a,P.isBlock=s,P.isContainer=d,P.getBlockWalker=l,P.getPreviousBlock=c,P.getNextBlock=h,P.areAlike=f,P.hasTagAttributes=p,P.getNearest=g,P.isOrContains=v,P.detach=_,P.replaceWith=S,P.empty=y,P.getNodeBefore=_e,P.getNodeAfter=Se,P.insertNodeInRange=ye,P.extractContentsOfRange=Te,P.deleteContentsOfRange=Ee,P.insertTreeFragmentIntoRange=be,P.isNodeContainedInRange=xe,P.moveRangeBoundariesDownTree=ke,P.moveRangeBoundariesUpTree=Ae,P.getStartBlockOfRange=Le,P.getEndBlockOfRange=Oe,P.contentWalker=Be,P.rangeDoesStartAtBlockBoundary=De,P.rangeDoesEndAtBlockBoundary=Re,P.expandRangeToBlockBoundaries=Pe,P.onPaste=ot,P.addLinks=St,P.splitBlock=ut,P.startSelectionId="squire-selection-start",P.endSelectionId=ct,"object"==typeof exports?module.exports=P:"function"==typeof define&&define.amd?define(function(){return P}):(G.Squire=P,top!==G&&"true"===e.documentElement.getAttribute("data-squireinit")&&(G.editor=new P(e),G.onEditorLoad&&(G.onEditorLoad(G.editor),G.onEditorLoad=null)))}(document); \ No newline at end of file +!function(e,t){"use strict";function n(e,t,n){this.root=this.currentNode=e,this.nodeType=t,this.filter=n||ue}function o(e,t){for(var n=e.length;n--;)if(!t(e[n]))return!1;return!0}function i(e){return e.nodeType===M&&!!pe[e.nodeName]}function r(e){switch(e.nodeType){case H:return me;case M:case z:if(de&&Ce.has(e))return Ce.get(e);break;default:return ge}var t;return t=o(e.childNodes,a)?fe.test(e.nodeName)?me:ve:Ne,de&&Ce.set(e,t),t}function a(e){return r(e)===me}function s(e){return r(e)===ve}function d(e){return r(e)===Ne}function l(e,t){var o=new n(t,q,s);return o.currentNode=e,o}function c(e,t){return e=l(e,t).previousNode(),e!==t?e:null}function h(e,t){return e=l(e,t).nextNode(),e!==t?e:null}function u(e){return!e.textContent&&!e.querySelector("IMG")}function f(e,t){return!i(e)&&e.nodeType===t.nodeType&&e.nodeName===t.nodeName&&"A"!==e.nodeName&&e.className===t.className&&(!e.style&&!t.style||e.style.cssText===t.style.cssText)}function p(e,t,n){if(e.nodeName!==t)return!1;for(var o in n)if(e.getAttribute(o)!==n[o])return!1;return!0}function g(e,t,n,o){for(;e&&e!==t;){if(p(e,n,o))return e;e=e.parentNode}return null}function m(e,t,n){for(;e&&e!==t;){if(n.test(e.nodeName))return e;e=e.parentNode}return null}function v(e,t){for(;t;){if(t===e)return!0;t=t.parentNode}return!1}function N(e,t,n){var o,i,r,a,s,d="";return e&&e!==t&&(d=N(e.parentNode,t,n),e.nodeType===M&&(d+=(d?">":"")+e.nodeName,(o=e.id)&&(d+="#"+o),(i=e.className.trim())&&(r=i.split(/\s\s*/),r.sort(),d+=".",d+=r.join(".")),(a=e.dir)&&(d+="[dir="+a+"]"),r&&(s=n.classNames,ce.call(r,s.highlight)>-1&&(d+="[backgroundColor="+e.style.backgroundColor.replace(/ /g,"")+"]"),ce.call(r,s.colour)>-1&&(d+="[color="+e.style.color.replace(/ /g,"")+"]"),ce.call(r,s.fontFamily)>-1&&(d+="[fontFamily="+e.style.fontFamily.replace(/ /g,"")+"]"),ce.call(r,s.fontSize)>-1&&(d+="[fontSize="+e.style.fontSize+"]")))),d}function C(e){var t=e.nodeType;return t===M||t===z?e.childNodes.length:e.length||0}function _(e){var t=e.parentNode;return t&&t.removeChild(e),e}function S(e,t){var n=e.parentNode;n&&n.replaceChild(t,e)}function y(e){for(var t=e.ownerDocument.createDocumentFragment(),n=e.childNodes,o=n?n.length:0;o--;)t.appendChild(e.firstChild);return t}function T(e,n,o,i){var r,a,s,d=e.createElement(n);if(o instanceof Array&&(i=o,o=null),o)for(r in o)o[r]!==t&&d.setAttribute(r,o[r]);if(i)for(a=0,s=i.length;as?t.startOffset-=1:t.startOffset===s&&(t.startContainer=o,t.startOffset=C(o))),t.endContainer===e&&(t.endOffset>s?t.endOffset-=1:t.endOffset===s&&(t.endContainer=o,t.endOffset=C(o))),_(n),n.nodeType===H?o.appendData(n.data):d.push(y(n));else if(n.nodeType===M){for(i=d.length;i--;)n.appendChild(d.pop());k(n,t)}}function L(e,t){if(e.nodeType===H&&(e=e.parentNode),e.nodeType===M){var n={startContainer:t.startContainer,startOffset:t.startOffset,endContainer:t.endContainer,endOffset:t.endOffset};k(e,n),t.setStart(n.startContainer,n.startOffset),t.setEnd(n.endContainer,n.endOffset)}}function A(e){var t=e.nodeName;return"TD"===t||"TH"===t||"TR"===t||"TBODY"===t||"THEAD"===t}function O(e,t,n,o){var i,r,a,s=t;if(!A(e)||!A(t)){for(;(i=s.parentNode)&&i!==o&&i.nodeType===M&&1===i.childNodes.length;)s=i;_(s),a=e.childNodes.length,r=e.lastChild,r&&"BR"===r.nodeName&&(e.removeChild(r),a-=1),e.appendChild(y(t)),n.setStart(e,a),n.collapse(!0),L(e,n),J&&(r=e.lastChild)&&"BR"===r.nodeName&&e.removeChild(r)}}function B(e,t){var n,o,i=e.previousSibling,r=e.firstChild,a=e.ownerDocument,s="LI"===e.nodeName;if((!s||r&&/^[OU]L$/.test(r.nodeName))&&!A(e))if(i&&f(i,e)){if(!d(i)){if(!s)return;o=T(a,"DIV"),o.appendChild(y(i)),i.appendChild(o)}_(e),n=!d(e),i.appendChild(y(e)),n&&b(i,t),r&&B(r,t)}else s&&(i=T(a,"DIV"),e.insertBefore(i,r),E(i,t))}function D(e){this.isShiftDown=e.shiftKey}function R(e,t,n){var o,i;if(e||(e={}),t)for(o in t)!n&&o in e||(i=t[o],e[o]=i&&i.constructor===Object?R(e[o],i,n):i);return e}function P(e,t){e.nodeType===W&&(e=e.body);var n,o=e.ownerDocument,i=o.defaultView;this._win=i,this._doc=o,this._root=e,this._events={},this._isFocused=!1,this._lastSelection=null,ae&&this.addEventListener("beforedeactivate",this.getSelection),this._hasZWS=!1,this._lastAnchorNode=null,this._lastFocusNode=null,this._path="",this._willUpdatePath=!1,"onselectionchange"in o?this.addEventListener("selectionchange",this._updatePathOnEvent):(this.addEventListener("keyup",this._updatePathOnEvent),this.addEventListener("mouseup",this._updatePathOnEvent)),this._undoIndex=-1,this._undoStack=[],this._undoStackLength=0,this._isInUndoState=!1,this._ignoreChange=!1,this._ignoreAllChanges=!1,se?(n=new MutationObserver(this._docWasChanged.bind(this)),n.observe(e,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),this._mutation=n):this.addEventListener("keyup",this._keyUpDetectChange),this._restoreSelection=!1,this.addEventListener("blur",U),this.addEventListener("mousedown",I),this.addEventListener("touchstart",I),this.addEventListener("focus",w),this._awaitingPaste=!1,this.addEventListener(X?"beforecut":"cut",tt),this.addEventListener("copy",nt),this.addEventListener("keydown",D),this.addEventListener("keyup",D),this.addEventListener(X?"beforepaste":"paste",ot),this.addEventListener("drop",it),this.addEventListener(J?"keypress":"keydown",Ie),this._keyHandlers=Object.create(He),this.setConfig(t),X&&(i.Text.prototype.splitText=function(e){var t=this.ownerDocument.createTextNode(this.data.slice(e)),n=this.nextSibling,o=this.parentNode,i=this.length-e;return n?o.insertBefore(t,n):o.appendChild(t),i&&this.deleteData(e,i),t}),e.setAttribute("contenteditable","true");try{o.execCommand("enableObjectResizing",!1,"false"),o.execCommand("enableInlineTableEditing",!1,"false")}catch(e){}e.__squire__=this,this.setHTML("")}function U(){this._restoreSelection=!0}function I(){this._restoreSelection=!1}function w(){this._restoreSelection&&this.setSelection(this._lastSelection)}function F(e,t,n){var o,i;for(o=t.firstChild;o;o=i){if(i=o.nextSibling,a(o)){if(o.nodeType===H||"BR"===o.nodeName||"IMG"===o.nodeName){n.appendChild(o);continue}}else if(s(o)){n.appendChild(e.createDefaultBlock([F(e,o,e._doc.createDocumentFragment())]));continue}F(e,o,n)}return n}var M=1,H=3,W=9,z=11,q=1,K="​",G=e.defaultView,Z=navigator.userAgent,j=/Android/.test(Z),Q=/iP(?:ad|hone|od)/.test(Z),$=/Mac OS X/.test(Z),V=/Windows NT/.test(Z),Y=/Gecko\//.test(Z),X=/Trident\/[456]\./.test(Z),J=!!G.opera,ee=/Edge\//.test(Z),te=!ee&&/WebKit\//.test(Z),ne=/Trident\/[4567]\./.test(Z),oe=$?"meta-":"ctrl-",ie=X||J,re=X||te,ae=X,se="undefined"!=typeof MutationObserver,de="undefined"!=typeof WeakMap,le=/[^ \t\r\n]/,ce=Array.prototype.indexOf;Object.create||(Object.create=function(e){var t=function(){};return t.prototype=e,new t});var he={1:1,2:2,3:4,8:128,9:256,11:1024},ue=function(){return!0};n.prototype.nextNode=function(){for(var e,t=this.currentNode,n=this.root,o=this.nodeType,i=this.filter;;){for(e=t.firstChild;!e&&t&&t!==n;)(e=t.nextSibling)||(t=t.parentNode);if(!e)return null;if(he[e.nodeType]&o&&i(e))return this.currentNode=e,e;t=e}},n.prototype.previousNode=function(){for(var e,t=this.currentNode,n=this.root,o=this.nodeType,i=this.filter;;){if(t===n)return null;if(e=t.previousSibling)for(;t=e.lastChild;)e=t;else e=t.parentNode;if(!e)return null;if(he[e.nodeType]&o&&i(e))return this.currentNode=e,e;t=e}},n.prototype.previousPONode=function(){for(var e,t=this.currentNode,n=this.root,o=this.nodeType,i=this.filter;;){for(e=t.lastChild;!e&&t&&t!==n;)(e=t.previousSibling)||(t=t.parentNode);if(!e)return null;if(he[e.nodeType]&o&&i(e))return this.currentNode=e,e;t=e}};var fe=/^(?:#text|A(?:BBR|CRONYM)?|B(?:R|D[IO])?|C(?:ITE|ODE)|D(?:ATA|EL|FN)|EM|FONT|I(?:FRAME|MG|NPUT|NS)?|KBD|Q|R(?:P|T|UBY)|S(?:AMP|MALL|PAN|TR(?:IKE|ONG)|U[BP])?|TIME|U|VAR|WBR)$/,pe={BR:1,HR:1,IFRAME:1,IMG:1,INPUT:1},ge=0,me=1,ve=2,Ne=3,Ce=de?new WeakMap:null,_e=function(e,t){for(var n=e.childNodes;t&&e.nodeType===M;)e=n[t-1],n=e.childNodes,t=n.length;return e},Se=function(e,t){if(e.nodeType===M){var n=e.childNodes;if(t-1,r=e.compareBoundaryPoints(1,o)<1;return!i&&!r}var a=e.compareBoundaryPoints(0,o)<1,s=e.compareBoundaryPoints(2,o)>-1;return a&&s},ke=function(e){for(var t,n=e.startContainer,o=e.startOffset,r=e.endContainer,a=e.endOffset,s=!0;n.nodeType!==H&&(t=n.childNodes[o])&&!i(t);)n=t,o=0;if(a)for(;r.nodeType!==H;){if(!(t=r.childNodes[a-1])||i(t)){if(s&&t&&"BR"===t.nodeName){a-=1,s=!1;continue}break}r=t,a=C(r)}else for(;r.nodeType!==H&&(t=r.firstChild)&&!i(t);)r=t;e.collapsed?(e.setStart(r,a),e.setEnd(n,o)):(e.setStart(n,o),e.setEnd(r,a))},Le=function(e,t,n,o){var i,r=e.startContainer,a=e.startOffset,s=e.endContainer,d=e.endOffset,l=!0;for(t||(t=e.commonAncestorContainer),n||(n=t);!a&&r!==t&&r!==o;)i=r.parentNode,a=ce.call(i.childNodes,r),r=i;for(;;){if(l&&s.nodeType!==H&&s.childNodes[d]&&"BR"===s.childNodes[d].nodeName&&(d+=1,l=!1),s===n||s===o||d!==C(s))break;i=s.parentNode,d=ce.call(i.childNodes,s)+1,s=i}e.setStart(r,a),e.setEnd(s,d)},Ae=function(e,t){var n,o=e.startContainer;return a(o)?n=c(o,t):o!==t&&s(o)?n=o:(n=_e(o,e.startOffset),n=h(n,t)),n&&xe(e,n,!0)?n:null},Oe=function(e,t){var n,o,i=e.endContainer;if(a(i))n=c(i,t);else if(i!==t&&s(i))n=i;else{if(!(n=Se(i,e.endOffset))||!v(t,n))for(n=t;o=n.lastChild;)n=o;n=c(n,t)}return n&&xe(e,n,!0)?n:null},Be=new n(null,4|q,function(e){return e.nodeType===H?le.test(e.data):"IMG"===e.nodeName}),De=function(e,t){var n,o=e.startContainer,i=e.startOffset;if(Be.root=null,o.nodeType===H){if(i)return!1;n=o}else if(n=Se(o,i),n&&!v(t,n)&&(n=null),!n&&(n=_e(o,i),n.nodeType===H&&n.length))return!1;return Be.currentNode=n,Be.root=Ae(e,t),!Be.previousNode()},Re=function(e,t){var n,o=e.endContainer,i=e.endOffset;if(Be.root=null,o.nodeType===H){if((n=o.data.length)&&i-1||!Y&&ce.call(i,"text/plain")>-1&&ce.call(i,"text/rtf")<0))return e.preventDefault(),void(!d&&(r=a.getData("text/html"))?this.insertHTML(r,!0):((r=a.getData("text/plain"))||(r=a.getData("text/uri-list")))&&this.insertPlainText(r,!0));this._awaitingPaste=!0;var f=this._doc.body,p=this.getSelection(),g=p.startContainer,m=p.startOffset,v=p.endContainer,N=p.endOffset,C=this.createElement("DIV",{contenteditable:"true",style:"position:fixed; overflow:hidden; top:0; right:100%; width:1px; height:1px;"});f.appendChild(C),p.selectNodeContents(C),this.setSelection(p),setTimeout(function(){try{u._awaitingPaste=!1;for(var e,t,n="",o=C;C=o;)o=C.nextSibling,_(C),e=C.firstChild,e&&e===C.lastChild&&"DIV"===e.nodeName&&(C=e),n+=C.innerHTML;t=u.createRange(g,m,v,N),u.setSelection(t),n&&u.insertHTML(n,!0)}catch(e){u.didError(e)}},0)},it=function(e){for(var t=e.dataTransfer.types,n=t.length,o=!1,i=!1;n--;)switch(t[n]){case"text/plain":o=!0;break;case"text/html":i=!0;break;default:return}(i||o)&&this.saveUndoState()},rt=P.prototype,at=function(e,t,n){var o=n._doc,i=e?DOMPurify.sanitize(e,{ALLOW_UNKNOWN_PROTOCOLS:!0,WHOLE_DOCUMENT:!1,RETURN_DOM:!0,RETURN_DOM_FRAGMENT:!0}):null;return i?o.importNode(i,!0):o.createDocumentFragment()};rt.setConfig=function(e){return e=R({blockTag:"DIV",blockAttributes:null,tagAttributes:{blockquote:null,ul:null,ol:null,li:null,a:null},classNames:{colour:"colour",fontFamily:"font",fontSize:"size",highlight:"highlight"},leafNodeNames:pe,undo:{documentSizeThreshold:-1,undoLimit:-1},isInsertedHTMLSanitized:!0,isSetHTMLSanitized:!0,sanitizeToDOMFragment:"undefined"!=typeof DOMPurify&&DOMPurify.isSupported?at:null,willCutCopy:null},e,!0),e.blockTag=e.blockTag.toUpperCase(),this._config=e,this},rt.createElement=function(e,t,n){return T(this._doc,e,t,n)},rt.createDefaultBlock=function(e){var t=this._config;return E(this.createElement(t.blockTag,t.blockAttributes,e),this._root)},rt.didError=function(e){console.log(e)},rt.getDocument=function(){return this._doc},rt.getRoot=function(){return this._root},rt.modifyDocument=function(e){var t=this._mutation;t&&(t.takeRecords().length&&this._docWasChanged(),t.disconnect()),this._ignoreAllChanges=!0,e(),this._ignoreAllChanges=!1,t&&(t.observe(this._root,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),this._ignoreChange=!1)};var st={pathChange:1,select:1,input:1,undoStateChange:1};rt.fireEvent=function(e,t){var n,o,i,r=this._events[e];if(/^(?:focus|blur)/.test(e))if(n=this._root===this._doc.activeElement,"focus"===e){if(!n||this._isFocused)return this;this._isFocused=!0}else{if(n||!this._isFocused)return this;this._isFocused=!1}if(r)for(t||(t={}),t.type!==e&&(t.type=e),r=r.slice(),o=r.length;o--;){i=r[o];try{i.handleEvent?i.handleEvent(t):i.call(this,t)}catch(t){t.details="Squire: fireEvent error. Event type: "+e,this.didError(t)}}return this},rt.destroy=function(){var e,t=this._events;for(e in t)this.removeEventListener(e);this._mutation&&this._mutation.disconnect(),delete this._root.__squire__,this._undoIndex=-1,this._undoStack=[],this._undoStackLength=0},rt.handleEvent=function(e){this.fireEvent(e.type,e)},rt.addEventListener=function(e,t){var n=this._events[e],o=this._root;return t?(n||(n=this._events[e]=[],st[e]||("selectionchange"===e&&(o=this._doc),o.addEventListener(e,this,!0))),n.push(t),this):(this.didError({name:"Squire: addEventListener with null or undefined fn",message:"Event type: "+e}),this)},rt.removeEventListener=function(e,t){var n,o=this._events[e],i=this._root;if(o){if(t)for(n=o.length;n--;)o[n]===t&&o.splice(n,1);else o.length=0;o.length||(delete this._events[e],st[e]||("selectionchange"===e&&(i=this._doc),i.removeEventListener(e,this,!0)))}return this},rt.createRange=function(e,t,n,o){if(e instanceof this._win.Range)return e.cloneRange();var i=this._doc.createRange();return i.setStart(e,t),n?i.setEnd(n,o):i.setEnd(e,t),i},rt.getCursorPosition=function(e){if(!e&&!(e=this.getSelection())||!e.getBoundingClientRect)return null;var t,n,o=e.getBoundingClientRect();return o&&!o.top&&(this._ignoreChange=!0,t=this._doc.createElement("SPAN"),t.textContent=K,ye(e,t),o=t.getBoundingClientRect(),n=t.parentNode,n.removeChild(t),L(n,e)),o},rt._moveCursorTo=function(e){var t=this._root,n=this.createRange(t,e?0:t.childNodes.length);return ke(n),this.setSelection(n),this},rt.moveCursorToStart=function(){return this._moveCursorTo(!0)},rt.moveCursorToEnd=function(){return this._moveCursorTo(!1)};var dt=function(e){return e._win.getSelection()||null};rt.setSelection=function(e){if(e)if(this._lastSelection=e,this._isFocused)if(j&&!this._restoreSelection)U.call(this),this.blur(),this.focus();else{Q&&this._win.focus();var t=dt(this);t&&(t.removeAllRanges(),t.addRange(e))}else U.call(this);return this},rt.getSelection=function(){var e,t,n,o,r=dt(this),a=this._root;return this._isFocused&&r&&r.rangeCount&&(e=r.getRangeAt(0).cloneRange(),t=e.startContainer,n=e.endContainer,t&&i(t)&&e.setStartBefore(t),n&&i(n)&&e.setEndBefore(n)),e&&v(a,e.commonAncestorContainer)?this._lastSelection=e:(e=this._lastSelection,o=e.commonAncestorContainer,v(o.ownerDocument,o)||(e=null)),e||(e=this.createRange(a.firstChild,0)),e},rt.getSelectedText=function(){var e=this.getSelection();if(!e||e.collapsed)return"";var t,o=new n(e.commonAncestorContainer,4|q,function(t){return xe(e,t,!0)}),i=e.startContainer,r=e.endContainer,s=o.currentNode=i,d="",l=!1;for(o.filter(s)||(s=o.nextNode());s;)s.nodeType===H?(t=s.data)&&/\S/.test(t)&&(s===r&&(t=t.slice(0,e.endOffset)),s===i&&(t=t.slice(e.startOffset)),d+=t,l=!0):("BR"===s.nodeName||l&&!a(s))&&(d+="\n",l=!1),s=o.nextNode();return d},rt.getPath=function(){return this._path};var lt=function(e,t){for(var o,i,r,s=new n(e,4);i=s.nextNode();)for(;(r=i.data.indexOf(K))>-1&&(!t||i.parentNode!==t);){if(1===i.length){do{o=i.parentNode,o.removeChild(i),i=o,s.currentNode=o}while(a(i)&&!C(i));break}i.deleteData(r,1)}};rt._didAddZWS=function(){this._hasZWS=!0},rt._removeZWS=function(){this._hasZWS&&(lt(this._root),this._hasZWS=!1)},rt._updatePath=function(e,t){if(e){var n,o=e.startContainer,i=e.endContainer;(t||o!==this._lastAnchorNode||i!==this._lastFocusNode)&&(this._lastAnchorNode=o,this._lastFocusNode=i,n=o&&i?o===i?N(i,this._root,this._config):"(selection)":"",this._path!==n&&(this._path=n,this.fireEvent("pathChange",{path:n}))),this.fireEvent(e.collapsed?"cursor":"select",{range:e})}},rt._updatePathOnEvent=function(e){var t=this;t._isFocused&&!t._willUpdatePath&&(t._willUpdatePath=!0,setTimeout(function(){t._willUpdatePath=!1,t._updatePath(t.getSelection())},0))}, +rt.focus=function(){return this._root.focus(),ne&&this.fireEvent("focus"),this},rt.blur=function(){return this._root.blur(),ne&&this.fireEvent("blur"),this};var ct="squire-selection-end";rt._saveRangeToBookmark=function(e){var t,n=this.createElement("INPUT",{id:"squire-selection-start",type:"hidden"}),o=this.createElement("INPUT",{id:ct,type:"hidden"});ye(e,n),e.collapse(!1),ye(e,o),2&n.compareDocumentPosition(o)&&(n.id=ct,o.id="squire-selection-start",t=n,n=o,o=t),e.setStartAfter(n),e.setEndBefore(o)},rt._getRangeAndRemoveBookmark=function(e){var t=this._root,n=t.querySelector("#squire-selection-start"),o=t.querySelector("#"+ct);if(n&&o){var i=n.parentNode,r=o.parentNode,a=ce.call(i.childNodes,n),s=ce.call(r.childNodes,o);i===r&&(s-=1),_(n),_(o),e||(e=this._doc.createRange()),e.setStart(i,a),e.setEnd(r,s),L(i,e),i!==r&&L(r,e),e.collapsed&&(i=e.startContainer,i.nodeType===H&&(r=i.childNodes[e.startOffset],r&&r.nodeType===H||(r=i.childNodes[e.startOffset-1]),r&&r.nodeType===H&&(e.setStart(r,0),e.collapse(!0))))}return e||null},rt._keyUpDetectChange=function(e){var t=e.keyCode;e.ctrlKey||e.metaKey||e.altKey||!(t<16||t>20)||!(t<33||t>45)||this._docWasChanged()},rt._docWasChanged=function(){if(de&&(Ce=new WeakMap),!this._ignoreAllChanges){if(se&&this._ignoreChange)return void(this._ignoreChange=!1);this._isInUndoState&&(this._isInUndoState=!1,this.fireEvent("undoStateChange",{canUndo:!0,canRedo:!1})),this.fireEvent("input")}},rt._recordUndoState=function(e,t){if(!this._isInUndoState||t){var n,o=this._undoIndex,i=this._undoStack,r=this._config.undo,a=r.documentSizeThreshold,s=r.undoLimit;t||(o+=1),o-1&&2*n.length>a&&s>-1&&o>s&&(i.splice(0,o-s),o=s,this._undoStackLength=s),i[o]=n,this._undoIndex=o,this._undoStackLength+=1,this._isInUndoState=!0}},rt.saveUndoState=function(e){return e===t&&(e=this.getSelection()),this._recordUndoState(e,this._isInUndoState),this._getRangeAndRemoveBookmark(e),this},rt.undo=function(){if(0!==this._undoIndex||!this._isInUndoState){this._recordUndoState(this.getSelection(),!1),this._undoIndex-=1,this._setHTML(this._undoStack[this._undoIndex]);var e=this._getRangeAndRemoveBookmark();e&&this.setSelection(e),this._isInUndoState=!0,this.fireEvent("undoStateChange",{canUndo:0!==this._undoIndex,canRedo:!0}),this.fireEvent("input")}return this},rt.redo=function(){var e=this._undoIndex,t=this._undoStackLength;if(e+1c&&h.splitText(c),h===s&&l&&(h=h.splitText(l),d===s&&(d=h,c-=l),s=h,l=0),i=this.createElement(e,t),S(h,i),i.appendChild(h))}while(r.nextNode());d.nodeType!==H&&(h.nodeType===H?(d=h,c=h.length):(d=h.parentNode,c=1)),o=this.createRange(s,l,d,c)}return o},rt._removeFormat=function(e,t,n,o){this._saveRangeToBookmark(n);var i,r=this._doc;n.collapsed&&(re?(i=r.createTextNode(K),this._didAddZWS()):i=r.createTextNode(""),ye(n,i));for(var s=n.commonAncestorContainer;a(s);)s=s.parentNode;var d=n.startContainer,l=n.startOffset,c=n.endContainer,h=n.endOffset,u=[],f=function(e,t){if(!xe(n,e,!1)){var o,i,r=e.nodeType===H;if(!xe(n,e,!0))return void("INPUT"===e.nodeName||r&&!e.data||u.push([t,e]));if(r)e===c&&h!==e.length&&u.push([t,e.splitText(h)]),e===d&&l&&(e.splitText(l),u.push([t,e]));else for(o=e.firstChild;o;o=i)i=o.nextSibling,f(o,t)}},g=Array.prototype.filter.call(s.getElementsByTagName(e),function(o){return xe(n,o,!0)&&p(o,e,t)});return o||g.forEach(function(e){f(e,e)}),u.forEach(function(e){var t=e[0].cloneNode(!1),n=e[1];S(n,t),t.appendChild(n)}),g.forEach(function(e){S(e,y(e))}),this._getRangeAndRemoveBookmark(n),i&&n.collapse(!1),L(s,n),n},rt.changeFormat=function(e,t,n,o){return n||(n=this.getSelection())?(this.saveUndoState(n),t&&(n=this._removeFormat(t.tag.toUpperCase(),t.attributes||{},n,o)),e&&(n=this._addFormat(e.tag.toUpperCase(),e.attributes||{},n)),this.setSelection(n),this._updatePath(n,!0),se||this._docWasChanged(),this):this};var ht={DT:"DD",DD:"DT",LI:"LI",PRE:"PRE"},ut=function(e,t,n,o){var i=ht[t.nodeName],r=null,a=x(n,o,t.parentNode,e._root),s=e._config;return i||(i=s.blockTag,r=s.blockAttributes),p(a,i,r)||(t=T(a.ownerDocument,i,r),a.dir&&(t.dir=a.dir),S(a,t),t.appendChild(y(a)),a=t),a};rt.forEachBlock=function(e,t,n){if(!n&&!(n=this.getSelection()))return this;t&&this.saveUndoState(n);var o=this._root,i=Ae(n,o),r=Oe(n,o);if(i&&r)do{if(e(i)||i===r)break}while(i=h(i,o));return t&&(this.setSelection(n),this._updatePath(n,!0),se||this._docWasChanged()),this},rt.modifyBlocks=function(e,t){if(!t&&!(t=this.getSelection()))return this;this._recordUndoState(t,this._isInUndoState);var n,o=this._root;return Pe(t,o),Le(t,o,o,o),n=Te(t,o,o),ye(t,e.call(this,n)),t.endOffset]+|\([^\s()<>]+\))+(?:\((?:[^\s()<>]+|(?:\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))|([\w\-.%+]+@(?:[\w\-]+\.)+[A-Z]{2,}\b)(?:\?[^&?\s]+=[^&?\s]+(?:&[^&?\s]+=[^&?\s]+)*)?/i;var St=function(e,t,o){var i,r,a,s,d,l,c,h=e.ownerDocument,u=new n(e,4,function(e){return!g(e,t,"A")}),f=o.linkRegExp,p=o._config.tagAttributes.a;if(f)for(;i=u.nextNode();)for(r=i.data,a=i.parentNode;s=f.exec(r);)d=s.index,l=d+s[0].length,d&&(c=h.createTextNode(r.slice(0,d)),a.insertBefore(c,i)),c=o.createElement("A",R({href:s[1]?/^(?:ht|f)tps?:/i.test(s[1])?s[1]:"http://"+s[1]:"mailto:"+s[0]},p,!1)),c.textContent=r.slice(d,l),a.insertBefore(c,i),i.data=r=r.slice(l)};rt.insertHTML=function(e,t){var n,o,i,r,a,s,d,l=this._config,c=l.isInsertedHTMLSanitized?l.sanitizeToDOMFragment:null,u=this.getSelection(),f=this._doc;"function"==typeof c?r=c(e,t,this):(t&&(n=e.indexOf("\x3c!--StartFragment--\x3e"),o=e.lastIndexOf("\x3c!--EndFragment--\x3e"),n>-1&&o>-1&&(e=e.slice(n+20,o))),/<\/td>((?!<\/tr>)[\s\S])*$/i.test(e)&&(e=""+e+""),/<\/tr>((?!<\/table>)[\s\S])*$/i.test(e)&&(e=""+e+"
    "),i=this.createElement("DIV"),i.innerHTML=e,r=f.createDocumentFragment(),r.appendChild(y(i))),this.saveUndoState(u);try{for(a=this._root,s=r,d={fragment:r,preventDefault:function(){this.defaultPrevented=!0},defaultPrevented:!1},St(r,r,this),$e(r,l),Je(r,a,!1),Ve(r),r.normalize();s=h(s,r);)E(s,a);t&&this.fireEvent("willPaste",d),d.defaultPrevented||(be(u,d.fragment,a),se||this._docWasChanged(),u.collapse(!1),this._ensureBottomLine()),this.setSelection(u),this._updatePath(u,!0),t&&this.focus()}catch(e){this.didError(e)}return this};var yt=function(e){return e.split("&").join("&").split("<").join("<").split(">").join(">").split('"').join(""")};rt.insertPlainText=function(e,t){var n=this.getSelection();if(n.collapsed&&g(n.startContainer,this._root,"PRE")){var o,i,r=n.startContainer,a=n.startOffset;return r&&r.nodeType===H||(o=this._doc.createTextNode(""),r.insertBefore(o,r.childNodes[a]),r=o,a=0),i={text:e,preventDefault:function(){this.defaultPrevented=!0},defaultPrevented:!1},t&&this.fireEvent("willPaste",i),i.defaultPrevented||(e=i.text,r.insertData(a,e),n.setStart(r,a+e.length),n.collapse(!0)),this.setSelection(n),this}var s,d,l,c,h=e.split("\n"),u=this._config,f=u.blockTag,p=u.blockAttributes,m="",v="<"+f;for(s in p)v+=" "+s+'="'+yt(p[s])+'"';for(v+=">",d=0,l=h.length;d")+m;return this.insertHTML(h.join(""),t)};var Tt=function(e,t,n){return function(){return this[e](t,n),this.focus()}};rt.addStyles=function(e){if(e){var t=this._doc.documentElement.firstChild,n=this.createElement("STYLE",{type:"text/css"});n.appendChild(this._doc.createTextNode(e)),t.appendChild(n)}return this},rt.bold=Tt("changeFormat",{tag:"B"}),rt.italic=Tt("changeFormat",{tag:"I"}),rt.underline=Tt("changeFormat",{tag:"U"}),rt.strikethrough=Tt("changeFormat",{tag:"S"}),rt.subscript=Tt("changeFormat",{tag:"SUB"},{tag:"SUP"}),rt.superscript=Tt("changeFormat",{tag:"SUP"},{tag:"SUB"}),rt.removeBold=Tt("changeFormat",null,{tag:"B"}),rt.removeItalic=Tt("changeFormat",null,{tag:"I"}),rt.removeUnderline=Tt("changeFormat",null,{tag:"U"}),rt.removeStrikethrough=Tt("changeFormat",null,{tag:"S"}),rt.removeSubscript=Tt("changeFormat",null,{tag:"SUB"}),rt.removeSuperscript=Tt("changeFormat",null,{tag:"SUP"}),rt.makeLink=function(e,t){var n=this.getSelection();if(n.collapsed){var o=e.indexOf(":")+1;if(o)for(;"/"===e[o];)o+=1;ye(n,this._doc.createTextNode(e.slice(o)))}return t=R(R({href:e},t,!0),this._config.tagAttributes.a,!1),this.changeFormat({tag:"A",attributes:t},{tag:"A"},n),this.focus()},rt.removeLink=function(){return this.changeFormat(null,{tag:"A"},this.getSelection(),!0),this.focus()},rt.setFontFace=function(e){var t=this._config.classNames.fontFamily;return this.changeFormat(e?{tag:"SPAN",attributes:{class:t,style:"font-family: "+e+", sans-serif;"}}:null,{tag:"SPAN",attributes:{class:t}}),this.focus()},rt.setFontSize=function(e){var t=this._config.classNames.fontSize;return this.changeFormat(e?{tag:"SPAN",attributes:{class:t,style:"font-size: "+("number"==typeof e?e+"px":e)}}:null,{tag:"SPAN",attributes:{class:t}}),this.focus()},rt.setTextColour=function(e){var t=this._config.classNames.colour;return this.changeFormat(e?{tag:"SPAN",attributes:{class:t,style:"color:"+e}}:null,{tag:"SPAN",attributes:{class:t}}),this.focus()},rt.setHighlightColour=function(e){var t=this._config.classNames.highlight;return this.changeFormat(e?{tag:"SPAN",attributes:{class:t,style:"background-color:"+e}}:e,{tag:"SPAN",attributes:{class:t}}),this.focus()},rt.setTextAlignment=function(e){return this.forEachBlock(function(t){var n=t.className.split(/\s+/).filter(function(e){return!!e&&!/^align/.test(e)}).join(" ");e?(t.className=n+" align-"+e,t.style.textAlign=e):(t.className=n,t.style.textAlign="")},!0),this.focus()},rt.setTextDirection=function(e){return this.forEachBlock(function(t){e?t.dir=e:t.removeAttribute("dir")},!0),this.focus()};var Et=function(e){for(var t,o=this._root,i=this._doc,r=i.createDocumentFragment(),a=l(e,o);t=a.nextNode();){var s,d,c=t.querySelectorAll("BR"),h=[],u=c.length;for(s=0;s-1;)a.appendChild(d.createTextNode(r.slice(0,s))),a.appendChild(d.createElement("BR")),r=r.slice(s+1);i.parentNode.insertBefore(a,i),i.data=r}b(t,l),S(t,y(t))}return e};rt.code=function(){var e=this.getSelection();return e.collapsed||d(e.commonAncestorContainer)?this.modifyBlocks(Et,e):this.changeFormat({tag:"CODE",attributes:this._config.tagAttributes.code},null,e),this.focus()},rt.removeCode=function(){var e=this.getSelection();return g(e.commonAncestorContainer,this._root,"PRE")?this.modifyBlocks(bt,e):this.changeFormat(null,{tag:"CODE"},e),this.focus()},rt.toggleCode=function(){return this.hasFormat("PRE")||this.hasFormat("CODE")?this.removeCode():this.code(),this},rt.removeAllFormatting=function(e){if(!e&&!(e=this.getSelection())||e.collapsed)return this;for(var t=this._root,n=e.commonAncestorContainer;n&&!s(n);)n=n.parentNode;if(n||(Pe(e,t),n=t),n.nodeType===H)return this;this.saveUndoState(e),Le(e,n,n,t);for(var o,i,r=n.ownerDocument,a=e.startContainer,d=e.startOffset,l=e.endContainer,c=e.endOffset,h=r.createDocumentFragment(),u=r.createDocumentFragment(),f=x(l,c,n,t),p=x(a,d,n,t);p!==f;)o=p.nextSibling,h.appendChild(p),p=o;return F(this,h,u),u.normalize(),p=u.firstChild,o=u.lastChild,i=n.childNodes,p?(n.insertBefore(u,f),d=ce.call(i,p),c=ce.call(i,o)+1):(d=ce.call(i,f),c=d),e.setStart(n,d),e.setEnd(n,c),L(n,e),ke(e),this.setSelection(e),this._updatePath(e,!0),this.focus()},rt.increaseQuoteLevel=Tt("modifyBlocks",ft),rt.decreaseQuoteLevel=Tt("modifyBlocks",pt),rt.makeUnorderedList=Tt("modifyBlocks",vt),rt.makeOrderedList=Tt("modifyBlocks",Nt),rt.removeList=Tt("modifyBlocks",Ct),P.isInline=a,P.isBlock=s,P.isContainer=d,P.getBlockWalker=l,P.getPreviousBlock=c,P.getNextBlock=h,P.areAlike=f,P.hasTagAttributes=p,P.getNearest=g,P.isOrContains=v,P.detach=_,P.replaceWith=S,P.empty=y,P.getNodeBefore=_e,P.getNodeAfter=Se,P.insertNodeInRange=ye,P.extractContentsOfRange=Te,P.deleteContentsOfRange=Ee,P.insertTreeFragmentIntoRange=be,P.isNodeContainedInRange=xe,P.moveRangeBoundariesDownTree=ke,P.moveRangeBoundariesUpTree=Le,P.getStartBlockOfRange=Ae,P.getEndBlockOfRange=Oe,P.contentWalker=Be,P.rangeDoesStartAtBlockBoundary=De,P.rangeDoesEndAtBlockBoundary=Re,P.expandRangeToBlockBoundaries=Pe,P.onPaste=ot,P.addLinks=St,P.splitBlock=ut,P.startSelectionId="squire-selection-start",P.endSelectionId=ct,"object"==typeof exports?module.exports=P:"function"==typeof define&&define.amd?define(function(){return P}):(G.Squire=P,top!==G&&"true"===e.documentElement.getAttribute("data-squireinit")&&(G.editor=new P(e),G.onEditorLoad&&(G.onEditorLoad(G.editor),G.onEditorLoad=null)))}(document); \ No newline at end of file diff --git a/modules/blogging/app/Volo.BloggingTestApp/yarn.lock b/modules/blogging/app/Volo.BloggingTestApp/yarn.lock index 6f0078f2c9..13a712e13c 100644 --- a/modules/blogging/app/Volo.BloggingTestApp/yarn.lock +++ b/modules/blogging/app/Volo.BloggingTestApp/yarn.lock @@ -2213,9 +2213,9 @@ pumpify@^1.3.5: inherits "^2.0.3" pump "^2.0.0" -"raphael@git+https://github.com/nhn/raphael.git#2.2.0-c": +"raphael@https://github.com/nhn/raphael.git#2.2.0-c": version "2.2.0-c" - resolved "git+https://github.com/nhn/raphael.git#78a6ed3ec269f33b6457b0ec66f8c3d1f2ed70e0" + resolved "https://github.com/nhn/raphael.git#78a6ed3ec269f33b6457b0ec66f8c3d1f2ed70e0" dependencies: eve "git://github.com/adobe-webplatform/eve.git#eef80ed" diff --git a/modules/blogging/app/update-database.ps1 b/modules/blogging/app/update-database.ps1 new file mode 100644 index 0000000000..39297dd2c9 --- /dev/null +++ b/modules/blogging/app/update-database.ps1 @@ -0,0 +1 @@ +dotnet ef database update -s Volo.BloggingTestApp/Volo.BloggingTestApp.csproj -p Volo.BloggingTestApp.EntityFrameworkCore/Volo.BloggingTestApp.EntityFrameworkCore.csproj \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/FodyWeavers.xml b/modules/blogging/src/Volo.Blogging.Application.Contracts/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/FodyWeavers.xsd b/modules/blogging/src/Volo.Blogging.Application.Contracts/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo.Blogging.Application.Contracts.csproj b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo.Blogging.Application.Contracts.csproj index dccdef1e0d..ba9aa67e7a 100644 --- a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo.Blogging.Application.Contracts.csproj +++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo.Blogging.Application.Contracts.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Localization/Resources/Blogging/ApplicationContracts/zh-Hant.json b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Localization/Resources/Blogging/ApplicationContracts/zh-Hant.json new file mode 100644 index 0000000000..bca246ba43 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/Localization/Resources/Blogging/ApplicationContracts/zh-Hant.json @@ -0,0 +1,14 @@ +{ + "culture": "zh-Hant", + "texts": { + "Permission:Blogging": "部落格", + "Permission:Blogs": "部落格", + "Permission:Posts": "文章", + "Permission:Tags": "標籤", + "Permission:Comments": "評論", + "Permission:Management": "管理", + "Permission:Edit": "標及", + "Permission:Create": "新增", + "Permission:Delete": "刪除" + } + } \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Application/FodyWeavers.xml b/modules/blogging/src/Volo.Blogging.Application/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Application/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Application/FodyWeavers.xsd b/modules/blogging/src/Volo.Blogging.Application/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Application/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo.Blogging.Application.csproj b/modules/blogging/src/Volo.Blogging.Application/Volo.Blogging.Application.csproj index a162d644df..9c4070fe25 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo.Blogging.Application.csproj +++ b/modules/blogging/src/Volo.Blogging.Application/Volo.Blogging.Application.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs index be51085f86..d798814caa 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs @@ -180,14 +180,14 @@ namespace Volo.Blogging.Posts return url; } - private async Task SaveTags(List newTags, Post post) + private async Task SaveTags(ICollection newTags, Post post) { await RemoveOldTags(newTags, post); await AddNewTags(newTags, post); } - private async Task RemoveOldTags(List newTags, Post post) + private async Task RemoveOldTags(ICollection newTags, Post post) { foreach (var oldTag in post.Tags) { @@ -209,7 +209,7 @@ namespace Volo.Blogging.Posts } } - private async Task AddNewTags(List newTags, Post post) + private async Task AddNewTags(IEnumerable newTags, Post post) { var tags = await _tagRepository.GetListAsync(post.BlogId); @@ -219,7 +219,7 @@ namespace Volo.Blogging.Posts if (tag == null) { - tag = await _tagRepository.InsertAsync(new Tag(post.BlogId, newTag, 1)); + tag = await _tagRepository.InsertAsync(new Tag(GuidGenerator.Create(), post.BlogId, newTag, 1)); } else { @@ -249,7 +249,7 @@ namespace Volo.Blogging.Posts return new List(tags.Split(",").Select(t => t.Trim())); } - private Task> FilterPostsByTag(List allPostDtos, Tag tag) + private Task> FilterPostsByTag(IEnumerable allPostDtos, Tag tag) { var filteredPostDtos = allPostDtos.Where(p => p.Tags?.Any(t => t.Id == tag.Id) ?? false).ToList(); diff --git a/modules/blogging/src/Volo.Blogging.Domain.Shared/FodyWeavers.xml b/modules/blogging/src/Volo.Blogging.Domain.Shared/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Domain.Shared/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Domain.Shared/FodyWeavers.xsd b/modules/blogging/src/Volo.Blogging.Domain.Shared/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Domain.Shared/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo.Blogging.Domain.Shared.csproj b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo.Blogging.Domain.Shared.csproj index c71ae5aef5..da706316f9 100644 --- a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo.Blogging.Domain.Shared.csproj +++ b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo.Blogging.Domain.Shared.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Localization/Resources/zh-Hant.json b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Localization/Resources/zh-Hant.json new file mode 100644 index 0000000000..fcafc171de --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Domain.Shared/Volo/Blogging/Localization/Resources/zh-Hant.json @@ -0,0 +1,47 @@ +{ + "culture": "zh-Hant", + "texts": { + "Menu:Blogs": "部落格", + "Menu:BlogManagement": "部落格管理", + "Title": "標題", + "Delete": "刪除", + "Reply": "回覆", + "ReplyTo": "回覆 {0}", + "ContinueReading": "繼續閱讀", + "DaysAgo": "{0}天前", + "YearsAgo": "{0}年前", + "MonthsAgo": "{0}個月前", + "WeeksAgo": "{0}週前", + "MinutesAgo": "{0}分前", + "SecondsAgo": "{0}秒前", + "HoursAgo": "{0}小時前", + "Now": "剛剛", + "Content": "內容", + "SeeAll": "查看所有", + "PopularTags": "熱門標籤", + "WiewsWithCount": "{0}人查看", + "LastPosts": "最後的文章", + "LeaveComment": "發表評論", + "TagsInThisArticle": "文章中的標籤", + "Posts": "文章", + "Edit": "編輯", + "BLOG": "部落格", + "CommentDeletionWarningMessage": "評論將被刪除.", + "PostDeletionWarningMessage": "文章將被刪除.", + "BlogDeletionWarningMessage": "部落格將被刪除.", + "AreYouSure": "您確定嗎?", + "CommentWithCount": "{0}個評論", + "Comment": "評論", + "ShareOnTwitter": "分享到Twitter", + "CoverImage": "封面圖", + "CreateANewPost": "新增一篇文章", + "CreateANewBlog": "新增一個部落格", + "WhatIsNew": "最新消息", + "Name": "名稱", + "ShortName": "簡稱", + "CreationTime": "建立時間", + "Description": "描述", + "Blogs": "部落格", + "Tags": "標籤" + } +} \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Domain/FodyWeavers.xml b/modules/blogging/src/Volo.Blogging.Domain/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Domain/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Domain/FodyWeavers.xsd b/modules/blogging/src/Volo.Blogging.Domain/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Domain/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Domain/Volo.Blogging.Domain.csproj b/modules/blogging/src/Volo.Blogging.Domain/Volo.Blogging.Domain.csproj index b30b54fede..a7cbc2c7c6 100644 --- a/modules/blogging/src/Volo.Blogging.Domain/Volo.Blogging.Domain.csproj +++ b/modules/blogging/src/Volo.Blogging.Domain/Volo.Blogging.Domain.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/Tag.cs b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/Tag.cs index 28d14d885d..fb8f97a4dc 100644 --- a/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/Tag.cs +++ b/modules/blogging/src/Volo.Blogging.Domain/Volo/Blogging/Tagging/Tag.cs @@ -20,8 +20,9 @@ namespace Volo.Blogging.Tagging } - public Tag(Guid blogId, [NotNull] string name, int usageCount = 0, string description = null) + public Tag(Guid id, Guid blogId, [NotNull] string name, int usageCount = 0, string description = null) { + Id = id; Name = Check.NotNullOrWhiteSpace(name, nameof(name)); BlogId = blogId; Description = description; diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/FodyWeavers.xml b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/FodyWeavers.xsd b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo.Blogging.EntityFrameworkCore.csproj b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo.Blogging.EntityFrameworkCore.csproj index 122385c76f..e74e255466 100644 --- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo.Blogging.EntityFrameworkCore.csproj +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo.Blogging.EntityFrameworkCore.csproj @@ -1,9 +1,10 @@ - + + - netstandard2.1 + netstandard2.0 Volo.Blogging.EntityFrameworkCore Volo.Blogging.EntityFrameworkCore diff --git a/modules/blogging/src/Volo.Blogging.HttpApi.Client/FodyWeavers.xml b/modules/blogging/src/Volo.Blogging.HttpApi.Client/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.HttpApi.Client/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.HttpApi.Client/FodyWeavers.xsd b/modules/blogging/src/Volo.Blogging.HttpApi.Client/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.HttpApi.Client/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.HttpApi.Client/Volo.Blogging.HttpApi.Client.csproj b/modules/blogging/src/Volo.Blogging.HttpApi.Client/Volo.Blogging.HttpApi.Client.csproj index 0c688104db..754382f89c 100644 --- a/modules/blogging/src/Volo.Blogging.HttpApi.Client/Volo.Blogging.HttpApi.Client.csproj +++ b/modules/blogging/src/Volo.Blogging.HttpApi.Client/Volo.Blogging.HttpApi.Client.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/blogging/src/Volo.Blogging.HttpApi/FodyWeavers.xml b/modules/blogging/src/Volo.Blogging.HttpApi/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.HttpApi/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.HttpApi/FodyWeavers.xsd b/modules/blogging/src/Volo.Blogging.HttpApi/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.HttpApi/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.HttpApi/Volo.Blogging.HttpApi.csproj b/modules/blogging/src/Volo.Blogging.HttpApi/Volo.Blogging.HttpApi.csproj index 8965b8782e..94181bf3fe 100644 --- a/modules/blogging/src/Volo.Blogging.HttpApi/Volo.Blogging.HttpApi.csproj +++ b/modules/blogging/src/Volo.Blogging.HttpApi/Volo.Blogging.HttpApi.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/FodyWeavers.xml b/modules/blogging/src/Volo.Blogging.MongoDB/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.MongoDB/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/FodyWeavers.xsd b/modules/blogging/src/Volo.Blogging.MongoDB/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.MongoDB/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo.Blogging.MongoDB.csproj b/modules/blogging/src/Volo.Blogging.MongoDB/Volo.Blogging.MongoDB.csproj index 0d299c1f3d..5019b843f2 100644 --- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo.Blogging.MongoDB.csproj +++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo.Blogging.MongoDB.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/blogging/src/Volo.Blogging.Web/BloggingWebModule.cs b/modules/blogging/src/Volo.Blogging.Web/BloggingWebModule.cs index 063ecebf5b..00fa553902 100644 --- a/modules/blogging/src/Volo.Blogging.Web/BloggingWebModule.cs +++ b/modules/blogging/src/Volo.Blogging.Web/BloggingWebModule.cs @@ -59,10 +59,10 @@ namespace Volo.Blogging var routePrefix = urlOptions.RoutePrefix; - options.Conventions.AddPageRoute("/Blog/Posts/Index", routePrefix + "{blogShortName}"); - options.Conventions.AddPageRoute("/Blog/Posts/Detail", routePrefix + "{blogShortName}/{postUrl}"); - options.Conventions.AddPageRoute("/Blog/Posts/Edit", routePrefix + "{blogShortName}/posts/{postId}/edit"); - options.Conventions.AddPageRoute("/Blog/Posts/New", routePrefix + "{blogShortName}/posts/new"); + options.Conventions.AddPageRoute("/Blogs/Posts/Index", routePrefix + "{blogShortName}"); + options.Conventions.AddPageRoute("/Blogs/Posts/Detail", routePrefix + "{blogShortName}/{postUrl}"); + options.Conventions.AddPageRoute("/Blogs/Posts/Edit", routePrefix + "{blogShortName}/posts/{postId}/edit"); + options.Conventions.AddPageRoute("/Blogs/Posts/New", routePrefix + "{blogShortName}/posts/new"); }); } } diff --git a/modules/blogging/src/Volo.Blogging.Web/FodyWeavers.xml b/modules/blogging/src/Volo.Blogging.Web/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Web/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Web/FodyWeavers.xsd b/modules/blogging/src/Volo.Blogging.Web/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Web/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/index.js b/modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/index.js index 0d8e8b3641..c2a18e083d 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/index.js +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/index.js @@ -9,6 +9,7 @@ serverSide: true, paging: false, info: false, + scrollX: true, searching: false, autoWidth: false, scrollCollapse: true, diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml deleted file mode 100644 index 4c945e8aac..0000000000 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml +++ /dev/null @@ -1,319 +0,0 @@ -@page -@inherits Volo.Blogging.Pages.Blog.BloggingPage -@using Microsoft.AspNetCore.Authorization -@using Microsoft.AspNetCore.Http.Extensions -@using Volo.Abp.Users -@using Volo.Blogging -@using Volo.Blogging.Pages.Blog.Posts -@using Volo.Blogging.Areas.Blog.Helpers.TagHelpers -@inject IAuthorizationService Authorization -@model DetailModel -@{ - ViewBag.PageTitle = "Blog"; - var hasCommentingPermission = CurrentUser.IsAuthenticated; //TODO: Apply real policy! -} -@section scripts { - - - -} -@section styles { - - - -} - -
    - -
    -
    -
    -
    -
    -
    -

    - @Model.Post.Title -

    - -
    - -
    -
    -
    - -
    -
    -
    -
    -
    - -
    -
    -
    -

    - @Html.Raw(RenderMarkdownToHtml(Model.Post.Content)) -

    -
    -
    -
    - -
    -
    - @if (Model.Post.Tags.Count > 0) - { -
    -
    @L["TagsInThisArticle"]
    - @foreach (var tag in Model.Post.Tags) - { - @tag.Name - } -
    - } - - - @if (Model.CommentsWithReplies.Count > 0) - { - - -

    @L["CommentWithCount", @Model.CommentCount]

    - @if (hasCommentingPermission) - { - @L["LeaveComment"] - } - else - { - @L["LeaveComment"] - } -
    -
    - } - -
    - @foreach (var commentWithRepliesDto in Model.CommentsWithReplies) - { -
    - -
    -
    - @(commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName) - @ConvertDatetimeToTimeAgo(commentWithRepliesDto.Comment.CreationTime) -
    -

    - @commentWithRepliesDto.Comment.Text -

    -
    - - @if (hasCommentingPermission) - { - - @L["Reply"] - - } - - @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Delete)) - { - | - - @L["Delete"] - - } - - @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) - { - | - - @L["Edit"] - - } -
    - - @if (hasCommentingPermission) - { -
    -
    -

    - @L["ReplyTo", commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName] - -

    -
    -
    - - - -
    - -
    - - - -
    -
    -
    - } - @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) - { -
    -
    -
    -
    - -
    - -
    - - - -
    -
    -
    - } - - @foreach (var reply in commentWithRepliesDto.Replies) - { -
    - -
    -
    - @(reply.Writer == null ? "" : reply.Writer.UserName) - @ConvertDatetimeToTimeAgo(reply.CreationTime) -
    -

    - @reply.Text -

    -
    - - @if (hasCommentingPermission) - { - - @L["Reply"] - - } - @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Delete) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) - { - | - - @L["Delete"] - - } - - @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) - { - | - - @L["Edit"] - - } -
    - - @if (hasCommentingPermission) - { -
    -
    -

    - @L["ReplyTo", commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName] -

    -
    -
    - - -
    - -
    - - - -
    -
    -
    - } - @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) - { -
    -
    -
    -
    - -
    - -
    - - - -
    -
    -
    - } -
    -
    - } -
    -
    - } -
    - - @if (hasCommentingPermission) - { -
    -
    -

    @L["LeaveComment"]

    -
    -
    -
    -
    - - -
    - -
    - - -
    -
    -
    - } - else - { - @L["LeaveComment"] - } -
    -
    -
    -
    diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/BloggingPage.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/BloggingPage.cs similarity index 81% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/BloggingPage.cs rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/BloggingPage.cs index ed3bb0971c..0808432521 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/BloggingPage.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/BloggingPage.cs @@ -1,5 +1,7 @@ using System; +using System.Linq; using System.Text; +using System.Text.RegularExpressions; using CommonMark; using Microsoft.AspNetCore.Html; using Microsoft.AspNetCore.Mvc.Localization; @@ -30,30 +32,27 @@ namespace Volo.Blogging.Pages.Blog public string GetShortContent(string content) //TODO: This should be moved to its own place! { - var openingTag = "

    "; - var closingTag = "

    "; - var html = RenderMarkdownToString(content); - if (string.IsNullOrWhiteSpace(html)) + var plainText = Regex.Replace(html, "/<[^>]*>/g", ""); + + if (string.IsNullOrWhiteSpace(plainText)) { return ""; } - var splittedHtml = html.Split(closingTag); - if (splittedHtml.Length < 1) + var firsParag = plainText.Split(Environment.NewLine).FirstOrDefault(s => !string.IsNullOrWhiteSpace(s)); + + if (firsParag == null) { - return ""; + return plainText; } - var firstHtmlPart = splittedHtml[0]; - var paragraphStartIndex = firstHtmlPart.IndexOf(openingTag, StringComparison.Ordinal) + openingTag.Length; - - if (firstHtmlPart.Length - paragraphStartIndex <= MaxShortContentLength) + if (firsParag.Length <= MaxShortContentLength) { - return firstHtmlPart.Substring(paragraphStartIndex); + return firsParag; } - return firstHtmlPart.Substring(paragraphStartIndex, MaxShortContentLength) + "..."; + return firsParag.Substring(0, MaxShortContentLength) + "..."; } public IHtmlContent RenderMarkdownToHtml(string content) diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/BloggingPageModel.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/BloggingPageModel.cs similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/BloggingPageModel.cs rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/BloggingPageModel.cs diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Index.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Index.cshtml similarity index 89% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Index.cshtml rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Index.cshtml index 97f06b6dc0..91eb12fac4 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Index.cshtml +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Index.cshtml @@ -3,7 +3,7 @@ @inherits BloggingPage @model IndexModel @{ - ViewBag.PageTitle = "Blog"; + ViewBag.PageTitle = "Blogs"; }

    @L["Blogs"] diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Index.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Index.cshtml.cs similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Index.cshtml.cs rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Index.cshtml.cs diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml new file mode 100644 index 0000000000..a76e92ea9b --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml @@ -0,0 +1,319 @@ +@page +@inherits Volo.Blogging.Pages.Blog.BloggingPage +@using Microsoft.AspNetCore.Authorization +@using Microsoft.AspNetCore.Http.Extensions +@using Volo.Abp.Users +@using Volo.Blogging +@using Volo.Blogging.Pages.Blog.Posts +@using Volo.Blogging.Areas.Blog.Helpers.TagHelpers +@inject IAuthorizationService Authorization +@model DetailModel +@{ + ViewBag.PageTitle = Model.Post.Title; + var hasCommentingPermission = CurrentUser.IsAuthenticated; //TODO: Apply real policy! +} +@section scripts { + + + +} +@section styles { + + + +} + +
    + +
    +
    +
    +
    +
    +
    +

    + @Model.Post.Title +

    + +
    + +
    +
    +
    + +
    +
    +
    +
    +
    + +
    +
    +
    +

    + @Html.Raw(RenderMarkdownToHtml(Model.Post.Content)) +

    +
    +
    +
    + +
    +
    + @if (Model.Post.Tags.Count > 0) + { +
    +
    @L["TagsInThisArticle"]
    + @foreach (var tag in Model.Post.Tags) + { + @tag.Name + } +
    + } + + + @if (Model.CommentsWithReplies.Count > 0) + { + + +

    @L["CommentWithCount", @Model.CommentCount]

    + @if (hasCommentingPermission) + { + @L["LeaveComment"] + } + else + { + @L["LeaveComment"] + } +
    +
    + +
    + @foreach (var commentWithRepliesDto in Model.CommentsWithReplies) + { +
    + +
    +
    + @(commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName) + @ConvertDatetimeToTimeAgo(commentWithRepliesDto.Comment.CreationTime) +
    +

    + @commentWithRepliesDto.Comment.Text +

    +
    + + @if (hasCommentingPermission) + { + + @L["Reply"] + + } + + @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Delete)) + { + | + + @L["Delete"] + + } + + @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) + { + | + + @L["Edit"] + + } +
    + + @if (hasCommentingPermission) + { +
    +
    +

    + @L["ReplyTo", commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName] + +

    +
    +
    + + + +
    + +
    + + + +
    +
    +
    + } + @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) + { +
    +
    +
    +
    + +
    + +
    + + + +
    +
    +
    + } + + @foreach (var reply in commentWithRepliesDto.Replies) + { +
    + +
    +
    + @(reply.Writer == null ? "" : reply.Writer.UserName) + @ConvertDatetimeToTimeAgo(reply.CreationTime) +
    +

    + @reply.Text +

    +
    + + @if (hasCommentingPermission) + { + + @L["Reply"] + + } + @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Delete) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) + { + | + + @L["Delete"] + + } + + @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) + { + | + + @L["Edit"] + + } +
    + + @if (hasCommentingPermission) + { +
    +
    +

    + @L["ReplyTo", commentWithRepliesDto.Comment.Writer == null ? "" : commentWithRepliesDto.Comment.Writer.UserName] +

    +
    +
    + + +
    + +
    + + + +
    +
    +
    + } + @if (await Authorization.IsGrantedAsync(BloggingPermissions.Comments.Update) || (CurrentUser.Id == commentWithRepliesDto.Comment.CreatorId)) + { +
    +
    +
    +
    + +
    + +
    + + + +
    +
    +
    + } +
    +
    + } +
    +
    + } +
    + } + + @if (hasCommentingPermission) + { +
    +
    +

    @L["LeaveComment"]

    +
    +
    +
    +
    + + +
    + +
    + + +
    +
    +
    + } + else + { + @L["LeaveComment"] + } +
    +
    +
    +
    diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml.cs rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Detail.cshtml.cs diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Edit.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Edit.cshtml similarity index 96% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Edit.cshtml rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Edit.cshtml index dac2d5122f..15119745df 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Edit.cshtml +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Edit.cshtml @@ -9,13 +9,13 @@ @section styles { - + } @section scripts { - + } diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Edit.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Edit.cshtml.cs similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Edit.cshtml.cs rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Edit.cshtml.cs diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Index.cshtml similarity index 94% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Index.cshtml index 20ebc1887f..b0f9dc4d46 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Index.cshtml @@ -12,13 +12,13 @@ @section scripts { - + } @section styles { - + } @@ -69,7 +69,7 @@

    @foreach (var tag in post.Tags) { - @tag.Name + @tag.Name }

    @@ -178,7 +178,7 @@

    @foreach (var tag in post.Tags) { - @tag.Name + @tag.Name }

    @@ -200,7 +200,7 @@ @foreach (var popularTag in Model.PopularTags) { } diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Index.cshtml.cs similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml.cs rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Index.cshtml.cs diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.css b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Index.css similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.css rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Index.css diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.min.css b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Index.min.css similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.min.css rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Index.min.css diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.scss b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Index.scss similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.scss rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/Index.scss diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/New.cshtml similarity index 96% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/New.cshtml index b96a531550..95b7de9e03 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/New.cshtml @@ -9,13 +9,13 @@ @section styles { - + } @section scripts { - + }
    diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/New.cshtml.cs similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml.cs rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/New.cshtml.cs diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/detail.js b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/detail.js similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/detail.js rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/detail.js diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/edit.js b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/edit.js similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/edit.js rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/edit.js diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/new.css b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/new.css similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/new.css rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/new.css diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/new.css.map b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/new.css.map similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/new.css.map rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/new.css.map diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/new.js b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/new.js similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/new.js rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/new.js diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/new.min.css b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/new.min.css similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/new.min.css rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/new.min.css diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/new.scss b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/new.scss similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/new.scss rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Posts/new.scss diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Scripts/blog.js b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Scripts/blog.js similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Scripts/blog.js rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Scripts/blog.js diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/_bootstrap-overwrite.scss b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/_bootstrap-overwrite.scss similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/_bootstrap-overwrite.scss rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/_bootstrap-overwrite.scss diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/_custom.scss b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/_custom.scss similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/_custom.scss rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/_custom.scss diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/_header.scss b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/_header.scss similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/_header.scss rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/_header.scss diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/_home.css b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/_home.css similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/_home.css rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/_home.css diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/_home.min.css b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/_home.min.css similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/_home.min.css rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/_home.min.css diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/_home.scss b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/_home.scss similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/_home.scss rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/_home.scss diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/_post.scss b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/_post.scss similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/_post.scss rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/_post.scss diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/blog.css b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/blog.css similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/blog.css rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/blog.css diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/blog.css.map b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/blog.css.map similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/blog.css.map rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/blog.css.map diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/blog.min.css b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/blog.min.css similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/blog.min.css rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/blog.min.css diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/blog.scss b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/blog.scss similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Shared/Styles/blog.scss rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/Shared/Styles/blog.scss diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/_ViewImports.cshtml b/modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/_ViewImports.cshtml similarity index 100% rename from modules/blogging/src/Volo.Blogging.Web/Pages/Blog/_ViewImports.cshtml rename to modules/blogging/src/Volo.Blogging.Web/Pages/Blogs/_ViewImports.cshtml diff --git a/modules/blogging/src/Volo.Blogging.Web/Volo.Blogging.Web.csproj b/modules/blogging/src/Volo.Blogging.Web/Volo.Blogging.Web.csproj index d85f182bcc..7313becddb 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Volo.Blogging.Web.csproj +++ b/modules/blogging/src/Volo.Blogging.Web/Volo.Blogging.Web.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/blogging/test/Volo.Blogging.Application.Tests/Volo.Blogging.Application.Tests.csproj b/modules/blogging/test/Volo.Blogging.Application.Tests/Volo.Blogging.Application.Tests.csproj index 473f1442c8..926daa142c 100644 --- a/modules/blogging/test/Volo.Blogging.Application.Tests/Volo.Blogging.Application.Tests.csproj +++ b/modules/blogging/test/Volo.Blogging.Application.Tests/Volo.Blogging.Application.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo.Blogging.Domain.Tests.csproj b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo.Blogging.Domain.Tests.csproj index dbc49033d3..4c77689067 100644 --- a/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo.Blogging.Domain.Tests.csproj +++ b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo.Blogging.Domain.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Tagging/Tag_Tests.cs b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Tagging/Tag_Tests.cs index a4368a6341..25ded93f72 100644 --- a/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Tagging/Tag_Tests.cs +++ b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Tagging/Tag_Tests.cs @@ -14,7 +14,7 @@ namespace Volo.Blogging [InlineData("bbb")] public void SetName(string name) { - var tag = new Tag(Guid.NewGuid(), "abp", 0, "abp tag"); + var tag = new Tag(Guid.NewGuid(), Guid.NewGuid(), "abp", 0, "abp tag"); tag.SetName(name); tag.Name.ShouldBe(name); } @@ -25,7 +25,7 @@ namespace Volo.Blogging [InlineData(3)] public void IncreaseUsageCount(int number) { - var tag = new Tag(Guid.NewGuid(), "abp", 0, "abp tag"); + var tag = new Tag(Guid.NewGuid(), Guid.NewGuid(), "abp", 0, "abp tag"); tag.IncreaseUsageCount(number); tag.UsageCount.ShouldBe(number); } @@ -36,7 +36,7 @@ namespace Volo.Blogging [InlineData(3)] public void DecreaseUsageCount(int number) { - var tag = new Tag(Guid.NewGuid(), "abp", 10, "abp tag"); + var tag = new Tag(Guid.NewGuid(), Guid.NewGuid(), "abp", 10, "abp tag"); tag.DecreaseUsageCount(number); tag.UsageCount.ShouldBe(10 - number); } @@ -44,7 +44,7 @@ namespace Volo.Blogging [Fact] public void DecreaseUsageCount_Should_Greater_ThanOrEqual_Zero() { - var tag = new Tag(Guid.NewGuid(), "abp", 10, "abp tag"); + var tag = new Tag(Guid.NewGuid(), Guid.NewGuid(), "abp", 10, "abp tag"); tag.DecreaseUsageCount(100); tag.UsageCount.ShouldBe(0); } @@ -54,7 +54,7 @@ namespace Volo.Blogging [InlineData("bbb")] public void SetDescription(string description) { - var tag = new Tag(Guid.NewGuid(), "abp", 0, "abp tag"); + var tag = new Tag(Guid.NewGuid(), Guid.NewGuid(), "abp", 0, "abp tag"); tag.SetDescription(description); tag.Description.ShouldBe(description); } diff --git a/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo.Blogging.EntityFrameworkCore.Tests.csproj b/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo.Blogging.EntityFrameworkCore.Tests.csproj index 8b92f8b67b..ffae92b6c8 100644 --- a/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo.Blogging.EntityFrameworkCore.Tests.csproj +++ b/modules/blogging/test/Volo.Blogging.EntityFrameworkCore.Tests/Volo.Blogging.EntityFrameworkCore.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo.Blogging.MongoDB.Tests.csproj b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo.Blogging.MongoDB.Tests.csproj index cc46eead03..d58c4ce66f 100644 --- a/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo.Blogging.MongoDB.Tests.csproj +++ b/modules/blogging/test/Volo.Blogging.MongoDB.Tests/Volo.Blogging.MongoDB.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/blogging/test/Volo.Blogging.TestBase/Volo.Blogging.TestBase.csproj b/modules/blogging/test/Volo.Blogging.TestBase/Volo.Blogging.TestBase.csproj index bdc6873c3a..39cc02fafa 100644 --- a/modules/blogging/test/Volo.Blogging.TestBase/Volo.Blogging.TestBase.csproj +++ b/modules/blogging/test/Volo.Blogging.TestBase/Volo.Blogging.TestBase.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestDataBuilder.cs b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestDataBuilder.cs index 67d8049a06..cd2168d9df 100644 --- a/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestDataBuilder.cs +++ b/modules/blogging/test/Volo.Blogging.TestBase/Volo/Blogging/BloggingTestDataBuilder.cs @@ -43,8 +43,8 @@ namespace Volo.Blogging await _postRepository.InsertAsync(new Post(_testData.Blog1Post2Id, _testData.Blog1Id, "title2", "coverImage2", "url2")); await _commentRepository.InsertAsync(new Comment(_testData.Blog1Post1Comment1Id,_testData.Blog1Post1Id,null,"text")); await _commentRepository.InsertAsync(new Comment(_testData.Blog1Post1Comment2Id, _testData.Blog1Post1Id, _testData.Blog1Post1Comment1Id, "text")); - await _tagRepository.InsertAsync(new Tag(_testData.Blog1Id, _testData.Tag1Name, 10)); - await _tagRepository.InsertAsync(new Tag(_testData.Blog1Id, _testData.Tag2Name)); + await _tagRepository.InsertAsync(new Tag(Guid.NewGuid(), _testData.Blog1Id, _testData.Tag1Name, 10)); + await _tagRepository.InsertAsync(new Tag(Guid.NewGuid(), _testData.Blog1Id, _testData.Tag2Name)); } } diff --git a/modules/client-simulation/demo/Volo.ClientSimulation.Demo/FodyWeavers.xml b/modules/client-simulation/demo/Volo.ClientSimulation.Demo/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/client-simulation/demo/Volo.ClientSimulation.Demo/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/client-simulation/demo/Volo.ClientSimulation.Demo/FodyWeavers.xsd b/modules/client-simulation/demo/Volo.ClientSimulation.Demo/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/client-simulation/demo/Volo.ClientSimulation.Demo/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/client-simulation/demo/Volo.ClientSimulation.Demo/Volo.ClientSimulation.Demo.csproj b/modules/client-simulation/demo/Volo.ClientSimulation.Demo/Volo.ClientSimulation.Demo.csproj index 8544cf6cff..1173121c3c 100644 --- a/modules/client-simulation/demo/Volo.ClientSimulation.Demo/Volo.ClientSimulation.Demo.csproj +++ b/modules/client-simulation/demo/Volo.ClientSimulation.Demo/Volo.ClientSimulation.Demo.csproj @@ -1,5 +1,6 @@ - + + @@ -8,7 +9,7 @@ - + diff --git a/modules/client-simulation/src/Volo.ClientSimulation.Web/FodyWeavers.xml b/modules/client-simulation/src/Volo.ClientSimulation.Web/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/client-simulation/src/Volo.ClientSimulation.Web/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/client-simulation/src/Volo.ClientSimulation.Web/FodyWeavers.xsd b/modules/client-simulation/src/Volo.ClientSimulation.Web/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/client-simulation/src/Volo.ClientSimulation.Web/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/client-simulation/src/Volo.ClientSimulation.Web/Volo.ClientSimulation.Web.csproj b/modules/client-simulation/src/Volo.ClientSimulation.Web/Volo.ClientSimulation.Web.csproj index 108c048937..ad0ce496f5 100644 --- a/modules/client-simulation/src/Volo.ClientSimulation.Web/Volo.ClientSimulation.Web.csproj +++ b/modules/client-simulation/src/Volo.ClientSimulation.Web/Volo.ClientSimulation.Web.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/client-simulation/src/Volo.ClientSimulation/FodyWeavers.xml b/modules/client-simulation/src/Volo.ClientSimulation/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/client-simulation/src/Volo.ClientSimulation/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/client-simulation/src/Volo.ClientSimulation/FodyWeavers.xsd b/modules/client-simulation/src/Volo.ClientSimulation/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/client-simulation/src/Volo.ClientSimulation/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/client-simulation/src/Volo.ClientSimulation/Volo.ClientSimulation.csproj b/modules/client-simulation/src/Volo.ClientSimulation/Volo.ClientSimulation.csproj index 82a5932188..3876e7deb5 100644 --- a/modules/client-simulation/src/Volo.ClientSimulation/Volo.ClientSimulation.csproj +++ b/modules/client-simulation/src/Volo.ClientSimulation/Volo.ClientSimulation.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/docs/README.md b/modules/docs/README.md index ee4e33a785..99117426d3 100644 --- a/modules/docs/README.md +++ b/modules/docs/README.md @@ -1,13 +1,15 @@ # Docs Module -This module is used to create technical documentation web sites. [abp.io](https://abp.io) web site uses this module for its documentation. +This module is used to create technical documentation web sites; -### Screenshot +* Built-in **GitHub integration**: Directly write and manage documents on GitHub. +* **Versioning** support directly integrated to GitHub releases. +* Supports **multi-language** (with fallback support to the default language). +* Supports the **Markdown** and HTML formats. +* Provides a **navigation** and an **outline** section. +* Allows to host **multiple projects** documentation in a single application. +* Links to the file on GitHub, so anyone can easily contribute by clicking to the **Edit link**. +* In addition to the GitHub source, allows to simply use a folder as the documentation source. -![screenshot](screenshot.png) +ABP Framework uses this module to host its documentation. See [docs.abp.io](https://docs.abp.io/). A screenshot from the ABP documentation: -### Main Features - -* Retrieves documents from a Github repository. -* Supports Markdown document formatting. -* Supports versioning (integrated to Github releases). -* Supports multiple projects. +![screenshot](screenshot2.png) diff --git a/modules/docs/Volo.Docs.sln b/modules/docs/Volo.Docs.sln index 74e748ac9b..1c32767baa 100644 --- a/modules/docs/Volo.Docs.sln +++ b/modules/docs/Volo.Docs.sln @@ -57,9 +57,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VoloDocs.Web", "app\VoloDoc EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VoloDocs.Migrator", "app\VoloDocs.Migrator\VoloDocs.Migrator.csproj", "{8A5E5001-C017-44A8-ADDA-DC66C102556E}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Docs.MongoDB", "src\Volo.Docs.MongoDB\Volo.Docs.MongoDB.csproj", "{DBE846CD-1BED-4F2C-ABF2-94F6240BCB9B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Docs.MongoDB", "src\Volo.Docs.MongoDB\Volo.Docs.MongoDB.csproj", "{DBE846CD-1BED-4F2C-ABF2-94F6240BCB9B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Docs.MongoDB.Tests", "test\Volo.Docs.MongoDB.Tests\Volo.Docs.MongoDB.Tests.csproj", "{C5E2A2A3-D54D-4C2E-97BA-EA50A49ED7AD}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Docs.MongoDB.Tests", "test\Volo.Docs.MongoDB.Tests\Volo.Docs.MongoDB.Tests.csproj", "{C5E2A2A3-D54D-4C2E-97BA-EA50A49ED7AD}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/modules/docs/app/VoloDocs.EntityFrameworkCore/FodyWeavers.xml b/modules/docs/app/VoloDocs.EntityFrameworkCore/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/docs/app/VoloDocs.EntityFrameworkCore/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/docs/app/VoloDocs.EntityFrameworkCore/FodyWeavers.xsd b/modules/docs/app/VoloDocs.EntityFrameworkCore/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/docs/app/VoloDocs.EntityFrameworkCore/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20181225134002_Initial20181225.Designer.cs b/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20181225134002_Initial20181225.Designer.cs deleted file mode 100644 index ab8c782832..0000000000 --- a/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20181225134002_Initial20181225.Designer.cs +++ /dev/null @@ -1,465 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using VoloDocs.EntityFrameworkCore; - -namespace VoloDocs.EntityFrameworkCore.Migrations -{ - [DbContext(typeof(VoloDocsDbContext))] - [Migration("20181225134002_Initial20181225")] - partial class Initial20181225 - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "2.1.1-rtm-30846") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasColumnName("ConcurrencyStamp") - .HasMaxLength(256); - - b.Property("Description") - .HasMaxLength(256); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); - - b.Property("IsStatic"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256); - - b.Property("Regex") - .HasMaxLength(512); - - b.Property("RegexDescription") - .HasMaxLength(128); - - b.Property("Required"); - - b.Property("ValueType"); - - b.HasKey("Id"); - - b.ToTable("AbpClaimTypes"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasColumnName("ConcurrencyStamp") - .HasMaxLength(256); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); - - b.Property("IsDefault") - .HasColumnName("IsDefault"); - - b.Property("IsPublic") - .HasColumnName("IsPublic"); - - b.Property("IsStatic") - .HasColumnName("IsStatic"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(256); - - b.Property("NormalizedName") - .IsRequired() - .HasMaxLength(256); - - b.Property("TenantId"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName"); - - b.ToTable("AbpRoles"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ClaimType") - .IsRequired() - .HasMaxLength(256); - - b.Property("ClaimValue") - .HasMaxLength(1024); - - b.Property("RoleId"); - - b.Property("TenantId"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AbpRoleClaims"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("AccessFailedCount") - .ValueGeneratedOnAdd() - .HasColumnName("AccessFailedCount") - .HasDefaultValue(0); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); - - b.Property("CreationTime") - .HasColumnName("CreationTime"); - - b.Property("CreatorId") - .HasColumnName("CreatorId"); - - b.Property("DeleterId") - .HasColumnName("DeleterId"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime"); - - b.Property("Email") - .HasColumnName("Email") - .HasMaxLength(256); - - b.Property("EmailConfirmed") - .ValueGeneratedOnAdd() - .HasColumnName("EmailConfirmed") - .HasDefaultValue(false); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId"); - - b.Property("LockoutEnabled") - .ValueGeneratedOnAdd() - .HasColumnName("LockoutEnabled") - .HasDefaultValue(false); - - b.Property("LockoutEnd"); - - b.Property("Name") - .HasColumnName("Name") - .HasMaxLength(64); - - b.Property("NormalizedEmail") - .HasColumnName("NormalizedEmail") - .HasMaxLength(256); - - b.Property("NormalizedUserName") - .IsRequired() - .HasColumnName("NormalizedUserName") - .HasMaxLength(256); - - b.Property("PasswordHash") - .HasColumnName("PasswordHash") - .HasMaxLength(256); - - b.Property("PhoneNumber") - .HasColumnName("PhoneNumber") - .HasMaxLength(16); - - b.Property("PhoneNumberConfirmed") - .ValueGeneratedOnAdd() - .HasColumnName("PhoneNumberConfirmed") - .HasDefaultValue(false); - - b.Property("SecurityStamp") - .IsRequired() - .HasColumnName("SecurityStamp") - .HasMaxLength(256); - - b.Property("Surname") - .HasColumnName("Surname") - .HasMaxLength(64); - - b.Property("TenantId") - .HasColumnName("TenantId"); - - b.Property("TwoFactorEnabled") - .ValueGeneratedOnAdd() - .HasColumnName("TwoFactorEnabled") - .HasDefaultValue(false); - - b.Property("UserName") - .IsRequired() - .HasColumnName("UserName") - .HasMaxLength(256); - - b.HasKey("Id"); - - b.HasIndex("Email"); - - b.HasIndex("NormalizedEmail"); - - b.HasIndex("NormalizedUserName"); - - b.HasIndex("UserName"); - - b.ToTable("AbpUsers"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ClaimType") - .IsRequired() - .HasMaxLength(256); - - b.Property("ClaimValue") - .HasMaxLength(1024); - - b.Property("TenantId"); - - b.Property("UserId"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AbpUserClaims"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => - { - b.Property("UserId"); - - b.Property("LoginProvider") - .HasMaxLength(64); - - b.Property("ProviderDisplayName") - .HasMaxLength(128); - - b.Property("ProviderKey") - .IsRequired() - .HasMaxLength(196); - - b.Property("TenantId"); - - b.HasKey("UserId", "LoginProvider"); - - b.HasIndex("LoginProvider", "ProviderKey"); - - b.ToTable("AbpUserLogins"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => - { - b.Property("UserId"); - - b.Property("RoleId"); - - b.Property("TenantId"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId", "UserId"); - - b.ToTable("AbpUserRoles"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => - { - b.Property("UserId"); - - b.Property("LoginProvider") - .HasMaxLength(64); - - b.Property("Name") - .HasMaxLength(128); - - b.Property("TenantId"); - - b.Property("Value"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AbpUserTokens"); - }); - - modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128); - - b.Property("ProviderKey") - .IsRequired() - .HasMaxLength(64); - - b.Property("ProviderName") - .IsRequired() - .HasMaxLength(64); - - b.Property("TenantId"); - - b.HasKey("Id"); - - b.HasIndex("Name", "ProviderName", "ProviderKey"); - - b.ToTable("AbpPermissionGrants"); - }); - - modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128); - - b.Property("ProviderKey") - .HasMaxLength(64); - - b.Property("ProviderName") - .HasMaxLength(64); - - b.Property("Value") - .IsRequired() - .HasMaxLength(2048); - - b.HasKey("Id"); - - b.HasIndex("Name", "ProviderName", "ProviderKey"); - - b.ToTable("AbpSettings"); - }); - - modelBuilder.Entity("Volo.Docs.Projects.Project", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); - - b.Property("DefaultDocumentName") - .IsRequired() - .HasMaxLength(128); - - b.Property("DocumentStoreType"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); - - b.Property("Format"); - - b.Property("LatestVersionBranchName") - .HasMaxLength(128); - - b.Property("MainWebsiteUrl"); - - b.Property("MinimumVersion"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(128); - - b.Property("NavigationDocumentName") - .IsRequired() - .HasMaxLength(128); - - b.Property("ShortName") - .IsRequired() - .HasMaxLength(32); - - b.HasKey("Id"); - - b.ToTable("DocsProjects"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => - { - b.HasOne("Volo.Abp.Identity.IdentityRole") - .WithMany("Claims") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => - { - b.HasOne("Volo.Abp.Identity.IdentityUser") - .WithMany("Claims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => - { - b.HasOne("Volo.Abp.Identity.IdentityUser") - .WithMany("Logins") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => - { - b.HasOne("Volo.Abp.Identity.IdentityRole") - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("Volo.Abp.Identity.IdentityUser") - .WithMany("Roles") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => - { - b.HasOne("Volo.Abp.Identity.IdentityUser") - .WithMany("Tokens") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/Migrations/20190527144415_Initial.Designer.cs b/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20200218014727_init.Designer.cs similarity index 50% rename from samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/Migrations/20190527144415_Initial.Designer.cs rename to modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20200218014727_init.Designer.cs index 1ed05a4c4b..522b3e3ba5 100644 --- a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/Migrations/20190527144415_Initial.Designer.cs +++ b/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20200218014727_init.Designer.cs @@ -5,254 +5,64 @@ using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Acme.BookStore.BookManagement.EntityFrameworkCore; +using VoloDocs.EntityFrameworkCore; -namespace Acme.BookStore.BookManagement.Migrations +namespace VoloDocs.EntityFrameworkCore.Migrations { - [DbContext(typeof(UnifiedDbContext))] - [Migration("20190527144415_Initial")] - partial class Initial + [DbContext(typeof(VoloDocsDbContext))] + [Migration("20200218014727_init")] + partial class init { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.2.4-servicing-10062") + .HasAnnotation("ProductVersion", "3.1.1") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("ApplicationName") - .HasColumnName("ApplicationName") - .HasMaxLength(96); - - b.Property("BrowserInfo") - .HasColumnName("BrowserInfo") - .HasMaxLength(512); - - b.Property("ClientId") - .HasColumnName("ClientId") - .HasMaxLength(64); - - b.Property("ClientIpAddress") - .HasColumnName("ClientIpAddress") - .HasMaxLength(64); - - b.Property("ClientName") - .HasColumnName("ClientName") - .HasMaxLength(128); - - b.Property("Comments") - .HasColumnName("Comments") - .HasMaxLength(256); - - b.Property("ConcurrencyStamp"); - - b.Property("CorrelationId") - .HasColumnName("CorrelationId") - .HasMaxLength(64); - - b.Property("Exceptions") - .HasColumnName("Exceptions") - .HasMaxLength(4000); - - b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration"); - - b.Property("ExecutionTime"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); - - b.Property("HttpMethod") - .HasColumnName("HttpMethod") - .HasMaxLength(16); - - b.Property("HttpStatusCode") - .HasColumnName("HttpStatusCode"); - - b.Property("ImpersonatorTenantId") - .HasColumnName("ImpersonatorTenantId"); - - b.Property("ImpersonatorUserId") - .HasColumnName("ImpersonatorUserId"); - - b.Property("TenantId") - .HasColumnName("TenantId"); - - b.Property("TenantName"); - - b.Property("Url") - .HasColumnName("Url") - .HasMaxLength(256); - - b.Property("UserId") - .HasColumnName("UserId"); - - b.Property("UserName") - .HasColumnName("UserName") - .HasMaxLength(256); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "ExecutionTime"); - - b.HasIndex("TenantId", "UserId", "ExecutionTime"); - - b.ToTable("AbpAuditLogs"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("AuditLogId") - .HasColumnName("AuditLogId"); - - b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration"); - - b.Property("ExecutionTime") - .HasColumnName("ExecutionTime"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); - - b.Property("MethodName") - .HasColumnName("MethodName") - .HasMaxLength(128); - - b.Property("Parameters") - .HasColumnName("Parameters") - .HasMaxLength(2000); - - b.Property("ServiceName") - .HasColumnName("ServiceName") - .HasMaxLength(256); - - b.Property("TenantId"); - - b.HasKey("Id"); - - b.HasIndex("AuditLogId"); - - b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); - - b.ToTable("AbpAuditLogActions"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("AuditLogId") - .HasColumnName("AuditLogId"); - - b.Property("ChangeTime") - .HasColumnName("ChangeTime"); - - b.Property("ChangeType") - .HasColumnName("ChangeType"); - - b.Property("EntityId") - .IsRequired() - .HasColumnName("EntityId") - .HasMaxLength(128); - - b.Property("EntityTenantId"); - - b.Property("EntityTypeFullName") - .IsRequired() - .HasColumnName("EntityTypeFullName") - .HasMaxLength(128); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); - - b.Property("TenantId") - .HasColumnName("TenantId"); - - b.HasKey("Id"); - - b.HasIndex("AuditLogId"); - - b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); - - b.ToTable("AbpEntityChanges"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => - { - b.Property("Id") - .ValueGeneratedOnAdd(); - - b.Property("EntityChangeId"); - - b.Property("NewValue") - .HasColumnName("NewValue") - .HasMaxLength(512); - - b.Property("OriginalValue") - .HasColumnName("OriginalValue") - .HasMaxLength(512); - - b.Property("PropertyName") - .IsRequired() - .HasColumnName("PropertyName") - .HasMaxLength(128); - - b.Property("PropertyTypeFullName") - .IsRequired() - .HasColumnName("PropertyTypeFullName") - .HasMaxLength(64); - - b.Property("TenantId"); - - b.HasKey("Id"); - - b.HasIndex("EntityChangeId"); - - b.ToTable("AbpEntityPropertyChanges"); - }); - modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .IsRequired() .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Description") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("IsStatic"); + b.Property("IsStatic") + .HasColumnType("bit"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Regex") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("RegexDescription") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ValueType"); + b.Property("ValueType") + .HasColumnType("int"); b.HasKey("Id"); @@ -262,35 +72,44 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .IsRequired() .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDefault") - .HasColumnName("IsDefault"); + .HasColumnName("IsDefault") + .HasColumnType("bit"); b.Property("IsPublic") - .HasColumnName("IsPublic"); + .HasColumnName("IsPublic") + .HasColumnType("bit"); b.Property("IsStatic") - .HasColumnName("IsStatic"); + .HasColumnName("IsStatic") + .HasColumnType("bit"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedName") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -302,18 +121,22 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("uniqueidentifier"); b.Property("ClaimType") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -325,105 +148,133 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AccessFailedCount") .ValueGeneratedOnAdd() .HasColumnName("AccessFailedCount") + .HasColumnType("int") .HasDefaultValue(0); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Email") + .IsRequired() .HasColumnName("Email") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("EmailConfirmed") .ValueGeneratedOnAdd() .HasColumnName("EmailConfirmed") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnName("LockoutEnabled") + .HasColumnType("bit") .HasDefaultValue(false); - b.Property("LockoutEnd"); + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); b.Property("Name") .HasColumnName("Name") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("NormalizedEmail") + .IsRequired() .HasColumnName("NormalizedEmail") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedUserName") .IsRequired() .HasColumnName("NormalizedUserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("PasswordHash") .HasColumnName("PasswordHash") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("PhoneNumber") .HasColumnName("PhoneNumber") + .HasColumnType("nvarchar(16)") .HasMaxLength(16); b.Property("PhoneNumberConfirmed") .ValueGeneratedOnAdd() .HasColumnName("PhoneNumberConfirmed") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("SecurityStamp") .IsRequired() .HasColumnName("SecurityStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Surname") .HasColumnName("Surname") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); b.Property("TwoFactorEnabled") .ValueGeneratedOnAdd() .HasColumnName("TwoFactorEnabled") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("UserName") .IsRequired() .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -442,18 +293,22 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("uniqueidentifier"); b.Property("ClaimType") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -464,19 +319,24 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") .IsRequired() + .HasColumnType("nvarchar(196)") .HasMaxLength(196); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("UserId", "LoginProvider"); @@ -487,11 +347,14 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("UserId", "RoleId"); @@ -502,17 +365,22 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Name") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("Value"); + b.Property("Value") + .HasColumnType("nvarchar(max)"); b.HasKey("UserId", "LoginProvider", "Name"); @@ -522,21 +390,26 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderName") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -548,20 +421,25 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderName") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Value") .IsRequired() + .HasColumnType("nvarchar(2048)") .HasMaxLength(2048); b.HasKey("Id"); @@ -571,144 +449,220 @@ namespace Acme.BookStore.BookManagement.Migrations b.ToTable("AbpSettings"); }); - modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + modelBuilder.Entity("Volo.Docs.Documents.Document", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("Content") + .IsRequired() + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnType("datetime2"); - b.Property("CreatorId") - .HasColumnName("CreatorId"); + b.Property("EditLink") + .HasColumnType("nvarchar(2048)") + .HasMaxLength(2048); - b.Property("DeleterId") - .HasColumnName("DeleterId"); + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + b.Property("FileName") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + b.Property("Format") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasDefaultValue(false); + b.Property("LanguageCode") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + b.Property("LastCachedTime") + .HasColumnType("datetime2"); - b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + b.Property("LastUpdatedTime") + .HasColumnType("datetime2"); + + b.Property("LocalDirectory") + .HasColumnType("nvarchar(512)") + .HasMaxLength(512); b.Property("Name") .IsRequired() - .HasMaxLength(64); + .HasColumnType("nvarchar(255)") + .HasMaxLength(255); - b.HasKey("Id"); + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("RawRootUrl") + .HasColumnType("nvarchar(2048)") + .HasMaxLength(2048); - b.HasIndex("Name") - .IsUnique(); + b.Property("RootUrl") + .HasColumnType("nvarchar(2048)") + .HasMaxLength(2048); + + b.Property("Version") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); - b.ToTable("AbpTenants"); + b.HasKey("Id"); + + b.ToTable("DocsDocuments"); }); - modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + modelBuilder.Entity("Volo.Docs.Documents.DocumentContributor", b => { - b.Property("TenantId"); + b.Property("DocumentId") + .HasColumnType("uniqueidentifier"); - b.Property("Name") - .HasMaxLength(64); + b.Property("Username") + .HasColumnType("nvarchar(450)"); - b.Property("Value") - .IsRequired() - .HasMaxLength(1024); + b.Property("AvatarUrl") + .HasColumnType("nvarchar(max)"); - b.HasKey("TenantId", "Name"); + b.Property("UserProfileUrl") + .HasColumnType("nvarchar(max)"); - b.ToTable("AbpTenantConnectionStrings"); - }); + b.HasKey("DocumentId", "Username"); - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => - { - b.HasOne("Volo.Abp.AuditLogging.AuditLog") - .WithMany("Actions") - .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade); + b.ToTable("DocsDocumentContributors"); }); - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + modelBuilder.Entity("Volo.Docs.Projects.Project", b => { - b.HasOne("Volo.Abp.AuditLogging.AuditLog") - .WithMany("EntityChanges") - .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade); - }); + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => - { - b.HasOne("Volo.Abp.AuditLogging.EntityChange") - .WithMany("PropertyChanges") - .HasForeignKey("EntityChangeId") - .OnDelete(DeleteBehavior.Cascade); + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("DefaultDocumentName") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("DocumentStoreType") + .HasColumnType("nvarchar(max)"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("Format") + .HasColumnType("nvarchar(max)"); + + b.Property("LatestVersionBranchName") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("MainWebsiteUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("MinimumVersion") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("NavigationDocumentName") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("ParametersDocumentName") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(32)") + .HasMaxLength(32); + + b.HasKey("Id"); + + b.ToTable("DocsProjects"); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => { - b.HasOne("Volo.Abp.Identity.IdentityRole") + b.HasOne("Volo.Abp.Identity.IdentityRole", null) .WithMany("Claims") .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Claims") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Logins") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { - b.HasOne("Volo.Abp.Identity.IdentityRole") + b.HasOne("Volo.Abp.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Roles") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Tokens") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + modelBuilder.Entity("Volo.Docs.Documents.DocumentContributor", b => { - b.HasOne("Volo.Abp.TenantManagement.Tenant") - .WithMany("ConnectionStrings") - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade); + b.HasOne("Volo.Docs.Documents.Document", null) + .WithMany("Contributors") + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); #pragma warning restore 612, 618 } diff --git a/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20181225134002_Initial20181225.cs b/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20200218014727_init.cs similarity index 83% rename from modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20181225134002_Initial20181225.cs rename to modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20200218014727_init.cs index abae1bbc04..7e85e1bbc1 100644 --- a/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20181225134002_Initial20181225.cs +++ b/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/20200218014727_init.cs @@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore.Migrations; namespace VoloDocs.EntityFrameworkCore.Migrations { - public partial class Initial20181225 : Migration + public partial class init : Migration { protected override void Up(MigrationBuilder migrationBuilder) { @@ -95,8 +95,8 @@ namespace VoloDocs.EntityFrameworkCore.Migrations NormalizedUserName = table.Column(maxLength: 256, nullable: false), Name = table.Column(maxLength: 64, nullable: true), Surname = table.Column(maxLength: 64, nullable: true), - Email = table.Column(maxLength: 256, nullable: true), - NormalizedEmail = table.Column(maxLength: 256, nullable: true), + Email = table.Column(maxLength: 256, nullable: false), + NormalizedEmail = table.Column(maxLength: 256, nullable: false), EmailConfirmed = table.Column(nullable: false, defaultValue: false), PasswordHash = table.Column(maxLength: 256, nullable: true), SecurityStamp = table.Column(maxLength: 256, nullable: false), @@ -112,6 +112,33 @@ namespace VoloDocs.EntityFrameworkCore.Migrations table.PrimaryKey("PK_AbpUsers", x => x.Id); }); + migrationBuilder.CreateTable( + name: "DocsDocuments", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + ProjectId = table.Column(nullable: false), + Name = table.Column(maxLength: 255, nullable: false), + Version = table.Column(maxLength: 128, nullable: false), + LanguageCode = table.Column(maxLength: 128, nullable: false), + FileName = table.Column(maxLength: 128, nullable: false), + Content = table.Column(nullable: false), + Format = table.Column(maxLength: 128, nullable: true), + EditLink = table.Column(maxLength: 2048, nullable: true), + RootUrl = table.Column(maxLength: 2048, nullable: true), + RawRootUrl = table.Column(maxLength: 2048, nullable: true), + LocalDirectory = table.Column(maxLength: 512, nullable: true), + CreationTime = table.Column(nullable: false), + LastUpdatedTime = table.Column(nullable: false), + LastCachedTime = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_DocsDocuments", x => x.Id); + }); + migrationBuilder.CreateTable( name: "DocsProjects", columns: table => new @@ -124,6 +151,7 @@ namespace VoloDocs.EntityFrameworkCore.Migrations Format = table.Column(nullable: true), DefaultDocumentName = table.Column(maxLength: 128, nullable: false), NavigationDocumentName = table.Column(maxLength: 128, nullable: false), + ParametersDocumentName = table.Column(maxLength: 128, nullable: false), MinimumVersion = table.Column(nullable: true), DocumentStoreType = table.Column(nullable: true), MainWebsiteUrl = table.Column(nullable: true), @@ -180,9 +208,9 @@ namespace VoloDocs.EntityFrameworkCore.Migrations name: "AbpUserLogins", columns: table => new { - TenantId = table.Column(nullable: true), UserId = table.Column(nullable: false), LoginProvider = table.Column(maxLength: 64, nullable: false), + TenantId = table.Column(nullable: true), ProviderKey = table.Column(maxLength: 196, nullable: false), ProviderDisplayName = table.Column(maxLength: 128, nullable: true) }, @@ -201,9 +229,9 @@ namespace VoloDocs.EntityFrameworkCore.Migrations name: "AbpUserRoles", columns: table => new { - TenantId = table.Column(nullable: true), UserId = table.Column(nullable: false), - RoleId = table.Column(nullable: false) + RoleId = table.Column(nullable: false), + TenantId = table.Column(nullable: true) }, constraints: table => { @@ -226,10 +254,10 @@ namespace VoloDocs.EntityFrameworkCore.Migrations name: "AbpUserTokens", columns: table => new { - TenantId = table.Column(nullable: true), UserId = table.Column(nullable: false), LoginProvider = table.Column(maxLength: 64, nullable: false), Name = table.Column(maxLength: 128, nullable: false), + TenantId = table.Column(nullable: true), Value = table.Column(nullable: true) }, constraints: table => @@ -243,6 +271,26 @@ namespace VoloDocs.EntityFrameworkCore.Migrations onDelete: ReferentialAction.Cascade); }); + migrationBuilder.CreateTable( + name: "DocsDocumentContributors", + columns: table => new + { + DocumentId = table.Column(nullable: false), + Username = table.Column(nullable: false), + UserProfileUrl = table.Column(nullable: true), + AvatarUrl = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_DocsDocumentContributors", x => new { x.DocumentId, x.Username }); + table.ForeignKey( + name: "FK_DocsDocumentContributors_DocsDocuments_DocumentId", + column: x => x.DocumentId, + principalTable: "DocsDocuments", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + migrationBuilder.CreateIndex( name: "IX_AbpPermissionGrants_Name_ProviderName_ProviderKey", table: "AbpPermissionGrants", @@ -325,6 +373,9 @@ namespace VoloDocs.EntityFrameworkCore.Migrations migrationBuilder.DropTable( name: "AbpUserTokens"); + migrationBuilder.DropTable( + name: "DocsDocumentContributors"); + migrationBuilder.DropTable( name: "DocsProjects"); @@ -333,6 +384,9 @@ namespace VoloDocs.EntityFrameworkCore.Migrations migrationBuilder.DropTable( name: "AbpUsers"); + + migrationBuilder.DropTable( + name: "DocsDocuments"); } } } diff --git a/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/VoloDocsDbContextModelSnapshot.cs b/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/VoloDocsDbContextModelSnapshot.cs index 0a93515c64..0780f28624 100644 --- a/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/VoloDocsDbContextModelSnapshot.cs +++ b/modules/docs/app/VoloDocs.EntityFrameworkCore/Migrations/VoloDocsDbContextModelSnapshot.cs @@ -15,42 +15,52 @@ namespace VoloDocs.EntityFrameworkCore.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.1.1-rtm-30846") + .HasAnnotation("ProductVersion", "3.1.1") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .IsRequired() .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Description") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("IsStatic"); + b.Property("IsStatic") + .HasColumnType("bit"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Regex") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("RegexDescription") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ValueType"); + b.Property("ValueType") + .HasColumnType("int"); b.HasKey("Id"); @@ -60,35 +70,44 @@ namespace VoloDocs.EntityFrameworkCore.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .IsRequired() .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDefault") - .HasColumnName("IsDefault"); + .HasColumnName("IsDefault") + .HasColumnType("bit"); b.Property("IsPublic") - .HasColumnName("IsPublic"); + .HasColumnName("IsPublic") + .HasColumnType("bit"); b.Property("IsStatic") - .HasColumnName("IsStatic"); + .HasColumnName("IsStatic") + .HasColumnType("bit"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedName") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -100,18 +119,22 @@ namespace VoloDocs.EntityFrameworkCore.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("uniqueidentifier"); b.Property("ClaimType") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -123,105 +146,133 @@ namespace VoloDocs.EntityFrameworkCore.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AccessFailedCount") .ValueGeneratedOnAdd() .HasColumnName("AccessFailedCount") + .HasColumnType("int") .HasDefaultValue(0); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Email") + .IsRequired() .HasColumnName("Email") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("EmailConfirmed") .ValueGeneratedOnAdd() .HasColumnName("EmailConfirmed") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnName("LockoutEnabled") + .HasColumnType("bit") .HasDefaultValue(false); - b.Property("LockoutEnd"); + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); b.Property("Name") .HasColumnName("Name") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("NormalizedEmail") + .IsRequired() .HasColumnName("NormalizedEmail") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedUserName") .IsRequired() .HasColumnName("NormalizedUserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("PasswordHash") .HasColumnName("PasswordHash") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("PhoneNumber") .HasColumnName("PhoneNumber") + .HasColumnType("nvarchar(16)") .HasMaxLength(16); b.Property("PhoneNumberConfirmed") .ValueGeneratedOnAdd() .HasColumnName("PhoneNumberConfirmed") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("SecurityStamp") .IsRequired() .HasColumnName("SecurityStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Surname") .HasColumnName("Surname") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); b.Property("TwoFactorEnabled") .ValueGeneratedOnAdd() .HasColumnName("TwoFactorEnabled") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("UserName") .IsRequired() .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -240,18 +291,22 @@ namespace VoloDocs.EntityFrameworkCore.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("uniqueidentifier"); b.Property("ClaimType") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -262,19 +317,24 @@ namespace VoloDocs.EntityFrameworkCore.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") .IsRequired() + .HasColumnType("nvarchar(196)") .HasMaxLength(196); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("UserId", "LoginProvider"); @@ -285,11 +345,14 @@ namespace VoloDocs.EntityFrameworkCore.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("UserId", "RoleId"); @@ -300,17 +363,22 @@ namespace VoloDocs.EntityFrameworkCore.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Name") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("Value"); + b.Property("Value") + .HasColumnType("nvarchar(max)"); b.HasKey("UserId", "LoginProvider", "Name"); @@ -320,21 +388,26 @@ namespace VoloDocs.EntityFrameworkCore.Migrations modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderName") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -346,20 +419,25 @@ namespace VoloDocs.EntityFrameworkCore.Migrations modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderName") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Value") .IsRequired() + .HasColumnType("nvarchar(2048)") .HasMaxLength(2048); b.HasKey("Id"); @@ -369,43 +447,155 @@ namespace VoloDocs.EntityFrameworkCore.Migrations b.ToTable("AbpSettings"); }); + modelBuilder.Entity("Volo.Docs.Documents.Document", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("Content") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("EditLink") + .HasColumnType("nvarchar(2048)") + .HasMaxLength(2048); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("Format") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("LanguageCode") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("LastCachedTime") + .HasColumnType("datetime2"); + + b.Property("LastUpdatedTime") + .HasColumnType("datetime2"); + + b.Property("LocalDirectory") + .HasColumnType("nvarchar(512)") + .HasMaxLength(512); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(255)") + .HasMaxLength(255); + + b.Property("ProjectId") + .HasColumnType("uniqueidentifier"); + + b.Property("RawRootUrl") + .HasColumnType("nvarchar(2048)") + .HasMaxLength(2048); + + b.Property("RootUrl") + .HasColumnType("nvarchar(2048)") + .HasMaxLength(2048); + + b.Property("Version") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.HasKey("Id"); + + b.ToTable("DocsDocuments"); + }); + + modelBuilder.Entity("Volo.Docs.Documents.DocumentContributor", b => + { + b.Property("DocumentId") + .HasColumnType("uniqueidentifier"); + + b.Property("Username") + .HasColumnType("nvarchar(450)"); + + b.Property("AvatarUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("UserProfileUrl") + .HasColumnType("nvarchar(max)"); + + b.HasKey("DocumentId", "Username"); + + b.ToTable("DocsDocumentContributors"); + }); + modelBuilder.Entity("Volo.Docs.Projects.Project", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("DefaultDocumentName") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("DocumentStoreType"); + b.Property("DocumentStoreType") + .HasColumnType("nvarchar(max)"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("Format"); + b.Property("Format") + .HasColumnType("nvarchar(max)"); b.Property("LatestVersionBranchName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("MainWebsiteUrl"); + b.Property("MainWebsiteUrl") + .HasColumnType("nvarchar(max)"); - b.Property("MinimumVersion"); + b.Property("MinimumVersion") + .HasColumnType("nvarchar(max)"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("NavigationDocumentName") .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("ParametersDocumentName") + .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ShortName") .IsRequired() + .HasColumnType("nvarchar(32)") .HasMaxLength(32); b.HasKey("Id"); @@ -415,47 +605,62 @@ namespace VoloDocs.EntityFrameworkCore.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => { - b.HasOne("Volo.Abp.Identity.IdentityRole") + b.HasOne("Volo.Abp.Identity.IdentityRole", null) .WithMany("Claims") .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Claims") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Logins") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { - b.HasOne("Volo.Abp.Identity.IdentityRole") + b.HasOne("Volo.Abp.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Roles") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Tokens") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Docs.Documents.DocumentContributor", b => + { + b.HasOne("Volo.Docs.Documents.Document", null) + .WithMany("Contributors") + .HasForeignKey("DocumentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); #pragma warning restore 612, 618 } diff --git a/modules/docs/app/VoloDocs.EntityFrameworkCore/VoloDocs.EntityFrameworkCore.csproj b/modules/docs/app/VoloDocs.EntityFrameworkCore/VoloDocs.EntityFrameworkCore.csproj index d7f8b49bae..b2b54a234f 100644 --- a/modules/docs/app/VoloDocs.EntityFrameworkCore/VoloDocs.EntityFrameworkCore.csproj +++ b/modules/docs/app/VoloDocs.EntityFrameworkCore/VoloDocs.EntityFrameworkCore.csproj @@ -1,7 +1,9 @@ - + + + - netstandard2.1 + netstandard2.0 diff --git a/modules/docs/app/VoloDocs.Migrator/FodyWeavers.xml b/modules/docs/app/VoloDocs.Migrator/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/docs/app/VoloDocs.Migrator/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/docs/app/VoloDocs.Migrator/FodyWeavers.xsd b/modules/docs/app/VoloDocs.Migrator/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/docs/app/VoloDocs.Migrator/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/docs/app/VoloDocs.Migrator/VoloDocs.Migrator.csproj b/modules/docs/app/VoloDocs.Migrator/VoloDocs.Migrator.csproj index 7304dda469..e1fba61428 100644 --- a/modules/docs/app/VoloDocs.Migrator/VoloDocs.Migrator.csproj +++ b/modules/docs/app/VoloDocs.Migrator/VoloDocs.Migrator.csproj @@ -1,4 +1,6 @@ - + + + netcoreapp3.1 diff --git a/modules/docs/app/VoloDocs.Web/FodyWeavers.xml b/modules/docs/app/VoloDocs.Web/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/docs/app/VoloDocs.Web/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/docs/app/VoloDocs.Web/FodyWeavers.xsd b/modules/docs/app/VoloDocs.Web/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/docs/app/VoloDocs.Web/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/docs/app/VoloDocs.Web/Localization/Resources/VoloDocs/Web/zh-Hant.json b/modules/docs/app/VoloDocs.Web/Localization/Resources/VoloDocs/Web/zh-Hant.json new file mode 100644 index 0000000000..643b875562 --- /dev/null +++ b/modules/docs/app/VoloDocs.Web/Localization/Resources/VoloDocs/Web/zh-Hant.json @@ -0,0 +1,10 @@ +{ + "culture": "zh-Hant", + "texts": { + "DocsTitle": "VoloDocs", + "WelcomeVoloDocs": "歡迎使用VoloDocs!", + "NoProjectWarning": "目前沒有專案!", + "CreateYourFirstProject": "建立您的第一個專案", + "NoProject": "沒有專案!" + } +} \ No newline at end of file diff --git a/modules/docs/app/VoloDocs.Web/VoloDocs.Web.csproj b/modules/docs/app/VoloDocs.Web/VoloDocs.Web.csproj index ef8fc992e3..3cc24371b8 100644 --- a/modules/docs/app/VoloDocs.Web/VoloDocs.Web.csproj +++ b/modules/docs/app/VoloDocs.Web/VoloDocs.Web.csproj @@ -1,5 +1,7 @@  + + netcoreapp3.1 true @@ -14,9 +16,13 @@ - + - + + + all + runtime; build; native; contentfiles; analyzers + @@ -32,6 +38,7 @@ + diff --git a/modules/docs/app/VoloDocs.Web/VoloDocsWebModule.cs b/modules/docs/app/VoloDocs.Web/VoloDocsWebModule.cs index 3e37206f31..d46ae6e021 100644 --- a/modules/docs/app/VoloDocs.Web/VoloDocsWebModule.cs +++ b/modules/docs/app/VoloDocs.Web/VoloDocsWebModule.cs @@ -31,6 +31,7 @@ using VoloDocs.EntityFrameworkCore; using Localization.Resources.AbpUi; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Hosting; +using Volo.Abp.Account; using Volo.Abp.Validation.Localization; namespace VoloDocs.Web @@ -43,6 +44,7 @@ namespace VoloDocs.Web typeof(VoloDocsEntityFrameworkCoreModule), typeof(AbpAutofacModule), typeof(AbpAccountWebModule), + typeof(AbpAccountApplicationModule), typeof(AbpIdentityWebModule), typeof(AbpIdentityApplicationModule), typeof(AbpPermissionManagementDomainIdentityModule), @@ -142,6 +144,12 @@ namespace VoloDocs.Web var env = context.GetEnvironment(); app.UseVirtualFiles(); + app.UseRouting(); + + app.UseAuthentication(); + app.UseAuthorization(); + + app.UseAbpRequestLocalization(); app.UseSwagger(); app.UseSwaggerUI(options => @@ -149,24 +157,11 @@ namespace VoloDocs.Web options.SwaggerEndpoint("/swagger/v1/swagger.json", "Support APP API"); }); - app.UseAuthentication(); - - app.UseAbpRequestLocalization(); - app.UseStatusCodePagesWithReExecute("/error/{0}"); //app.UseMiddleware(); - app.UseMvc(routes => - { - routes.MapRoute( - name: "defaultWithArea", - template: "{area}/{controller=Home}/{action=Index}/{id?}"); - - routes.MapRoute( - name: "default", - template: "{controller=Home}/{action=Index}/{id?}"); - }); + app.UseMvcWithDefaultRouteAndArea(); using (var scope = context.ServiceProvider.CreateScope()) { diff --git a/modules/docs/screenshot.png b/modules/docs/screenshot.png deleted file mode 100644 index 55ff411f0c..0000000000 Binary files a/modules/docs/screenshot.png and /dev/null differ diff --git a/modules/docs/screenshot2.png b/modules/docs/screenshot2.png new file mode 100644 index 0000000000..0dcdf921b9 Binary files /dev/null and b/modules/docs/screenshot2.png differ diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/FodyWeavers.xml b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/FodyWeavers.xsd b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo.Docs.Admin.Application.Contracts.csproj b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo.Docs.Admin.Application.Contracts.csproj index 2805d03357..16ef215c5c 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo.Docs.Admin.Application.Contracts.csproj +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo.Docs.Admin.Application.Contracts.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/DocsAdminPermissionDefinitionProvider.cs b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/DocsAdminPermissionDefinitionProvider.cs index 9ad0411d15..c7bb12e3bb 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/DocsAdminPermissionDefinitionProvider.cs +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/DocsAdminPermissionDefinitionProvider.cs @@ -14,6 +14,9 @@ namespace Volo.Docs.Admin projects.AddChild(DocsAdminPermissions.Projects.Update, L("Permission:Edit")); projects.AddChild(DocsAdminPermissions.Projects.Delete, L("Permission:Delete")); projects.AddChild(DocsAdminPermissions.Projects.Create, L("Permission:Create")); + + group.AddPermission(DocsAdminPermissions.Documents.Default, L("Permission:Documents")); + } private static LocalizableString L(string name) diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/DocsAdminPermissions.cs b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/DocsAdminPermissions.cs index 341f4c5819..26c1c46254 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/DocsAdminPermissions.cs +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/DocsAdminPermissions.cs @@ -14,6 +14,12 @@ namespace Volo.Docs.Admin public const string Create = Default + ".Create"; } + public static class Documents + { + public const string Default = GroupName + ".Documents"; + } + + public static string[] GetAll() { return ReflectionHelper.GetPublicConstantsRecursively(typeof(DocsAdminPermissions)); diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/IDocumentAdminAppService.cs b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/IDocumentAdminAppService.cs new file mode 100644 index 0000000000..6adab29c74 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/IDocumentAdminAppService.cs @@ -0,0 +1,12 @@ +using System.Threading.Tasks; +using Volo.Abp.Application.Services; + +namespace Volo.Docs.Admin.Documents +{ + public interface IDocumentAdminAppService : IApplicationService + { + Task PullAllAsync(PullAllDocumentInput input); + + Task PullAsync(PullDocumentInput input); + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/PullAllDocumentInput.cs b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/PullAllDocumentInput.cs new file mode 100644 index 0000000000..d796c00e64 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/PullAllDocumentInput.cs @@ -0,0 +1,17 @@ +using System; +using System.ComponentModel.DataAnnotations; +using Volo.Docs.Documents; + +namespace Volo.Docs.Admin.Documents +{ + public class PullAllDocumentInput + { + public Guid ProjectId { get; set; } + + [StringLength(DocumentConsts.MaxLanguageCodeNameLength)] + public string LanguageCode { get; set; } + + [StringLength(DocumentConsts.MaxVersionNameLength)] + public string Version { get; set; } + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/PullDocumentInput.cs b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/PullDocumentInput.cs new file mode 100644 index 0000000000..fcc9816b02 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Documents/PullDocumentInput.cs @@ -0,0 +1,20 @@ +using System; +using System.ComponentModel.DataAnnotations; +using Volo.Docs.Documents; + +namespace Volo.Docs.Admin.Documents +{ + public class PullDocumentInput + { + public Guid ProjectId { get; set; } + + [StringLength(DocumentConsts.MaxNameLength)] + public string Name { get; set; } + + [StringLength(DocumentConsts.MaxLanguageCodeNameLength)] + public string LanguageCode { get; set; } + + [StringLength(DocumentConsts.MaxVersionNameLength)] + public string Version { get; set; } + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/en.json b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/en.json index 58cff5aa2e..708088b6a6 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/en.json +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/en.json @@ -6,11 +6,13 @@ "Permission:Edit": "Edit", "Permission:Delete": "Delete", "Permission:Create": "Create", + "Permission:Documents": "Documents", "Menu:DocumentManagement": "Documents", "Menu:ProjectManagement": "Projects", "CreateANewProject": "Create new project", "Edit": "Edit", "Create": "Create", + "Pull": "Pull", "Projects": "Projects", "Name": "Name", "ShortName": "ShortName", @@ -27,6 +29,9 @@ "DisplayName:LatestVersionBranchName": "Latest version branch name", "DisplayName:GitHubRootUrl": "GitHub root URL", "DisplayName:GitHubAccessToken": "GitHub access token", - "DisplayName:GitHubUserAgent": "GitHub user agent" + "DisplayName:GitHubUserAgent": "GitHub user agent", + "DisplayName:All": "Pull all", + "DisplayName:LanguageCode": "Language code", + "DisplayName:Version": "Version" } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/tr.json b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/tr.json index 8c31fb1c5a..c40893e538 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/tr.json +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/tr.json @@ -6,11 +6,13 @@ "Permission:Edit": "Düzenle", "Permission:Delete": "Sil", "Permission:Create": "Oluştur", + "Permission:Documents": "Döküman", "Menu:DocumentManagement": "Dökümanlar", "Menu:ProjectManagement": "Projeler", "CreateANewProject": "Yeni proje oluştur", "Edit": "Düzenle", "Create": "Yeni oluştur", + "Pull": "çekme", "Projects": "Projeler", "Name": "İsim", "ShortName": "Kısa isim", @@ -26,6 +28,9 @@ "DisplayName:MainWebsiteUrl": "Ana web site URL", "DisplayName:LatestVersionBranchName": "Son versiyon Branch adı", "DisplayName:GitHubRootUrl": "GitHub kök adresi", - "DisplayName:GitHubAccessToken": "GitHub erişim token" + "DisplayName:GitHubAccessToken": "GitHub erişim token", + "DisplayName:All": "Çekme bütün", + "DisplayName:LanguageCode": "Dil kodu", + "DisplayName:Version": "versiyon" } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/zh-Hans.json b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/zh-Hans.json index 3c540e8154..039be20995 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/zh-Hans.json +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/zh-Hans.json @@ -6,11 +6,13 @@ "Permission:Edit": "编辑", "Permission:Delete": "删除", "Permission:Create": "创建", + "Permission:Documents": "文档", "Menu:DocumentManagement": "文档", "Menu:ProjectManagement": "项目", "CreateANewProject": "创建新项目", "Edit": "编辑", "Create": "创建", + "Pull": "拉取", "Projects": "项目", "Name": "名称", "ShortName": "简称", @@ -27,6 +29,9 @@ "DisplayName:LatestVersionBranchName": "最新版本的分支名称", "DisplayName:GitHubRootUrl": "GitHub根网址", "DisplayName:GitHubAccessToken": "GitHub访问令牌", - "DisplayName:GitHubUserAgent": "GitHub用户代理" + "DisplayName:GitHubUserAgent": "GitHub用户代理", + "DisplayName:All": "拉取所有", + "DisplayName:LanguageCode": "语言代码", + "DisplayName:Version": "版本" } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/zh-Hant.json b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/zh-Hant.json new file mode 100644 index 0000000000..910194094d --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/Localization/Resources/Docs/ApplicationContracts/zh-Hant.json @@ -0,0 +1,37 @@ +{ + "culture": "zh-Hant", + "texts": { + "Permission:DocumentManagement": "文件管理", + "Permission:Projects": "專案", + "Permission:Edit": "編輯", + "Permission:Delete": "刪除", + "Permission:Create": "建立", + "Permission:Documents": "文件", + "Menu:DocumentManagement": "文件管理", + "Menu:ProjectManagement": "專案管理", + "CreateANewProject": "建立新專案", + "Edit": "編輯", + "Create": "建立", + "Pull": "拉取", + "Projects": "專案", + "Name": "名稱", + "ShortName": "簡稱", + "DocumentStoreType": "文件存儲類型", + "Format": "格式", + "ShortNameInfoText": "將用於唯一的URL.", + "DisplayName:Name": "名稱", + "DisplayName:ShortName": "簡稱", + "DisplayName:Format": "格式", + "DisplayName:DefaultDocumentName": "預設文件名稱", + "DisplayName:NavigationDocumentName": "導覽文件名稱", + "DisplayName:MinimumVersion": "最低版本", + "DisplayName:MainWebsiteUrl": "主網站網址", + "DisplayName:LatestVersionBranchName": "最新版本的分支名稱", + "DisplayName:GitHubRootUrl": "GitHub根網址", + "DisplayName:GitHubAccessToken": "GitHub 存取Token ", + "DisplayName:GitHubUserAgent": "GitHub 使用者代理", + "DisplayName:All": "拉取所有", + "DisplayName:LanguageCode": "語言代碼", + "DisplayName:Version": "版本" + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Application/FodyWeavers.xml b/modules/docs/src/Volo.Docs.Admin.Application/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Application/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Application/FodyWeavers.xsd b/modules/docs/src/Volo.Docs.Admin.Application/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Application/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Application/Volo.Docs.Admin.Application.csproj b/modules/docs/src/Volo.Docs.Admin.Application/Volo.Docs.Admin.Application.csproj index 73d2afc26b..666b4dd79d 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application/Volo.Docs.Admin.Application.csproj +++ b/modules/docs/src/Volo.Docs.Admin.Application/Volo.Docs.Admin.Application.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Documents/DocumentAdminAppService.cs b/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Documents/DocumentAdminAppService.cs new file mode 100644 index 0000000000..255fed246f --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Documents/DocumentAdminAppService.cs @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Newtonsoft.Json; +using Volo.Abp.Application.Services; +using Volo.Abp.Caching; +using Volo.Docs.Documents; +using Volo.Docs.Projects; + +namespace Volo.Docs.Admin.Documents +{ + [Authorize(DocsAdminPermissions.Documents.Default)] + public class DocumentAdminAppService : ApplicationService, IDocumentAdminAppService + { + private readonly IProjectRepository _projectRepository; + private readonly IDocumentRepository _documentRepository; + private readonly IDocumentSourceFactory _documentStoreFactory; + private readonly IDistributedCache _documentUpdateCache; + + public DocumentAdminAppService(IProjectRepository projectRepository, + IDocumentRepository documentRepository, + IDocumentSourceFactory documentStoreFactory, + IDistributedCache documentUpdateCache) + { + _projectRepository = projectRepository; + _documentRepository = documentRepository; + _documentStoreFactory = documentStoreFactory; + _documentUpdateCache = documentUpdateCache; + } + + public async Task PullAllAsync(PullAllDocumentInput input) + { + var project = await _projectRepository.GetAsync(input.ProjectId); + + var navigationFile = await GetDocumentAsync( + project, + project.NavigationDocumentName, + input.LanguageCode, + input.Version + ); + + var nav = JsonConvert.DeserializeObject(navigationFile.Content); + var leafs = nav.Items.GetAllNodes(x => x.Items) + .Where(x => x.IsLeaf && !x.Path.IsNullOrWhiteSpace()) + .ToList(); + + var source = _documentStoreFactory.Create(project.DocumentStoreType); + + var documents = new List(); + foreach (var leaf in leafs) + { + var sourceDocument = + await source.GetDocumentAsync(project, leaf.Path, input.LanguageCode, input.Version); + documents.Add(sourceDocument); + } + + foreach (var document in documents) + { + await _documentRepository.DeleteAsync(document.ProjectId, document.Name, + document.LanguageCode, + document.Version); + + await _documentRepository.InsertAsync(document, true); + await UpdateDocumentUpdateInfoCache(document); + } + } + + public async Task PullAsync(PullDocumentInput input) + { + var project = await _projectRepository.GetAsync(input.ProjectId); + + var source = _documentStoreFactory.Create(project.DocumentStoreType); + var sourceDocument = await source.GetDocumentAsync(project, input.Name, input.LanguageCode, input.Version); + + await _documentRepository.DeleteAsync(sourceDocument.ProjectId, sourceDocument.Name, + sourceDocument.LanguageCode, sourceDocument.Version); + await _documentRepository.InsertAsync(sourceDocument, true); + await UpdateDocumentUpdateInfoCache(sourceDocument); + } + + private async Task UpdateDocumentUpdateInfoCache(Document document) + { + var cacheKey = $"DocumentUpdateInfo{document.ProjectId}#{document.Name}#{document.LanguageCode}#{document.Version}"; + await _documentUpdateCache.SetAsync(cacheKey, new DocumentUpdateInfo + { + Name = document.Name, + CreationTime = document.CreationTime, + LastUpdatedTime = document.LastUpdatedTime + }); + } + + private async Task GetDocumentAsync( + Project project, + string documentName, + string languageCode, + string version) + { + version = string.IsNullOrWhiteSpace(version) ? project.LatestVersionBranchName : version; + var source = _documentStoreFactory.Create(project.DocumentStoreType); + var document = await source.GetDocumentAsync(project, documentName, languageCode, version); + return document; + } + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.HttpApi.Client/FodyWeavers.xml b/modules/docs/src/Volo.Docs.Admin.HttpApi.Client/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.HttpApi.Client/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.HttpApi.Client/FodyWeavers.xsd b/modules/docs/src/Volo.Docs.Admin.HttpApi.Client/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.HttpApi.Client/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.HttpApi.Client/Volo.Docs.Admin.HttpApi.Client.csproj b/modules/docs/src/Volo.Docs.Admin.HttpApi.Client/Volo.Docs.Admin.HttpApi.Client.csproj index 13f2faebf5..50e135a237 100644 --- a/modules/docs/src/Volo.Docs.Admin.HttpApi.Client/Volo.Docs.Admin.HttpApi.Client.csproj +++ b/modules/docs/src/Volo.Docs.Admin.HttpApi.Client/Volo.Docs.Admin.HttpApi.Client.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/docs/src/Volo.Docs.Admin.HttpApi/FodyWeavers.xml b/modules/docs/src/Volo.Docs.Admin.HttpApi/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.HttpApi/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.HttpApi/FodyWeavers.xsd b/modules/docs/src/Volo.Docs.Admin.HttpApi/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.HttpApi/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo.Docs.Admin.HttpApi.csproj b/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo.Docs.Admin.HttpApi.csproj index ef87e7a6e4..eb0da981f4 100644 --- a/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo.Docs.Admin.HttpApi.csproj +++ b/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo.Docs.Admin.HttpApi.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo/Docs/Admin/DocumentsAdminController.cs b/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo/Docs/Admin/DocumentsAdminController.cs new file mode 100644 index 0000000000..75f610d3e5 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo/Docs/Admin/DocumentsAdminController.cs @@ -0,0 +1,36 @@ +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Volo.Abp; +using Volo.Abp.AspNetCore.Mvc; +using Volo.Docs.Admin.Documents; + +namespace Volo.Docs.Admin +{ + [RemoteService] + [Area("docs")] + [ControllerName("DocumentsAdmin")] + [Route("api/docs/admin/documents")] + public class DocumentsAdminController : AbpController, IDocumentAdminAppService + { + private readonly IDocumentAdminAppService _documentAdminAppService; + + public DocumentsAdminController(IDocumentAdminAppService documentAdminAppService) + { + _documentAdminAppService = documentAdminAppService; + } + + [HttpPost] + [Route("PullAll")] + public Task PullAllAsync(PullAllDocumentInput input) + { + return _documentAdminAppService.PullAllAsync(input); + } + + [HttpPost] + [Route("Pull")] + public Task PullAsync(PullDocumentInput input) + { + return _documentAdminAppService.PullAsync(input); + } + } +} diff --git a/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebAutoMapperProfile.cs b/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebAutoMapperProfile.cs index 9bf81c2140..ca430cdaad 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebAutoMapperProfile.cs +++ b/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebAutoMapperProfile.cs @@ -1,5 +1,6 @@ using AutoMapper; using Volo.Abp.AutoMapper; +using Volo.Docs.Admin.Documents; using Volo.Docs.Admin.Pages.Docs.Admin.Projects; using Volo.Docs.Admin.Projects; @@ -15,6 +16,9 @@ namespace Volo.Docs.Admin CreateMap () .Ignore(x => x.GitHubAccessToken).Ignore(x => x.GitHubRootUrl).Ignore(x => x.GitHubUserAgent); + + CreateMap(); + CreateMap(); } } } diff --git a/modules/docs/src/Volo.Docs.Admin.Web/FodyWeavers.xml b/modules/docs/src/Volo.Docs.Admin.Web/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Web/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Web/FodyWeavers.xsd b/modules/docs/src/Volo.Docs.Admin.Web/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Web/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Index.cshtml b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Index.cshtml index a72506d978..e3c0416b6d 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Index.cshtml +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Index.cshtml @@ -20,6 +20,7 @@ + } diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Pull.cshtml b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Pull.cshtml new file mode 100644 index 0000000000..6257971669 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Pull.cshtml @@ -0,0 +1,22 @@ +@page +@using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Modal +@using Volo.Docs.Admin.Pages.Docs.Admin.Projects +@inherits Volo.Docs.Admin.Pages.Docs.Admin.DocsAdminPage +@model Volo.Docs.Admin.Pages.Docs.Admin.Projects.PullModel +@{ + Layout = null; +} + +@if (Model.PullDocument != null) +{ + + + + + + + + + + +} diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Pull.cshtml.cs b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Pull.cshtml.cs new file mode 100644 index 0000000000..dd1b5c2ac9 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Pull.cshtml.cs @@ -0,0 +1,75 @@ +using System; +using System.ComponentModel.DataAnnotations; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Volo.Docs.Admin.Documents; +using Volo.Docs.Admin.Projects; +using Volo.Docs.Documents; + +namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects +{ + public class PullModel : DocsAdminPageModel + { + [BindProperty] + public PullDocumentViewModel PullDocument { get; set; } + + private readonly IProjectAdminAppService _projectAppService; + private readonly IDocumentAdminAppService _documentAppService; + + public PullModel(IProjectAdminAppService projectAppService, + IDocumentAdminAppService documentAppService) + { + _projectAppService = projectAppService; + _documentAppService = documentAppService; + } + + public async Task OnGetAsync(Guid id) + { + var project = await _projectAppService.GetAsync(id); + + PullDocument = new PullDocumentViewModel() + { + ProjectId = project.Id, + All = false + }; + + return Page(); + } + + public async Task OnPostAsync() + { + if (PullDocument.All) + { + await _documentAppService.PullAllAsync( + ObjectMapper.Map(PullDocument)); + } + else + { + await _documentAppService.PullAsync( + ObjectMapper.Map(PullDocument)); + } + + return NoContent(); + } + + public class PullDocumentViewModel + { + [HiddenInput] + public Guid ProjectId { get; set; } + + public bool All { get; set; } + + [Required] + [StringLength(DocumentConsts.MaxNameLength)] + public string Name { get; set; } + + [Required] + [StringLength(DocumentConsts.MaxLanguageCodeNameLength)] + public string LanguageCode { get; set; } + + [Required] + [StringLength(DocumentConsts.MaxVersionNameLength)] + public string Version { get; set; } + } + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Pull.js b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Pull.js new file mode 100644 index 0000000000..8c62b5de34 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Pull.js @@ -0,0 +1,23 @@ +var abp = abp || {}; + +$(function () { + abp.modals.projectPull = function () { + var initModal = function (publicApi, args) { + var $form = publicApi.getForm(); + var fg = $form.find("#PullDocument_Name").parent(); + var nameInput = fg.html(); + + $form.find("input:checkbox").change(function() { + if ($(this).prop("checked")) { + fg.html(""); + } else { + fg.html(nameInput); + } + }); + }; + + return { + initModal: initModal + }; + }; +}); \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/index.js b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/index.js index f1ce283543..b843202dd9 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/index.js +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/index.js @@ -12,10 +12,16 @@ modalClass: 'projectEdit' }); + var _pullModal = new abp.ModalManager({ + viewUrl: abp.appPath + 'Docs/Admin/Projects/Pull', + modalClass: 'projectPull' + }); + var _dataTable = $('#ProjectsTable').DataTable(abp.libs.datatables.normalizeConfiguration({ processing: true, serverSide: true, + scrollX: true, paging: true, searching: false, autoWidth: false, @@ -47,6 +53,15 @@ _dataTable.ajax.reload(); }); } + }, + { + text: l('Pull'), + visible: abp.auth.isGranted('Docs.Admin.Documents'), + action: function (data) { + _pullModal.open({ + Id: data.record.id + }); + } } ] } diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Volo.Docs.Admin.Web.csproj b/modules/docs/src/Volo.Docs.Admin.Web/Volo.Docs.Admin.Web.csproj index ab6da2e1d0..4cad3d9e71 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/Volo.Docs.Admin.Web.csproj +++ b/modules/docs/src/Volo.Docs.Admin.Web/Volo.Docs.Admin.Web.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/docs/src/Volo.Docs.Application.Contracts/FodyWeavers.xml b/modules/docs/src/Volo.Docs.Application.Contracts/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Application.Contracts/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Application.Contracts/FodyWeavers.xsd b/modules/docs/src/Volo.Docs.Application.Contracts/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Application.Contracts/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Application.Contracts/Volo.Docs.Application.Contracts.csproj b/modules/docs/src/Volo.Docs.Application.Contracts/Volo.Docs.Application.Contracts.csproj index 2dc6d77b21..15df62ac54 100644 --- a/modules/docs/src/Volo.Docs.Application.Contracts/Volo.Docs.Application.Contracts.csproj +++ b/modules/docs/src/Volo.Docs.Application.Contracts/Volo.Docs.Application.Contracts.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/DocumentWithDetailsDto.cs b/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/DocumentWithDetailsDto.cs index 44b2ef6861..0364a2e26f 100644 --- a/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/DocumentWithDetailsDto.cs +++ b/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/DocumentWithDetailsDto.cs @@ -7,23 +7,31 @@ namespace Volo.Docs.Documents [Serializable] public class DocumentWithDetailsDto { - public string Title { get; set; } + public virtual string Name { get; set; } - public string Content { get; set; } + public virtual string Version { get; set; } - public string Format { get; set; } + public virtual string LanguageCode { get; set; } - public string EditLink { get; set; } + public virtual string FileName { get; set; } - public string RootUrl { get; set; } + public virtual string Content { get; set; } - public string RawRootUrl { get; set; } + public virtual string Format { get; set; } - public string Version { get; set; } + public virtual string EditLink { get; set; } - public string LocalDirectory { get; set; } + public virtual string RootUrl { get; set; } - public string FileName { get; set; } + public virtual string RawRootUrl { get; set; } + + public virtual string LocalDirectory { get; set; } + + public virtual DateTime CreationTime { get; set; } + + public virtual DateTime LastUpdatedTime { get; set; } + + public virtual DateTime LastCachedTime { get; set; } public ProjectDto Project { get; set; } diff --git a/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/IDocumentAppService.cs b/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/IDocumentAppService.cs index cfc4840824..b1195e0254 100644 --- a/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/IDocumentAppService.cs +++ b/modules/docs/src/Volo.Docs.Application.Contracts/Volo/Docs/Documents/IDocumentAppService.cs @@ -9,7 +9,7 @@ namespace Volo.Docs.Documents Task GetDefaultAsync(GetDefaultDocumentInput input); - Task GetNavigationAsync(GetNavigationDocumentInput input); + Task GetNavigationAsync(GetNavigationDocumentInput input); Task GetParametersAsync(GetParametersDocumentInput input); diff --git a/modules/docs/src/Volo.Docs.Application/FodyWeavers.xml b/modules/docs/src/Volo.Docs.Application/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Application/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Application/FodyWeavers.xsd b/modules/docs/src/Volo.Docs.Application/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Application/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Application/Volo.Docs.Application.csproj b/modules/docs/src/Volo.Docs.Application/Volo.Docs.Application.csproj index 1d2f977806..1009305c17 100644 --- a/modules/docs/src/Volo.Docs.Application/Volo.Docs.Application.csproj +++ b/modules/docs/src/Volo.Docs.Application/Volo.Docs.Application.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/docs/src/Volo.Docs.Application/Volo/Docs/Documents/DocumentAppService.cs b/modules/docs/src/Volo.Docs.Application/Volo/Docs/Documents/DocumentAppService.cs index b3b2a05b53..7ea04ec0c0 100644 --- a/modules/docs/src/Volo.Docs.Application/Volo/Docs/Documents/DocumentAppService.cs +++ b/modules/docs/src/Volo.Docs.Application/Volo/Docs/Documents/DocumentAppService.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using Microsoft.Extensions.Caching.Distributed; using Microsoft.Extensions.Hosting; @@ -13,24 +14,27 @@ namespace Volo.Docs.Documents public class DocumentAppService : DocsAppServiceBase, IDocumentAppService { private readonly IProjectRepository _projectRepository; - private readonly IDocumentStoreFactory _documentStoreFactory; - protected IDistributedCache DocumentCache { get; } + private readonly IDocumentRepository _documentRepository; + private readonly IDocumentSourceFactory _documentStoreFactory; protected IDistributedCache LanguageCache { get; } protected IDistributedCache ResourceCache { get; } + protected IDistributedCache DocumentUpdateCache { get; } protected IHostEnvironment HostEnvironment { get; } public DocumentAppService( IProjectRepository projectRepository, - IDocumentStoreFactory documentStoreFactory, - IDistributedCache documentCache, + IDocumentRepository documentRepository, + IDocumentSourceFactory documentStoreFactory, IDistributedCache languageCache, - IDistributedCache resourceCache, + IDistributedCache resourceCache, + IDistributedCache documentUpdateCache, IHostEnvironment hostEnvironment) { _projectRepository = projectRepository; + _documentRepository = documentRepository; _documentStoreFactory = documentStoreFactory; - DocumentCache = documentCache; LanguageCache = languageCache; ResourceCache = resourceCache; + DocumentUpdateCache = documentUpdateCache; HostEnvironment = hostEnvironment; } @@ -58,16 +62,35 @@ namespace Volo.Docs.Documents ); } - public virtual async Task GetNavigationAsync(GetNavigationDocumentInput input) + public virtual async Task GetNavigationAsync(GetNavigationDocumentInput input) { var project = await _projectRepository.GetAsync(input.ProjectId); - return await GetDocumentWithDetailsDtoAsync( + var navigationDocument = await GetDocumentWithDetailsDtoAsync( project, project.NavigationDocumentName, input.LanguageCode, input.Version ); + + var navigationNode = JsonConvert.DeserializeObject(navigationDocument.Content); + + var leafs = navigationNode.Items.GetAllNodes(x => x.Items) + .Where(x => !x.Path.IsNullOrWhiteSpace()) + .ToList(); + + foreach (var leaf in leafs) + { + var cacheKey = $"DocumentUpdateInfo{project.Id}#{leaf.Path}#{input.LanguageCode}#{input.Version}"; + var documentUpdateInfo = await DocumentUpdateCache.GetAsync(cacheKey); + if (documentUpdateInfo != null) + { + leaf.CreationTime = documentUpdateInfo.CreationTime; + leaf.LastUpdatedTime = documentUpdateInfo.LastUpdatedTime; + } + } + + return navigationNode; } public async Task GetResourceAsync(GetDocumentResourceInput input) @@ -78,8 +101,8 @@ namespace Volo.Docs.Documents async Task GetResourceAsync() { - var store = _documentStoreFactory.Create(project.DocumentStoreType); - var documentResource = await store.GetResource(project, input.Name, input.LanguageCode, input.Version); + var source = _documentStoreFactory.Create(project.DocumentStoreType); + var documentResource = await source.GetResource(project, input.Name, input.LanguageCode, input.Version); return ObjectMapper.Map(documentResource); } @@ -107,6 +130,11 @@ namespace Volo.Docs.Documents try { + if (string.IsNullOrWhiteSpace(project.ParametersDocumentName)) + { + return await Task.FromResult(null); + } + var document = await GetDocumentWithDetailsDtoAsync( project, project.ParametersDocumentName, @@ -131,15 +159,27 @@ namespace Volo.Docs.Documents { version = string.IsNullOrWhiteSpace(version) ? project.LatestVersionBranchName : version; - var cacheKey = $"Document@{project.ShortName}#{languageCode}#{documentName}#{version}"; - async Task GetDocumentAsync() { - Logger.LogInformation($"Not found in the cache. Requesting {documentName} from the store..."); - var store = _documentStoreFactory.Create(project.DocumentStoreType); - var document = await store.GetDocumentAsync(project, documentName, languageCode, version); + Logger.LogInformation($"Not found in the cache. Requesting {documentName} from the source..."); + + var source = _documentStoreFactory.Create(project.DocumentStoreType); + var sourceDocument = await source.GetDocumentAsync(project, documentName, languageCode, version); + + await _documentRepository.DeleteAsync(project.Id, sourceDocument.Name, sourceDocument.LanguageCode, sourceDocument.Version); + await _documentRepository.InsertAsync(sourceDocument, true); + Logger.LogInformation($"Document retrieved: {documentName}"); - return CreateDocumentWithDetailsDto(project, document); + + var cacheKey = $"DocumentUpdateInfo{sourceDocument.ProjectId}#{sourceDocument.Name}#{sourceDocument.LanguageCode}#{sourceDocument.Version}"; + await DocumentUpdateCache.SetAsync(cacheKey, new DocumentUpdateInfo + { + Name = sourceDocument.Name, + CreationTime = sourceDocument.CreationTime, + LastUpdatedTime = sourceDocument.LastUpdatedTime + }); + + return CreateDocumentWithDetailsDto(project, sourceDocument); } if (HostEnvironment.IsDevelopment()) @@ -147,16 +187,30 @@ namespace Volo.Docs.Documents return await GetDocumentAsync(); } - return await DocumentCache.GetOrAddAsync( - cacheKey, - GetDocumentAsync, - () => new DistributedCacheEntryOptions - { - //TODO: Configurable? - AbsoluteExpirationRelativeToNow = TimeSpan.FromHours(2), - SlidingExpiration = TimeSpan.FromMinutes(30) - } - ); + var document = await _documentRepository.FindAsync(project.Id, documentName, languageCode, version); + if (document == null) + { + return await GetDocumentAsync(); + } + + //Only the latest version (dev) of the document needs to update the cache. + if (!project.LatestVersionBranchName.IsNullOrWhiteSpace() && + document.Version == project.LatestVersionBranchName && + //TODO: Configurable cache time? + document.LastCachedTime + TimeSpan.FromHours(2) < DateTime.Now) + { + return await GetDocumentAsync(); + } + + var cacheKey = $"DocumentUpdateInfo{document.ProjectId}#{document.Name}#{document.LanguageCode}#{document.Version}"; + await DocumentUpdateCache.SetAsync(cacheKey, new DocumentUpdateInfo + { + Name = document.Name, + CreationTime = document.CreationTime, + LastUpdatedTime = document.LastUpdatedTime, + }); + + return CreateDocumentWithDetailsDto(project, document); } protected virtual DocumentWithDetailsDto CreateDocumentWithDetailsDto(Project project, Document document) @@ -166,6 +220,5 @@ namespace Volo.Docs.Documents documentDto.Contributors = ObjectMapper.Map, List>(document.Contributors); return documentDto; } - } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Application/Volo/Docs/Projects/ProjectAppService.cs b/modules/docs/src/Volo.Docs.Application/Volo/Docs/Projects/ProjectAppService.cs index 13d2ad0ced..c05857f588 100644 --- a/modules/docs/src/Volo.Docs.Application/Volo/Docs/Projects/ProjectAppService.cs +++ b/modules/docs/src/Volo.Docs.Application/Volo/Docs/Projects/ProjectAppService.cs @@ -15,18 +15,18 @@ namespace Volo.Docs.Projects { private readonly IProjectRepository _projectRepository; private readonly IDistributedCache> _versionCache; - private readonly IDocumentStoreFactory _documentStoreFactory; + private readonly IDocumentSourceFactory _documentSource; protected IDistributedCache LanguageCache { get; } public ProjectAppService( IProjectRepository projectRepository, IDistributedCache> versionCache, - IDocumentStoreFactory documentStoreFactory, + IDocumentSourceFactory documentSource, IDistributedCache languageCache) { _projectRepository = projectRepository; _versionCache = versionCache; - _documentStoreFactory = documentStoreFactory; + _documentSource = documentSource; LanguageCache = languageCache; } @@ -68,7 +68,7 @@ namespace Volo.Docs.Projects protected virtual async Task> GetVersionsAsync(Project project) { - var store = _documentStoreFactory.Create(project.DocumentStoreType); + var store = _documentSource.Create(project.DocumentStoreType); var versions = await store.GetVersionsAsync(project); if (!versions.Any()) @@ -108,7 +108,7 @@ namespace Volo.Docs.Projects private async Task GetLanguageListInternalAsync(string shortName, string version) { var project = await _projectRepository.GetByShortNameAsync(shortName); - var store = _documentStoreFactory.Create(project.DocumentStoreType); + var store = _documentSource.Create(project.DocumentStoreType); async Task GetLanguagesAsync() { diff --git a/modules/docs/src/Volo.Docs.Domain.Shared/FodyWeavers.xml b/modules/docs/src/Volo.Docs.Domain.Shared/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Domain.Shared/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Domain.Shared/FodyWeavers.xsd b/modules/docs/src/Volo.Docs.Domain.Shared/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Domain.Shared/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Domain.Shared/Volo.Docs.Domain.Shared.csproj b/modules/docs/src/Volo.Docs.Domain.Shared/Volo.Docs.Domain.Shared.csproj index 185bc84d5b..453026ef95 100644 --- a/modules/docs/src/Volo.Docs.Domain.Shared/Volo.Docs.Domain.Shared.csproj +++ b/modules/docs/src/Volo.Docs.Domain.Shared/Volo.Docs.Domain.Shared.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Documents/DocumentConsts.cs b/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Documents/DocumentConsts.cs index 04371e3dff..f629abd0a4 100644 --- a/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Documents/DocumentConsts.cs +++ b/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Documents/DocumentConsts.cs @@ -3,5 +3,13 @@ public static class DocumentConsts { public const int MaxNameLength = 255; + public const int MaxVersionNameLength = 128; + public const int MaxLanguageCodeNameLength = 128; + public const int MaxFileNameNameLength = 128; + public const int MaxFormatNameLength = 128; + public const int MaxEditLinkLength = 2048; + public const int MaxRootUrlLength = 2048; + public const int MaxRawRootUrlLength = 2048; + public const int MaxLocalDirectoryLength = 512; } } diff --git a/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Documents/DocumentUpdateInfo.cs b/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Documents/DocumentUpdateInfo.cs new file mode 100644 index 0000000000..fcabe91549 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Documents/DocumentUpdateInfo.cs @@ -0,0 +1,14 @@ +using System; + +namespace Volo.Docs.Documents +{ + [Serializable] + public class DocumentUpdateInfo + { + public virtual string Name { get; set; } + + public virtual DateTime CreationTime { get; set; } + + public virtual DateTime LastUpdatedTime { get; set; } + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Web/Models/NavigationNode.cs b/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Documents/NavigationNode.cs similarity index 62% rename from modules/docs/src/Volo.Docs.Web/Models/NavigationNode.cs rename to modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Documents/NavigationNode.cs index c8996a4837..b5c2704eb8 100644 --- a/modules/docs/src/Volo.Docs.Web/Models/NavigationNode.cs +++ b/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Documents/NavigationNode.cs @@ -22,6 +22,10 @@ namespace Volo.Docs.Documents public bool IsEmpty => Text == null && Path == null; + public virtual DateTime? CreationTime { get; set; } + + public virtual DateTime? LastUpdatedTime { get; set; } + public bool IsSelected(string documentName) { if (documentName == null) @@ -50,4 +54,24 @@ namespace Volo.Docs.Documents return false; } } + + public static class NavigationNodeExtension + { + public static IEnumerable GetAllNodes(this IEnumerable source, Func> selector) + { + if (source == null) + { + yield break; + } + + foreach (var item in source) + { + yield return item; + foreach (var subItem in GetAllNodes(selector(item), selector)) + { + yield return subItem; + } + } + } + } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Domain/FodyWeavers.xml b/modules/docs/src/Volo.Docs.Domain/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Domain/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Domain/FodyWeavers.xsd b/modules/docs/src/Volo.Docs.Domain/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Domain/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Domain/Volo.Docs.Domain.csproj b/modules/docs/src/Volo.Docs.Domain/Volo.Docs.Domain.csproj index 9de0a675ea..234832ef1a 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo.Docs.Domain.csproj +++ b/modules/docs/src/Volo.Docs.Domain/Volo.Docs.Domain.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDomainModule.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDomainModule.cs index 91618b950a..81f681403d 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDomainModule.cs +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/DocsDomainModule.cs @@ -32,10 +32,10 @@ namespace Volo.Docs .AddVirtualJson("/Volo/Docs/Localization/Domain"); }); - Configure(options => + Configure(options => { - options.Stores[GithubDocumentStore.Type] = typeof(GithubDocumentStore); - options.Stores[FileSystemDocumentStore.Type] = typeof(FileSystemDocumentStore); + options.Sources[GithubDocumentSource.Type] = typeof(GithubDocumentSource); + options.Sources[FileSystemDocumentSource.Type] = typeof(FileSystemDocumentSource); }); context.Services.AddHttpClient(GithubRepositoryManager.HttpClientName, client => diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/Document.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/Document.cs index edec595bc0..ecbc3aa617 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/Document.cs +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/Document.cs @@ -1,27 +1,110 @@ +using System; using System.Collections.Generic; +using System.Linq; +using JetBrains.Annotations; +using Volo.Abp; +using Volo.Abp.Domain.Entities; namespace Volo.Docs.Documents { - public class Document + public class Document : AggregateRoot { - public string Title { get; set; } + public virtual Guid ProjectId { get; protected set; } - public string Content { get; set; } + public virtual string Name { get; protected set; } - public string Format { get; set; } + public virtual string Version { get; protected set; } - public string EditLink { get; set; } + public virtual string LanguageCode { get; protected set; } - public string RootUrl { get; set; } + public virtual string FileName { get; set; } - public string RawRootUrl { get; set; } + public virtual string Content { get; set; } - public string Version { get; set; } + public virtual string Format { get; set; } - public string LocalDirectory { get; set; } + public virtual string EditLink { get; set; } - public string FileName { get; set; } + public virtual string RootUrl { get; set; } - public List Contributors { get; set; } + public virtual string RawRootUrl { get; set; } + + public virtual string LocalDirectory { get; set; } + + public virtual DateTime CreationTime { get; set; } + + public virtual DateTime LastUpdatedTime { get; set; } + + public virtual DateTime LastCachedTime { get; set; } + + public virtual List Contributors { get; set; } + + protected Document() + { + Contributors = new List(); + ExtraProperties = new Dictionary(); + } + + public Document( + Guid id, + Guid projectId, + [NotNull] string name, + [NotNull] string version, + [NotNull] string languageCode, + [NotNull] string fileName, + [NotNull] string content, + [NotNull] string format, + [NotNull] string editLink, + [NotNull] string rootUrl, + [NotNull] string rawRootUrl, + [NotNull] string localDirectory, + DateTime creationTime, + DateTime lastUpdatedTime, + DateTime lastCachedTime + ) + { + Id = id; + ProjectId = projectId; + + Name = Check.NotNullOrWhiteSpace(name, nameof(name)); + Version = Check.NotNullOrWhiteSpace(version, nameof(version)); + LanguageCode = Check.NotNullOrWhiteSpace(languageCode, nameof(languageCode)); + FileName = Check.NotNullOrWhiteSpace(fileName, nameof(fileName)); + Content = Check.NotNullOrWhiteSpace(content, nameof(content)); + Format = Check.NotNullOrWhiteSpace(format, nameof(format)); + EditLink = Check.NotNullOrWhiteSpace(editLink, nameof(editLink)); + RootUrl = Check.NotNullOrWhiteSpace(rootUrl, nameof(rootUrl)); + RawRootUrl = Check.NotNullOrWhiteSpace(rawRootUrl, nameof(rawRootUrl)); + LocalDirectory = Check.NotNull(localDirectory, nameof(localDirectory)); + + CreationTime = creationTime; + LastUpdatedTime = lastUpdatedTime; + LastCachedTime = lastCachedTime; + + Contributors = new List(); + ExtraProperties = new Dictionary(); + } + + public virtual void AddContributor(string username, string userProfileUrl, string avatarUrl) + { + Contributors.AddIfNotContains(new DocumentContributor(Id, username, userProfileUrl, avatarUrl)); + } + + public virtual void RemoveAllContributors() + { + Contributors.Clear(); + } + + public virtual void RemoveContributor(string username, string userProfileUrl, string avatarUrl) + { + Contributors.RemoveAll(r => + r.Username == username && r.UserProfileUrl == userProfileUrl && r.AvatarUrl == avatarUrl); + } + + public virtual DocumentContributor FindContributor(string username, string userProfileUrl, string avatarUrl) + { + return Contributors.FirstOrDefault(r => + r.Username == username && r.UserProfileUrl == userProfileUrl && r.AvatarUrl == avatarUrl); + } } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/DocumentContributor.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/DocumentContributor.cs index e405ae767c..1351b0a4ca 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/DocumentContributor.cs +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/DocumentContributor.cs @@ -1,15 +1,39 @@ using System; -using System.Collections.Generic; -using System.Text; +using Volo.Abp.Domain.Entities; namespace Volo.Docs.Documents { - public class DocumentContributor + public class DocumentContributor : Entity { + public Guid DocumentId { get; set; } + public string Username { get; set; } public string UserProfileUrl { get; set; } public string AvatarUrl { get; set; } + + protected DocumentContributor() + { + + } + + public virtual bool Equals(Guid documentId, string username) + { + return DocumentId == documentId && Username == username; + } + + public DocumentContributor(Guid documentId, string username, string userProfileUrl, string avatarUrl) + { + DocumentId = documentId; + Username = username; + UserProfileUrl = userProfileUrl; + AvatarUrl = avatarUrl; + } + + public override object[] GetKeys() + { + return new object[] { DocumentId, Username }; + } } } diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/DocumentStoreFactory.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/DocumentSourceFactory.cs similarity index 54% rename from modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/DocumentStoreFactory.cs rename to modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/DocumentSourceFactory.cs index 9e13dd2fd8..88ec294850 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/DocumentStoreFactory.cs +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/DocumentSourceFactory.cs @@ -6,28 +6,28 @@ using Volo.Abp.DependencyInjection; namespace Volo.Docs.Documents { - public class DocumentStoreFactory : IDocumentStoreFactory, ITransientDependency + public class DocumentSourceFactory : IDocumentSourceFactory, ITransientDependency { - protected DocumentStoreOptions Options { get; } + protected DocumentSourceOptions Options { get; } protected IServiceProvider ServiceProvider { get; } - public DocumentStoreFactory( + public DocumentSourceFactory( IServiceProvider serviceProvider, - IOptions options) + IOptions options) { Options = options.Value; ServiceProvider = serviceProvider; } - public virtual IDocumentStore Create(string storeType) + public virtual IDocumentSource Create(string sourceType) { - var serviceType = Options.Stores.GetOrDefault(storeType); + var serviceType = Options.Sources.GetOrDefault(sourceType); if (serviceType == null) { - throw new ApplicationException($"Unknown document store: {storeType}"); + throw new ApplicationException($"Unknown document store: {sourceType}"); } - return (IDocumentStore) ServiceProvider.GetRequiredService(serviceType); + return (IDocumentSource) ServiceProvider.GetRequiredService(serviceType); } } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/DocumentSourceOptions.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/DocumentSourceOptions.cs new file mode 100644 index 0000000000..ccfc36cbfe --- /dev/null +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/DocumentSourceOptions.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +namespace Volo.Docs.Documents +{ + public class DocumentSourceOptions + { + public Dictionary Sources { get; set; } + + public DocumentSourceOptions() + { + Sources = new Dictionary(); + } + } +} diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/DocumentStoreOptions.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/DocumentStoreOptions.cs deleted file mode 100644 index fcc5781d98..0000000000 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/DocumentStoreOptions.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Volo.Docs.Documents -{ - public class DocumentStoreOptions - { - public Dictionary Stores { get; set; } - - public DocumentStoreOptions() - { - Stores = new Dictionary(); - } - } -} diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/IDocumentRepository.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/IDocumentRepository.cs new file mode 100644 index 0000000000..75e8a22e6d --- /dev/null +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/IDocumentRepository.cs @@ -0,0 +1,17 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; + +namespace Volo.Docs.Documents +{ + public interface IDocumentRepository : IBasicRepository + { + Task FindAsync(Guid projectId, string name, string languageCode, string version, + bool includeDetails = true, + CancellationToken cancellationToken = default); + + Task DeleteAsync(Guid projectId, string name, string languageCode, string version, + CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/IDocumentStore.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/IDocumentSource.cs similarity index 91% rename from modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/IDocumentStore.cs rename to modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/IDocumentSource.cs index 3cbf2c40f2..e9d2779bd3 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/IDocumentStore.cs +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/IDocumentSource.cs @@ -6,7 +6,7 @@ using Volo.Docs.Projects; namespace Volo.Docs.Documents { - public interface IDocumentStore : IDomainService + public interface IDocumentSource : IDomainService { Task GetDocumentAsync(Project project, string documentName, string languageCode, string version); diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/IDocumentSourceFactory.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/IDocumentSourceFactory.cs new file mode 100644 index 0000000000..41e5481c14 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/IDocumentSourceFactory.cs @@ -0,0 +1,7 @@ +namespace Volo.Docs.Documents +{ + public interface IDocumentSourceFactory + { + IDocumentSource Create(string sourceType); + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/IDocumentStoreFactory.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/IDocumentStoreFactory.cs deleted file mode 100644 index 3a997eb26d..0000000000 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Documents/IDocumentStoreFactory.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Volo.Docs.Documents -{ - public interface IDocumentStoreFactory - { - IDocumentStore Create(string storeType); - } -} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/FileSystem/Documents/FileSystemDocumentStore.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/FileSystem/Documents/FileSystemDocumentSource.cs similarity index 76% rename from modules/docs/src/Volo.Docs.Domain/Volo/Docs/FileSystem/Documents/FileSystemDocumentStore.cs rename to modules/docs/src/Volo.Docs.Domain/Volo/Docs/FileSystem/Documents/FileSystemDocumentSource.cs index 085ce9a917..d93b378dcd 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/FileSystem/Documents/FileSystemDocumentStore.cs +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/FileSystem/Documents/FileSystemDocumentSource.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.IO; using System.Security; using System.Threading.Tasks; @@ -11,7 +12,7 @@ using Volo.Docs.Projects; namespace Volo.Docs.FileSystem.Documents { - public class FileSystemDocumentStore : DomainService, IDocumentStore + public class FileSystemDocumentSource : DomainService, IDocumentSource { public const string Type = "FileSystem"; @@ -30,16 +31,21 @@ namespace Volo.Docs.FileSystem.Documents localDirectory = documentName.Substring(0, documentName.LastIndexOf('/')); } - return new Document - { - Content = content, - FileName = Path.GetFileName(path), - Format = project.Format, - LocalDirectory = localDirectory, - Title = documentName, - RawRootUrl = $"/document-resources?projectId={project.Id.ToString()}&version={version}&languageCode={languageCode}&name=", - RootUrl = "/" - }; + return new Document(GuidGenerator.Create(), + project.Id, + documentName, + version, + languageCode, + Path.GetFileName(path), + content, + project.Format, + path, + "/", + $"/document-resources?projectId={project.Id.ToString()}&version={version}&languageCode={languageCode}&name=", + localDirectory, + File.GetCreationTime(path), + File.GetLastWriteTime(path), + DateTime.Now); } public Task> GetVersionsAsync(Project project) diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/FileSystem/Projects/ProjectFileSystemExtensions.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/FileSystem/Projects/ProjectFileSystemExtensions.cs index 904e7b9e29..f0fc44e39e 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/FileSystem/Projects/ProjectFileSystemExtensions.cs +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/FileSystem/Projects/ProjectFileSystemExtensions.cs @@ -24,7 +24,7 @@ namespace Volo.Docs.FileSystem.Projects { Check.NotNull(project, nameof(project)); - if (project.DocumentStoreType != FileSystemDocumentStore.Type) + if (project.DocumentStoreType != FileSystemDocumentSource.Type) { throw new ApplicationException("Given project has not a FileSystem document store!"); } diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/GitHub/Documents/GithubDocumentStore.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/GitHub/Documents/GithubDocumentSource.cs similarity index 78% rename from modules/docs/src/Volo.Docs.Domain/Volo/Docs/GitHub/Documents/GithubDocumentStore.cs rename to modules/docs/src/Volo.Docs.Domain/Volo/Docs/GitHub/Documents/GithubDocumentSource.cs index bd399a4f83..0c837991d1 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/GitHub/Documents/GithubDocumentStore.cs +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/GitHub/Documents/GithubDocumentSource.cs @@ -16,13 +16,13 @@ namespace Volo.Docs.GitHub.Documents { //TODO: Needs more refactoring - public class GithubDocumentStore : DomainService, IDocumentStore + public class GithubDocumentSource : DomainService, IDocumentSource { public const string Type = "GitHub"; private readonly IGithubRepositoryManager _githubRepositoryManager; - public GithubDocumentStore(IGithubRepositoryManager githubRepositoryManager) + public GithubDocumentSource(IGithubRepositoryManager githubRepositoryManager) { _githubRepositoryManager = githubRepositoryManager; } @@ -34,7 +34,6 @@ namespace Volo.Docs.GitHub.Documents var userAgent = project.GetGithubUserAgentOrNull(); var rawRootUrl = CalculateRawRootUrlWithLanguageCode(rootUrl, languageCode); var rawDocumentUrl = rawRootUrl + documentName; - var commitHistoryUrl = project.GetGitHubUrlForCommitHistory() + documentName; var isNavigationDocument = documentName == project.NavigationDocumentName; var isParameterDocument = documentName == project.ParametersDocumentName; var editLink = rootUrl.ReplaceFirst("/tree/", "/blob/") + languageCode + "/" + documentName; @@ -47,20 +46,40 @@ namespace Volo.Docs.GitHub.Documents fileName = documentName.Substring(documentName.LastIndexOf('/') + 1); } - return new Document + var fileCommits = await GetFileCommitsAsync(project, version, $"docs/{languageCode}/{documentName}"); + + var document= new Document(GuidGenerator.Create(), + project.Id, + documentName, + version, + languageCode, + fileName, + await DownloadWebContentAsStringAsync(rawDocumentUrl, token, userAgent), + project.Format, + editLink, + rootUrl, + rawRootUrl, + localDirectory, + fileCommits.LastOrDefault()?.Commit.Author.Date.DateTime ?? DateTime.MinValue, + fileCommits.FirstOrDefault()?.Commit.Author.Date.DateTime ?? DateTime.MinValue, + DateTime.Now); + + var authors = fileCommits + .Where(x => x.Author != null) + .Select(x => x.Author) + .GroupBy(x => x.Id) + .OrderByDescending(x => x.Count()) + .Select(x => x.FirstOrDefault()).ToList(); + + if (!isNavigationDocument && !isParameterDocument) { - Title = documentName, - EditLink = editLink, - RootUrl = rootUrl, - RawRootUrl = rawRootUrl, - Format = project.Format, - LocalDirectory = localDirectory, - FileName = fileName, - Contributors = new List(), - //Contributors = !isNavigationDocument && !isParameterDocument ? await GetContributors(commitHistoryUrl, token, userAgent): new List(), - Version = version, - Content = await DownloadWebContentAsStringAsync(rawDocumentUrl, token, userAgent) - }; + foreach (var author in authors) + { + document.AddContributor(author.Login, author.HtmlUrl, author.AvatarUrl); + } + } + + return document; } public async Task> GetVersionsAsync(Project project) @@ -124,6 +143,15 @@ namespace Volo.Docs.GitHub.Documents return await _githubRepositoryManager.GetReleasesAsync(ownerName, repositoryName, project.GetGitHubAccessTokenOrNull()); } + private async Task> GetFileCommitsAsync(Project project, string version, string filename) + { + var url = project.GetGitHubUrl(); + var ownerName = GetOwnerNameFromUrl(url); + var repositoryName = GetRepositoryNameFromUrl(url); + return await _githubRepositoryManager.GetFileCommitsAsync(ownerName, repositoryName, + version, filename, project.GetGitHubAccessTokenOrNull()); + } + protected virtual string GetOwnerNameFromUrl(string url) { try @@ -183,39 +211,6 @@ namespace Volo.Docs.GitHub.Documents } } - private async Task> GetContributors(string url, string token, string userAgent) - { - var contributors = new List(); - - try - { - var commitsJsonAsString = await DownloadWebContentAsStringAsync(url, token, userAgent); - - var commits = JArray.Parse(commitsJsonAsString); - - foreach (var commit in commits) - { - var author = commit["author"]; - - contributors.Add(new DocumentContributor - { - Username = (string)author["login"], - UserProfileUrl = (string)author["html_url"], - AvatarUrl = (string)author["avatar_url"] - }); - } - - contributors = contributors.GroupBy(c => c.Username).OrderByDescending(c=>c.Count()) - .Select( c => c.FirstOrDefault()).ToList(); - } - catch (Exception ex) - { - Logger.LogWarning(ex.Message); - } - - return contributors; - } - private static string CalculateRawRootUrlWithLanguageCode(string rootUrl, string languageCode) { return (rootUrl diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/GitHub/Documents/GithubRepositoryManager.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/GitHub/Documents/GithubRepositoryManager.cs index d19f70c2cd..787dcbba48 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/GitHub/Documents/GithubRepositoryManager.cs +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/GitHub/Documents/GithubRepositoryManager.cs @@ -64,5 +64,16 @@ namespace Volo.Docs.GitHub.Documents .Release .GetAll(name, repositoryName)).ToList(); } + + public async Task> GetFileCommitsAsync(string name, string repositoryName, string version, string filename, string token) + { + var client = token.IsNullOrWhiteSpace() + ? new GitHubClient(new ProductHeaderValue(name)) + : new GitHubClient(new ProductHeaderValue(name), new InMemoryCredentialStore(new Credentials(token))); + + var repo = await client.Repository.Get(name, repositoryName); + var request = new CommitRequest { Path = filename, Sha = version }; + return await client.Repository.Commit.GetAll(repo.Id, request); + } } } diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/GitHub/Documents/IGithubRepositoryManager.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/GitHub/Documents/IGithubRepositoryManager.cs index 519b9829d5..fa81ba695b 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/GitHub/Documents/IGithubRepositoryManager.cs +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/GitHub/Documents/IGithubRepositoryManager.cs @@ -15,5 +15,6 @@ namespace Volo.Docs.GitHub.Documents Task> GetReleasesAsync(string name, string repositoryName, string token); + Task> GetFileCommitsAsync(string name, string repositoryName, string version, string filename, string token); } } diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/GitHub/Projects/ProjectGithubExtensions.cs b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/GitHub/Projects/ProjectGithubExtensions.cs index 3d2170a121..d518132950 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/GitHub/Projects/ProjectGithubExtensions.cs +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/GitHub/Projects/ProjectGithubExtensions.cs @@ -21,14 +21,6 @@ namespace Volo.Docs.GitHub.Projects .Replace("{version}", version); } - public static string GetGitHubUrlForCommitHistory([NotNull] this Project project) - { - return project - .GetGitHubUrl() - .Replace("github.com", "api.github.com/repos") - .Replace("tree/{version}/", "commits?path="); - } - public static void SetGitHubUrl([NotNull] this Project project, string value) { CheckGitHubProject(project); @@ -57,7 +49,7 @@ namespace Volo.Docs.GitHub.Projects { Check.NotNull(project, nameof(project)); - if (project.DocumentStoreType != GithubDocumentStore.Type) + if (project.DocumentStoreType != GithubDocumentSource.Type) { throw new ApplicationException("Given project has not a Github document store!"); } diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/cs.json b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/cs.json index 6ca29e5420..743218aeba 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/cs.json +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/cs.json @@ -15,6 +15,7 @@ "DocumentNotFound": "Ups, vyžádaný dokument neexistuje!", "NavigationDocumentNotFound": "Tato verze nemá navigační dokument!", "DocumentNotFoundInSelectedLanguage": "Tento dokument není dostupný ve vybraném jazyce. Zobrazen dokument ve výchozím jazyce.", - "FilterTopics": "Filtrovat témata" + "FilterTopics": "Filtrovat témata", + "MultipleVersionDocumentInfo": "Tento dokument má více verzí. Vyberte možnosti, které vám nejlépe vyhovují." } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/en.json b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/en.json index 1750f82e61..92858a87f0 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/en.json +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/en.json @@ -7,6 +7,7 @@ "ShareOn": "Share on", "Version": "Version", "Edit": "Edit", + "LastEditTime": "Last edit", "Delete": "Delete", "InThisDocument": "In this document", "GoToTop": "Go to top", @@ -16,6 +17,10 @@ "NavigationDocumentNotFound": "This version does not have a navigation document!", "DocumentNotFoundInSelectedLanguage": "Document in the language you wanted is not found. Document in the default language is shown.", "FilterTopics": "Filter topics", - "MultipleVersionDocumentInfo": "This document has multiple versions. Select the options best fit for you." + "MultipleVersionDocumentInfo": "This document has multiple versions. Select the options best fit for you.", + "New": "New", + "Upd": "Upd", + "NewExplanation": "Created in the last two weeks.", + "UpdatedExplanation": "Updated in the last two weeks." } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/tr.json b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/tr.json index 440273022f..612274f95d 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/tr.json +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/tr.json @@ -7,6 +7,7 @@ "ShareOn": "Paylaş", "Version": "Versiyon", "Edit": "Düzenle", + "LastEditTime": "Son Düzenleme", "Delete": "Sil", "InThisDocument": "Bu dökümanda", "GoToTop": "En üste çık", @@ -15,6 +16,10 @@ "DocumentNotFound": "Aradığınız döküman bulunamadı!", "NavigationDocumentNotFound": "Bu döküman için menü bulunamadı!", "DocumentNotFoundInSelectedLanguage": "İstediğiniz dilde belge bulunamadı. Varsayılan dilde belge gösterilir.", - "MultipleVersionDocumentInfo": "Bu dökümanın birden çok versiyonu bulunmaktadır. Sizin için en uygun olan seçenekleri seçiniz." + "MultipleVersionDocumentInfo": "Bu dökümanın birden çok versiyonu bulunmaktadır. Sizin için en uygun olan seçenekleri seçiniz.", + "New": "Yeni", + "Upd": "Günc", + "NewExplanation": "Son iki hafta içinde oluşturuldu.", + "UpdatedExplanation": "Son iki hafta içinde güncellendi." } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/zh-Hans.json b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/zh-Hans.json index 410374b4fd..3eec4562bb 100644 --- a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/zh-Hans.json +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/zh-Hans.json @@ -7,6 +7,7 @@ "ShareOn": "分享到", "Version": "版本", "Edit": "编辑", + "LastEditTime": "上次编辑", "Delete": "删除", "InThisDocument": "在本文中", "GoToTop": "到顶部", @@ -15,6 +16,10 @@ "DocumentNotFound": "找不到请求的文档!", "NavigationDocumentNotFound": "这个版本没有导航文件!", "DocumentNotFoundInSelectedLanguage": "本文档不适用于所选语言, 将以默认语言显示文档.", - "FilterTopics": "过滤主题" + "FilterTopics": "过滤主题", + "New": "新文档", + "Upd": "更新", + "NewExplanation": "在最近两周内创建.", + "UpdatedExplanation": "在最近两周内更新." } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/zh-Hant.json b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/zh-Hant.json new file mode 100644 index 0000000000..5c3d723b0a --- /dev/null +++ b/modules/docs/src/Volo.Docs.Domain/Volo/Docs/Localization/Domain/zh-Hant.json @@ -0,0 +1,25 @@ +{ + "culture": "zh-Hant", + "texts": { + "Documents": "文件", + "BackToWebsite": "返回主網站", + "Contributors": "貢獻者", + "ShareOn": "分享到", + "Version": "版本", + "Edit": "編輯", + "LastEditTime": "上次編輯", + "Delete": "刪除", + "InThisDocument": "在此文件中", + "GoToTop": "到最上方", + "Projects": "專案", + "NoProjectWarning": "沒有專案!", + "DocumentNotFound": "找不到要求的文件!", + "NavigationDocumentNotFound": "這個版本沒有導覽文件!", + "DocumentNotFoundInSelectedLanguage": "本文件不適用於所選語系,將以預設語系顯示.", + "FilterTopics": "過濾主題", + "New": "新文檔", + "Upd": "更新", + "NewExplanation": "在最近兩周內創建.", + "UpdatedExplanation": "在最近兩周內更新." + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.EntityFrameworkCore/FodyWeavers.xml b/modules/docs/src/Volo.Docs.EntityFrameworkCore/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/docs/src/Volo.Docs.EntityFrameworkCore/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.EntityFrameworkCore/FodyWeavers.xsd b/modules/docs/src/Volo.Docs.EntityFrameworkCore/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/docs/src/Volo.Docs.EntityFrameworkCore/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo.Docs.EntityFrameworkCore.csproj b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo.Docs.EntityFrameworkCore.csproj index 1111fa62a2..d8bf0d7fc6 100644 --- a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo.Docs.EntityFrameworkCore.csproj +++ b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo.Docs.EntityFrameworkCore.csproj @@ -1,14 +1,21 @@ - + + - netstandard2.1 + netstandard2.0 Volo.Docs.EntityFrameworkCore Volo.Docs.EntityFrameworkCore + + + + + + diff --git a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/Documents/EFCoreDocumentRepository.cs b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/Documents/EFCoreDocumentRepository.cs new file mode 100644 index 0000000000..7698ef0b39 --- /dev/null +++ b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/Documents/EFCoreDocumentRepository.cs @@ -0,0 +1,36 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using Volo.Docs.EntityFrameworkCore; + +namespace Volo.Docs.Documents +{ + public class EFCoreDocumentRepository : EfCoreRepository, IDocumentRepository + { + public EFCoreDocumentRepository(IDbContextProvider dbContextProvider) + : base(dbContextProvider) + { + } + + public async Task FindAsync(Guid projectId, string name, string languageCode, string version, + bool includeDetails = true, + CancellationToken cancellationToken = default) + { + return await DbSet.IncludeDetails(includeDetails) + .FirstOrDefaultAsync(x => + x.ProjectId == projectId && x.Name == name && x.LanguageCode == languageCode && + x.Version == version, + cancellationToken); + } + + public async Task DeleteAsync(Guid projectId, string name, string languageCode, string version, CancellationToken cancellationToken = default) + { + await DeleteAsync(x => + x.ProjectId == projectId && x.Name == name && x.LanguageCode == languageCode && + x.Version == version, cancellationToken: cancellationToken); + } + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContext.cs b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContext.cs index 1f6a43b825..7c1c635617 100644 --- a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContext.cs +++ b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContext.cs @@ -1,6 +1,7 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; +using Volo.Docs.Documents; using Volo.Docs.Projects; namespace Volo.Docs.EntityFrameworkCore @@ -10,6 +11,10 @@ namespace Volo.Docs.EntityFrameworkCore { public DbSet Projects { get; set; } + public DbSet Documents { get; set; } + + public DbSet DocumentContributors { get; set; } + public DocsDbContext(DbContextOptions options) : base(options) { diff --git a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContextModelBuilderExtensions.cs b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContextModelBuilderExtensions.cs index f6a17b68d7..64a85db140 100644 --- a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContextModelBuilderExtensions.cs +++ b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsDbContextModelBuilderExtensions.cs @@ -3,6 +3,7 @@ using JetBrains.Annotations; using Microsoft.EntityFrameworkCore; using Volo.Abp; using Volo.Abp.EntityFrameworkCore.Modeling; +using Volo.Docs.Documents; using Volo.Docs.Projects; namespace Volo.Docs.EntityFrameworkCore @@ -26,8 +27,7 @@ namespace Volo.Docs.EntityFrameworkCore { b.ToTable(options.TablePrefix + "Projects", options.Schema); - b.ConfigureConcurrencyStamp(); - b.ConfigureExtraProperties(); + b.ConfigureByConvention(); b.Property(x => x.Name).IsRequired().HasMaxLength(ProjectConsts.MaxNameLength); b.Property(x => x.ShortName).IsRequired().HasMaxLength(ProjectConsts.MaxShortNameLength); @@ -36,6 +36,35 @@ namespace Volo.Docs.EntityFrameworkCore b.Property(x => x.ParametersDocumentName).IsRequired().HasMaxLength(ProjectConsts.MaxParametersDocumentNameLength); b.Property(x => x.LatestVersionBranchName).HasMaxLength(ProjectConsts.MaxLatestVersionBranchNameLength); }); + + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "Documents", options.Schema); + + b.ConfigureByConvention(); + + b.Property(x => x.Name).IsRequired().HasMaxLength(DocumentConsts.MaxNameLength); + b.Property(x => x.Version).IsRequired().HasMaxLength(DocumentConsts.MaxVersionNameLength); + b.Property(x => x.LanguageCode).IsRequired().HasMaxLength(DocumentConsts.MaxLanguageCodeNameLength); + b.Property(x => x.FileName).IsRequired().HasMaxLength(DocumentConsts.MaxFileNameNameLength); + b.Property(x => x.Content).IsRequired(); + b.Property(x => x.Format).HasMaxLength(DocumentConsts.MaxFormatNameLength); + b.Property(x => x.EditLink).HasMaxLength(DocumentConsts.MaxEditLinkLength); + b.Property(x => x.RootUrl).HasMaxLength(DocumentConsts.MaxRootUrlLength); + b.Property(x => x.RawRootUrl).HasMaxLength(DocumentConsts.MaxRawRootUrlLength); + b.Property(x => x.LocalDirectory).HasMaxLength(DocumentConsts.MaxLocalDirectoryLength); + + b.HasMany(x => x.Contributors).WithOne() + .HasForeignKey(x => new { x.DocumentId }) + .IsRequired(); + }); + + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "DocumentContributors", options.Schema); + + b.HasKey(x => new { x.DocumentId, x.Username }); + }); } } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsEfCoreQueryableExtensions.cs b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsEfCoreQueryableExtensions.cs new file mode 100644 index 0000000000..0bd2e4fff8 --- /dev/null +++ b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsEfCoreQueryableExtensions.cs @@ -0,0 +1,14 @@ +using System.Linq; +using Microsoft.EntityFrameworkCore; +using Volo.Docs.Documents; + +namespace Volo.Docs.EntityFrameworkCore +{ + public static class DocsEfCoreQueryableExtensions + { + public static IQueryable IncludeDetails(this IQueryable queryable, bool include = true) + { + return !include ? queryable : queryable.Include(x => x.Contributors); + } + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsEntityFrameworkCoreModule.cs b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsEntityFrameworkCoreModule.cs index 459a96516b..6e6b780666 100644 --- a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsEntityFrameworkCoreModule.cs +++ b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/DocsEntityFrameworkCoreModule.cs @@ -1,6 +1,7 @@ using Microsoft.Extensions.DependencyInjection; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.Modularity; +using Volo.Docs.Documents; using Volo.Docs.Projects; namespace Volo.Docs.EntityFrameworkCore @@ -15,6 +16,7 @@ namespace Volo.Docs.EntityFrameworkCore context.Services.AddAbpDbContext(options => { options.AddRepository(); + options.AddRepository(); }); } } diff --git a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/IDocsDbContext.cs b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/IDocsDbContext.cs index 4f11d438e7..6e96604592 100644 --- a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/IDocsDbContext.cs +++ b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/EntityFrameworkCore/IDocsDbContext.cs @@ -1,6 +1,7 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; +using Volo.Docs.Documents; using Volo.Docs.Projects; namespace Volo.Docs.EntityFrameworkCore @@ -9,5 +10,9 @@ namespace Volo.Docs.EntityFrameworkCore public interface IDocsDbContext : IEfCoreDbContext { DbSet Projects { get; set; } + + DbSet Documents { get; set; } + + DbSet DocumentContributors { get; set; } } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.HttpApi.Client/FodyWeavers.xml b/modules/docs/src/Volo.Docs.HttpApi.Client/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/docs/src/Volo.Docs.HttpApi.Client/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.HttpApi.Client/FodyWeavers.xsd b/modules/docs/src/Volo.Docs.HttpApi.Client/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/docs/src/Volo.Docs.HttpApi.Client/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.HttpApi.Client/Volo.Docs.HttpApi.Client.csproj b/modules/docs/src/Volo.Docs.HttpApi.Client/Volo.Docs.HttpApi.Client.csproj index eedcfc905c..f527001c45 100644 --- a/modules/docs/src/Volo.Docs.HttpApi.Client/Volo.Docs.HttpApi.Client.csproj +++ b/modules/docs/src/Volo.Docs.HttpApi.Client/Volo.Docs.HttpApi.Client.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/docs/src/Volo.Docs.HttpApi/FodyWeavers.xml b/modules/docs/src/Volo.Docs.HttpApi/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/docs/src/Volo.Docs.HttpApi/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.HttpApi/FodyWeavers.xsd b/modules/docs/src/Volo.Docs.HttpApi/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/docs/src/Volo.Docs.HttpApi/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.HttpApi/Volo.Docs.HttpApi.csproj b/modules/docs/src/Volo.Docs.HttpApi/Volo.Docs.HttpApi.csproj index 60dfef5bd4..671d5dbbac 100644 --- a/modules/docs/src/Volo.Docs.HttpApi/Volo.Docs.HttpApi.csproj +++ b/modules/docs/src/Volo.Docs.HttpApi/Volo.Docs.HttpApi.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/docs/src/Volo.Docs.HttpApi/Volo/Docs/Documents/DocsDocumentController.cs b/modules/docs/src/Volo.Docs.HttpApi/Volo/Docs/Documents/DocsDocumentController.cs index 9ff91c8b17..a066a92f23 100644 --- a/modules/docs/src/Volo.Docs.HttpApi/Volo/Docs/Documents/DocsDocumentController.cs +++ b/modules/docs/src/Volo.Docs.HttpApi/Volo/Docs/Documents/DocsDocumentController.cs @@ -34,7 +34,7 @@ namespace Volo.Docs.Documents [HttpGet] [Route("navigation")] - public virtual Task GetNavigationAsync(GetNavigationDocumentInput input) + public Task GetNavigationAsync(GetNavigationDocumentInput input) { return DocumentAppService.GetNavigationAsync(input); } diff --git a/modules/docs/src/Volo.Docs.MongoDB/FodyWeavers.xml b/modules/docs/src/Volo.Docs.MongoDB/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/docs/src/Volo.Docs.MongoDB/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.MongoDB/FodyWeavers.xsd b/modules/docs/src/Volo.Docs.MongoDB/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/docs/src/Volo.Docs.MongoDB/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.MongoDB/Volo.Docs.MongoDB.csproj b/modules/docs/src/Volo.Docs.MongoDB/Volo.Docs.MongoDB.csproj index ebe3500cac..9a5cd19550 100644 --- a/modules/docs/src/Volo.Docs.MongoDB/Volo.Docs.MongoDB.csproj +++ b/modules/docs/src/Volo.Docs.MongoDB/Volo.Docs.MongoDB.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Documents/MongoDocumentRepository.cs b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Documents/MongoDocumentRepository.cs new file mode 100644 index 0000000000..ee72171e0d --- /dev/null +++ b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Documents/MongoDocumentRepository.cs @@ -0,0 +1,36 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using MongoDB.Driver.Linq; +using Volo.Abp.Domain.Repositories.MongoDB; +using Volo.Abp.MongoDB; +using Volo.Docs.MongoDB; + +namespace Volo.Docs.Documents +{ + public class MongoDocumentRepository : MongoDbRepository, IDocumentRepository + { + public MongoDocumentRepository(IMongoDbContextProvider dbContextProvider) + : base(dbContextProvider) + { + } + + public async Task FindAsync(Guid projectId, string name, string languageCode, string version, + bool includeDetails = true, + CancellationToken cancellationToken = default) + { + return await GetMongoQueryable().FirstOrDefaultAsync(x => x.ProjectId == projectId && + x.Name == name && + x.LanguageCode == languageCode && + x.Version == version, cancellationToken); + } + + public async Task DeleteAsync(Guid projectId, string name, string languageCode, string version, + CancellationToken cancellationToken = default) + { + await DeleteAsync(x => + x.ProjectId == projectId && x.Name == name && x.LanguageCode == languageCode && + x.Version == version, cancellationToken: cancellationToken); + } + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/BloggingMongoDbModule.cs b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/BloggingMongoDbModule.cs index 68b7827b08..cc9662a1ad 100644 --- a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/BloggingMongoDbModule.cs +++ b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/BloggingMongoDbModule.cs @@ -2,6 +2,7 @@ using Volo.Abp.MongoDB; using Volo.Docs.Projects; using Microsoft.Extensions.DependencyInjection; +using Volo.Docs.Documents; namespace Volo.Docs.MongoDB { @@ -16,6 +17,7 @@ namespace Volo.Docs.MongoDB context.Services.AddMongoDbContext(options => { options.AddRepository(); + options.AddRepository(); }); } } diff --git a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoDbContext.cs b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoDbContext.cs index cc65e9ab3e..afc430c945 100644 --- a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoDbContext.cs +++ b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoDbContext.cs @@ -2,6 +2,7 @@ using Volo.Abp.Data; using Volo.Docs.Projects; using Volo.Abp.MongoDB; +using Volo.Docs.Documents; namespace Volo.Docs.MongoDB { @@ -9,6 +10,7 @@ namespace Volo.Docs.MongoDB public class DocsMongoDbContext : AbpMongoDbContext, IDocsMongoDbContext { public IMongoCollection Projects => Collection(); + public IMongoCollection Documents => Collection(); protected override void CreateModel(IMongoModelBuilder modelBuilder) { diff --git a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoDbContextExtensions.cs b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoDbContextExtensions.cs index 456070a645..c1645885d2 100644 --- a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoDbContextExtensions.cs +++ b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/DocsMongoDbContextExtensions.cs @@ -1,6 +1,7 @@ using System; using Volo.Abp; using Volo.Abp.MongoDB; +using Volo.Docs.Documents; using Volo.Docs.Projects; namespace Volo.Docs.MongoDB @@ -23,6 +24,11 @@ namespace Volo.Docs.MongoDB { b.CollectionName = options.CollectionPrefix + "Projects"; }); + + builder.Entity(b => + { + b.CollectionName = options.CollectionPrefix + "DocumentS"; + }); } } } diff --git a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/IDocsMongoDbContext.cs b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/IDocsMongoDbContext.cs index 78b3be8484..92c86a7c4f 100644 --- a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/IDocsMongoDbContext.cs +++ b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/MongoDB/IDocsMongoDbContext.cs @@ -1,6 +1,7 @@ using MongoDB.Driver; using Volo.Abp.Data; using Volo.Abp.MongoDB; +using Volo.Docs.Documents; using Volo.Docs.Projects; namespace Volo.Docs.MongoDB @@ -8,8 +9,8 @@ namespace Volo.Docs.MongoDB [ConnectionStringName(DocsDbProperties.ConnectionStringName)] public interface IDocsMongoDbContext : IAbpMongoDbContext { - IMongoCollection Projects { get; } + IMongoCollection Documents { get; } } } \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Web/Areas/Documents/TagHelpers/TreeTagHelper.cs b/modules/docs/src/Volo.Docs.Web/Areas/Documents/TagHelpers/TreeTagHelper.cs index afb61eadd3..1c57191d0a 100644 --- a/modules/docs/src/Volo.Docs.Web/Areas/Documents/TagHelpers/TreeTagHelper.cs +++ b/modules/docs/src/Volo.Docs.Web/Areas/Documents/TagHelpers/TreeTagHelper.cs @@ -2,8 +2,10 @@ using System.Linq; using System.Text; using Microsoft.AspNetCore.Razor.TagHelpers; +using Microsoft.Extensions.Localization; using Microsoft.Extensions.Options; using Volo.Docs.Documents; +using Volo.Docs.Localization; using Volo.Docs.Utils; namespace Volo.Docs.Areas.Documents.TagHelpers @@ -15,6 +17,8 @@ namespace Volo.Docs.Areas.Documents.TagHelpers { private readonly DocsUiOptions _uiOptions; + private readonly IStringLocalizer _localizer; + private const string LiItemTemplateWithLink = @"
  • {2}{3}
  • "; private const string ListItemAnchor = @"{2}"; @@ -41,8 +45,9 @@ namespace Volo.Docs.Areas.Documents.TagHelpers [HtmlAttributeName("language")] public string LanguageCode { get; set; } - public TreeTagHelper(IOptions urlOptions) + public TreeTagHelper(IOptions urlOptions, IStringLocalizer localizer) { + _localizer = localizer; _uiOptions = urlOptions.Value; } @@ -118,7 +123,27 @@ namespace Volo.Docs.Areas.Documents.TagHelpers } else { - listInnerItem = string.Format(ListItemAnchor, NormalizePath(node.Path), textCss, node.Text.IsNullOrEmpty() ? "?" : node.Text); + var badge = ""; + + if (!node.Path.IsNullOrWhiteSpace() && node.CreationTime.HasValue && node.LastUpdatedTime.HasValue) + { + var newBadge = "" + _localizer["New"] + ""; + var updBadge = "" + _localizer["Upd"] + ""; + + if(node.CreationTime + TimeSpan.FromDays(14) > DateTime.Now) + { + badge = newBadge; + } + else if (node.LastUpdatedTime + TimeSpan.FromDays(14) > DateTime.Now) + { + badge = updBadge; + } + } + + listInnerItem = string.Format(ListItemAnchor, NormalizePath(node.Path), textCss, + node.Text.IsNullOrEmpty() + ? "?" + : node.Text + badge); } return string.Format(LiItemTemplateWithLink, diff --git a/modules/docs/src/Volo.Docs.Web/DocsWebAutoMapperProfile.cs b/modules/docs/src/Volo.Docs.Web/DocsWebAutoMapperProfile.cs index 4a25c94370..a4c4c7647e 100644 --- a/modules/docs/src/Volo.Docs.Web/DocsWebAutoMapperProfile.cs +++ b/modules/docs/src/Volo.Docs.Web/DocsWebAutoMapperProfile.cs @@ -8,8 +8,7 @@ namespace Volo.Docs { public DocsWebAutoMapperProfile() { - CreateMap() - .Ignore(x => x.RootNode); + } } } diff --git a/modules/docs/src/Volo.Docs.Web/DocsWebModule.cs b/modules/docs/src/Volo.Docs.Web/DocsWebModule.cs index 13f29184a9..5b7309a310 100644 --- a/modules/docs/src/Volo.Docs.Web/DocsWebModule.cs +++ b/modules/docs/src/Volo.Docs.Web/DocsWebModule.cs @@ -5,7 +5,9 @@ using Microsoft.Extensions.Options; using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; using Volo.Abp.AspNetCore.Mvc.UI.Bundling; +using Volo.Abp.AspNetCore.Mvc.UI.Packages; using Volo.Abp.AspNetCore.Mvc.UI.Packages.Prismjs; +using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; using Volo.Abp.AutoMapper; using Volo.Abp.Modularity; using Volo.Abp.VirtualFileSystem; @@ -18,7 +20,11 @@ namespace Volo.Docs { [DependsOn( typeof(DocsHttpApiModule), - typeof(AbpAspNetCoreMvcUiBootstrapModule) + typeof(AbpAutoMapperModule), + typeof(AbpAspNetCoreMvcUiBootstrapModule), + typeof(AbpAspNetCoreMvcUiThemeSharedModule), + typeof(AbpAspNetCoreMvcUiPackagesModule), + typeof(AbpAspNetCoreMvcUiBundlingModule) )] public class DocsWebModule : AbpModule { diff --git a/modules/docs/src/Volo.Docs.Web/FodyWeavers.xml b/modules/docs/src/Volo.Docs.Web/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Web/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Web/FodyWeavers.xsd b/modules/docs/src/Volo.Docs.Web/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Web/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Web/HtmlConverting/DocumentPartialTemplateContent.cs b/modules/docs/src/Volo.Docs.Web/HtmlConverting/DocumentPartialTemplateContent.cs new file mode 100644 index 0000000000..5db9fc8164 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Web/HtmlConverting/DocumentPartialTemplateContent.cs @@ -0,0 +1,9 @@ +namespace Volo.Docs.HtmlConverting +{ + public class DocumentPartialTemplateContent + { + public string Path { get; set; } + + public string Content { get; set; } + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Web/HtmlConverting/DocumentPartialTemplateWithValuesDto.cs b/modules/docs/src/Volo.Docs.Web/HtmlConverting/DocumentPartialTemplateWithValuesDto.cs new file mode 100644 index 0000000000..d3ea14921c --- /dev/null +++ b/modules/docs/src/Volo.Docs.Web/HtmlConverting/DocumentPartialTemplateWithValuesDto.cs @@ -0,0 +1,11 @@ +using System.Collections.Generic; + +namespace Volo.Docs.HtmlConverting +{ + public class DocumentPartialTemplateWithValuesDto + { + public string Path { get; set; } + + public Dictionary Parameters { get; set; } + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Web/HtmlConverting/IDocumentSectionRenderer.cs b/modules/docs/src/Volo.Docs.Web/HtmlConverting/IDocumentSectionRenderer.cs index 2d9511d05b..0738b4fd5c 100644 --- a/modules/docs/src/Volo.Docs.Web/HtmlConverting/IDocumentSectionRenderer.cs +++ b/modules/docs/src/Volo.Docs.Web/HtmlConverting/IDocumentSectionRenderer.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; +using System.Collections.Generic; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; @@ -8,8 +6,10 @@ namespace Volo.Docs.HtmlConverting { public interface IDocumentSectionRenderer: ITransientDependency { - Task RenderAsync(string doucment, DocumentRenderParameters parameters); + Task RenderAsync(string doucment, DocumentRenderParameters parameters = null, List partialTemplates = null); Task>> GetAvailableParametersAsync(string document); + + Task> GetPartialTemplatesInDocumentAsync(string documentContent); } } diff --git a/modules/docs/src/Volo.Docs.Web/HtmlConverting/ScribanDocumentSectionRenderer.cs b/modules/docs/src/Volo.Docs.Web/HtmlConverting/ScribanDocumentSectionRenderer.cs index df95bf985d..4a4f3b2142 100644 --- a/modules/docs/src/Volo.Docs.Web/HtmlConverting/ScribanDocumentSectionRenderer.cs +++ b/modules/docs/src/Volo.Docs.Web/HtmlConverting/ScribanDocumentSectionRenderer.cs @@ -1,11 +1,13 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using Scriban; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; +using Volo.Docs.Documents; namespace Volo.Docs.HtmlConverting { @@ -14,6 +16,7 @@ namespace Volo.Docs.HtmlConverting private const string jsonOpener = "````json"; private const string jsonCloser = "````"; private const string docs_param = "//[doc-params]"; + private const string docs_templates = "//[doc-template]"; public ILogger Logger { get; set; } @@ -22,8 +25,13 @@ namespace Volo.Docs.HtmlConverting Logger = NullLogger.Instance; } - public async Task RenderAsync(string document, DocumentRenderParameters parameters = null) + public async Task RenderAsync(string document, DocumentRenderParameters parameters = null, List partialTemplates = null) { + if (partialTemplates != null && partialTemplates.Any()) + { + document = SetPartialTemplates(document, partialTemplates); + } + var scribanTemplate = Template.Parse(document); if (parameters == null) @@ -99,7 +107,7 @@ namespace Volo.Docs.HtmlConverting if (jsonBeginningIndex < 0) { - return (-1,-1,""); + return (-1, -1, ""); } var jsonEndingIndex = document.Substring(jsonBeginningIndex).IndexOf(jsonCloser, StringComparison.Ordinal) + jsonBeginningIndex; @@ -116,5 +124,78 @@ namespace Volo.Docs.HtmlConverting return (-1, -1, ""); } + + public async Task> GetPartialTemplatesInDocumentAsync(string documentContent) + { + var templates = new List(); + + while (documentContent.Contains(jsonOpener)) + { + var afterJsonOpener = documentContent.Substring( + documentContent.IndexOf(jsonOpener, StringComparison.Ordinal) + jsonOpener.Length); + + var betweenJsonOpenerAndCloser = afterJsonOpener.Substring(0, + afterJsonOpener.IndexOf(jsonCloser, StringComparison.Ordinal)); + + documentContent = afterJsonOpener.Substring( + afterJsonOpener.IndexOf(jsonCloser, StringComparison.Ordinal) + jsonCloser.Length); + + if (!betweenJsonOpenerAndCloser.Contains(docs_templates)) + { + continue; + } + + var json = betweenJsonOpenerAndCloser.Substring(betweenJsonOpenerAndCloser.IndexOf(docs_templates, StringComparison.Ordinal) + docs_templates.Length); + + var template = JsonConvert.DeserializeObject(json); + + templates.Add(template); + } + + return templates; + } + + private string SetPartialTemplates(string document, List templates) + { + var newDocument = new StringBuilder(); + + while (document.Contains(jsonOpener)) + { + var beforeJson = document.Substring(0, + document.IndexOf(jsonOpener, StringComparison.Ordinal) + jsonOpener.Length); + + var afterJsonOpener = document.Substring( + document.IndexOf(jsonOpener, StringComparison.Ordinal) + jsonOpener.Length); + + var betweenJsonOpenerAndCloser = afterJsonOpener.Substring(0, + afterJsonOpener.IndexOf(jsonCloser, StringComparison.Ordinal)); + + if (!betweenJsonOpenerAndCloser.Contains(docs_templates)) + { + document = afterJsonOpener.Substring( + afterJsonOpener.IndexOf(jsonCloser, StringComparison.Ordinal) + jsonCloser.Length); + newDocument.Append(beforeJson + betweenJsonOpenerAndCloser + jsonCloser); + continue; + } + + var json = betweenJsonOpenerAndCloser.Substring(betweenJsonOpenerAndCloser.IndexOf(docs_templates, StringComparison.Ordinal) + docs_templates.Length); + + var templatePath = JsonConvert.DeserializeObject(json)?.Path; + + var template = templates.FirstOrDefault(t => t.Path == templatePath); + + var beforeTemplate = document.Substring(0, + document.IndexOf(jsonOpener, StringComparison.Ordinal)); + + newDocument.Append(beforeTemplate + template?.Content + jsonCloser); + + document = afterJsonOpener.Substring( + afterJsonOpener.IndexOf(jsonCloser, StringComparison.Ordinal) + jsonCloser.Length); + } + + newDocument.Append(document); + + return newDocument.ToString(); + } } } diff --git a/modules/docs/src/Volo.Docs.Web/Markdown/MarkdownDocumentToHtmlConverter.cs b/modules/docs/src/Volo.Docs.Web/Markdown/MarkdownDocumentToHtmlConverter.cs index 81ce5ab1f7..5d7282a7e6 100644 --- a/modules/docs/src/Volo.Docs.Web/Markdown/MarkdownDocumentToHtmlConverter.cs +++ b/modules/docs/src/Volo.Docs.Web/Markdown/MarkdownDocumentToHtmlConverter.cs @@ -24,7 +24,7 @@ namespace Volo.Docs.Markdown } private const string MdLinkFormat = "[{0}]({1}{2}/{3}/{4}{5}/{6})"; - private const string MarkdownLinkRegExp = @"\[(.*?)\]\((.*?\.md)\)"; + private const string MarkdownLinkRegExp = @"\[(.*?)\]\((.*?)\)"; private const string AnchorLinkRegExp = @"]+href=\""(.*?)\""[^>]*>(.*)?"; public virtual string Convert(ProjectDto project, DocumentWithDetailsDto document, string version, @@ -56,7 +56,7 @@ namespace Volo.Docs.Markdown var normalized = Regex.Replace(content, MarkdownLinkRegExp, delegate (Match match) { var link = match.Groups[2].Value; - if (UrlHelper.IsExternalLink(link)) + if (UrlHelper.IsExternalLink(link) || !link.EndsWith(".md")) { return match.Value; } diff --git a/modules/docs/src/Volo.Docs.Web/Models/NavigationWithDetailsDto.cs b/modules/docs/src/Volo.Docs.Web/Models/NavigationWithDetailsDto.cs deleted file mode 100644 index a85c6eeb01..0000000000 --- a/modules/docs/src/Volo.Docs.Web/Models/NavigationWithDetailsDto.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System; -using Newtonsoft.Json; - -namespace Volo.Docs.Documents -{ - public class NavigationWithDetailsDto : DocumentWithDetailsDto - { - [JsonProperty("items")] - public NavigationNode RootNode { get; set; } - - public void ConvertItems() - { - if (Content.IsNullOrEmpty()) - { - RootNode = new NavigationNode(); - return; - } - - try - { - RootNode = JsonConvert.DeserializeObject(Content); - } - catch (JsonException ex) - { - //todo: should log the exception? - RootNode = new NavigationNode(); - } - } - } -} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml index bebf083381..7029cc410a 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml @@ -1,10 +1,11 @@ -@page +@page @using Microsoft.AspNetCore.Mvc.Localization @using Volo.Abp.AspNetCore.Mvc.UI.Layout @using Volo.Abp.AspNetCore.Mvc.UI.Packages.Anchor @using Volo.Abp.AspNetCore.Mvc.UI.Packages.Clipboard @using Volo.Abp.AspNetCore.Mvc.UI.Packages.MalihuCustomScrollbar @using Volo.Abp.AspNetCore.Mvc.UI.Packages.Popper +@using Volo.Docs.Pages.Documents.Shared.DocumentNotFoundComponent @using Volo.Abp.AspNetCore.Mvc.UI.Packages.Prismjs @using Volo.Abp.AspNetCore.Mvc.UI.Theming @using Volo.Docs @@ -39,268 +40,284 @@ } -
    -
    -
    -
    +@if (Model.DocumentFound) +{ +
    +
    +
    +
    -
    - -
    - -
    +
    + +
    -
    - @if (Model.VersionSelectItems.Any()) - { -
    -
    -
    -
    -
    - -
    +
    - + @if (Model.ShowProjectsCombobox && Model.ProjectSelectItems.Count > 1) + { +
    +
    +
    +
    +
    + +
    } - @if (Model.LanguageSelectListItems.Count > 1) - { -
    -
    -
    -
    -
    - +
    + @if (Model.VersionSelectItems.Any()) + { +
    +
    +
    +
    +
    + +
    + +
    -
    -
    - } -
    + } -
    -
    -
    -
    - + @if (Model.LanguageSelectListItems.Count > 1) + { +
    +
    +
    +
    +
    + +
    + +
    +
    +
    - - -
    + }
    -
    +
    +
    +
    +
    + +
    - @if (Model.Navigation == null || Model.Navigation.Content.IsNullOrEmpty()) - { -
    - @L["NavigationDocumentNotFound"] + +
    +
    - } - else - { - - } -
    - -
    -
    - @if (Model.Document != null) - { -
    - +
    -
    -
    -
    - @if (Model.Document.Contributors != null && Model.Document.Contributors.Count > 0) + @if (Model.Document != null) + { +
    + -
    +
    -
    +
    -
    @L["InThisDocument"]
    - +
    @L["InThisDocument"]
    + -
    -
    - } - else - { -
    -

    @L["DocumentNotFound"]

    + } + else + { +
    +

    @L["DocumentNotFound"]

    - - - @L["BackToWebsite"] - -
    - } + + + @L["BackToWebsite"] + +
    + } +
    -
    - +} +else +{ + @(await Component.InvokeAsync(new + { + model = new DocumentNotFoundPageModel + { + ProjectName = Model.ProjectName, + DocumentName = Model.DocumentName, + LanguageCode = Model.LanguageCode, + Version = Model.Version, + } + })) +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs index b4ba841169..5788743784 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; +using Volo.Abp; using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; using Volo.Abp.Domain.Entities; @@ -32,6 +33,8 @@ namespace Volo.Docs.Pages.Documents.Project [BindProperty(SupportsGet = true)] public string LanguageCode { get; set; } + public bool DocumentFound { get; set; } = true; + public string DefaultLanguageCode { get; set; } public ProjectDto Project { get; set; } @@ -48,7 +51,7 @@ namespace Volo.Docs.Pages.Documents.Project public List ProjectSelectItems { get; private set; } - public NavigationWithDetailsDto Navigation { get; private set; } + public NavigationNode Navigation { get; private set; } public VersionInfoViewModel LatestVersionInfo { get; private set; } @@ -60,7 +63,7 @@ namespace Volo.Docs.Pages.Documents.Project public DocumentParametersDto DocumentPreferences { get; set; } - public DocumentRenderParameters UserPreferences { get; set; } + public DocumentRenderParameters UserPreferences { get; set; } = new DocumentRenderParameters(); private readonly IDocumentAppService _documentAppService; private readonly IDocumentToHtmlConverterFactory _documentToHtmlConverterFactory; @@ -85,13 +88,28 @@ namespace Volo.Docs.Pages.Documents.Project } public async Task OnGetAsync() + { + try + { + return await SetPageAsync(); + } + catch (DocumentNotFoundException exception) + { + Logger.LogWarning(exception.Message); + + DocumentFound = false; + return Page(); + } + } + + private async Task SetPageAsync() { DocumentsUrlPrefix = _uiOptions.RoutePrefix; ShowProjectsCombobox = _uiOptions.ShowProjectsCombobox; try { - await SetProjectAsync(); + await SetProjectAsync(); } catch (EntityNotFoundException e) { @@ -270,7 +288,7 @@ namespace Volo.Docs.Pages.Documents.Project { try { - var document = await _documentAppService.GetNavigationAsync( + Navigation = await _documentAppService.GetNavigationAsync( new GetNavigationDocumentInput { ProjectId = Project.Id, @@ -278,15 +296,11 @@ namespace Volo.Docs.Pages.Documents.Project Version = Version } ); - - Navigation = ObjectMapper.Map(document); } catch (DocumentNotFoundException) //TODO: What if called on a remote service which may return 404 { return; } - - Navigation.ConvertItems(); } public string CreateVersionLink(VersionInfoViewModel latestVersion, string version, string documentName = null) @@ -391,10 +405,12 @@ namespace Volo.Docs.Pages.Documents.Project private async Task ConvertDocumentContentToHtmlAsync() { - await SetDocumentPreferences(); + await SetDocumentPreferencesAsync(); SetUserPreferences(); - Document.Content = await _documentSectionRenderer.RenderAsync(Document.Content, UserPreferences); + var partialTemplates = await GetDocumentPartialTemplatesAsync(); + + Document.Content = await _documentSectionRenderer.RenderAsync(Document.Content, UserPreferences, partialTemplates); var converter = _documentToHtmlConverterFactory.Create(Document.Format ?? Project.Format); var content = converter.Convert(Project, Document, GetSpecificVersionOrLatest(), LanguageCode); @@ -415,9 +431,56 @@ namespace Volo.Docs.Pages.Documents.Project Document.Content = content; } + private async Task> GetDocumentPartialTemplatesAsync() + { + var partialTemplatesInDocument = await _documentSectionRenderer.GetPartialTemplatesInDocumentAsync(Document.Content); + + if (!partialTemplatesInDocument?.Any(t => t.Parameters != null) ?? true) + { + return null; + } + + foreach (var partialTemplates in partialTemplatesInDocument) + { + foreach (var parameter in partialTemplates.Parameters) + { + if (!UserPreferences.ContainsKey(parameter.Key)) + { + UserPreferences.Add(parameter.Key, parameter.Value); + } + else + { + UserPreferences[parameter.Key] = parameter.Value; + } + } + } + + var contents = new List(); + + foreach (var partialTemplate in partialTemplatesInDocument) + { + var content = (await _documentAppService.GetAsync(new GetDocumentInput + { + LanguageCode = LanguageCode, + Name = partialTemplate.Path, + ProjectId = Project.Id, + Version = Version + })).Content; + + contents.Add(new DocumentPartialTemplateContent + { + Path = partialTemplate.Path, + Content = content + }); + } + + return contents; + } + private void SetUserPreferences() { - UserPreferences = new DocumentRenderParameters(); + UserPreferences.Add("Document_Language_Code", LanguageCode); + UserPreferences.Add("Document_Version", Version); var cookie = Request.Cookies["AbpDocsPreferences"]; @@ -431,27 +494,30 @@ namespace Volo.Docs.Pages.Documents.Project { continue; } + var key = keyValue.Split("=")[0]; var value = keyValue.Split("=")[1]; UserPreferences.Add(key, value); - UserPreferences.Add(key + "_Value", DocumentPreferences.Parameters?.FirstOrDefault(p=>p.Name == key) - ?.Values.FirstOrDefault(v=>v.Key == value).Value); + UserPreferences.Add(key + "_Value", DocumentPreferences?.Parameters?.FirstOrDefault(p => p.Name == key) + ?.Values.FirstOrDefault(v => v.Key == value).Value); } } var query = Request.Query; - foreach (var keyValue in query) + foreach (var (key, value) in query) { - if (UserPreferences.ContainsKey(keyValue.Key)) + if (UserPreferences.ContainsKey(key)) { - UserPreferences.Remove(keyValue.Key); - UserPreferences.Remove(keyValue.Key + "_Value"); + UserPreferences.Remove(key); + UserPreferences.Remove(key + "_Value"); } - UserPreferences.Add(keyValue.Key, keyValue.Value); - UserPreferences.Add(keyValue.Key + "_Value", DocumentPreferences.Parameters?.FirstOrDefault(p => p.Name == keyValue.Key) - ?.Values.FirstOrDefault(v => v.Key == keyValue.Value).Value); + + UserPreferences.Add(key, value); + UserPreferences.Add(key + "_Value", + DocumentPreferences?.Parameters?.FirstOrDefault(p => p.Name == key)?.Values + .FirstOrDefault(v => v.Key == value).Value); } if (DocumentPreferences?.Parameters == null) @@ -467,9 +533,10 @@ namespace Volo.Docs.Pages.Documents.Project UserPreferences.Add(parameter.Name + "_Value", parameter.Values.FirstOrDefault().Value); } } + } - public async Task SetDocumentPreferences() + public async Task SetDocumentPreferencesAsync() { var projectParameters = await _documentAppService.GetParametersAsync( new GetParametersDocumentInput @@ -479,6 +546,7 @@ namespace Volo.Docs.Pages.Documents.Project Version = Version }); + if (projectParameters?.Parameters == null) { return; diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/index.js b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/index.js index a95677891e..9cbfd547ab 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/index.js +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/index.js @@ -5,7 +5,6 @@ var $navigation = $("#" + navigationContainerId); - var getShownDocumentLinks = function () { return $navigation.find(".mCSB_container > li a:visible").not(".tree-toggle"); }; @@ -140,6 +139,12 @@ window.history.replaceState({}, document.title, new_uri); }; + var getTenYearsLater = function () { + var tenYearsLater = new Date(); + tenYearsLater.setTime(tenYearsLater.getTime() + (365 * 10 * 24 * 60 * 60 * 1000)); + return tenYearsLater; + }; + var setCookies = function () { var cookie = abp.utils.getCookieValue("AbpDocsPreferences"); @@ -161,7 +166,6 @@ if (splitted.length > 0 && splitted[0] === key) { keyValues[k] = key + "=" + value; - console.log(keyValues[k]); changed = true; } } @@ -171,7 +175,7 @@ } } - abp.utils.setCookieValue("AbpDocsPreferences", keyValues.join('|')); + abp.utils.setCookieValue("AbpDocsPreferences", keyValues.join('|'), getTenYearsLater(), '/'); }; $(".doc-section-combobox").change(function () { diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/DocumentNotFoundComponent/Default.cshtml b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/DocumentNotFoundComponent/Default.cshtml new file mode 100644 index 0000000000..604ff05da7 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/DocumentNotFoundComponent/Default.cshtml @@ -0,0 +1,53 @@ +@using Volo.Docs.Pages.Documents.Shared.DocumentNotFoundComponent +@model DocumentNotFoundPageModel +@{ +} +
    +
    + 404 +

    + "@Model.DocumentName" not found in @Model.ProjectName documents, with @Model.Version version and @Model.LanguageCode language. +

    +
    + + Go Back + +
    +
    + + + \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/DocumentNotFoundComponent/DocumentNotFoundPageModel.cs b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/DocumentNotFoundComponent/DocumentNotFoundPageModel.cs new file mode 100644 index 0000000000..72b2b97584 --- /dev/null +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/DocumentNotFoundComponent/DocumentNotFoundPageModel.cs @@ -0,0 +1,15 @@ +namespace Volo.Docs.Pages.Documents.Shared.DocumentNotFoundComponent +{ + public class DocumentNotFoundPageModel + { + public string ProjectName { get; set; } + + public string LanguageCode { get; set; } + + public string Version { get; set; } + + public string DocumentName { get; set; } + + public string DocumentsUrlPrefix { get; set; } + } +} diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/DocumentNotFoundComponent/DocumentNotFoundViewComponent.cs b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/DocumentNotFoundComponent/DocumentNotFoundViewComponent.cs new file mode 100644 index 0000000000..7aeed9beee --- /dev/null +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/DocumentNotFoundComponent/DocumentNotFoundViewComponent.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Options; +using Volo.Abp.AspNetCore.Mvc; + +namespace Volo.Docs.Pages.Documents.Shared.DocumentNotFoundComponent +{ + public class DocumentNotFoundViewComponent : AbpViewComponent + { + private readonly DocsUiOptions _options; + + public DocumentNotFoundViewComponent(IOptions options) + { + _options = options.Value; + } + public IViewComponentResult Invoke(DocumentNotFoundPageModel model, string defaultErrorMessageKey) + { + model.DocumentsUrlPrefix = _options.RoutePrefix; + + return View("~/Pages/Documents/Shared/DocumentNotFoundComponent/Default.cshtml", model); + } + } +} diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/Styles/vs.css b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/Styles/vs.css index 6b58aea222..cbff2c6272 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/Styles/vs.css +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/Styles/vs.css @@ -137,17 +137,17 @@ .docs-page .docs-sidebar .docs-top .navbar-logo .navbar-brand strong { font-weight: 300; text-transform: uppercase; - font-size: .9rem; - opacity: .6; } + font-size: .7em; + letter-spacing: 1px; } .docs-page .docs-sidebar .docs-top .navbar-logo .go-back-site { color: #000; - opacity: .15; - transition: .4s; - font-size: .75rem; + opacity: .65; + transition: .2s; + font-size: .8em; font-weight: 300; } .docs-page .docs-sidebar .docs-top .navbar-logo .go-back-site:hover { text-decoration: none; - opacity: .5; } + opacity: 1; } .docs-page .docs-sidebar .docs-top .navbar-logo .navbar-logo-desc { font-size: .85em; } .docs-page .docs-sidebar .docs-top .navbar-logo .navbar-logo-desc strong { @@ -193,61 +193,63 @@ margin-left: 10px; } .docs-page .docs-content .docs-text-field { padding: 2rem; } - .docs-page .docs-content article.docs-body h1 { - padding-top: 1rem; - font-size: 2.25rem; - padding-bottom: 10px; } - .docs-page .docs-content article.docs-body h2 { - padding-top: 2rem; - padding-bottom: 10px; - font-size: 2rem; } - .docs-page .docs-content article.docs-body h3, .docs-page .docs-content article.docs-body h4, .docs-page .docs-content article.docs-body h5, .docs-page .docs-content article.docs-body h6 { - padding-top: 20px; - padding-bottom: 5px; - font-size: 1.5rem; } - .docs-page .docs-content article.docs-body h1, .docs-page .docs-content article.docs-body h2, .docs-page .docs-content article.docs-body h3, .docs-page .docs-content article.docs-body h4, .docs-page .docs-content article.docs-body h5, .docs-page .docs-content article.docs-body h6 { - position: relative; } - .docs-page .docs-content article.docs-body h1 .anchor, .docs-page .docs-content article.docs-body h2 .anchor, .docs-page .docs-content article.docs-body h3 .anchor, .docs-page .docs-content article.docs-body h4 .anchor, .docs-page .docs-content article.docs-body h5 .anchor, .docs-page .docs-content article.docs-body h6 .anchor { - position: absolute; - right: -26px; - font-size: 18px; - bottom: 5px; - color: #999; - opacity: 0; - transition: .5s; } - .docs-page .docs-content article.docs-body h1:hover .anchor, .docs-page .docs-content article.docs-body h2:hover .anchor, .docs-page .docs-content article.docs-body h3:hover .anchor, .docs-page .docs-content article.docs-body h4:hover .anchor, .docs-page .docs-content article.docs-body h5:hover .anchor, .docs-page .docs-content article.docs-body h6:hover .anchor { - opacity: 1; } - .docs-page .docs-content article.docs-body .blockquote { - margin-bottom: 1rem; - margin-left: 0; - border-left: 2px solid gray; - padding: 1em; - background-color: #eee; - padding-bottom: .2em; } - .docs-page .docs-content article.docs-body img { - max-width: 100%; - border: 1px solid #f4f5f7; - margin: 15px 0 25px; - box-shadow: 0 0 45px #f8f9fa; - border-radius: 6px; } - .docs-page .docs-content article.docs-body table { - display: block; - overflow: auto; - width: 100%; } - .docs-page .docs-content article.docs-body table thead tr { - border-bottom: 2px inset; } - .docs-page .docs-content article.docs-body table th { - font-weight: 600; } - .docs-page .docs-content article.docs-body table td, .docs-page .docs-content article.docs-body table th { - border: 1px solid #dfe2e5; - padding: 6px 13px; } - .docs-page .docs-content article.docs-body table tr { - background-color: #fff; - border-top: 1px solid #c6cbd1; } - .docs-page .docs-content article.docs-body table tr:nth-child(2n) { - background-color: #f6f8fa; } - .docs-page .docs-content article.docs-body table img { - background-color: initial; } + .docs-page .docs-content article.docs-body { + word-break: break-word; } + .docs-page .docs-content article.docs-body h1 { + padding-top: 1rem; + font-size: 2.25rem; + padding-bottom: 10px; } + .docs-page .docs-content article.docs-body h2 { + padding-top: 2rem; + padding-bottom: 10px; + font-size: 2rem; } + .docs-page .docs-content article.docs-body h3, .docs-page .docs-content article.docs-body h4, .docs-page .docs-content article.docs-body h5, .docs-page .docs-content article.docs-body h6 { + padding-top: 20px; + padding-bottom: 5px; + font-size: 1.5rem; } + .docs-page .docs-content article.docs-body h1, .docs-page .docs-content article.docs-body h2, .docs-page .docs-content article.docs-body h3, .docs-page .docs-content article.docs-body h4, .docs-page .docs-content article.docs-body h5, .docs-page .docs-content article.docs-body h6 { + position: relative; } + .docs-page .docs-content article.docs-body h1 .anchor, .docs-page .docs-content article.docs-body h2 .anchor, .docs-page .docs-content article.docs-body h3 .anchor, .docs-page .docs-content article.docs-body h4 .anchor, .docs-page .docs-content article.docs-body h5 .anchor, .docs-page .docs-content article.docs-body h6 .anchor { + position: absolute; + right: -26px; + font-size: 18px; + bottom: 5px; + color: #999; + opacity: 0; + transition: .5s; } + .docs-page .docs-content article.docs-body h1:hover .anchor, .docs-page .docs-content article.docs-body h2:hover .anchor, .docs-page .docs-content article.docs-body h3:hover .anchor, .docs-page .docs-content article.docs-body h4:hover .anchor, .docs-page .docs-content article.docs-body h5:hover .anchor, .docs-page .docs-content article.docs-body h6:hover .anchor { + opacity: 1; } + .docs-page .docs-content article.docs-body .blockquote { + margin-bottom: 1rem; + margin-left: 0; + border-left: 2px solid gray; + padding: 1em; + background-color: #eee; + padding-bottom: .2em; } + .docs-page .docs-content article.docs-body img { + max-width: 100%; + border: 1px solid #f4f5f7; + margin: 15px 0 25px; + box-shadow: 0 0 45px #f8f9fa; + border-radius: 6px; } + .docs-page .docs-content article.docs-body table { + display: block; + overflow: auto; + width: 100%; } + .docs-page .docs-content article.docs-body table thead tr { + border-bottom: 2px inset; } + .docs-page .docs-content article.docs-body table th { + font-weight: 600; } + .docs-page .docs-content article.docs-body table td, .docs-page .docs-content article.docs-body table th { + border: 1px solid #dfe2e5; + padding: 6px 13px; } + .docs-page .docs-content article.docs-body table tr { + background-color: #fff; + border-top: 1px solid #c6cbd1; } + .docs-page .docs-content article.docs-body table tr:nth-child(2n) { + background-color: #f6f8fa; } + .docs-page .docs-content article.docs-body table img { + background-color: initial; } .docs-page .docs-page-index { min-height: 96vh; } .docs-page .docs-page-index #scroll-index { diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/Styles/vs.min.css b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/Styles/vs.min.css index 4605cb9eff..2111ae8075 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/Styles/vs.min.css +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/Styles/vs.min.css @@ -1 +1 @@ -body{position:relative;}.docs-page{background:#f5f7f9;}.docs-page .anchorjs-link{transition:all .25s linear;}.docs-page *:hover>.anchorjs-link{margin-left:-1.125em !important;transition:color .25s linear;color:#808080;}.docs-page .anchorjs-link:hover{color:#007bff;text-decoration:none;}.docs-page .docs-sidebar{background:#f5f7f9;padding-right:1rem;position:relative;top:0;left:0;position:fixed;}.docs-page .docs-sidebar .docs-sidebar-wrapper{width:270px;float:right;}.docs-page .docs-sidebar .docs-sidebar-wrapper input.form-control{background:none;background:#fff;border:0;}.docs-page .docs-sidebar .docs-sidebar-wrapper input.form-control:focus,.docs-page .docs-sidebar .docs-sidebar-wrapper input.form-control:active,.docs-page .docs-sidebar .docs-sidebar-wrapper input.form-control:hover,.docs-page .docs-sidebar .docs-sidebar-wrapper input.form-control:visited{box-shadow:none;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version{position:relative;padding:0 1rem;margin:.25rem 0;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select{border-radius:3px;border:1px solid #e9ecef;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select .input-group-text{padding:.375rem .6rem;font-size:.9rem;width:32px;height:30px;line-height:1;border-radius:0;border:1px solid #e9ecef;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select select.form-control,.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select input.form-control{padding:0 10px;border:0;min-height:30px;height:30px;font-size:.85em;border-radius:1px;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select select.form-control:focus,.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select select.form-control:active,.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select select.form-control:hover,.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select select.form-control:visited,.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select input.form-control:focus,.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select input.form-control:active,.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select input.form-control:hover,.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select input.form-control:visited{box-shadow:none;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select select.form-control{padding-left:6px;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-filter{padding:0 1rem;margin:.5rem 0;font-size:.9em;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-filter .filter-icon i.fa{color:#ddd;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list{height:100vh;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list>ul{display:block;height:calc(100vh - 220px);overflow-y:auto;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul{font-size:.935em;list-style:none;padding:0 1rem;margin:0;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li{margin-left:0;padding-left:24px;display:block;width:100%;position:relative;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li a{color:#999;font-weight:700;padding:7px 0;display:block;border-bottom:0;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li a:hover{color:#000;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li a.last-link{top:11px;color:#aaa;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li span.tree-toggle{color:#999;padding:7px 0;display:block;border-bottom:0;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li .plus-icon{font-size:.85em;transition:.3s;width:18px;height:18px;text-align:center;padding:0;line-height:1;border-radius:50%;margin-right:4px;position:absolute;left:2px;top:11px;color:#aaa;cursor:default;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li .plus-icon .fa-long-arrow-right.no-link{color:#555;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li .plus-icon .fa-chevron-right{cursor:pointer;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li ul{padding:0;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li ul li a{font-weight:400;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li ul li ul{padding:0;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li ul li ul li a{font-weight:300;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li.selected-tree>a{color:#000;transition:.4s;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li.selected-tree>span .fa{transform:rotate(90deg);color:#007bff;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li.selected-tree.last-link>span .fa{transform:rotate(0deg);}.docs-page .docs-sidebar .docs-top .navbar-logo .navbar-brand{font-size:1.5rem;color:#000;font-weight:700;padding:20px 0 10px;line-height:1;}.docs-page .docs-sidebar .docs-top .navbar-logo .navbar-brand strong{font-weight:300;text-transform:uppercase;font-size:.9rem;opacity:.6;}.docs-page .docs-sidebar .docs-top .navbar-logo .go-back-site{color:#000;opacity:.15;transition:.4s;font-size:.75rem;font-weight:300;}.docs-page .docs-sidebar .docs-top .navbar-logo .go-back-site:hover{text-decoration:none;opacity:.5;}.docs-page .docs-sidebar .docs-top .navbar-logo .navbar-logo-desc{font-size:.85em;}.docs-page .docs-sidebar .docs-top .navbar-logo .navbar-logo-desc strong{display:block;}.docs-page .docs-content{overflow-x:scroll;}.docs-page .docs-content .contributors{position:absolute;top:15px;right:5px;}.docs-page .docs-content .contributors .contributors-avatar{border-radius:21px;width:21px;height:21px;}.docs-page .docs-content .contributors a{padding:0;width:21px;height:21px;display:inline-block;margin:0 0 0 2px;}.docs-page .docs-content .contributors a:hover{text-decoration:none;}.docs-page .docs-content .docs-link-btns{border-bottom:1px solid #f4f5f7;background:#fdfdfd;padding:10px 20px;margin:0 -15px;text-align:right;font-size:.8em;min-height:40px;}.docs-page .docs-content .docs-link-btns a{color:#999;}.docs-page .docs-content .docs-link-btns a:hover{color:#444;text-decoration:none;}.docs-page .docs-content .docs-link-btns .twitter{color:#00acee;}.docs-page .docs-content .docs-link-btns .linkedin{color:#0077b5;}.docs-page .docs-content .docs-link-btns .email{color:#5a5a5a;}.docs-page .docs-content .docs-link-btns .share-button{margin-left:10px;}.docs-page .docs-content .docs-text-field{padding:2rem;}.docs-page .docs-content article.docs-body h1{padding-top:1rem;font-size:2.25rem;padding-bottom:10px;}.docs-page .docs-content article.docs-body h2{padding-top:2rem;padding-bottom:10px;font-size:2rem;}.docs-page .docs-content article.docs-body h3,.docs-page .docs-content article.docs-body h4,.docs-page .docs-content article.docs-body h5,.docs-page .docs-content article.docs-body h6{padding-top:20px;padding-bottom:5px;font-size:1.5rem;}.docs-page .docs-content article.docs-body h1,.docs-page .docs-content article.docs-body h2,.docs-page .docs-content article.docs-body h3,.docs-page .docs-content article.docs-body h4,.docs-page .docs-content article.docs-body h5,.docs-page .docs-content article.docs-body h6{position:relative;}.docs-page .docs-content article.docs-body h1 .anchor,.docs-page .docs-content article.docs-body h2 .anchor,.docs-page .docs-content article.docs-body h3 .anchor,.docs-page .docs-content article.docs-body h4 .anchor,.docs-page .docs-content article.docs-body h5 .anchor,.docs-page .docs-content article.docs-body h6 .anchor{position:absolute;right:-26px;font-size:18px;bottom:5px;color:#999;opacity:0;transition:.5s;}.docs-page .docs-content article.docs-body h1:hover .anchor,.docs-page .docs-content article.docs-body h2:hover .anchor,.docs-page .docs-content article.docs-body h3:hover .anchor,.docs-page .docs-content article.docs-body h4:hover .anchor,.docs-page .docs-content article.docs-body h5:hover .anchor,.docs-page .docs-content article.docs-body h6:hover .anchor{opacity:1;}.docs-page .docs-content article.docs-body .blockquote{margin-bottom:1rem;margin-left:0;border-left:2px solid #808080;padding:1em;background-color:#eee;padding-bottom:.2em;}.docs-page .docs-content article.docs-body img{max-width:100%;border:1px solid #f4f5f7;margin:15px 0 25px;box-shadow:0 0 45px #f8f9fa;border-radius:6px;}.docs-page .docs-content article.docs-body table{display:block;overflow:auto;width:100%;}.docs-page .docs-content article.docs-body table thead tr{border-bottom:2px inset;}.docs-page .docs-content article.docs-body table th{font-weight:600;}.docs-page .docs-content article.docs-body table td,.docs-page .docs-content article.docs-body table th{border:1px solid #dfe2e5;padding:6px 13px;}.docs-page .docs-content article.docs-body table tr{background-color:#fff;border-top:1px solid #c6cbd1;}.docs-page .docs-content article.docs-body table tr:nth-child(2n){background-color:#f6f8fa;}.docs-page .docs-content article.docs-body table img{background-color:initial;}.docs-page .docs-page-index{min-height:96vh;}.docs-page .docs-page-index #scroll-index{max-height:96vh;}.docs-page .docs-page-index .docs-inner-anchors{position:fixed;top:0;padding:10px;font-size:.9em;}.docs-page .docs-page-index .docs-inner-anchors .navbar .nav-pills{font-size:.92em;margin-left:15px;border-left:1px solid #eee;}.docs-page .docs-page-index .docs-inner-anchors .navbar .nav-pills .nav-link{padding:3px 14px 4px;color:#aaa;line-height:1.2;position:relative;border-left:1px solid #eee;border-radius:0;margin-left:-1px;margin-top:1px;margin-bottom:1px;transition:.2s;font-weight:normal;}.docs-page .docs-page-index .docs-inner-anchors .navbar .nav-pills .nav-link.active{border-left:1px solid #007bff;background:none;color:#007bff;font-weight:normal;}.docs-page .docs-page-index .docs-inner-anchors .navbar .nav-pills .nav-pills .nav-link.active{color:#007bff;}.docs-page .docs-page-index .docs-inner-anchors .navbar .nav-pills .nav-pills .nav-pills .nav-link.active{color:#007bff;}.docs-page .docs-page-index .docs-inner-anchors .index-scroll{margin-left:-30px;}.docs-page .docs-page-index .docs-inner-anchors .docs-anchors-wrapper{max-width:300px;float:left;}.docs-page .docs-page-index .scroll-top-btn{display:none;font-size:.85em;color:#aaa;text-decoration:none;padding-left:18px;}.docs-page .docs-page-index .scroll-top-btn.showup{display:block;}@media(min-width:1100px){.container{max-width:1080px;}.docs-page .docs-sidebar.dark-sidebar{background:#191919;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-version .version-select{border:1px solid #333;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-version .version-select select.form-control,.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-version .version-select input.form-control{background:#191919;border-color:#191919;color:#999;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-version .version-select input.form-control{background:#191919;border-color:#191919;color:#999;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-version .version-select input.form-control::placeholder{color:#999;opacity:.5;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-version .version-select label{background:#333;border-color:#333;color:#ddd;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-filter .form-control{background:#333;color:#999;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-filter select{border:0;border-radius:6px;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-filter .filter-icon i.fa{color:#aaa;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-tree-list ul li a{color:#aaa;border-bottom:0;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-tree-list ul li a:hover{color:#fff;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-tree-list ul li a .plus-icon{font-size:.85em;transition:.3s;width:18px;height:18px;text-align:center;padding:0;line-height:1;border-radius:50%;margin-right:4px;position:absolute;left:2px;top:11px;color:#aaa;cursor:default;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-tree-list ul li a .plus-icon .fa-long-arrow-right.no-link{color:#555;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-tree-list ul li a .plus-icon .fa-chevron-right{cursor:pointer;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-tree-list ul li a .plus-icon.last-link{top:11px;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-tree-list ul li span.tree-toggle{color:#555;padding:7px 0;display:block;border-bottom:0;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-tree-list ul li.selected-tree>a{color:#fff;transition:.4s;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-tree-list ul li.selected-tree>a span .fa{color:#fff;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-tree-list ul li.selected-tree>a span:not(.last-link) .fa{transform:rotate(90deg);color:#fff;}.docs-page .docs-sidebar.dark-sidebar .docs-top .navbar-logo .navbar-brand{color:#fff;text-transform:uppercase;white-space:unset;}.docs-page .docs-sidebar.dark-sidebar .docs-top .navbar-logo .go-back-site{color:#fff;}.docs-page .docs-sidebar.dark-sidebar .docs-top .navbar-logo .navbar-logo-desc{color:#ddd;}}@media(min-width:1366px){.container{max-width:1340px;}}@media(min-width:1440px){.container{max-width:1400px;}}@media(max-width:767px){.docs-page .docs-content article.docs-body h1{padding-top:1.5rem;}.docs-page{background:#f5f7f9;}.docs-page>.container-fluid{display:block;}.docs-page>.container-fluid>.row{display:block;}.docs-page .docs-sidebar{position:fixed;max-width:100%;width:100%;display:block;padding:0 !important;top:0;left:0;z-index:100;right:0;}.docs-page .docs-sidebar .docs-sidebar-wrapper{max-width:100%;width:100%;top:0;position:relative;margin:0 !important;height:72px;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list{padding:.5rem 1.5rem 2rem 1.5rem;position:fixed;top:70px;font-size:17px;left:0;width:100%;z-index:100;background:#f5f7f9;display:none;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list .docs-filter{padding:0 0 1rem !important;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version label{width:36px;text-align:center;padding-left:0;padding-right:0;display:inline-block;line-height:26px;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version input.form-control{padding-left:12px !important;}.docs-page .docs-sidebar .docs-top .navbar-logo{padding:0;padding-top:.3rem;display:block;text-align:center;}.docs-page .docs-sidebar .docs-top .navbar-logo .navbar-brand{font-size:1.5rem;font-weight:700;display:block;margin-right:0;padding:7px 0 10px;text-transform:uppercase;}.docs-page .docs-sidebar .docs-top .navbar-logo .navbar-brand .docs-logo{width:110px;}.docs-page .docs-sidebar .docs-top .navbar-logo .go-back-site{display:none;}.docs-page .docs-sidebar .docs-top .navbar-logo .navbar-logo-desc{font-size:1em;display:none;}.docs-page .docs-sidebar .docs-top .open-dmenu{position:absolute;top:10px;left:20px;}.docs-page .docs-content{padding-top:72px;max-width:100%;display:block !important;}.docs-page .docs-content .docs-text-field{padding:1rem 1.5rem;}.docs-page .docs-page-index{display:none;}}.for-mobile{display:none;}.for-desktop{display:inline-block;}pre[class*="language-"]{padding:1.4em 2em !important;margin:15px 0 25px !important;border-radius:6px;}code{padding:.2em .4em;margin:0;font-size:82%;background-color:#f0f1f3;border-radius:3px;color:#28a745;}pre code{padding:0;}pre .token.keyword{color:#569cd6;}pre .token.atrule,pre .token.attr-value,pre .token.function,pre .token.class-name{color:#d69d85;}:not(pre)>code[class*="language-"],pre[class*="language-"]{background:#191919 !important;}div.code-toolbar>.toolbar span{cursor:default;}div.code-toolbar>.toolbar a{cursor:copy;}@media(max-width:767px){body{font-size:14px;}.for-mobile{display:inline-block;}.for-desktop{display:none;}.close-mmenu,.close-dmenu{position:absolute;top:-78px;left:25px;color:#fff;font-size:68px;background:#fff;opacity:0;}.navbar{padding:.5rem 1.75rem;}.navbar .navbar-collapse{background:#38003d;position:fixed;top:86px;left:0;width:100%;height:100vh;height:calc(100vh - 86px);z-index:100 !important;}.navbar .navbar-collapse .navbar-nav{height:100vh;padding:20px 30px;overflow:auto;}.navbar .navbar-collapse .navbar-nav .nav-link{padding:1.2rem !important;}.navbar .navbar-toggler{padding:.5rem .75rem;font-size:1.5rem;line-height:1;background-color:transparent;border:0;border-radius:.25rem;color:#fff !important;margin-left:-1rem;}.section-with-logos img{margin:15px;opacity:1;-webkit-filter:grayscale(0%);filter:grayscale(0%);}span.code-arrow{padding:0 0 0;display:block;transform:rotate(90deg);font-size:2em;}.mb-5,.my-5{margin-bottom:2rem !important;}}@media screen and (max-width:767px){.navbar-logo .navbar-brand{display:inline-block;margin:0 auto !important;max-width:70%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}}.alert-criteria{padding:1.25em 1.5em;max-width:100%;}.alert-criteria p.alert-p{font-size:.96em;}.alert-criteria .input-group .input-group-text,.alert-criteria .input-group .form-control{font-size:.96em;}@media screen and (max-width:767px){.alert-criteria .input-group .input-group-text,.alert-criteria .input-group .form-control{font-size:.88em;}}.alert-criteria .input-group .input-group-text{color:#004085;background-color:#bddcfd;border:1px solid #bddcfd;}@media screen and (max-width:1366px){.alert-criteria .input-group .input-group-text{display:none;}}.alert-criteria .input-group .form-control{color:#004085;background-color:#fff;border:1px solid #bddcfd;}@media screen and (max-width:1366px){.alert-criteria .input-group .form-control{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem;}}.scrolledMore{padding-top:107px;}.scrolledMore .alert-criteria{position:fixed;top:0;z-index:10;border:0;border-radius:0;margin-left:-47px;padding:.5em .75em;}@media screen and (max-width:767px){.scrolledMore .alert-criteria{top:72px;margin-left:-36px;}}.scrolledMore .alert-criteria p.alert-p{display:none;} \ No newline at end of file +body{position:relative;}.docs-page{background:#f5f7f9;}.docs-page .anchorjs-link{transition:all .25s linear;}.docs-page *:hover>.anchorjs-link{margin-left:-1.125em !important;transition:color .25s linear;color:#808080;}.docs-page .anchorjs-link:hover{color:#007bff;text-decoration:none;}.docs-page .docs-sidebar{background:#f5f7f9;padding-right:1rem;position:relative;top:0;left:0;position:fixed;}.docs-page .docs-sidebar .docs-sidebar-wrapper{width:270px;float:right;}.docs-page .docs-sidebar .docs-sidebar-wrapper input.form-control{background:none;background:#fff;border:0;}.docs-page .docs-sidebar .docs-sidebar-wrapper input.form-control:focus,.docs-page .docs-sidebar .docs-sidebar-wrapper input.form-control:active,.docs-page .docs-sidebar .docs-sidebar-wrapper input.form-control:hover,.docs-page .docs-sidebar .docs-sidebar-wrapper input.form-control:visited{box-shadow:none;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version{position:relative;padding:0 1rem;margin:.25rem 0;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select{border-radius:3px;border:1px solid #e9ecef;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select .input-group-text{padding:.375rem .6rem;font-size:.9rem;width:32px;height:30px;line-height:1;border-radius:0;border:1px solid #e9ecef;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select select.form-control,.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select input.form-control{padding:0 10px;border:0;min-height:30px;height:30px;font-size:.85em;border-radius:1px;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select select.form-control:focus,.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select select.form-control:active,.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select select.form-control:hover,.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select select.form-control:visited,.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select input.form-control:focus,.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select input.form-control:active,.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select input.form-control:hover,.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select input.form-control:visited{box-shadow:none;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version .version-select select.form-control{padding-left:6px;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-filter{padding:0 1rem;margin:.5rem 0;font-size:.9em;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-filter .filter-icon i.fa{color:#ddd;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list{height:100vh;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list>ul{display:block;height:calc(100vh - 220px);overflow-y:auto;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul{font-size:.935em;list-style:none;padding:0 1rem;margin:0;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li{margin-left:0;padding-left:24px;display:block;width:100%;position:relative;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li a{color:#999;font-weight:700;padding:7px 0;display:block;border-bottom:0;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li a:hover{color:#000;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li a.last-link{top:11px;color:#aaa;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li span.tree-toggle{color:#999;padding:7px 0;display:block;border-bottom:0;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li .plus-icon{font-size:.85em;transition:.3s;width:18px;height:18px;text-align:center;padding:0;line-height:1;border-radius:50%;margin-right:4px;position:absolute;left:2px;top:11px;color:#aaa;cursor:default;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li .plus-icon .fa-long-arrow-right.no-link{color:#555;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li .plus-icon .fa-chevron-right{cursor:pointer;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li ul{padding:0;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li ul li a{font-weight:400;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li ul li ul{padding:0;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li ul li ul li a{font-weight:300;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li.selected-tree>a{color:#000;transition:.4s;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li.selected-tree>span .fa{transform:rotate(90deg);color:#007bff;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list ul li.selected-tree.last-link>span .fa{transform:rotate(0deg);}.docs-page .docs-sidebar .docs-top .navbar-logo .navbar-brand{font-size:1.5rem;color:#000;font-weight:700;padding:20px 0 10px;line-height:1;}.docs-page .docs-sidebar .docs-top .navbar-logo .navbar-brand strong{font-weight:300;text-transform:uppercase;font-size:.7em;letter-spacing:1px;}.docs-page .docs-sidebar .docs-top .navbar-logo .go-back-site{color:#000;opacity:.65;transition:.2s;font-size:.8em;font-weight:300;}.docs-page .docs-sidebar .docs-top .navbar-logo .go-back-site:hover{text-decoration:none;opacity:1;}.docs-page .docs-sidebar .docs-top .navbar-logo .navbar-logo-desc{font-size:.85em;}.docs-page .docs-sidebar .docs-top .navbar-logo .navbar-logo-desc strong{display:block;}.docs-page .docs-content{overflow-x:scroll;}.docs-page .docs-content .contributors{position:absolute;top:15px;right:5px;}.docs-page .docs-content .contributors .contributors-avatar{border-radius:21px;width:21px;height:21px;}.docs-page .docs-content .contributors a{padding:0;width:21px;height:21px;display:inline-block;margin:0 0 0 2px;}.docs-page .docs-content .contributors a:hover{text-decoration:none;}.docs-page .docs-content .docs-link-btns{border-bottom:1px solid #f4f5f7;background:#fdfdfd;padding:10px 20px;margin:0 -15px;text-align:right;font-size:.8em;min-height:40px;}.docs-page .docs-content .docs-link-btns a{color:#999;}.docs-page .docs-content .docs-link-btns a:hover{color:#444;text-decoration:none;}.docs-page .docs-content .docs-link-btns .twitter{color:#00acee;}.docs-page .docs-content .docs-link-btns .linkedin{color:#0077b5;}.docs-page .docs-content .docs-link-btns .email{color:#5a5a5a;}.docs-page .docs-content .docs-link-btns .share-button{margin-left:10px;}.docs-page .docs-content .docs-text-field{padding:2rem;}.docs-page .docs-content article.docs-body{word-break:break-word;}.docs-page .docs-content article.docs-body h1{padding-top:1rem;font-size:2.25rem;padding-bottom:10px;}.docs-page .docs-content article.docs-body h2{padding-top:2rem;padding-bottom:10px;font-size:2rem;}.docs-page .docs-content article.docs-body h3,.docs-page .docs-content article.docs-body h4,.docs-page .docs-content article.docs-body h5,.docs-page .docs-content article.docs-body h6{padding-top:20px;padding-bottom:5px;font-size:1.5rem;}.docs-page .docs-content article.docs-body h1,.docs-page .docs-content article.docs-body h2,.docs-page .docs-content article.docs-body h3,.docs-page .docs-content article.docs-body h4,.docs-page .docs-content article.docs-body h5,.docs-page .docs-content article.docs-body h6{position:relative;}.docs-page .docs-content article.docs-body h1 .anchor,.docs-page .docs-content article.docs-body h2 .anchor,.docs-page .docs-content article.docs-body h3 .anchor,.docs-page .docs-content article.docs-body h4 .anchor,.docs-page .docs-content article.docs-body h5 .anchor,.docs-page .docs-content article.docs-body h6 .anchor{position:absolute;right:-26px;font-size:18px;bottom:5px;color:#999;opacity:0;transition:.5s;}.docs-page .docs-content article.docs-body h1:hover .anchor,.docs-page .docs-content article.docs-body h2:hover .anchor,.docs-page .docs-content article.docs-body h3:hover .anchor,.docs-page .docs-content article.docs-body h4:hover .anchor,.docs-page .docs-content article.docs-body h5:hover .anchor,.docs-page .docs-content article.docs-body h6:hover .anchor{opacity:1;}.docs-page .docs-content article.docs-body .blockquote{margin-bottom:1rem;margin-left:0;border-left:2px solid #808080;padding:1em;background-color:#eee;padding-bottom:.2em;}.docs-page .docs-content article.docs-body img{max-width:100%;border:1px solid #f4f5f7;margin:15px 0 25px;box-shadow:0 0 45px #f8f9fa;border-radius:6px;}.docs-page .docs-content article.docs-body table{display:block;overflow:auto;width:100%;}.docs-page .docs-content article.docs-body table thead tr{border-bottom:2px inset;}.docs-page .docs-content article.docs-body table th{font-weight:600;}.docs-page .docs-content article.docs-body table td,.docs-page .docs-content article.docs-body table th{border:1px solid #dfe2e5;padding:6px 13px;}.docs-page .docs-content article.docs-body table tr{background-color:#fff;border-top:1px solid #c6cbd1;}.docs-page .docs-content article.docs-body table tr:nth-child(2n){background-color:#f6f8fa;}.docs-page .docs-content article.docs-body table img{background-color:initial;}.docs-page .docs-page-index{min-height:96vh;}.docs-page .docs-page-index #scroll-index{max-height:96vh;}.docs-page .docs-page-index .docs-inner-anchors{position:fixed;top:0;padding:10px;font-size:.9em;}.docs-page .docs-page-index .docs-inner-anchors .navbar .nav-pills{font-size:.92em;margin-left:15px;border-left:1px solid #eee;}.docs-page .docs-page-index .docs-inner-anchors .navbar .nav-pills .nav-link{padding:3px 14px 4px;color:#aaa;line-height:1.2;position:relative;border-left:1px solid #eee;border-radius:0;margin-left:-1px;margin-top:1px;margin-bottom:1px;transition:.2s;font-weight:normal;}.docs-page .docs-page-index .docs-inner-anchors .navbar .nav-pills .nav-link.active{border-left:1px solid #007bff;background:none;color:#007bff;font-weight:normal;}.docs-page .docs-page-index .docs-inner-anchors .navbar .nav-pills .nav-pills .nav-link.active{color:#007bff;}.docs-page .docs-page-index .docs-inner-anchors .navbar .nav-pills .nav-pills .nav-pills .nav-link.active{color:#007bff;}.docs-page .docs-page-index .docs-inner-anchors .index-scroll{margin-left:-30px;}.docs-page .docs-page-index .docs-inner-anchors .docs-anchors-wrapper{max-width:300px;float:left;}.docs-page .docs-page-index .scroll-top-btn{display:none;font-size:.85em;color:#aaa;text-decoration:none;padding-left:18px;}.docs-page .docs-page-index .scroll-top-btn.showup{display:block;}@media(min-width:1100px){.container{max-width:1080px;}.docs-page .docs-sidebar.dark-sidebar{background:#191919;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-version .version-select{border:1px solid #333;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-version .version-select select.form-control,.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-version .version-select input.form-control{background:#191919;border-color:#191919;color:#999;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-version .version-select input.form-control{background:#191919;border-color:#191919;color:#999;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-version .version-select input.form-control::placeholder{color:#999;opacity:.5;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-version .version-select label{background:#333;border-color:#333;color:#ddd;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-filter .form-control{background:#333;color:#999;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-filter select{border:0;border-radius:6px;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-filter .filter-icon i.fa{color:#aaa;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-tree-list ul li a{color:#aaa;border-bottom:0;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-tree-list ul li a:hover{color:#fff;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-tree-list ul li a .plus-icon{font-size:.85em;transition:.3s;width:18px;height:18px;text-align:center;padding:0;line-height:1;border-radius:50%;margin-right:4px;position:absolute;left:2px;top:11px;color:#aaa;cursor:default;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-tree-list ul li a .plus-icon .fa-long-arrow-right.no-link{color:#555;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-tree-list ul li a .plus-icon .fa-chevron-right{cursor:pointer;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-tree-list ul li a .plus-icon.last-link{top:11px;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-tree-list ul li span.tree-toggle{color:#555;padding:7px 0;display:block;border-bottom:0;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-tree-list ul li.selected-tree>a{color:#fff;transition:.4s;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-tree-list ul li.selected-tree>a span .fa{color:#fff;}.docs-page .docs-sidebar.dark-sidebar .docs-sidebar-wrapper .docs-tree-list ul li.selected-tree>a span:not(.last-link) .fa{transform:rotate(90deg);color:#fff;}.docs-page .docs-sidebar.dark-sidebar .docs-top .navbar-logo .navbar-brand{color:#fff;text-transform:uppercase;white-space:unset;}.docs-page .docs-sidebar.dark-sidebar .docs-top .navbar-logo .go-back-site{color:#fff;}.docs-page .docs-sidebar.dark-sidebar .docs-top .navbar-logo .navbar-logo-desc{color:#ddd;}}@media(min-width:1366px){.container{max-width:1340px;}}@media(min-width:1440px){.container{max-width:1400px;}}@media(max-width:767px){.docs-page .docs-content article.docs-body h1{padding-top:1.5rem;}.docs-page{background:#f5f7f9;}.docs-page>.container-fluid{display:block;}.docs-page>.container-fluid>.row{display:block;}.docs-page .docs-sidebar{position:fixed;max-width:100%;width:100%;display:block;padding:0 !important;top:0;left:0;z-index:100;right:0;}.docs-page .docs-sidebar .docs-sidebar-wrapper{max-width:100%;width:100%;top:0;position:relative;margin:0 !important;height:72px;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list{padding:.5rem 1.5rem 2rem 1.5rem;position:fixed;top:70px;font-size:17px;left:0;width:100%;z-index:100;background:#f5f7f9;display:none;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-tree-list .docs-filter{padding:0 0 1rem !important;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version label{width:36px;text-align:center;padding-left:0;padding-right:0;display:inline-block;line-height:26px;}.docs-page .docs-sidebar .docs-sidebar-wrapper .docs-version input.form-control{padding-left:12px !important;}.docs-page .docs-sidebar .docs-top .navbar-logo{padding:0;padding-top:.3rem;display:block;text-align:center;}.docs-page .docs-sidebar .docs-top .navbar-logo .navbar-brand{font-size:1.5rem;font-weight:700;display:block;margin-right:0;padding:7px 0 10px;text-transform:uppercase;}.docs-page .docs-sidebar .docs-top .navbar-logo .navbar-brand .docs-logo{width:110px;}.docs-page .docs-sidebar .docs-top .navbar-logo .go-back-site{display:none;}.docs-page .docs-sidebar .docs-top .navbar-logo .navbar-logo-desc{font-size:1em;display:none;}.docs-page .docs-sidebar .docs-top .open-dmenu{position:absolute;top:10px;left:20px;}.docs-page .docs-content{padding-top:72px;max-width:100%;display:block !important;}.docs-page .docs-content .docs-text-field{padding:1rem 1.5rem;}.docs-page .docs-page-index{display:none;}}.for-mobile{display:none;}.for-desktop{display:inline-block;}pre[class*="language-"]{padding:1.4em 2em !important;margin:15px 0 25px !important;border-radius:6px;}code{padding:.2em .4em;margin:0;font-size:82%;background-color:#f0f1f3;border-radius:3px;color:#28a745;}pre code{padding:0;}pre .token.keyword{color:#569cd6;}pre .token.atrule,pre .token.attr-value,pre .token.function,pre .token.class-name{color:#d69d85;}:not(pre)>code[class*="language-"],pre[class*="language-"]{background:#191919 !important;}div.code-toolbar>.toolbar span{cursor:default;}div.code-toolbar>.toolbar a{cursor:copy;}@media(max-width:767px){body{font-size:14px;}.for-mobile{display:inline-block;}.for-desktop{display:none;}.close-mmenu,.close-dmenu{position:absolute;top:-78px;left:25px;color:#fff;font-size:68px;background:#fff;opacity:0;}.navbar{padding:.5rem 1.75rem;}.navbar .navbar-collapse{background:#38003d;position:fixed;top:86px;left:0;width:100%;height:100vh;height:calc(100vh - 86px);z-index:100 !important;}.navbar .navbar-collapse .navbar-nav{height:100vh;padding:20px 30px;overflow:auto;}.navbar .navbar-collapse .navbar-nav .nav-link{padding:1.2rem !important;}.navbar .navbar-toggler{padding:.5rem .75rem;font-size:1.5rem;line-height:1;background-color:transparent;border:0;border-radius:.25rem;color:#fff !important;margin-left:-1rem;}.section-with-logos img{margin:15px;opacity:1;-webkit-filter:grayscale(0%);filter:grayscale(0%);}span.code-arrow{padding:0 0 0;display:block;transform:rotate(90deg);font-size:2em;}.mb-5,.my-5{margin-bottom:2rem !important;}}@media screen and (max-width:767px){.navbar-logo .navbar-brand{display:inline-block;margin:0 auto !important;max-width:70%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}}.alert-criteria{padding:1.25em 1.5em;max-width:100%;}.alert-criteria p.alert-p{font-size:.96em;}.alert-criteria .input-group .input-group-text,.alert-criteria .input-group .form-control{font-size:.96em;}@media screen and (max-width:767px){.alert-criteria .input-group .input-group-text,.alert-criteria .input-group .form-control{font-size:.88em;}}.alert-criteria .input-group .input-group-text{color:#004085;background-color:#bddcfd;border:1px solid #bddcfd;}@media screen and (max-width:1366px){.alert-criteria .input-group .input-group-text{display:none;}}.alert-criteria .input-group .form-control{color:#004085;background-color:#fff;border:1px solid #bddcfd;}@media screen and (max-width:1366px){.alert-criteria .input-group .form-control{border-top-left-radius:.25rem;border-bottom-left-radius:.25rem;}}.scrolledMore{padding-top:107px;}.scrolledMore .alert-criteria{position:fixed;top:0;z-index:10;border:0;border-radius:0;margin-left:-47px;padding:.5em .75em;}@media screen and (max-width:767px){.scrolledMore .alert-criteria{top:72px;margin-left:-36px;}}.scrolledMore .alert-criteria p.alert-p{display:none;} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/Styles/vs.scss b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/Styles/vs.scss index cf6e577a28..771070f775 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/Styles/vs.scss +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/Styles/vs.scss @@ -233,21 +233,21 @@ body { strong { font-weight: 300; text-transform: uppercase; - font-size: .9rem; - opacity: .6; + font-size: .7em; + letter-spacing: 1px; } } .go-back-site { color: #000; - opacity: .15; - transition: .4s; - font-size: .75rem; + opacity: .65; + transition: .2s; + font-size: .8em; font-weight: 300; &:hover { text-decoration: none; - opacity: .5; + opacity: 1; } } @@ -329,6 +329,8 @@ body { } article.docs-body { + word-break: break-word; + h1 { padding-top: 1rem; font-size: 2.25rem; diff --git a/modules/docs/src/Volo.Docs.Web/Volo.Docs.Web.csproj b/modules/docs/src/Volo.Docs.Web/Volo.Docs.Web.csproj index 2adfb50de0..ed9cf98af8 100644 --- a/modules/docs/src/Volo.Docs.Web/Volo.Docs.Web.csproj +++ b/modules/docs/src/Volo.Docs.Web/Volo.Docs.Web.csproj @@ -1,5 +1,6 @@ - + + @@ -17,6 +18,7 @@ + diff --git a/modules/docs/test/Volo.Docs.Admin.Application.Tests/Volo.Docs.Admin.Application.Tests.csproj b/modules/docs/test/Volo.Docs.Admin.Application.Tests/Volo.Docs.Admin.Application.Tests.csproj index 1063314379..91eb42aaf2 100644 --- a/modules/docs/test/Volo.Docs.Admin.Application.Tests/Volo.Docs.Admin.Application.Tests.csproj +++ b/modules/docs/test/Volo.Docs.Admin.Application.Tests/Volo.Docs.Admin.Application.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/docs/test/Volo.Docs.Admin.Application.Tests/Volo/Docs/DocumentAdminAppService_Tests.cs b/modules/docs/test/Volo.Docs.Admin.Application.Tests/Volo/Docs/DocumentAdminAppService_Tests.cs new file mode 100644 index 0000000000..a969e3390a --- /dev/null +++ b/modules/docs/test/Volo.Docs.Admin.Application.Tests/Volo/Docs/DocumentAdminAppService_Tests.cs @@ -0,0 +1,55 @@ +using System.Threading.Tasks; +using Shouldly; +using Volo.Docs.Admin.Documents; +using Volo.Docs.Documents; +using Xunit; + +namespace Volo.Docs +{ + public class DocumentAdminAppService_Tests : DocsAdminApplicationTestBase + { + private readonly IDocumentAdminAppService _documentAdminAppService; + private readonly IDocumentRepository _documentRepository; + private readonly DocsTestData _testData; + + public DocumentAdminAppService_Tests() + { + _documentAdminAppService = GetRequiredService(); + _documentRepository = GetRequiredService(); + _testData = GetRequiredService(); + } + + [Fact] + public async Task PullAsync() + { + (await _documentRepository.FindAsync(_testData.PorjectId, "Part-I.md", "en", "1.0.0")).ShouldBeNull(); + + await _documentAdminAppService.PullAsync(new PullDocumentInput + { + ProjectId = _testData.PorjectId, + Name = "Part-I.md", + LanguageCode = "en", + Version = "1.0.0" + }); + + (await _documentRepository.FindAsync(_testData.PorjectId, "Part-I.md", "en", "1.0.0")).ShouldNotBeNull(); + } + + [Fact] + public async Task PullAllAsync() + { + (await _documentRepository.FindAsync(_testData.PorjectId, "Part-I.md", "en", "1.0.0")).ShouldBeNull(); + (await _documentRepository.FindAsync(_testData.PorjectId, "Part-II.md", "en", "1.0.0")).ShouldBeNull(); + + await _documentAdminAppService.PullAllAsync(new PullAllDocumentInput + { + ProjectId = _testData.PorjectId, + LanguageCode = "en", + Version = "1.0.0" + }); + + (await _documentRepository.FindAsync(_testData.PorjectId, "Part-I.md", "en", "1.0.0")).ShouldNotBeNull(); + (await _documentRepository.FindAsync(_testData.PorjectId, "Part-II.md", "en", "1.0.0")).ShouldNotBeNull(); + } + } +} diff --git a/modules/docs/test/Volo.Docs.Application.Tests/Volo.Docs.Application.Tests.csproj b/modules/docs/test/Volo.Docs.Application.Tests/Volo.Docs.Application.Tests.csproj index 4b86efc543..2e4fcd6402 100644 --- a/modules/docs/test/Volo.Docs.Application.Tests/Volo.Docs.Application.Tests.csproj +++ b/modules/docs/test/Volo.Docs.Application.Tests/Volo.Docs.Application.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/docs/test/Volo.Docs.Domain.Tests/Volo.Docs.Domain.Tests.csproj b/modules/docs/test/Volo.Docs.Domain.Tests/Volo.Docs.Domain.Tests.csproj index ea4e45c897..5483881192 100644 --- a/modules/docs/test/Volo.Docs.Domain.Tests/Volo.Docs.Domain.Tests.csproj +++ b/modules/docs/test/Volo.Docs.Domain.Tests/Volo.Docs.Domain.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/docs/test/Volo.Docs.Domain.Tests/Volo/Docs/DocumentSourceFactory_Tests.cs b/modules/docs/test/Volo.Docs.Domain.Tests/Volo/Docs/DocumentSourceFactory_Tests.cs new file mode 100644 index 0000000000..8e56a087d1 --- /dev/null +++ b/modules/docs/test/Volo.Docs.Domain.Tests/Volo/Docs/DocumentSourceFactory_Tests.cs @@ -0,0 +1,25 @@ +using Shouldly; +using Volo.Docs.Documents; +using Volo.Docs.FileSystem.Documents; +using Volo.Docs.GitHub.Documents; +using Xunit; + +namespace Volo.Docs +{ + public class DocumentSourceFactory_Tests : DocsDomainTestBase + { + private readonly IDocumentSourceFactory _documentSourceFactory; + + public DocumentSourceFactory_Tests() + { + _documentSourceFactory = GetRequiredService(); + } + + [Fact] + public void Create() + { + _documentSourceFactory.Create(GithubDocumentSource.Type).GetType().ShouldBe(typeof(GithubDocumentSource)); + _documentSourceFactory.Create(FileSystemDocumentSource.Type).GetType().ShouldBe(typeof(FileSystemDocumentSource)); + } + } +} diff --git a/modules/docs/test/Volo.Docs.Domain.Tests/Volo/Docs/DocumentStoreFactory_Tests.cs b/modules/docs/test/Volo.Docs.Domain.Tests/Volo/Docs/DocumentStoreFactory_Tests.cs deleted file mode 100644 index 73e07ec8e2..0000000000 --- a/modules/docs/test/Volo.Docs.Domain.Tests/Volo/Docs/DocumentStoreFactory_Tests.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Shouldly; -using Volo.Docs.Documents; -using Volo.Docs.FileSystem.Documents; -using Volo.Docs.GitHub.Documents; -using Xunit; - -namespace Volo.Docs -{ - public class DocumentStoreFactory_Tests : DocsDomainTestBase - { - private readonly IDocumentStoreFactory _documentStoreFactory; - - public DocumentStoreFactory_Tests() - { - _documentStoreFactory = GetRequiredService(); - } - - [Fact] - public void Create() - { - _documentStoreFactory.Create(GithubDocumentStore.Type).GetType().ShouldBe(typeof(GithubDocumentStore)); - _documentStoreFactory.Create(FileSystemDocumentStore.Type).GetType().ShouldBe(typeof(FileSystemDocumentStore)); - } - } -} diff --git a/modules/docs/test/Volo.Docs.Domain.Tests/Volo/Docs/GithubDocumentStore_Tests.cs b/modules/docs/test/Volo.Docs.Domain.Tests/Volo/Docs/GithubDocumentSource_Tests.cs similarity index 66% rename from modules/docs/test/Volo.Docs.Domain.Tests/Volo/Docs/GithubDocumentStore_Tests.cs rename to modules/docs/test/Volo.Docs.Domain.Tests/Volo/Docs/GithubDocumentSource_Tests.cs index 76d1f9f68f..1e89966518 100644 --- a/modules/docs/test/Volo.Docs.Domain.Tests/Volo/Docs/GithubDocumentStore_Tests.cs +++ b/modules/docs/test/Volo.Docs.Domain.Tests/Volo/Docs/GithubDocumentSource_Tests.cs @@ -7,15 +7,15 @@ using Xunit; namespace Volo.Docs { - public class GithubDocumentStore_Tests : DocsDomainTestBase + public class GithubDocumentSource_Tests : DocsDomainTestBase { - private readonly IDocumentStoreFactory _documentStoreFactory; + private readonly IDocumentSourceFactory _documentSourceFactory; private readonly IProjectRepository _projectRepository; private readonly DocsTestData _testData; - public GithubDocumentStore_Tests() + public GithubDocumentSource_Tests() { - _documentStoreFactory = GetRequiredService(); + _documentSourceFactory = GetRequiredService(); _projectRepository = GetRequiredService(); _testData = GetRequiredService(); } @@ -23,15 +23,15 @@ namespace Volo.Docs [Fact] public async Task GetDocumentAsync() { - var store = _documentStoreFactory.Create(GithubDocumentStore.Type); + var source = _documentSourceFactory.Create(GithubDocumentSource.Type); var project = await _projectRepository.FindAsync(_testData.PorjectId); project.ShouldNotBeNull(); - var document = await store.GetDocumentAsync(project, "index2", "en", "0.123.0"); + var document = await source.GetDocumentAsync(project, "index2", "en", "0.123.0"); document.ShouldNotBeNull(); - document.Title.ShouldBe("index2"); + document.Name.ShouldBe("index2"); document.FileName.ShouldBe("index2"); document.Version.ShouldBe("0.123.0"); document.Content.ShouldBe("stringContent"); @@ -40,12 +40,12 @@ namespace Volo.Docs [Fact] public async Task GetVersionsAsync() { - var store = _documentStoreFactory.Create(GithubDocumentStore.Type); + var source = _documentSourceFactory.Create(GithubDocumentSource.Type); var project = await _projectRepository.FindAsync(_testData.PorjectId); project.ShouldNotBeNull(); - var document = await store.GetVersionsAsync(project); + var document = await source.GetVersionsAsync(project); document.ShouldNotBeNull(); document.Count.ShouldBe(1); @@ -55,12 +55,12 @@ namespace Volo.Docs [Fact] public async Task GetResource() { - var store = _documentStoreFactory.Create(GithubDocumentStore.Type); + var source = _documentSourceFactory.Create(GithubDocumentSource.Type); var project = await _projectRepository.FindAsync(_testData.PorjectId); project.ShouldNotBeNull(); - var documentResource = await store.GetResource(project, "index.md", "en", "0.123.0"); + var documentResource = await source.GetResource(project, "index.md", "en", "0.123.0"); documentResource.ShouldNotBeNull(); documentResource.Content.ShouldBe(new byte[] diff --git a/modules/docs/test/Volo.Docs.EntityFrameworkCore.Tests/Volo.Docs.EntityFrameworkCore.Tests.csproj b/modules/docs/test/Volo.Docs.EntityFrameworkCore.Tests/Volo.Docs.EntityFrameworkCore.Tests.csproj index c17dc2c2da..7f8c963c0c 100644 --- a/modules/docs/test/Volo.Docs.EntityFrameworkCore.Tests/Volo.Docs.EntityFrameworkCore.Tests.csproj +++ b/modules/docs/test/Volo.Docs.EntityFrameworkCore.Tests/Volo.Docs.EntityFrameworkCore.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/docs/test/Volo.Docs.EntityFrameworkCore.Tests/Volo/Docs/EntityFrameworkCore/DocumentRepository_Tests.cs b/modules/docs/test/Volo.Docs.EntityFrameworkCore.Tests/Volo/Docs/EntityFrameworkCore/DocumentRepository_Tests.cs new file mode 100644 index 0000000000..d36c97a2b7 --- /dev/null +++ b/modules/docs/test/Volo.Docs.EntityFrameworkCore.Tests/Volo/Docs/EntityFrameworkCore/DocumentRepository_Tests.cs @@ -0,0 +1,6 @@ +namespace Volo.Docs.EntityFrameworkCore +{ + public class DocumentRepository_Tests : DocumentRepository_Tests + { + } +} \ No newline at end of file diff --git a/modules/docs/test/Volo.Docs.MongoDB.Tests/Volo.Docs.MongoDB.Tests.csproj b/modules/docs/test/Volo.Docs.MongoDB.Tests/Volo.Docs.MongoDB.Tests.csproj index 3a8d3cb7d9..dac64c24c1 100644 --- a/modules/docs/test/Volo.Docs.MongoDB.Tests/Volo.Docs.MongoDB.Tests.csproj +++ b/modules/docs/test/Volo.Docs.MongoDB.Tests/Volo.Docs.MongoDB.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/docs/test/Volo.Docs.MongoDB.Tests/Volo/Docs/Document/DocumentRepository_Tests.cs b/modules/docs/test/Volo.Docs.MongoDB.Tests/Volo/Docs/Document/DocumentRepository_Tests.cs new file mode 100644 index 0000000000..63e69d099a --- /dev/null +++ b/modules/docs/test/Volo.Docs.MongoDB.Tests/Volo/Docs/Document/DocumentRepository_Tests.cs @@ -0,0 +1,9 @@ +using Volo.Docs.MongoDB; + +namespace Volo.Docs.Document +{ + public class DocumentRepository_Tests : DocumentRepository_Tests + { + + } +} \ No newline at end of file diff --git a/modules/docs/test/Volo.Docs.TestBase/Volo.Docs.TestBase.csproj b/modules/docs/test/Volo.Docs.TestBase/Volo.Docs.TestBase.csproj index aeed82e1dd..7a19db874e 100644 --- a/modules/docs/test/Volo.Docs.TestBase/Volo.Docs.TestBase.csproj +++ b/modules/docs/test/Volo.Docs.TestBase/Volo.Docs.TestBase.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/docs/test/Volo.Docs.TestBase/Volo/Docs/DocsTestBase.cs b/modules/docs/test/Volo.Docs.TestBase/Volo/Docs/DocsTestBase.cs index ec8270ae01..56a8ea0203 100644 --- a/modules/docs/test/Volo.Docs.TestBase/Volo/Docs/DocsTestBase.cs +++ b/modules/docs/test/Volo.Docs.TestBase/Volo/Docs/DocsTestBase.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using Microsoft.Extensions.DependencyInjection; using NSubstitute; @@ -23,6 +23,11 @@ namespace Volo.Docs var repositoryManager = Substitute.For(); repositoryManager.GetFileRawStringContentAsync(Arg.Any(), Arg.Any(), Arg.Any()) .Returns("stringContent"); + repositoryManager.GetFileRawStringContentAsync( + Arg.Is(x => x.Contains("docs-nav.json", StringComparison.InvariantCultureIgnoreCase)), + Arg.Any(), Arg.Any()) + .Returns("{\"items\":[{\"text\":\"Part-I.md\",\"path\":\"Part-I.md\"},{\"text\":\"Part-II\",\"path\":\"Part-II.md\"}]}"); + repositoryManager.GetFileRawByteArrayContentAsync(Arg.Any(), Arg.Any(), Arg.Any()) .Returns(new byte[] { 0x01, 0x02, 0x03 }); repositoryManager.GetReleasesAsync(Arg.Any(), Arg.Any(), Arg.Any()) @@ -47,6 +52,25 @@ namespace Volo.Docs "https://api.github.com/repos/abpframework/abp/zipball/0.15.0", null) }); + repositoryManager.GetFileCommitsAsync(Arg.Any(), Arg.Any(), Arg.Any(), + Arg.Any(), Arg.Any()) + .Returns(new List + { + new GitHubCommit("", "", "", "", "", null, null, + new Author("hikalkan ", 2, "", "https://avatars1.githubusercontent.com/u/1?v=4", "", + "https://github.com/hikalkan", "", "", "", "", "", "", "", "", "", "", false), "", + new Commit("", "", "", "", "", null, null, "", new Committer("", "", DateTimeOffset.Now), + null, null, new []{ new GitReference("", "", "", "", "", null, null) }, 1, null), + null, "", null, new []{ new GitReference("", "", "", "", "", null, null) }, null), + + new GitHubCommit("", "", "", "", "", null, null, + new Author("ebicoglu ", 2, "", "https://avatars1.githubusercontent.com/u/2?v=4", "", + "https://github.com/ebicoglu", "", "", "", "", "", "", "", "", "", "", false), "", + new Commit("", "", "", "", "", null, null, "", new Committer("", "", DateTimeOffset.Now), + null, null, new []{ new GitReference("", "", "", "", "", null, null) }, 1, null), + null, "", null, new []{ new GitReference("", "", "", "", "", null, null) }, null) + }); + services.AddSingleton(repositoryManager); } } diff --git a/modules/docs/test/Volo.Docs.TestBase/Volo/Docs/DocsTestDataBuilder.cs b/modules/docs/test/Volo.Docs.TestBase/Volo/Docs/DocsTestDataBuilder.cs index 121d18b44a..e7eadd7562 100644 --- a/modules/docs/test/Volo.Docs.TestBase/Volo/Docs/DocsTestDataBuilder.cs +++ b/modules/docs/test/Volo.Docs.TestBase/Volo/Docs/DocsTestDataBuilder.cs @@ -1,6 +1,8 @@ -using System.Threading.Tasks; +using System; +using System.Threading.Tasks; using Volo.Abp.Data; using Volo.Abp.DependencyInjection; +using Volo.Docs.Documents; using Volo.Docs.GitHub.Documents; using Volo.Docs.Projects; @@ -10,13 +12,16 @@ namespace Volo.Docs { private readonly DocsTestData _testData; private readonly IProjectRepository _projectRepository; + private readonly IDocumentRepository _documentRepository; public DocsTestDataBuilder( DocsTestData testData, - IProjectRepository projectRepository) + IProjectRepository projectRepository, + IDocumentRepository documentRepository) { _testData = testData; _projectRepository = projectRepository; + _documentRepository = documentRepository; } public async Task BuildAsync() @@ -25,7 +30,7 @@ namespace Volo.Docs _testData.PorjectId, "ABP vNext", "ABP", - GithubDocumentStore.Type, + GithubDocumentSource.Type, "md", "index", "docs-nav.json", @@ -38,6 +43,12 @@ namespace Volo.Docs .SetProperty("GitHubUserAgent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64)"); await _projectRepository.InsertAsync(project); + + await _documentRepository.InsertAsync(new Document(Guid.NewGuid(), project.Id, "CLI.md", "2.0.0", "en", "CLI.md", + "this is abp cli", "md", "https://github.com/abpframework/abp/blob/2.0.0/docs/en/CLI.md", + "https://github.com/abpframework/abp/tree/2.0.0/docs/", + "https://raw.githubusercontent.com/abpframework/abp/2.0.0/docs/en/", "", DateTime.Now, DateTime.Now, + DateTime.Now)); } } } \ No newline at end of file diff --git a/modules/docs/test/Volo.Docs.TestBase/Volo/Docs/DocumentRepository_Tests.cs b/modules/docs/test/Volo.Docs.TestBase/Volo/Docs/DocumentRepository_Tests.cs new file mode 100644 index 0000000000..68a2ebb5e6 --- /dev/null +++ b/modules/docs/test/Volo.Docs.TestBase/Volo/Docs/DocumentRepository_Tests.cs @@ -0,0 +1,38 @@ +using System.Threading.Tasks; +using Shouldly; +using Volo.Abp.Modularity; +using Volo.Docs.Documents; +using Xunit; + +namespace Volo.Docs +{ + public abstract class DocumentRepository_Tests : DocsTestBase + where TStartupModule : IAbpModule + { + protected readonly IDocumentRepository DocumentRepository; + protected readonly DocsTestData DocsTestData; + + protected DocumentRepository_Tests() + { + DocumentRepository = GetRequiredService(); + DocsTestData = GetRequiredService(); + } + + [Fact] + public async Task FindAsync() + { + var document = await DocumentRepository.FindAsync(DocsTestData.PorjectId, "CLI.md", "en", "2.0.0"); + document.ShouldNotBeNull(); + } + + [Fact] + public async Task DeleteAsync() + { + (await DocumentRepository.GetListAsync()).ShouldNotBeEmpty(); + + await DocumentRepository.DeleteAsync(DocsTestData.PorjectId, "CLI.md", "en", "2.0.0"); + + (await DocumentRepository.GetListAsync()).ShouldBeEmpty(); + } + } +} diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Application.Contracts/FodyWeavers.xml b/modules/feature-management/src/Volo.Abp.FeatureManagement.Application.Contracts/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Application.Contracts/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Application.Contracts/FodyWeavers.xsd b/modules/feature-management/src/Volo.Abp.FeatureManagement.Application.Contracts/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Application.Contracts/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Application.Contracts/Volo.Abp.FeatureManagement.Application.Contracts.csproj b/modules/feature-management/src/Volo.Abp.FeatureManagement.Application.Contracts/Volo.Abp.FeatureManagement.Application.Contracts.csproj index 760805086f..09376e7f2a 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Application.Contracts/Volo.Abp.FeatureManagement.Application.Contracts.csproj +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Application.Contracts/Volo.Abp.FeatureManagement.Application.Contracts.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/FodyWeavers.xml b/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/FodyWeavers.xsd b/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo.Abp.FeatureManagement.Application.csproj b/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo.Abp.FeatureManagement.Application.csproj index 243ec87813..eab014478e 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo.Abp.FeatureManagement.Application.csproj +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo.Abp.FeatureManagement.Application.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo/Abp/FeatureManagement/FeatureAppService.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo/Abp/FeatureManagement/FeatureAppService.cs index 2290e79f00..097ea7ffa0 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo/Abp/FeatureManagement/FeatureAppService.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo/Abp/FeatureManagement/FeatureAppService.cs @@ -34,7 +34,7 @@ namespace Volo.Abp.FeatureManagement public virtual async Task GetAsync([NotNull] string providerName, [NotNull] string providerKey) { - await CheckProviderPolicy(providerName).ConfigureAwait(false); + await CheckProviderPolicy(providerName); var featureDefinitions = _featureDefinitionManager.GetAll(); var features = new List(); @@ -48,7 +48,7 @@ namespace Volo.Abp.FeatureManagement ValueType = featureDefinition.ValueType, Description = featureDefinition.Description?.Localize(_stringLocalizerFactory), ParentName = featureDefinition.Parent?.Name, - Value = await _featureManager.GetOrNullAsync(featureDefinition.Name, providerName, providerKey).ConfigureAwait(false) + Value = await _featureManager.GetOrNullAsync(featureDefinition.Name, providerName, providerKey) }); } @@ -59,11 +59,11 @@ namespace Volo.Abp.FeatureManagement public virtual async Task UpdateAsync([NotNull] string providerName, [NotNull] string providerKey, UpdateFeaturesDto input) { - await CheckProviderPolicy(providerName).ConfigureAwait(false); + await CheckProviderPolicy(providerName); foreach (var feature in input.Features) { - await _featureManager.SetAsync(feature.Name, feature.Value, providerName, providerKey).ConfigureAwait(false); + await _featureManager.SetAsync(feature.Name, feature.Value, providerName, providerKey); } } @@ -88,7 +88,7 @@ namespace Volo.Abp.FeatureManagement throw new AbpException($"No policy defined to get/set permissions for the provider '{policyName}'. Use {nameof(FeatureManagementOptions)} to map the policy."); } - await AuthorizationService.CheckAsync(policyName).ConfigureAwait(false); + await AuthorizationService.CheckAsync(policyName); } } } diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/FodyWeavers.xml b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/FodyWeavers.xsd b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo.Abp.FeatureManagement.Domain.Shared.csproj b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo.Abp.FeatureManagement.Domain.Shared.csproj index bfa20270c8..5ffd761bf0 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo.Abp.FeatureManagement.Domain.Shared.csproj +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo.Abp.FeatureManagement.Domain.Shared.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/Localization/Domain/zh-Hant.json b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/Localization/Domain/zh-Hant.json new file mode 100644 index 0000000000..bc4dbf268f --- /dev/null +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain.Shared/Volo/Abp/FeatureManagement/Localization/Domain/zh-Hant.json @@ -0,0 +1,7 @@ +{ + "culture": "zh-Hant", + "texts": { + "Features": "功能", + "NoFeatureFoundMessage": "沒有可用的功能." + } +} \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/FodyWeavers.xml b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/FodyWeavers.xsd b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo.Abp.FeatureManagement.Domain.csproj b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo.Abp.FeatureManagement.Domain.csproj index 8b29b704ce..10033847c2 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo.Abp.FeatureManagement.Domain.csproj +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo.Abp.FeatureManagement.Domain.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementProvider.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementProvider.cs index 58353321fa..1d0c59773b 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementProvider.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementProvider.cs @@ -16,17 +16,17 @@ namespace Volo.Abp.FeatureManagement public async Task GetOrNullAsync(FeatureDefinition feature, string providerKey) { - return await Store.GetOrNullAsync(feature.Name, Name, NormalizeProviderKey(providerKey)).ConfigureAwait(false); + return await Store.GetOrNullAsync(feature.Name, Name, NormalizeProviderKey(providerKey)); } public virtual async Task SetAsync(FeatureDefinition feature, string value, string providerKey) { - await Store.SetAsync(feature.Name, value, Name, NormalizeProviderKey(providerKey)).ConfigureAwait(false); + await Store.SetAsync(feature.Name, value, Name, NormalizeProviderKey(providerKey)); } public virtual async Task ClearAsync(FeatureDefinition feature, string providerKey) { - await Store.DeleteAsync(feature.Name, Name, NormalizeProviderKey(providerKey)).ConfigureAwait(false); + await Store.DeleteAsync(feature.Name, Name, NormalizeProviderKey(providerKey)); } protected virtual string NormalizeProviderKey(string providerKey) diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementStore.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementStore.cs index 2970296381..94c4d48067 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementStore.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManagementStore.cs @@ -23,52 +23,52 @@ namespace Volo.Abp.FeatureManagement public async Task GetOrNullAsync(string name, string providerName, string providerKey) { - var cacheItem = await GetCacheItemAsync(name, providerName, providerKey).ConfigureAwait(false); + var cacheItem = await GetCacheItemAsync(name, providerName, providerKey); return cacheItem.Value; } public async Task SetAsync(string name, string value, string providerName, string providerKey) { - var featureValue = await FeatureValueRepository.FindAsync(name, providerName, providerKey).ConfigureAwait(false); + var featureValue = await FeatureValueRepository.FindAsync(name, providerName, providerKey); if (featureValue == null) { featureValue = new FeatureValue(GuidGenerator.Create(), name, value, providerName, providerKey); - await FeatureValueRepository.InsertAsync(featureValue).ConfigureAwait(false); + await FeatureValueRepository.InsertAsync(featureValue); } else { featureValue.Value = value; - await FeatureValueRepository.UpdateAsync(featureValue).ConfigureAwait(false); + await FeatureValueRepository.UpdateAsync(featureValue); } } public async Task DeleteAsync(string name, string providerName, string providerKey) { - var featureValue = await FeatureValueRepository.FindAsync(name, providerName, providerKey).ConfigureAwait(false); + var featureValue = await FeatureValueRepository.FindAsync(name, providerName, providerKey); if (featureValue != null) { - await FeatureValueRepository.DeleteAsync(featureValue).ConfigureAwait(false); + await FeatureValueRepository.DeleteAsync(featureValue); } } protected virtual async Task GetCacheItemAsync(string name, string providerName, string providerKey) { var cacheKey = CalculateCacheKey(name, providerName, providerKey); - var cacheItem = await Cache.GetAsync(cacheKey).ConfigureAwait(false); + var cacheItem = await Cache.GetAsync(cacheKey); if (cacheItem != null) { return cacheItem; } - var featureValue = await FeatureValueRepository.FindAsync(name, providerName, providerKey).ConfigureAwait(false); + var featureValue = await FeatureValueRepository.FindAsync(name, providerName, providerKey); cacheItem = new FeatureValueCacheItem(featureValue?.Value); await Cache.SetAsync( cacheKey, cacheItem - ).ConfigureAwait(false); + ); return cacheItem; } diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManager.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManager.cs index 8249166f20..06ca345bf6 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManager.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureManager.cs @@ -82,7 +82,7 @@ namespace Volo.Abp.FeatureManagement var providerValue = await provider.GetOrNullAsync( feature, provider.Name == providerName ? providerKey : null - ).ConfigureAwait(false); + ); if (providerValue != null) { @@ -123,7 +123,7 @@ namespace Volo.Abp.FeatureManagement if (providers.Count > 1 && !forceToSet && value != null) { - var fallbackValue = await GetOrNullInternalAsync(name, providers[1].Name, null).ConfigureAwait(false); + var fallbackValue = await GetOrNullInternalAsync(name, providers[1].Name, null); if (fallbackValue == value) { //Clear the value if it's same as it's fallback value @@ -139,14 +139,14 @@ namespace Volo.Abp.FeatureManagement { foreach (var provider in providers) { - await provider.ClearAsync(feature, providerKey).ConfigureAwait(false); + await provider.ClearAsync(feature, providerKey); } } else { foreach (var provider in providers) { - await provider.SetAsync(feature, value, providerKey).ConfigureAwait(false); + await provider.SetAsync(feature, value, providerKey); } } } @@ -172,7 +172,7 @@ namespace Volo.Abp.FeatureManagement value = await provider.GetOrNullAsync( feature, provider.Name == providerName ? providerKey : null - ).ConfigureAwait(false); + ); if (value != null) { diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureValueCacheItemInvalidator.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureValueCacheItemInvalidator.cs index 1d13d46e0a..63e207b1e7 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureValueCacheItemInvalidator.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Domain/Volo/Abp/FeatureManagement/FeatureValueCacheItemInvalidator.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.FeatureManagement eventData.Entity.ProviderKey ); - await Cache.RemoveAsync(cacheKey).ConfigureAwait(false); + await Cache.RemoveAsync(cacheKey); } protected virtual string CalculateCacheKey(string name, string providerName, string providerKey) diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/FodyWeavers.xml b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/FodyWeavers.xsd b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo.Abp.FeatureManagement.EntityFrameworkCore.csproj b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo.Abp.FeatureManagement.EntityFrameworkCore.csproj index 297d7fcaa4..ac13799b80 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo.Abp.FeatureManagement.EntityFrameworkCore.csproj +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo.Abp.FeatureManagement.EntityFrameworkCore.csproj @@ -1,9 +1,10 @@ - + + - netstandard2.1 + netstandard2.0 diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/EfCoreFeatureValueRepository.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/EfCoreFeatureValueRepository.cs index 87251ff366..9545ac36b4 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/EfCoreFeatureValueRepository.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/EfCoreFeatureValueRepository.cs @@ -20,7 +20,7 @@ namespace Volo.Abp.FeatureManagement.EntityFrameworkCore return await DbSet .FirstOrDefaultAsync( s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey - ).ConfigureAwait(false); + ); } public async Task> GetListAsync(string providerName, string providerKey) @@ -28,7 +28,7 @@ namespace Volo.Abp.FeatureManagement.EntityFrameworkCore return await DbSet .Where( s => s.ProviderName == providerName && s.ProviderKey == providerKey - ).ToListAsync().ConfigureAwait(false); + ).ToListAsync(); } } } \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi.Client/FodyWeavers.xml b/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi.Client/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi.Client/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi.Client/FodyWeavers.xsd b/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi.Client/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi.Client/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi.Client/Volo.Abp.FeatureManagement.HttpApi.Client.csproj b/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi.Client/Volo.Abp.FeatureManagement.HttpApi.Client.csproj index a99f8e0bfb..1a784f6e6c 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi.Client/Volo.Abp.FeatureManagement.HttpApi.Client.csproj +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi.Client/Volo.Abp.FeatureManagement.HttpApi.Client.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi/FodyWeavers.xml b/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi/FodyWeavers.xsd b/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi/Volo.Abp.FeatureManagement.HttpApi.csproj b/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi/Volo.Abp.FeatureManagement.HttpApi.csproj index d49cd4f813..c809224e43 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi/Volo.Abp.FeatureManagement.HttpApi.csproj +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi/Volo.Abp.FeatureManagement.HttpApi.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/FodyWeavers.xml b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/FodyWeavers.xsd b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo.Abp.FeatureManagement.MongoDB.csproj b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo.Abp.FeatureManagement.MongoDB.csproj index 5f4d23bf4e..44c720110d 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo.Abp.FeatureManagement.MongoDB.csproj +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo.Abp.FeatureManagement.MongoDB.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/MongoFeatureValueRepository.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/MongoFeatureValueRepository.cs index 62e112b764..f57d125dce 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/MongoFeatureValueRepository.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.MongoDB/Volo/Abp/FeatureManagement/MongoDB/MongoFeatureValueRepository.cs @@ -19,14 +19,14 @@ namespace Volo.Abp.FeatureManagement.MongoDB public async Task FindAsync(string name, string providerName, string providerKey) { return await GetMongoQueryable() - .FirstOrDefaultAsync(s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey).ConfigureAwait(false); + .FirstOrDefaultAsync(s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey); } public async Task> GetListAsync(string providerName, string providerKey) { return await GetMongoQueryable() .Where(s => s.ProviderName == providerName && s.ProviderKey == providerKey) - .ToListAsync().ConfigureAwait(false); + .ToListAsync(); } } } \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/FodyWeavers.xml b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/FodyWeavers.xsd b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs index 4360e0d72c..d9e0d7b2c4 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs @@ -36,7 +36,7 @@ namespace Volo.Abp.FeatureManagement.Web.Pages.FeatureManagement public async Task OnGetAsync() { - FeatureListDto = await _featureAppService.GetAsync(ProviderName, ProviderKey).ConfigureAwait(false); + FeatureListDto = await _featureAppService.GetAsync(ProviderName, ProviderKey); } public async Task OnPostAsync() @@ -50,7 +50,7 @@ namespace Volo.Abp.FeatureManagement.Web.Pages.FeatureManagement }).ToList() }; - await _featureAppService.UpdateAsync(ProviderName, ProviderKey, features).ConfigureAwait(false); + await _featureAppService.UpdateAsync(ProviderName, ProviderKey, features); return NoContent(); } diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Volo.Abp.FeatureManagement.Web.csproj b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Volo.Abp.FeatureManagement.Web.csproj index e44deb17e7..b4917d34d6 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Volo.Abp.FeatureManagement.Web.csproj +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Volo.Abp.FeatureManagement.Web.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/feature-management/test/Volo.Abp.FeatureManagement.Application.Tests/Volo.Abp.FeatureManagement.Application.Tests.csproj b/modules/feature-management/test/Volo.Abp.FeatureManagement.Application.Tests/Volo.Abp.FeatureManagement.Application.Tests.csproj index ef81b4b9ea..19124ccf85 100644 --- a/modules/feature-management/test/Volo.Abp.FeatureManagement.Application.Tests/Volo.Abp.FeatureManagement.Application.Tests.csproj +++ b/modules/feature-management/test/Volo.Abp.FeatureManagement.Application.Tests/Volo.Abp.FeatureManagement.Application.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/modules/feature-management/test/Volo.Abp.FeatureManagement.Application.Tests/Volo/Abp/FeatureManagement/FeatureAppService_Tests.cs b/modules/feature-management/test/Volo.Abp.FeatureManagement.Application.Tests/Volo/Abp/FeatureManagement/FeatureAppService_Tests.cs index 8987a232b0..b86e6be013 100644 --- a/modules/feature-management/test/Volo.Abp.FeatureManagement.Application.Tests/Volo/Abp/FeatureManagement/FeatureAppService_Tests.cs +++ b/modules/feature-management/test/Volo.Abp.FeatureManagement.Application.Tests/Volo/Abp/FeatureManagement/FeatureAppService_Tests.cs @@ -39,7 +39,7 @@ namespace Volo.Abp.FeatureManagement Login(_testData.User1Id); var featureList = await _featureAppService.GetAsync(EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString()).ConfigureAwait(false); + TestEditionIds.Regular.ToString()); featureList.ShouldNotBeNull(); featureList.Features.ShouldContain(feature => feature.Name == TestFeatureDefinitionProvider.SocialLogins); @@ -61,10 +61,10 @@ namespace Volo.Abp.FeatureManagement Value = false.ToString().ToLowerInvariant() } } - }).ConfigureAwait(false); + }); (await _featureAppService.GetAsync(EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString()).ConfigureAwait(false)).Features.Any(x => + TestEditionIds.Regular.ToString())).Features.Any(x => x.Name == TestFeatureDefinitionProvider.SocialLogins && x.Value == false.ToString().ToLowerInvariant()) .ShouldBeTrue(); diff --git a/modules/feature-management/test/Volo.Abp.FeatureManagement.Domain.Tests/Volo.Abp.FeatureManagement.Domain.Tests.csproj b/modules/feature-management/test/Volo.Abp.FeatureManagement.Domain.Tests/Volo.Abp.FeatureManagement.Domain.Tests.csproj index 585f399d3e..95793ffff4 100644 --- a/modules/feature-management/test/Volo.Abp.FeatureManagement.Domain.Tests/Volo.Abp.FeatureManagement.Domain.Tests.csproj +++ b/modules/feature-management/test/Volo.Abp.FeatureManagement.Domain.Tests/Volo.Abp.FeatureManagement.Domain.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/modules/feature-management/test/Volo.Abp.FeatureManagement.Domain.Tests/Volo/Abp/FeatureManagement/FeatureManager_Tests.cs b/modules/feature-management/test/Volo.Abp.FeatureManagement.Domain.Tests/Volo/Abp/FeatureManagement/FeatureManager_Tests.cs index ac75fdd86e..d86bcfaa48 100644 --- a/modules/feature-management/test/Volo.Abp.FeatureManagement.Domain.Tests/Volo/Abp/FeatureManagement/FeatureManager_Tests.cs +++ b/modules/feature-management/test/Volo.Abp.FeatureManagement.Domain.Tests/Volo/Abp/FeatureManagement/FeatureManager_Tests.cs @@ -27,63 +27,63 @@ namespace Volo.Abp.FeatureManagement (await _featureManager.GetOrNullDefaultAsync( TestFeatureDefinitionProvider.SocialLogins - ).ConfigureAwait(false)).ShouldBeNull(); + )).ShouldBeNull(); (await _featureManager.GetOrNullDefaultAsync( TestFeatureDefinitionProvider.DailyAnalysis - ).ConfigureAwait(false)).ShouldBe(false.ToString().ToLowerInvariant()); + )).ShouldBe(false.ToString().ToLowerInvariant()); (await _featureManager.GetOrNullDefaultAsync( TestFeatureDefinitionProvider.ProjectCount - ).ConfigureAwait(false)).ShouldBe("1"); + )).ShouldBe("1"); (await _featureManager.GetOrNullDefaultAsync( TestFeatureDefinitionProvider.BackupCount - ).ConfigureAwait(false)).ShouldBe("0"); + )).ShouldBe("0"); //"Enterprise" edition values (await _featureManager.GetOrNullForEditionAsync( TestFeatureDefinitionProvider.SocialLogins, TestEditionIds.Enterprise - ).ConfigureAwait(false)).ShouldBe(true.ToString().ToLowerInvariant()); + )).ShouldBe(true.ToString().ToLowerInvariant()); (await _featureManager.GetOrNullForEditionAsync( TestFeatureDefinitionProvider.DailyAnalysis, TestEditionIds.Enterprise - ).ConfigureAwait(false)).ShouldBe(false.ToString().ToLowerInvariant()); + )).ShouldBe(false.ToString().ToLowerInvariant()); (await _featureManager.GetOrNullForEditionAsync( TestFeatureDefinitionProvider.ProjectCount, TestEditionIds.Enterprise - ).ConfigureAwait(false)).ShouldBe("3"); + )).ShouldBe("3"); (await _featureManager.GetOrNullForEditionAsync( TestFeatureDefinitionProvider.BackupCount, TestEditionIds.Enterprise - ).ConfigureAwait(false)).ShouldBe("5"); + )).ShouldBe("5"); //"Ultimate" edition values (await _featureManager.GetOrNullForEditionAsync( TestFeatureDefinitionProvider.SocialLogins, TestEditionIds.Ultimate - ).ConfigureAwait(false)).ShouldBe(true.ToString().ToLowerInvariant()); + )).ShouldBe(true.ToString().ToLowerInvariant()); (await _featureManager.GetOrNullForEditionAsync( TestFeatureDefinitionProvider.DailyAnalysis, TestEditionIds.Ultimate - ).ConfigureAwait(false)).ShouldBe(true.ToString().ToLowerInvariant()); + )).ShouldBe(true.ToString().ToLowerInvariant()); (await _featureManager.GetOrNullForEditionAsync( TestFeatureDefinitionProvider.ProjectCount, TestEditionIds.Ultimate - ).ConfigureAwait(false)).ShouldBe("10"); + )).ShouldBe("10"); (await _featureManager.GetOrNullForEditionAsync( TestFeatureDefinitionProvider.BackupCount, TestEditionIds.Ultimate - ).ConfigureAwait(false)).ShouldBe("10"); + )).ShouldBe("10"); } [Fact] diff --git a/modules/feature-management/test/Volo.Abp.FeatureManagement.Domain.Tests/Volo/Abp/FeatureManagement/FeatureValueCacheItemInvalidator_Tests.cs b/modules/feature-management/test/Volo.Abp.FeatureManagement.Domain.Tests/Volo/Abp/FeatureManagement/FeatureValueCacheItemInvalidator_Tests.cs index 7b3aa9f256..890e94663b 100644 --- a/modules/feature-management/test/Volo.Abp.FeatureManagement.Domain.Tests/Volo/Abp/FeatureManagement/FeatureValueCacheItemInvalidator_Tests.cs +++ b/modules/feature-management/test/Volo.Abp.FeatureManagement.Domain.Tests/Volo/Abp/FeatureManagement/FeatureValueCacheItemInvalidator_Tests.cs @@ -30,17 +30,17 @@ namespace Volo.Abp.FeatureManagement TestFeatureDefinitionProvider.SocialLogins, EditionFeatureValueProvider.ProviderName, TestEditionIds.Regular.ToString() - ).ConfigureAwait(false) + ) ).ShouldNotBeNull(); var feature = await _featureValueRepository.FindAsync( TestFeatureDefinitionProvider.SocialLogins, EditionFeatureValueProvider.ProviderName, TestEditionIds.Regular.ToString() - ).ConfigureAwait(false); + ); // Act - await _featureValueRepository.DeleteAsync(feature).ConfigureAwait(false); + await _featureValueRepository.DeleteAsync(feature); // Assert (await _cache.GetAsync( @@ -49,7 +49,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Regular.ToString() ) - ).ConfigureAwait(false) + ) ).ShouldBeNull(); } diff --git a/modules/feature-management/test/Volo.Abp.FeatureManagement.EntityFrameworkCore.Tests/Volo.Abp.FeatureManagement.EntityFrameworkCore.Tests.csproj b/modules/feature-management/test/Volo.Abp.FeatureManagement.EntityFrameworkCore.Tests/Volo.Abp.FeatureManagement.EntityFrameworkCore.Tests.csproj index 8a8b62a666..ef8877a1f1 100644 --- a/modules/feature-management/test/Volo.Abp.FeatureManagement.EntityFrameworkCore.Tests/Volo.Abp.FeatureManagement.EntityFrameworkCore.Tests.csproj +++ b/modules/feature-management/test/Volo.Abp.FeatureManagement.EntityFrameworkCore.Tests/Volo.Abp.FeatureManagement.EntityFrameworkCore.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo.Abp.FeatureManagement.MongoDB.Tests.csproj b/modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo.Abp.FeatureManagement.MongoDB.Tests.csproj index 37ebd8aa4a..91ccb18368 100644 --- a/modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo.Abp.FeatureManagement.MongoDB.Tests.csproj +++ b/modules/feature-management/test/Volo.Abp.FeatureManagement.MongoDB.Tests/Volo.Abp.FeatureManagement.MongoDB.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo.Abp.FeatureManagement.TestBase.csproj b/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo.Abp.FeatureManagement.TestBase.csproj index 571adf02c8..111643ce37 100644 --- a/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo.Abp.FeatureManagement.TestBase.csproj +++ b/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo.Abp.FeatureManagement.TestBase.csproj @@ -1,4 +1,4 @@ - + diff --git a/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureManagementStore_Tests.cs b/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureManagementStore_Tests.cs index 500e28233c..a6f040dde3 100644 --- a/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureManagementStore_Tests.cs +++ b/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureManagementStore_Tests.cs @@ -27,11 +27,11 @@ namespace Volo.Abp.FeatureManagement // Act (await FeatureManagementStore.GetOrNullAsync(Guid.NewGuid().ToString(), EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString()).ConfigureAwait(false)).ShouldBeNull(); + TestEditionIds.Regular.ToString())).ShouldBeNull(); (await FeatureManagementStore.GetOrNullAsync(TestFeatureDefinitionProvider.SocialLogins, EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString()).ConfigureAwait(false)).ShouldNotBeNull(); + TestEditionIds.Regular.ToString())).ShouldNotBeNull(); } [Fact] @@ -40,17 +40,17 @@ namespace Volo.Abp.FeatureManagement // Arrange (await FeatureManagementStore.GetOrNullAsync(TestFeatureDefinitionProvider.SocialLogins, EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString()).ConfigureAwait(false)).ShouldNotBeNull(); + TestEditionIds.Regular.ToString())).ShouldNotBeNull(); // Act await FeatureManagementStore.DeleteAsync(TestFeatureDefinitionProvider.SocialLogins, EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString()).ConfigureAwait(false); + TestEditionIds.Regular.ToString()); // Assert (await FeatureManagementStore.GetOrNullAsync(TestFeatureDefinitionProvider.SocialLogins, EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString()).ConfigureAwait(false)).ShouldBeNull(); + TestEditionIds.Regular.ToString())).ShouldBeNull(); } [Fact] @@ -59,18 +59,18 @@ namespace Volo.Abp.FeatureManagement // Arrange (await FeatureValueRepository.FindAsync(TestFeatureDefinitionProvider.SocialLogins, EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString()).ConfigureAwait(false)).Value.ShouldBe(true.ToString().ToLowerInvariant()); + TestEditionIds.Regular.ToString())).Value.ShouldBe(true.ToString().ToLowerInvariant()); // Act await FeatureManagementStore.SetAsync(TestFeatureDefinitionProvider.SocialLogins, false.ToString().ToUpperInvariant(), EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString()).ConfigureAwait(false); + TestEditionIds.Regular.ToString()); // Assert (await FeatureValueRepository.FindAsync(TestFeatureDefinitionProvider.SocialLogins, EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString()).ConfigureAwait(false)).Value.ShouldBe(false.ToString().ToUpperInvariant()); + TestEditionIds.Regular.ToString())).Value.ShouldBe(false.ToString().ToUpperInvariant()); } [Fact] @@ -79,18 +79,18 @@ namespace Volo.Abp.FeatureManagement // Arrange (await FeatureValueRepository.FindAsync(TestFeatureDefinitionProvider.SocialLogins, EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString()).ConfigureAwait(false)).ShouldNotBeNull(); + TestEditionIds.Regular.ToString())).ShouldNotBeNull(); // Act await FeatureManagementStore.DeleteAsync(TestFeatureDefinitionProvider.SocialLogins, EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString()).ConfigureAwait(false); + TestEditionIds.Regular.ToString()); // Assert (await FeatureValueRepository.FindAsync(TestFeatureDefinitionProvider.SocialLogins, EditionFeatureValueProvider.ProviderName, - TestEditionIds.Regular.ToString()).ConfigureAwait(false)).ShouldBeNull(); + TestEditionIds.Regular.ToString())).ShouldBeNull(); } diff --git a/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureManagementTestDataBuilder.cs b/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureManagementTestDataBuilder.cs index dc286e6782..0629693dbd 100644 --- a/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureManagementTestDataBuilder.cs +++ b/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureManagementTestDataBuilder.cs @@ -34,7 +34,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Regular.ToString() ) - ).ConfigureAwait(false); + ); //UserCount await _featureValueRepository.InsertAsync( @@ -45,7 +45,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Regular.ToString() ) - ).ConfigureAwait(false); + ); //ProjectCount await _featureValueRepository.InsertAsync( @@ -56,7 +56,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Regular.ToString() ) - ).ConfigureAwait(false); + ); #endregion @@ -71,7 +71,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Enterprise.ToString() ) - ).ConfigureAwait(false); + ); //EmailSupport await _featureValueRepository.InsertAsync( @@ -82,7 +82,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Enterprise.ToString() ) - ).ConfigureAwait(false); + ); //UserCount await _featureValueRepository.InsertAsync( @@ -93,7 +93,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Enterprise.ToString() ) - ).ConfigureAwait(false); + ); //ProjectCount await _featureValueRepository.InsertAsync( @@ -104,7 +104,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Enterprise.ToString() ) - ).ConfigureAwait(false); + ); //BackupCount await _featureValueRepository.InsertAsync( @@ -115,7 +115,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Enterprise.ToString() ) - ).ConfigureAwait(false); + ); #endregion @@ -130,7 +130,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Ultimate.ToString() ) - ).ConfigureAwait(false); + ); //EmailSupport await _featureValueRepository.InsertAsync( @@ -141,7 +141,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Ultimate.ToString() ) - ).ConfigureAwait(false); + ); //EmailSupport await _featureValueRepository.InsertAsync( @@ -152,7 +152,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Ultimate.ToString() ) - ).ConfigureAwait(false); + ); //UserCount await _featureValueRepository.InsertAsync( @@ -163,7 +163,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Ultimate.ToString() ) - ).ConfigureAwait(false); + ); //ProjectCount await _featureValueRepository.InsertAsync( @@ -174,7 +174,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Ultimate.ToString() ) - ).ConfigureAwait(false); + ); //BackupCount await _featureValueRepository.InsertAsync( @@ -185,7 +185,7 @@ namespace Volo.Abp.FeatureManagement EditionFeatureValueProvider.ProviderName, TestEditionIds.Ultimate.ToString() ) - ).ConfigureAwait(false); + ); #endregion } diff --git a/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureValueRepository_Tests.cs b/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureValueRepository_Tests.cs index 8c3904ef24..c7cbb0d8ae 100644 --- a/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureValueRepository_Tests.cs +++ b/modules/feature-management/test/Volo.Abp.FeatureManagement.TestBase/Volo/Abp/FeatureManagement/FeatureValueRepository_Tests.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.FeatureManagement TestFeatureDefinitionProvider.ProjectCount, EditionFeatureValueProvider.ProviderName, TestEditionIds.Enterprise.ToString() - ).ConfigureAwait(false); + ); featureValue.ShouldNotBeNull(); featureValue.Value.ShouldBe("3"); @@ -35,7 +35,7 @@ namespace Volo.Abp.FeatureManagement TestFeatureDefinitionProvider.ProjectCount, EditionFeatureValueProvider.ProviderName, "undefined-edition-id" - ).ConfigureAwait(false); + ); featureValue.ShouldBeNull(); } @@ -46,7 +46,7 @@ namespace Volo.Abp.FeatureManagement var featureValues = await Repository.GetListAsync( EditionFeatureValueProvider.ProviderName, TestEditionIds.Enterprise.ToString() - ).ConfigureAwait(false); + ); featureValues.Count.ShouldBeGreaterThan(0); diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/FodyWeavers.xml b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/FodyWeavers.xsd b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo.Abp.Identity.Application.Contracts.csproj b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo.Abp.Identity.Application.Contracts.csproj index f14910c068..9703b293d8 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo.Abp.Identity.Application.Contracts.csproj +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo.Abp.Identity.Application.Contracts.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateDto.cs b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateDto.cs index cc2e21eeda..a572c7db2c 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateDto.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserCreateDto.cs @@ -1,4 +1,5 @@ -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Auditing; namespace Volo.Abp.Identity { @@ -6,6 +7,7 @@ namespace Volo.Abp.Identity { [Required] [StringLength(IdentityUserConsts.MaxPasswordLength)] + [DisableAuditing] public string Password { get; set; } } } \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserUpdateDto.cs b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserUpdateDto.cs index 4c1c90d4cc..216a55df9e 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserUpdateDto.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityUserUpdateDto.cs @@ -1,4 +1,5 @@ -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations; +using Volo.Abp.Auditing; using Volo.Abp.Domain.Entities; namespace Volo.Abp.Identity @@ -6,6 +7,7 @@ namespace Volo.Abp.Identity public class IdentityUserUpdateDto : IdentityUserCreateOrUpdateDtoBase, IHasConcurrencyStamp { [StringLength(IdentityUserConsts.MaxPasswordLength)] + [DisableAuditing] public string Password { get; set; } public string ConcurrencyStamp { get; set; } diff --git a/modules/identity/src/Volo.Abp.Identity.Application/FodyWeavers.xml b/modules/identity/src/Volo.Abp.Identity.Application/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Application/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Application/FodyWeavers.xsd b/modules/identity/src/Volo.Abp.Identity.Application/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Application/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Application/Volo.Abp.Identity.Application.csproj b/modules/identity/src/Volo.Abp.Identity.Application/Volo.Abp.Identity.Application.csproj index 8eac9e9162..fc01ba4400 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application/Volo.Abp.Identity.Application.csproj +++ b/modules/identity/src/Volo.Abp.Identity.Application/Volo.Abp.Identity.Application.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs index 44b97a82ea..ffc13fdbca 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs @@ -24,13 +24,13 @@ namespace Volo.Abp.Identity public virtual async Task GetAsync(Guid id) { return ObjectMapper.Map( - await _roleManager.GetByIdAsync(id).ConfigureAwait(false)); + await _roleManager.GetByIdAsync(id)); } public virtual async Task> GetListAsync(PagedAndSortedResultRequestDto input) { - var list = await _roleRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount).ConfigureAwait(false); - var totalCount = await _roleRepository.GetCountAsync().ConfigureAwait(false); + var list = await _roleRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount); + var totalCount = await _roleRepository.GetCountAsync(); return new PagedResultDto( totalCount, @@ -46,8 +46,8 @@ namespace Volo.Abp.Identity role.IsDefault = input.IsDefault; role.IsPublic = input.IsPublic; - (await _roleManager.CreateAsync(role).ConfigureAwait(false)).CheckErrors(); - await CurrentUnitOfWork.SaveChangesAsync().ConfigureAwait(false); + (await _roleManager.CreateAsync(role)).CheckErrors(); + await CurrentUnitOfWork.SaveChangesAsync(); return ObjectMapper.Map(role); } @@ -55,16 +55,16 @@ namespace Volo.Abp.Identity [Authorize(IdentityPermissions.Roles.Update)] public virtual async Task UpdateAsync(Guid id, IdentityRoleUpdateDto input) { - var role = await _roleManager.GetByIdAsync(id).ConfigureAwait(false); + var role = await _roleManager.GetByIdAsync(id); role.ConcurrencyStamp = input.ConcurrencyStamp; - (await _roleManager.SetRoleNameAsync(role, input.Name).ConfigureAwait(false)).CheckErrors(); + (await _roleManager.SetRoleNameAsync(role, input.Name)).CheckErrors(); role.IsDefault = input.IsDefault; role.IsPublic = input.IsPublic; - (await _roleManager.UpdateAsync(role).ConfigureAwait(false)).CheckErrors(); - await CurrentUnitOfWork.SaveChangesAsync().ConfigureAwait(false); + (await _roleManager.UpdateAsync(role)).CheckErrors(); + await CurrentUnitOfWork.SaveChangesAsync(); return ObjectMapper.Map(role); } @@ -72,13 +72,13 @@ namespace Volo.Abp.Identity [Authorize(IdentityPermissions.Roles.Delete)] public virtual async Task DeleteAsync(Guid id) { - var role = await _roleManager.FindByIdAsync(id.ToString()).ConfigureAwait(false); + var role = await _roleManager.FindByIdAsync(id.ToString()); if (role == null) { return; } - (await _roleManager.DeleteAsync(role).ConfigureAwait(false)).CheckErrors(); + (await _roleManager.DeleteAsync(role)).CheckErrors(); } } } diff --git a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs index 365fac604f..c1d0f8f28b 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs @@ -26,14 +26,14 @@ namespace Volo.Abp.Identity { return ObjectMapper.Map( await _userManager.GetByIdAsync(id) -.ConfigureAwait(false)); + ); } [Authorize(IdentityPermissions.Users.Default)] public virtual async Task> GetListAsync(GetIdentityUsersInput input) { - var count = await _userRepository.GetCountAsync(input.Filter).ConfigureAwait(false); - var list = await _userRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter).ConfigureAwait(false); + var count = await _userRepository.GetCountAsync(input.Filter); + var list = await _userRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter); return new PagedResultDto( count, @@ -44,7 +44,7 @@ namespace Volo.Abp.Identity [Authorize(IdentityPermissions.Users.Default)] public virtual async Task> GetRolesAsync(Guid id) { - var roles = await _userRepository.GetRolesAsync(id).ConfigureAwait(false); + var roles = await _userRepository.GetRolesAsync(id); return new ListResultDto( ObjectMapper.Map, List>(roles) ); @@ -55,10 +55,10 @@ namespace Volo.Abp.Identity { var user = new IdentityUser(GuidGenerator.Create(), input.UserName, input.Email, CurrentTenant.Id); - (await _userManager.CreateAsync(user, input.Password).ConfigureAwait(false)).CheckErrors(); - await UpdateUserByInput(user, input).ConfigureAwait(false); + (await _userManager.CreateAsync(user, input.Password)).CheckErrors(); + await UpdateUserByInput(user, input); - await CurrentUnitOfWork.SaveChangesAsync().ConfigureAwait(false); + await CurrentUnitOfWork.SaveChangesAsync(); return ObjectMapper.Map(user); } @@ -66,20 +66,20 @@ namespace Volo.Abp.Identity [Authorize(IdentityPermissions.Users.Update)] public virtual async Task UpdateAsync(Guid id, IdentityUserUpdateDto input) { - var user = await _userManager.GetByIdAsync(id).ConfigureAwait(false); + var user = await _userManager.GetByIdAsync(id); user.ConcurrencyStamp = input.ConcurrencyStamp; - (await _userManager.SetUserNameAsync(user, input.UserName).ConfigureAwait(false)).CheckErrors(); - await UpdateUserByInput(user, input).ConfigureAwait(false); - (await _userManager.UpdateAsync(user).ConfigureAwait(false)).CheckErrors(); + (await _userManager.SetUserNameAsync(user, input.UserName)).CheckErrors(); + await UpdateUserByInput(user, input); + (await _userManager.UpdateAsync(user)).CheckErrors(); if (!input.Password.IsNullOrEmpty()) { - (await _userManager.RemovePasswordAsync(user).ConfigureAwait(false)).CheckErrors(); - (await _userManager.AddPasswordAsync(user, input.Password).ConfigureAwait(false)).CheckErrors(); + (await _userManager.RemovePasswordAsync(user)).CheckErrors(); + (await _userManager.AddPasswordAsync(user, input.Password)).CheckErrors(); } - await CurrentUnitOfWork.SaveChangesAsync().ConfigureAwait(false); + await CurrentUnitOfWork.SaveChangesAsync(); return ObjectMapper.Map(user); } @@ -92,21 +92,21 @@ namespace Volo.Abp.Identity throw new BusinessException(code: IdentityErrorCodes.UserSelfDeletion); } - var user = await _userManager.FindByIdAsync(id.ToString()).ConfigureAwait(false); + var user = await _userManager.FindByIdAsync(id.ToString()); if (user == null) { return; } - (await _userManager.DeleteAsync(user).ConfigureAwait(false)).CheckErrors(); + (await _userManager.DeleteAsync(user)).CheckErrors(); } [Authorize(IdentityPermissions.Users.Update)] public virtual async Task UpdateRolesAsync(Guid id, IdentityUserUpdateRolesDto input) { - var user = await _userManager.GetByIdAsync(id).ConfigureAwait(false); - (await _userManager.SetRolesAsync(user, input.RoleNames).ConfigureAwait(false)).CheckErrors(); - await _userRepository.UpdateAsync(user).ConfigureAwait(false); + var user = await _userManager.GetByIdAsync(id); + (await _userManager.SetRolesAsync(user, input.RoleNames)).CheckErrors(); + await _userRepository.UpdateAsync(user); } [Authorize(IdentityPermissions.Users.Default)] @@ -114,7 +114,7 @@ namespace Volo.Abp.Identity { return ObjectMapper.Map( await _userManager.FindByNameAsync(username) -.ConfigureAwait(false)); + ); } [Authorize(IdentityPermissions.Users.Default)] @@ -122,30 +122,30 @@ namespace Volo.Abp.Identity { return ObjectMapper.Map( await _userManager.FindByEmailAsync(email) -.ConfigureAwait(false)); + ); } private async Task UpdateUserByInput(IdentityUser user, IdentityUserCreateOrUpdateDtoBase input) { if (!string.Equals(user.Email, input.Email, StringComparison.InvariantCultureIgnoreCase)) { - (await _userManager.SetEmailAsync(user, input.Email).ConfigureAwait(false)).CheckErrors(); + (await _userManager.SetEmailAsync(user, input.Email)).CheckErrors(); } if (!string.Equals(user.PhoneNumber, input.PhoneNumber, StringComparison.InvariantCultureIgnoreCase)) { - (await _userManager.SetPhoneNumberAsync(user, input.PhoneNumber).ConfigureAwait(false)).CheckErrors(); + (await _userManager.SetPhoneNumberAsync(user, input.PhoneNumber)).CheckErrors(); } - (await _userManager.SetTwoFactorEnabledAsync(user, input.TwoFactorEnabled).ConfigureAwait(false)).CheckErrors(); - (await _userManager.SetLockoutEnabledAsync(user, input.LockoutEnabled).ConfigureAwait(false)).CheckErrors(); + (await _userManager.SetTwoFactorEnabledAsync(user, input.TwoFactorEnabled)).CheckErrors(); + (await _userManager.SetLockoutEnabledAsync(user, input.LockoutEnabled)).CheckErrors(); user.Name = input.Name; user.Surname = input.Surname; if (input.RoleNames != null) { - (await _userManager.SetRolesAsync(user, input.RoleNames).ConfigureAwait(false)).CheckErrors(); + (await _userManager.SetRolesAsync(user, input.RoleNames)).CheckErrors(); } } } diff --git a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserLookupAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserLookupAppService.cs index ca2b25f83b..48d42c4579 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserLookupAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserLookupAppService.cs @@ -18,7 +18,7 @@ namespace Volo.Abp.Identity public virtual async Task FindByIdAsync(Guid id) { - var userData = await UserLookupServiceProvider.FindByIdAsync(id).ConfigureAwait(false); + var userData = await UserLookupServiceProvider.FindByIdAsync(id); if (userData == null) { return null; @@ -29,7 +29,7 @@ namespace Volo.Abp.Identity public virtual async Task FindByUserNameAsync(string userName) { - var userData = await UserLookupServiceProvider.FindByUserNameAsync(userName).ConfigureAwait(false); + var userData = await UserLookupServiceProvider.FindByUserNameAsync(userName); if (userData == null) { return null; diff --git a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/ProfileAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/ProfileAppService.cs index 04d2c55a0b..0b8712b93d 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/ProfileAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/ProfileAppService.cs @@ -21,39 +21,39 @@ namespace Volo.Abp.Identity { return ObjectMapper.Map( await _userManager.GetByIdAsync(CurrentUser.GetId()) -.ConfigureAwait(false)); + ); } public virtual async Task UpdateAsync(UpdateProfileDto input) { - var user = await _userManager.GetByIdAsync(CurrentUser.GetId()).ConfigureAwait(false); + var user = await _userManager.GetByIdAsync(CurrentUser.GetId()); - if (await SettingProvider.IsTrueAsync(IdentitySettingNames.User.IsUserNameUpdateEnabled).ConfigureAwait(false)) + if (await SettingProvider.IsTrueAsync(IdentitySettingNames.User.IsUserNameUpdateEnabled)) { - (await _userManager.SetUserNameAsync(user, input.UserName).ConfigureAwait(false)).CheckErrors(); + (await _userManager.SetUserNameAsync(user, input.UserName)).CheckErrors(); } - if (await SettingProvider.IsTrueAsync(IdentitySettingNames.User.IsEmailUpdateEnabled).ConfigureAwait(false)) + if (await SettingProvider.IsTrueAsync(IdentitySettingNames.User.IsEmailUpdateEnabled)) { - (await _userManager.SetEmailAsync(user, input.Email).ConfigureAwait(false)).CheckErrors(); + (await _userManager.SetEmailAsync(user, input.Email)).CheckErrors(); } - (await _userManager.SetPhoneNumberAsync(user, input.PhoneNumber).ConfigureAwait(false)).CheckErrors(); + (await _userManager.SetPhoneNumberAsync(user, input.PhoneNumber)).CheckErrors(); user.Name = input.Name; user.Surname = input.Surname; - (await _userManager.UpdateAsync(user).ConfigureAwait(false)).CheckErrors(); + (await _userManager.UpdateAsync(user)).CheckErrors(); - await CurrentUnitOfWork.SaveChangesAsync().ConfigureAwait(false); + await CurrentUnitOfWork.SaveChangesAsync(); return ObjectMapper.Map(user); } public virtual async Task ChangePasswordAsync(ChangePasswordInput input) { - var currentUser = await _userManager.GetByIdAsync(CurrentUser.GetId()).ConfigureAwait(false); - (await _userManager.ChangePasswordAsync(currentUser, input.CurrentPassword, input.NewPassword).ConfigureAwait(false)).CheckErrors(); + var currentUser = await _userManager.GetByIdAsync(CurrentUser.GetId()); + (await _userManager.ChangePasswordAsync(currentUser, input.CurrentPassword, input.NewPassword)).CheckErrors(); } } } diff --git a/modules/identity/src/Volo.Abp.Identity.AspNetCore/FodyWeavers.xml b/modules/identity/src/Volo.Abp.Identity.AspNetCore/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.AspNetCore/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.AspNetCore/FodyWeavers.xsd b/modules/identity/src/Volo.Abp.Identity.AspNetCore/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.AspNetCore/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo.Abp.Identity.AspNetCore.csproj b/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo.Abp.Identity.AspNetCore.csproj index 7ecd91595f..5125c7a89c 100644 --- a/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo.Abp.Identity.AspNetCore.csproj +++ b/modules/identity/src/Volo.Abp.Identity.AspNetCore/Volo.Abp.Identity.AspNetCore.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/FodyWeavers.xml b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/FodyWeavers.xsd b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo.Abp.Identity.Domain.Shared.csproj b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo.Abp.Identity.Domain.Shared.csproj index 460f5285e4..0af270c597 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo.Abp.Identity.Domain.Shared.csproj +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo.Abp.Identity.Domain.Shared.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserConsts.cs b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserConsts.cs index f56a59e967..ef2cc57ef4 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserConsts.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserConsts.cs @@ -18,7 +18,7 @@ namespace Volo.Abp.Identity public const int MaxPhoneNumberLength = AbpUserConsts.MaxPhoneNumberLength; - public const int MaxPasswordLength = 32; + public const int MaxPasswordLength = 128; public const int MaxPasswordHashLength = 256; diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/cs.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/cs.json index 0f87bec5e5..8517adcf12 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/cs.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/cs.json @@ -71,6 +71,32 @@ "Permission:Delete": "Smazat", "Permission:ChangePermissions": "Změnit oprávnění", "Permission:UserManagement": "Správa uživatelů", - "Permission:UserLookup": "Vyhledání uživatele" + "Permission:UserLookup": "Vyhledání uživatele", + "DisplayName:Abp.Identity.Password.RequiredLength": "Požadovaná délka", + "DisplayName:Abp.Identity.Password.RequiredUniqueChars": "Požadovaný počet unikátních znaků", + "DisplayName:Abp.Identity.Password.RequireNonAlphanumeric": "Požadován nealfanumerický znak", + "DisplayName:Abp.Identity.Password.RequireLowercase": "Požadováno malé písmeno", + "DisplayName:Abp.Identity.Password.RequireUppercase": "Požadováno velké písmeno", + "DisplayName:Abp.Identity.Password.RequireDigit": "Požadováno číslo", + "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Povoleno pro nové uživatele", + "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Délka blokování (sekundy)", + "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Maximální počet neúspěšných pokusů o přístup", + "DisplayName:Abp.Identity.SignIn.RequireConfirmedEmail": "Požadovat potvrzený email", + "DisplayName:Abp.Identity.SignIn.RequireConfirmedPhoneNumber": "Požadovat potvrzené telefonní číslo", + "DisplayName:Abp.Identity.User.IsUserNameUpdateEnabled": "Je povolena změna uživatelského jména", + "DisplayName:Abp.Identity.User.IsEmailUpdateEnabled": "Je povolena změna emailu", + "Description:Abp.Identity.Password.RequiredLength": "Minimální délka hesla.", + "Description:Abp.Identity.Password.RequiredUniqueChars": "Minimální počet jedinečných znaků, které musí heslo obsahovat.", + "Description:Abp.Identity.Password.RequireNonAlphanumeric": "Hesla musí obsahovat nealfanumerický znak.", + "Description:Abp.Identity.Password.RequireLowercase": "Pokud hesla musí obsahovat ASCII znak malých písmen.", + "Description:Abp.Identity.Password.RequireUppercase": "Pokud hesla musí obsahovat ASCII znak velkých písmen.", + "Description:Abp.Identity.Password.RequireDigit": "Pokud hesla musí obsahovat číslici.", + "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Zda může být uzamčen nový uživatel.", + "Description:Abp.Identity.Lockout.LockoutDuration": "Doba, po kterou je uživatel zablokován, když dojde k zablokování.", + "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Počet neúspěšných pokusů o přístup než je uživatel uzamčen, za předpokladu, že je uzamčení povoleno.", + "Description:Abp.Identity.SignIn.RequireConfirmedEmail": "Zda je k přihlášení vyžadována potvrzená emailová adresa.", + "Description:Abp.Identity.SignIn.RequireConfirmedPhoneNumber": "Zda je pro přihlášení vyžadováno potvrzené telefonní číslo.", + "Description:Abp.Identity.User.IsUserNameUpdateEnabled": "Zda může uživatel změnit uživatelské jméno.", + "Description:Abp.Identity.User.IsEmailUpdateEnabled": "Zda může uživatel změnit email." } } \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en.json index c542f45ea3..116cdea8d3 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en.json @@ -7,7 +7,7 @@ "UserName": "User name", "EmailAddress": "Email address", "PhoneNumber": "Phone number", - "UserInformations": "User informations", + "UserInformations": "User information", "DisplayName:IsDefault": "Default", "DisplayName:IsStatic": "Static", "DisplayName:IsPublic": "Public", @@ -101,4 +101,4 @@ "Description:Abp.Identity.User.IsUserNameUpdateEnabled": "Whether the username can be updated by the user.", "Description:Abp.Identity.User.IsEmailUpdateEnabled": "Whether the email can be updated by the user." } -} \ No newline at end of file +} diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hans.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hans.json index b80c820f98..ffeb4d0d40 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hans.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hans.json @@ -83,7 +83,7 @@ "DisplayName:Abp.Identity.Lockout.LockoutDuration": "锁定时间(秒)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "最大失败访问尝试次数", "DisplayName:Abp.Identity.SignIn.RequireConfirmedEmail": "要求验证的电子邮箱", - "DisplayName:Abp.Identity.SignIn.RequireConfirmedPhoneNumber": "要求验证的电话号码", + "DisplayName:Abp.Identity.SignIn.RequireConfirmedPhoneNumber": "要求验证的手机号码", "DisplayName:Abp.Identity.User.IsUserNameUpdateEnabled": "启用用户名更新", "DisplayName:Abp.Identity.User.IsEmailUpdateEnabled": "启用电子邮箱更新", "Description:Abp.Identity.Password.RequiredLength": "密码的最小长度.", @@ -96,7 +96,7 @@ "Description:Abp.Identity.Lockout.LockoutDuration": "当锁定发生时用户被的锁定的时间(秒).", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "如果启用锁定, 当用户被锁定前失败的访问尝试次数.", "Description:Abp.Identity.SignIn.RequireConfirmedEmail": "登录时是否需要验证的电子邮箱.", - "Description:Abp.Identity.SignIn.RequireConfirmedPhoneNumber": "登录时是否需要验证的电话号码.", + "Description:Abp.Identity.SignIn.RequireConfirmedPhoneNumber": "登录时是否需要验证的手机号码.", "Description:Abp.Identity.User.IsUserNameUpdateEnabled": "是否允许用户更新用户名.", "Description:Abp.Identity.User.IsEmailUpdateEnabled": "是否允许用户更新电子邮箱." diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hant.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hant.json new file mode 100644 index 0000000000..240b7babdf --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hant.json @@ -0,0 +1,103 @@ +{ + "culture": "zh-Hant", + "texts": { + "Menu:IdentityManagement": "身份識別管理", + "Users": "使用者", + "NewUser": "新使用者", + "UserName": "使用者名稱", + "EmailAddress": "電子信箱地址", + "PhoneNumber": "手機號碼", + "UserInformations": "用戶資訊", + "DisplayName:IsDefault": "預設", + "DisplayName:IsStatic": "靜態", + "DisplayName:IsPublic": "公開", + "Roles": "角色", + "Password": "密碼", + "PersonalInfo": " 個人資料", + "PersonalSettings": "個人設置", + "UserDeletionConfirmationMessage": "使用者 '{0}' 將被刪除. 你確定嗎?", + "RoleDeletionConfirmationMessage": "角色 '{0}' 將被刪除. 你確定嗎?", + "DisplayName:RoleName": "角色名稱", + "DisplayName:UserName": "使用者名稱", + "DisplayName:Name": "名子", + "DisplayName:Surname": "姓", + "DisplayName:Password": "密碼", + "DisplayName:Email": "電子信箱地址", + "DisplayName:PhoneNumber": "手機號碼", + "DisplayName:TwoFactorEnabled": "二次認證", + "DisplayName:LockoutEnabled": "登入失敗,帳號被鎖定", + "NewRole": "新角色", + "RoleName": "角色名稱", + "CreationTime": "建立時間", + "Permissions": "權限", + "DisplayName:CurrentPassword": "目前密碼", + "DisplayName:NewPassword": "新密碼", + "DisplayName:NewPasswordConfirm": "確認新密碼", + "PasswordChangedMessage": "你已成功更改密碼.", + "PersonalSettingsSavedMessage": "你的個人設置保存成功.", + "Identity.DefaultError": "發生了一個未知錯誤.", + "Identity.ConcurrencyFailure": "對象已被修改,因樂觀並行控制導致失敗.", + "Identity.DuplicateEmail": "電子信箱 '{0}' 已存在.", + "Identity.DuplicateRoleName": "角色名 '{0}' 已存在.", + "Identity.DuplicateUserName": "使用者名稱 '{0}' 已存在.", + "Identity.InvalidEmail": "電子信箱 '{0}' 無效.", + "Identity.InvalidPasswordHasherCompatibilityMode": "提供的 PasswordHasherCompatibilityMode 無效.", + "Identity.InvalidPasswordHasherIterationCount": "迭代計數必須是正整數.", + "Identity.InvalidRoleName": "角色名 '{0}' 無效.", + "Identity.InvalidToken": "token無效.", + "Identity.InvalidUserName": "使用者名稱 '{0}' 無效, 只能包含字母或數字.", + "Identity.LoginAlreadyAssociated": "此登入名的使用者已存在.", + "Identity.PasswordMismatch": "密碼錯誤.", + "Identity.PasswordRequiresDigit": "密碼至少包含一位數字 ('0'-'9').", + "Identity.PasswordRequiresLower": "密碼至少包含一位小寫字母 ('a'-'z').", + "Identity.PasswordRequiresNonAlphanumeric": "密碼至少包含一位非字母數字字元.", + "Identity.PasswordRequiresUpper": "密碼至少包含一位大寫字母 ('A'-'Z').", + "Identity.PasswordTooShort": "密碼至少為{0}個字元.", + "Identity.RoleNotFound": "角色 {0} 不存在.", + "Identity.UserAlreadyHasPassword": "使用者已設置密碼.", + "Identity.UserAlreadyInRole": "使用者已具有角色 '{0}'.", + "Identity.UserLockedOut": "使用者被鎖定.", + "Identity.UserLockoutNotEnabled": "該使用者未啟用鎖定.", + "Identity.UserNameNotFound": "使用者 {0} 不存在.", + "Identity.UserNotInRole": "使用者不具有 '{0}' 角色.", + "Identity.PasswordConfirmationFailed": "密碼或確認密碼不一致.", + "Identity.StaticRoleRenamingErrorMessage": "無法重命名靜態角色.", + "Identity.StaticRoleDeletionErrorMessage": "無法刪除靜態角色.", + "Volo.Abp.Identity:010001": "您無法刪除自己的帳號!", + "Permission:IdentityManagement": "身份識別管理", + "Permission:RoleManagement": "角色管理", + "Permission:Create": "建立", + "Permission:Edit": "編輯", + "Permission:Delete": "刪除", + "Permission:ChangePermissions": "更改權限", + "Permission:UserManagement": "使用者管理", + "Permission:UserLookup": "使用者查詢", + "DisplayName:Abp.Identity.Password.RequiredLength": "要求長度", + "DisplayName:Abp.Identity.Password.RequiredUniqueChars": "要求唯一字元數量", + "DisplayName:Abp.Identity.Password.RequireNonAlphanumeric": "要求非字母數字", + "DisplayName:Abp.Identity.Password.RequireLowercase": "要求小寫字母", + "DisplayName:Abp.Identity.Password.RequireUppercase": "要求大寫字母", + "DisplayName:Abp.Identity.Password.RequireDigit": "要求數字", + "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "允許新使用者", + "DisplayName:Abp.Identity.Lockout.LockoutDuration": "鎖定時間(秒)", + "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "最大失敗存取嘗試次數", + "DisplayName:Abp.Identity.SignIn.RequireConfirmedEmail": "要求驗證的電子信箱", + "DisplayName:Abp.Identity.SignIn.RequireConfirmedPhoneNumber": "要求驗證的手機號碼", + "DisplayName:Abp.Identity.User.IsUserNameUpdateEnabled": "啟用使用者名稱更新", + "DisplayName:Abp.Identity.User.IsEmailUpdateEnabled": "啟用電子信箱更新", + "Description:Abp.Identity.Password.RequiredLength": "密碼的最小長度.", + "Description:Abp.Identity.Password.RequiredUniqueChars": "密碼必須包含唯一字元的數量.", + "Description:Abp.Identity.Password.RequireNonAlphanumeric": "密碼是否必須包含非字母數字.", + "Description:Abp.Identity.Password.RequireLowercase": "密碼是否必須包含小寫字母.", + "Description:Abp.Identity.Password.RequireUppercase": "密碼是否必須包含大小字母.", + "Description:Abp.Identity.Password.RequireDigit": "密碼是否必須包含數字.", + "Description:Abp.Identity.Lockout.AllowedForNewUsers": "允許新使用者被鎖定.", + "Description:Abp.Identity.Lockout.LockoutDuration": "當鎖定發生時使用者被鎖定的時間(秒).", + "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "如果啟用鎖定,當使用者被鎖定前失敗的存取嘗試次數.", + "Description:Abp.Identity.SignIn.RequireConfirmedEmail": "登入時是否需要驗證電子信箱.", + "Description:Abp.Identity.SignIn.RequireConfirmedPhoneNumber": "登入時是否需要驗證手機號碼.", + "Description:Abp.Identity.User.IsUserNameUpdateEnabled": "是否允許使用者更新使用者名稱.", + "Description:Abp.Identity.User.IsEmailUpdateEnabled": "是否允許使用者更新電子信箱." + + } +} \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/FodyWeavers.xml b/modules/identity/src/Volo.Abp.Identity.Domain/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Domain/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/FodyWeavers.xsd b/modules/identity/src/Volo.Abp.Identity.Domain/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Domain/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj b/modules/identity/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj index 3e348db1e3..f6eb1df909 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo.Abp.Identity.Domain.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityOptionsFactory.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityOptionsFactory.cs index 3836783a01..89f2b11bc2 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityOptionsFactory.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityOptionsFactory.cs @@ -39,19 +39,19 @@ namespace Volo.Abp.Identity protected virtual async Task OverrideOptionsAsync(IdentityOptions options) { - options.Password.RequiredLength = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequiredLength, options.Password.RequiredLength).ConfigureAwait(false); - options.Password.RequiredUniqueChars = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequiredUniqueChars, options.Password.RequiredUniqueChars).ConfigureAwait(false); - options.Password.RequireNonAlphanumeric = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequireNonAlphanumeric, options.Password.RequireNonAlphanumeric).ConfigureAwait(false); - options.Password.RequireLowercase = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequireLowercase, options.Password.RequireLowercase).ConfigureAwait(false); - options.Password.RequireUppercase = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequireUppercase, options.Password.RequireUppercase).ConfigureAwait(false); - options.Password.RequireDigit = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequireDigit, options.Password.RequireDigit).ConfigureAwait(false); - - options.Lockout.AllowedForNewUsers = await _settingProvider.GetAsync(IdentitySettingNames.Lockout.AllowedForNewUsers, options.Lockout.AllowedForNewUsers).ConfigureAwait(false); + options.Password.RequiredLength = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequiredLength, options.Password.RequiredLength); + options.Password.RequiredUniqueChars = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequiredUniqueChars, options.Password.RequiredUniqueChars); + options.Password.RequireNonAlphanumeric = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequireNonAlphanumeric, options.Password.RequireNonAlphanumeric); + options.Password.RequireLowercase = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequireLowercase, options.Password.RequireLowercase); + options.Password.RequireUppercase = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequireUppercase, options.Password.RequireUppercase); + options.Password.RequireDigit = await _settingProvider.GetAsync(IdentitySettingNames.Password.RequireDigit, options.Password.RequireDigit); + + options.Lockout.AllowedForNewUsers = await _settingProvider.GetAsync(IdentitySettingNames.Lockout.AllowedForNewUsers, options.Lockout.AllowedForNewUsers); options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromSeconds(await _settingProvider.GetAsync(IdentitySettingNames.Lockout.LockoutDuration, options.Lockout.DefaultLockoutTimeSpan.TotalSeconds.To())); - options.Lockout.MaxFailedAccessAttempts = await _settingProvider.GetAsync(IdentitySettingNames.Lockout.MaxFailedAccessAttempts, options.Lockout.MaxFailedAccessAttempts).ConfigureAwait(false); + options.Lockout.MaxFailedAccessAttempts = await _settingProvider.GetAsync(IdentitySettingNames.Lockout.MaxFailedAccessAttempts, options.Lockout.MaxFailedAccessAttempts); - options.SignIn.RequireConfirmedEmail = await _settingProvider.GetAsync(IdentitySettingNames.SignIn.RequireConfirmedEmail, options.SignIn.RequireConfirmedEmail).ConfigureAwait(false); - options.SignIn.RequireConfirmedPhoneNumber = await _settingProvider.GetAsync(IdentitySettingNames.SignIn.RequireConfirmedPhoneNumber, options.SignIn.RequireConfirmedPhoneNumber).ConfigureAwait(false); + options.SignIn.RequireConfirmedEmail = await _settingProvider.GetAsync(IdentitySettingNames.SignIn.RequireConfirmedEmail, options.SignIn.RequireConfirmedEmail); + options.SignIn.RequireConfirmedPhoneNumber = await _settingProvider.GetAsync(IdentitySettingNames.SignIn.RequireConfirmedPhoneNumber, options.SignIn.RequireConfirmedPhoneNumber); } } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpUserClaimsPrincipalFactory.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpUserClaimsPrincipalFactory.cs index 9425a91cdc..8db2b95942 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpUserClaimsPrincipalFactory.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpUserClaimsPrincipalFactory.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.Identity [UnitOfWork] public override async Task CreateAsync(IdentityUser user) { - var principal = await base.CreateAsync(user).ConfigureAwait(false); + var principal = await base.CreateAsync(user); if (user.TenantId.HasValue) { diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentityRoleRepository.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentityRoleRepository.cs index 6ce3ce3c0c..3a344b3140 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentityRoleRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IIdentityRoleRepository.cs @@ -21,5 +21,10 @@ namespace Volo.Abp.Identity bool includeDetails = false, CancellationToken cancellationToken = default ); + + Task> GetDefaultOnesAsync( + bool includeDetails = false, + CancellationToken cancellationToken = default + ); } } \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityClaimTypeManager.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityClaimTypeManager.cs index ae468d272a..6e79b29d98 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityClaimTypeManager.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityClaimTypeManager.cs @@ -15,17 +15,17 @@ namespace Volo.Abp.Identity public virtual async Task CreateAsync(IdentityClaimType claimType) { - if (await _identityClaimTypeRepository.AnyAsync(claimType.Name).ConfigureAwait(false)) + if (await _identityClaimTypeRepository.AnyAsync(claimType.Name)) { throw new AbpException($"Name Exist: {claimType.Name}"); } - return await _identityClaimTypeRepository.InsertAsync(claimType).ConfigureAwait(false); + return await _identityClaimTypeRepository.InsertAsync(claimType); } public virtual async Task UpdateAsync(IdentityClaimType claimType) { - if (await _identityClaimTypeRepository.AnyAsync(claimType.Name, claimType.Id).ConfigureAwait(false)) + if (await _identityClaimTypeRepository.AnyAsync(claimType.Name, claimType.Id)) { throw new AbpException($"Name Exist: {claimType.Name}"); } @@ -36,7 +36,7 @@ namespace Volo.Abp.Identity } - return await _identityClaimTypeRepository.UpdateAsync(claimType).ConfigureAwait(false); + return await _identityClaimTypeRepository.UpdateAsync(claimType); } } } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDataSeeder.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDataSeeder.cs index 92ebe6adfb..70945c2546 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDataSeeder.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityDataSeeder.cs @@ -47,7 +47,7 @@ namespace Volo.Abp.Identity const string adminUserName = "admin"; var adminUser = await _userRepository.FindByNormalizedUserNameAsync( _lookupNormalizer.NormalizeName(adminUserName) - ).ConfigureAwait(false); + ); if (adminUser != null) { @@ -64,12 +64,12 @@ namespace Volo.Abp.Identity Name = adminUserName }; - (await _userManager.CreateAsync(adminUser, adminPassword).ConfigureAwait(false)).CheckErrors(); + (await _userManager.CreateAsync(adminUser, adminPassword)).CheckErrors(); result.CreatedAdminUser = true; //"admin" role const string adminRoleName = "admin"; - var adminRole = await _roleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName(adminRoleName)).ConfigureAwait(false); + var adminRole = await _roleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName(adminRoleName)); if (adminRole == null) { adminRole = new IdentityRole( @@ -82,11 +82,11 @@ namespace Volo.Abp.Identity IsPublic = true }; - (await _roleManager.CreateAsync(adminRole).ConfigureAwait(false)).CheckErrors(); + (await _roleManager.CreateAsync(adminRole)).CheckErrors(); result.CreatedAdminRole = true; } - (await _userManager.AddToRoleAsync(adminUser, adminRoleName).ConfigureAwait(false)).CheckErrors(); + (await _userManager.AddToRoleAsync(adminUser, adminRoleName)).CheckErrors(); return result; } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRole.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRole.cs index 825266e993..dac173719a 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRole.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRole.cs @@ -100,6 +100,22 @@ namespace Volo.Abp.Identity Claims.RemoveAll(c => c.ClaimType == claim.Type && c.ClaimValue == claim.Value); } + public virtual void ChangeName(string name) + { + Check.NotNullOrWhiteSpace(name, nameof(name)); + + var oldName = Name; + Name = name; + + AddLocalEvent( + new IdentityRoleNameChangedEvent + { + IdentityRole = this, + OldName = oldName + } + ); + } + public override string ToString() { return $"{base.ToString()}, Name = {Name}"; diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleManager.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleManager.cs index 17f1b817aa..0a64d64aad 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleManager.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleManager.cs @@ -41,7 +41,7 @@ namespace Volo.Abp.Identity public virtual async Task GetByIdAsync(Guid id) { - var role = await Store.FindByIdAsync(id.ToString(), CancellationToken).ConfigureAwait(false); + var role = await Store.FindByIdAsync(id.ToString(), CancellationToken); if (role == null) { throw new EntityNotFoundException(typeof(IdentityRole), id); @@ -57,7 +57,7 @@ namespace Volo.Abp.Identity throw new BusinessException(_localizer["Identity.StaticRoleRenamingErrorMessage"]); // TODO: localize & change exception type } - return await base.SetRoleNameAsync(role, name).ConfigureAwait(false); + return await base.SetRoleNameAsync(role, name); } public override async Task DeleteAsync(IdentityRole role) @@ -67,7 +67,7 @@ namespace Volo.Abp.Identity throw new BusinessException(_localizer["Identity.StaticRoleDeletionErrorMessage"]); // TODO: localize & change exception type } - return await base.DeleteAsync(role).ConfigureAwait(false); + return await base.DeleteAsync(role); } } } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleNameChangedEvent.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleNameChangedEvent.cs new file mode 100644 index 0000000000..f14f0a71ed --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleNameChangedEvent.cs @@ -0,0 +1,8 @@ +namespace Volo.Abp.Identity +{ + public class IdentityRoleNameChangedEvent + { + public IdentityRole IdentityRole { get; set; } + public string OldName { get; set; } + } +} diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleStore.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleStore.cs index 1ca46b0830..ddff3ae844 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleStore.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleStore.cs @@ -67,7 +67,7 @@ namespace Volo.Abp.Identity Check.NotNull(role, nameof(role)); - await _roleRepository.InsertAsync(role, AutoSaveChanges, cancellationToken).ConfigureAwait(false); + await _roleRepository.InsertAsync(role, AutoSaveChanges, cancellationToken); return IdentityResult.Success; } @@ -86,7 +86,7 @@ namespace Volo.Abp.Identity try { - await _roleRepository.UpdateAsync(role, AutoSaveChanges, cancellationToken).ConfigureAwait(false); + await _roleRepository.UpdateAsync(role, AutoSaveChanges, cancellationToken); } catch (AbpDbConcurrencyException ex) { @@ -111,7 +111,7 @@ namespace Volo.Abp.Identity try { - await _roleRepository.DeleteAsync(role, AutoSaveChanges, cancellationToken).ConfigureAwait(false); + await _roleRepository.DeleteAsync(role, AutoSaveChanges, cancellationToken); } catch (AbpDbConcurrencyException ex) { @@ -165,7 +165,7 @@ namespace Volo.Abp.Identity Check.NotNull(role, nameof(role)); - role.Name = roleName; + role.ChangeName(roleName); return Task.CompletedTask; } @@ -249,7 +249,7 @@ namespace Volo.Abp.Identity Check.NotNull(role, nameof(role)); - await _roleRepository.EnsureCollectionLoadedAsync(role, r => r.Claims, cancellationToken).ConfigureAwait(false); + await _roleRepository.EnsureCollectionLoadedAsync(role, r => r.Claims, cancellationToken); return role.Claims.Select(c => c.ToClaim()).ToList(); } @@ -268,7 +268,7 @@ namespace Volo.Abp.Identity Check.NotNull(role, nameof(role)); Check.NotNull(claim, nameof(claim)); - await _roleRepository.EnsureCollectionLoadedAsync(role, r => r.Claims, cancellationToken).ConfigureAwait(false); + await _roleRepository.EnsureCollectionLoadedAsync(role, r => r.Claims, cancellationToken); role.AddClaim(_guidGenerator, claim); } @@ -285,7 +285,7 @@ namespace Volo.Abp.Identity Check.NotNull(role, nameof(role)); Check.NotNull(claim, nameof(claim)); - await _roleRepository.EnsureCollectionLoadedAsync(role, r => r.Claims, cancellationToken).ConfigureAwait(false); + await _roleRepository.EnsureCollectionLoadedAsync(role, r => r.Claims, cancellationToken); role.RemoveClaim(claim); } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs index 242ca6a908..a2f5912d61 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserManager.cs @@ -33,7 +33,8 @@ namespace Volo.Abp.Identity IPasswordHasher passwordHasher, IEnumerable> userValidators, IEnumerable> passwordValidators, - ILookupNormalizer keyNormalizer, IdentityErrorDescriber errors, + ILookupNormalizer keyNormalizer, + IdentityErrorDescriber errors, IServiceProvider services, ILogger logger, ICancellationTokenProvider cancellationTokenProvider, @@ -59,7 +60,7 @@ namespace Volo.Abp.Identity public virtual async Task GetByIdAsync(Guid id) { - var user = await Store.FindByIdAsync(id.ToString(), CancellationToken).ConfigureAwait(false); + var user = await Store.FindByIdAsync(id.ToString(), CancellationToken); if (user == null) { throw new EntityNotFoundException(typeof(IdentityUser), id); @@ -75,13 +76,13 @@ namespace Volo.Abp.Identity var currentRoleNames = await GetRolesAsync(user).ConfigureAwait(false); - var result = await RemoveFromRolesAsync(user, currentRoleNames.Except(roleNames).Distinct()).ConfigureAwait(false); + var result = await RemoveFromRolesAsync(user, currentRoleNames.Except(roleNames).Distinct()); if (!result.Succeeded) { return result; } - result = await AddToRolesAsync(user, roleNames.Except(currentRoleNames).Distinct()).ConfigureAwait(false); + result = await AddToRolesAsync(user, roleNames.Except(currentRoleNames).Distinct()); if (!result.Succeeded) { return result; diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserRepositoryExternalUserLookupServiceProvider.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserRepositoryExternalUserLookupServiceProvider.cs index 1fdc6ff934..75c2ef53a7 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserRepositoryExternalUserLookupServiceProvider.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserRepositoryExternalUserLookupServiceProvider.cs @@ -30,7 +30,7 @@ namespace Volo.Abp.Identity includeDetails: false, cancellationToken: cancellationToken ) -.ConfigureAwait(false))?.ToAbpUserData(); +)?.ToAbpUserData(); } public virtual async Task FindByUserNameAsync( @@ -43,7 +43,7 @@ namespace Volo.Abp.Identity includeDetails: false, cancellationToken: cancellationToken ) -.ConfigureAwait(false))?.ToAbpUserData(); +)?.ToAbpUserData(); } } } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserStore.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserStore.cs index cbec7144d2..ffc35b1135 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserStore.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserStore.cs @@ -163,7 +163,7 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); - await _userRepository.InsertAsync(user, AutoSaveChanges, cancellationToken).ConfigureAwait(false); + await _userRepository.InsertAsync(user, AutoSaveChanges, cancellationToken); return IdentityResult.Success; } @@ -182,7 +182,7 @@ namespace Volo.Abp.Identity try { - await _userRepository.UpdateAsync(user, AutoSaveChanges, cancellationToken).ConfigureAwait(false); + await _userRepository.UpdateAsync(user, AutoSaveChanges, cancellationToken); } catch (AbpDbConcurrencyException ex) { @@ -207,7 +207,7 @@ namespace Volo.Abp.Identity try { - await _userRepository.DeleteAsync(user, AutoSaveChanges, cancellationToken).ConfigureAwait(false); + await _userRepository.DeleteAsync(user, AutoSaveChanges, cancellationToken); } catch (AbpDbConcurrencyException ex) { @@ -313,14 +313,14 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); Check.NotNull(normalizedRoleName, nameof(normalizedRoleName)); - var role = await _roleRepository.FindByNormalizedNameAsync(normalizedRoleName, cancellationToken: cancellationToken).ConfigureAwait(false); + var role = await _roleRepository.FindByNormalizedNameAsync(normalizedRoleName, cancellationToken: cancellationToken); if (role == null) { throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, "Role {0} does not exist!", normalizedRoleName)); } - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Roles, cancellationToken).ConfigureAwait(false); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Roles, cancellationToken); user.AddRole(role.Id); } @@ -343,13 +343,13 @@ namespace Volo.Abp.Identity throw new ArgumentException(nameof(normalizedRoleName) + " can not be null or whitespace"); } - var role = await _roleRepository.FindByNormalizedNameAsync(normalizedRoleName, cancellationToken: cancellationToken).ConfigureAwait(false); + var role = await _roleRepository.FindByNormalizedNameAsync(normalizedRoleName, cancellationToken: cancellationToken); if (role == null) { return; } - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Roles, cancellationToken).ConfigureAwait(false); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Roles, cancellationToken); user.RemoveRole(role.Id); } @@ -392,13 +392,13 @@ namespace Volo.Abp.Identity throw new ArgumentException(nameof(normalizedRoleName) + " can not be null or whitespace"); } - var role = await _roleRepository.FindByNormalizedNameAsync(normalizedRoleName, cancellationToken: cancellationToken).ConfigureAwait(false); + var role = await _roleRepository.FindByNormalizedNameAsync(normalizedRoleName, cancellationToken: cancellationToken); if (role == null) { return false; } - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Roles, cancellationToken).ConfigureAwait(false); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Roles, cancellationToken); return user.IsInRole(role.Id); } @@ -415,7 +415,7 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Claims, cancellationToken).ConfigureAwait(false); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Claims, cancellationToken); return user.Claims.Select(c => c.ToClaim()).ToList(); } @@ -434,7 +434,7 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); Check.NotNull(claims, nameof(claims)); - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Claims, cancellationToken).ConfigureAwait(false); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Claims, cancellationToken); user.AddClaims(_guidGenerator, claims); } @@ -455,7 +455,7 @@ namespace Volo.Abp.Identity Check.NotNull(claim, nameof(claim)); Check.NotNull(newClaim, nameof(newClaim)); - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Claims, cancellationToken).ConfigureAwait(false); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Claims, cancellationToken); user.ReplaceClaim(claim, newClaim); } @@ -474,7 +474,7 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); Check.NotNull(claims, nameof(claims)); - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Claims, cancellationToken).ConfigureAwait(false); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Claims, cancellationToken); user.RemoveClaims(claims); } @@ -493,7 +493,7 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); Check.NotNull(login, nameof(login)); - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Logins, cancellationToken).ConfigureAwait(false); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Logins, cancellationToken); user.AddLogin(login); } @@ -514,7 +514,7 @@ namespace Volo.Abp.Identity Check.NotNull(loginProvider, nameof(loginProvider)); Check.NotNull(providerKey, nameof(providerKey)); - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Logins, cancellationToken).ConfigureAwait(false); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Logins, cancellationToken); user.RemoveLogin(loginProvider, providerKey); } @@ -533,7 +533,7 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Logins, cancellationToken).ConfigureAwait(false); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Logins, cancellationToken); return user.Logins.Select(l => l.ToUserLoginInfo()).ToList(); } @@ -992,7 +992,7 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Tokens, cancellationToken).ConfigureAwait(false); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Tokens, cancellationToken); user.SetToken(loginProvider, name, value); } @@ -1011,7 +1011,7 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Tokens, cancellationToken).ConfigureAwait(false); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Tokens, cancellationToken); user.RemoveToken(loginProvider, name); } @@ -1030,7 +1030,7 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); - await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Tokens, cancellationToken).ConfigureAwait(false); + await _userRepository.EnsureCollectionLoadedAsync(user, u => u.Tokens, cancellationToken); return user.FindToken(loginProvider, name)?.Value; } @@ -1057,7 +1057,7 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); - var mergedCodes = await GetTokenAsync(user, InternalLoginProvider, RecoveryCodeTokenName, cancellationToken).ConfigureAwait(false) ?? ""; + var mergedCodes = await GetTokenAsync(user, InternalLoginProvider, RecoveryCodeTokenName, cancellationToken) ?? ""; if (mergedCodes.Length > 0) { return mergedCodes.Split(';').Length; @@ -1094,12 +1094,12 @@ namespace Volo.Abp.Identity Check.NotNull(user, nameof(user)); Check.NotNull(code, nameof(code)); - var mergedCodes = await GetTokenAsync(user, InternalLoginProvider, RecoveryCodeTokenName, cancellationToken).ConfigureAwait(false) ?? ""; + var mergedCodes = await GetTokenAsync(user, InternalLoginProvider, RecoveryCodeTokenName, cancellationToken) ?? ""; var splitCodes = mergedCodes.Split(';'); if (splitCodes.Contains(code)) { var updatedCodes = new List(splitCodes.Where(s => s != code)); - await ReplaceCodesAsync(user, updatedCodes, cancellationToken).ConfigureAwait(false); + await ReplaceCodesAsync(user, updatedCodes, cancellationToken); return true; } return false; diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/UserRoleFinder.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/UserRoleFinder.cs index c366591a57..d2de24a568 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/UserRoleFinder.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/UserRoleFinder.cs @@ -15,7 +15,7 @@ namespace Volo.Abp.Identity public virtual async Task GetRolesAsync(Guid userId) { - return (await _identityUserRepository.GetRoleNamesAsync(userId).ConfigureAwait(false)).ToArray(); + return (await _identityUserRepository.GetRoleNamesAsync(userId)).ToArray(); } } } diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/FodyWeavers.xml b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/FodyWeavers.xsd b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo.Abp.Identity.EntityFrameworkCore.csproj b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo.Abp.Identity.EntityFrameworkCore.csproj index 994a3a3985..0f1e0d1c7e 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo.Abp.Identity.EntityFrameworkCore.csproj +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo.Abp.Identity.EntityFrameworkCore.csproj @@ -1,9 +1,10 @@ - + + - netstandard2.1 + netstandard2.0 Volo.Abp.Identity.EntityFrameworkCore Volo.Abp.Identity.EntityFrameworkCore $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityClaimTypeRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityClaimTypeRepository.cs index d7cb57d396..95b7a7fe42 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityClaimTypeRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityClaimTypeRepository.cs @@ -21,7 +21,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore { return await DbSet .WhereIf(ignoredId != null, ct => ct.Id != ignoredId) - .CountAsync(ct => ct.Name == name).ConfigureAwait(false) > 0; + .CountAsync(ct => ct.Name == name) > 0; } public async Task> GetListAsync(string sorting, int maxResultCount, int skipCount, string filter) @@ -34,7 +34,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore ) .OrderBy(sorting ?? "name desc") .PageBy(skipCount, maxResultCount) - .ToListAsync().ConfigureAwait(false); + .ToListAsync(); return identityClaimTypes; } diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityRoleRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityRoleRepository.cs index 731cc6df23..dfaaf51d91 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityRoleRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityRoleRepository.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore { return await DbSet .IncludeDetails(includeDetails) - .FirstOrDefaultAsync(r => r.NormalizedName == normalizedRoleName, GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .FirstOrDefaultAsync(r => r.NormalizedName == normalizedRoleName, GetCancellationToken(cancellationToken)); } public virtual async Task> GetListAsync( @@ -39,7 +39,13 @@ namespace Volo.Abp.Identity.EntityFrameworkCore .IncludeDetails(includeDetails) .OrderBy(sorting ?? nameof(IdentityRole.Name)) .PageBy(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task> GetDefaultOnesAsync( + bool includeDetails = false, CancellationToken cancellationToken = default) + { + return await DbSet.IncludeDetails(includeDetails).Where(r => r.IsDefault).ToListAsync(GetCancellationToken(cancellationToken)); } public override IQueryable WithDetails() diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs index 0564668225..2b5f249e77 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserRepository.cs @@ -29,7 +29,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore .FirstOrDefaultAsync( u => u.NormalizedUserName == normalizedUserName, GetCancellationToken(cancellationToken) - ).ConfigureAwait(false); + ); } public virtual async Task> GetRoleNamesAsync( @@ -41,7 +41,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore where userRole.UserId == id select role.Name; - return await query.ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + return await query.ToListAsync(GetCancellationToken(cancellationToken)); } public virtual async Task> GetRoleNamesInOrganizationUnitAsync( @@ -66,7 +66,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore return await DbSet .IncludeDetails(includeDetails) .Where(u => u.Logins.Any(login => login.LoginProvider == loginProvider && login.ProviderKey == providerKey)) - .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); } public virtual async Task FindByNormalizedEmailAsync( @@ -76,7 +76,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore { return await DbSet .IncludeDetails(includeDetails) - .FirstOrDefaultAsync(u => u.NormalizedEmail == normalizedEmail, GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .FirstOrDefaultAsync(u => u.NormalizedEmail == normalizedEmail, GetCancellationToken(cancellationToken)); } public virtual async Task> GetListByClaimAsync( @@ -87,7 +87,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore return await DbSet .IncludeDetails(includeDetails) .Where(u => u.Claims.Any(c => c.ClaimType == claim.Type && c.ClaimValue == claim.Value)) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public virtual async Task> GetListByNormalizedRoleNameAsync( @@ -97,7 +97,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore { var role = await DbContext.Roles .Where(x => x.NormalizedName == normalizedRoleName) - .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); if (role == null) { @@ -107,7 +107,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore return await DbSet .IncludeDetails(includeDetails) .Where(u => u.Roles.Any(r => r.RoleId == role.Id)) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public virtual async Task> GetListAsync( @@ -128,7 +128,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore ) .OrderBy(sorting ?? nameof(IdentityUser.UserName)) .PageBy(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public virtual async Task> GetRolesAsync( @@ -141,7 +141,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore where userRole.UserId == id select role; - return await query.ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + return await query.ToListAsync(GetCancellationToken(cancellationToken)); } public virtual async Task GetCountAsync( @@ -154,7 +154,7 @@ namespace Volo.Abp.Identity.EntityFrameworkCore u.UserName.Contains(filter) || u.Email.Contains(filter) ) - .LongCountAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .LongCountAsync(GetCancellationToken(cancellationToken)); } public virtual async Task> GetOrganizationUnitsAsync( diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/FodyWeavers.xml b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/FodyWeavers.xsd b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo.Abp.Identity.HttpApi.Client.csproj b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo.Abp.Identity.HttpApi.Client.csproj index 0f5d63db37..11fd0a40b6 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo.Abp.Identity.HttpApi.Client.csproj +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo.Abp.Identity.HttpApi.Client.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/HttpClientUserRoleFinder.cs b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/HttpClientUserRoleFinder.cs index 1e5934cee5..a5fffe9848 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/HttpClientUserRoleFinder.cs +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/HttpClientUserRoleFinder.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.Identity public async Task GetRolesAsync(Guid userId) { - var output = await _userAppService.GetRolesAsync(userId).ConfigureAwait(false); + var output = await _userAppService.GetRolesAsync(userId); return output.Items.Select(r => r.Name).ToArray(); } } diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi/FodyWeavers.xml b/modules/identity/src/Volo.Abp.Identity.HttpApi/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi/FodyWeavers.xsd b/modules/identity/src/Volo.Abp.Identity.HttpApi/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo.Abp.Identity.HttpApi.csproj b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo.Abp.Identity.HttpApi.csproj index c7ca885378..55629d070e 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo.Abp.Identity.HttpApi.csproj +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo.Abp.Identity.HttpApi.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/FodyWeavers.xml b/modules/identity/src/Volo.Abp.Identity.MongoDB/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/FodyWeavers.xsd b/modules/identity/src/Volo.Abp.Identity.MongoDB/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo.Abp.Identity.MongoDB.csproj b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo.Abp.Identity.MongoDB.csproj index 06e5717e03..762582ef67 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo.Abp.Identity.MongoDB.csproj +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo.Abp.Identity.MongoDB.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityClaimTypeRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityClaimTypeRepository.cs index beed5130f1..16ba528412 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityClaimTypeRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityClaimTypeRepository.cs @@ -22,13 +22,13 @@ namespace Volo.Abp.Identity.MongoDB { return await GetMongoQueryable() .Where(ct => ct.Name == name) - .AnyAsync().ConfigureAwait(false); + .AnyAsync(); } else { return await GetMongoQueryable() .Where(ct => ct.Id != ignoredId && ct.Name == name) - .AnyAsync().ConfigureAwait(false); + .AnyAsync(); } } @@ -43,7 +43,7 @@ namespace Volo.Abp.Identity.MongoDB .OrderBy(sorting ?? nameof(IdentityClaimType.Name)) .As>() .PageBy>(skipCount, maxResultCount) - .ToListAsync().ConfigureAwait(false); + .ToListAsync(); } } } diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityRoleRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityRoleRepository.cs index 4bae372c8e..10f77836c9 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityRoleRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityRoleRepository.cs @@ -27,7 +27,7 @@ namespace Volo.Abp.Identity.MongoDB bool includeDetails = true, CancellationToken cancellationToken = default) { - return await GetMongoQueryable().FirstOrDefaultAsync(r => r.NormalizedName == normalizedRoleName, GetCancellationToken(cancellationToken)).ConfigureAwait(false); + return await GetMongoQueryable().FirstOrDefaultAsync(r => r.NormalizedName == normalizedRoleName, GetCancellationToken(cancellationToken)); } public async Task> GetListAsync( @@ -41,7 +41,13 @@ namespace Volo.Abp.Identity.MongoDB .OrderBy(sorting ?? nameof(IdentityRole.Name)) .As>() .PageBy>(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task> GetDefaultOnesAsync( + bool includeDetails = false, CancellationToken cancellationToken = default) + { + return await GetMongoQueryable().Where(r => r.IsDefault).ToListAsync(cancellationToken: GetCancellationToken(cancellationToken)); } } } \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs index fc198c7883..79217f4eeb 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs @@ -33,16 +33,16 @@ namespace Volo.Abp.Identity.MongoDB .FirstOrDefaultAsync( u => u.NormalizedUserName == normalizedUserName, GetCancellationToken(cancellationToken) - ).ConfigureAwait(false); + ); } public async Task> GetRoleNamesAsync( Guid id, CancellationToken cancellationToken = default) { - var user = await GetAsync(id, cancellationToken: GetCancellationToken(cancellationToken)).ConfigureAwait(false); + var user = await GetAsync(id, cancellationToken: GetCancellationToken(cancellationToken)); var roleIds = user.Roles.Select(r => r.RoleId).ToArray(); - return await DbContext.Roles.AsQueryable().Where(r => roleIds.Contains(r.Id)).Select(r => r.Name).ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + return await DbContext.Roles.AsQueryable().Where(r => roleIds.Contains(r.Id)).Select(r => r.Name).ToListAsync(GetCancellationToken(cancellationToken)); } public async Task> GetRoleNamesInOrganizationUnitAsync( @@ -64,7 +64,7 @@ namespace Volo.Abp.Identity.MongoDB { return await GetMongoQueryable() .Where(u => u.Logins.Any(login => login.LoginProvider == loginProvider && login.ProviderKey == providerKey)) - .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); } public async Task FindByNormalizedEmailAsync( @@ -72,7 +72,7 @@ namespace Volo.Abp.Identity.MongoDB bool includeDetails = true, CancellationToken cancellationToken = default) { - return await GetMongoQueryable().FirstOrDefaultAsync(u => u.NormalizedEmail == normalizedEmail, GetCancellationToken(cancellationToken)).ConfigureAwait(false); + return await GetMongoQueryable().FirstOrDefaultAsync(u => u.NormalizedEmail == normalizedEmail, GetCancellationToken(cancellationToken)); } public async Task> GetListByClaimAsync( @@ -82,7 +82,7 @@ namespace Volo.Abp.Identity.MongoDB { return await GetMongoQueryable() .Where(u => u.Claims.Any(c => c.ClaimType == claim.Type && c.ClaimValue == claim.Value)) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public async Task> GetListByNormalizedRoleNameAsync( @@ -90,7 +90,7 @@ namespace Volo.Abp.Identity.MongoDB bool includeDetails = false, CancellationToken cancellationToken = default) { - var role = await DbContext.Roles.AsQueryable().Where(x => x.NormalizedName == normalizedRoleName).FirstOrDefaultAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + var role = await DbContext.Roles.AsQueryable().Where(x => x.NormalizedName == normalizedRoleName).FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); if (role == null) { @@ -99,7 +99,7 @@ namespace Volo.Abp.Identity.MongoDB return await GetMongoQueryable() .Where(u => u.Roles.Any(r => r.RoleId == role.Id)) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public async Task> GetListAsync( @@ -120,7 +120,7 @@ namespace Volo.Abp.Identity.MongoDB .OrderBy(sorting ?? nameof(IdentityUser.UserName)) .As>() .PageBy>(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public async Task> GetRolesAsync( @@ -128,9 +128,9 @@ namespace Volo.Abp.Identity.MongoDB bool includeDetails = false, CancellationToken cancellationToken = default) { - var user = await GetAsync(id, cancellationToken: GetCancellationToken(cancellationToken)).ConfigureAwait(false); + var user = await GetAsync(id, cancellationToken: GetCancellationToken(cancellationToken)); var roleIds = user.Roles.Select(r => r.RoleId).ToArray(); - return await DbContext.Roles.AsQueryable().Where(r => roleIds.Contains(r.Id)).ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + return await DbContext.Roles.AsQueryable().Where(r => roleIds.Contains(r.Id)).ToListAsync(GetCancellationToken(cancellationToken)); } public async Task> GetOrganizationUnitsAsync( @@ -157,7 +157,7 @@ namespace Volo.Abp.Identity.MongoDB u.UserName.Contains(filter) || u.Email.Contains(filter) ) - .LongCountAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .LongCountAsync(GetCancellationToken(cancellationToken)); } public async Task> GetUsersInOrganizationUnitAsync( diff --git a/modules/identity/src/Volo.Abp.Identity.Web/FodyWeavers.xml b/modules/identity/src/Volo.Abp.Identity.Web/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Web/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Web/FodyWeavers.xsd b/modules/identity/src/Volo.Abp.Identity.Web/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Web/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Navigation/AbpIdentityWebMainMenuContributor.cs b/modules/identity/src/Volo.Abp.Identity.Web/Navigation/AbpIdentityWebMainMenuContributor.cs index d6d61dcff4..34dc3dd4cd 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Navigation/AbpIdentityWebMainMenuContributor.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/Navigation/AbpIdentityWebMainMenuContributor.cs @@ -18,8 +18,8 @@ namespace Volo.Abp.Identity.Web.Navigation var authorizationService = context.ServiceProvider.GetRequiredService(); - var hasRolePermission = await authorizationService.IsGrantedAsync(IdentityPermissions.Roles.Default).ConfigureAwait(false); - var hasUserPermission = await authorizationService.IsGrantedAsync(IdentityPermissions.Users.Default).ConfigureAwait(false); + var hasRolePermission = await authorizationService.IsGrantedAsync(IdentityPermissions.Roles.Default); + var hasUserPermission = await authorizationService.IsGrantedAsync(IdentityPermissions.Users.Default); if (hasRolePermission || hasUserPermission) { diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml.cs b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml.cs index 4861944c7f..b3fdad3a95 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/CreateModal.cshtml.cs @@ -21,7 +21,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Roles ValidateModel(); var input = ObjectMapper.Map(Role); - await _identityRoleAppService.CreateAsync(input).ConfigureAwait(false); + await _identityRoleAppService.CreateAsync(input); return NoContent(); } diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml.cs b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml.cs index 42f13b4bf5..8416e171b0 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/EditModal.cshtml.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Roles { Role = ObjectMapper.Map( await _identityRoleAppService.GetAsync(id) -.ConfigureAwait(false)); + ); } public async Task OnPostAsync() @@ -30,7 +30,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Roles ValidateModel(); var input = ObjectMapper.Map(Role); - await _identityRoleAppService.UpdateAsync(Role.Id, input).ConfigureAwait(false); + await _identityRoleAppService.UpdateAsync(Role.Id, input); return NoContent(); } diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/index.js b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/index.js index eb0892338c..8332a95ac7 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/index.js +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Roles/index.js @@ -17,6 +17,7 @@ searching: false, processing: true, serverSide: true, + scrollX: true, paging: true, ajax: abp.libs.datatables.createAjax(_identityRoleAppService.getList), columnDefs: [ diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml.cs b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml.cs index e2dbedc660..aad90e73cc 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml.cs @@ -1,8 +1,9 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; +using Volo.Abp.Auditing; using Volo.Abp.Application.Dtos; namespace Volo.Abp.Identity.Web.Pages.Identity.Users @@ -28,7 +29,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users { UserInfo = new UserInfoViewModel(); - var roleDtoList = await _identityRoleAppService.GetListAsync(new PagedAndSortedResultRequestDto()).ConfigureAwait(false); + var roleDtoList = await _identityRoleAppService.GetListAsync(new PagedAndSortedResultRequestDto()); Roles = ObjectMapper.Map, AssignedRoleViewModel[]>(roleDtoList.Items); @@ -45,7 +46,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users var input = ObjectMapper.Map(UserInfo); input.RoleNames = Roles.Where(r => r.IsAssigned).Select(r => r.Name).ToArray(); - await _identityUserAppService.CreateAsync(input).ConfigureAwait(false); + await _identityUserAppService.CreateAsync(input); return NoContent(); } @@ -65,6 +66,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users [Required] [StringLength(IdentityUserConsts.MaxPasswordLength)] [DataType(DataType.Password)] + [DisableAuditing] public string Password { get; set; } [Required] diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs index 7a55711bd3..6c8d40c14d 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs @@ -4,6 +4,7 @@ using System.ComponentModel.DataAnnotations; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; +using Volo.Abp.Auditing; using Volo.Abp.Application.Dtos; using Volo.Abp.Domain.Entities; @@ -28,13 +29,13 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users public async Task OnGetAsync(Guid id) { - UserInfo = ObjectMapper.Map(await _identityUserAppService.GetAsync(id).ConfigureAwait(false)); + UserInfo = ObjectMapper.Map(await _identityUserAppService.GetAsync(id)); Roles = ObjectMapper.Map, AssignedRoleViewModel[]>( - (await _identityRoleAppService.GetListAsync(new PagedAndSortedResultRequestDto()).ConfigureAwait(false)).Items + (await _identityRoleAppService.GetListAsync(new PagedAndSortedResultRequestDto())).Items ); - var userRoleNames = (await _identityUserAppService.GetRolesAsync(UserInfo.Id).ConfigureAwait(false)).Items.Select(r => r.Name).ToList(); + var userRoleNames = (await _identityUserAppService.GetRolesAsync(UserInfo.Id)).Items.Select(r => r.Name).ToList(); foreach (var role in Roles) { if (userRoleNames.Contains(role.Name)) @@ -50,7 +51,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users var input = ObjectMapper.Map(UserInfo); input.RoleNames = Roles.Where(r => r.IsAssigned).Select(r => r.Name).ToArray(); - await _identityUserAppService.UpdateAsync(UserInfo.Id, input).ConfigureAwait(false); + await _identityUserAppService.UpdateAsync(UserInfo.Id, input); return NoContent(); } @@ -75,6 +76,7 @@ namespace Volo.Abp.Identity.Web.Pages.Identity.Users [StringLength(IdentityUserConsts.MaxPasswordLength)] [DataType(DataType.Password)] + [DisableAuditing] public string Password { get; set; } [Required] diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/index.js b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/index.js index 4d8486d256..64505509ba 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/index.js +++ b/modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/index.js @@ -15,6 +15,7 @@ order: [[1, "asc"]], processing: true, serverSide: true, + scrollX: true, paging: true, ajax: abp.libs.datatables.createAjax(_identityUserAppService.getList), columnDefs: [ diff --git a/modules/identity/src/Volo.Abp.Identity.Web/Volo.Abp.Identity.Web.csproj b/modules/identity/src/Volo.Abp.Identity.Web/Volo.Abp.Identity.Web.csproj index 6a68d21e4b..98cdf702d4 100644 --- a/modules/identity/src/Volo.Abp.Identity.Web/Volo.Abp.Identity.Web.csproj +++ b/modules/identity/src/Volo.Abp.Identity.Web/Volo.Abp.Identity.Web.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/FodyWeavers.xml b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/FodyWeavers.xsd b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo.Abp.PermissionManagement.Domain.Identity.csproj b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo.Abp.PermissionManagement.Domain.Identity.csproj index ea663ba49b..40a310cf2d 100644 --- a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo.Abp.PermissionManagement.Domain.Identity.csproj +++ b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo.Abp.PermissionManagement.Domain.Identity.csproj @@ -1,5 +1,6 @@ - + + @@ -16,6 +17,7 @@ + diff --git a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RolePermissionManagementProvider.cs b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RolePermissionManagementProvider.cs index 2c7920539c..09fb389163 100644 --- a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RolePermissionManagementProvider.cs +++ b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RolePermissionManagementProvider.cs @@ -39,11 +39,11 @@ namespace Volo.Abp.PermissionManagement.Identity if (providerName == UserPermissionValueProvider.ProviderName) { var userId = Guid.Parse(providerKey); - var roleNames = await _userRoleFinder.GetRolesAsync(userId).ConfigureAwait(false); + var roleNames = await _userRoleFinder.GetRolesAsync(userId); foreach (var roleName in roleNames) { - var permissionGrant = await PermissionGrantRepository.FindAsync(name, Name, roleName).ConfigureAwait(false); + var permissionGrant = await PermissionGrantRepository.FindAsync(name, Name, roleName); if (permissionGrant != null) { return new PermissionValueProviderGrantInfo(true, roleName); diff --git a/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleUpdateEventHandler.cs b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleUpdateEventHandler.cs new file mode 100644 index 0000000000..ca2695aaf5 --- /dev/null +++ b/modules/identity/src/Volo.Abp.PermissionManagement.Domain.Identity/Volo/Abp/PermissionManagement/Identity/RoleUpdateEventHandler.cs @@ -0,0 +1,43 @@ +using System.Threading.Tasks; +using Volo.Abp.Authorization.Permissions; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Domain.Entities.Events; +using Volo.Abp.EventBus; +using Volo.Abp.Identity; + +namespace Volo.Abp.PermissionManagement.Identity +{ + public class RoleUpdateEventHandler : + ILocalEventHandler, + ITransientDependency + { + protected IIdentityRoleRepository RoleRepository { get; } + protected IPermissionManager PermissionManager { get; } + protected IPermissionGrantRepository PermissionGrantRepository { get; } + + public RoleUpdateEventHandler( + IIdentityRoleRepository roleRepository, + IPermissionManager permissionManager, + IPermissionGrantRepository permissionGrantRepository) + { + RoleRepository = roleRepository; + PermissionManager = permissionManager; + PermissionGrantRepository = permissionGrantRepository; + } + + public async Task HandleEventAsync(IdentityRoleNameChangedEvent eventData) + { + var role = await RoleRepository.FindAsync(eventData.IdentityRole.Id, false); + if (role == null) + { + return; + } + + var permissionGrantsInRole = await PermissionGrantRepository.GetListAsync(RolePermissionValueProvider.ProviderName, eventData.OldName); + foreach (var permissionGrant in permissionGrantsInRole) + { + await PermissionManager.UpdateProviderKeyAsync(permissionGrant, eventData.IdentityRole.Name); + } + } + } +} diff --git a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo.Abp.Identity.Application.Tests.csproj b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo.Abp.Identity.Application.Tests.csproj index 58a34d0198..b86bcde846 100644 --- a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo.Abp.Identity.Application.Tests.csproj +++ b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo.Abp.Identity.Application.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs index b743ee54e9..663cc07786 100644 --- a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs @@ -23,11 +23,11 @@ namespace Volo.Abp.Identity { //Arrange - var moderator = await GetRoleAsync("moderator").ConfigureAwait(false); + var moderator = await GetRoleAsync("moderator"); //Act - var result = await _roleAppService.GetAsync(moderator.Id).ConfigureAwait(false); + var result = await _roleAppService.GetAsync(moderator.Id); //Assert @@ -39,7 +39,7 @@ namespace Volo.Abp.Identity { //Act - var result = await _roleAppService.GetListAsync(new PagedAndSortedResultRequestDto()).ConfigureAwait(false); + var result = await _roleAppService.GetListAsync(new PagedAndSortedResultRequestDto()); //Assert @@ -58,14 +58,14 @@ namespace Volo.Abp.Identity //Act - var result = await _roleAppService.CreateAsync(input).ConfigureAwait(false); + var result = await _roleAppService.CreateAsync(input); //Assert result.Id.ShouldNotBe(Guid.Empty); result.Name.ShouldBe(input.Name); - var role = await _roleRepository.GetAsync(result.Id).ConfigureAwait(false); + var role = await _roleRepository.GetAsync(result.Id); role.Name.ShouldBe(input.Name); } @@ -74,7 +74,7 @@ namespace Volo.Abp.Identity { //Arrange - var moderator = await GetRoleAsync("moderator").ConfigureAwait(false); + var moderator = await GetRoleAsync("moderator"); var input = new IdentityRoleUpdateDto { @@ -86,14 +86,14 @@ namespace Volo.Abp.Identity //Act - var result = await _roleAppService.UpdateAsync(moderator.Id, input).ConfigureAwait(false); + var result = await _roleAppService.UpdateAsync(moderator.Id, input); //Assert result.Id.ShouldBe(moderator.Id); result.Name.ShouldBe(input.Name); - var updatedRole = await _roleRepository.GetAsync(moderator.Id).ConfigureAwait(false); + var updatedRole = await _roleRepository.GetAsync(moderator.Id); updatedRole.Name.ShouldBe(input.Name); } @@ -102,15 +102,15 @@ namespace Volo.Abp.Identity { //Arrange - var moderator = await GetRoleAsync("moderator").ConfigureAwait(false); + var moderator = await GetRoleAsync("moderator"); //Act - await _roleAppService.DeleteAsync(moderator.Id).ConfigureAwait(false); + await _roleAppService.DeleteAsync(moderator.Id); //Assert - (await FindRoleAsync("moderator").ConfigureAwait(false)).ShouldBeNull(); + (await FindRoleAsync("moderator")).ShouldBeNull(); } private async Task GetRoleAsync(string roleName) diff --git a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs index 19cfb705fd..6fbf23ed73 100644 --- a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.Identity //Act - var result = await _userAppService.GetAsync(johnNash.Id).ConfigureAwait(false); + var result = await _userAppService.GetAsync(johnNash.Id); //Assert @@ -44,7 +44,7 @@ namespace Volo.Abp.Identity { //Act - var result = await _userAppService.GetListAsync(new GetIdentityUsersInput()).ConfigureAwait(false); + var result = await _userAppService.GetListAsync(new GetIdentityUsersInput()); //Assert @@ -69,7 +69,7 @@ namespace Volo.Abp.Identity //Act - var result = await _userAppService.CreateAsync(input).ConfigureAwait(false); + var result = await _userAppService.CreateAsync(input); //Assert @@ -79,7 +79,7 @@ namespace Volo.Abp.Identity result.LockoutEnabled.ShouldBe(input.LockoutEnabled); result.PhoneNumber.ShouldBe(input.PhoneNumber); - var user = await _userRepository.GetAsync(result.Id).ConfigureAwait(false); + var user = await _userRepository.GetAsync(result.Id); user.Id.ShouldBe(result.Id); user.UserName.ShouldBe(input.UserName); user.Email.ShouldBe(input.Email); @@ -110,7 +110,7 @@ namespace Volo.Abp.Identity //Act - var result = await _userAppService.UpdateAsync(johnNash.Id, input).ConfigureAwait(false); + var result = await _userAppService.UpdateAsync(johnNash.Id, input); //Assert @@ -120,7 +120,7 @@ namespace Volo.Abp.Identity result.LockoutEnabled.ShouldBe(input.LockoutEnabled); result.PhoneNumber.ShouldBe(input.PhoneNumber); - var user = await _userRepository.GetAsync(result.Id).ConfigureAwait(false); + var user = await _userRepository.GetAsync(result.Id); user.Id.ShouldBe(result.Id); user.UserName.ShouldBe(input.UserName); user.Email.ShouldBe(input.Email); @@ -134,7 +134,7 @@ namespace Volo.Abp.Identity public async Task UpdateAsync_Concurrency_Exception() { //Get user - var johnNash = await _userAppService.GetAsync(_testData.UserJohnId).ConfigureAwait(false); + var johnNash = await _userAppService.GetAsync(_testData.UserJohnId); //Act @@ -151,13 +151,13 @@ namespace Volo.Abp.Identity ConcurrencyStamp = johnNash.ConcurrencyStamp }; - await _userAppService.UpdateAsync(johnNash.Id, input).ConfigureAwait(false); + await _userAppService.UpdateAsync(johnNash.Id, input); //Second update with same input will throw exception because the entity has been modified (await Assert.ThrowsAsync(async () => { - await _userAppService.UpdateAsync(johnNash.Id, input).ConfigureAwait(false); - }).ConfigureAwait(false)).Message.ShouldContain("Optimistic concurrency failure"); + await _userAppService.UpdateAsync(johnNash.Id, input); + })).Message.ShouldContain("Optimistic concurrency failure"); } [Fact] @@ -169,7 +169,7 @@ namespace Volo.Abp.Identity //Act - await _userAppService.DeleteAsync(johnNash.Id).ConfigureAwait(false); + await _userAppService.DeleteAsync(johnNash.Id); //Assert @@ -185,7 +185,7 @@ namespace Volo.Abp.Identity //Act - var result = await _userAppService.GetRolesAsync(johnNash.Id).ConfigureAwait(false); + var result = await _userAppService.GetRolesAsync(johnNash.Id); //Assert @@ -209,11 +209,11 @@ namespace Volo.Abp.Identity { RoleNames = new[] { "admin", "moderator" } } - ).ConfigureAwait(false); + ); //Assert - var roleNames = await _userRepository.GetRoleNamesAsync(johnNash.Id).ConfigureAwait(false); + var roleNames = await _userRepository.GetRoleNamesAsync(johnNash.Id); roleNames.Count.ShouldBe(2); roleNames.ShouldContain("admin"); roleNames.ShouldContain("moderator"); diff --git a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserLookupAppService_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserLookupAppService_Tests.cs index f28c65be83..227977cf15 100644 --- a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserLookupAppService_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserLookupAppService_Tests.cs @@ -24,32 +24,32 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByIdAsync() { - var user = await _identityUserRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _identityUserRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - (await _identityUserLookupAppService.FindByIdAsync(user.Id).ConfigureAwait(false)).UserName.ShouldBe(user.UserName); + (await _identityUserLookupAppService.FindByIdAsync(user.Id)).UserName.ShouldBe(user.UserName); } [Fact] public async Task FindById_NotExist_Should_Return_Null() { - var user = await _identityUserLookupAppService.FindByIdAsync(Guid.NewGuid()).ConfigureAwait(false); + var user = await _identityUserLookupAppService.FindByIdAsync(Guid.NewGuid()); user.ShouldBeNull(); } [Fact] public async Task FindByUserNameAsync() { - var user = await _identityUserRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _identityUserRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - (await _identityUserLookupAppService.FindByUserNameAsync(user.UserName).ConfigureAwait(false)).UserName.ShouldBe(user.UserName); + (await _identityUserLookupAppService.FindByUserNameAsync(user.UserName)).UserName.ShouldBe(user.UserName); } [Fact] public async Task FindByUserName_NotExist_Should_Return_Null() { - var user = await _identityUserLookupAppService.FindByUserNameAsync(Guid.NewGuid().ToString()).ConfigureAwait(false); + var user = await _identityUserLookupAppService.FindByUserNameAsync(Guid.NewGuid().ToString()); user.ShouldBeNull(); } } diff --git a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/ProfileAppService_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/ProfileAppService_Tests.cs index c6e2d45055..fc0334ce05 100644 --- a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/ProfileAppService_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/ProfileAppService_Tests.cs @@ -34,7 +34,7 @@ namespace Volo.Abp.Identity _currentUser.IsAuthenticated.Returns(true); //Act - var result = await _profileAppService.GetAsync().ConfigureAwait(false); + var result = await _profileAppService.GetAsync(); //Assert var johnNash = GetUser("john.nash"); @@ -62,7 +62,7 @@ namespace Volo.Abp.Identity }; //Act - var result = await _profileAppService.UpdateAsync(input).ConfigureAwait(false); + var result = await _profileAppService.UpdateAsync(input); //Assert result.UserName.ShouldBe(input.UserName); diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo.Abp.Identity.Domain.Tests.csproj b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo.Abp.Identity.Domain.Tests.csproj index 59614115e4..731a1eeab1 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo.Abp.Identity.Domain.Tests.csproj +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo.Abp.Identity.Domain.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/Distributed_User_Change_Event_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/Distributed_User_Change_Event_Tests.cs index e16228290c..95e8f925c4 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/Distributed_User_Change_Event_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/Distributed_User_Change_Event_Tests.cs @@ -40,11 +40,11 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); - await _userManager.SetEmailAsync(user, "john.nash_UPDATED@abp.io").ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); + await _userManager.SetEmailAsync(user, "john.nash_UPDATED@abp.io"); _testCounter.GetValue("EntityUpdatedEto").ShouldBe(0); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } _testCounter.GetValue("EntityUpdatedEto").ShouldBe(1); diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityClaimTypeManager_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityClaimTypeManager_Tests.cs index c7622bec8b..c5c68d40c6 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityClaimTypeManager_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityClaimTypeManager_Tests.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.Identity { var claimType = await _claimTypeManager.CreateAsync(new IdentityClaimType(Guid.NewGuid(), "Phone", false, false, null, - null, null, IdentityClaimValueType.String)).ConfigureAwait(false); + null, null, IdentityClaimValueType.String)); claimType.ShouldNotBeNull(); claimType.Name.ShouldBe("Phone"); @@ -36,17 +36,17 @@ namespace Volo.Abp.Identity { await Assert.ThrowsAnyAsync(async () => await _claimTypeManager.CreateAsync( new IdentityClaimType( - Guid.NewGuid(), "Age")).ConfigureAwait(false)).ConfigureAwait(false); + Guid.NewGuid(), "Age"))); } [Fact] public async Task UpdateAsync() { - var ageClaim = await _identityClaimTypeRepository.FindAsync(_testData.AgeClaimId).ConfigureAwait(false); + var ageClaim = await _identityClaimTypeRepository.FindAsync(_testData.AgeClaimId); ageClaim.ShouldNotBeNull(); ageClaim.Description = "this is age"; - var updatedAgeClaimType = await _claimTypeManager.UpdateAsync(ageClaim).ConfigureAwait(false); + var updatedAgeClaimType = await _claimTypeManager.UpdateAsync(ageClaim); updatedAgeClaimType.ShouldNotBeNull(); updatedAgeClaimType.Description.ShouldBe("this is age"); } @@ -57,7 +57,7 @@ namespace Volo.Abp.Identity { await Assert.ThrowsAnyAsync(async () => await _claimTypeManager.UpdateAsync( new IdentityClaimType( - Guid.NewGuid(), "Age")).ConfigureAwait(false)).ConfigureAwait(false); + Guid.NewGuid(), "Age"))); } @@ -65,9 +65,9 @@ namespace Volo.Abp.Identity public async Task Static_IdentityClaimType_Cant_Not_Update() { var phoneClaim = new IdentityClaimType(Guid.NewGuid(), "Phone", true, true); - await _identityClaimTypeRepository.InsertAsync(phoneClaim).ConfigureAwait(false); + await _identityClaimTypeRepository.InsertAsync(phoneClaim); - await Assert.ThrowsAnyAsync(async () => await _claimTypeManager.UpdateAsync(phoneClaim).ConfigureAwait(false)).ConfigureAwait(false); + await Assert.ThrowsAnyAsync(async () => await _claimTypeManager.UpdateAsync(phoneClaim)); } } } diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleManager_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleManager_Tests.cs index fbb2a3c023..4314f3eac6 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleManager_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleManager_Tests.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetByIdAsync() { - var role = await _identityRoleManager.FindByIdAsync(_testData.RoleModeratorId.ToString()).ConfigureAwait(false); + var role = await _identityRoleManager.FindByIdAsync(_testData.RoleModeratorId.ToString()); role.ShouldNotBeNull(); role.Name.ShouldBe("moderator"); @@ -37,10 +37,10 @@ namespace Volo.Abp.Identity [Fact] public async Task SetRoleNameAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); - (await _identityRoleManager.SetRoleNameAsync(role, "teacher").ConfigureAwait(false)).Succeeded.ShouldBeTrue(); + (await _identityRoleManager.SetRoleNameAsync(role, "teacher")).Succeeded.ShouldBeTrue(); role.Name.ShouldBe("teacher"); } @@ -48,12 +48,12 @@ namespace Volo.Abp.Identity [Fact] public async Task DeleteAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); - await _identityRoleManager.DeleteAsync(role).ConfigureAwait(false); + await _identityRoleManager.DeleteAsync(role); - (await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false)).ShouldBeNull(); + (await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator"))).ShouldBeNull(); } } diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleStore_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleStore_Tests.cs index 9a4d9d194d..11345a4a46 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleStore_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityRoleStore_Tests.cs @@ -32,9 +32,9 @@ namespace Volo.Abp.Identity { var roleId = Guid.NewGuid(); var role = new IdentityRole(roleId, "teacher"); - (await _identityRoleStore.CreateAsync(role).ConfigureAwait(false)).Succeeded.ShouldBeTrue(); + (await _identityRoleStore.CreateAsync(role)).Succeeded.ShouldBeTrue(); - var teacher = await _identityRoleStore.FindByIdAsync(roleId.ToString()).ConfigureAwait(false); + var teacher = await _identityRoleStore.FindByIdAsync(roleId.ToString()); teacher.ShouldNotBeNull(); teacher.Name.ShouldBe("teacher"); @@ -43,11 +43,11 @@ namespace Volo.Abp.Identity [Fact] public async Task UpdateAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); role.IsDefault = true; - await _identityRoleStore.UpdateAsync(role).ConfigureAwait(false); + await _identityRoleStore.UpdateAsync(role); role.IsDefault.ShouldBeTrue(); } @@ -56,40 +56,40 @@ namespace Volo.Abp.Identity [Fact] public async Task DeleteAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); - await _identityRoleStore.DeleteAsync(role).ConfigureAwait(false); + await _identityRoleStore.DeleteAsync(role); - (await _identityRoleStore.FindByIdAsync(_testData.RoleModeratorId.ToString()).ConfigureAwait(false)).ShouldBeNull(); + (await _identityRoleStore.FindByIdAsync(_testData.RoleModeratorId.ToString())).ShouldBeNull(); } [Fact] public async Task GetRoleIdAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); - (await _identityRoleStore.GetRoleIdAsync(role).ConfigureAwait(false)).ShouldBe(_testData.RoleModeratorId.ToString()); + (await _identityRoleStore.GetRoleIdAsync(role)).ShouldBe(_testData.RoleModeratorId.ToString()); } [Fact] public async Task GetRoleNameAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); - (await _identityRoleStore.GetRoleNameAsync(role).ConfigureAwait(false)).ShouldBe(role.Name); + (await _identityRoleStore.GetRoleNameAsync(role)).ShouldBe(role.Name); } [Fact] public async Task SetRoleNameAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); - await _identityRoleStore.SetRoleNameAsync(role, "teacher").ConfigureAwait(false); + await _identityRoleStore.SetRoleNameAsync(role, "teacher"); role.Name.ShouldBe("teacher"); } @@ -97,7 +97,7 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByIdAsync() { - var role = await _identityRoleStore.FindByIdAsync(_testData.RoleModeratorId.ToString()).ConfigureAwait(false); + var role = await _identityRoleStore.FindByIdAsync(_testData.RoleModeratorId.ToString()); role.ShouldNotBeNull(); role.Name.ShouldBe("moderator"); @@ -106,7 +106,7 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByNameAsync() { - var role = await _identityRoleStore.FindByNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); + var role = await _identityRoleStore.FindByNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); role.Name.ShouldBe("moderator"); @@ -115,19 +115,19 @@ namespace Volo.Abp.Identity [Fact] public async Task GetNormalizedRoleNameAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); - (await _identityRoleStore.GetNormalizedRoleNameAsync(role).ConfigureAwait(false)).ShouldBe(role.NormalizedName); + (await _identityRoleStore.GetNormalizedRoleNameAsync(role)).ShouldBe(role.NormalizedName); } [Fact] public async Task SetNormalizedRoleNameAsync() { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); - await _identityRoleStore.SetNormalizedRoleNameAsync(role, _lookupNormalizer.NormalizeName("teacher")).ConfigureAwait(false); + await _identityRoleStore.SetNormalizedRoleNameAsync(role, _lookupNormalizer.NormalizeName("teacher")); role.NormalizedName.ShouldBe(_lookupNormalizer.NormalizeName("teacher")); } @@ -137,15 +137,15 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); - var claims = await _identityRoleStore.GetClaimsAsync(role).ConfigureAwait(false); + var claims = await _identityRoleStore.GetClaimsAsync(role); claims.ShouldNotBeEmpty(); claims.ShouldContain(x => x.Type == "test-claim" && x.Value == "test-value"); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } @@ -156,7 +156,7 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); role.Claims.Add(new IdentityRoleClaim(Guid.NewGuid(), role.Id, "my-claim", "my-value", role.TenantId)); @@ -164,7 +164,7 @@ namespace Volo.Abp.Identity //role.Claims.ShouldContain(x => x.ClaimType == "my-claim" && x.ClaimValue == "my-value"); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } @@ -173,7 +173,7 @@ namespace Volo.Abp.Identity throw; } - var role2 = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); + var role2 = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role2.ShouldNotBeNull(); role2.Claims.ShouldContain(x => x.ClaimType == "my-claim" && x.ClaimValue == "my-value"); } @@ -183,14 +183,14 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); + var role = await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("moderator")); role.ShouldNotBeNull(); - await _identityRoleStore.RemoveClaimAsync(role, new Claim("test-claim", "test-value")).ConfigureAwait(false); + await _identityRoleStore.RemoveClaimAsync(role, new Claim("test-claim", "test-value")); role.Claims.ShouldNotContain(x => x.ClaimType == "test-claim" && x.ClaimValue == "test-value"); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } } diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs index 444e6e26e1..bab2d42ece 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserManager_Tests.cs @@ -35,7 +35,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetByIdAsync() { - var user = await _identityUserManager.GetByIdAsync(_testData.UserJohnId).ConfigureAwait(false); + var user = await _identityUserManager.GetByIdAsync(_testData.UserJohnId); user.ShouldNotBeNull(); user.UserName.ShouldBe("john.nash"); @@ -47,18 +47,18 @@ namespace Volo.Abp.Identity using (var uow = _unitOfWorkManager.Begin()) { var user = await _identityUserRepository.FindByNormalizedUserNameAsync( - _lookupNormalizer.NormalizeName("david")).ConfigureAwait(false); + _lookupNormalizer.NormalizeName("david")); user.ShouldNotBeNull(); var identityResult = await _identityUserManager.SetRolesAsync(user, new List() { "moderator", - }).ConfigureAwait(false); + }); identityResult.Succeeded.ShouldBeTrue(); user.Roles.ShouldContain(x => x.RoleId == _testData.RoleModeratorId); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } @@ -68,23 +68,23 @@ namespace Volo.Abp.Identity using (var uow = _unitOfWorkManager.Begin()) { var roleSupporter = - await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("supporter")).ConfigureAwait(false); + await _identityRoleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("supporter")); roleSupporter.ShouldNotBeNull(); var user = await _identityUserRepository.FindByNormalizedUserNameAsync( - _lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + _lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); var identityResult = await _identityUserManager.SetRolesAsync(user, new List() { "admin", - }).ConfigureAwait(false); + }); identityResult.Succeeded.ShouldBeTrue(); user.Roles.ShouldNotContain(x => x.RoleId == _testData.RoleModeratorId); user.Roles.ShouldNotContain(x => x.RoleId == roleSupporter.Id); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserStore_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserStore_Tests.cs index 6c7b6610ae..6e84a88450 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserStore_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/IdentityUserStore_Tests.cs @@ -29,29 +29,29 @@ namespace Volo.Abp.Identity [Fact] public async Task GetUserIdAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - (await _identityUserStore.GetUserIdAsync(user).ConfigureAwait(false)).ShouldBe(user.Id.ToString()); + (await _identityUserStore.GetUserIdAsync(user)).ShouldBe(user.Id.ToString()); } [Fact] public async Task GetUserNameAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - (await _identityUserStore.GetUserNameAsync(user).ConfigureAwait(false)).ShouldBe(user.UserName); + (await _identityUserStore.GetUserNameAsync(user)).ShouldBe(user.UserName); } [Fact] public async Task SetUserNameAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - await _identityUserStore.SetUserNameAsync(user, "bob.lee").ConfigureAwait(false); + await _identityUserStore.SetUserNameAsync(user, "bob.lee"); user.UserName.ShouldBe("bob.lee"); //user.NormalizedUserName.ShouldBe(_lookupNormalizer.Normalize("bob.lee")); } @@ -60,19 +60,19 @@ namespace Volo.Abp.Identity [Fact] public async Task GetNormalizedUserNameAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - (await _identityUserStore.GetNormalizedUserNameAsync(user).ConfigureAwait(false)).ShouldBe(user.NormalizedUserName); + (await _identityUserStore.GetNormalizedUserNameAsync(user)).ShouldBe(user.NormalizedUserName); } [Fact] public async Task SetNormalizedUserNameAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - await _identityUserStore.SetNormalizedUserNameAsync(user, _lookupNormalizer.NormalizeName("bob.lee")).ConfigureAwait(false); + await _identityUserStore.SetNormalizedUserNameAsync(user, _lookupNormalizer.NormalizeName("bob.lee")); user.NormalizedUserName.ShouldBe(_lookupNormalizer.NormalizeName("bob.lee")); } @@ -83,9 +83,9 @@ namespace Volo.Abp.Identity var userId = Guid.NewGuid(); var user = new IdentityUser(userId, "bob.lee", "bob.lee@abp.io"); - await _identityUserStore.CreateAsync(user).ConfigureAwait(false); + await _identityUserStore.CreateAsync(user); - var bobLee = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("bob.lee")).ConfigureAwait(false); + var bobLee = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("bob.lee")); bobLee.ShouldNotBeNull(); bobLee.UserName.ShouldBe("bob.lee"); bobLee.Email.ShouldBe("bob.lee@abp.io"); @@ -94,26 +94,26 @@ namespace Volo.Abp.Identity [Fact] public async Task UpdateAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); user.Name = "lee"; - (await _identityUserStore.UpdateAsync(user).ConfigureAwait(false)).Succeeded.ShouldBeTrue(); + (await _identityUserStore.UpdateAsync(user)).Succeeded.ShouldBeTrue(); - (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false)).Name + (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash"))).Name .ShouldBe("lee"); } [Fact] public async Task Update_Concurrency() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - (await _identityUserStore.UpdateAsync(user).ConfigureAwait(false)).Succeeded.ShouldBeTrue(); + (await _identityUserStore.UpdateAsync(user)).Succeeded.ShouldBeTrue(); user.ConcurrencyStamp = Guid.NewGuid().ToString(); - var identityResult = await _identityUserStore.UpdateAsync(user).ConfigureAwait(false); + var identityResult = await _identityUserStore.UpdateAsync(user); identityResult.Succeeded.ShouldBeFalse(); identityResult.Errors.ShouldContain(x => @@ -126,19 +126,19 @@ namespace Volo.Abp.Identity [Fact] public async Task DeleteAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - (await _identityUserStore.DeleteAsync(user).ConfigureAwait(false)).Succeeded.ShouldBeTrue(); + (await _identityUserStore.DeleteAsync(user)).Succeeded.ShouldBeTrue(); - (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false)).ShouldBeNull(); + (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash"))).ShouldBeNull(); } [Fact] public async Task FindByIdAsync() { - var user = await _identityUserStore.FindByIdAsync(_testData.UserJohnId.ToString()).ConfigureAwait(false); + var user = await _identityUserStore.FindByIdAsync(_testData.UserJohnId.ToString()); user.ShouldNotBeNull(); user.UserName.ShouldBe("john.nash"); @@ -148,7 +148,7 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByNameAsync() { - var user = await _identityUserStore.FindByNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _identityUserStore.FindByNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); user.UserName.ShouldBe("john.nash"); @@ -158,11 +158,11 @@ namespace Volo.Abp.Identity [Fact] public async Task SetPasswordHashAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); user.PasswordHash.ShouldBeNull(); - await _identityUserStore.SetPasswordHashAsync(user, "P@ssw0rd").ConfigureAwait(false); + await _identityUserStore.SetPasswordHashAsync(user, "P@ssw0rd"); user.PasswordHash.ShouldBe("P@ssw0rd"); } @@ -170,23 +170,23 @@ namespace Volo.Abp.Identity [Fact] public async Task GetPasswordHashAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - await _identityUserStore.SetPasswordHashAsync(user, "P@ssw0rd").ConfigureAwait(false); + await _identityUserStore.SetPasswordHashAsync(user, "P@ssw0rd"); - (await _identityUserStore.GetPasswordHashAsync(user).ConfigureAwait(false)).ShouldBe("P@ssw0rd"); + (await _identityUserStore.GetPasswordHashAsync(user)).ShouldBe("P@ssw0rd"); } [Fact] public async Task HasPasswordAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - (await _identityUserStore.HasPasswordAsync(user).ConfigureAwait(false)).ShouldBeFalse(); + (await _identityUserStore.HasPasswordAsync(user)).ShouldBeFalse(); - await _identityUserStore.SetPasswordHashAsync(user, "P@ssw0rd").ConfigureAwait(false); - (await _identityUserStore.HasPasswordAsync(user).ConfigureAwait(false)).ShouldBeTrue(); + await _identityUserStore.SetPasswordHashAsync(user, "P@ssw0rd"); + (await _identityUserStore.HasPasswordAsync(user)).ShouldBeTrue(); } [Fact] @@ -194,15 +194,15 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("david")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("david")); user.ShouldNotBeNull(); user.Roles.ShouldBeEmpty(); - await _identityUserStore.AddToRoleAsync(user, _lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); + await _identityUserStore.AddToRoleAsync(user, _lookupNormalizer.NormalizeName("moderator")); user.Roles.ShouldContain(x => x.RoleId == _testData.RoleModeratorId); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } @@ -211,15 +211,15 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); user.Roles.ShouldContain(x => x.RoleId == _testData.RoleModeratorId); - await _identityUserStore.RemoveFromRoleAsync(user, _lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); + await _identityUserStore.RemoveFromRoleAsync(user, _lookupNormalizer.NormalizeName("moderator")); user.Roles.ShouldNotContain(x => x.RoleId == _testData.RoleModeratorId); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } @@ -227,10 +227,10 @@ namespace Volo.Abp.Identity [Fact] public async Task GetRolesAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - var roleNames = await _identityUserStore.GetRolesAsync(user).ConfigureAwait(false); + var roleNames = await _identityUserStore.GetRolesAsync(user); roleNames.ShouldNotBeEmpty(); roleNames.ShouldContain(x => x == "moderator"); roleNames.ShouldContain(x => x == "supporter"); @@ -241,13 +241,13 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - (await _identityUserStore.IsInRoleAsync(user, _lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false)).ShouldBeTrue(); - (await _identityUserStore.IsInRoleAsync(user, _lookupNormalizer.NormalizeName("moderatorNotExist")).ConfigureAwait(false)).ShouldBeFalse(); + (await _identityUserStore.IsInRoleAsync(user, _lookupNormalizer.NormalizeName("moderator"))).ShouldBeTrue(); + (await _identityUserStore.IsInRoleAsync(user, _lookupNormalizer.NormalizeName("moderatorNotExist"))).ShouldBeFalse(); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } @@ -256,14 +256,14 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - var claims = await _identityUserStore.GetClaimsAsync(user).ConfigureAwait(false); + var claims = await _identityUserStore.GetClaimsAsync(user); claims.ShouldNotBeEmpty(); claims.ShouldContain(x => x.Type == "TestClaimType" && x.Value == "42"); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } @@ -272,18 +272,18 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); user.Claims.ShouldNotContain(x => x.ClaimType == "MyClaimType" && x.ClaimValue == "MyClaimValue"); await _identityUserStore.AddClaimsAsync(user, new List() { new Claim("MyClaimType", "MyClaimValue") - }).ConfigureAwait(false); + }); user.Claims.ShouldContain(x => x.ClaimType == "MyClaimType" && x.ClaimValue == "MyClaimValue"); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } @@ -292,15 +292,15 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - await _identityUserStore.ReplaceClaimAsync(user, new Claim("TestClaimType", "42"), new Claim("MyClaimType", "MyClaimValue")).ConfigureAwait(false); + await _identityUserStore.ReplaceClaimAsync(user, new Claim("TestClaimType", "42"), new Claim("MyClaimType", "MyClaimValue")); user.Claims.ShouldNotContain(x => x.ClaimType == "TestClaimType" && x.ClaimValue == "42"); user.Claims.ShouldContain(x => x.ClaimType == "MyClaimType" && x.ClaimValue == "MyClaimValue"); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } @@ -309,17 +309,17 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); await _identityUserStore.RemoveClaimsAsync(user, new List() { new Claim("TestClaimType", "42") - }).ConfigureAwait(false); + }); user.Claims.ShouldNotContain(x => x.ClaimType == "TestClaimType" && x.ClaimValue == "42"); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } @@ -328,15 +328,15 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); user.Logins.ShouldNotContain(x => x.LoginProvider == "facebook" && x.ProviderKey == "john"); - await _identityUserStore.AddLoginAsync(user, new UserLoginInfo("facebook", "john", "John Nash")).ConfigureAwait(false); + await _identityUserStore.AddLoginAsync(user, new UserLoginInfo("facebook", "john", "John Nash")); user.Logins.ShouldContain(x => x.LoginProvider == "facebook" && x.ProviderKey == "john"); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } @@ -345,15 +345,15 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); user.Logins.ShouldContain(x => x.LoginProvider == "github" && x.ProviderKey == "john"); - await _identityUserStore.RemoveLoginAsync(user, "github", "john").ConfigureAwait(false); + await _identityUserStore.RemoveLoginAsync(user, "github", "john"); user.Logins.ShouldNotContain(x => x.LoginProvider == "github" && x.ProviderKey == "john"); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } @@ -363,16 +363,16 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - var logins = await _identityUserStore.GetLoginsAsync(user).ConfigureAwait(false); + var logins = await _identityUserStore.GetLoginsAsync(user); logins.ShouldNotBeNull(); logins.ShouldContain(x => x.LoginProvider == "github" && x.ProviderKey == "john"); logins.ShouldContain(x => x.LoginProvider == "twitter" && x.ProviderKey == "johnx"); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } @@ -380,7 +380,7 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByLoginAsync() { - var user = await _identityUserStore.FindByLoginAsync("github", "john").ConfigureAwait(false); + var user = await _identityUserStore.FindByLoginAsync("github", "john"); user.ShouldNotBeNull(); user.UserName.ShouldBe("john.nash"); } @@ -389,21 +389,21 @@ namespace Volo.Abp.Identity [Fact] public async Task GetEmailConfirmedAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - (await _identityUserStore.GetEmailConfirmedAsync(user).ConfigureAwait(false)).ShouldBe(user.EmailConfirmed); + (await _identityUserStore.GetEmailConfirmedAsync(user)).ShouldBe(user.EmailConfirmed); } [Fact] public async Task SetEmailConfirmedAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); var emailConfirmed = user.EmailConfirmed; - await _identityUserStore.SetEmailConfirmedAsync(user, !emailConfirmed).ConfigureAwait(false); + await _identityUserStore.SetEmailConfirmedAsync(user, !emailConfirmed); user.EmailConfirmed.ShouldBe(!emailConfirmed); } @@ -411,10 +411,10 @@ namespace Volo.Abp.Identity [Fact] public async Task SetEmailAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - await _identityUserStore.SetEmailAsync(user, "john.nash.kobe@abp.io").ConfigureAwait(false); + await _identityUserStore.SetEmailAsync(user, "john.nash.kobe@abp.io"); user.Email.ShouldBe("john.nash.kobe@abp.io"); //user.NormalizedEmail.ShouldBe(_lookupNormalizer.Normalize("john.nash.kobe@abp.io")); @@ -423,28 +423,28 @@ namespace Volo.Abp.Identity [Fact] public async Task GetEmailAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - (await _identityUserStore.GetEmailAsync(user).ConfigureAwait(false)).ShouldBe(user.Email); + (await _identityUserStore.GetEmailAsync(user)).ShouldBe(user.Email); } [Fact] public async Task GetNormalizedEmailAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - (await _identityUserStore.GetNormalizedEmailAsync(user).ConfigureAwait(false)).ShouldBe(user.NormalizedEmail); + (await _identityUserStore.GetNormalizedEmailAsync(user)).ShouldBe(user.NormalizedEmail); } [Fact] public async Task SetNormalizedEmailAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - await _identityUserStore.SetNormalizedEmailAsync(user, _lookupNormalizer.NormalizeEmail("john.nash.kobe@abp.io")).ConfigureAwait(false); + await _identityUserStore.SetNormalizedEmailAsync(user, _lookupNormalizer.NormalizeEmail("john.nash.kobe@abp.io")); user.NormalizedEmail.ShouldBe(_lookupNormalizer.NormalizeEmail("john.nash.kobe@abp.io")); } @@ -452,7 +452,7 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByEmailAsync() { - var user = await _identityUserStore.FindByEmailAsync(_lookupNormalizer.NormalizeEmail("john.nash@abp.io")).ConfigureAwait(false); + var user = await _identityUserStore.FindByEmailAsync(_lookupNormalizer.NormalizeEmail("john.nash@abp.io")); user.ShouldNotBeNull(); user.Email.ShouldBe("john.nash@abp.io"); @@ -461,19 +461,19 @@ namespace Volo.Abp.Identity [Fact] public async Task GetLockoutEndDateAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - (await _identityUserStore.GetLockoutEndDateAsync(user).ConfigureAwait(false)).ShouldBe(user.LockoutEnd); + (await _identityUserStore.GetLockoutEndDateAsync(user)).ShouldBe(user.LockoutEnd); } [Fact] public async Task SetLockoutEndDateAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - await _identityUserStore.SetLockoutEndDateAsync(user, DateTimeOffset.Parse("01/01/2019")).ConfigureAwait(false); + await _identityUserStore.SetLockoutEndDateAsync(user, DateTimeOffset.Parse("01/01/2019")); user.LockoutEnd.ShouldBe(DateTimeOffset.Parse("01/01/2019")); } @@ -482,11 +482,11 @@ namespace Volo.Abp.Identity [Fact] public async Task IncrementAccessFailedCountAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); var count = user.AccessFailedCount; - await _identityUserStore.IncrementAccessFailedCountAsync(user).ConfigureAwait(false); + await _identityUserStore.IncrementAccessFailedCountAsync(user); user.AccessFailedCount.ShouldBe(count + 1); } @@ -494,10 +494,10 @@ namespace Volo.Abp.Identity [Fact] public async Task ResetAccessFailedCountAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - await _identityUserStore.ResetAccessFailedCountAsync(user).ConfigureAwait(false); + await _identityUserStore.ResetAccessFailedCountAsync(user); user.AccessFailedCount.ShouldBe(0); } @@ -505,29 +505,29 @@ namespace Volo.Abp.Identity [Fact] public async Task GetAccessFailedCountAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - (await _identityUserStore.GetAccessFailedCountAsync(user).ConfigureAwait(false)).ShouldBe(user.AccessFailedCount); + (await _identityUserStore.GetAccessFailedCountAsync(user)).ShouldBe(user.AccessFailedCount); } [Fact] public async Task GetLockoutEnabledAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - (await _identityUserStore.GetLockoutEnabledAsync(user).ConfigureAwait(false)).ShouldBe(user.LockoutEnabled); + (await _identityUserStore.GetLockoutEnabledAsync(user)).ShouldBe(user.LockoutEnabled); } [Fact] public async Task SetLockoutEnabledAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); var lockoutEnabled = user.LockoutEnabled; - await _identityUserStore.SetLockoutEnabledAsync(user, !lockoutEnabled).ConfigureAwait(false); + await _identityUserStore.SetLockoutEnabledAsync(user, !lockoutEnabled); user.LockoutEnabled.ShouldBe(!lockoutEnabled); } @@ -536,10 +536,10 @@ namespace Volo.Abp.Identity [Fact] public async Task SetPhoneNumberAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - await _identityUserStore.SetPhoneNumberAsync(user, "13800138000").ConfigureAwait(false); + await _identityUserStore.SetPhoneNumberAsync(user, "13800138000"); user.PhoneNumber.ShouldBe("13800138000"); } @@ -548,30 +548,30 @@ namespace Volo.Abp.Identity [Fact] public async Task GetPhoneNumberAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - (await _identityUserStore.GetPhoneNumberAsync(user).ConfigureAwait(false)).ShouldBe(user.PhoneNumber); + (await _identityUserStore.GetPhoneNumberAsync(user)).ShouldBe(user.PhoneNumber); } [Fact] public async Task GetPhoneNumberConfirmedAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - (await _identityUserStore.GetPhoneNumberConfirmedAsync(user).ConfigureAwait(false)).ShouldBe(user.PhoneNumberConfirmed); + (await _identityUserStore.GetPhoneNumberConfirmedAsync(user)).ShouldBe(user.PhoneNumberConfirmed); } [Fact] public async Task SetPhoneNumberConfirmedAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); var phoneNumberConfirmed = user.PhoneNumberConfirmed; - await _identityUserStore.SetPhoneNumberConfirmedAsync(user, !phoneNumberConfirmed).ConfigureAwait(false); + await _identityUserStore.SetPhoneNumberConfirmedAsync(user, !phoneNumberConfirmed); user.PhoneNumberConfirmed.ShouldBe(!phoneNumberConfirmed); } @@ -580,11 +580,11 @@ namespace Volo.Abp.Identity [Fact] public async Task SetSecurityStampAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); var securityStamp = Guid.NewGuid().ToString(); - await _identityUserStore.SetSecurityStampAsync(user, securityStamp).ConfigureAwait(false); + await _identityUserStore.SetSecurityStampAsync(user, securityStamp); user.SecurityStamp.ShouldBe(securityStamp); } @@ -592,21 +592,21 @@ namespace Volo.Abp.Identity [Fact] public async Task GetSecurityStampAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - (await _identityUserStore.GetSecurityStampAsync(user).ConfigureAwait(false)).ShouldBe(user.SecurityStamp); + (await _identityUserStore.GetSecurityStampAsync(user)).ShouldBe(user.SecurityStamp); } [Fact] public async Task SetTwoFactorEnabledAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); var twoFactorEnabled = user.TwoFactorEnabled; - await _identityUserStore.SetTwoFactorEnabledAsync(user, !twoFactorEnabled).ConfigureAwait(false); + await _identityUserStore.SetTwoFactorEnabledAsync(user, !twoFactorEnabled); user.TwoFactorEnabled.ShouldBe(!twoFactorEnabled); } @@ -615,16 +615,16 @@ namespace Volo.Abp.Identity [Fact] public async Task GetTwoFactorEnabledAsync() { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - (await _identityUserStore.GetTwoFactorEnabledAsync(user).ConfigureAwait(false)).ShouldBe(user.TwoFactorEnabled); + (await _identityUserStore.GetTwoFactorEnabledAsync(user)).ShouldBe(user.TwoFactorEnabled); } [Fact] public async Task GetUsersForClaimAsync() { - var user = await _identityUserStore.GetUsersForClaimAsync(new Claim("TestClaimType", "42")).ConfigureAwait(false); + var user = await _identityUserStore.GetUsersForClaimAsync(new Claim("TestClaimType", "42")); user.ShouldNotBeNull(); user.ShouldNotBeEmpty(); user.ShouldContain(x => x.UserName == "john.nash"); @@ -633,7 +633,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetUsersInRoleAsync() { - var user = await _identityUserStore.GetUsersInRoleAsync(_lookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); + var user = await _identityUserStore.GetUsersInRoleAsync(_lookupNormalizer.NormalizeName("moderator")); user.ShouldNotBeNull(); user.ShouldContain(x => x.UserName == "john.nash"); } @@ -643,15 +643,15 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - await _identityUserStore.SetTokenAsync(user, "test-provider", "test-name", "123123").ConfigureAwait(false); + await _identityUserStore.SetTokenAsync(user, "test-provider", "test-name", "123123"); user.Tokens.ShouldNotBeEmpty(); user.Tokens.ShouldContain(x => x.LoginProvider == "test-provider" && x.Name == "test-name" && x.Value == "123123"); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } @@ -660,14 +660,14 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - await _identityUserStore.RemoveTokenAsync(user, "test-provider", "test-name").ConfigureAwait(false); + await _identityUserStore.RemoveTokenAsync(user, "test-provider", "test-name"); user.Tokens.ShouldNotContain(x => x.LoginProvider == "test-provider" && x.Name == "test-name" && x.Value == "123123"); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } @@ -676,12 +676,12 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - (await _identityUserStore.GetTokenAsync(user, "test-provider", "test-name").ConfigureAwait(false)).ShouldBe("test-value"); + (await _identityUserStore.GetTokenAsync(user, "test-provider", "test-name")).ShouldBe("test-value"); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } @@ -690,14 +690,14 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - await _identityUserStore.SetAuthenticatorKeyAsync(user, "testKey").ConfigureAwait(false); + await _identityUserStore.SetAuthenticatorKeyAsync(user, "testKey"); user.Tokens.ShouldContain(x => x.LoginProvider == "[AspNetUserStore]" && x.Name == "AuthenticatorKey" && x.Value == "testKey"); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } @@ -706,13 +706,13 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - await _identityUserStore.SetAuthenticatorKeyAsync(user, "testKey").ConfigureAwait(false); + await _identityUserStore.SetAuthenticatorKeyAsync(user, "testKey"); - (await _identityUserStore.GetAuthenticatorKeyAsync(user).ConfigureAwait(false)).ShouldBe("testKey"); + (await _identityUserStore.GetAuthenticatorKeyAsync(user)).ShouldBe("testKey"); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } @@ -722,13 +722,13 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - await _identityUserStore.SetTokenAsync(user, "[AspNetUserStore]", "RecoveryCodes", "testKey;testKey2").ConfigureAwait(false); + await _identityUserStore.SetTokenAsync(user, "[AspNetUserStore]", "RecoveryCodes", "testKey;testKey2"); - (await _identityUserStore.CountCodesAsync(user).ConfigureAwait(false)).ShouldBe(2); + (await _identityUserStore.CountCodesAsync(user)).ShouldBe(2); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } @@ -737,18 +737,18 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); await _identityUserStore.ReplaceCodesAsync(user, new List() { "testKey", "testKey2" - }).ConfigureAwait(false); + }); user.Tokens.ShouldContain(x => x.LoginProvider == "[AspNetUserStore]" && x.Name == "RecoveryCodes" && x.Value == "testKey;testKey2"); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } @@ -757,13 +757,13 @@ namespace Volo.Abp.Identity { using (var uow = _unitOfWorkManager.Begin()) { - var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var user = await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("john.nash")); user.ShouldNotBeNull(); - await _identityUserStore.SetTokenAsync(user, "[AspNetUserStore]", "RecoveryCodes", "testKey;testKey2").ConfigureAwait(false); + await _identityUserStore.SetTokenAsync(user, "[AspNetUserStore]", "RecoveryCodes", "testKey;testKey2"); - (await _identityUserStore.RedeemCodeAsync(user, "testKey").ConfigureAwait(false)).ShouldBeTrue(); + (await _identityUserStore.RedeemCodeAsync(user, "testKey")).ShouldBeTrue(); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } } diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/PermissionManager_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/PermissionManager_Tests.cs index a098ba92c6..621cb4621f 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/PermissionManager_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/PermissionManager_Tests.cs @@ -24,19 +24,19 @@ namespace Volo.Abp.Identity public async Task Roles_Should_Have_Configured_Permissions() { //admin - var grantInfos = await _permissionManager.GetAllForRoleAsync("admin").ConfigureAwait(false); + var grantInfos = await _permissionManager.GetAllForRoleAsync("admin"); RoleShouldHavePermission(grantInfos, "admin", TestPermissionNames.MyPermission1); RoleShouldHavePermission(grantInfos, "admin", TestPermissionNames.MyPermission2); RoleShouldHavePermission(grantInfos, "admin", TestPermissionNames.MyPermission2_ChildPermission1); //moderator - grantInfos = await _permissionManager.GetAllForRoleAsync("moderator").ConfigureAwait(false); + grantInfos = await _permissionManager.GetAllForRoleAsync("moderator"); RoleShouldHavePermission(grantInfos, "moderator", TestPermissionNames.MyPermission1); RoleShouldHavePermission(grantInfos, "moderator", TestPermissionNames.MyPermission2); ShouldNotHavePermission(grantInfos, TestPermissionNames.MyPermission2_ChildPermission1); //supporter - grantInfos = await _permissionManager.GetAllForRoleAsync("supporter").ConfigureAwait(false); + grantInfos = await _permissionManager.GetAllForRoleAsync("supporter"); RoleShouldHavePermission(grantInfos, "supporter", TestPermissionNames.MyPermission1); ShouldNotHavePermission(grantInfos, TestPermissionNames.MyPermission2); ShouldNotHavePermission(grantInfos, TestPermissionNames.MyPermission2_ChildPermission1); @@ -45,21 +45,21 @@ namespace Volo.Abp.Identity [Fact] public async Task Should_Grant_Permission_To_Role() { - (await _permissionManager.GetForRoleAsync("supporter", TestPermissionNames.MyPermission2).ConfigureAwait(false)).IsGranted.ShouldBeFalse(); - (await _permissionStore.IsGrantedAsync(TestPermissionNames.MyPermission2, RolePermissionValueProvider.ProviderName, "supporter").ConfigureAwait(false)).ShouldBeFalse(); + (await _permissionManager.GetForRoleAsync("supporter", TestPermissionNames.MyPermission2)).IsGranted.ShouldBeFalse(); + (await _permissionStore.IsGrantedAsync(TestPermissionNames.MyPermission2, RolePermissionValueProvider.ProviderName, "supporter")).ShouldBeFalse(); - await _permissionManager.SetForRoleAsync("supporter", TestPermissionNames.MyPermission2, true).ConfigureAwait(false); + await _permissionManager.SetForRoleAsync("supporter", TestPermissionNames.MyPermission2, true); - (await _permissionManager.GetForRoleAsync("supporter", TestPermissionNames.MyPermission2).ConfigureAwait(false)).IsGranted.ShouldBeTrue(); - (await _permissionStore.IsGrantedAsync(TestPermissionNames.MyPermission2, RolePermissionValueProvider.ProviderName, "supporter").ConfigureAwait(false)).ShouldBeTrue(); + (await _permissionManager.GetForRoleAsync("supporter", TestPermissionNames.MyPermission2)).IsGranted.ShouldBeTrue(); + (await _permissionStore.IsGrantedAsync(TestPermissionNames.MyPermission2, RolePermissionValueProvider.ProviderName, "supporter")).ShouldBeTrue(); } [Fact] public async Task Should_Revoke_Permission_From_Role() { - (await _permissionManager.GetForRoleAsync("moderator", TestPermissionNames.MyPermission1).ConfigureAwait(false)).IsGranted.ShouldBeTrue(); - await _permissionManager.SetForRoleAsync("moderator", TestPermissionNames.MyPermission1, false).ConfigureAwait(false); - (await _permissionManager.GetForRoleAsync("moderator", TestPermissionNames.MyPermission1).ConfigureAwait(false)).IsGranted.ShouldBeFalse(); + (await _permissionManager.GetForRoleAsync("moderator", TestPermissionNames.MyPermission1)).IsGranted.ShouldBeTrue(); + await _permissionManager.SetForRoleAsync("moderator", TestPermissionNames.MyPermission1, false); + (await _permissionManager.GetForRoleAsync("moderator", TestPermissionNames.MyPermission1)).IsGranted.ShouldBeFalse(); } [Fact] @@ -67,21 +67,21 @@ namespace Volo.Abp.Identity { //administrator var user = GetUser("administrator"); - var grantInfos = await _permissionManager.GetAllForUserAsync(user.Id).ConfigureAwait(false); + var grantInfos = await _permissionManager.GetAllForUserAsync(user.Id); UserShouldHavePermission(grantInfos, user.Id, TestPermissionNames.MyPermission1, "admin"); UserShouldHavePermission(grantInfos, user.Id, TestPermissionNames.MyPermission2, "admin"); UserShouldHavePermission(grantInfos, user.Id, TestPermissionNames.MyPermission2_ChildPermission1, "admin"); //john.nash user = GetUser("john.nash"); - grantInfos = await _permissionManager.GetAllForUserAsync(user.Id).ConfigureAwait(false); + grantInfos = await _permissionManager.GetAllForUserAsync(user.Id); UserShouldHavePermission(grantInfos, user.Id, TestPermissionNames.MyPermission1, "moderator", "supporter"); UserShouldHavePermission(grantInfos, user.Id, TestPermissionNames.MyPermission2, "moderator"); ShouldNotHavePermission(grantInfos, TestPermissionNames.MyPermission2_ChildPermission1); //john.nash user = GetUser("david"); - grantInfos = await _permissionManager.GetAllForUserAsync(user.Id).ConfigureAwait(false); + grantInfos = await _permissionManager.GetAllForUserAsync(user.Id); UserShouldHavePermission(grantInfos, user.Id, TestPermissionNames.MyPermission1); ShouldNotHavePermission(grantInfos, TestPermissionNames.MyPermission2); ShouldNotHavePermission(grantInfos, TestPermissionNames.MyPermission2_ChildPermission1); diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/RoleChangingEvents_Test.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/RoleChangingEvents_Test.cs new file mode 100644 index 0000000000..c3c24a29cc --- /dev/null +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/RoleChangingEvents_Test.cs @@ -0,0 +1,58 @@ +using Microsoft.AspNetCore.Identity; +using Shouldly; +using System.Threading.Tasks; +using Volo.Abp.EventBus.Distributed; +using Volo.Abp.Guids; +using Volo.Abp.PermissionManagement; +using Volo.Abp.Uow; +using Xunit; + +namespace Volo.Abp.Identity +{ + public class RoleChangingEvents_Test : AbpIdentityDomainTestBase + { + protected readonly IIdentityRoleRepository RoleRepository; + protected readonly IPermissionGrantRepository PermissionGrantRepository; + protected readonly IdentityRoleManager RoleManager; + protected readonly ILookupNormalizer LookupNormalizer; + protected readonly IGuidGenerator GuidGenerator; + protected readonly IUnitOfWorkManager UowManager; + + public RoleChangingEvents_Test() + { + RoleRepository = GetRequiredService(); ; + PermissionGrantRepository = GetRequiredService(); ; + RoleManager = GetRequiredService(); ; + LookupNormalizer = GetRequiredService(); ; + GuidGenerator = GetRequiredService(); + UowManager = GetRequiredService(); + } + + [Fact] + public async Task Role_Update_Event_Test() + { + var role = await RoleRepository + .FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("moderator")) + ; + + var permissionGrantsInRole = await PermissionGrantRepository.GetListAsync("R", role.Name); + permissionGrantsInRole.ShouldNotBeNull(); + permissionGrantsInRole.Count.ShouldBeGreaterThan(0); + var count = permissionGrantsInRole.Count; + + using (var uow = UowManager.Begin()) + { + var identityResult = await RoleManager.SetRoleNameAsync(role, "TestModerator"); + identityResult.Succeeded.ShouldBeTrue(); + var xx = await RoleRepository.UpdateAsync(role); + await uow.CompleteAsync(); + } + + role = await RoleRepository.GetAsync(role.Id); + role.Name.ShouldBe("TestModerator"); + + permissionGrantsInRole = await PermissionGrantRepository.GetListAsync("R", role.Name); + permissionGrantsInRole.Count.ShouldBe(count); + } + } +} diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/TestPermissionDataBuilder.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/TestPermissionDataBuilder.cs index c53592d567..ad94e914b5 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/TestPermissionDataBuilder.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/TestPermissionDataBuilder.cs @@ -29,26 +29,26 @@ namespace Volo.Abp.Identity public async Task Build() { - await AddRolePermissions().ConfigureAwait(false); - await AddUserPermissions().ConfigureAwait(false); + await AddRolePermissions(); + await AddUserPermissions(); } private async Task AddRolePermissions() { - await AddPermission(TestPermissionNames.MyPermission1, RolePermissionValueProvider.ProviderName, "admin").ConfigureAwait(false); - await AddPermission(TestPermissionNames.MyPermission2, RolePermissionValueProvider.ProviderName, "admin").ConfigureAwait(false); - await AddPermission(TestPermissionNames.MyPermission2_ChildPermission1, RolePermissionValueProvider.ProviderName, "admin").ConfigureAwait(false); + await AddPermission(TestPermissionNames.MyPermission1, RolePermissionValueProvider.ProviderName, "admin"); + await AddPermission(TestPermissionNames.MyPermission2, RolePermissionValueProvider.ProviderName, "admin"); + await AddPermission(TestPermissionNames.MyPermission2_ChildPermission1, RolePermissionValueProvider.ProviderName, "admin"); - await AddPermission(TestPermissionNames.MyPermission1, RolePermissionValueProvider.ProviderName, "moderator").ConfigureAwait(false); - await AddPermission(TestPermissionNames.MyPermission2, RolePermissionValueProvider.ProviderName, "moderator").ConfigureAwait(false); + await AddPermission(TestPermissionNames.MyPermission1, RolePermissionValueProvider.ProviderName, "moderator"); + await AddPermission(TestPermissionNames.MyPermission2, RolePermissionValueProvider.ProviderName, "moderator"); - await AddPermission(TestPermissionNames.MyPermission1, RolePermissionValueProvider.ProviderName, "supporter").ConfigureAwait(false); + await AddPermission(TestPermissionNames.MyPermission1, RolePermissionValueProvider.ProviderName, "supporter"); } private async Task AddUserPermissions() { var david = AsyncHelper.RunSync(() => _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("david"))); - await AddPermission(TestPermissionNames.MyPermission1, UserPermissionValueProvider.ProviderName, david.Id.ToString()).ConfigureAwait(false); + await AddPermission(TestPermissionNames.MyPermission1, UserPermissionValueProvider.ProviderName, david.Id.ToString()); } private async Task AddPermission(string permissionName, string providerName, string providerKey) @@ -60,7 +60,7 @@ namespace Volo.Abp.Identity providerName, providerKey ) - ).ConfigureAwait(false); + ); } } } diff --git a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/UserRoleFinder_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/UserRoleFinder_Tests.cs index a8f2159fc2..ef06949500 100644 --- a/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/UserRoleFinder_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Domain.Tests/Volo/Abp/Identity/UserRoleFinder_Tests.cs @@ -21,7 +21,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetRolesAsync() { - var roleNames = await _userRoleFinder.GetRolesAsync(_testData.UserJohnId).ConfigureAwait(false); + var roleNames = await _userRoleFinder.GetRolesAsync(_testData.UserJohnId); roleNames.ShouldNotBeEmpty(); roleNames.ShouldContain(x => x == "moderator"); roleNames.ShouldContain(x => x == "supporter"); diff --git a/modules/identity/test/Volo.Abp.Identity.EntityFrameworkCore.Tests/Volo.Abp.Identity.EntityFrameworkCore.Tests.csproj b/modules/identity/test/Volo.Abp.Identity.EntityFrameworkCore.Tests/Volo.Abp.Identity.EntityFrameworkCore.Tests.csproj index 5e01379951..bb3329cb25 100644 --- a/modules/identity/test/Volo.Abp.Identity.EntityFrameworkCore.Tests/Volo.Abp.Identity.EntityFrameworkCore.Tests.csproj +++ b/modules/identity/test/Volo.Abp.Identity.EntityFrameworkCore.Tests/Volo.Abp.Identity.EntityFrameworkCore.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo.Abp.Identity.MongoDB.Tests.csproj b/modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo.Abp.Identity.MongoDB.Tests.csproj index 22edeae68a..73d1cbf32e 100644 --- a/modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo.Abp.Identity.MongoDB.Tests.csproj +++ b/modules/identity/test/Volo.Abp.Identity.MongoDB.Tests/Volo.Abp.Identity.MongoDB.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo.Abp.Identity.TestBase.csproj b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo.Abp.Identity.TestBase.csproj index de9dc07587..0dd175fabc 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo.Abp.Identity.TestBase.csproj +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo.Abp.Identity.TestBase.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestBaseModule.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestBaseModule.cs index 0c8c545b8c..4b956ab16d 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestBaseModule.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestBaseModule.cs @@ -32,10 +32,10 @@ namespace Volo.Abp.Identity var dataSeeder = scope.ServiceProvider.GetRequiredService(); AsyncHelper.RunSync(async () => { - await dataSeeder.SeedAsync().ConfigureAwait(false); + await dataSeeder.SeedAsync(); await scope.ServiceProvider .GetRequiredService() - .Build().ConfigureAwait(false); + .Build(); }); } } diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs index 979fcf940f..11c968de3f 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/AbpIdentityTestDataBuilder.cs @@ -55,14 +55,14 @@ namespace Volo.Abp.Identity private async Task AddRoles() { - _adminRole = await _roleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("admin")).ConfigureAwait(false); + _adminRole = await _roleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("admin")); _moderator = new IdentityRole(_testData.RoleModeratorId, "moderator"); _moderator.AddClaim(_guidGenerator, new Claim("test-claim", "test-value")); - await _roleRepository.InsertAsync(_moderator).ConfigureAwait(false); + await _roleRepository.InsertAsync(_moderator); _supporterRole = new IdentityRole(_guidGenerator.Create(), "supporter"); - await _roleRepository.InsertAsync(_supporterRole).ConfigureAwait(false); + await _roleRepository.InsertAsync(_supporterRole); } /* Creates OU tree as shown below: @@ -95,7 +95,7 @@ namespace Volo.Abp.Identity var adminUser = new IdentityUser(_guidGenerator.Create(), "administrator", "admin@abp.io"); adminUser.AddRole(_adminRole.Id); adminUser.AddClaim(_guidGenerator, new Claim("TestClaimType", "42")); - await _userRepository.InsertAsync(adminUser).ConfigureAwait(false); + await _userRepository.InsertAsync(adminUser); var john = new IdentityUser(_testData.UserJohnId, "john.nash", "john.nash@abp.io"); john.AddRole(_moderator.Id); @@ -106,15 +106,15 @@ namespace Volo.Abp.Identity john.AddLogin(new UserLoginInfo("twitter", "johnx", "John Nash")); john.AddClaim(_guidGenerator, new Claim("TestClaimType", "42")); john.SetToken("test-provider", "test-name", "test-value"); - await _userRepository.InsertAsync(john).ConfigureAwait(false); + await _userRepository.InsertAsync(john); var david = new IdentityUser(_testData.UserDavidId, "david", "david@abp.io"); - await _userRepository.InsertAsync(david).ConfigureAwait(false); + await _userRepository.InsertAsync(david); var neo = new IdentityUser(_testData.UserNeoId, "neo", "neo@abp.io"); neo.AddRole(_supporterRole.Id); neo.AddClaim(_guidGenerator, new Claim("TestClaimType", "43")); - await _userRepository.InsertAsync(neo).ConfigureAwait(false); + await _userRepository.InsertAsync(neo); } @@ -122,8 +122,9 @@ namespace Volo.Abp.Identity { var ageClaim = new IdentityClaimType(_testData.AgeClaimId, "Age", false, false, null, null, null, IdentityClaimValueType.Int); await _identityClaimTypeRepository.InsertAsync(ageClaim).ConfigureAwait(false); + var educationClaim = new IdentityClaimType(_testData.EducationClaimId, "Education", true, false, null, null, null); - await _identityClaimTypeRepository.InsertAsync(educationClaim).ConfigureAwait(false); + await _identityClaimTypeRepository.InsertAsync(educationClaim); } private async Task CreateOU(string displayName, string code, Guid? parentId = null) diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityClaimTypeRepository_Tests.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityClaimTypeRepository_Tests.cs index afe117d421..3250c0b04a 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityClaimTypeRepository_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityClaimTypeRepository_Tests.cs @@ -28,11 +28,11 @@ namespace Volo.Abp.Identity { var claim = (await ClaimTypeRepository.GetListAsync()).FirstOrDefault(); - var result1 = await ClaimTypeRepository.AnyAsync(claim.Name).ConfigureAwait(false); + var result1 = await ClaimTypeRepository.AnyAsync(claim.Name); result1.ShouldBe(true); - var result2 = await ClaimTypeRepository.AnyAsync(Guid.NewGuid().ToString()).ConfigureAwait(false); + var result2 = await ClaimTypeRepository.AnyAsync(Guid.NewGuid().ToString()); result2.ShouldBe(false); } diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityDataSeeder_Tests.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityDataSeeder_Tests.cs index 0b6692f419..65eac5bc9d 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityDataSeeder_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityDataSeeder_Tests.cs @@ -25,11 +25,11 @@ namespace Volo.Abp.Identity [Fact] public async Task Should_Create_Admin_User_And_Role() { - await _identityDataSeeder.SeedAsync("admin@abp.io", "1q2w3E*").ConfigureAwait(false); + await _identityDataSeeder.SeedAsync("admin@abp.io", "1q2w3E*"); - (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("admin")).ConfigureAwait(false)).ShouldNotBeNull(); - (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("admin")).ConfigureAwait(false)).Name.ShouldBe("admin"); - (await _roleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("admin")).ConfigureAwait(false)).ShouldNotBeNull(); + (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("admin"))).ShouldNotBeNull(); + (await _userRepository.FindByNormalizedUserNameAsync(_lookupNormalizer.NormalizeName("admin"))).Name.ShouldBe("admin"); + (await _roleRepository.FindByNormalizedNameAsync(_lookupNormalizer.NormalizeName("admin"))).ShouldNotBeNull(); } } } diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityRoleRepository_Tests.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityRoleRepository_Tests.cs index cd7ee1eb32..eb22de0600 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityRoleRepository_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityRoleRepository_Tests.cs @@ -23,29 +23,40 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByNormalizedNameAsync() { - (await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("admin")).ConfigureAwait(false)).ShouldNotBeNull(); - (await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("undefined-role")).ConfigureAwait(false)).ShouldBeNull(); + (await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("admin"))).ShouldNotBeNull(); + (await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("undefined-role"))).ShouldBeNull(); } [Fact] public async Task GetListAsync() { - var roles = await RoleRepository.GetListAsync().ConfigureAwait(false); + var roles = await RoleRepository.GetListAsync(); roles.ShouldContain(r => r.Name == "admin"); roles.ShouldContain(r => r.Name == "moderator"); roles.ShouldContain(r => r.Name == "supporter"); } + [Fact] + public async Task GetDefaultOnesAsync() + { + var roles = await RoleRepository.GetDefaultOnesAsync().ConfigureAwait(false); + + foreach (var role in roles) + { + role.IsDefault.ShouldBe(true); + } + } + [Fact] public async Task GetCountAsync() { - (await RoleRepository.GetCountAsync().ConfigureAwait(false)).ShouldBeGreaterThan(0); + (await RoleRepository.GetCountAsync()).ShouldBeGreaterThan(0); } [Fact] public async Task Should_Eager_Load_Role_Collections() { - var role = await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("moderator")).ConfigureAwait(false); + var role = await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("moderator")); role.Claims.ShouldNotBeNull(); role.Claims.Any().ShouldBeTrue(); } diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs index 7433e4c202..114d7e37a2 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/IdentityUserRepository_Tests.cs @@ -28,23 +28,23 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByNormalizedUserNameAsync() { - (await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false)).ShouldNotBeNull(); - (await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("undefined-user")).ConfigureAwait(false)).ShouldBeNull(); + (await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash"))).ShouldNotBeNull(); + (await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("undefined-user"))).ShouldBeNull(); } [Fact] public async Task FindByNormalizedEmailAsync() { - (await UserRepository.FindByNormalizedEmailAsync(LookupNormalizer.NormalizeEmail("john.nash@abp.io")).ConfigureAwait(false)).ShouldNotBeNull(); - (await UserRepository.FindByNormalizedEmailAsync(LookupNormalizer.NormalizeEmail("david@abp.io")).ConfigureAwait(false)).ShouldNotBeNull(); - (await UserRepository.FindByNormalizedEmailAsync(LookupNormalizer.NormalizeEmail("undefined-user@abp.io")).ConfigureAwait(false)).ShouldBeNull(); + (await UserRepository.FindByNormalizedEmailAsync(LookupNormalizer.NormalizeEmail("john.nash@abp.io"))).ShouldNotBeNull(); + (await UserRepository.FindByNormalizedEmailAsync(LookupNormalizer.NormalizeEmail("david@abp.io"))).ShouldNotBeNull(); + (await UserRepository.FindByNormalizedEmailAsync(LookupNormalizer.NormalizeEmail("undefined-user@abp.io"))).ShouldBeNull(); } [Fact] public async Task GetRoleNamesAsync() { - var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); - var roles = await UserRepository.GetRoleNamesAsync(john.Id).ConfigureAwait(false); + var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash")); + var roles = await UserRepository.GetRoleNamesAsync(john.Id); roles.Count.ShouldBe(2); roles.ShouldContain("moderator"); roles.ShouldContain("supporter"); @@ -53,37 +53,37 @@ namespace Volo.Abp.Identity [Fact] public async Task FindByLoginAsync() { - var user = await UserRepository.FindByLoginAsync("github", "john").ConfigureAwait(false); + var user = await UserRepository.FindByLoginAsync("github", "john"); user.ShouldNotBeNull(); user.UserName.ShouldBe("john.nash"); - user = await UserRepository.FindByLoginAsync("twitter", "johnx").ConfigureAwait(false); + user = await UserRepository.FindByLoginAsync("twitter", "johnx"); user.ShouldNotBeNull(); user.UserName.ShouldBe("john.nash"); - (await UserRepository.FindByLoginAsync("github", "undefinedid").ConfigureAwait(false)).ShouldBeNull(); + (await UserRepository.FindByLoginAsync("github", "undefinedid")).ShouldBeNull(); } [Fact] public async Task GetListByClaimAsync() { - var users = await UserRepository.GetListByClaimAsync(new Claim("TestClaimType", "42")).ConfigureAwait(false); + var users = await UserRepository.GetListByClaimAsync(new Claim("TestClaimType", "42")); users.Count.ShouldBe(2); users.ShouldContain(u => u.UserName == "administrator"); users.ShouldContain(u => u.UserName == "john.nash"); - users = await UserRepository.GetListByClaimAsync(new Claim("TestClaimType", "43")).ConfigureAwait(false); + users = await UserRepository.GetListByClaimAsync(new Claim("TestClaimType", "43")); users.Count.ShouldBe(1); users.ShouldContain(u => u.UserName == "neo"); - users = await UserRepository.GetListByClaimAsync(new Claim("TestClaimType", "undefined")).ConfigureAwait(false); + users = await UserRepository.GetListByClaimAsync(new Claim("TestClaimType", "undefined")); users.Count.ShouldBe(0); } [Fact] public async Task GetListByNormalizedRoleNameAsync() { - var users = await UserRepository.GetListByNormalizedRoleNameAsync(LookupNormalizer.NormalizeName("supporter")).ConfigureAwait(false); + var users = await UserRepository.GetListByNormalizedRoleNameAsync(LookupNormalizer.NormalizeName("supporter")); users.Count.ShouldBe(2); users.ShouldContain(u => u.UserName == "john.nash"); users.ShouldContain(u => u.UserName == "neo"); @@ -92,7 +92,7 @@ namespace Volo.Abp.Identity [Fact] public async Task GetListAsync() { - var users = await UserRepository.GetListAsync("UserName DESC", 5, 0, "n").ConfigureAwait(false); + var users = await UserRepository.GetListAsync("UserName DESC", 5, 0, "n"); users.Count.ShouldBeGreaterThan(1); users.Count.ShouldBeLessThanOrEqualTo(5); @@ -110,15 +110,15 @@ namespace Volo.Abp.Identity ).ShouldBeGreaterThan(0); } - users = await UserRepository.GetListAsync(null, 999, 0, "undefined-username").ConfigureAwait(false); + users = await UserRepository.GetListAsync(null, 999, 0, "undefined-username"); users.Count.ShouldBe(0); } [Fact] public async Task GetRolesAsync() { - var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); - var roles = await UserRepository.GetRolesAsync(john.Id).ConfigureAwait(false); + var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash")); + var roles = await UserRepository.GetRolesAsync(john.Id); roles.Count.ShouldBe(2); roles.ShouldContain(r => r.Name == "moderator"); roles.ShouldContain(r => r.Name == "supporter"); @@ -127,8 +127,8 @@ namespace Volo.Abp.Identity [Fact] public async Task GetCountAsync() { - (await UserRepository.GetCountAsync("n").ConfigureAwait(false)).ShouldBeGreaterThan(1); - (await UserRepository.GetCountAsync("undefined-username").ConfigureAwait(false)).ShouldBe(0); + (await UserRepository.GetCountAsync("n")).ShouldBeGreaterThan(1); + (await UserRepository.GetCountAsync("undefined-username")).ShouldBe(0); } [Fact] @@ -150,7 +150,7 @@ namespace Volo.Abp.Identity [Fact] public async Task Should_Eager_Load_User_Collections() { - var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash")).ConfigureAwait(false); + var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash")); john.Roles.ShouldNotBeNull(); john.Roles.Any().ShouldBeTrue(); diff --git a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/LazyLoading_Tests.cs b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/LazyLoading_Tests.cs index 3db968232b..a832b5024d 100644 --- a/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/LazyLoading_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.TestBase/Volo/Abp/Identity/LazyLoading_Tests.cs @@ -31,11 +31,11 @@ namespace Volo.Abp.Identity { using (var uow = GetRequiredService().Begin()) { - var role = await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("moderator"), includeDetails: false).ConfigureAwait(false); + var role = await RoleRepository.FindByNormalizedNameAsync(LookupNormalizer.NormalizeName("moderator"), includeDetails: false); role.Claims.ShouldNotBeNull(); role.Claims.Any().ShouldBeTrue(); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } @@ -44,7 +44,7 @@ namespace Volo.Abp.Identity { using (var uow = GetRequiredService().Begin()) { - var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash"), includeDetails: false).ConfigureAwait(false); + var john = await UserRepository.FindByNormalizedUserNameAsync(LookupNormalizer.NormalizeName("john.nash"), includeDetails: false); john.Roles.ShouldNotBeNull(); john.Roles.Any().ShouldBeTrue(); diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/FodyWeavers.xml b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/FodyWeavers.xsd b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo.Abp.IdentityServer.Domain.Shared.csproj b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo.Abp.IdentityServer.Domain.Shared.csproj index 71d99b826b..e8a623fad6 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo.Abp.IdentityServer.Domain.Shared.csproj +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo.Abp.IdentityServer.Domain.Shared.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/zh-Hant.json b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/zh-Hant.json new file mode 100644 index 0000000000..859e8c29b7 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain.Shared/Volo/Abp/IdentityServer/Localization/Resources/zh-Hant.json @@ -0,0 +1,8 @@ +{ + "culture": "zh-Hant", + "texts": { + "Volo.IdentityServer:DuplicateIdentityResourceName": "Identity資源名稱已存在: {Name}", + "Volo.IdentityServer:DuplicateApiResourceName": "Api資源名稱已存在: {Name}", + "Volo.IdentityServer:DuplicateClientId": "ClientId已經存在: {ClientId}" + } +} \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/FodyWeavers.xml b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/FodyWeavers.xsd b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj index 70d0fbcba7..3ad4d2bb05 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo.Abp.IdentityServer.Domain.csproj @@ -1,5 +1,6 @@ - + + @@ -20,6 +21,7 @@ + diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpCorsPolicyService.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpCorsPolicyService.cs index c445b7e90e..9113051a4a 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpCorsPolicyService.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpCorsPolicyService.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.IdentityServer public async Task IsOriginAllowedAsync(string origin) { - var cacheItem = await Cache.GetOrAddAsync(AllowedCorsOriginsCacheItem.AllOrigins, CreateCacheItemAsync).ConfigureAwait(false); + var cacheItem = await Cache.GetOrAddAsync(AllowedCorsOriginsCacheItem.AllOrigins, CreateCacheItemAsync); var isAllowed = cacheItem.AllowedOrigins.Contains(origin, StringComparer.OrdinalIgnoreCase); @@ -49,7 +49,7 @@ namespace Volo.Abp.IdentityServer return new AllowedCorsOriginsCacheItem { - AllowedOrigins = (await clientRepository.GetAllDistinctAllowedCorsOriginsAsync().ConfigureAwait(false)).ToArray() + AllowedOrigins = (await clientRepository.GetAllDistinctAllowedCorsOriginsAsync()).ToArray() }; } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs index c89e7e74d2..0ff798e7fd 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs @@ -1,11 +1,13 @@ -using System.Security.Cryptography.X509Certificates; -using IdentityServer4.Services; +using IdentityServer4.Services; using IdentityServer4.Stores; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; +using Microsoft.Extensions.Options; using Volo.Abp.AutoMapper; +using Volo.Abp.BackgroundWorkers; using Volo.Abp.Caching; using Volo.Abp.Identity; -using Volo.Abp.IdentityServer.Clients; +using Volo.Abp.IdentityServer.Tokens; using Volo.Abp.Modularity; using Volo.Abp.Security; using Volo.Abp.Validation; @@ -18,7 +20,8 @@ namespace Volo.Abp.IdentityServer typeof(AbpIdentityDomainModule), typeof(AbpSecurityModule), typeof(AbpCachingModule), - typeof(AbpValidationModule) + typeof(AbpValidationModule), + typeof(AbpBackgroundWorkersModule) )] public class AbpIdentityServerDomainModule : AbpModule { @@ -28,12 +31,12 @@ namespace Volo.Abp.IdentityServer Configure(options => { - options.AddProfile(validate: true); + options.AddProfile(validate: true); }); AddIdentityServer(context.Services); } - + private static void AddIdentityServer(IServiceCollection services) { var configuration = services.GetConfiguration(); @@ -58,7 +61,12 @@ namespace Volo.Abp.IdentityServer if (!services.IsAdded()) { - identityServerBuilder.AddInMemoryPersistedGrants(); + services.TryAddSingleton(); + } + + if (!services.IsAdded()) + { + services.TryAddSingleton(); } if (!services.IsAdded()) @@ -72,5 +80,19 @@ namespace Volo.Abp.IdentityServer identityServerBuilder.AddInMemoryIdentityResources(configuration.GetSection("IdentityServer:IdentityResources")); } } + + public override void OnApplicationInitialization(ApplicationInitializationContext context) + { + var options = context.ServiceProvider.GetRequiredService>().Value; + if (options.IsCleanupEnabled) + { + context.ServiceProvider + .GetRequiredService() + .Add( + context.ServiceProvider + .GetRequiredService() + ); + } + } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AllowedCorsOriginsCacheItemInvalidator.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AllowedCorsOriginsCacheItemInvalidator.cs index 0a05e1781e..80bc425d5c 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AllowedCorsOriginsCacheItemInvalidator.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AllowedCorsOriginsCacheItemInvalidator.cs @@ -21,12 +21,12 @@ namespace Volo.Abp.IdentityServer public async Task HandleEventAsync(EntityChangedEventData eventData) { - await Cache.RemoveAsync(AllowedCorsOriginsCacheItem.AllOrigins).ConfigureAwait(false); + await Cache.RemoveAsync(AllowedCorsOriginsCacheItem.AllOrigins); } public async Task HandleEventAsync(EntityChangedEventData eventData) { - await Cache.RemoveAsync(AllowedCorsOriginsCacheItem.AllOrigins).ConfigureAwait(false); + await Cache.RemoveAsync(AllowedCorsOriginsCacheItem.AllOrigins); } } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpProfileService.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpProfileService.cs index 93a1fb5bbe..f3bca6dba9 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpProfileService.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpProfileService.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.IdentityServer.AspNetIdentity { using (_currentTenant.Change(context.Subject.FindTenantId())) { - await base.GetProfileDataAsync(context).ConfigureAwait(false); + await base.GetProfileDataAsync(context); } } @@ -37,7 +37,7 @@ namespace Volo.Abp.IdentityServer.AspNetIdentity { using (_currentTenant.Change(context.Subject.FindTenantId())) { - await base.IsActiveAsync(context).ConfigureAwait(false); + await base.IsActiveAsync(context); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs index c7d9000cd2..68489a1bdb 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs @@ -43,22 +43,22 @@ namespace Volo.Abp.IdentityServer.AspNetIdentity [UnitOfWork] public virtual async Task ValidateAsync(ResourceOwnerPasswordValidationContext context) { - await ReplaceEmailToUsernameOfInputIfNeeds(context).ConfigureAwait(false); + await ReplaceEmailToUsernameOfInputIfNeeds(context); - var user = await _userManager.FindByNameAsync(context.UserName).ConfigureAwait(false); + var user = await _userManager.FindByNameAsync(context.UserName); if (user != null) { - var result = await _signInManager.CheckPasswordSignInAsync(user, context.Password, true).ConfigureAwait(false); + var result = await _signInManager.CheckPasswordSignInAsync(user, context.Password, true); if (result.Succeeded) { - var sub = await _userManager.GetUserIdAsync(user).ConfigureAwait(false); + var sub = await _userManager.GetUserIdAsync(user); _logger.LogInformation("Credentials validated for username: {username}", context.UserName); - await _events.RaiseAsync(new UserLoginSuccessEvent(context.UserName, sub, context.UserName, interactive: false)).ConfigureAwait(false); + await _events.RaiseAsync(new UserLoginSuccessEvent(context.UserName, sub, context.UserName, interactive: false)); var additionalClaims = new List(); - await AddCustomClaimsAsync(additionalClaims, user, context).ConfigureAwait(false); + await AddCustomClaimsAsync(additionalClaims, user, context); context.Result = new GrantValidationResult( sub, @@ -71,23 +71,23 @@ namespace Volo.Abp.IdentityServer.AspNetIdentity else if (result.IsLockedOut) { _logger.LogInformation("Authentication failed for username: {username}, reason: locked out", context.UserName); - await _events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "locked out", interactive: false)).ConfigureAwait(false); + await _events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "locked out", interactive: false)); } else if (result.IsNotAllowed) { _logger.LogInformation("Authentication failed for username: {username}, reason: not allowed", context.UserName); - await _events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "not allowed", interactive: false)).ConfigureAwait(false); + await _events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "not allowed", interactive: false)); } else { _logger.LogInformation("Authentication failed for username: {username}, reason: invalid credentials", context.UserName); - await _events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "invalid credentials", interactive: false)).ConfigureAwait(false); + await _events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "invalid credentials", interactive: false)); } } else { _logger.LogInformation("No user found matching username: {username}", context.UserName); - await _events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "invalid username", interactive: false)).ConfigureAwait(false); + await _events.RaiseAsync(new UserLoginFailureEvent(context.UserName, "invalid username", interactive: false)); } context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant); @@ -95,18 +95,18 @@ namespace Volo.Abp.IdentityServer.AspNetIdentity protected virtual async Task ReplaceEmailToUsernameOfInputIfNeeds(ResourceOwnerPasswordValidationContext context) { - if (!ValidationHandler.IsValidEmailAddress(context.UserName)) + if (!ValidationHelper.IsValidEmailAddress(context.UserName)) { return; } - var userByUsername = await _userManager.FindByNameAsync(context.UserName).ConfigureAwait(false); + var userByUsername = await _userManager.FindByNameAsync(context.UserName); if (userByUsername != null) { return; } - var userByEmail = await _userManager.FindByEmailAsync(context.UserName).ConfigureAwait(false); + var userByEmail = await _userManager.FindByEmailAsync(context.UserName); if (userByEmail == null) { return; diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/Client.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/Client.cs index 031aa86bfc..b7a53ad66f 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/Client.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/Client.cs @@ -108,10 +108,10 @@ namespace Volo.Abp.IdentityServer.Clients } public Client(Guid id, [NotNull] string clientId) + : base(id) { Check.NotNull(clientId, nameof(clientId)); - Id = id; ClientId = clientId; //TODO: Replace magics with constants? diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientStore.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientStore.cs index 8ba8aea7e3..0e88b658cd 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientStore.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientStore.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.IdentityServer.Clients public virtual async Task FindClientByIdAsync(string clientId) { - var client = await _clientRepository.FindByCliendIdAsync(clientId).ConfigureAwait(false); + var client = await _clientRepository.FindByCliendIdAsync(clientId); return _objectMapper.Map(client); } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Devices/DeviceFlowCodes.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Devices/DeviceFlowCodes.cs new file mode 100644 index 0000000000..8814519cd4 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Devices/DeviceFlowCodes.cs @@ -0,0 +1,31 @@ +using System; +using Volo.Abp.Domain.Entities.Auditing; + +namespace Volo.Abp.IdentityServer.Devices +{ + public class DeviceFlowCodes : CreationAuditedAggregateRoot + { + public virtual string DeviceCode { get; set; } + + public virtual string UserCode { get; set; } + + public virtual string SubjectId { get; set; } + + public virtual string ClientId { get; set; } + + public virtual DateTime? Expiration { get; set; } + + public virtual string Data { get; set; } + + private DeviceFlowCodes() + { + + } + + public DeviceFlowCodes(Guid id) + : base(id) + { + + } + } +} \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Devices/DeviceFlowStore.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Devices/DeviceFlowStore.cs new file mode 100644 index 0000000000..0f0021f9a4 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Devices/DeviceFlowStore.cs @@ -0,0 +1,143 @@ +using System; +using System.Threading.Tasks; +using IdentityModel; +using IdentityServer4.Models; +using IdentityServer4.Stores; +using IdentityServer4.Stores.Serialization; +using JetBrains.Annotations; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Guids; + +namespace Volo.Abp.IdentityServer.Devices +{ + public class DeviceFlowStore : IDeviceFlowStore, ITransientDependency + { + protected IDeviceFlowCodesRepository DeviceFlowCodesRepository { get; } + protected IGuidGenerator GuidGenerator { get; } + protected IPersistentGrantSerializer PersistentGrantSerializer { get; } + + public DeviceFlowStore( + IDeviceFlowCodesRepository deviceFlowCodesRepository, + IGuidGenerator guidGenerator, + IPersistentGrantSerializer persistentGrantSerializer) + { + DeviceFlowCodesRepository = deviceFlowCodesRepository; + GuidGenerator = guidGenerator; + PersistentGrantSerializer = persistentGrantSerializer; + } + + public async Task StoreDeviceAuthorizationAsync(string deviceCode, string userCode, DeviceCode data) + { + Check.NotNull(deviceCode, nameof(deviceCode)); + Check.NotNull(userCode, nameof(userCode)); + Check.NotNull(data, nameof(data)); + + await DeviceFlowCodesRepository + .InsertAsync( + new DeviceFlowCodes(GuidGenerator.Create()) + { + DeviceCode = deviceCode, + UserCode = userCode, + ClientId = data.ClientId, + SubjectId = data.Subject?.FindFirst(JwtClaimTypes.Subject).Value, + CreationTime = data.CreationTime, + Expiration = data.CreationTime.AddSeconds(data.Lifetime), + Data = Serialize(data) + } + ); + } + + public async Task FindByUserCodeAsync(string userCode) + { + Check.NotNull(userCode, nameof(userCode)); + + var deviceCodes = await DeviceFlowCodesRepository + .FindByUserCodeAsync(userCode) + ; + + if (deviceCodes == null) + { + return null; + } + + return DeserializeToDeviceCode(deviceCodes.Data); + } + + public async Task FindByDeviceCodeAsync(string deviceCode) + { + Check.NotNull(deviceCode, nameof(deviceCode)); + + var deviceCodes = await DeviceFlowCodesRepository + .FindByDeviceCodeAsync(deviceCode) + ; + + if (deviceCodes == null) + { + return null; + } + + return DeserializeToDeviceCode(deviceCodes.Data); + } + + public async Task UpdateByUserCodeAsync(string userCode, DeviceCode data) + { + Check.NotNull(userCode, nameof(userCode)); + Check.NotNull(data, nameof(data)); + + + var deviceCodes = await DeviceFlowCodesRepository + .FindByUserCodeAsync(userCode) + ; + + if (deviceCodes == null) + { + throw new InvalidOperationException($"Could not update device code by the given userCode: {userCode}"); + } + + deviceCodes.SubjectId = data.Subject?.FindFirst(JwtClaimTypes.Subject).Value; + deviceCodes.Data = Serialize(data); + + await DeviceFlowCodesRepository + .UpdateAsync(deviceCodes, autoSave: true) + ; + } + + public async Task RemoveByDeviceCodeAsync(string deviceCode) + { + Check.NotNull(deviceCode, nameof(deviceCode)); + + var deviceCodes = await DeviceFlowCodesRepository + .FindByDeviceCodeAsync(deviceCode) + ; + + if (deviceCodes == null) + { + return; + } + + await DeviceFlowCodesRepository + .DeleteAsync(deviceCodes, autoSave: true) + ; + } + + private string Serialize([CanBeNull] DeviceCode deviceCode) + { + if (deviceCode == null) + { + return null; + } + + return PersistentGrantSerializer.Serialize(deviceCode); + } + + protected virtual DeviceCode DeserializeToDeviceCode([CanBeNull] string data) + { + if (data == null) + { + return null; + } + + return PersistentGrantSerializer.Deserialize(data); + } + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Devices/IDeviceFlowCodesRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Devices/IDeviceFlowCodesRepository.cs new file mode 100644 index 0000000000..b6bcb69bed --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Devices/IDeviceFlowCodesRepository.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories; + +namespace Volo.Abp.IdentityServer.Devices +{ + public interface IDeviceFlowCodesRepository : IBasicRepository + { + Task FindByUserCodeAsync( + string userCode, + CancellationToken cancellationToken = default + ); + + Task FindByDeviceCodeAsync( + string deviceCode, + CancellationToken cancellationToken = default + ); + + Task> GetListByExpirationAsync( + DateTime maxExpirationDate, + int maxResultCount, + CancellationToken cancellationToken = default + ); + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/IPersistentGrantRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/IPersistentGrantRepository.cs index 6e316806b6..65cfabd7e7 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/IPersistentGrantRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/IPersistentGrantRepository.cs @@ -18,6 +18,12 @@ namespace Volo.Abp.IdentityServer.Grants CancellationToken cancellationToken = default ); + Task> GetListByExpirationAsync( + DateTime maxExpirationDate, + int maxResultCount, + CancellationToken cancellationToken = default + ); + Task DeleteAsync( string subjectId, string clientId, diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrantStore.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrantStore.cs index 9cf855e105..e58dae6daf 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrantStore.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrantStore.cs @@ -24,51 +24,51 @@ namespace Volo.Abp.IdentityServer.Grants public virtual async Task StoreAsync(IdentityServer4.Models.PersistedGrant grant) { - var entity = await _persistentGrantRepository.FindByKeyAsync(grant.Key).ConfigureAwait(false); + var entity = await _persistentGrantRepository.FindByKeyAsync(grant.Key); if (entity == null) { entity = _objectMapper.Map(grant); EntityHelper.TrySetId(entity, () => _guidGenerator.Create()); - await _persistentGrantRepository.InsertAsync(entity).ConfigureAwait(false); + await _persistentGrantRepository.InsertAsync(entity); } else { _objectMapper.Map(grant, entity); - await _persistentGrantRepository.UpdateAsync(entity).ConfigureAwait(false); + await _persistentGrantRepository.UpdateAsync(entity); } } public virtual async Task GetAsync(string key) { - var persistedGrant = await _persistentGrantRepository.FindByKeyAsync(key).ConfigureAwait(false); + var persistedGrant = await _persistentGrantRepository.FindByKeyAsync(key); return _objectMapper.Map(persistedGrant); } public virtual async Task> GetAllAsync(string subjectId) { - var persistedGrants = await _persistentGrantRepository.GetListBySubjectIdAsync(subjectId).ConfigureAwait(false); + var persistedGrants = await _persistentGrantRepository.GetListBySubjectIdAsync(subjectId); return persistedGrants.Select(x => _objectMapper.Map(x)); } public virtual async Task RemoveAsync(string key) { - var persistedGrant = await _persistentGrantRepository.FindByKeyAsync(key).ConfigureAwait(false); + var persistedGrant = await _persistentGrantRepository.FindByKeyAsync(key); if (persistedGrant == null) { return; } - await _persistentGrantRepository.DeleteAsync(persistedGrant).ConfigureAwait(false); + await _persistentGrantRepository.DeleteAsync(persistedGrant); } public virtual async Task RemoveAllAsync(string subjectId, string clientId) { - await _persistentGrantRepository.DeleteAsync(subjectId, clientId).ConfigureAwait(false); + await _persistentGrantRepository.DeleteAsync(subjectId, clientId); } public virtual async Task RemoveAllAsync(string subjectId, string clientId, string type) { - await _persistentGrantRepository.DeleteAsync(subjectId, clientId, type).ConfigureAwait(false); + await _persistentGrantRepository.DeleteAsync(subjectId, clientId, type); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceDataSeeder.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceDataSeeder.cs index 8c828b970c..024f8bea13 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceDataSeeder.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceDataSeeder.cs @@ -37,16 +37,16 @@ namespace Volo.Abp.IdentityServer.IdentityResources { foreach (var claimType in resource.UserClaims) { - await AddClaimTypeIfNotExistsAsync(claimType).ConfigureAwait(false); + await AddClaimTypeIfNotExistsAsync(claimType); } - await AddIdentityResourceIfNotExistsAsync(resource).ConfigureAwait(false); + await AddIdentityResourceIfNotExistsAsync(resource); } } protected virtual async Task AddIdentityResourceIfNotExistsAsync(IdentityServer4.Models.IdentityResource resource) { - if (await IdentityResourceRepository.CheckNameExistAsync(resource.Name).ConfigureAwait(false)) + if (await IdentityResourceRepository.CheckNameExistAsync(resource.Name)) { return; } @@ -56,12 +56,12 @@ namespace Volo.Abp.IdentityServer.IdentityResources GuidGenerator.Create(), resource ) - ).ConfigureAwait(false); + ); } protected virtual async Task AddClaimTypeIfNotExistsAsync(string claimType) { - if (await ClaimTypeRepository.AnyAsync(claimType).ConfigureAwait(false)) + if (await ClaimTypeRepository.AnyAsync(claimType)) { return; } @@ -72,7 +72,7 @@ namespace Volo.Abp.IdentityServer.IdentityResources claimType, isStatic: true ) - ).ConfigureAwait(false); + ); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientAutoMapperProfile.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs similarity index 94% rename from modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientAutoMapperProfile.cs rename to modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs index 81e5841d6b..ba1f44953c 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientAutoMapperProfile.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerAutoMapperProfile.cs @@ -2,14 +2,15 @@ using System.Security.Claims; using AutoMapper; using Volo.Abp.IdentityServer.ApiResources; +using Volo.Abp.IdentityServer.Clients; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; -namespace Volo.Abp.IdentityServer.Clients +namespace Volo.Abp.IdentityServer { - public class ClientAutoMapperProfile : Profile + public class IdentityServerAutoMapperProfile : Profile { - public ClientAutoMapperProfile() + public IdentityServerAutoMapperProfile() { //TODO: Reverse maps will not used probably. Remove those will not used diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerBuilderExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerBuilderExtensions.cs index 2168b2067e..516d400db6 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerBuilderExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/IdentityServerBuilderExtensions.cs @@ -1,6 +1,7 @@ using IdentityServer4.Stores; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.IdentityServer.Clients; +using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; namespace Volo.Abp.IdentityServer @@ -10,6 +11,7 @@ namespace Volo.Abp.IdentityServer public static IIdentityServerBuilder AddAbpStores(this IIdentityServerBuilder builder) { builder.Services.AddTransient(); + builder.Services.AddTransient(); return builder .AddClientStore() diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Jwt/JwtTokenMiddleware.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Jwt/JwtTokenMiddleware.cs index 58d3205dc2..57ca9cc4c2 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Jwt/JwtTokenMiddleware.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Jwt/JwtTokenMiddleware.cs @@ -13,14 +13,14 @@ namespace Volo.Abp.IdentityServer.Jwt { if (ctx.User.Identity?.IsAuthenticated != true) { - var result = await ctx.AuthenticateAsync(schema).ConfigureAwait(false); + var result = await ctx.AuthenticateAsync(schema); if (result.Succeeded && result.Principal != null) { ctx.User = result.Principal; } } - await next().ConfigureAwait(false); + await next(); }); } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs index 0b8b5016a7..56275bb386 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs @@ -29,26 +29,26 @@ namespace Volo.Abp.IdentityServer public virtual async Task> FindIdentityResourcesByScopeAsync(IEnumerable scopeNames) { - var resource = await _identityResourceRepository.GetListByScopesAsync(scopeNames.ToArray(), includeDetails: true).ConfigureAwait(false); + var resource = await _identityResourceRepository.GetListByScopesAsync(scopeNames.ToArray(), includeDetails: true); return _objectMapper.Map, List>(resource); } public virtual async Task> FindApiResourcesByScopeAsync(IEnumerable scopeNames) { - var resources = await _apiResourceRepository.GetListByScopesAsync(scopeNames.ToArray(), includeDetails: true).ConfigureAwait(false); + var resources = await _apiResourceRepository.GetListByScopesAsync(scopeNames.ToArray(), includeDetails: true); return resources.Select(x => _objectMapper.Map(x)); } public virtual async Task FindApiResourceAsync(string name) { - var resource = await _apiResourceRepository.FindByNameAsync(name).ConfigureAwait(false); + var resource = await _apiResourceRepository.FindByNameAsync(name); return _objectMapper.Map(resource); } public virtual async Task GetAllResourcesAsync() { - var identityResources = await _identityResourceRepository.GetListAsync(includeDetails: true).ConfigureAwait(false); - var apiResources = await _apiResourceRepository.GetListAsync(includeDetails: true).ConfigureAwait(false); + var identityResources = await _identityResourceRepository.GetListAsync(includeDetails: true); + var apiResources = await _apiResourceRepository.GetListAsync(includeDetails: true); return new Resources( _objectMapper.Map, IdentityServer4.Models.IdentityResource[]>(identityResources), diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Tokens/TokenCleanupBackgroundWorker.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Tokens/TokenCleanupBackgroundWorker.cs new file mode 100644 index 0000000000..e910a3b30f --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Tokens/TokenCleanupBackgroundWorker.cs @@ -0,0 +1,34 @@ +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using Volo.Abp.BackgroundWorkers; +using Volo.Abp.Threading; + +namespace Volo.Abp.IdentityServer.Tokens +{ + public class TokenCleanupBackgroundWorker : AsyncPeriodicBackgroundWorkerBase + { + protected TokenCleanupOptions Options { get; } + + public TokenCleanupBackgroundWorker( + AbpTimer timer, + IServiceScopeFactory serviceScopeFactory, + IOptions options) + : base( + timer, + serviceScopeFactory) + { + Options = options.Value; + timer.Period = Options.CleanupPeriod; + } + + protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) + { + await workerContext + .ServiceProvider + .GetRequiredService() + .CleanAsync() + ; + } + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Tokens/TokenCleanupOptions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Tokens/TokenCleanupOptions.cs new file mode 100644 index 0000000000..816ef6af15 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Tokens/TokenCleanupOptions.cs @@ -0,0 +1,34 @@ +using Volo.Abp.BackgroundWorkers; + +namespace Volo.Abp.IdentityServer.Tokens +{ + public class TokenCleanupOptions + { + /// + /// Default: 3,600,000 ms. + /// + public int CleanupPeriod { get; set; } = 3_600_000; + + /// + /// Default value: 100. + /// + public int CleanupBatchSize { get; set; } = 100; + + /// + /// The number of loop if there are + /// more than tokens in the database. + /// So, if is 10 and is 100, + /// then the cleanup worker will clean 1,000 items in one at max. + /// + /// Default value: 10. + /// + public int CleanupLoopCount { get; set; } = 10; + + /// + /// Default value: true. + /// If is false, + /// this property is ignored and the cleanup worker doesn't work for this application instance. + /// + public bool IsCleanupEnabled { get; set; } = true; + } +} \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Tokens/TokenCleanupService.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Tokens/TokenCleanupService.cs new file mode 100644 index 0000000000..dfa66b9e88 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Tokens/TokenCleanupService.cs @@ -0,0 +1,83 @@ +using System.Threading.Tasks; +using Microsoft.Extensions.Options; +using Volo.Abp.DependencyInjection; +using Volo.Abp.IdentityServer.Devices; +using Volo.Abp.IdentityServer.Grants; +using Volo.Abp.Timing; +using Volo.Abp.Uow; + +namespace Volo.Abp.IdentityServer.Tokens +{ + public class TokenCleanupService : ITransientDependency + { + protected IPersistentGrantRepository PersistentGrantRepository { get; } + protected IDeviceFlowCodesRepository DeviceFlowCodesRepository { get; } + protected IClock Clock { get; } + protected TokenCleanupOptions Options { get; } + + public TokenCleanupService( + IPersistentGrantRepository persistentGrantRepository, + IDeviceFlowCodesRepository deviceFlowCodesRepository, + IClock clock, + IOptions options) + { + PersistentGrantRepository = persistentGrantRepository; + DeviceFlowCodesRepository = deviceFlowCodesRepository; + Clock = clock; + Options = options.Value; + } + + public virtual async Task CleanAsync() + { + await RemoveGrantsAsync() + ; + + await RemoveDeviceCodesAsync(); + } + + [UnitOfWork] + protected virtual async Task RemoveGrantsAsync() + { + for (int i = 0; i < Options.CleanupLoopCount; i++) + { + var persistentGrants = await PersistentGrantRepository + .GetListByExpirationAsync(Clock.Now, Options.CleanupBatchSize); + + //TODO: Can be optimized if the repository implements the batch deletion + foreach (var persistentGrant in persistentGrants) + { + await PersistentGrantRepository + .DeleteAsync(persistentGrant); + } + + //No need to continue to query if it gets more than max items. + if (persistentGrants.Count < Options.CleanupBatchSize) + { + break; + } + } + } + + protected virtual async Task RemoveDeviceCodesAsync() + { + for (int i = 0; i < Options.CleanupLoopCount; i++) + { + var deviceFlowCodeses = await DeviceFlowCodesRepository + .GetListByExpirationAsync(Clock.Now, Options.CleanupBatchSize); + + //TODO: Can be optimized if the repository implements the batch deletion + foreach (var deviceFlowCodes in deviceFlowCodeses) + { + await DeviceFlowCodesRepository + .DeleteAsync(deviceFlowCodes); + } + + //No need to continue to query if it gets more than max items. + if (deviceFlowCodeses.Count < Options.CleanupBatchSize) + { + break; + } + } + } + } +} \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/FodyWeavers.xml b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/FodyWeavers.xsd b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo.Abp.IdentityServer.EntityFrameworkCore.csproj b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo.Abp.IdentityServer.EntityFrameworkCore.csproj index 72681fbf9d..5396e34103 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo.Abp.IdentityServer.EntityFrameworkCore.csproj +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo.Abp.IdentityServer.EntityFrameworkCore.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs index ec038afac6..5f7d6369af 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.IdentityServer.ApiResources select apiResource; return await query - .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); } public virtual async Task> GetListByScopesAsync( @@ -40,7 +40,7 @@ namespace Volo.Abp.IdentityServer.ApiResources where api.Scopes.Any(x => scopeNames.Contains(x.Name)) select api; - return await query.ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + return await query.ToListAsync(GetCancellationToken(cancellationToken)); } public virtual async Task> GetListAsync(string sorting, int skipCount, int maxResultCount, bool includeDetails = false, @@ -49,7 +49,7 @@ namespace Volo.Abp.IdentityServer.ApiResources return await DbSet .IncludeDetails(includeDetails).OrderBy(sorting ?? "name desc") .PageBy(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public virtual async Task> GetListAsync( @@ -58,12 +58,12 @@ namespace Volo.Abp.IdentityServer.ApiResources { return await DbSet .IncludeDetails(includeDetails) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public async Task CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) { - return await DbSet.AnyAsync(ar => ar.Id != expectedId && ar.Name == name, cancellationToken: cancellationToken).ConfigureAwait(false); + return await DbSet.AnyAsync(ar => ar.Id != expectedId && ar.Name == name, cancellationToken: cancellationToken); } public override async Task DeleteAsync(Guid id, bool autoSave = false, CancellationToken cancellationToken = default) @@ -82,7 +82,7 @@ namespace Volo.Abp.IdentityServer.ApiResources DbContext.Set().Remove(scope); } - await base.DeleteAsync(id, autoSave, cancellationToken).ConfigureAwait(false); + await base.DeleteAsync(id, autoSave, cancellationToken); } public override IQueryable WithDetails() diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs index 4dc5134ff6..44218470fd 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.IdentityServer.Clients { return await DbSet .IncludeDetails(includeDetails) - .FirstOrDefaultAsync(x => x.ClientId == clientId, GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .FirstOrDefaultAsync(x => x.ClientId == clientId, GetCancellationToken(cancellationToken)); } public virtual async Task> GetListAsync(string sorting, int skipCount, int maxResultCount, bool includeDetails = false, @@ -34,7 +34,7 @@ namespace Volo.Abp.IdentityServer.Clients return await DbSet .IncludeDetails(includeDetails).OrderBy(sorting ?? nameof(Client.ClientName) + " desc") .PageBy(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public async Task> GetAllDistinctAllowedCorsOriginsAsync(CancellationToken cancellationToken = default) @@ -42,12 +42,12 @@ namespace Volo.Abp.IdentityServer.Clients return await DbContext.ClientCorsOrigins .Select(x => x.Origin) .Distinct() - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public async Task CheckClientIdExistAsync(string clientId, Guid? expectedId = null, CancellationToken cancellationToken = default) { - return await DbSet.AnyAsync(c => c.Id != expectedId && c.ClientId == clientId, cancellationToken: cancellationToken).ConfigureAwait(false); + return await DbSet.AnyAsync(c => c.Id != expectedId && c.ClientId == clientId, cancellationToken: cancellationToken); } public override IQueryable WithDetails() diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Devices/DeviceFlowCodesRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Devices/DeviceFlowCodesRepository.cs new file mode 100644 index 0000000000..3a10d21046 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Devices/DeviceFlowCodesRepository.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; +using Volo.Abp.IdentityServer.EntityFrameworkCore; + +namespace Volo.Abp.IdentityServer.Devices +{ + public class DeviceFlowCodesRepository : EfCoreRepository, + IDeviceFlowCodesRepository + { + public DeviceFlowCodesRepository(IDbContextProvider dbContextProvider) + : base(dbContextProvider) + { + + } + + public async Task FindByUserCodeAsync( + string userCode, + CancellationToken cancellationToken = default) + { + return await DbSet + .FirstOrDefaultAsync(d => d.UserCode == userCode, GetCancellationToken(cancellationToken)) + ; + } + + public async Task FindByDeviceCodeAsync( + string deviceCode, + CancellationToken cancellationToken = default) + { + return await DbSet + .FirstOrDefaultAsync(d => d.DeviceCode == deviceCode, GetCancellationToken(cancellationToken)); + } + + public async Task> GetListByExpirationAsync(DateTime maxExpirationDate, int maxResultCount, + CancellationToken cancellationToken = default) + { + return await DbSet + .Where(x => x.Expiration != null && x.Expiration < maxExpirationDate) + .OrderBy(x => x.ClientId) + .Take(maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + } +} diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/AbpIdentityServerEntityFrameworkCoreModule.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/AbpIdentityServerEntityFrameworkCoreModule.cs index 74a4ce754f..a932cd3351 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/AbpIdentityServerEntityFrameworkCoreModule.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/AbpIdentityServerEntityFrameworkCoreModule.cs @@ -2,6 +2,7 @@ using Volo.Abp.EntityFrameworkCore; using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.Clients; +using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; using Volo.Abp.Modularity; @@ -34,6 +35,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore options.AddRepository(); options.AddRepository(); options.AddRepository(); + options.AddRepository(); }); } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs index 3c7f425dc9..52ba7c8e6c 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IIdentityServerDbContext.cs @@ -3,6 +3,7 @@ using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.Clients; +using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; @@ -46,5 +47,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore DbSet ClientProperties { get; set; } DbSet PersistedGrants { get; set; } + + DbSet DeviceFlowCodes { get; set; } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs index 800aa8b8be..f63cd6bf1c 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContext.cs @@ -3,6 +3,7 @@ using Volo.Abp.Data; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.Clients; +using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; @@ -47,6 +48,8 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore public DbSet PersistedGrants { get; set; } + public DbSet DeviceFlowCodes { get; set; } + public IdentityServerDbContext(DbContextOptions options) : base(options) { @@ -56,6 +59,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); + builder.ConfigureIdentityServer(); } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs index bd69f6948f..9f65e4e419 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/EntityFrameworkCore/IdentityServerDbContextModelCreatingExtensions.cs @@ -1,11 +1,13 @@ using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore; -using Newtonsoft.Json; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore.Modeling; +using Volo.Abp.EntityFrameworkCore.ValueComparers; +using Volo.Abp.EntityFrameworkCore.ValueConverters; using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.Clients; +using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; @@ -202,10 +204,8 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore identityResource.Property(x => x.DisplayName).HasMaxLength(IdentityResourceConsts.DisplayNameMaxLength); identityResource.Property(x => x.Description).HasMaxLength(IdentityResourceConsts.DescriptionMaxLength); identityResource.Property(x => x.Properties) - .HasConversion( - d => JsonConvert.SerializeObject(d, Formatting.None), - s => JsonConvert.DeserializeObject>(s) - ); + .HasConversion(new AbpJsonValueConverter>()) + .Metadata.SetValueComparer(new AbpDictionaryValueComparer()); identityResource.HasMany(x => x.UserClaims).WithOne().HasForeignKey(x => x.IdentityResourceId).IsRequired(); }); @@ -229,10 +229,8 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore apiResource.Property(x => x.DisplayName).HasMaxLength(ApiResourceConsts.DisplayNameMaxLength); apiResource.Property(x => x.Description).HasMaxLength(ApiResourceConsts.DescriptionMaxLength); apiResource.Property(x => x.Properties) - .HasConversion( - d => JsonConvert.SerializeObject(d, Formatting.None), - s => JsonConvert.DeserializeObject>(s) - ); + .HasConversion(new AbpJsonValueConverter>()) + .Metadata.SetValueComparer(new AbpDictionaryValueComparer()); apiResource.HasMany(x => x.Secrets).WithOne().HasForeignKey(x => x.ApiResourceId).IsRequired(); apiResource.HasMany(x => x.Scopes).WithOne().HasForeignKey(x => x.ApiResourceId).IsRequired(); @@ -246,6 +244,7 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore apiSecret.HasKey(x => new { x.ApiResourceId, x.Type, x.Value }); apiSecret.Property(x => x.Type).HasMaxLength(SecretConsts.TypeMaxLength).IsRequired(); + apiSecret.Property(x => x.Description).HasMaxLength(SecretConsts.DescriptionMaxLength); if (options.DatabaseProvider == EfCoreDatabaseProvider.MySql) { @@ -255,8 +254,6 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore { apiSecret.Property(x => x.Value).HasMaxLength(SecretConsts.ValueMaxLength).IsRequired(); } - - apiSecret.Property(x => x.Description).HasMaxLength(SecretConsts.DescriptionMaxLength); }); builder.Entity(apiClaim => @@ -290,6 +287,24 @@ namespace Volo.Abp.IdentityServer.EntityFrameworkCore apiScopeClaim.Property(x => x.Type).HasMaxLength(UserClaimConsts.TypeMaxLength).IsRequired(); apiScopeClaim.Property(x => x.Name).HasMaxLength(ApiScopeConsts.NameMaxLength).IsRequired(); }); + + builder.Entity(b => + { + b.ToTable(options.TablePrefix + "DeviceFlowCodes", options.Schema); + + b.ConfigureByConvention(); + + b.Property(x => x.DeviceCode).HasMaxLength(200).IsRequired(); + b.Property(x => x.UserCode).HasMaxLength(200).IsRequired(); + b.Property(x => x.SubjectId).HasMaxLength(200); + b.Property(x => x.ClientId).HasMaxLength(200).IsRequired(); + b.Property(x => x.Expiration).IsRequired(); + b.Property(x => x.Data).HasMaxLength(50000).IsRequired(); + + b.HasIndex(x => new { x.UserCode }).IsUnique(); + b.HasIndex(x => x.DeviceCode).IsUnique(); + b.HasIndex(x => x.Expiration); + }); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Grants/PersistedGrantRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Grants/PersistedGrantRepository.cs index e0af04c53e..76c02d1122 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Grants/PersistedGrantRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Grants/PersistedGrantRepository.cs @@ -12,28 +12,42 @@ namespace Volo.Abp.IdentityServer.Grants { public class PersistentGrantRepository : EfCoreRepository, IPersistentGrantRepository { - public PersistentGrantRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + public PersistentGrantRepository(IDbContextProvider dbContextProvider) + : base(dbContextProvider) { } - public Task FindByKeyAsync( + public async Task FindByKeyAsync( string key, CancellationToken cancellationToken = default) { - return DbSet - .FirstOrDefaultAsync(x => x.Key == key, GetCancellationToken(cancellationToken)); + return await DbSet + .FirstOrDefaultAsync(x => x.Key == key, GetCancellationToken(cancellationToken)) + ; } - public Task> GetListBySubjectIdAsync( + public async Task> GetListBySubjectIdAsync( string subjectId, CancellationToken cancellationToken = default) { - return DbSet + return await DbSet .Where(x => x.SubjectId == subjectId) .ToListAsync(GetCancellationToken(cancellationToken)); } + public async Task> GetListByExpirationAsync( + DateTime maxExpirationDate, + int maxResultCount, + CancellationToken cancellationToken = default) + { + return await DbSet + .Where(x => x.Expiration != null && x.Expiration < maxExpirationDate) + .OrderBy(x => x.ClientId) + .Take(maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + public async Task DeleteAsync( string subjectId, string clientId, @@ -42,7 +56,7 @@ namespace Volo.Abp.IdentityServer.Grants await DeleteAsync( x => x.SubjectId == subjectId && x.ClientId == clientId, cancellationToken: GetCancellationToken(cancellationToken) - ).ConfigureAwait(false); + ); } public async Task DeleteAsync( @@ -54,7 +68,7 @@ namespace Volo.Abp.IdentityServer.Grants await DeleteAsync( x => x.SubjectId == subjectId && x.ClientId == clientId && x.Type == type, cancellationToken: GetCancellationToken(cancellationToken) - ).ConfigureAwait(false); + ); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs index d5d05c5e9a..20789ecca8 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.IdentityServer.IdentityResources where scopeNames.Contains(identityResource.Name) select identityResource; - return await query.ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + return await query.ToListAsync(GetCancellationToken(cancellationToken)); } public override IQueryable WithDetails() @@ -43,7 +43,7 @@ namespace Volo.Abp.IdentityServer.IdentityResources .IncludeDetails(includeDetails) .OrderBy(sorting ?? "name desc") .PageBy(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public async Task FindByNameAsync( @@ -54,12 +54,12 @@ namespace Volo.Abp.IdentityServer.IdentityResources return await DbSet .IncludeDetails(includeDetails) .Where(x => x.Name == name) - .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); } public async Task CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) { - return await DbSet.AnyAsync(ir => ir.Id != expectedId && ir.Name == name, cancellationToken: cancellationToken).ConfigureAwait(false); + return await DbSet.AnyAsync(ir => ir.Id != expectedId && ir.Name == name, cancellationToken: cancellationToken); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/FodyWeavers.xml b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/FodyWeavers.xsd b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo.Abp.IdentityServer.MongoDB.csproj b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo.Abp.IdentityServer.MongoDB.csproj index 64ee9f6eee..0fd4cc51cf 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo.Abp.IdentityServer.MongoDB.csproj +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo.Abp.IdentityServer.MongoDB.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs index 16f99b9119..b4b5fe9b60 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContext.cs @@ -2,6 +2,7 @@ using Volo.Abp.Data; using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.Clients; +using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.MongoDB; using IdentityResource = Volo.Abp.IdentityServer.IdentityResources.IdentityResource; @@ -19,6 +20,8 @@ namespace Volo.Abp.IdentityServer.MongoDB public IMongoCollection PersistedGrants => Collection(); + public IMongoCollection DeviceFlowCodes => Collection(); + protected override void CreateModel(IMongoModelBuilder modelBuilder) { base.CreateModel(modelBuilder); diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContextExtensions.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContextExtensions.cs index 474188a0e1..b6a20d842a 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContextExtensions.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbContextExtensions.cs @@ -1,6 +1,7 @@ using System; using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.Clients; +using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; using Volo.Abp.MongoDB; @@ -39,6 +40,11 @@ namespace Volo.Abp.IdentityServer.MongoDB { b.CollectionName = options.CollectionPrefix + "PersistedGrants"; }); + + builder.Entity(b => + { + b.CollectionName = options.CollectionPrefix + "DeviceFlowCodes"; + }); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbModule.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbModule.cs index 1076d19ecf..251378e087 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbModule.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/AbpIdentityServerMongoDbModule.cs @@ -1,4 +1,5 @@ using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.Modularity; using Volo.Abp.MongoDB; @@ -32,6 +33,7 @@ namespace Volo.Abp.IdentityServer.MongoDB options.AddRepository(); options.AddRepository(); options.AddRepository(); + options.AddRepository(); }); } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IAbpIdentityServerMongoDbContext.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IAbpIdentityServerMongoDbContext.cs index cda4718896..3bb21a8198 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IAbpIdentityServerMongoDbContext.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/IAbpIdentityServerMongoDbContext.cs @@ -1,6 +1,7 @@ using MongoDB.Driver; using Volo.Abp.Data; using Volo.Abp.IdentityServer.Clients; +using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; using Volo.Abp.MongoDB; @@ -18,5 +19,7 @@ namespace Volo.Abp.IdentityServer.MongoDB IMongoCollection IdentityResources { get; } IMongoCollection PersistedGrants { get; } + + IMongoCollection DeviceFlowCodes { get; } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs index 008d34f322..45b69c82f7 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.IdentityServer.MongoDB { return await GetMongoQueryable() .Where(ar => ar.Name == name) - .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); } public virtual async Task> GetListByScopesAsync(string[] scopeNames, bool includeDetails = false, @@ -30,7 +30,7 @@ namespace Volo.Abp.IdentityServer.MongoDB { return await GetMongoQueryable() .Where(ar => ar.Scopes.Any(x => scopeNames.Contains(x.Name))) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public virtual async Task> GetListAsync(string sorting, int skipCount, int maxResultCount, bool includeDetails = false, @@ -40,17 +40,17 @@ namespace Volo.Abp.IdentityServer.MongoDB .OrderBy(sorting ?? nameof(ApiResource.Name)) .As>() .PageBy>(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public virtual async Task GetTotalCount() { - return await GetCountAsync().ConfigureAwait(false); + return await GetCountAsync(); } public async Task CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) { - return await GetMongoQueryable().AnyAsync(ar => ar.Id != expectedId && ar.Name == name, cancellationToken: cancellationToken).ConfigureAwait(false); + return await GetMongoQueryable().AnyAsync(ar => ar.Id != expectedId && ar.Name == name, cancellationToken: cancellationToken); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs index 6e371717ba..61488edc3d 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs @@ -26,7 +26,7 @@ namespace Volo.Abp.IdentityServer.MongoDB bool includeDetails = true, CancellationToken cancellationToken = default) { - return await GetMongoQueryable().FirstOrDefaultAsync(x => x.ClientId == clientId, GetCancellationToken(cancellationToken)).ConfigureAwait(false); + return await GetMongoQueryable().FirstOrDefaultAsync(x => x.ClientId == clientId, GetCancellationToken(cancellationToken)); } public virtual async Task> GetListAsync( @@ -40,7 +40,7 @@ namespace Volo.Abp.IdentityServer.MongoDB .OrderBy(sorting ?? nameof(Client.ClientName)) .As>() .PageBy>(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public async Task> GetAllDistinctAllowedCorsOriginsAsync( @@ -50,17 +50,17 @@ namespace Volo.Abp.IdentityServer.MongoDB .SelectMany(x => x.AllowedCorsOrigins) .Select(y => y.Origin) .Distinct() - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public async Task CheckClientIdExistAsync(string clientId, Guid? expectedId = null, CancellationToken cancellationToken = default) { - return await GetMongoQueryable().AnyAsync(c => c.Id != expectedId && c.ClientId == clientId, cancellationToken: cancellationToken).ConfigureAwait(false); + return await GetMongoQueryable().AnyAsync(c => c.Id != expectedId && c.ClientId == clientId, cancellationToken: cancellationToken); } public virtual async Task GetTotalCount() { - return await GetCountAsync().ConfigureAwait(false); + return await GetCountAsync(); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoDeviceFlowCodesRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoDeviceFlowCodesRepository.cs new file mode 100644 index 0000000000..44cb86a744 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoDeviceFlowCodesRepository.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using MongoDB.Driver; +using MongoDB.Driver.Linq; +using Volo.Abp.Domain.Repositories.MongoDB; +using Volo.Abp.IdentityServer.Devices; +using Volo.Abp.MongoDB; + +namespace Volo.Abp.IdentityServer.MongoDB +{ + public class MongoDeviceFlowCodesRepository : + MongoDbRepository, IDeviceFlowCodesRepository + { + public MongoDeviceFlowCodesRepository( + IMongoDbContextProvider dbContextProvider) : base(dbContextProvider) + { + + } + + public async Task FindByUserCodeAsync( + string userCode, + CancellationToken cancellationToken = default) + { + return await GetMongoQueryable() + .FirstOrDefaultAsync(d => d.UserCode == userCode, GetCancellationToken(cancellationToken)) + ; + } + + public async Task FindByDeviceCodeAsync(string deviceCode, CancellationToken cancellationToken = default) + { + return await GetMongoQueryable() + .FirstOrDefaultAsync(d => d.DeviceCode == deviceCode, GetCancellationToken(cancellationToken)); + } + + public async Task> GetListByExpirationAsync( + DateTime maxExpirationDate, + int maxResultCount, + CancellationToken cancellationToken = default) + { + return await GetMongoQueryable() + .Where(x => x.Expiration != null && x.Expiration < maxExpirationDate) + .OrderBy(x => x.ClientId) + .Take(maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + } +} \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs index eefd4d325c..d25faa9622 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs @@ -24,7 +24,7 @@ namespace Volo.Abp.IdentityServer.MongoDB .OrderBy(sorting ?? nameof(IdentityResource.Name)) .As>() .PageBy>(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public async Task FindByNameAsync( @@ -34,7 +34,7 @@ namespace Volo.Abp.IdentityServer.MongoDB { return await GetMongoQueryable() .Where(x => x.Name == name) - .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); } public async Task> GetListByScopesAsync(string[] scopeNames, bool includeDetails = false, @@ -42,17 +42,17 @@ namespace Volo.Abp.IdentityServer.MongoDB { return await GetMongoQueryable() .Where(ar => scopeNames.Contains(ar.Name)) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public virtual async Task GetTotalCountAsync() { - return await GetCountAsync().ConfigureAwait(false); + return await GetCountAsync(); } public async Task CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) { - return await GetMongoQueryable().AnyAsync(ir => ir.Id != expectedId && ir.Name == name, cancellationToken: cancellationToken).ConfigureAwait(false); + return await GetMongoQueryable().AnyAsync(ir => ir.Id != expectedId && ir.Name == name, cancellationToken: cancellationToken); } } } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistedGrantRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistedGrantRepository.cs index 3ee17df174..e63bc27805 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistedGrantRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistedGrantRepository.cs @@ -20,14 +20,25 @@ namespace Volo.Abp.IdentityServer.MongoDB { return await GetMongoQueryable() - .FirstOrDefaultAsync(x => x.Key == key, GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .FirstOrDefaultAsync(x => x.Key == key, GetCancellationToken(cancellationToken)); } public async Task> GetListBySubjectIdAsync(string subjectId, CancellationToken cancellationToken = default) { return await GetMongoQueryable() .Where(x => x.SubjectId == subjectId) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)) + ; + } + + public async Task> GetListByExpirationAsync(DateTime maxExpirationDate, int maxResultCount, + CancellationToken cancellationToken = default) + { + return await GetMongoQueryable() + .Where(x => x.Expiration != null && x.Expiration < maxExpirationDate) + .OrderBy(x => x.ClientId) + .Take(maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); } public async Task DeleteAsync(string subjectId, string clientId, CancellationToken cancellationToken = default) @@ -35,7 +46,7 @@ namespace Volo.Abp.IdentityServer.MongoDB await DeleteAsync( x => x.SubjectId == subjectId && x.ClientId == clientId, cancellationToken: GetCancellationToken(cancellationToken) - ).ConfigureAwait(false); + ); } public async Task DeleteAsync(string subjectId, string clientId, string type, CancellationToken cancellationToken = default) @@ -43,7 +54,7 @@ namespace Volo.Abp.IdentityServer.MongoDB await DeleteAsync( x => x.SubjectId == subjectId && x.ClientId == clientId && x.Type == type, cancellationToken: GetCancellationToken(cancellationToken) - ).ConfigureAwait(false); + ); } } } diff --git a/modules/identityserver/src/Volo.Abp.PermissionManagement.Domain.IdentityServer/FodyWeavers.xml b/modules/identityserver/src/Volo.Abp.PermissionManagement.Domain.IdentityServer/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.PermissionManagement.Domain.IdentityServer/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.PermissionManagement.Domain.IdentityServer/FodyWeavers.xsd b/modules/identityserver/src/Volo.Abp.PermissionManagement.Domain.IdentityServer/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/identityserver/src/Volo.Abp.PermissionManagement.Domain.IdentityServer/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.PermissionManagement.Domain.IdentityServer/Volo.Abp.PermissionManagement.Domain.IdentityServer.csproj b/modules/identityserver/src/Volo.Abp.PermissionManagement.Domain.IdentityServer/Volo.Abp.PermissionManagement.Domain.IdentityServer.csproj index a1579f3f31..e1c009e432 100644 --- a/modules/identityserver/src/Volo.Abp.PermissionManagement.Domain.IdentityServer/Volo.Abp.PermissionManagement.Domain.IdentityServer.csproj +++ b/modules/identityserver/src/Volo.Abp.PermissionManagement.Domain.IdentityServer/Volo.Abp.PermissionManagement.Domain.IdentityServer.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo.Abp.IdentityServer.Domain.Tests.csproj b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo.Abp.IdentityServer.Domain.Tests.csproj index ce12bb92eb..e90296c8ac 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo.Abp.IdentityServer.Domain.Tests.csproj +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo.Abp.IdentityServer.Domain.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/ClientStore_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/ClientStore_Tests.cs index a5b1540a1b..e89f385b57 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/ClientStore_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/ClientStore_Tests.cs @@ -18,7 +18,7 @@ namespace Volo.Abp.IdentityServer.Clients [Fact] public async Task FindClientByIdAsync_Should_Return_Null_If_Not_Found() { - var client = await _clientStore.FindClientByIdAsync("non-existing-id").ConfigureAwait(false); + var client = await _clientStore.FindClientByIdAsync("non-existing-id"); client.ShouldBeNull(); } @@ -26,7 +26,7 @@ namespace Volo.Abp.IdentityServer.Clients public async Task FindClientByIdAsync_Should_Return_The_Client_If_Found() { //Act - var client = await _clientStore.FindClientByIdAsync("42").ConfigureAwait(false); + var client = await _clientStore.FindClientByIdAsync("42"); //Assert client.ShouldNotBeNull(); diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/IdentityResourceStore_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/IdentityResourceStore_Tests.cs index 9e7bdfc99a..a313c2717f 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/IdentityResourceStore_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/IdentityResourceStore_Tests.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.IdentityServer.Clients public async Task FindApiResourceAsync_Should_Return_Null_If_Not_Found() { //Act - var resource = await _resourceStore.FindApiResourceAsync("non-existing-name").ConfigureAwait(false); + var resource = await _resourceStore.FindApiResourceAsync("non-existing-name"); //Assert resource.ShouldBeNull(); @@ -32,7 +32,7 @@ namespace Volo.Abp.IdentityServer.Clients public async Task FindApiResourceAsync_Should_Return_If_Found() { //Act - var apiResource = await _resourceStore.FindApiResourceAsync("Test-ApiResource-Name-1").ConfigureAwait(false); + var apiResource = await _resourceStore.FindApiResourceAsync("Test-ApiResource-Name-1"); //Assert apiResource.ShouldNotBe(null); @@ -48,7 +48,7 @@ namespace Volo.Abp.IdentityServer.Clients var apiResources = (await _resourceStore.FindApiResourcesByScopeAsync(new List { "Test-ApiResource-ApiScope-Name-1" - }).ConfigureAwait(false)).ToList(); + })).ToList(); //Assert apiResources.ShouldNotBe(null); @@ -63,7 +63,7 @@ namespace Volo.Abp.IdentityServer.Clients var identityResourcesByScope = await _resourceStore.FindIdentityResourcesByScopeAsync(new List { "Test-Identity-Resource-Name-1" - }).ConfigureAwait(false); + }); //Assert var resourcesByScope = identityResourcesByScope as IdentityResource[] ?? identityResourcesByScope.ToArray(); @@ -77,7 +77,7 @@ namespace Volo.Abp.IdentityServer.Clients public async Task GetAllResourcesAsync_Should_Return() { //Act - var resources = await _resourceStore.GetAllResourcesAsync().ConfigureAwait(false); + var resources = await _resourceStore.GetAllResourcesAsync(); //Assert resources.ShouldNotBe(null); diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/PersistentGrant_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/PersistentGrant_Tests.cs index 7df9936183..8e83f57c51 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/PersistentGrant_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Clients/PersistentGrant_Tests.cs @@ -21,7 +21,7 @@ namespace Volo.Abp.IdentityServer.Clients [Fact] public async Task FindClientByIdAsync_Should_Return_Null_If_Not_Found() { - var persistentGrant = await _persistedGrantStore.GetAsync("not-existing-id").ConfigureAwait(false); + var persistentGrant = await _persistedGrantStore.GetAsync("not-existing-id"); persistentGrant.ShouldBeNull(); } @@ -29,7 +29,7 @@ namespace Volo.Abp.IdentityServer.Clients public async Task FindPersistentGrantByIdAsync_Should_Return_The_PersistentGrant_If_Found() { //Act - var client = await _persistedGrantStore.GetAsync("38").ConfigureAwait(false); + var client = await _persistedGrantStore.GetAsync("38"); //Assert client.ShouldNotBeNull(); @@ -52,10 +52,10 @@ namespace Volo.Abp.IdentityServer.Clients Data = "TestData-39", Expiration = new DateTime(2018, 1, 6, 21, 22, 23), CreationTime = new DateTime(2018, 1, 5, 19, 20, 21) - }).ConfigureAwait(false); + }); //Assert - var persistedGrant = await _persistedGrantStore.GetAsync("39").ConfigureAwait(false); + var persistedGrant = await _persistedGrantStore.GetAsync("39"); persistedGrant.Key.ShouldBe("39"); persistedGrant.ClientId.ShouldBe("TestClientId-39"); persistedGrant.Type.ShouldBe("TestType-39"); @@ -92,10 +92,10 @@ namespace Volo.Abp.IdentityServer.Clients Data = "TestData-PersistedGrantKey1", Expiration = new DateTime(2018, 1, 6, 21, 22, 23), CreationTime = new DateTime(2018, 1, 5, 19, 20, 21) - }).ConfigureAwait(false); + }); //Assert - var persistedGrant = await _persistedGrantStore.GetAsync("PersistedGrantKey1").ConfigureAwait(false); + var persistedGrant = await _persistedGrantStore.GetAsync("PersistedGrantKey1"); persistedGrant.Key.ShouldBe("PersistedGrantKey1"); persistedGrant.ClientId.ShouldBe("TestClientId-PersistedGrantKey1"); persistedGrant.Type.ShouldBe("TestType-PersistedGrantKey1"); @@ -122,7 +122,7 @@ namespace Volo.Abp.IdentityServer.Clients public async Task GetAllAsync_Should_Get_All_PersistedGrants_For_A_Given_SubjectId() { //Act - var persistentGrants = await _persistedGrantStore.GetAllAsync("TestSubject").ConfigureAwait(false); + var persistentGrants = await _persistedGrantStore.GetAllAsync("TestSubject"); //Assert var persistedGrants = persistentGrants as PersistedGrant[] ?? persistentGrants.ToArray(); @@ -142,13 +142,13 @@ namespace Volo.Abp.IdentityServer.Clients Type = "Type", ClientId = "ClientId", Data = "" - }).ConfigureAwait(false); + }); //Act - await _persistedGrantStore.RemoveAsync("#1P3R").ConfigureAwait(false); + await _persistedGrantStore.RemoveAsync("#1P3R"); //Assert - var persistedGrant = await _persistedGrantStore.GetAsync("#1P3R").ConfigureAwait(false); + var persistedGrant = await _persistedGrantStore.GetAsync("#1P3R"); persistedGrant.ShouldBe(null); } @@ -156,16 +156,16 @@ namespace Volo.Abp.IdentityServer.Clients public async Task RemoveAllAsync_Should_RemoveAll_PeristedGrants_For_A_Given_Subject_And_ClientId() { //Arrange - var persistedGrantsWithTestSubjectX = await _persistedGrantStore.GetAllAsync("TestSubject-X").ConfigureAwait(false); + var persistedGrantsWithTestSubjectX = await _persistedGrantStore.GetAllAsync("TestSubject-X"); var persistedGrantsWithTestSubjectXBeforeLength = persistedGrantsWithTestSubjectX.ToArray().Length; //Act - await _persistedGrantStore.RemoveAllAsync("TestSubject-X", "TestClientId-X").ConfigureAwait(false); + await _persistedGrantStore.RemoveAllAsync("TestSubject-X", "TestClientId-X"); //Assert persistedGrantsWithTestSubjectXBeforeLength.ShouldBe(2); - var persistedGrants = (await _persistedGrantStore.GetAllAsync("TestClientId-37").ConfigureAwait(false)).ToArray(); + var persistedGrants = (await _persistedGrantStore.GetAllAsync("TestClientId-37")).ToArray(); persistedGrants.ShouldNotBe(null); persistedGrants.Length.ShouldBe(0); } diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/CorsPolicyService_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/CorsPolicyService_Tests.cs index cdbea763c6..af701cfc69 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/CorsPolicyService_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/CorsPolicyService_Tests.cs @@ -23,27 +23,27 @@ namespace Volo.Abp.IdentityServer [Fact] public async Task IsOriginAllowedAsync() { - (await _corsPolicyService.IsOriginAllowedAsync("https://client1-origin.com").ConfigureAwait(false)).ShouldBeTrue(); - (await _corsPolicyService.IsOriginAllowedAsync("https://unknown-origin.com").ConfigureAwait(false)).ShouldBeFalse(); + (await _corsPolicyService.IsOriginAllowedAsync("https://client1-origin.com")).ShouldBeTrue(); + (await _corsPolicyService.IsOriginAllowedAsync("https://unknown-origin.com")).ShouldBeFalse(); } [Fact] public async Task IsOriginAllowedAsync_Should_Invalidate_Cache_On_Update() { //It does not exists before - (await _corsPolicyService.IsOriginAllowedAsync("https://new-origin.com").ConfigureAwait(false)).ShouldBeFalse(); + (await _corsPolicyService.IsOriginAllowedAsync("https://new-origin.com")).ShouldBeFalse(); using (var uow = _unitOfWorkManager.Begin()) { - var client1 = await _clientRepository.FindByCliendIdAsync("ClientId1").ConfigureAwait(false); + var client1 = await _clientRepository.FindByCliendIdAsync("ClientId1"); client1.AddCorsOrigin("https://new-origin.com"); - await _clientRepository.UpdateAsync(client1).ConfigureAwait(false); + await _clientRepository.UpdateAsync(client1); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } //It does exists now - (await _corsPolicyService.IsOriginAllowedAsync("https://new-origin.com").ConfigureAwait(false)).ShouldBeTrue(); + (await _corsPolicyService.IsOriginAllowedAsync("https://new-origin.com")).ShouldBeTrue(); } } } diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Devices/DeviceFlowStore_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Devices/DeviceFlowStore_Tests.cs new file mode 100644 index 0000000000..7d4c630de7 --- /dev/null +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Devices/DeviceFlowStore_Tests.cs @@ -0,0 +1,95 @@ +using System.Linq; +using System.Security.Claims; +using System.Threading.Tasks; +using IdentityModel; +using IdentityServer4.Models; +using IdentityServer4.Stores; +using Shouldly; +using Xunit; + +namespace Volo.Abp.IdentityServer.Devices +{ + public class DeviceFlowStore_Tests : AbpIdentityServerTestBase + { + private readonly IDeviceFlowStore _deviceFlowStore; + + public DeviceFlowStore_Tests() + { + _deviceFlowStore = GetRequiredService(); + } + + [Fact] + public async Task StoreDeviceAuthorizationAsync() + { + await _deviceFlowStore.StoreDeviceAuthorizationAsync( + "DeviceCode-Test1", + "UserCode-Test1", + new DeviceCode + { + ClientId = "ClientId1", + AuthorizedScopes = new string[] { "s1", "s2" }, + IsAuthorized = true, + Lifetime = 42, + RequestedScopes = new string[] { "rs1" }, + Subject = new ClaimsPrincipal( + new[] + { + new ClaimsIdentity(new[] + { + new Claim(JwtClaimTypes.Subject, "sid1") + }) + } + ) + } + ); + + void Check(DeviceCode deviceCode) + { + deviceCode.ClientId.ShouldBe("ClientId1"); + deviceCode.AuthorizedScopes.ShouldNotBeNull(); + deviceCode.AuthorizedScopes.Count().ShouldBe(2); + deviceCode.AuthorizedScopes.ShouldContain("s1"); + deviceCode.AuthorizedScopes.ShouldContain("s2"); + deviceCode.IsAuthorized.ShouldBeTrue(); + deviceCode.Lifetime.ShouldBe(42); + deviceCode.RequestedScopes.ShouldNotBeNull(); + deviceCode.RequestedScopes.Count().ShouldBe(1); + deviceCode.RequestedScopes.ShouldContain("rs1"); + deviceCode.Subject.ShouldNotBeNull(); + deviceCode.Subject.Claims.ShouldContain(x => x.Type == JwtClaimTypes.Subject && x.Value == "sid1"); + } + + Check(await _deviceFlowStore.FindByUserCodeAsync("UserCode-Test1")); + Check(await _deviceFlowStore.FindByDeviceCodeAsync("DeviceCode-Test1")); + } + + [Fact] + public async Task RemoveByDeviceCodeAsync() + { + (await _deviceFlowStore.FindByDeviceCodeAsync("DeviceCode1")).ShouldNotBeNull(); + + await _deviceFlowStore.RemoveByDeviceCodeAsync("DeviceCode1"); + + (await _deviceFlowStore.FindByDeviceCodeAsync("DeviceCode1")).ShouldBeNull(); + } + + [Fact] + public async Task UpdateByDeviceCodeAsync() + { + var deviceCode = await _deviceFlowStore.FindByDeviceCodeAsync("DeviceCode1"); + deviceCode.ShouldNotBeNull(); + deviceCode.Lifetime.ShouldBe(42); + + await _deviceFlowStore.UpdateByUserCodeAsync( + "DeviceFlowCodesUserCode1", + new DeviceCode + { + Lifetime = 43 + } + ); + + deviceCode = await _deviceFlowStore.FindByDeviceCodeAsync("DeviceCode1"); + deviceCode.Lifetime.ShouldBe(43); + } + } +} diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Tokens/TokenCleanupService_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Tokens/TokenCleanupService_Tests.cs new file mode 100644 index 0000000000..8de564cc23 --- /dev/null +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.Domain.Tests/Volo/Abp/IdentityServer/Tokens/TokenCleanupService_Tests.cs @@ -0,0 +1,37 @@ +using System.Threading.Tasks; +using Shouldly; +using Volo.Abp.IdentityServer.Devices; +using Volo.Abp.IdentityServer.Grants; +using Xunit; + +namespace Volo.Abp.IdentityServer.Tokens +{ + public class TokenCleanupService_Tests : AbpIdentityServerTestBase + { + private readonly IPersistentGrantRepository _persistentGrantRepository; + private readonly IDeviceFlowCodesRepository _deviceFlowCodesRepository; + private readonly TokenCleanupService _tokenCleanupService; + + public TokenCleanupService_Tests() + { + _persistentGrantRepository = GetRequiredService(); + _deviceFlowCodesRepository = GetRequiredService(); + _tokenCleanupService = GetRequiredService(); + } + + [Fact] + public async Task Should_Clear_Expired_Tokens() + { + var persistentGrantCount = await _persistentGrantRepository.GetCountAsync(); + var deviceFlowCodesCount = await _deviceFlowCodesRepository.GetCountAsync(); + + await _tokenCleanupService.CleanAsync(); + + (await _persistentGrantRepository.GetCountAsync()) + .ShouldBe(persistentGrantCount - 1); + + (await _deviceFlowCodesRepository.GetCountAsync()) + .ShouldBe(deviceFlowCodesCount - 1); + } + } +} diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests.csproj b/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests.csproj index 4876a42c56..f9cdb67d4c 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests.csproj +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs index d7e0716151..0d87a2fd19 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.EntityFrameworkCore.Tests/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs @@ -39,10 +39,10 @@ namespace Volo.Abp.IdentityServer public async Task BuildAsync() { - await AddClients().ConfigureAwait(false); - await AddPersistentGrants().ConfigureAwait(false); - await AddApiResources().ConfigureAwait(false); - await AddIdentityResources().ConfigureAwait(false); + await AddClients(); + await AddPersistentGrants(); + await AddApiResources(); + await AddIdentityResources(); } private async Task AddClients() @@ -56,7 +56,7 @@ namespace Volo.Abp.IdentityServer client42.AddScope("api1"); - await _clientRepository.InsertAsync(client42).ConfigureAwait(false); + await _clientRepository.InsertAsync(client42); } private async Task AddPersistentGrants() @@ -68,7 +68,7 @@ namespace Volo.Abp.IdentityServer Type = "TestType-38", SubjectId = "TestSubject", Data = "TestData-38" - }).ConfigureAwait(false); + }); await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) { @@ -77,7 +77,7 @@ namespace Volo.Abp.IdentityServer Type = "TestType-37", SubjectId = "TestSubject", Data = "TestData-37" - }).ConfigureAwait(false); + }); await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) { @@ -86,7 +86,7 @@ namespace Volo.Abp.IdentityServer Type = "TestType-36", SubjectId = "TestSubject-X", Data = "TestData-36" - }).ConfigureAwait(false); + }); await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) { @@ -95,7 +95,7 @@ namespace Volo.Abp.IdentityServer Type = "TestType-35", SubjectId = "TestSubject-X", Data = "TestData-35" - }).ConfigureAwait(false); + }); } private async Task AddApiResources() @@ -111,7 +111,7 @@ namespace Volo.Abp.IdentityServer apiResource.AddScope("Test-ApiResource-ApiScope-Name-1", "Test-ApiResource-ApiScope-DisplayName-1"); apiResource.AddUserClaim("Test-ApiResource-Claim-Type-1"); - await _apiResourceRepository.InsertAsync(apiResource).ConfigureAwait(false); + await _apiResourceRepository.InsertAsync(apiResource); } private async Task AddIdentityResources() @@ -126,7 +126,7 @@ namespace Volo.Abp.IdentityServer identityResource.AddUserClaim("Test-Identity-Resource-1-IdentityClaim-Type-1"); - await _identityResourceRepository.InsertAsync(identityResource).ConfigureAwait(false); + await _identityResourceRepository.InsertAsync(identityResource); } } } diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.MongoDB.Tests/Volo.Abp.IdentityServer.MongoDB.Tests.csproj b/modules/identityserver/test/Volo.Abp.IdentityServer.MongoDB.Tests/Volo.Abp.IdentityServer.MongoDB.Tests.csproj index 6459a4c307..65e2a1f5c9 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.MongoDB.Tests/Volo.Abp.IdentityServer.MongoDB.Tests.csproj +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.MongoDB.Tests/Volo.Abp.IdentityServer.MongoDB.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo.Abp.IdentityServer.TestBase.csproj b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo.Abp.IdentityServer.TestBase.csproj index c02b7d5c13..d6a6ee9a0c 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo.Abp.IdentityServer.TestBase.csproj +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo.Abp.IdentityServer.TestBase.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs index e1676f2408..c36fef2d58 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/AbpIdentityServerTestDataBuilder.cs @@ -6,8 +6,10 @@ using Volo.Abp.Guids; using Volo.Abp.Identity; using Volo.Abp.IdentityServer.ApiResources; using Volo.Abp.IdentityServer.Clients; +using Volo.Abp.IdentityServer.Devices; using Volo.Abp.IdentityServer.Grants; using Volo.Abp.IdentityServer.IdentityResources; +using Volo.Abp.Timing; namespace Volo.Abp.IdentityServer { @@ -19,7 +21,9 @@ namespace Volo.Abp.IdentityServer private readonly IIdentityResourceRepository _identityResourceRepository; private readonly IIdentityClaimTypeRepository _identityClaimTypeRepository; private readonly IPersistentGrantRepository _persistentGrantRepository; + private readonly IDeviceFlowCodesRepository _deviceFlowCodesRepository; private readonly AbpIdentityServerTestData _testData; + private readonly IClock _clock; public AbpIdentityServerTestDataBuilder( IGuidGenerator guidGenerator, @@ -28,7 +32,9 @@ namespace Volo.Abp.IdentityServer IIdentityResourceRepository identityResourceRepository, IIdentityClaimTypeRepository identityClaimTypeRepository, AbpIdentityServerTestData testData, - IPersistentGrantRepository persistentGrantRepository) + IPersistentGrantRepository persistentGrantRepository, + IDeviceFlowCodesRepository deviceFlowCodesRepository, + IClock clock) { _testData = testData; _guidGenerator = guidGenerator; @@ -37,15 +43,46 @@ namespace Volo.Abp.IdentityServer _identityResourceRepository = identityResourceRepository; _identityClaimTypeRepository = identityClaimTypeRepository; _persistentGrantRepository = persistentGrantRepository; + _clock = clock; + _deviceFlowCodesRepository = deviceFlowCodesRepository; } public async Task BuildAsync() { - await AddPersistedGrants().ConfigureAwait(false); - await AddIdentityResources().ConfigureAwait(false); - await AddApiResources().ConfigureAwait(false); - await AddClients().ConfigureAwait(false); - await AddClaimTypes().ConfigureAwait(false); + await AddDeviceFlowCodes(); + await AddPersistedGrants(); + await AddIdentityResources(); + await AddApiResources(); + await AddClients(); + await AddClaimTypes(); + } + + private async Task AddDeviceFlowCodes() + { + await _deviceFlowCodesRepository.InsertAsync( + new DeviceFlowCodes(_guidGenerator.Create()) + { + ClientId = "c1", + DeviceCode = "DeviceCode1", + Expiration = _clock.Now.AddDays(1), + Data = "{\"Lifetime\":\"42\"}", + UserCode = "DeviceFlowCodesUserCode1", + SubjectId = "DeviceFlowCodesSubjectId1" + } + ); + + await _deviceFlowCodesRepository.InsertAsync( + new DeviceFlowCodes(_guidGenerator.Create()) + { + ClientId = "c1", + DeviceCode = "DeviceCode2", + Expiration = _clock.Now.AddDays(-1), + Data = "", + UserCode = "DeviceFlowCodesUserCode2", + SubjectId = "DeviceFlowCodesSubjectId2" + } + ); + } private async Task AddPersistedGrants() @@ -57,7 +94,7 @@ namespace Volo.Abp.IdentityServer ClientId = "PersistedGrantClientId1", Type = "PersistedGrantType1", Data = "" - }).ConfigureAwait(false); + }); await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) { @@ -66,7 +103,7 @@ namespace Volo.Abp.IdentityServer ClientId = "c1", Type = "c1type", Data = "" - }).ConfigureAwait(false); + }); await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) { @@ -74,8 +111,19 @@ namespace Volo.Abp.IdentityServer SubjectId = "PersistedGrantSubjectId3", ClientId = "c1", Type = "c1type", - Data = "" - }).ConfigureAwait(false); + Data = "", + Expiration = _clock.Now.AddDays(1), + }); + + await _persistentGrantRepository.InsertAsync(new PersistedGrant(_guidGenerator.Create()) + { + Key = "PersistedGrantKey_Expired1", + SubjectId = "PersistedGrantSubjectId_Expired1", + ClientId = "c1", + Type = "c1type", + Data = "", + Expiration = _clock.Now.AddDays(-1) + }); } private async Task AddIdentityResources() @@ -88,9 +136,9 @@ namespace Volo.Abp.IdentityServer identityResource.AddUserClaim(nameof(ApiResourceClaim.Type)); - await _identityResourceRepository.InsertAsync(identityResource).ConfigureAwait(false); - await _identityResourceRepository.InsertAsync(new IdentityResource(_guidGenerator.Create(), "NewIdentityResource2")).ConfigureAwait(false); - await _identityResourceRepository.InsertAsync(new IdentityResource(_guidGenerator.Create(), "NewIdentityResource3")).ConfigureAwait(false); + await _identityResourceRepository.InsertAsync(identityResource); + await _identityResourceRepository.InsertAsync(new IdentityResource(_guidGenerator.Create(), "NewIdentityResource2")); + await _identityResourceRepository.InsertAsync(new IdentityResource(_guidGenerator.Create(), "NewIdentityResource3")); } private async Task AddApiResources() @@ -103,9 +151,9 @@ namespace Volo.Abp.IdentityServer apiResource.AddUserClaim(nameof(ApiResourceClaim.Type)); apiResource.AddSecret(nameof(ApiSecret.Value)); - await _apiResourceRepository.InsertAsync(apiResource).ConfigureAwait(false); - await _apiResourceRepository.InsertAsync(new ApiResource(_guidGenerator.Create(), "NewApiResource2")).ConfigureAwait(false); - await _apiResourceRepository.InsertAsync(new ApiResource(_guidGenerator.Create(), "NewApiResource3")).ConfigureAwait(false); + await _apiResourceRepository.InsertAsync(apiResource); + await _apiResourceRepository.InsertAsync(new ApiResource(_guidGenerator.Create(), "NewApiResource2")); + await _apiResourceRepository.InsertAsync(new ApiResource(_guidGenerator.Create(), "NewApiResource3")); } private async Task AddClients() @@ -130,17 +178,17 @@ namespace Volo.Abp.IdentityServer client.AddScope(nameof(ClientScope.Scope)); client.AddSecret(nameof(ClientSecret.Value)); - await _clientRepository.InsertAsync(client).ConfigureAwait(false); + await _clientRepository.InsertAsync(client); - await _clientRepository.InsertAsync(new Client(_guidGenerator.Create(), "ClientId2")).ConfigureAwait(false); - await _clientRepository.InsertAsync(new Client(_guidGenerator.Create(), "ClientId3")).ConfigureAwait(false); + await _clientRepository.InsertAsync(new Client(_guidGenerator.Create(), "ClientId2")); + await _clientRepository.InsertAsync(new Client(_guidGenerator.Create(), "ClientId3")); } private async Task AddClaimTypes() { var ageClaim = new IdentityClaimType(Guid.NewGuid(), "Age", false, false, null, null, null, IdentityClaimValueType.Int); - await _identityClaimTypeRepository.InsertAsync(ageClaim).ConfigureAwait(false); + await _identityClaimTypeRepository.InsertAsync(ageClaim); } } } diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ApiResourceRepository_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ApiResourceRepository_Tests.cs index 43b4e9d8f2..b79114c59a 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ApiResourceRepository_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ApiResourceRepository_Tests.cs @@ -20,13 +20,13 @@ namespace Volo.Abp.IdentityServer [Fact] public async Task FindByNormalizedNameAsync() { - (await apiResourceRepository.FindByNameAsync("NewApiResource2").ConfigureAwait(false)).ShouldNotBeNull(); + (await apiResourceRepository.FindByNameAsync("NewApiResource2")).ShouldNotBeNull(); } [Fact] public async Task GetListByScopesAsync() { - (await apiResourceRepository.GetListByScopesAsync(new[] { "NewApiResource2", "NewApiResource3" }).ConfigureAwait(false)).Count.ShouldBe(2); + (await apiResourceRepository.GetListByScopesAsync(new[] { "NewApiResource2", "NewApiResource3" })).Count.ShouldBe(2); } } } diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ClientRepository_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ClientRepository_Tests.cs index 300c1620ff..86f69610f5 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ClientRepository_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/ClientRepository_Tests.cs @@ -21,13 +21,13 @@ namespace Volo.Abp.IdentityServer [Fact] public async Task FindByCliendIdAsync() { - (await clientRepository.FindByCliendIdAsync("ClientId2").ConfigureAwait(false)).ShouldNotBeNull(); + (await clientRepository.FindByCliendIdAsync("ClientId2")).ShouldNotBeNull(); } [Fact] public async Task GetAllDistinctAllowedCorsOriginsAsync() { - var origins = await clientRepository.GetAllDistinctAllowedCorsOriginsAsync().ConfigureAwait(false); + var origins = await clientRepository.GetAllDistinctAllowedCorsOriginsAsync(); origins.Any().ShouldBeTrue(); } } diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/IdentityResourceRepository_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/IdentityResourceRepository_Tests.cs index 2d98fff2a3..3ab47dd7ce 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/IdentityResourceRepository_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/IdentityResourceRepository_Tests.cs @@ -23,7 +23,7 @@ namespace Volo.Abp.IdentityServer [Fact] public async Task GetListByScopesAsync() { - (await identityResourceRepository.GetListByScopesAsync(new[] { "", "NewIdentityResource2" }).ConfigureAwait(false)).Count.ShouldBe(1); + (await identityResourceRepository.GetListByScopesAsync(new[] { "", "NewIdentityResource2" })).Count.ShouldBe(1); } } } diff --git a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/PersistentGrantRepository_Tests.cs b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/PersistentGrantRepository_Tests.cs index 0786af42bc..20f6674515 100644 --- a/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/PersistentGrantRepository_Tests.cs +++ b/modules/identityserver/test/Volo.Abp.IdentityServer.TestBase/Volo/Abp/IdentityServer/PersistentGrantRepository_Tests.cs @@ -22,13 +22,13 @@ namespace Volo.Abp.IdentityServer [Fact] public async Task FindByKeyAsync() { - (await _persistentGrantRepository.FindByKeyAsync("PersistedGrantKey1").ConfigureAwait(false)).ShouldNotBeNull(); + (await _persistentGrantRepository.FindByKeyAsync("PersistedGrantKey1")).ShouldNotBeNull(); } [Fact] public async Task GetListBySubjectIdAsync() { - var persistedGrants = await _persistentGrantRepository.GetListBySubjectIdAsync("PersistedGrantSubjectId1").ConfigureAwait(false); + var persistedGrants = await _persistentGrantRepository.GetListBySubjectIdAsync("PersistedGrantSubjectId1"); persistedGrants.ShouldNotBeEmpty(); persistedGrants.ShouldContain(x => x.Key == "PersistedGrantKey1"); } @@ -36,9 +36,9 @@ namespace Volo.Abp.IdentityServer [Fact] public async Task DeleteBySubjectIdAndClientId() { - await _persistentGrantRepository.DeleteAsync("PersistedGrantSubjectId1", "PersistedGrantClientId1").ConfigureAwait(false); + await _persistentGrantRepository.DeleteAsync("PersistedGrantSubjectId1", "PersistedGrantClientId1"); - var persistedGrants = await _persistentGrantRepository.GetListAsync().ConfigureAwait(false); + var persistedGrants = await _persistentGrantRepository.GetListAsync(); persistedGrants.ShouldNotBeEmpty(); persistedGrants.ShouldNotContain(x => x.Key == "PersistedGrantKey1" && x.SubjectId == "PersistedGrantSubjectId1" && @@ -49,9 +49,9 @@ namespace Volo.Abp.IdentityServer public async Task DeleteBySubjectIdAndClientIdAndType() { await _persistentGrantRepository.DeleteAsync("PersistedGrantSubjectId1", "PersistedGrantClientId1", - "PersistedGrantClientId1").ConfigureAwait(false); + "PersistedGrantClientId1"); - var persistedGrants = await _persistentGrantRepository.GetListAsync().ConfigureAwait(false); + var persistedGrants = await _persistentGrantRepository.GetListAsync(); persistedGrants.ShouldNotBeEmpty(); persistedGrants.ShouldNotContain(x => x.Key == "PersistedGrantKey1" && x.SubjectId == "PersistedGrantSubjectId1" && diff --git a/modules/permission-management/Volo.Abp.PermissionManagement.sln b/modules/permission-management/Volo.Abp.PermissionManagement.sln index 5812918a3c..16071f9e10 100644 --- a/modules/permission-management/Volo.Abp.PermissionManagement.sln +++ b/modules/permission-management/Volo.Abp.PermissionManagement.sln @@ -19,7 +19,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.PermissionManageme EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.PermissionManagement.Web", "src\Volo.Abp.PermissionManagement.Web\Volo.Abp.PermissionManagement.Web.csproj", "{97A386F8-DAE0-4BEA-ADE5-1D57C3336515}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.PermissionManagement.Tests", "test\Volo.Abp.PermissionManagement.Tests\Volo.Abp.PermissionManagement.Tests.csproj", "{48297098-79D0-413B-939C-6C432142C42D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.PermissionManagement.Domain.Tests", "test\Volo.Abp.PermissionManagement.Tests\Volo.Abp.PermissionManagement.Domain.Tests.csproj", "{48297098-79D0-413B-939C-6C432142C42D}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.PermissionManagement.TestBase", "test\Volo.Abp.PermissionManagement.TestBase\Volo.Abp.PermissionManagement.TestBase.csproj", "{49259427-CAEB-4FAE-81E4-848F789487EA}" EndProject @@ -33,7 +33,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.PermissionManageme EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.PermissionManagement.HttpApi.Client", "src\Volo.Abp.PermissionManagement.HttpApi.Client\Volo.Abp.PermissionManagement.HttpApi.Client.csproj", "{1CD80519-9431-48DB-B0EA-291A73FF9F49}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.PermissionManagement.Application.Tests", "test\Volo.Abp.PermissionManagement.Application.Tests\Volo.Abp.PermissionManagement.Application.Tests.csproj", "{A0F72F5F-3713-4E06-ADB7-15ADFDCB79B1}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.PermissionManagement.Application.Tests", "test\Volo.Abp.PermissionManagement.Application.Tests\Volo.Abp.PermissionManagement.Application.Tests.csproj", "{A0F72F5F-3713-4E06-ADB7-15ADFDCB79B1}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/FodyWeavers.xml b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/FodyWeavers.xsd b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo.Abp.PermissionManagement.Application.Contracts.csproj b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo.Abp.PermissionManagement.Application.Contracts.csproj index 9e1d805b8a..8bb01c8fff 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo.Abp.PermissionManagement.Application.Contracts.csproj +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application.Contracts/Volo.Abp.PermissionManagement.Application.Contracts.csproj @@ -1,5 +1,6 @@ + diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application/FodyWeavers.xml b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application/FodyWeavers.xsd b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application/Volo.Abp.PermissionManagement.Application.csproj b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application/Volo.Abp.PermissionManagement.Application.csproj index cd39199733..41a280d054 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application/Volo.Abp.PermissionManagement.Application.csproj +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application/Volo.Abp.PermissionManagement.Application.csproj @@ -1,5 +1,6 @@ + diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application/Volo/Abp/PermissionManagement/PermissionAppService.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application/Volo/Abp/PermissionManagement/PermissionAppService.cs index b9f504b4f1..63065fd688 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Application/Volo/Abp/PermissionManagement/PermissionAppService.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Application/Volo/Abp/PermissionManagement/PermissionAppService.cs @@ -34,7 +34,7 @@ namespace Volo.Abp.PermissionManagement public virtual async Task GetAsync(string providerName, string providerKey) { - await CheckProviderPolicy(providerName).ConfigureAwait(false); + await CheckProviderPolicy(providerName); var result = new GetPermissionListResultDto { @@ -74,7 +74,7 @@ namespace Volo.Abp.PermissionManagement GrantedProviders = new List() }; - var grantInfo = await _permissionManager.GetAsync(permission.Name, providerName, providerKey).ConfigureAwait(false); + var grantInfo = await _permissionManager.GetAsync(permission.Name, providerName, providerKey); grantInfoDto.IsGranted = grantInfo.IsGranted; @@ -101,11 +101,11 @@ namespace Volo.Abp.PermissionManagement public virtual async Task UpdateAsync(string providerName, string providerKey, UpdatePermissionsDto input) { - await CheckProviderPolicy(providerName).ConfigureAwait(false); + await CheckProviderPolicy(providerName); foreach (var permissionDto in input.Permissions) { - await _permissionManager.SetAsync(permissionDto.Name, providerName, providerKey, permissionDto.IsGranted).ConfigureAwait(false); + await _permissionManager.SetAsync(permissionDto.Name, providerName, providerKey, permissionDto.IsGranted); } } @@ -117,7 +117,7 @@ namespace Volo.Abp.PermissionManagement throw new AbpException($"No policy defined to get/set permissions for the provider '{policyName}'. Use {nameof(PermissionManagementOptions)} to map the policy."); } - await AuthorizationService.CheckAsync(policyName).ConfigureAwait(false); + await AuthorizationService.CheckAsync(policyName); } } } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/FodyWeavers.xml b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/FodyWeavers.xsd b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo.Abp.PermissionManagement.Domain.Shared.csproj b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo.Abp.PermissionManagement.Domain.Shared.csproj index ff0ba6fbee..629d9f1742 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo.Abp.PermissionManagement.Domain.Shared.csproj +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo.Abp.PermissionManagement.Domain.Shared.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/zh-Hant.json b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/zh-Hant.json new file mode 100644 index 0000000000..ea109a2dd0 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain.Shared/Volo/Abp/PermissionManagement/Localization/Domain/zh-Hant.json @@ -0,0 +1,10 @@ +{ + "culture": "zh-Hant", + "texts": { + "Permissions": "權限", + "OnlyProviderPermissons": "只有這個提供者", + "All": "全部", + "SelectAllInAllTabs": "授予所有權限", + "SelectAllInThisTab": "全選" + } +} \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/FodyWeavers.xml b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/FodyWeavers.xsd b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo.Abp.PermissionManagement.Domain.csproj b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo.Abp.PermissionManagement.Domain.csproj index 8bfc4e4683..1a44f1f6a1 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo.Abp.PermissionManagement.Domain.csproj +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo.Abp.PermissionManagement.Domain.csproj @@ -1,5 +1,6 @@ + diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IPermissionManager.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IPermissionManager.cs index 888f06235e..26310a12fe 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IPermissionManager.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/IPermissionManager.cs @@ -13,5 +13,7 @@ namespace Volo.Abp.PermissionManagement Task> GetAllAsync([NotNull] string providerName, [NotNull] string providerKey); Task SetAsync(string permissionName, string providerName, string providerKey, bool isGranted); + + Task UpdateProviderKeyAsync(PermissionGrant permissionGrant, string providerKey); } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionDataSeeder.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionDataSeeder.cs index 451b9fadbf..80062f528d 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionDataSeeder.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionDataSeeder.cs @@ -40,7 +40,7 @@ namespace Volo.Abp.PermissionManagement providerKey, tenantId ) - ).ConfigureAwait(false); + ); } } } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionGrant.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionGrant.cs index 7ec99fbe3a..4f951a92cc 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionGrant.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionGrant.cs @@ -17,7 +17,7 @@ namespace Volo.Abp.PermissionManagement public virtual string ProviderName { get; protected set; } [CanBeNull] - public virtual string ProviderKey { get; protected set; } + public virtual string ProviderKey { get; protected internal set; } protected PermissionGrant() { diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionGrantCacheItemInvalidator.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionGrantCacheItemInvalidator.cs index 46badf093a..9e73e59b79 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionGrantCacheItemInvalidator.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionGrantCacheItemInvalidator.cs @@ -29,7 +29,7 @@ namespace Volo.Abp.PermissionManagement using (CurrentTenant.Change(eventData.Entity.TenantId)) { - await Cache.RemoveAsync(cacheKey).ConfigureAwait(false); + await Cache.RemoveAsync(cacheKey); } } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManagementProvider.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManagementProvider.cs index 9cca1277d5..0b83f37fd1 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManagementProvider.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManagementProvider.cs @@ -46,7 +46,7 @@ namespace Volo.Abp.PermissionManagement protected virtual async Task GrantAsync(string name, string providerKey) { - var permissionGrant = await PermissionGrantRepository.FindAsync(name, Name, providerKey).ConfigureAwait(false); + var permissionGrant = await PermissionGrantRepository.FindAsync(name, Name, providerKey); if (permissionGrant != null) { return; @@ -60,18 +60,18 @@ namespace Volo.Abp.PermissionManagement providerKey, CurrentTenant.Id ) - ).ConfigureAwait(false); + ); } protected virtual async Task RevokeAsync(string name, string providerKey) { - var permissionGrant = await PermissionGrantRepository.FindAsync(name, Name, providerKey).ConfigureAwait(false); + var permissionGrant = await PermissionGrantRepository.FindAsync(name, Name, providerKey); if (permissionGrant == null) { return; } - await PermissionGrantRepository.DeleteAsync(permissionGrant).ConfigureAwait(false); + await PermissionGrantRepository.DeleteAsync(permissionGrant); } } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManager.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManager.cs index d7d1dd70c1..3607a57f4b 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManager.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionManager.cs @@ -52,7 +52,7 @@ namespace Volo.Abp.PermissionManagement public async Task GetAsync(string permissionName, string providerName, string providerKey) { - return await GetInternalAsync(PermissionDefinitionManager.Get(permissionName), providerName, providerKey).ConfigureAwait(false); + return await GetInternalAsync(PermissionDefinitionManager.Get(permissionName), providerName, providerKey); } public async Task> GetAllAsync(string providerName, string providerKey) @@ -61,7 +61,7 @@ namespace Volo.Abp.PermissionManagement foreach (var permissionDefinition in PermissionDefinitionManager.GetPermissions()) { - results.Add(await GetInternalAsync(permissionDefinition, providerName, providerKey).ConfigureAwait(false)); + results.Add(await GetInternalAsync(permissionDefinition, providerName, providerKey)); } return results; @@ -83,7 +83,7 @@ namespace Volo.Abp.PermissionManagement throw new ApplicationException($"The permission named '{permission.Name}' has multitenancy side '{permission.MultiTenancySide}' which is not compatible with the current multitenancy side '{CurrentTenant.GetMultiTenancySide()}'"); } - var currentGrantInfo = await GetInternalAsync(permission, providerName, providerKey).ConfigureAwait(false); + var currentGrantInfo = await GetInternalAsync(permission, providerName, providerKey); if (currentGrantInfo.IsGranted == isGranted) { return; @@ -96,7 +96,13 @@ namespace Volo.Abp.PermissionManagement throw new AbpException("Unknown permission management provider: " + providerName); } - await provider.SetAsync(permissionName, providerKey, isGranted).ConfigureAwait(false); + await provider.SetAsync(permissionName, providerKey, isGranted); + } + + public async Task UpdateProviderKeyAsync(PermissionGrant permissionGrant, string providerKey) + { + permissionGrant.ProviderKey = providerKey; + return await PermissionGrantRepository.UpdateAsync(permissionGrant); } protected virtual async Task GetInternalAsync(PermissionDefinition permission, string providerName, string providerKey) @@ -115,7 +121,7 @@ namespace Volo.Abp.PermissionManagement foreach (var provider in ManagementProviders) { - var providerResult = await provider.CheckAsync(permission.Name, providerName, providerKey).ConfigureAwait(false); + var providerResult = await provider.CheckAsync(permission.Name, providerName, providerKey); if (providerResult.IsGranted) { result.IsGranted = true; diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionStore.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionStore.cs index 0d594007e8..744dc19c8e 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionStore.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Domain/Volo/Abp/PermissionManagement/PermissionStore.cs @@ -26,7 +26,7 @@ namespace Volo.Abp.PermissionManagement public async Task IsGrantedAsync(string name, string providerName, string providerKey) { - return (await GetCacheItemAsync(name, providerName, providerKey).ConfigureAwait(false)).IsGranted; + return (await GetCacheItemAsync(name, providerName, providerKey)).IsGranted; } protected virtual async Task GetCacheItemAsync(string name, string providerName, string providerKey) @@ -35,7 +35,7 @@ namespace Volo.Abp.PermissionManagement Logger.LogDebug($"PermissionStore.GetCacheItemAsync: {cacheKey}"); - var cacheItem = await Cache.GetAsync(cacheKey).ConfigureAwait(false); + var cacheItem = await Cache.GetAsync(cacheKey); if (cacheItem != null) { @@ -55,7 +55,7 @@ namespace Volo.Abp.PermissionManagement await Cache.SetAsync( cacheKey, cacheItem - ).ConfigureAwait(false); + ); Logger.LogDebug($"Finished setting the cache item: {cacheKey}"); diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/FodyWeavers.xml b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/FodyWeavers.xsd b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo.Abp.PermissionManagement.EntityFrameworkCore.csproj b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo.Abp.PermissionManagement.EntityFrameworkCore.csproj index c13b3da80b..0b9ac8acd8 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo.Abp.PermissionManagement.EntityFrameworkCore.csproj +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo.Abp.PermissionManagement.EntityFrameworkCore.csproj @@ -1,9 +1,10 @@ - + + - netstandard2.1 + netstandard2.0 Volo.Abp.PermissionManagement.EntityFrameworkCore Volo.Abp.PermissionManagement.EntityFrameworkCore $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/EfCorePermissionGrantRepository.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/EfCorePermissionGrantRepository.cs index 8663e8026a..d8241d6f8f 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/EfCorePermissionGrantRepository.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/EfCorePermissionGrantRepository.cs @@ -30,7 +30,7 @@ namespace Volo.Abp.PermissionManagement.EntityFrameworkCore s.ProviderName == providerName && s.ProviderKey == providerKey, GetCancellationToken(cancellationToken) - ).ConfigureAwait(false); + ); } public async Task> GetListAsync( @@ -42,7 +42,7 @@ namespace Volo.Abp.PermissionManagement.EntityFrameworkCore .Where(s => s.ProviderName == providerName && s.ProviderKey == providerKey - ).ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + ).ToListAsync(GetCancellationToken(cancellationToken)); } } } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/FodyWeavers.xml b/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/FodyWeavers.xsd b/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/Volo.Abp.PermissionManagement.HttpApi.Client.csproj b/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/Volo.Abp.PermissionManagement.HttpApi.Client.csproj index c634f59f65..8360442b75 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/Volo.Abp.PermissionManagement.HttpApi.Client.csproj +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi.Client/Volo.Abp.PermissionManagement.HttpApi.Client.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi/FodyWeavers.xml b/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi/FodyWeavers.xsd b/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi/Volo.Abp.PermissionManagement.HttpApi.csproj b/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi/Volo.Abp.PermissionManagement.HttpApi.csproj index 2411e5cf47..a41a82b330 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi/Volo.Abp.PermissionManagement.HttpApi.csproj +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi/Volo.Abp.PermissionManagement.HttpApi.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/FodyWeavers.xml b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/FodyWeavers.xsd b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo.Abp.PermissionManagement.MongoDB.csproj b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo.Abp.PermissionManagement.MongoDB.csproj index 53ad2adde2..4dd5b952f4 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo.Abp.PermissionManagement.MongoDB.csproj +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo.Abp.PermissionManagement.MongoDB.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/MongoPermissionGrantRepository.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/MongoPermissionGrantRepository.cs index bc2f5ef5d9..67befaa717 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/MongoPermissionGrantRepository.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/MongoPermissionGrantRepository.cs @@ -29,7 +29,7 @@ namespace Volo.Abp.PermissionManagement.MongoDB s.ProviderName == providerName && s.ProviderKey == providerKey, GetCancellationToken(cancellationToken) - ).ConfigureAwait(false); + ); } public async Task> GetListAsync( @@ -41,7 +41,7 @@ namespace Volo.Abp.PermissionManagement.MongoDB .Where(s => s.ProviderName == providerName && s.ProviderKey == providerKey - ).ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + ).ToListAsync(GetCancellationToken(cancellationToken)); } } } \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/FodyWeavers.xml b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/FodyWeavers.xsd b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs index fe01aa6618..70ec393455 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs @@ -42,7 +42,7 @@ namespace Volo.Abp.PermissionManagement.Web.Pages.AbpPermissionManagement { ValidateModel(); - var result = await _permissionAppService.GetAsync(ProviderName, ProviderKey).ConfigureAwait(false); + var result = await _permissionAppService.GetAsync(ProviderName, ProviderKey); EntityDisplayName = result.EntityDisplayName; @@ -84,7 +84,7 @@ namespace Volo.Abp.PermissionManagement.Web.Pages.AbpPermissionManagement { Permissions = updatePermissionDtos } - ).ConfigureAwait(false); + ); return NoContent(); } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Volo.Abp.PermissionManagement.Web.csproj b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Volo.Abp.PermissionManagement.Web.csproj index 1bf27e1ddc..2c1e0b290d 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Volo.Abp.PermissionManagement.Web.csproj +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Volo.Abp.PermissionManagement.Web.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo.Abp.PermissionManagement.Application.Tests.csproj b/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo.Abp.PermissionManagement.Application.Tests.csproj index 92cd6ddd5d..e7fde2be87 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo.Abp.PermissionManagement.Application.Tests.csproj +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo.Abp.PermissionManagement.Application.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -10,7 +10,7 @@ - + diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/PermissionAppService_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/PermissionAppService_Tests.cs index d610eede6e..e6240a34b2 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/PermissionAppService_Tests.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Application.Tests/Volo/Abp/PermissionManagement/PermissionAppService_Tests.cs @@ -24,7 +24,7 @@ namespace Volo.Abp.PermissionManagement.Application.Tests.Volo.Abp.PermissionMan public async Task GetAsync() { var permissionListResultDto = await _permissionAppService.GetAsync(UserPermissionValueProvider.ProviderName, - PermissionTestDataBuilder.User1Id.ToString()).ConfigureAwait(false); + PermissionTestDataBuilder.User1Id.ToString()); permissionListResultDto.ShouldNotBeNull(); permissionListResultDto.EntityDisplayName.ShouldBe(PermissionTestDataBuilder.User1Id.ToString()); @@ -43,7 +43,7 @@ namespace Volo.Abp.PermissionManagement.Application.Tests.Volo.Abp.PermissionMan public async Task UpdateAsync() { (await _permissionGrantRepository.FindAsync("MyPermission1", "Test", - "Test").ConfigureAwait(false)).ShouldBeNull(); + "Test")).ShouldBeNull(); await _permissionAppService.UpdateAsync("Test", "Test", new UpdatePermissionsDto() @@ -56,10 +56,10 @@ namespace Volo.Abp.PermissionManagement.Application.Tests.Volo.Abp.PermissionMan Name = "MyPermission1" } } - }).ConfigureAwait(false); + }); (await _permissionGrantRepository.FindAsync("MyPermission1", "Test", - "Test").ConfigureAwait(false)).ShouldNotBeNull(); + "Test")).ShouldNotBeNull(); } [Fact] @@ -67,14 +67,14 @@ namespace Volo.Abp.PermissionManagement.Application.Tests.Volo.Abp.PermissionMan { await _permissionGrantRepository.InsertAsync( new PermissionGrant( - Guid.NewGuid(), + Guid.NewGuid(), "MyPermission1", "Test", "Test" ) - ).ConfigureAwait(false); + ); (await _permissionGrantRepository.FindAsync("MyPermission1", "Test", - "Test").ConfigureAwait(false)).ShouldNotBeNull(); + "Test")).ShouldNotBeNull(); await _permissionAppService.UpdateAsync("Test", "Test", new UpdatePermissionsDto() @@ -87,10 +87,10 @@ namespace Volo.Abp.PermissionManagement.Application.Tests.Volo.Abp.PermissionMan Name = "MyPermission1" } } - }).ConfigureAwait(false); + }); (await _permissionGrantRepository.FindAsync("MyPermission1", "Test", - "Test").ConfigureAwait(false)).ShouldBeNull(); + "Test")).ShouldBeNull(); } } } diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.EntityFrameworkCore.Tests/Volo.Abp.PermissionManagement.EntityFrameworkCore.Tests.csproj b/modules/permission-management/test/Volo.Abp.PermissionManagement.EntityFrameworkCore.Tests/Volo.Abp.PermissionManagement.EntityFrameworkCore.Tests.csproj index c3e5d1d750..3736c5651e 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.EntityFrameworkCore.Tests/Volo.Abp.PermissionManagement.EntityFrameworkCore.Tests.csproj +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.EntityFrameworkCore.Tests/Volo.Abp.PermissionManagement.EntityFrameworkCore.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -21,4 +21,4 @@ - \ No newline at end of file + diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.MongoDB.Tests/Volo.Abp.PermissionManagement.MongoDB.Tests.csproj b/modules/permission-management/test/Volo.Abp.PermissionManagement.MongoDB.Tests/Volo.Abp.PermissionManagement.MongoDB.Tests.csproj index 1f66b07cf5..2e688fd5e6 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.MongoDB.Tests/Volo.Abp.PermissionManagement.MongoDB.Tests.csproj +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.MongoDB.Tests/Volo.Abp.PermissionManagement.MongoDB.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -21,4 +21,4 @@ - \ No newline at end of file + diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo.Abp.PermissionManagement.TestBase.csproj b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo.Abp.PermissionManagement.TestBase.csproj index ba8c20e337..bdaa26deea 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo.Abp.PermissionManagement.TestBase.csproj +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo.Abp.PermissionManagement.TestBase.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -26,4 +26,4 @@ - \ No newline at end of file + diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionGrantRepository_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionGrantRepository_Tests.cs index 217b81361b..e27be7e426 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionGrantRepository_Tests.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionGrantRepository_Tests.cs @@ -19,16 +19,16 @@ namespace Volo.Abp.PermissionManagement [Fact] public async Task FindAsync() { - (await PermissionGrantRepository.FindAsync("MyPermission1", UserPermissionValueProvider.ProviderName, PermissionTestDataBuilder.User1Id.ToString()).ConfigureAwait(false)).ShouldNotBeNull(); + (await PermissionGrantRepository.FindAsync("MyPermission1", UserPermissionValueProvider.ProviderName, PermissionTestDataBuilder.User1Id.ToString())).ShouldNotBeNull(); - (await PermissionGrantRepository.FindAsync("Undefined-Permission", UserPermissionValueProvider.ProviderName, PermissionTestDataBuilder.User1Id.ToString()).ConfigureAwait(false)).ShouldBeNull(); - (await PermissionGrantRepository.FindAsync("MyPermission1", "Undefined-Provider", "Unknown-Id").ConfigureAwait(false)).ShouldBeNull(); + (await PermissionGrantRepository.FindAsync("Undefined-Permission", UserPermissionValueProvider.ProviderName, PermissionTestDataBuilder.User1Id.ToString())).ShouldBeNull(); + (await PermissionGrantRepository.FindAsync("MyPermission1", "Undefined-Provider", "Unknown-Id")).ShouldBeNull(); } [Fact] public async Task GetListAsync() { - var permissionGrants = await PermissionGrantRepository.GetListAsync(UserPermissionValueProvider.ProviderName, PermissionTestDataBuilder.User1Id.ToString()).ConfigureAwait(false); + var permissionGrants = await PermissionGrantRepository.GetListAsync(UserPermissionValueProvider.ProviderName, PermissionTestDataBuilder.User1Id.ToString()); permissionGrants.ShouldContain(p => p.Name == "MyPermission1"); } diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionTestDataBuilder.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionTestDataBuilder.cs index d6e89741c4..662d0b17c8 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionTestDataBuilder.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.TestBase/Volo/Abp/PermissionManagement/PermissionTestDataBuilder.cs @@ -29,7 +29,7 @@ namespace Volo.Abp.PermissionManagement UserPermissionValueProvider.ProviderName, User1Id.ToString() ) - ).ConfigureAwait(false); + ); await _permissionGrantRepository.InsertAsync( new PermissionGrant( @@ -38,7 +38,7 @@ namespace Volo.Abp.PermissionManagement UserPermissionValueProvider.ProviderName, User1Id.ToString() ) - ).ConfigureAwait(false); + ); } } } \ No newline at end of file diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo.Abp.PermissionManagement.Tests.csproj b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo.Abp.PermissionManagement.Domain.Tests.csproj similarity index 95% rename from modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo.Abp.PermissionManagement.Tests.csproj rename to modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo.Abp.PermissionManagement.Domain.Tests.csproj index c9a10af869..4177b1b4dd 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo.Abp.PermissionManagement.Tests.csproj +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo.Abp.PermissionManagement.Domain.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -21,4 +21,4 @@ - \ No newline at end of file + diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionChecker_Basic_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionChecker_Basic_Tests.cs index b2125dbf02..1fb52c13a1 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionChecker_Basic_Tests.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionChecker_Basic_Tests.cs @@ -19,13 +19,13 @@ namespace Volo.Abp.PermissionManagement { await Assert.ThrowsAsync(async () => await _permissionChecker.IsGrantedAsync("UndefinedPermissionName") -.ConfigureAwait(false)).ConfigureAwait(false); + ); } [Fact] public async Task Should_Return_False_As_Default_For_Any_Permission() { - (await _permissionChecker.IsGrantedAsync("MyPermission1").ConfigureAwait(false)).ShouldBeFalse(); + (await _permissionChecker.IsGrantedAsync("MyPermission1")).ShouldBeFalse(); } } } diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionChecker_User_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionChecker_User_Tests.cs index 2a6f59af82..b49ff94f90 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionChecker_User_Tests.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionChecker_User_Tests.cs @@ -23,7 +23,7 @@ namespace Volo.Abp.PermissionManagement (await _permissionChecker.IsGrantedAsync( CreatePrincipal(PermissionTestDataBuilder.User1Id), "MyPermission1" - ).ConfigureAwait(false)).ShouldBeTrue(); + )).ShouldBeTrue(); } [Fact] @@ -32,7 +32,7 @@ namespace Volo.Abp.PermissionManagement (await _permissionChecker.IsGrantedAsync( CreatePrincipal(PermissionTestDataBuilder.User2Id), "MyPermission1" - ).ConfigureAwait(false)).ShouldBeFalse(); + )).ShouldBeFalse(); } [Fact] @@ -41,7 +41,7 @@ namespace Volo.Abp.PermissionManagement (await _permissionChecker.IsGrantedAsync( CreatePrincipal(null), "MyPermission1" - ).ConfigureAwait(false)).ShouldBeFalse(); + )).ShouldBeFalse(); } [Fact] @@ -50,7 +50,7 @@ namespace Volo.Abp.PermissionManagement (await _permissionChecker.IsGrantedAsync( CreatePrincipal(PermissionTestDataBuilder.User1Id, Guid.NewGuid()), "MyPermission3" - ).ConfigureAwait(false)).ShouldBeFalse(); + )).ShouldBeFalse(); } private static ClaimsPrincipal CreatePrincipal(Guid? userId, Guid? tenantId = null) diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionDataSeeder_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionDataSeeder_Tests.cs index 32ee6ff1cf..6868421a8a 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionDataSeeder_Tests.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionDataSeeder_Tests.cs @@ -21,17 +21,17 @@ namespace Volo.Abp.PermissionManagement [Fact] public async Task SeedAsync() { - (await _grantpermissionGrantRepository.FindAsync("MyPermission1", "Test", "Test").ConfigureAwait(false)).ShouldBeNull(); - (await _grantpermissionGrantRepository.FindAsync("MyPermission2", "Test", "Test").ConfigureAwait(false)).ShouldBeNull(); + (await _grantpermissionGrantRepository.FindAsync("MyPermission1", "Test", "Test")).ShouldBeNull(); + (await _grantpermissionGrantRepository.FindAsync("MyPermission2", "Test", "Test")).ShouldBeNull(); await _permissionDataSeeder.SeedAsync("Test", "Test", new List() { "MyPermission1", "MyPermission2" - }).ConfigureAwait(false); + }); - (await _grantpermissionGrantRepository.FindAsync("MyPermission1", "Test", "Test").ConfigureAwait(false)).ShouldNotBeNull(); - (await _grantpermissionGrantRepository.FindAsync("MyPermission2", "Test", "Test").ConfigureAwait(false)).ShouldNotBeNull(); + (await _grantpermissionGrantRepository.FindAsync("MyPermission1", "Test", "Test")).ShouldNotBeNull(); + (await _grantpermissionGrantRepository.FindAsync("MyPermission2", "Test", "Test")).ShouldNotBeNull(); } } diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionGrantCacheItemInvalidator_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionGrantCacheItemInvalidator_Tests.cs index 7148fe9191..9d4248bb5a 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionGrantCacheItemInvalidator_Tests.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionGrantCacheItemInvalidator_Tests.cs @@ -28,17 +28,17 @@ namespace Volo.Abp.PermissionManagement { (await _cache.GetAsync(PermissionGrantCacheItem.CalculateCacheKey("MyPermission1", UserPermissionValueProvider.ProviderName, - PermissionTestDataBuilder.User1Id.ToString())).ConfigureAwait(false)).ShouldBeNull(); + PermissionTestDataBuilder.User1Id.ToString()))).ShouldBeNull(); await _permissionStore.IsGrantedAsync("MyPermission1", UserPermissionValueProvider.ProviderName, - PermissionTestDataBuilder.User1Id.ToString()).ConfigureAwait(false); + PermissionTestDataBuilder.User1Id.ToString()); (await _cache.GetAsync(PermissionGrantCacheItem.CalculateCacheKey("MyPermission1", UserPermissionValueProvider.ProviderName, - PermissionTestDataBuilder.User1Id.ToString())).ConfigureAwait(false)).ShouldNotBeNull(); + PermissionTestDataBuilder.User1Id.ToString()))).ShouldNotBeNull(); } [Fact] @@ -47,17 +47,17 @@ namespace Volo.Abp.PermissionManagement // IsGrantedAsync will cache PermissionGrant await _permissionStore.IsGrantedAsync("MyPermission1", UserPermissionValueProvider.ProviderName, - PermissionTestDataBuilder.User1Id.ToString()).ConfigureAwait(false); + PermissionTestDataBuilder.User1Id.ToString()); var permissionGrant = await _permissionGrantRepository.FindAsync("MyPermission1", UserPermissionValueProvider.ProviderName, - PermissionTestDataBuilder.User1Id.ToString()).ConfigureAwait(false); + PermissionTestDataBuilder.User1Id.ToString()); permissionGrant.ShouldNotBeNull(); - await _permissionGrantRepository.DeleteAsync(permissionGrant).ConfigureAwait(false); + await _permissionGrantRepository.DeleteAsync(permissionGrant); (await _cache.GetAsync(PermissionGrantCacheItem.CalculateCacheKey("MyPermission1", UserPermissionValueProvider.ProviderName, - PermissionTestDataBuilder.User1Id.ToString())).ConfigureAwait(false)).ShouldBeNull(); + PermissionTestDataBuilder.User1Id.ToString()))).ShouldBeNull(); } } } diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionManagementProvider_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionManagementProvider_Tests.cs index 1cbab007e3..aac1272ccd 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionManagementProvider_Tests.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionManagementProvider_Tests.cs @@ -29,11 +29,11 @@ namespace Volo.Abp.PermissionManagement "Test", "Test" ) - ).ConfigureAwait(false); + ); var permissionValueProviderGrantInfo = await _permissionManagementProvider.CheckAsync("MyPermission1", "Test", - "Test").ConfigureAwait(false); + "Test"); permissionValueProviderGrantInfo.IsGranted.ShouldBeTrue(); permissionValueProviderGrantInfo.ProviderKey.ShouldBe("Test"); @@ -44,7 +44,7 @@ namespace Volo.Abp.PermissionManagement { var permissionValueProviderGrantInfo = await _permissionManagementProvider.CheckAsync("MyPermission1", "TestNotExist", - "Test").ConfigureAwait(false); + "Test"); permissionValueProviderGrantInfo.IsGranted.ShouldBeFalse(); permissionValueProviderGrantInfo.ProviderKey.ShouldBeNull(); @@ -61,18 +61,18 @@ namespace Volo.Abp.PermissionManagement "Test", "Test" ) - ).ConfigureAwait(false); + ); (await _permissionGrantRepository.FindAsync("MyPermission1", "Test", - "Test").ConfigureAwait(false)).ShouldNotBeNull(); + "Test")).ShouldNotBeNull(); await _permissionManagementProvider.SetAsync("MyPermission1", "Test", - false).ConfigureAwait(false); + false); (await _permissionGrantRepository.FindAsync("MyPermission1", "Test", - "Test").ConfigureAwait(false)).ShouldBeNull(); + "Test")).ShouldBeNull(); } } diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionManager_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionManager_Tests.cs index 6b838a4fc0..07d279ec9d 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionManager_Tests.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionManager_Tests.cs @@ -28,11 +28,11 @@ namespace Volo.Abp.PermissionManagement "MyPermission1", "Test", "Test") - ).ConfigureAwait(false); + ); var grantedProviders = await _permissionManager.GetAsync("MyPermission1", "Test", - "Test").ConfigureAwait(false); + "Test"); grantedProviders.ShouldNotBeNull(); grantedProviders.IsGranted.ShouldBeTrue(); @@ -46,7 +46,7 @@ namespace Volo.Abp.PermissionManagement await Assert.ThrowsAsync(async () => await _permissionManager.GetAsync( "MyPermission1NotExist", "Test", - "Test").ConfigureAwait(false)).ConfigureAwait(false); + "Test")); } [Fact] @@ -57,18 +57,18 @@ namespace Volo.Abp.PermissionManagement "MyPermission1", "Test", "Test") - ).ConfigureAwait(false); + ); await _permissionGrantRepository.InsertAsync(new PermissionGrant( Guid.NewGuid(), "MyPermission2", "Test", "Test") - ).ConfigureAwait(false); + ); var permissionWithGrantedProviders = await _permissionManager.GetAllAsync( "Test", - "Test").ConfigureAwait(false); + "Test"); permissionWithGrantedProviders.ShouldNotBeNull(); permissionWithGrantedProviders.ShouldContain(x => @@ -82,16 +82,16 @@ namespace Volo.Abp.PermissionManagement { (await _permissionGrantRepository.FindAsync("MyPermission2", "Test", - "Test").ConfigureAwait(false)).ShouldBeNull(); + "Test")).ShouldBeNull(); await _permissionManager.SetAsync( "MyPermission2", "Test", - "Test", true).ConfigureAwait(false); + "Test", true); (await _permissionGrantRepository.FindAsync("MyPermission2", "Test", - "Test").ConfigureAwait(false)).ShouldNotBeNull(); + "Test")).ShouldNotBeNull(); } [Fact] @@ -101,8 +101,23 @@ namespace Volo.Abp.PermissionManagement "MyPermission1NotExist", "Test", "Test", - true).ConfigureAwait(false)).ConfigureAwait(false); + true)); } + [Fact] + public async Task UpdateProviderKey() + { + await _permissionGrantRepository.InsertAsync(new PermissionGrant( + Guid.NewGuid(), + "MyPermission1", + "Test", + "Test") + ); + var permissionGrant = await _permissionGrantRepository.FindAsync("MyPermission1", "Test", "Test"); + permissionGrant.ProviderKey.ShouldBe("Test"); + + await _permissionManager.UpdateProviderKeyAsync(permissionGrant, "NewProviderKey"); + (await _permissionGrantRepository.FindAsync("MyPermission1", "Test", "NewProviderKey")).ShouldNotBeNull(); + } } } diff --git a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionStore_Tests.cs b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionStore_Tests.cs index f82b541e27..965899ede9 100644 --- a/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionStore_Tests.cs +++ b/modules/permission-management/test/Volo.Abp.PermissionManagement.Tests/Volo/Abp/PermissionManagement/PermissionStore_Tests.cs @@ -22,12 +22,12 @@ namespace Volo.Abp.PermissionManagement { (await _permissionStore.IsGrantedAsync("MyPermission1", UserPermissionValueProvider.ProviderName, - PermissionTestDataBuilder.User1Id.ToString()).ConfigureAwait(false)).ShouldBeTrue(); + PermissionTestDataBuilder.User1Id.ToString())).ShouldBeTrue(); (await _permissionStore.IsGrantedAsync("MyPermission1NotExist", UserPermissionValueProvider.ProviderName, - PermissionTestDataBuilder.User1Id.ToString()).ConfigureAwait(false)).ShouldBeFalse(); + PermissionTestDataBuilder.User1Id.ToString())).ShouldBeFalse(); } } diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain.Shared/FodyWeavers.xml b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain.Shared/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain.Shared/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain.Shared/FodyWeavers.xsd b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain.Shared/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain.Shared/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain.Shared/Volo.Abp.SettingManagement.Domain.Shared.csproj b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain.Shared/Volo.Abp.SettingManagement.Domain.Shared.csproj index 8de8ec1923..406ef82aba 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain.Shared/Volo.Abp.SettingManagement.Domain.Shared.csproj +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain.Shared/Volo.Abp.SettingManagement.Domain.Shared.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain.Shared/Volo/Abp/SettingManagement/Localization/Resources/AbpSettingManagement/zh-Hant.json b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain.Shared/Volo/Abp/SettingManagement/Localization/Resources/AbpSettingManagement/zh-Hant.json new file mode 100644 index 0000000000..f8f55c38cb --- /dev/null +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain.Shared/Volo/Abp/SettingManagement/Localization/Resources/AbpSettingManagement/zh-Hant.json @@ -0,0 +1,7 @@ +{ + "culture": "zh-Hant", + "texts": { + "Settings": "設置", + "SuccessfullySaved": "保存成功" + } +} \ No newline at end of file diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/FodyWeavers.xml b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/FodyWeavers.xsd b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo.Abp.SettingManagement.Domain.csproj b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo.Abp.SettingManagement.Domain.csproj index 8345be068a..8b0ced6f97 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo.Abp.SettingManagement.Domain.csproj +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo.Abp.SettingManagement.Domain.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingCacheItemInvalidator.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingCacheItemInvalidator.cs index 419d0febcd..35d358a67d 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingCacheItemInvalidator.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingCacheItemInvalidator.cs @@ -23,7 +23,7 @@ namespace Volo.Abp.SettingManagement eventData.Entity.ProviderKey ); - await Cache.RemoveAsync(cacheKey).ConfigureAwait(false); + await Cache.RemoveAsync(cacheKey); } protected virtual string CalculateCacheKey(string name, string providerName, string providerKey) diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManagementProvider.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManagementProvider.cs index b7410490f5..2859b2e7f4 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManagementProvider.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManagementProvider.cs @@ -17,17 +17,17 @@ namespace Volo.Abp.SettingManagement public async Task GetOrNullAsync(SettingDefinition setting, string providerKey) { - return await SettingManagementStore.GetOrNullAsync(setting.Name, Name, NormalizeProviderKey(providerKey)).ConfigureAwait(false); + return await SettingManagementStore.GetOrNullAsync(setting.Name, Name, NormalizeProviderKey(providerKey)); } public virtual async Task SetAsync(SettingDefinition setting, string value, string providerKey) { - await SettingManagementStore.SetAsync(setting.Name, value, Name, NormalizeProviderKey(providerKey)).ConfigureAwait(false); + await SettingManagementStore.SetAsync(setting.Name, value, Name, NormalizeProviderKey(providerKey)); } public virtual async Task ClearAsync(SettingDefinition setting, string providerKey) { - await SettingManagementStore.DeleteAsync(setting.Name, Name, NormalizeProviderKey(providerKey)).ConfigureAwait(false); + await SettingManagementStore.DeleteAsync(setting.Name, Name, NormalizeProviderKey(providerKey)); } protected virtual string NormalizeProviderKey(string providerKey) diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManagementStore.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManagementStore.cs index 622ea4a705..8c9cfc8684 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManagementStore.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManagementStore.cs @@ -26,58 +26,58 @@ namespace Volo.Abp.SettingManagement public async Task GetOrNullAsync(string name, string providerName, string providerKey) { - var cacheItem = await GetCacheItemAsync(name, providerName, providerKey).ConfigureAwait(false); + var cacheItem = await GetCacheItemAsync(name, providerName, providerKey); return cacheItem.Value; } public async Task SetAsync(string name, string value, string providerName, string providerKey) { - var setting = await SettingRepository.FindAsync(name, providerName, providerKey).ConfigureAwait(false); + var setting = await SettingRepository.FindAsync(name, providerName, providerKey); if (setting == null) { setting = new Setting(GuidGenerator.Create(), name, value, providerName, providerKey); - await SettingRepository.InsertAsync(setting).ConfigureAwait(false); + await SettingRepository.InsertAsync(setting); } else { setting.Value = value; - await SettingRepository.UpdateAsync(setting).ConfigureAwait(false); + await SettingRepository.UpdateAsync(setting); } } public async Task> GetListAsync(string providerName, string providerKey) { - var settings = await SettingRepository.GetListAsync(providerName, providerKey).ConfigureAwait(false); + var settings = await SettingRepository.GetListAsync(providerName, providerKey); return settings.Select(s => new SettingValue(s.Name, s.Value)).ToList(); } public async Task DeleteAsync(string name, string providerName, string providerKey) { - var setting = await SettingRepository.FindAsync(name, providerName, providerKey).ConfigureAwait(false); + var setting = await SettingRepository.FindAsync(name, providerName, providerKey); if (setting != null) { - await SettingRepository.DeleteAsync(setting).ConfigureAwait(false); + await SettingRepository.DeleteAsync(setting); } } protected virtual async Task GetCacheItemAsync(string name, string providerName, string providerKey) { var cacheKey = CalculateCacheKey(name, providerName, providerKey); - var cacheItem = await Cache.GetAsync(cacheKey).ConfigureAwait(false); + var cacheItem = await Cache.GetAsync(cacheKey); if (cacheItem != null) { return cacheItem; } - var setting = await SettingRepository.FindAsync(name, providerName, providerKey).ConfigureAwait(false); + var setting = await SettingRepository.FindAsync(name, providerName, providerKey); cacheItem = new SettingCacheItem(setting?.Value); await Cache.SetAsync( cacheKey, cacheItem - ).ConfigureAwait(false); + ); return cacheItem; } diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManager.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManager.cs index e5cdcb4466..cfb4cccbe3 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManager.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Domain/Volo/Abp/SettingManagement/SettingManager.cs @@ -79,7 +79,7 @@ namespace Volo.Abp.SettingManagement var providerValue = await provider.GetOrNullAsync( setting, provider.Name == providerName ? providerKey : null - ).ConfigureAwait(false); + ); if (providerValue != null) { value = providerValue; @@ -91,7 +91,7 @@ namespace Volo.Abp.SettingManagement value = await providerList[0].GetOrNullAsync( setting, providerKey - ).ConfigureAwait(false); + ); } if (setting.IsEncrypted) @@ -132,7 +132,7 @@ namespace Volo.Abp.SettingManagement if (providers.Count > 1 && !forceToSet && setting.IsInherited && value != null) { - var fallbackValue = await GetOrNullInternalAsync(name, providers[1].Name, null).ConfigureAwait(false); + var fallbackValue = await GetOrNullInternalAsync(name, providers[1].Name, null); if (fallbackValue == value) { //Clear the value if it's same as it's fallback value @@ -148,14 +148,14 @@ namespace Volo.Abp.SettingManagement { foreach (var provider in providers) { - await provider.ClearAsync(setting, providerKey).ConfigureAwait(false); + await provider.ClearAsync(setting, providerKey); } } else { foreach (var provider in providers) { - await provider.SetAsync(setting, value, providerKey).ConfigureAwait(false); + await provider.SetAsync(setting, value, providerKey); } } } @@ -182,7 +182,7 @@ namespace Volo.Abp.SettingManagement value = await provider.GetOrNullAsync( setting, provider.Name == providerName ? providerKey : null - ).ConfigureAwait(false); + ); if (value != null) { diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/FodyWeavers.xml b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/FodyWeavers.xsd b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo.Abp.SettingManagement.EntityFrameworkCore.csproj b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo.Abp.SettingManagement.EntityFrameworkCore.csproj index f5e1761cc5..8f389e8391 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo.Abp.SettingManagement.EntityFrameworkCore.csproj +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo.Abp.SettingManagement.EntityFrameworkCore.csproj @@ -1,9 +1,10 @@ - + + - netstandard2.1 + netstandard2.0 Volo.Abp.SettingManagement.EntityFrameworkCore Volo.Abp.SettingManagement.EntityFrameworkCore $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/EfCoreSettingRepository.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/EfCoreSettingRepository.cs index bd848ce076..86b31036d1 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/EfCoreSettingRepository.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/EfCoreSettingRepository.cs @@ -20,7 +20,7 @@ namespace Volo.Abp.SettingManagement.EntityFrameworkCore return await DbSet .FirstOrDefaultAsync( s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey - ).ConfigureAwait(false); + ); } public async Task> GetListAsync(string providerName, string providerKey) @@ -28,7 +28,7 @@ namespace Volo.Abp.SettingManagement.EntityFrameworkCore return await DbSet .Where( s => s.ProviderName == providerName && s.ProviderKey == providerKey - ).ToListAsync().ConfigureAwait(false); + ).ToListAsync(); } } } diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/FodyWeavers.xml b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/FodyWeavers.xsd b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo.Abp.SettingManagement.MongoDB.csproj b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo.Abp.SettingManagement.MongoDB.csproj index 8f068d1f12..84c98c6981 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo.Abp.SettingManagement.MongoDB.csproj +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo.Abp.SettingManagement.MongoDB.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/MongoSettingRepository.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/MongoSettingRepository.cs index e08c099eaa..56516dcbd0 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/MongoSettingRepository.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.MongoDB/Volo/Abp/SettingManagement/MongoDB/MongoSettingRepository.cs @@ -18,12 +18,12 @@ namespace Volo.Abp.SettingManagement.MongoDB public async Task FindAsync(string name, string providerName, string providerKey) { - return await GetMongoQueryable().FirstOrDefaultAsync(s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey).ConfigureAwait(false); + return await GetMongoQueryable().FirstOrDefaultAsync(s => s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey); } public async Task> GetListAsync(string providerName, string providerKey) { - return await GetMongoQueryable().Where(s => s.ProviderName == providerName && s.ProviderKey == providerKey).ToListAsync().ConfigureAwait(false); + return await GetMongoQueryable().Where(s => s.ProviderName == providerName && s.ProviderKey == providerKey).ToListAsync(); } } } \ No newline at end of file diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/FodyWeavers.xml b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/FodyWeavers.xsd b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Navigation/SettingManagementMainMenuContributor.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Navigation/SettingManagementMainMenuContributor.cs index 1dc8030bd8..8aee74c56c 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Navigation/SettingManagementMainMenuContributor.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Navigation/SettingManagementMainMenuContributor.cs @@ -23,7 +23,7 @@ namespace Volo.Abp.SettingManagement.Web.Navigation var settingPageCreationContext = new SettingPageCreationContext(context.ServiceProvider); if ( !settingManagementPageOptions.Contributors.Any() || - !(await CheckAnyOfPagePermissionsGranted(settingManagementPageOptions, settingPageCreationContext).ConfigureAwait(false)) + !(await CheckAnyOfPagePermissionsGranted(settingManagementPageOptions, settingPageCreationContext)) ) { return; @@ -49,7 +49,7 @@ namespace Volo.Abp.SettingManagement.Web.Navigation { foreach (var contributor in settingManagementPageOptions.Contributors) { - if (await contributor.CheckPermissionsAsync(settingPageCreationContext).ConfigureAwait(false)) + if (await contributor.CheckPermissionsAsync(settingPageCreationContext)) { return true; } diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.cshtml.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.cshtml.cs index 401d845039..1fdba05707 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.cshtml.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Index.cshtml.cs @@ -26,7 +26,7 @@ namespace Volo.Abp.SettingManagement.Web.Pages.SettingManagement foreach (var contributor in _options.Contributors) { - await contributor.ConfigureAsync(SettingPageCreationContext).ConfigureAwait(false); + await contributor.ConfigureAsync(SettingPageCreationContext); } } } diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Volo.Abp.SettingManagement.Web.csproj b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Volo.Abp.SettingManagement.Web.csproj index 854fedf853..cbf526e751 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Volo.Abp.SettingManagement.Web.csproj +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Volo.Abp.SettingManagement.Web.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/setting-management/test/Volo.Abp.SettingManagement.EntityFrameworkCore.Tests/Volo.Abp.SettingManagement.EntityFrameworkCore.Tests.csproj b/modules/setting-management/test/Volo.Abp.SettingManagement.EntityFrameworkCore.Tests/Volo.Abp.SettingManagement.EntityFrameworkCore.Tests.csproj index 1a04328983..5cfcd5f3ff 100644 --- a/modules/setting-management/test/Volo.Abp.SettingManagement.EntityFrameworkCore.Tests/Volo.Abp.SettingManagement.EntityFrameworkCore.Tests.csproj +++ b/modules/setting-management/test/Volo.Abp.SettingManagement.EntityFrameworkCore.Tests/Volo.Abp.SettingManagement.EntityFrameworkCore.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/setting-management/test/Volo.Abp.SettingManagement.MongoDB.Tests/Volo.Abp.SettingManagement.MongoDB.Tests.csproj b/modules/setting-management/test/Volo.Abp.SettingManagement.MongoDB.Tests/Volo.Abp.SettingManagement.MongoDB.Tests.csproj index 791758698d..2e2ab114e4 100644 --- a/modules/setting-management/test/Volo.Abp.SettingManagement.MongoDB.Tests/Volo.Abp.SettingManagement.MongoDB.Tests.csproj +++ b/modules/setting-management/test/Volo.Abp.SettingManagement.MongoDB.Tests/Volo.Abp.SettingManagement.MongoDB.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo.Abp.SettingManagement.TestBase.csproj b/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo.Abp.SettingManagement.TestBase.csproj index 75f44e1ca3..d6511ec8cf 100644 --- a/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo.Abp.SettingManagement.TestBase.csproj +++ b/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo.Abp.SettingManagement.TestBase.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingRepository_Tests.cs b/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingRepository_Tests.cs index 6d8be6fe8a..5dad99a0ca 100644 --- a/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingRepository_Tests.cs +++ b/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingRepository_Tests.cs @@ -26,25 +26,25 @@ namespace Volo.Abp.SettingManagement "MySetting1", GlobalSettingValueProvider.ProviderName, null - ).ConfigureAwait(false)).Value.ShouldBe("42"); + )).Value.ShouldBe("42"); (await SettingRepository.FindAsync( "MySetting2", UserSettingValueProvider.ProviderName, TestData.User1Id.ToString() - ).ConfigureAwait(false)).Value.ShouldBe("user1-store-value"); + )).Value.ShouldBe("user1-store-value"); (await SettingRepository.FindAsync( "Undefined-Setting", GlobalSettingValueProvider.ProviderName, null - ).ConfigureAwait(false)).ShouldBeNull(); + )).ShouldBeNull(); } [Fact] public async Task GetListAsync() { - var settings = await SettingRepository.GetListAsync(GlobalSettingValueProvider.ProviderName, null).ConfigureAwait(false); + var settings = await SettingRepository.GetListAsync(GlobalSettingValueProvider.ProviderName, null); settings.Any().ShouldBeTrue(); settings.ShouldContain(s => s.Name == "MySetting1" && s.Value == "42"); settings.ShouldContain(s => s.Name == "MySetting2" && s.Value == "default-store-value"); diff --git a/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingTestDataBuilder.cs b/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingTestDataBuilder.cs index d89111bd82..a4a0b32a03 100644 --- a/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingTestDataBuilder.cs +++ b/modules/setting-management/test/Volo.Abp.SettingManagement.TestBase/Volo/Abp/SettingManagement/SettingTestDataBuilder.cs @@ -30,7 +30,7 @@ namespace Volo.Abp.SettingManagement "42", GlobalSettingValueProvider.ProviderName ) - ).ConfigureAwait(false); + ); await _settingRepository.InsertAsync( new Setting( @@ -39,7 +39,7 @@ namespace Volo.Abp.SettingManagement "default-store-value", GlobalSettingValueProvider.ProviderName ) - ).ConfigureAwait(false); + ); await _settingRepository.InsertAsync( new Setting( @@ -49,7 +49,7 @@ namespace Volo.Abp.SettingManagement UserSettingValueProvider.ProviderName, _testData.User1Id.ToString() ) - ).ConfigureAwait(false); + ); await _settingRepository.InsertAsync( new Setting( @@ -59,7 +59,7 @@ namespace Volo.Abp.SettingManagement UserSettingValueProvider.ProviderName, _testData.User2Id.ToString() ) - ).ConfigureAwait(false); + ); await _settingRepository.InsertAsync( new Setting( @@ -68,7 +68,7 @@ namespace Volo.Abp.SettingManagement "default-store-value", GlobalSettingValueProvider.ProviderName ) - ).ConfigureAwait(false); + ); await _settingRepository.InsertAsync( new Setting( @@ -78,7 +78,7 @@ namespace Volo.Abp.SettingManagement UserSettingValueProvider.ProviderName, _testData.User1Id.ToString() ) - ).ConfigureAwait(false); + ); } } } \ No newline at end of file diff --git a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo.Abp.SettingManagement.Tests.csproj b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo.Abp.SettingManagement.Tests.csproj index 7f99e1ae2c..ea519cf662 100644 --- a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo.Abp.SettingManagement.Tests.csproj +++ b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo.Abp.SettingManagement.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/DefaultValueSettingManagementProvider_Tests.cs b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/DefaultValueSettingManagementProvider_Tests.cs index 216ebf6283..20263a73c9 100644 --- a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/DefaultValueSettingManagementProvider_Tests.cs +++ b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/DefaultValueSettingManagementProvider_Tests.cs @@ -21,7 +21,7 @@ namespace Volo.Abp.SettingManagement var defaultValueSettingManagementProvider = new DefaultValueSettingManagementProvider(); (await defaultValueSettingManagementProvider - .GetOrNullAsync(mySetting3, DefaultValueSettingValueProvider.ProviderName).ConfigureAwait(false)).ShouldBe("123"); + .GetOrNullAsync(mySetting3, DefaultValueSettingValueProvider.ProviderName)).ShouldBe("123"); } [Fact] @@ -30,7 +30,7 @@ namespace Volo.Abp.SettingManagement var mySetting3 = _settingDefinitionManager.Get("MySetting3"); await Assert.ThrowsAsync(async () => await new DefaultValueSettingManagementProvider().SetAsync(mySetting3, "123", - DefaultValueSettingValueProvider.ProviderName).ConfigureAwait(false)).ConfigureAwait(false); + DefaultValueSettingValueProvider.ProviderName)); } [Fact] @@ -40,7 +40,7 @@ namespace Volo.Abp.SettingManagement await Assert.ThrowsAsync(async () => await new DefaultValueSettingManagementProvider().ClearAsync(mySetting3, - DefaultValueSettingValueProvider.ProviderName).ConfigureAwait(false)).ConfigureAwait(false); + DefaultValueSettingValueProvider.ProviderName)); } } } diff --git a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingCacheItemInvalidator_Tests.cs b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingCacheItemInvalidator_Tests.cs index cf2c610b79..4a501f58e8 100644 --- a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingCacheItemInvalidator_Tests.cs +++ b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingCacheItemInvalidator_Tests.cs @@ -29,9 +29,9 @@ namespace Volo.Abp.SettingManagement public async Task GetOrNullAsync_Should_Cached() { // Act - (await _cache.GetAsync(SettingCacheItem.CalculateCacheKey("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString())).ConfigureAwait(false)).ShouldBeNull(); - await _settingManagementStore.GetOrNullAsync("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()).ConfigureAwait(false); - (await _cache.GetAsync(SettingCacheItem.CalculateCacheKey("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString())).ConfigureAwait(false)).ShouldNotBeNull(); + (await _cache.GetAsync(SettingCacheItem.CalculateCacheKey("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()))).ShouldBeNull(); + await _settingManagementStore.GetOrNullAsync("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()); + (await _cache.GetAsync(SettingCacheItem.CalculateCacheKey("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()))).ShouldNotBeNull(); } [Fact] @@ -39,15 +39,15 @@ namespace Volo.Abp.SettingManagement { // Arrange // GetOrNullAsync will cache language. - await _settingManagementStore.GetOrNullAsync("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()).ConfigureAwait(false); + await _settingManagementStore.GetOrNullAsync("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()); // Act - var lang = await _settingRepository.FindAsync("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()).ConfigureAwait(false); - await _settingRepository.DeleteAsync(lang).ConfigureAwait(false); + var lang = await _settingRepository.FindAsync("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()); + await _settingRepository.DeleteAsync(lang); // Assert (await _cache.GetAsync( - SettingCacheItem.CalculateCacheKey("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString())).ConfigureAwait(false)).ShouldBeNull(); + SettingCacheItem.CalculateCacheKey("MySetting2", UserSettingValueProvider.ProviderName, _testData.User1Id.ToString()))).ShouldBeNull(); } [Fact] @@ -60,15 +60,14 @@ namespace Volo.Abp.SettingManagement // GetOrNullAsync will cache language. await _settingManagementStore .GetOrNullAsync("MySetting2", GlobalSettingValueProvider.ProviderName, null) - .ConfigureAwait(false); + ; } using (_currentTenant.Change(null)) { // SetAsync will make cache invalid. await _settingManagementStore - .SetAsync("MySetting2", "MySetting2Value", GlobalSettingValueProvider.ProviderName, null) - .ConfigureAwait(false); + .SetAsync("MySetting2", "MySetting2Value", GlobalSettingValueProvider.ProviderName, null); } using (_currentTenant.Change(tenantId)) @@ -76,7 +75,7 @@ namespace Volo.Abp.SettingManagement // Assert (await _cache.GetAsync( SettingCacheItem.CalculateCacheKey("MySetting2", GlobalSettingValueProvider.ProviderName, null)) - .ConfigureAwait(false)).ShouldBeNull(); + ).ShouldBeNull(); } } } diff --git a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManagementStore_Tests.cs b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManagementStore_Tests.cs index 99ca9e70da..753ba15054 100644 --- a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManagementStore_Tests.cs +++ b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManagementStore_Tests.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.SettingManagement public async Task GetOrNull_NotExist_Should_Be_Null() { var value = await _settingManagementStore.GetOrNullAsync("notExistName", "notExistProviderName", - "notExistProviderKey").ConfigureAwait(false); + "notExistProviderKey"); value.ShouldBeNull(); } @@ -33,7 +33,7 @@ namespace Volo.Abp.SettingManagement [Fact] public async Task GetOrNullAsync() { - var value = await _settingManagementStore.GetOrNullAsync("MySetting1", GlobalSettingValueProvider.ProviderName, null).ConfigureAwait(false); + var value = await _settingManagementStore.GetOrNullAsync("MySetting1", GlobalSettingValueProvider.ProviderName, null); value.ShouldNotBeNull(); value.ShouldBe("42"); @@ -42,22 +42,22 @@ namespace Volo.Abp.SettingManagement [Fact] public async Task SetAsync() { - var setting = await _settingRepository.FindAsync(_testData.SettingId).ConfigureAwait(false); + var setting = await _settingRepository.FindAsync(_testData.SettingId); setting.Value.ShouldBe("42"); - await _settingManagementStore.SetAsync("MySetting1", "43", GlobalSettingValueProvider.ProviderName, null).ConfigureAwait(false); + await _settingManagementStore.SetAsync("MySetting1", "43", GlobalSettingValueProvider.ProviderName, null); - (await _settingRepository.FindAsync(_testData.SettingId).ConfigureAwait(false)).Value.ShouldBe("43"); + (await _settingRepository.FindAsync(_testData.SettingId)).Value.ShouldBe("43"); } [Fact] public async Task DeleteAsync() { - (await _settingRepository.FindAsync(_testData.SettingId).ConfigureAwait(false)).ShouldNotBeNull(); + (await _settingRepository.FindAsync(_testData.SettingId)).ShouldNotBeNull(); - await _settingManagementStore.DeleteAsync("MySetting1", GlobalSettingValueProvider.ProviderName, null).ConfigureAwait(false); + await _settingManagementStore.DeleteAsync("MySetting1", GlobalSettingValueProvider.ProviderName, null); - (await _settingRepository.FindAsync(_testData.SettingId).ConfigureAwait(false)).ShouldBeNull(); + (await _settingRepository.FindAsync(_testData.SettingId)).ShouldBeNull(); } } diff --git a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManager_Basic_Tests.cs b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManager_Basic_Tests.cs index b9efa5640f..1dafc31570 100644 --- a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManager_Basic_Tests.cs +++ b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManager_Basic_Tests.cs @@ -21,26 +21,26 @@ namespace Volo.Abp.SettingManagement { await Assert.ThrowsAsync( async () => await _settingProvider.GetOrNullAsync("UndefinedSetting") -.ConfigureAwait(false)).ConfigureAwait(false); + ); } [Fact] public async Task Should_Get_Default_Value_If_Not_Set_In_Store() { - var value = await _settingProvider.GetOrNullAsync("SettingNotSetInStore").ConfigureAwait(false); + var value = await _settingProvider.GetOrNullAsync("SettingNotSetInStore"); value.ShouldBe("default-value"); } [Fact] public async Task Should_Get_Base_Store_Value() { - (await _settingProvider.GetOrNullAsync("MySetting1").ConfigureAwait(false)).ShouldBe("42"); + (await _settingProvider.GetOrNullAsync("MySetting1")).ShouldBe("42"); } [Fact] public async Task Should_Get_All_Base_Store_Values() { - var settingValues = await _settingProvider.GetAllAsync().ConfigureAwait(false); + var settingValues = await _settingProvider.GetAllAsync(); settingValues.ShouldContain(sv => sv.Name == "MySetting1" && sv.Value == "42"); settingValues.ShouldContain(sv => sv.Name == "MySetting2" && sv.Value == "default-store-value"); settingValues.ShouldContain(sv => sv.Name == "SettingNotSetInStore" && sv.Value == "default-value"); @@ -49,10 +49,10 @@ namespace Volo.Abp.SettingManagement [Fact] public async Task Should_Set_Global_Value() { - await _settingManager.SetGlobalAsync("MySetting1", "43").ConfigureAwait(false); + await _settingManager.SetGlobalAsync("MySetting1", "43"); - (await _settingManager.GetOrNullGlobalAsync("MySetting1").ConfigureAwait(false)).ShouldBe("43"); - (await _settingProvider.GetOrNullAsync("MySetting1").ConfigureAwait(false)).ShouldBe("43"); + (await _settingManager.GetOrNullGlobalAsync("MySetting1")).ShouldBe("43"); + (await _settingProvider.GetOrNullAsync("MySetting1")).ShouldBe("43"); } } } diff --git a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManager_User_Tests.cs b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManager_User_Tests.cs index d49ca823f1..4b42572f0a 100644 --- a/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManager_User_Tests.cs +++ b/modules/setting-management/test/Volo.Abp.SettingManagement.Tests/Volo/Abp/SettingManagement/SettingManager_User_Tests.cs @@ -35,67 +35,67 @@ namespace Volo.Abp.SettingManagement [Fact] public async Task Should_Get_From_Store_For_Given_User() { - (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User1Id).ConfigureAwait(false)).ShouldBe("user1-store-value"); - (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User2Id).ConfigureAwait(false)).ShouldBe("user2-store-value"); + (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User1Id)).ShouldBe("user1-store-value"); + (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User2Id)).ShouldBe("user2-store-value"); } [Fact] public async Task Should_Fallback_To_Default_Store_Value_When_No_Value_For_Given_User() { - (await _settingManager.GetOrNullForUserAsync("MySetting2", Guid.NewGuid()).ConfigureAwait(false)).ShouldBe("default-store-value"); + (await _settingManager.GetOrNullForUserAsync("MySetting2", Guid.NewGuid())).ShouldBe("default-store-value"); } [Fact] public async Task Should_Not_Fallback_To_Default_Store_Value_When_No_Value_For_Given_User_But_Specified_Fallback_As_False() { - (await _settingManager.GetOrNullForUserAsync("MySetting2", Guid.NewGuid(), fallback: false).ConfigureAwait(false)).ShouldBeNull(); + (await _settingManager.GetOrNullForUserAsync("MySetting2", Guid.NewGuid(), fallback: false)).ShouldBeNull(); } [Fact] public async Task Should_Get_From_Store_For_Current_User() { _currentUserId = _testData.User1Id; - (await _settingProvider.GetOrNullAsync("MySetting2").ConfigureAwait(false)).ShouldBe("user1-store-value"); + (await _settingProvider.GetOrNullAsync("MySetting2")).ShouldBe("user1-store-value"); _currentUserId = _testData.User2Id; - (await _settingProvider.GetOrNullAsync("MySetting2").ConfigureAwait(false)).ShouldBe("user2-store-value"); + (await _settingProvider.GetOrNullAsync("MySetting2")).ShouldBe("user2-store-value"); } [Fact] public async Task Should_Fallback_To_Default_Store_Value_When_No_Value_For_Current_User() { _currentUserId = Guid.NewGuid(); - (await _settingProvider.GetOrNullAsync("MySetting2").ConfigureAwait(false)).ShouldBe("default-store-value"); + (await _settingProvider.GetOrNullAsync("MySetting2")).ShouldBe("default-store-value"); } [Fact] public async Task Should_Get_From_Store_For_Current_User_With_GetOrNullForCurrentUserAsync() { _currentUserId = _testData.User1Id; - (await _settingManager.GetOrNullForCurrentUserAsync("MySetting2").ConfigureAwait(false)).ShouldBe("user1-store-value"); + (await _settingManager.GetOrNullForCurrentUserAsync("MySetting2")).ShouldBe("user1-store-value"); _currentUserId = _testData.User2Id; - (await _settingManager.GetOrNullForCurrentUserAsync("MySetting2").ConfigureAwait(false)).ShouldBe("user2-store-value"); + (await _settingManager.GetOrNullForCurrentUserAsync("MySetting2")).ShouldBe("user2-store-value"); } [Fact] public async Task Should_Fallback_To_Default_Store_Value_When_No_Value_For_Current_User_With_GetOrNullForCurrentUserAsync() { _currentUserId = Guid.NewGuid(); - (await _settingProvider.GetOrNullAsync("MySetting2").ConfigureAwait(false)).ShouldBe("default-store-value"); + (await _settingProvider.GetOrNullAsync("MySetting2")).ShouldBe("default-store-value"); } [Fact] public async Task Should_Not_Fallback_To_Default_Store_Value_When_No_Value_For_Current_User_But_Specified_Fallback_As_False() { _currentUserId = Guid.NewGuid(); - (await _settingManager.GetOrNullForCurrentUserAsync("MySetting2", fallback: false).ConfigureAwait(false)).ShouldBeNull(); + (await _settingManager.GetOrNullForCurrentUserAsync("MySetting2", fallback: false)).ShouldBeNull(); } [Fact] public async Task Should_Get_All_From_Store_For_Given_User() { - var settingValues = await _settingManager.GetAllForUserAsync(_testData.User1Id).ConfigureAwait(false); + var settingValues = await _settingManager.GetAllForUserAsync(_testData.User1Id); settingValues.ShouldContain(sv => sv.Name == "MySetting1" && sv.Value == "42"); settingValues.ShouldContain(sv => sv.Name == "MySetting2" && sv.Value == "user1-store-value"); settingValues.ShouldContain(sv => sv.Name == "SettingNotSetInStore" && sv.Value == "default-value"); @@ -104,7 +104,7 @@ namespace Volo.Abp.SettingManagement [Fact] public async Task Should_Get_All_From_Store_For_Given_User_Without_Fallback() { - var settingValues = await _settingManager.GetAllForUserAsync(_testData.User1Id, fallback: false).ConfigureAwait(false); + var settingValues = await _settingManager.GetAllForUserAsync(_testData.User1Id, fallback: false); settingValues.ShouldContain(sv => sv.Name == "MySetting2" && sv.Value == "user1-store-value"); settingValues.ShouldContain(sv => sv.Name == "MySettingWithoutInherit" && sv.Value == "user1-store-value"); settingValues.ShouldNotContain(sv => sv.Name == "MySetting1"); @@ -113,7 +113,7 @@ namespace Volo.Abp.SettingManagement [Fact] public async Task Should_Delete_Setting_Record_When_Set_To_Null() { - await _settingManager.SetForUserAsync(_testData.User1Id, "MySetting2", null).ConfigureAwait(false); + await _settingManager.SetForUserAsync(_testData.User1Id, "MySetting2", null); GetSettingsFromDbContext( UserSettingValueProvider.ProviderName, @@ -125,12 +125,12 @@ namespace Volo.Abp.SettingManagement [Fact] public async Task Should_Change_User_Setting() { - (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User1Id).ConfigureAwait(false)) + (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User1Id)) .ShouldBe("user1-store-value"); - await _settingManager.SetForUserAsync(_testData.User1Id, "MySetting2", "user1-new-store-value").ConfigureAwait(false); + await _settingManager.SetForUserAsync(_testData.User1Id, "MySetting2", "user1-new-store-value"); - (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User1Id).ConfigureAwait(false)) + (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User1Id)) .ShouldBe("user1-new-store-value"); GetSettingsFromDbContext( @@ -147,7 +147,7 @@ namespace Volo.Abp.SettingManagement _testData.User1Id, "MySetting2", "default-store-value" - ).ConfigureAwait(false); + ); GetSettingsFromDbContext( UserSettingValueProvider.ProviderName, @@ -155,7 +155,7 @@ namespace Volo.Abp.SettingManagement "MySetting2" ).Count.ShouldBe(0); - (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User1Id).ConfigureAwait(false)) + (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User1Id)) .ShouldBe("default-store-value"); } @@ -167,7 +167,7 @@ namespace Volo.Abp.SettingManagement "MySetting2", "default-store-value", forceToSet: true - ).ConfigureAwait(false); + ); GetSettingsFromDbContext( UserSettingValueProvider.ProviderName, @@ -175,16 +175,16 @@ namespace Volo.Abp.SettingManagement "MySetting2" ).Single().Value.ShouldBe("default-store-value"); - (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User1Id).ConfigureAwait(false)) + (await _settingManager.GetOrNullForUserAsync("MySetting2", _testData.User1Id)) .ShouldBe("default-store-value"); } [Fact] public async Task Should_Get_For_Given_User_For_Non_Inherited_Setting() { - (await _settingManager.GetOrNullForUserAsync("MySettingWithoutInherit", _testData.User1Id).ConfigureAwait(false)).ShouldBe("user1-store-value"); - (await _settingManager.GetOrNullForUserAsync("MySettingWithoutInherit", _testData.User2Id).ConfigureAwait(false)).ShouldBeNull(); //Does not inherit! - (await _settingManager.GetOrNullGlobalAsync("MySettingWithoutInherit").ConfigureAwait(false)).ShouldBe("default-store-value"); + (await _settingManager.GetOrNullForUserAsync("MySettingWithoutInherit", _testData.User1Id)).ShouldBe("user1-store-value"); + (await _settingManager.GetOrNullForUserAsync("MySettingWithoutInherit", _testData.User2Id)).ShouldBeNull(); //Does not inherit! + (await _settingManager.GetOrNullGlobalAsync("MySettingWithoutInherit")).ShouldBe("default-store-value"); } } } \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Application.Contracts/FodyWeavers.xml b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application.Contracts/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application.Contracts/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Application.Contracts/FodyWeavers.xsd b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application.Contracts/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application.Contracts/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Application.Contracts/Volo.Abp.TenantManagement.Application.Contracts.csproj b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application.Contracts/Volo.Abp.TenantManagement.Application.Contracts.csproj index 57f177df96..41620fcc1d 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Application.Contracts/Volo.Abp.TenantManagement.Application.Contracts.csproj +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application.Contracts/Volo.Abp.TenantManagement.Application.Contracts.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/FodyWeavers.xml b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/FodyWeavers.xsd b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/Volo.Abp.TenantManagement.Application.csproj b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/Volo.Abp.TenantManagement.Application.csproj index bd5926a785..2e8bff8d48 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/Volo.Abp.TenantManagement.Application.csproj +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/Volo.Abp.TenantManagement.Application.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/Volo/Abp/TenantManagement/TenantAppService.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/Volo/Abp/TenantManagement/TenantAppService.cs index 084c6c1920..3dabc569bd 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/Volo/Abp/TenantManagement/TenantAppService.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/Volo/Abp/TenantManagement/TenantAppService.cs @@ -27,13 +27,13 @@ namespace Volo.Abp.TenantManagement public virtual async Task GetAsync(Guid id) { return ObjectMapper.Map( - await TenantRepository.GetAsync(id).ConfigureAwait(false)); + await TenantRepository.GetAsync(id)); } public virtual async Task> GetListAsync(GetTenantsInput input) { - var count = await TenantRepository.GetCountAsync(input.Filter).ConfigureAwait(false); - var list = await TenantRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter).ConfigureAwait(false); + var count = await TenantRepository.GetCountAsync(input.Filter); + var list = await TenantRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter); return new PagedResultDto( count, @@ -44,15 +44,15 @@ namespace Volo.Abp.TenantManagement [Authorize(TenantManagementPermissions.Tenants.Create)] public virtual async Task CreateAsync(TenantCreateDto input) { - var tenant = await TenantManager.CreateAsync(input.Name).ConfigureAwait(false); - await TenantRepository.InsertAsync(tenant).ConfigureAwait(false); + var tenant = await TenantManager.CreateAsync(input.Name); + await TenantRepository.InsertAsync(tenant); using (CurrentTenant.Change(tenant.Id, tenant.Name)) { //TODO: Handle database creation? //TODO: Set admin email & password..? - await DataSeeder.SeedAsync(tenant.Id).ConfigureAwait(false); + await DataSeeder.SeedAsync(tenant.Id); } return ObjectMapper.Map(tenant); @@ -61,45 +61,45 @@ namespace Volo.Abp.TenantManagement [Authorize(TenantManagementPermissions.Tenants.Update)] public virtual async Task UpdateAsync(Guid id, TenantUpdateDto input) { - var tenant = await TenantRepository.GetAsync(id).ConfigureAwait(false); - await TenantManager.ChangeNameAsync(tenant, input.Name).ConfigureAwait(false); - await TenantRepository.UpdateAsync(tenant).ConfigureAwait(false); + var tenant = await TenantRepository.GetAsync(id); + await TenantManager.ChangeNameAsync(tenant, input.Name); + await TenantRepository.UpdateAsync(tenant); return ObjectMapper.Map(tenant); } [Authorize(TenantManagementPermissions.Tenants.Delete)] public virtual async Task DeleteAsync(Guid id) { - var tenant = await TenantRepository.FindAsync(id).ConfigureAwait(false); + var tenant = await TenantRepository.FindAsync(id); if (tenant == null) { return; } - await TenantRepository.DeleteAsync(tenant).ConfigureAwait(false); + await TenantRepository.DeleteAsync(tenant); } [Authorize(TenantManagementPermissions.Tenants.ManageConnectionStrings)] public virtual async Task GetDefaultConnectionStringAsync(Guid id) { - var tenant = await TenantRepository.GetAsync(id).ConfigureAwait(false); + var tenant = await TenantRepository.GetAsync(id); return tenant?.FindDefaultConnectionString(); } [Authorize(TenantManagementPermissions.Tenants.ManageConnectionStrings)] public virtual async Task UpdateDefaultConnectionStringAsync(Guid id, string defaultConnectionString) { - var tenant = await TenantRepository.GetAsync(id).ConfigureAwait(false); + var tenant = await TenantRepository.GetAsync(id); tenant.SetDefaultConnectionString(defaultConnectionString); - await TenantRepository.UpdateAsync(tenant).ConfigureAwait(false); + await TenantRepository.UpdateAsync(tenant); } [Authorize(TenantManagementPermissions.Tenants.ManageConnectionStrings)] public virtual async Task DeleteDefaultConnectionStringAsync(Guid id) { - var tenant = await TenantRepository.GetAsync(id).ConfigureAwait(false); + var tenant = await TenantRepository.GetAsync(id); tenant.RemoveDefaultConnectionString(); - await TenantRepository.UpdateAsync(tenant).ConfigureAwait(false); + await TenantRepository.UpdateAsync(tenant); } } } diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/FodyWeavers.xml b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/FodyWeavers.xsd b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo.Abp.TenantManagement.Domain.Shared.csproj b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo.Abp.TenantManagement.Domain.Shared.csproj index 5cdaa28369..925834d1f6 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo.Abp.TenantManagement.Domain.Shared.csproj +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo.Abp.TenantManagement.Domain.Shared.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/Localization/Resources/zh-Hant.json b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/Localization/Resources/zh-Hant.json new file mode 100644 index 0000000000..858d7d6f9b --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain.Shared/Volo/Abp/TenantManagement/Localization/Resources/zh-Hant.json @@ -0,0 +1,20 @@ +{ + "culture": "zh-Hant", + "texts": { + "Menu:TenantManagement": "租戶管理", + "Tenants": "租戶", + "NewTenant": "新租戶", + "TenantName": "租戶名稱", + "DisplayName:TenantName": "租戶名稱", + "TenantDeletionConfirmationMessage": "租戶 '{0}' 將被刪除. 您確定嗎?", + "ConnectionStrings": "資料庫連線字串", + "DisplayName:DefaultConnectionString": "預設資料庫連線字串", + "DisplayName:UseSharedDatabase": "使用共用資料庫", + "Permission:TenantManagement": "租戶管理", + "Permission:Create": "新增", + "Permission:Edit": "編輯", + "Permission:Delete": "刪除", + "Permission:ManageConnectionStrings": "管理資料庫連線字串", + "Permission:ManageFeatures": "管理功能" + } +} \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/FodyWeavers.xml b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/FodyWeavers.xsd b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo.Abp.TenantManagement.Domain.csproj b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo.Abp.TenantManagement.Domain.csproj index 9f516e45fd..28541197c4 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo.Abp.TenantManagement.Domain.csproj +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo.Abp.TenantManagement.Domain.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantManager.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantManager.cs index fbc422c31a..79d7cf891e 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantManager.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantManager.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.TenantManagement { Check.NotNull(name, nameof(name)); - await ValidateNameAsync(name).ConfigureAwait(false); + await ValidateNameAsync(name); return new Tenant(GuidGenerator.Create(), name); } @@ -28,13 +28,13 @@ namespace Volo.Abp.TenantManagement Check.NotNull(tenant, nameof(tenant)); Check.NotNull(name, nameof(name)); - await ValidateNameAsync(name, tenant.Id).ConfigureAwait(false); + await ValidateNameAsync(name, tenant.Id); tenant.SetName(name); } protected virtual async Task ValidateNameAsync(string name, Guid? expectedId = null) { - var tenant = await _tenantRepository.FindByNameAsync(name).ConfigureAwait(false); + var tenant = await _tenantRepository.FindByNameAsync(name); if (tenant != null && tenant.Id != expectedId) { throw new UserFriendlyException("Duplicate tenancy name: " + name); //TODO: A domain exception would be better..? diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantStore.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantStore.cs index 234f23959a..afa9af0cf2 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantStore.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantStore.cs @@ -28,7 +28,7 @@ namespace Volo.Abp.TenantManagement { using (_currentTenant.Change(null)) //TODO: No need this if we can implement to define host side (or tenant-independent) entities! { - var tenant = await _tenantRepository.FindByNameAsync(name).ConfigureAwait(false); + var tenant = await _tenantRepository.FindByNameAsync(name); if (tenant == null) { return null; @@ -42,7 +42,7 @@ namespace Volo.Abp.TenantManagement { using (_currentTenant.Change(null)) //TODO: No need this if we can implement to define host side (or tenant-independent) entities! { - var tenant = await _tenantRepository.FindAsync(id).ConfigureAwait(false); + var tenant = await _tenantRepository.FindAsync(id); if (tenant == null) { return null; diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/FodyWeavers.xml b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/FodyWeavers.xsd b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo.Abp.TenantManagement.EntityFrameworkCore.csproj b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo.Abp.TenantManagement.EntityFrameworkCore.csproj index 259f5e7a73..26ecad10b5 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo.Abp.TenantManagement.EntityFrameworkCore.csproj +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo.Abp.TenantManagement.EntityFrameworkCore.csproj @@ -1,9 +1,10 @@ - + + - netstandard2.1 + netstandard2.0 Volo.Abp.TenantManagement.EntityFrameworkCore Volo.Abp.TenantManagement.EntityFrameworkCore $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/EfCoreTenantRepository.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/EfCoreTenantRepository.cs index a6deb69f4c..e211f81abf 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/EfCoreTenantRepository.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/EfCoreTenantRepository.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.TenantManagement.EntityFrameworkCore { return await DbSet .IncludeDetails(includeDetails) - .FirstOrDefaultAsync(t => t.Name == name, GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .FirstOrDefaultAsync(t => t.Name == name, GetCancellationToken(cancellationToken)); } public Tenant FindByName(string name, bool includeDetails = true) @@ -59,7 +59,7 @@ namespace Volo.Abp.TenantManagement.EntityFrameworkCore ) .OrderBy(sorting ?? nameof(Tenant.Name)) .PageBy(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi.Client/FodyWeavers.xml b/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi.Client/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi.Client/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi.Client/FodyWeavers.xsd b/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi.Client/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi.Client/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi.Client/Volo.Abp.TenantManagement.HttpApi.Client.csproj b/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi.Client/Volo.Abp.TenantManagement.HttpApi.Client.csproj index cb8c188e9b..9c36b1b29e 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi.Client/Volo.Abp.TenantManagement.HttpApi.Client.csproj +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi.Client/Volo.Abp.TenantManagement.HttpApi.Client.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/FodyWeavers.xml b/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/FodyWeavers.xsd b/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/Volo.Abp.TenantManagement.HttpApi.csproj b/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/Volo.Abp.TenantManagement.HttpApi.csproj index a26db3823b..082be51571 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/Volo.Abp.TenantManagement.HttpApi.csproj +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/Volo.Abp.TenantManagement.HttpApi.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/FodyWeavers.xml b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/FodyWeavers.xsd b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo.Abp.TenantManagement.MongoDB.csproj b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo.Abp.TenantManagement.MongoDB.csproj index aa7c7f9340..870d87b6c4 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo.Abp.TenantManagement.MongoDB.csproj +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo.Abp.TenantManagement.MongoDB.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/MongoTenantRepository.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/MongoTenantRepository.cs index 21e5ab9b1d..1d57652833 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/MongoTenantRepository.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/MongoTenantRepository.cs @@ -25,7 +25,7 @@ namespace Volo.Abp.TenantManagement.MongoDB CancellationToken cancellationToken = default) { return await GetMongoQueryable() - .FirstOrDefaultAsync(t => t.Name == name, GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .FirstOrDefaultAsync(t => t.Name == name, GetCancellationToken(cancellationToken)); } public Tenant FindByName(string name, bool includeDetails = true) @@ -57,7 +57,7 @@ namespace Volo.Abp.TenantManagement.MongoDB .OrderBy(sorting ?? nameof(Tenant.Name)) .As>() .PageBy>(skipCount, maxResultCount) - .ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + .ToListAsync(GetCancellationToken(cancellationToken)); } public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/FodyWeavers.xml b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/FodyWeavers.xsd b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Navigation/AbpTenantManagementWebMainMenuContributor.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Navigation/AbpTenantManagementWebMainMenuContributor.cs index 2ca66c1485..b7ef9f277e 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Navigation/AbpTenantManagementWebMainMenuContributor.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Navigation/AbpTenantManagementWebMainMenuContributor.cs @@ -24,7 +24,7 @@ namespace Volo.Abp.TenantManagement.Web.Navigation var tenantManagementMenuItem = new ApplicationMenuItem(TenantManagementMenuNames.GroupName, l["Menu:TenantManagement"], icon: "fa fa-users"); administrationMenu.AddItem(tenantManagementMenuItem); - if (await authorizationService.IsGrantedAsync(TenantManagementPermissions.Tenants.Default).ConfigureAwait(false)) + if (await authorizationService.IsGrantedAsync(TenantManagementPermissions.Tenants.Default)) { tenantManagementMenuItem.AddItem(new ApplicationMenuItem(TenantManagementMenuNames.Tenants, l["Tenants"], url: "/TenantManagement/Tenants")); } diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/ConnectionStringsModal.cshtml.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/ConnectionStringsModal.cshtml.cs index 7814d7c018..481cc6b7ca 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/ConnectionStringsModal.cshtml.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/ConnectionStringsModal.cshtml.cs @@ -20,7 +20,7 @@ namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants public async Task OnGetAsync(Guid id) { - var defaultConnectionString = await _tenantAppService.GetDefaultConnectionStringAsync(id).ConfigureAwait(false); + var defaultConnectionString = await _tenantAppService.GetDefaultConnectionStringAsync(id); Tenant = new TenantInfoModel { Id = id, @@ -35,11 +35,11 @@ namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants if (Tenant.UseSharedDatabase || Tenant.DefaultConnectionString.IsNullOrWhiteSpace()) { - await _tenantAppService.DeleteDefaultConnectionStringAsync(Tenant.Id).ConfigureAwait(false); + await _tenantAppService.DeleteDefaultConnectionStringAsync(Tenant.Id); } else { - await _tenantAppService.UpdateDefaultConnectionStringAsync(Tenant.Id, Tenant.DefaultConnectionString).ConfigureAwait(false); + await _tenantAppService.UpdateDefaultConnectionStringAsync(Tenant.Id, Tenant.DefaultConnectionString); } return NoContent(); diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/CreateModal.cshtml.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/CreateModal.cshtml.cs index 1ac1e7b97d..a602b12a65 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/CreateModal.cshtml.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/CreateModal.cshtml.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants ValidateModel(); var input = ObjectMapper.Map(Tenant); - await _tenantAppService.CreateAsync(input).ConfigureAwait(false); + await _tenantAppService.CreateAsync(input); return NoContent(); } diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/EditModal.cshtml.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/EditModal.cshtml.cs index f3bdb8f95f..58516e8ff7 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/EditModal.cshtml.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/EditModal.cshtml.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants { Tenant = ObjectMapper.Map( await _tenantAppService.GetAsync(id) -.ConfigureAwait(false)); + ); } public async Task OnPostAsync() @@ -30,7 +30,7 @@ namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants ValidateModel(); var input = ObjectMapper.Map(Tenant); - await _tenantAppService.UpdateAsync(Tenant.Id, input).ConfigureAwait(false); + await _tenantAppService.UpdateAsync(Tenant.Id, input); return NoContent(); } diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.js b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.js index 3ae75e6ad6..0dc1861790 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.js +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.js @@ -19,6 +19,7 @@ order: [[1, "asc"]], processing: true, paging: true, + scrollX: true, serverSide: true, ajax: abp.libs.datatables.createAjax(_tenantAppService.getList), columnDefs: [ diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Volo.Abp.TenantManagement.Web.csproj b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Volo.Abp.TenantManagement.Web.csproj index 93fa5b3817..56e6d3cae7 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Volo.Abp.TenantManagement.Web.csproj +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Volo.Abp.TenantManagement.Web.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/tenant-management/test/Volo.Abp.TenantManagement.Application.Tests/Volo.Abp.TenantManagement.Application.Tests.csproj b/modules/tenant-management/test/Volo.Abp.TenantManagement.Application.Tests/Volo.Abp.TenantManagement.Application.Tests.csproj index 65498d6f38..77b220f937 100644 --- a/modules/tenant-management/test/Volo.Abp.TenantManagement.Application.Tests/Volo.Abp.TenantManagement.Application.Tests.csproj +++ b/modules/tenant-management/test/Volo.Abp.TenantManagement.Application.Tests/Volo.Abp.TenantManagement.Application.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/tenant-management/test/Volo.Abp.TenantManagement.Application.Tests/Volo/Abp/TenantManagement/TenantAppService_Tests.cs b/modules/tenant-management/test/Volo.Abp.TenantManagement.Application.Tests/Volo/Abp/TenantManagement/TenantAppService_Tests.cs index 99318e52e4..3e44e7c8ea 100644 --- a/modules/tenant-management/test/Volo.Abp.TenantManagement.Application.Tests/Volo/Abp/TenantManagement/TenantAppService_Tests.cs +++ b/modules/tenant-management/test/Volo.Abp.TenantManagement.Application.Tests/Volo/Abp/TenantManagement/TenantAppService_Tests.cs @@ -20,14 +20,14 @@ namespace Volo.Abp.TenantManagement public async Task GetAsync() { var tenantInDb = UsingDbContext(dbContext => dbContext.Tenants.First()); - var tenant = await _tenantAppService.GetAsync(tenantInDb.Id).ConfigureAwait(false); + var tenant = await _tenantAppService.GetAsync(tenantInDb.Id); tenant.Name.ShouldBe(tenantInDb.Name); } [Fact] public async Task GetListAsync() { - var result = await _tenantAppService.GetListAsync(new GetTenantsInput()).ConfigureAwait(false); + var result = await _tenantAppService.GetListAsync(new GetTenantsInput()); result.TotalCount.ShouldBeGreaterThan(0); result.Items.ShouldContain(t => t.Name == "acme"); result.Items.ShouldContain(t => t.Name == "volosoft"); @@ -36,7 +36,7 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task GetListAsync_Filtered() { - var result = await _tenantAppService.GetListAsync(new GetTenantsInput { Filter = "volo" }).ConfigureAwait(false); + var result = await _tenantAppService.GetListAsync(new GetTenantsInput { Filter = "volo" }); result.TotalCount.ShouldBeGreaterThan(0); result.Items.ShouldNotContain(t => t.Name == "acme"); result.Items.ShouldContain(t => t.Name == "volosoft"); @@ -45,7 +45,7 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task GetListAsync_Sorted_Descending_By_Name() { - var result = await _tenantAppService.GetListAsync(new GetTenantsInput { Sorting = "Name DESC" }).ConfigureAwait(false); + var result = await _tenantAppService.GetListAsync(new GetTenantsInput { Sorting = "Name DESC" }); result.TotalCount.ShouldBeGreaterThan(0); var tenants = result.Items.ToList(); @@ -59,7 +59,7 @@ namespace Volo.Abp.TenantManagement public async Task CreateAsync() { var tenancyName = Guid.NewGuid().ToString("N").ToLowerInvariant(); - var tenant = await _tenantAppService.CreateAsync(new TenantCreateDto { Name = tenancyName }).ConfigureAwait(false); + var tenant = await _tenantAppService.CreateAsync(new TenantCreateDto { Name = tenancyName }); tenant.Name.ShouldBe(tenancyName); tenant.Id.ShouldNotBe(default(Guid)); } @@ -69,8 +69,8 @@ namespace Volo.Abp.TenantManagement { await Assert.ThrowsAsync(async () => { - await _tenantAppService.CreateAsync(new TenantCreateDto { Name = "acme" }).ConfigureAwait(false); - }).ConfigureAwait(false); + await _tenantAppService.CreateAsync(new TenantCreateDto { Name = "acme" }); + }); } [Fact] @@ -78,7 +78,7 @@ namespace Volo.Abp.TenantManagement { var acme = UsingDbContext(dbContext => dbContext.Tenants.Single(t => t.Name == "acme")); - var result = await _tenantAppService.UpdateAsync(acme.Id, new TenantUpdateDto { Name = "acme-renamed" }).ConfigureAwait(false); + var result = await _tenantAppService.UpdateAsync(acme.Id, new TenantUpdateDto { Name = "acme-renamed" }); result.Id.ShouldBe(acme.Id); result.Name.ShouldBe("acme-renamed"); @@ -93,8 +93,8 @@ namespace Volo.Abp.TenantManagement await Assert.ThrowsAsync(async () => { - await _tenantAppService.UpdateAsync(acme.Id, new TenantUpdateDto { Name = "volosoft" }).ConfigureAwait(false); - }).ConfigureAwait(false); + await _tenantAppService.UpdateAsync(acme.Id, new TenantUpdateDto { Name = "volosoft" }); + }); } [Fact] @@ -102,7 +102,7 @@ namespace Volo.Abp.TenantManagement { var acme = UsingDbContext(dbContext => dbContext.Tenants.Single(t => t.Name == "acme")); - await _tenantAppService.DeleteAsync(acme.Id).ConfigureAwait(false); + await _tenantAppService.DeleteAsync(acme.Id); UsingDbContext(dbContext => { diff --git a/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo.Abp.TenantManagement.Domain.Tests.csproj b/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo.Abp.TenantManagement.Domain.Tests.csproj index 8dd16201cb..3d8b2073f6 100644 --- a/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo.Abp.TenantManagement.Domain.Tests.csproj +++ b/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo.Abp.TenantManagement.Domain.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/TenantManager_Tests.cs b/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/TenantManager_Tests.cs index 0e5eba4136..8605047bbb 100644 --- a/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/TenantManager_Tests.cs +++ b/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/TenantManager_Tests.cs @@ -19,23 +19,23 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task CreateAsync() { - var tenant = await _tenantManager.CreateAsync("Test").ConfigureAwait(false); + var tenant = await _tenantManager.CreateAsync("Test"); tenant.Name.ShouldBe("Test"); } [Fact] public async Task Create_Tenant_Name_Can_Not_Duplicate() { - await Assert.ThrowsAsync(async () => await _tenantManager.CreateAsync("volosoft").ConfigureAwait(false)).ConfigureAwait(false); + await Assert.ThrowsAsync(async () => await _tenantManager.CreateAsync("volosoft")); } [Fact] public async Task ChangeNameAsync() { - var tenant = await _tenantRepository.FindByNameAsync("volosoft").ConfigureAwait(false); + var tenant = await _tenantRepository.FindByNameAsync("volosoft"); tenant.ShouldNotBeNull(); - await _tenantManager.ChangeNameAsync(tenant, "newVolosoft").ConfigureAwait(false); + await _tenantManager.ChangeNameAsync(tenant, "newVolosoft"); tenant.Name.ShouldBe("newVolosoft"); } @@ -43,10 +43,10 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task ChangeName_Tenant_Name_Can_Not_Duplicate() { - var tenant = await _tenantRepository.FindByNameAsync("acme").ConfigureAwait(false); + var tenant = await _tenantRepository.FindByNameAsync("acme"); tenant.ShouldNotBeNull(); - await Assert.ThrowsAsync(async () => await _tenantManager.ChangeNameAsync(tenant, "volosoft").ConfigureAwait(false)).ConfigureAwait(false); + await Assert.ThrowsAsync(async () => await _tenantManager.ChangeNameAsync(tenant, "volosoft")); } } } diff --git a/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/TenantStore_Tests.cs b/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/TenantStore_Tests.cs index eb6f44068f..f199124bca 100644 --- a/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/TenantStore_Tests.cs +++ b/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/TenantStore_Tests.cs @@ -19,7 +19,7 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task FindAsyncByName() { - var acme = await _tenantStore.FindAsync("acme").ConfigureAwait(false); + var acme = await _tenantStore.FindAsync("acme"); acme.ShouldNotBeNull(); acme.Name.ShouldBe("acme"); } @@ -27,10 +27,10 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task FindAsyncById() { - var acme = await _tenantRepository.FindByNameAsync("acme").ConfigureAwait(false); + var acme = await _tenantRepository.FindByNameAsync("acme"); acme.ShouldNotBeNull(); - (await _tenantStore.FindAsync(acme.Id).ConfigureAwait(false)).ShouldNotBeNull(); + (await _tenantStore.FindAsync(acme.Id)).ShouldNotBeNull(); } } } diff --git a/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/Tenant_Tests.cs b/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/Tenant_Tests.cs index 6256007e57..5107d1a06d 100644 --- a/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/Tenant_Tests.cs +++ b/modules/tenant-management/test/Volo.Abp.TenantManagement.Domain.Tests/Volo/Abp/TenantManagement/Tenant_Tests.cs @@ -16,7 +16,7 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task FindDefaultConnectionString() { - var acme = await _tenantRepository.FindByNameAsync("acme").ConfigureAwait(false); + var acme = await _tenantRepository.FindByNameAsync("acme"); acme.ShouldNotBeNull(); acme.FindDefaultConnectionString().ShouldBe("DefaultConnString-Value"); @@ -25,7 +25,7 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task FindConnectionString() { - var acme = await _tenantRepository.FindByNameAsync("acme").ConfigureAwait(false); + var acme = await _tenantRepository.FindByNameAsync("acme"); acme.ShouldNotBeNull(); acme.FindConnectionString(Data.ConnectionStrings.DefaultConnectionStringName).ShouldBe("DefaultConnString-Value"); diff --git a/modules/tenant-management/test/Volo.Abp.TenantManagement.EntityFrameworkCore.Tests/Volo.Abp.TenantManagement.EntityFrameworkCore.Tests.csproj b/modules/tenant-management/test/Volo.Abp.TenantManagement.EntityFrameworkCore.Tests/Volo.Abp.TenantManagement.EntityFrameworkCore.Tests.csproj index 528fd9e4e9..7786d493df 100644 --- a/modules/tenant-management/test/Volo.Abp.TenantManagement.EntityFrameworkCore.Tests/Volo.Abp.TenantManagement.EntityFrameworkCore.Tests.csproj +++ b/modules/tenant-management/test/Volo.Abp.TenantManagement.EntityFrameworkCore.Tests/Volo.Abp.TenantManagement.EntityFrameworkCore.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/tenant-management/test/Volo.Abp.TenantManagement.MongoDB.Tests/Volo.Abp.TenantManagement.MongoDB.Tests.csproj b/modules/tenant-management/test/Volo.Abp.TenantManagement.MongoDB.Tests/Volo.Abp.TenantManagement.MongoDB.Tests.csproj index 8cd0fbdae2..e7a10843ba 100644 --- a/modules/tenant-management/test/Volo.Abp.TenantManagement.MongoDB.Tests/Volo.Abp.TenantManagement.MongoDB.Tests.csproj +++ b/modules/tenant-management/test/Volo.Abp.TenantManagement.MongoDB.Tests/Volo.Abp.TenantManagement.MongoDB.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo.Abp.TenantManagement.TestBase.csproj b/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo.Abp.TenantManagement.TestBase.csproj index 89b9c1aae2..765d7ef219 100644 --- a/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo.Abp.TenantManagement.TestBase.csproj +++ b/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo.Abp.TenantManagement.TestBase.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/AbpTenantManagementTestDataBuilder.cs b/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/AbpTenantManagementTestDataBuilder.cs index 7127d902f5..45acc070d8 100644 --- a/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/AbpTenantManagementTestDataBuilder.cs +++ b/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/AbpTenantManagementTestDataBuilder.cs @@ -25,13 +25,13 @@ namespace Volo.Abp.TenantManagement private async Task AddTenantsAsync() { - var acme = await _tenantManager.CreateAsync("acme").ConfigureAwait(false); + var acme = await _tenantManager.CreateAsync("acme"); acme.ConnectionStrings.Add(new TenantConnectionString(acme.Id, ConnectionStrings.DefaultConnectionStringName, "DefaultConnString-Value")); acme.ConnectionStrings.Add(new TenantConnectionString(acme.Id, "MyConnString", "MyConnString-Value")); - await _tenantRepository.InsertAsync(acme).ConfigureAwait(false); + await _tenantRepository.InsertAsync(acme); - var volosoft = await _tenantManager.CreateAsync("volosoft").ConfigureAwait(false); - await _tenantRepository.InsertAsync(volosoft).ConfigureAwait(false); + var volosoft = await _tenantManager.CreateAsync("volosoft"); + await _tenantRepository.InsertAsync(volosoft); } } } \ No newline at end of file diff --git a/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/LazyLoad_Tests.cs b/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/LazyLoad_Tests.cs index f055e8e9b5..4ece524e0f 100644 --- a/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/LazyLoad_Tests.cs +++ b/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/LazyLoad_Tests.cs @@ -22,11 +22,11 @@ namespace Volo.Abp.TenantManagement { using (var uow = GetRequiredService().Begin()) { - var role = await TenantRepository.FindByNameAsync("acme", includeDetails: false).ConfigureAwait(false); + var role = await TenantRepository.FindByNameAsync("acme", includeDetails: false); role.ConnectionStrings.ShouldNotBeNull(); role.ConnectionStrings.Any().ShouldBeTrue(); - await uow.CompleteAsync().ConfigureAwait(false); + await uow.CompleteAsync(); } } } diff --git a/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/TenantRepository_Tests.cs b/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/TenantRepository_Tests.cs index 92ebf57353..06c75317fa 100644 --- a/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/TenantRepository_Tests.cs +++ b/modules/tenant-management/test/Volo.Abp.TenantManagement.TestBase/Volo/Abp/TenantManagement/TenantRepository_Tests.cs @@ -20,13 +20,13 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task FindByNameAsync() { - var tenant = await TenantRepository.FindByNameAsync("acme").ConfigureAwait(false); + var tenant = await TenantRepository.FindByNameAsync("acme"); tenant.ShouldNotBeNull(); - tenant = await TenantRepository.FindByNameAsync("undefined-tenant").ConfigureAwait(false); + tenant = await TenantRepository.FindByNameAsync("undefined-tenant"); tenant.ShouldBeNull(); - tenant = await TenantRepository.FindByNameAsync("acme", includeDetails: true).ConfigureAwait(false); + tenant = await TenantRepository.FindByNameAsync("acme", includeDetails: true); tenant.ShouldNotBeNull(); tenant.ConnectionStrings.Count.ShouldBeGreaterThanOrEqualTo(2); } @@ -34,15 +34,15 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task FindAsync() { - var tenantId = (await TenantRepository.FindByNameAsync("acme").ConfigureAwait(false)).Id; + var tenantId = (await TenantRepository.FindByNameAsync("acme")).Id; - var tenant = await TenantRepository.FindAsync(tenantId).ConfigureAwait(false); + var tenant = await TenantRepository.FindAsync(tenantId); tenant.ShouldNotBeNull(); - tenant = await TenantRepository.FindAsync(Guid.NewGuid()).ConfigureAwait(false); + tenant = await TenantRepository.FindAsync(Guid.NewGuid()); tenant.ShouldBeNull(); - tenant = await TenantRepository.FindAsync(tenantId, includeDetails: true).ConfigureAwait(false); + tenant = await TenantRepository.FindAsync(tenantId, includeDetails: true); tenant.ShouldNotBeNull(); tenant.ConnectionStrings.Count.ShouldBeGreaterThanOrEqualTo(2); } @@ -50,7 +50,7 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task GetListAsync() { - var tenants = await TenantRepository.GetListAsync().ConfigureAwait(false); + var tenants = await TenantRepository.GetListAsync(); tenants.ShouldContain(t => t.Name == "acme"); tenants.ShouldContain(t => t.Name == "volosoft"); } @@ -58,7 +58,7 @@ namespace Volo.Abp.TenantManagement [Fact] public async Task Should_Eager_Load_Tenant_Collections() { - var role = await TenantRepository.FindByNameAsync("acme").ConfigureAwait(false); + var role = await TenantRepository.FindByNameAsync("acme"); role.ConnectionStrings.ShouldNotBeNull(); role.ConnectionStrings.Any().ShouldBeTrue(); } diff --git a/modules/users/src/Volo.Abp.Users.Abstractions/FodyWeavers.xml b/modules/users/src/Volo.Abp.Users.Abstractions/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/users/src/Volo.Abp.Users.Abstractions/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/users/src/Volo.Abp.Users.Abstractions/FodyWeavers.xsd b/modules/users/src/Volo.Abp.Users.Abstractions/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/users/src/Volo.Abp.Users.Abstractions/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/users/src/Volo.Abp.Users.Abstractions/Volo.Abp.Users.Abstractions.csproj b/modules/users/src/Volo.Abp.Users.Abstractions/Volo.Abp.Users.Abstractions.csproj index 92d5a13bfc..43907cd41d 100644 --- a/modules/users/src/Volo.Abp.Users.Abstractions/Volo.Abp.Users.Abstractions.csproj +++ b/modules/users/src/Volo.Abp.Users.Abstractions/Volo.Abp.Users.Abstractions.csproj @@ -1,5 +1,6 @@ - + + diff --git a/modules/users/src/Volo.Abp.Users.Domain.Shared/FodyWeavers.xml b/modules/users/src/Volo.Abp.Users.Domain.Shared/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/users/src/Volo.Abp.Users.Domain.Shared/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/users/src/Volo.Abp.Users.Domain.Shared/FodyWeavers.xsd b/modules/users/src/Volo.Abp.Users.Domain.Shared/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/users/src/Volo.Abp.Users.Domain.Shared/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/users/src/Volo.Abp.Users.Domain.Shared/Volo.Abp.Users.Domain.Shared.csproj b/modules/users/src/Volo.Abp.Users.Domain.Shared/Volo.Abp.Users.Domain.Shared.csproj index 00423f67ae..30a5701451 100644 --- a/modules/users/src/Volo.Abp.Users.Domain.Shared/Volo.Abp.Users.Domain.Shared.csproj +++ b/modules/users/src/Volo.Abp.Users.Domain.Shared/Volo.Abp.Users.Domain.Shared.csproj @@ -1,5 +1,6 @@ + diff --git a/modules/users/src/Volo.Abp.Users.Domain/FodyWeavers.xml b/modules/users/src/Volo.Abp.Users.Domain/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/users/src/Volo.Abp.Users.Domain/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/users/src/Volo.Abp.Users.Domain/FodyWeavers.xsd b/modules/users/src/Volo.Abp.Users.Domain/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/users/src/Volo.Abp.Users.Domain/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/users/src/Volo.Abp.Users.Domain/Volo.Abp.Users.Domain.csproj b/modules/users/src/Volo.Abp.Users.Domain/Volo.Abp.Users.Domain.csproj index 8d39887121..fadbff5be4 100644 --- a/modules/users/src/Volo.Abp.Users.Domain/Volo.Abp.Users.Domain.csproj +++ b/modules/users/src/Volo.Abp.Users.Domain/Volo.Abp.Users.Domain.csproj @@ -1,5 +1,6 @@ + diff --git a/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupService.cs b/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupService.cs index a45bcec7ce..09979f00e1 100644 --- a/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupService.cs +++ b/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupService.cs @@ -32,7 +32,7 @@ namespace Volo.Abp.Users public async Task FindByIdAsync(Guid id, CancellationToken cancellationToken = default) { - var localUser = await _userRepository.FindAsync(id, cancellationToken: cancellationToken).ConfigureAwait(false); + var localUser = await _userRepository.FindAsync(id, cancellationToken: cancellationToken); if (ExternalUserLookupServiceProvider == null) { @@ -48,13 +48,13 @@ namespace Volo.Abp.Users try { - externalUser = await ExternalUserLookupServiceProvider.FindByIdAsync(id, cancellationToken).ConfigureAwait(false); + externalUser = await ExternalUserLookupServiceProvider.FindByIdAsync(id, cancellationToken); if (externalUser == null) { if (localUser != null) { //TODO: Instead of deleting, should be make it inactive or something like that? - await WithNewUowAsync(() => _userRepository.DeleteAsync(localUser, cancellationToken: cancellationToken)).ConfigureAwait(false); + await WithNewUowAsync(() => _userRepository.DeleteAsync(localUser, cancellationToken: cancellationToken)); } return null; @@ -68,25 +68,25 @@ namespace Volo.Abp.Users if (localUser == null) { - await WithNewUowAsync(() => _userRepository.InsertAsync(CreateUser(externalUser), cancellationToken: cancellationToken)).ConfigureAwait(false); - return await _userRepository.FindAsync(id, cancellationToken: cancellationToken).ConfigureAwait(false); + await WithNewUowAsync(() => _userRepository.InsertAsync(CreateUser(externalUser), cancellationToken: cancellationToken)); + return await _userRepository.FindAsync(id, cancellationToken: cancellationToken); } if (localUser is IUpdateUserData && ((IUpdateUserData)localUser).Update(externalUser)) { - await WithNewUowAsync(() => _userRepository.UpdateAsync(localUser, cancellationToken: cancellationToken)).ConfigureAwait(false); + await WithNewUowAsync(() => _userRepository.UpdateAsync(localUser, cancellationToken: cancellationToken)); } else { return localUser; } - return await _userRepository.FindAsync(id, cancellationToken: cancellationToken).ConfigureAwait(false); + return await _userRepository.FindAsync(id, cancellationToken: cancellationToken); } public async Task FindByUserNameAsync(string userName, CancellationToken cancellationToken = default) { - var localUser = await _userRepository.FindByUserNameAsync(userName, cancellationToken).ConfigureAwait(false); + var localUser = await _userRepository.FindByUserNameAsync(userName, cancellationToken); if (ExternalUserLookupServiceProvider == null) { @@ -102,13 +102,13 @@ namespace Volo.Abp.Users try { - externalUser = await ExternalUserLookupServiceProvider.FindByUserNameAsync(userName, cancellationToken).ConfigureAwait(false); + externalUser = await ExternalUserLookupServiceProvider.FindByUserNameAsync(userName, cancellationToken); if (externalUser == null) { if (localUser != null) { //TODO: Instead of deleting, should be make it passive or something like that? - await WithNewUowAsync(() => _userRepository.DeleteAsync(localUser, cancellationToken: cancellationToken)).ConfigureAwait(false); + await WithNewUowAsync(() => _userRepository.DeleteAsync(localUser, cancellationToken: cancellationToken)); } return null; @@ -122,20 +122,20 @@ namespace Volo.Abp.Users if (localUser == null) { - await WithNewUowAsync(() => _userRepository.InsertAsync(CreateUser(externalUser), cancellationToken: cancellationToken)).ConfigureAwait(false); - return await _userRepository.FindAsync(externalUser.Id, cancellationToken: cancellationToken).ConfigureAwait(false); + await WithNewUowAsync(() => _userRepository.InsertAsync(CreateUser(externalUser), cancellationToken: cancellationToken)); + return await _userRepository.FindAsync(externalUser.Id, cancellationToken: cancellationToken); } if (localUser is IUpdateUserData && ((IUpdateUserData)localUser).Update(externalUser)) { - await WithNewUowAsync(() => _userRepository.UpdateAsync(localUser, cancellationToken: cancellationToken)).ConfigureAwait(false); + await WithNewUowAsync(() => _userRepository.UpdateAsync(localUser, cancellationToken: cancellationToken)); } else { return localUser; } - return await _userRepository.FindAsync(externalUser.Id, cancellationToken: cancellationToken).ConfigureAwait(false); + return await _userRepository.FindAsync(externalUser.Id, cancellationToken: cancellationToken); } protected abstract TUser CreateUser(IUserData externalUser); @@ -144,8 +144,8 @@ namespace Volo.Abp.Users { using (var uow = _unitOfWorkManager.Begin(requiresNew: true)) { - await func().ConfigureAwait(false); - await uow.SaveChangesAsync().ConfigureAwait(false); + await func(); + await uow.SaveChangesAsync(); } } } diff --git a/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupServiceExtensions.cs b/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupServiceExtensions.cs index a605db88bc..88781ea026 100644 --- a/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupServiceExtensions.cs +++ b/modules/users/src/Volo.Abp.Users.Domain/Volo/Abp/Users/UserLookupServiceExtensions.cs @@ -10,7 +10,7 @@ namespace Volo.Abp.Users public static async Task GetByIdAsync(this IUserLookupService userLookupService, Guid id, CancellationToken cancellationToken = default) where TUser : class, IUser { - var user = await userLookupService.FindByIdAsync(id, cancellationToken).ConfigureAwait(false); + var user = await userLookupService.FindByIdAsync(id, cancellationToken); if (user == null) { throw new EntityNotFoundException(typeof(TUser), id); @@ -22,7 +22,7 @@ namespace Volo.Abp.Users public static async Task GetByUserNameAsync(this IUserLookupService userLookupService, string userName, CancellationToken cancellationToken = default) where TUser : class, IUser { - var user = await userLookupService.FindByUserNameAsync(userName, cancellationToken).ConfigureAwait(false); + var user = await userLookupService.FindByUserNameAsync(userName, cancellationToken); if (user == null) { throw new EntityNotFoundException(typeof(TUser), userName); diff --git a/modules/users/src/Volo.Abp.Users.EntityFrameworkCore/FodyWeavers.xml b/modules/users/src/Volo.Abp.Users.EntityFrameworkCore/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/users/src/Volo.Abp.Users.EntityFrameworkCore/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/users/src/Volo.Abp.Users.EntityFrameworkCore/FodyWeavers.xsd b/modules/users/src/Volo.Abp.Users.EntityFrameworkCore/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/users/src/Volo.Abp.Users.EntityFrameworkCore/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/users/src/Volo.Abp.Users.EntityFrameworkCore/Volo.Abp.Users.EntityFrameworkCore.csproj b/modules/users/src/Volo.Abp.Users.EntityFrameworkCore/Volo.Abp.Users.EntityFrameworkCore.csproj index d70b92e1a4..666cc83f09 100644 --- a/modules/users/src/Volo.Abp.Users.EntityFrameworkCore/Volo.Abp.Users.EntityFrameworkCore.csproj +++ b/modules/users/src/Volo.Abp.Users.EntityFrameworkCore/Volo.Abp.Users.EntityFrameworkCore.csproj @@ -1,9 +1,10 @@ - + + - netstandard2.1 + netstandard2.0 Volo.Abp.Users.EntityFrameworkCore Volo.Abp.Users.EntityFrameworkCore $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; diff --git a/modules/users/src/Volo.Abp.Users.EntityFrameworkCore/Volo/Abp/Users/EntityFrameworkCore/EfCoreAbpUserRepositoryBase.cs b/modules/users/src/Volo.Abp.Users.EntityFrameworkCore/Volo/Abp/Users/EntityFrameworkCore/EfCoreAbpUserRepositoryBase.cs index 6dbc5b7d0c..5d0958101c 100644 --- a/modules/users/src/Volo.Abp.Users.EntityFrameworkCore/Volo/Abp/Users/EntityFrameworkCore/EfCoreAbpUserRepositoryBase.cs +++ b/modules/users/src/Volo.Abp.Users.EntityFrameworkCore/Volo/Abp/Users/EntityFrameworkCore/EfCoreAbpUserRepositoryBase.cs @@ -21,12 +21,12 @@ namespace Volo.Abp.Users.EntityFrameworkCore public async Task FindByUserNameAsync(string userName, CancellationToken cancellationToken = default) { - return await this.FirstOrDefaultAsync(u => u.UserName == userName, GetCancellationToken(cancellationToken)).ConfigureAwait(false); + return await this.FirstOrDefaultAsync(u => u.UserName == userName, GetCancellationToken(cancellationToken)); } public virtual async Task> GetListAsync(IEnumerable ids, CancellationToken cancellationToken = default) { - return await DbSet.Where(u => ids.Contains(u.Id)).ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + return await DbSet.Where(u => ids.Contains(u.Id)).ToListAsync(GetCancellationToken(cancellationToken)); } } } \ No newline at end of file diff --git a/modules/users/src/Volo.Abp.Users.MongoDB/FodyWeavers.xml b/modules/users/src/Volo.Abp.Users.MongoDB/FodyWeavers.xml new file mode 100644 index 0000000000..be0de3a908 --- /dev/null +++ b/modules/users/src/Volo.Abp.Users.MongoDB/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/modules/users/src/Volo.Abp.Users.MongoDB/FodyWeavers.xsd b/modules/users/src/Volo.Abp.Users.MongoDB/FodyWeavers.xsd new file mode 100644 index 0000000000..3f3946e282 --- /dev/null +++ b/modules/users/src/Volo.Abp.Users.MongoDB/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/modules/users/src/Volo.Abp.Users.MongoDB/Volo.Abp.Users.MongoDB.csproj b/modules/users/src/Volo.Abp.Users.MongoDB/Volo.Abp.Users.MongoDB.csproj index 205d39d7ae..4efc907924 100644 --- a/modules/users/src/Volo.Abp.Users.MongoDB/Volo.Abp.Users.MongoDB.csproj +++ b/modules/users/src/Volo.Abp.Users.MongoDB/Volo.Abp.Users.MongoDB.csproj @@ -1,5 +1,6 @@ + diff --git a/modules/users/src/Volo.Abp.Users.MongoDB/Volo/Abp/Users/MongoDB/MongoUserRepositoryBase.cs b/modules/users/src/Volo.Abp.Users.MongoDB/Volo/Abp/Users/MongoDB/MongoUserRepositoryBase.cs index a176db97b4..50d892d8dd 100644 --- a/modules/users/src/Volo.Abp.Users.MongoDB/Volo/Abp/Users/MongoDB/MongoUserRepositoryBase.cs +++ b/modules/users/src/Volo.Abp.Users.MongoDB/Volo/Abp/Users/MongoDB/MongoUserRepositoryBase.cs @@ -22,12 +22,12 @@ namespace Volo.Abp.Users.MongoDB public virtual async Task FindByUserNameAsync(string userName, CancellationToken cancellationToken = default) { - return await GetMongoQueryable().FirstOrDefaultAsync(u => u.UserName == userName, GetCancellationToken(cancellationToken)).ConfigureAwait(false); + return await GetMongoQueryable().FirstOrDefaultAsync(u => u.UserName == userName, GetCancellationToken(cancellationToken)); } public virtual async Task> GetListAsync(IEnumerable ids, CancellationToken cancellationToken = default) { - return await GetMongoQueryable().Where(u => ids.Contains(u.Id)).ToListAsync(GetCancellationToken(cancellationToken)).ConfigureAwait(false); + return await GetMongoQueryable().Where(u => ids.Contains(u.Id)).ToListAsync(GetCancellationToken(cancellationToken)); } } } \ No newline at end of file diff --git a/modules/users/test/Volo.Abp.Users.EntityFrameworkCore.Tests/Volo.Abp.Users.EntityFrameworkCore.Tests.csproj b/modules/users/test/Volo.Abp.Users.EntityFrameworkCore.Tests/Volo.Abp.Users.EntityFrameworkCore.Tests.csproj index 286cfbf85d..a63193fbff 100644 --- a/modules/users/test/Volo.Abp.Users.EntityFrameworkCore.Tests/Volo.Abp.Users.EntityFrameworkCore.Tests.csproj +++ b/modules/users/test/Volo.Abp.Users.EntityFrameworkCore.Tests/Volo.Abp.Users.EntityFrameworkCore.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp2.2 diff --git a/modules/users/test/Volo.Abp.Users.MongoDB.Tests/Volo.Abp.Users.MongoDB.Tests.csproj b/modules/users/test/Volo.Abp.Users.MongoDB.Tests/Volo.Abp.Users.MongoDB.Tests.csproj index 5a5fdebd93..06b92ffd34 100644 --- a/modules/users/test/Volo.Abp.Users.MongoDB.Tests/Volo.Abp.Users.MongoDB.Tests.csproj +++ b/modules/users/test/Volo.Abp.Users.MongoDB.Tests/Volo.Abp.Users.MongoDB.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp2.2 diff --git a/npm/get-version.js b/npm/get-version.js new file mode 100644 index 0000000000..7f3dd79e3b --- /dev/null +++ b/npm/get-version.js @@ -0,0 +1,3 @@ +const fse = require("fs-extra"); + +console.log(fse.readJSONSync("package.json").version); diff --git a/npm/lerna.json b/npm/lerna.json index f941062e34..c482601db0 100644 --- a/npm/lerna.json +++ b/npm/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.1.1", + "version": "2.0.1", "packages": [ "packs/*" ], diff --git a/npm/ng-packs/CHANGELOG.md b/npm/ng-packs/CHANGELOG.md index 3ee75c623d..64777880da 100644 --- a/npm/ng-packs/CHANGELOG.md +++ b/npm/ng-packs/CHANGELOG.md @@ -1,3 +1,41 @@ +# [2.0.0](https://github.com/abpframework/abp/compare/1.1.2...2.0.0) (2020-01-13) + + +### Bug Fixes + +* **core:** fix flattedRoutes manipulation ([2b2e0be](https://github.com/abpframework/abp/commit/2b2e0be51d9fb37188348f390b56df286de7a6bc)) +* **core:** fix nullable control in the config state ([756e858](https://github.com/abpframework/abp/commit/756e8588f3dd2d1035dbc22db3773653e28b1542)) +* **core:** update flattedRoutes when patchRoute action dispatched ([15a8279](https://github.com/abpframework/abp/commit/15a82794ac5173bd080d3aec46efb43bfc0614ae)) +* **permission-management:** fix twice executing problem of visible setter([ae16916](https://github.com/abpframework/abp/commit/ae16916ae2b03dfc25d9c4c5ceeb559dee34bde2)) +* **theme-shared:** fix remember me functionality [(#2610)](https://github.com/abpframework/abp/pull/2610) ([189a77f](https://github.com/abpframework/abp/commit/189a77f4c421398b841e67280f6f19c4ef56649d)), closes [(#2602)](https://github.com/abpframework/abp/issues/2602) + + +### Code Refactoring + +* remove deprecated functions, outputs, inputs etc. ([f1d0eba](https://github.com/abpframework/abp/commit/f1d0ebae856406213023af11632ed72849928b3e)), closes [#2476](https://github.com/abpframework/abp/issues/2476) + + +### Features + +* add state actions to related state services ([#2431](https://github.com/abpframework/abp/pull/2431)), closes ([#2430](https://github.com/abpframework/abp/pull/2430)) +* make some components replaceable ([#2522](https://github.com/abpframework/abp/pull/2522)), closes ([#2404](https://github.com/abpframework/abp/issues/2404)) +* **account:** add autocomplete attiributes for chromium based browsers ([343c847](https://github.com/abpframework/abp/commit/343c847fb70d634218de1b156b3a15557e27acda)) +* **account:** add the enableLocalLogin condition to auth-wrapper ([#2537](https://github.com/abpframework/abp/pull/2573)) ([0fb7ba4](https://github.com/abpframework/abp/commit/0fb7ba4614ebb64a00f19a9bef277a0fb9bee764)) +* **core:** add init directive ([5ae1071](https://github.com/abpframework/abp/commit/5ae10717d73b1d76711dcd68201ed6b0609c4112)) +* **core:** add ExtractFromGeneric type to ABP namespace ([1fe3b35](https://github.com/abpframework/abp/commit/1fe3b35076c5daddf9edc2a8396b62288cf105da)) +* **core:** add init directive to emit an output when the element initialized ([31c224c](https://github.com/abpframework/abp/commit/31c224c9f9c015e94877d1eba382d1cd415704c7)) +* **core:** fill the parentName property in flattedRoutes for child rotues ([17dd0a2](https://github.com/abpframework/abp/commit/17dd0a25a7dc2fa6268ce68f4f2f5d78f78a1f23)) +* **core:** create AddRoute action to add new elements to top navigation ([#2425](https://github.com/abpframework/abp/pull/2425)), closes ([#2186](https://github.com/abpframework/abp/pull/2186)) +* **theme-shared:** trigger unload confirmation in the modal component when form is dirty ([f59a294](https://github.com/abpframework/abp/commit/f59a2945b223a19750afd46da7e33deff2583328)) +* **theme-shared:** create new toast and confirmation components ([#2606](https://github.com/abpframework/abp/pull/2606)), closes ([#2537](https://github.com/abpframework/abp/issues/2537)) +* **theme-shared:** create table, pagination, loading components ([#2605](https://github.com/abpframework/abp/pull/2605)), related ([#2537](https://github.com/abpframework/abp/issues/2537)) + + +### BREAKING CHANGES + +* Deprecated functions, outputs, inputs addressed in issue #2476 are removed. + + # [1.1.0](https://github.com/abpframework/abp/compare/1.0.2...1.1.0) (2019-12-06) diff --git a/npm/ng-packs/apps/dev-app/src/app/shared/shared.module.ts b/npm/ng-packs/apps/dev-app/src/app/shared/shared.module.ts index 6bae4ea332..6c4c9b016c 100644 --- a/npm/ng-packs/apps/dev-app/src/app/shared/shared.module.ts +++ b/npm/ng-packs/apps/dev-app/src/app/shared/shared.module.ts @@ -4,11 +4,26 @@ import { NgModule } from '@angular/core'; import { ThemeBasicModule } from '@abp/ng.theme.basic'; import { ThemeSharedModule } from '@abp/ng.theme.shared'; import { TableModule } from 'primeng/table'; +import { NgxValidateCoreModule } from '@ngx-validate/core'; @NgModule({ declarations: [], - imports: [CoreModule, ThemeSharedModule, ThemeBasicModule, TableModule, NgbDropdownModule], - exports: [CoreModule, ThemeSharedModule, ThemeBasicModule, TableModule, NgbDropdownModule], + imports: [ + CoreModule, + ThemeSharedModule, + ThemeBasicModule, + TableModule, + NgbDropdownModule, + NgxValidateCoreModule, + ], + exports: [ + CoreModule, + ThemeSharedModule, + ThemeBasicModule, + TableModule, + NgbDropdownModule, + NgxValidateCoreModule, + ], providers: [], }) export class SharedModule {} diff --git a/npm/ng-packs/apps/dev-app/src/favicon.ico b/npm/ng-packs/apps/dev-app/src/favicon.ico index 997406ad22..39695854d2 100644 Binary files a/npm/ng-packs/apps/dev-app/src/favicon.ico and b/npm/ng-packs/apps/dev-app/src/favicon.ico differ diff --git a/npm/ng-packs/apps/dev-app/src/index.html b/npm/ng-packs/apps/dev-app/src/index.html index cb6d4ae93a..c879c573b1 100644 --- a/npm/ng-packs/apps/dev-app/src/index.html +++ b/npm/ng-packs/apps/dev-app/src/index.html @@ -2,7 +2,7 @@ - DevApp + ABP Dev diff --git a/npm/ng-packs/apps/dev-app/tsconfig.app.json b/npm/ng-packs/apps/dev-app/tsconfig.app.json index cc22d70d1c..464faaec10 100644 --- a/npm/ng-packs/apps/dev-app/tsconfig.app.json +++ b/npm/ng-packs/apps/dev-app/tsconfig.app.json @@ -6,8 +6,8 @@ "paths": { "@abp/ng.core": ["packages/core/src/public-api.ts"], "@abp/ng.core/*": ["packages/core/src/lib/*"], - // "@abp/ng.theme.shared": ["packages/theme-shared/src/public-api.ts"], - // "@abp/ng.theme.shared/*": ["packages/theme-shared/src/lib/*"], + "@abp/ng.theme.shared": ["packages/theme-shared/src/public-api.ts"], + "@abp/ng.theme.shared/*": ["packages/theme-shared/src/lib/*"], "@abp/ng.theme.basic": ["packages/theme-basic/src/public-api.ts"], "@abp/ng.theme.basic/*": ["packages/theme-basic/src/lib/*"], "@abp/ng.account": ["packages/account/src/public-api.ts"], diff --git a/npm/ng-packs/lerna.version.json b/npm/ng-packs/lerna.version.json index 1a9787d177..db0d8368b9 100644 --- a/npm/ng-packs/lerna.version.json +++ b/npm/ng-packs/lerna.version.json @@ -1,5 +1,7 @@ { - "version": "1.1.1", - "packages": ["packages/*"], + "version": "2.0.1", + "packages": [ + "packages/*" + ], "npmClient": "yarn" } diff --git a/npm/ng-packs/package.json b/npm/ng-packs/package.json index 920fe7a595..c440aed399 100644 --- a/npm/ng-packs/package.json +++ b/npm/ng-packs/package.json @@ -12,7 +12,7 @@ "test": "ng test --watchAll --runInBand", "commit": "git-cz", "lint": "ng lint", - "scripts:build": "cd scripts && npm install && yarn build", + "scripts:build": "cd scripts && yarn && yarn build", "prepare:workspace": "yarn scripts:build", "ci": "yarn prepare:workspace && yarn ci:test && yarn ng lint && yarn ci:build", "ci:test": "ng test --coverage=false", @@ -21,19 +21,19 @@ "generate:changelog": "conventional-changelog -p angular -i CHANGELOG.md -s" }, "devDependencies": { - "@abp/ng.account": "^1.1.1", - "@abp/ng.account.config": "^1.1.1", - "@abp/ng.core": "^1.1.1", - "@abp/ng.feature-management": "^1.1.1", - "@abp/ng.identity": "^1.1.1", - "@abp/ng.identity.config": "^1.1.1", - "@abp/ng.permission-management": "^1.1.1", - "@abp/ng.setting-management": "^1.1.1", - "@abp/ng.setting-management.config": "^1.1.1", - "@abp/ng.tenant-management": "^1.1.1", - "@abp/ng.tenant-management.config": "^1.1.1", - "@abp/ng.theme.basic": "^1.1.1", - "@abp/ng.theme.shared": "^1.1.1", + "@abp/ng.account": "^2.0.1", + "@abp/ng.account.config": "^2.0.1", + "@abp/ng.core": "^2.0.1", + "@abp/ng.feature-management": "^2.0.1", + "@abp/ng.identity": "^2.0.1", + "@abp/ng.identity.config": "^2.0.1", + "@abp/ng.permission-management": "^2.0.1", + "@abp/ng.setting-management": "^2.0.1", + "@abp/ng.setting-management.config": "^2.0.1", + "@abp/ng.tenant-management": "^2.0.1", + "@abp/ng.tenant-management.config": "^2.0.1", + "@abp/ng.theme.basic": "^2.0.1", + "@abp/ng.theme.shared": "^2.0.1", "@angular-builders/jest": "^8.2.0", "@angular-devkit/build-angular": "~0.803.21", "@angular-devkit/build-ng-packagr": "~0.803.21", @@ -74,7 +74,6 @@ "just-compare": "^1.3.0", "lerna": "^3.19.0", "ng-packagr": "^5.7.1", - "ngx-perfect-scrollbar": "^8.0.0", "ngxs-reset-plugin": "^1.2.0", "ngxs-schematic": "^1.1.9", "prettier": "^1.18.2", @@ -83,7 +82,7 @@ "protractor": "~5.4.0", "rxjs": "~6.4.0", "snq": "^1.0.3", - "symlink-manager": "^1.4.1", + "symlink-manager": "^1.4.2", "ts-node": "~7.0.0", "tsickle": "^0.37.0", "tslint": "~5.20.0", diff --git a/npm/ng-packs/packages/account-config/package.json b/npm/ng-packs/packages/account-config/package.json index aeb8d2b697..430263c48f 100644 --- a/npm/ng-packs/packages/account-config/package.json +++ b/npm/ng-packs/packages/account-config/package.json @@ -1,6 +1,6 @@ { "name": "@abp/ng.account.config", - "version": "1.1.1", + "version": "2.0.1", "homepage": "https://abp.io", "repository": { "type": "git", diff --git a/npm/ng-packs/packages/account/package.json b/npm/ng-packs/packages/account/package.json index 88f866d5a4..c6478dab6e 100644 --- a/npm/ng-packs/packages/account/package.json +++ b/npm/ng-packs/packages/account/package.json @@ -1,14 +1,14 @@ { "name": "@abp/ng.account", - "version": "1.1.1", + "version": "2.0.1", "homepage": "https://abp.io", "repository": { "type": "git", "url": "https://github.com/abpframework/abp.git" }, "dependencies": { - "@abp/ng.account.config": "^1.1.1", - "@abp/ng.theme.shared": "^1.1.1" + "@abp/ng.account.config": "^2.0.1", + "@abp/ng.theme.shared": "^2.0.1" }, "publishConfig": { "access": "public" diff --git a/npm/ng-packs/packages/account/src/lib/account.module.ts b/npm/ng-packs/packages/account/src/lib/account.module.ts index 3923ff4e17..93a496f8b5 100644 --- a/npm/ng-packs/packages/account/src/lib/account.module.ts +++ b/npm/ng-packs/packages/account/src/lib/account.module.ts @@ -3,7 +3,6 @@ import { ThemeSharedModule } from '@abp/ng.theme.shared'; import { NgModule, Provider } from '@angular/core'; import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'; import { NgxValidateCoreModule } from '@ngx-validate/core'; -import { TableModule } from 'primeng/table'; import { AccountRoutingModule } from './account-routing.module'; import { ChangePasswordComponent } from './components/change-password/change-password.component'; import { LoginComponent } from './components/login/login.component'; @@ -29,7 +28,6 @@ import { AuthWrapperComponent } from './components/auth-wrapper/auth-wrapper.com CoreModule, AccountRoutingModule, ThemeSharedModule, - TableModule, NgbDropdownModule, NgxValidateCoreModule, ], diff --git a/npm/ng-packs/packages/account/src/lib/components/auth-wrapper/auth-wrapper.component.html b/npm/ng-packs/packages/account/src/lib/components/auth-wrapper/auth-wrapper.component.html index f25b6eae0c..145935f7c5 100644 --- a/npm/ng-packs/packages/account/src/lib/components/auth-wrapper/auth-wrapper.component.html +++ b/npm/ng-packs/packages/account/src/lib/components/auth-wrapper/auth-wrapper.component.html @@ -5,7 +5,10 @@ > + + +
    + {{ 'AbpAccount::InvalidLoginRequest' | abpLocalization }} + {{ 'AbpAccount::ThereAreNoLoginSchemesConfiguredForThisClient' | abpLocalization }} +
    +
    diff --git a/npm/ng-packs/packages/account/src/lib/components/auth-wrapper/auth-wrapper.component.ts b/npm/ng-packs/packages/account/src/lib/components/auth-wrapper/auth-wrapper.component.ts index d38754ff50..6df49195c4 100644 --- a/npm/ng-packs/packages/account/src/lib/components/auth-wrapper/auth-wrapper.component.ts +++ b/npm/ng-packs/packages/account/src/lib/components/auth-wrapper/auth-wrapper.component.ts @@ -1,4 +1,6 @@ -import { Component, Input, TemplateRef } from '@angular/core'; +import { ConfigState, takeUntilDestroy } from '@abp/ng.core'; +import { Component, Input, OnDestroy, OnInit, TemplateRef } from '@angular/core'; +import { Store } from '@ngxs/store'; import { Account } from '../../models/account'; @Component({ @@ -7,10 +9,31 @@ import { Account } from '../../models/account'; exportAs: 'abpAuthWrapper', }) export class AuthWrapperComponent - implements Account.AuthWrapperComponentInputs, Account.AuthWrapperComponentOutputs { + implements + Account.AuthWrapperComponentInputs, + Account.AuthWrapperComponentOutputs, + OnInit, + OnDestroy { @Input() readonly mainContentRef: TemplateRef; @Input() readonly cancelContentRef: TemplateRef; + + enableLocalLogin = true; + + constructor(private store: Store) {} + + ngOnInit() { + this.store + .select(ConfigState.getSetting('Abp.Account.EnableLocalLogin')) + .pipe(takeUntilDestroy(this)) + .subscribe(value => { + if (value) { + this.enableLocalLogin = value.toLowerCase() !== 'false'; + } + }); + } + + ngOnDestroy() {} } diff --git a/npm/ng-packs/packages/account/src/lib/components/change-password/change-password.component.ts b/npm/ng-packs/packages/account/src/lib/components/change-password/change-password.component.ts index 2b66a80b94..87169a2c1f 100644 --- a/npm/ng-packs/packages/account/src/lib/components/change-password/change-password.component.ts +++ b/npm/ng-packs/packages/account/src/lib/components/change-password/change-password.component.ts @@ -54,7 +54,9 @@ export class ChangePasswordComponent passwordRulesArr.push('capital'); } - if (+(passwordRules['Abp.Identity.Password.RequiredUniqueChars'] || 0) > 0) { + if ( + (passwordRules['Abp.Identity.Password.RequireNonAlphanumeric'] || '').toLowerCase() === 'true' + ) { passwordRulesArr.push('special'); } @@ -72,7 +74,7 @@ export class ChangePasswordComponent required, validatePassword(passwordRulesArr), minLength(requiredLength), - maxLength(32), + maxLength(128), ], }, ], @@ -83,7 +85,7 @@ export class ChangePasswordComponent required, validatePassword(passwordRulesArr), minLength(requiredLength), - maxLength(32), + maxLength(128), ], }, ], diff --git a/npm/ng-packs/packages/account/src/lib/components/login/login.component.html b/npm/ng-packs/packages/account/src/lib/components/login/login.component.html index c448e2a228..09e5d0314d 100644 --- a/npm/ng-packs/packages/account/src/lib/components/login/login.component.html +++ b/npm/ng-packs/packages/account/src/lib/components/login/login.component.html @@ -12,7 +12,7 @@

    {{ 'AbpAccount::Login' | abpLocalization }}

    - + {{ 'AbpAccount::AreYouANewUser' | abpLocalization }} {{ 'AbpAccount::Register' | abpLocalization diff --git a/npm/ng-packs/packages/account/src/lib/components/login/login.component.ts b/npm/ng-packs/packages/account/src/lib/components/login/login.component.ts index c3b037afa0..21a6ac31a2 100644 --- a/npm/ng-packs/packages/account/src/lib/components/login/login.component.ts +++ b/npm/ng-packs/packages/account/src/lib/components/login/login.component.ts @@ -1,15 +1,12 @@ -import { GetAppConfiguration, ConfigState, SessionState } from '@abp/ng.core'; -import { Component, Inject, Optional } from '@angular/core'; +import { AuthService, SetRemember, ConfigState } from '@abp/ng.core'; +import { ToasterService } from '@abp/ng.theme.shared'; +import { Component, OnInit } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import { Navigate } from '@ngxs/router-plugin'; import { Store } from '@ngxs/store'; import { OAuthService } from 'angular-oauth2-oidc'; -import { from, throwError } from 'rxjs'; -import { Options } from '../../models/options'; -import { ToasterService } from '@abp/ng.theme.shared'; -import { catchError, finalize, switchMap, tap } from 'rxjs/operators'; +import { throwError } from 'rxjs'; +import { catchError, finalize } from 'rxjs/operators'; import snq from 'snq'; -import { HttpHeaders } from '@angular/common/http'; const { maxLength, minLength, required } = Validators; @@ -17,47 +14,43 @@ const { maxLength, minLength, required } = Validators; selector: 'abp-login', templateUrl: './login.component.html', }) -export class LoginComponent { +export class LoginComponent implements OnInit { form: FormGroup; inProgress: boolean; + isSelfRegistrationEnabled = true; + constructor( private fb: FormBuilder, private oauthService: OAuthService, private store: Store, private toasterService: ToasterService, - @Optional() @Inject('ACCOUNT_OPTIONS') private options: Options, - ) { - this.oauthService.configure(this.store.selectSnapshot(ConfigState.getOne('environment')).oAuthConfig); - this.oauthService.loadDiscoveryDocument(); + private authService: AuthService, + ) {} + + ngOnInit() { + this.isSelfRegistrationEnabled = + ( + (this.store.selectSnapshot( + ConfigState.getSetting('Abp.Account.IsSelfRegistrationEnabled'), + ) as string) || '' + ).toLowerCase() !== 'false'; this.form = this.fb.group({ username: ['', [required, maxLength(255)]], - password: ['', [required, maxLength(32)]], + password: ['', [required, maxLength(128)]], remember: [false], }); } onSubmit() { if (this.form.invalid) return; - // this.oauthService.setStorage(this.form.value.remember ? localStorage : sessionStorage); this.inProgress = true; - const tenant = this.store.selectSnapshot(SessionState.getTenant); - from( - this.oauthService.fetchTokenUsingPasswordFlow( - this.form.get('username').value, - this.form.get('password').value, - new HttpHeaders({ ...(tenant && tenant.id && { __tenant: tenant.id }) }), - ), - ) + this.authService + .login(this.form.get('username').value, this.form.get('password').value) .pipe( - switchMap(() => this.store.dispatch(new GetAppConfiguration())), - tap(() => { - const redirectUrl = snq(() => window.history.state).redirectUrl || (this.options || {}).redirectUrl || '/'; - this.store.dispatch(new Navigate([redirectUrl])); - }), catchError(err => { this.toasterService.error( snq(() => err.error.error_description) || @@ -69,6 +62,8 @@ export class LoginComponent { }), finalize(() => (this.inProgress = false)), ) - .subscribe(); + .subscribe(() => { + this.store.dispatch(new SetRemember(this.form.get('remember').value)); + }); } } diff --git a/npm/ng-packs/packages/account/src/lib/components/manage-profile/manage-profile.component.html b/npm/ng-packs/packages/account/src/lib/components/manage-profile/manage-profile.component.html index 04dd582ac7..20ddf69a06 100644 --- a/npm/ng-packs/packages/account/src/lib/components/manage-profile/manage-profile.component.html +++ b/npm/ng-packs/packages/account/src/lib/components/manage-profile/manage-profile.component.html @@ -3,7 +3,7 @@
    -
    + -
    +

    diff --git a/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.html b/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.html index 5e7b292703..291d3f1cbd 100644 --- a/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.html +++ b/npm/ng-packs/packages/account/src/lib/components/personal-settings/personal-settings.component.html @@ -27,7 +27,8 @@

    * + > *
    {{ 'AbpIdentity::Save' | abpLocalization }} diff --git a/npm/ng-packs/packages/account/src/lib/components/register/register.component.html b/npm/ng-packs/packages/account/src/lib/components/register/register.component.html index 4a0f75d010..f803d473cd 100644 --- a/npm/ng-packs/packages/account/src/lib/components/register/register.component.html +++ b/npm/ng-packs/packages/account/src/lib/components/register/register.component.html @@ -16,7 +16,13 @@ 'AbpAccount::Login' | abpLocalization }} -
    +
    * = this.store.selectSnapshot( ConfigState.getSettings('Identity.Password'), ); @@ -55,7 +71,9 @@ export class RegisterComponent implements OnInit { passwordRulesArr.push('capital'); } - if (+(passwordRules['Abp.Identity.Password.RequiredUniqueChars'] || 0) > 0) { + if ( + (passwordRules['Abp.Identity.Password.RequireNonAlphanumeric'] || '').toLowerCase() === 'true' + ) { passwordRulesArr.push('special'); } @@ -67,7 +85,7 @@ export class RegisterComponent implements OnInit { username: ['', [required, maxLength(255)]], password: [ '', - [required, validatePassword(passwordRulesArr), minLength(requiredLength), maxLength(32)], + [required, validatePassword(passwordRulesArr), minLength(requiredLength), maxLength(128)], ], email: ['', [required, email]], }); @@ -85,25 +103,10 @@ export class RegisterComponent implements OnInit { appName: 'Angular', } as RegisterRequest; - const tenant = this.store.selectSnapshot(SessionState.getTenant); - this.accountService .register(newUser) .pipe( - switchMap(() => - from( - this.oauthService.fetchTokenUsingPasswordFlow( - newUser.userName, - newUser.password, - new HttpHeaders({ - ...(tenant && tenant.id && { __tenant: tenant.id }), - }), - ), - ), - ), - switchMap(() => this.store.dispatch(new GetAppConfiguration())), - tap(() => this.store.dispatch(new Navigate(['/']))), - take(1), + switchMap(() => this.authService.login(newUser.userName, newUser.password)), catchError(err => { this.toasterService.error( snq(() => err.error.error_description) || diff --git a/npm/ng-packs/packages/account/src/lib/models/account.ts b/npm/ng-packs/packages/account/src/lib/models/account.ts index fc455758cb..04a37709c6 100644 --- a/npm/ng-packs/packages/account/src/lib/models/account.ts +++ b/npm/ng-packs/packages/account/src/lib/models/account.ts @@ -6,24 +6,13 @@ export namespace Account { readonly cancelContentRef?: TemplateRef; } - // tslint:disable-next-line: no-empty-interface + //tslint:disable export interface AuthWrapperComponentOutputs {} - - // tslint:disable-next-line: no-empty-interface export interface TenantBoxComponentInputs {} - - // tslint:disable-next-line: no-empty-interface export interface TenantBoxComponentOutputs {} - - // tslint:disable-next-line: no-empty-interface export interface PersonalSettingsComponentInputs {} - - // tslint:disable-next-line: no-empty-interface export interface PersonalSettingsComponentOutputs {} - - // tslint:disable-next-line: no-empty-interface export interface ChangePasswordComponentInputs {} - - // tslint:disable-next-line: no-empty-interface export interface ChangePasswordComponentOutputs {} + // tslint:enable } diff --git a/npm/ng-packs/packages/core/package.json b/npm/ng-packs/packages/core/package.json index 10063989b5..51dfa528d5 100644 --- a/npm/ng-packs/packages/core/package.json +++ b/npm/ng-packs/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@abp/ng.core", - "version": "1.1.1", + "version": "2.0.1", "homepage": "https://abp.io", "repository": { "type": "git", diff --git a/npm/ng-packs/packages/core/src/lib/abstracts/ng-model.component.ts b/npm/ng-packs/packages/core/src/lib/abstracts/ng-model.component.ts index 4614011b92..7176803b74 100644 --- a/npm/ng-packs/packages/core/src/lib/abstracts/ng-model.component.ts +++ b/npm/ng-packs/packages/core/src/lib/abstracts/ng-model.component.ts @@ -1,27 +1,48 @@ import { ControlValueAccessor } from '@angular/forms'; -import { ChangeDetectorRef, Component, Injector, Input, Type } from '@angular/core'; +import { ChangeDetectorRef, Component, Injector, Input } from '@angular/core'; -@Component({ selector: 'abp-abstract-ng-model', template: '' }) -export class AbstractNgModelComponent implements ControlValueAccessor { - @Input() disabled: boolean; +// Not an abstract class on purpose. Do not change! +// tslint:disable-next-line: use-component-selector +@Component({ template: '' }) +export class AbstractNgModelComponent implements ControlValueAccessor { + protected _value: T; + protected cdRef: ChangeDetectorRef; + onChange: (value: T) => {}; + onTouched: () => {}; + + @Input() + disabled: boolean; + + @Input() + readonly: boolean; + + @Input() + valueFn: (value: U, previousValue?: T) => T = value => (value as any) as T; + + @Input() + valueLimitFn: (value: T, previousValue?: T) => any = value => false; + + @Input() + set value(value: T) { + value = this.valueFn((value as any) as U, this._value); + + if (this.valueLimitFn(value, this._value) !== false || this.readonly) return; - @Input() set value(value: T) { this._value = value; this.notifyValueChange(); } get value(): T { - return this._value; + return this._value || this.defaultValue; } - onChange: (value: T) => {}; - onTouched: () => {}; - - protected _value: T; - protected cdRef: ChangeDetectorRef; + get defaultValue(): T { + return this._value; + } constructor(public injector: Injector) { - this.cdRef = injector.get(ChangeDetectorRef as Type); + // tslint:disable-next-line: deprecation + this.cdRef = injector.get(ChangeDetectorRef); } notifyValueChange(): void { @@ -31,8 +52,8 @@ export class AbstractNgModelComponent implements ControlValueAccessor { } writeValue(value: T): void { - this._value = value; - setTimeout(() => this.cdRef.detectChanges(), 0); + this._value = this.valueLimitFn(value, this._value) || value; + setTimeout(() => this.cdRef.markForCheck(), 0); } registerOnChange(fn: any): void { diff --git a/npm/ng-packs/packages/core/src/lib/actions/config.actions.ts b/npm/ng-packs/packages/core/src/lib/actions/config.actions.ts index 7e7f932e24..8fd11bd2cb 100644 --- a/npm/ng-packs/packages/core/src/lib/actions/config.actions.ts +++ b/npm/ng-packs/packages/core/src/lib/actions/config.actions.ts @@ -1,4 +1,5 @@ -import { ABP } from '../models'; +import { ABP } from '../models/common'; +import { Config } from '../models/config'; export class PatchRouteByName { static readonly type = '[Config] Patch Route By Name'; @@ -16,3 +17,8 @@ export class AddRoute { static readonly type = '[Config] Add Route'; constructor(public payload: Omit) {} } + +export class SetEnvironment { + static readonly type = '[Config] Set Environment'; + constructor(public environment: Config.Environment) {} +} diff --git a/npm/ng-packs/packages/core/src/lib/actions/replaceable-components.actions.ts b/npm/ng-packs/packages/core/src/lib/actions/replaceable-components.actions.ts index e611459960..3b948cf63d 100644 --- a/npm/ng-packs/packages/core/src/lib/actions/replaceable-components.actions.ts +++ b/npm/ng-packs/packages/core/src/lib/actions/replaceable-components.actions.ts @@ -1,5 +1,8 @@ import { ReplaceableComponents } from '../models/replaceable-components'; +/** + * @see usage: https://github.com/abpframework/abp/pull/2522#issue-358333183 + */ export class AddReplaceableComponent { static readonly type = '[ReplaceableComponents] Add'; constructor(public payload: ReplaceableComponents.ReplaceableComponent) {} diff --git a/npm/ng-packs/packages/core/src/lib/actions/session.actions.ts b/npm/ng-packs/packages/core/src/lib/actions/session.actions.ts index 7a89be4de3..463e9a202d 100644 --- a/npm/ng-packs/packages/core/src/lib/actions/session.actions.ts +++ b/npm/ng-packs/packages/core/src/lib/actions/session.actions.ts @@ -8,3 +8,11 @@ export class SetTenant { static readonly type = '[Session] Set Tenant'; constructor(public payload: ABP.BasicItem) {} } +export class ModifyOpenedTabCount { + static readonly type = '[Session] Modify Opened Tab Count'; + constructor(public operation: 'increase' | 'decrease') {} +} +export class SetRemember { + static readonly type = '[Session] Set Remember'; + constructor(public payload: boolean) {} +} diff --git a/npm/ng-packs/packages/core/src/lib/core.module.ts b/npm/ng-packs/packages/core/src/lib/core.module.ts index a3fc08c7e2..e89da17f29 100644 --- a/npm/ng-packs/packages/core/src/lib/core.module.ts +++ b/npm/ng-packs/packages/core/src/lib/core.module.ts @@ -6,7 +6,7 @@ import { RouterModule } from '@angular/router'; import { NgxsRouterPluginModule } from '@ngxs/router-plugin'; import { NgxsStoragePluginModule } from '@ngxs/storage-plugin'; import { NgxsModule, NGXS_PLUGINS } from '@ngxs/store'; -import { OAuthModule } from 'angular-oauth2-oidc'; +import { OAuthModule, OAuthStorage } from 'angular-oauth2-oidc'; import { AbstractNgModelComponent } from './abstracts/ng-model.component'; import { DynamicLayoutComponent } from './components/dynamic-layout.component'; import { RouterOutletComponent } from './components/router-outlet.component'; @@ -34,12 +34,15 @@ import { ReplaceableComponentsState } from './states/replaceable-components.stat import { InitDirective } from './directives/init.directive'; import { ReplaceableTemplateDirective } from './directives/replaceable-template.directive'; +export function storageFactory(): OAuthStorage { + return localStorage; +} @NgModule({ imports: [ NgxsModule.forFeature([ReplaceableComponentsState, ProfileState, SessionState, ConfigState]), NgxsRouterPluginModule.forRoot(), NgxsStoragePluginModule.forRoot({ key: ['SessionState'] }), - OAuthModule.forRoot(), + OAuthModule, CommonModule, HttpClientModule, FormsModule, @@ -127,6 +130,8 @@ export class CoreModule { deps: [Injector], useFactory: localeInitializer, }, + ...OAuthModule.forRoot().providers, + { provide: OAuthStorage, useFactory: storageFactory }, ], }; } diff --git a/npm/ng-packs/packages/core/src/lib/models/session.ts b/npm/ng-packs/packages/core/src/lib/models/session.ts index 8eba0cb36c..110fad53f5 100644 --- a/npm/ng-packs/packages/core/src/lib/models/session.ts +++ b/npm/ng-packs/packages/core/src/lib/models/session.ts @@ -4,5 +4,12 @@ export namespace Session { export interface State { language: string; tenant: ABP.BasicItem; + sessionDetail: SessionDetail; + } + + export interface SessionDetail { + openedTabCount: number; + lastExitTime: number; + remember: boolean; } } diff --git a/npm/ng-packs/packages/core/src/lib/services/auth.service.ts b/npm/ng-packs/packages/core/src/lib/services/auth.service.ts new file mode 100644 index 0000000000..5ae13a4012 --- /dev/null +++ b/npm/ng-packs/packages/core/src/lib/services/auth.service.ts @@ -0,0 +1,65 @@ +import { HttpHeaders } from '@angular/common/http'; +import { Inject, Injectable, Optional } from '@angular/core'; +import { Navigate } from '@ngxs/router-plugin'; +import { Store } from '@ngxs/store'; +import { OAuthService } from 'angular-oauth2-oidc'; +import { from, Observable } from 'rxjs'; +import { switchMap, tap, take } from 'rxjs/operators'; +import snq from 'snq'; +import { GetAppConfiguration } from '../actions/config.actions'; +import { SessionState } from '../states/session.state'; +import { RestService } from './rest.service'; +import { ConfigState } from '../states/config.state'; + +@Injectable({ + providedIn: 'root', +}) +export class AuthService { + constructor( + private rest: RestService, + private oAuthService: OAuthService, + private store: Store, + @Optional() @Inject('ACCOUNT_OPTIONS') private options: any, + ) {} + + login(username: string, password: string): Observable { + const tenant = this.store.selectSnapshot(SessionState.getTenant); + + this.oAuthService.configure( + this.store.selectSnapshot(ConfigState.getOne('environment')).oAuthConfig, + ); + + return from(this.oAuthService.loadDiscoveryDocument()).pipe( + switchMap(() => + from( + this.oAuthService.fetchTokenUsingPasswordFlow( + username, + password, + new HttpHeaders({ ...(tenant && tenant.id && { __tenant: tenant.id }) }), + ), + ), + ), + switchMap(() => this.store.dispatch(new GetAppConfiguration())), + tap(() => { + const redirectUrl = + snq(() => window.history.state.redirectUrl) || (this.options || {}).redirectUrl || '/'; + this.store.dispatch(new Navigate([redirectUrl])); + }), + take(1), + ); + } + + logout(): Observable { + return this.rest + .request({ + method: 'GET', + url: '/api/account/logout', + }) + .pipe( + switchMap(() => { + this.oAuthService.logOut(); + return this.store.dispatch(new GetAppConfiguration()); + }), + ); + } +} diff --git a/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts b/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts index 506b278634..cf97e42b0f 100644 --- a/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/config-state.service.ts @@ -1,8 +1,12 @@ import { Injectable } from '@angular/core'; import { Store } from '@ngxs/store'; +import { + AddRoute, + GetAppConfiguration, + PatchRouteByName, + SetEnvironment, +} from '../actions/config.actions'; import { ConfigState } from '../states'; -import { GetAppConfiguration, PatchRouteByName, AddRoute } from '../actions/config.actions'; -import { ABP } from '../models'; @Injectable({ providedIn: 'root', @@ -61,4 +65,8 @@ export class ConfigStateService { dispatchAddRoute(...args: ConstructorParameters) { return this.store.dispatch(new AddRoute(...args)); } + + dispatchSetEnvironment(...args: ConstructorParameters) { + return this.store.dispatch(new SetEnvironment(...args)); + } } diff --git a/npm/ng-packs/packages/core/src/lib/services/index.ts b/npm/ng-packs/packages/core/src/lib/services/index.ts index 6b90b997cc..e7f7f9b985 100644 --- a/npm/ng-packs/packages/core/src/lib/services/index.ts +++ b/npm/ng-packs/packages/core/src/lib/services/index.ts @@ -1,4 +1,5 @@ export * from './application-configuration.service'; +export * from './auth.service'; export * from './config-state.service'; export * from './lazy-load.service'; export * from './localization.service'; diff --git a/npm/ng-packs/packages/core/src/lib/services/localization.service.ts b/npm/ng-packs/packages/core/src/lib/services/localization.service.ts index d87d28a938..b12b517156 100644 --- a/npm/ng-packs/packages/core/src/lib/services/localization.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/localization.service.ts @@ -10,6 +10,9 @@ type ShouldReuseRoute = (future: ActivatedRouteSnapshot, curr: ActivatedRouteSna @Injectable({ providedIn: 'root' }) export class LocalizationService { + /** + * Returns currently selected language + */ get currentLang(): string { return this.store.selectSnapshot(state => state.SessionState.language); } @@ -42,6 +45,11 @@ export class LocalizationService { }); } + /** + * Returns an observable localized text with the given interpolation parameters in current language. + * @param key Localizaton key to replace with localized text + * @param interpolateParams Values to interpolate + */ get( key: string | Config.LocalizationWithDefault, ...interpolateParams: string[] @@ -49,6 +57,11 @@ export class LocalizationService { return this.store.select(ConfigState.getLocalization(key, ...interpolateParams)); } + /** + * Returns localized text with the given interpolation parameters in current language. + * @param key Localization key to replace with localized text + * @param interpolateParams Values to intepolate. + */ instant(key: string | Config.LocalizationWithDefault, ...interpolateParams: string[]): string { return this.store.selectSnapshot(ConfigState.getLocalization(key, ...interpolateParams)); } diff --git a/npm/ng-packs/packages/core/src/lib/services/session-state.service.ts b/npm/ng-packs/packages/core/src/lib/services/session-state.service.ts index 88b8f2df9b..2875e02824 100644 --- a/npm/ng-packs/packages/core/src/lib/services/session-state.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/session-state.service.ts @@ -1,8 +1,12 @@ import { Injectable } from '@angular/core'; import { Store } from '@ngxs/store'; +import { + SetLanguage, + SetRemember, + SetTenant, + ModifyOpenedTabCount, +} from '../actions/session.actions'; import { SessionState } from '../states'; -import { ABP } from '../models'; -import { SetLanguage, SetTenant } from '../actions'; @Injectable({ providedIn: 'root', @@ -18,6 +22,10 @@ export class SessionStateService { return this.store.selectSnapshot(SessionState.getTenant); } + getSessionDetail() { + return this.store.selectSnapshot(SessionState.getSessionDetail); + } + dispatchSetLanguage(...args: ConstructorParameters) { return this.store.dispatch(new SetLanguage(...args)); } @@ -25,4 +33,12 @@ export class SessionStateService { dispatchSetTenant(...args: ConstructorParameters) { return this.store.dispatch(new SetTenant(...args)); } + + dispatchSetRemember(...args: ConstructorParameters) { + return this.store.dispatch(new SetRemember(...args)); + } + + dispatchModifyOpenedTabCount(...args: ConstructorParameters) { + return this.store.dispatch(new ModifyOpenedTabCount(...args)); + } } diff --git a/npm/ng-packs/packages/core/src/lib/states/config.state.ts b/npm/ng-packs/packages/core/src/lib/states/config.state.ts index 1e959b3e54..ff964cfe92 100644 --- a/npm/ng-packs/packages/core/src/lib/states/config.state.ts +++ b/npm/ng-packs/packages/core/src/lib/states/config.state.ts @@ -2,7 +2,12 @@ import { Action, createSelector, Selector, State, StateContext, Store } from '@n import { of } from 'rxjs'; import { switchMap, tap } from 'rxjs/operators'; import snq from 'snq'; -import { GetAppConfiguration, PatchRouteByName, AddRoute } from '../actions/config.actions'; +import { + GetAppConfiguration, + PatchRouteByName, + AddRoute, + SetEnvironment, +} from '../actions/config.actions'; import { SetLanguage } from '../actions/session.actions'; import { ABP } from '../models/common'; import { Config } from '../models/config'; @@ -137,6 +142,7 @@ export class ConfigState { key: string | Config.LocalizationWithDefault, ...interpolateParams: string[] ) { + if (!key) key = ''; let defaultValue: string; if (typeof key !== 'string') { @@ -144,8 +150,6 @@ export class ConfigState { key = key.key; } - if (!key) key = ''; - const keys = key.split('::') as string[]; const selector = createSelector([ConfigState], (state: Config.State) => { if (!state.localization) return defaultValue || key; @@ -250,7 +254,7 @@ export class ConfigState { if (index < 0) return; const parent = flattedRoutes[index]; - if (parent.url.replace('/', '')) { + if ((parent.url || '').replace('/', '')) { route.url = `${parent.url}/${route.path}`; } else { route.url = `/${route.path}`; @@ -292,6 +296,13 @@ export class ConfigState { flattedRoutes, }); } + + @Action(SetEnvironment) + setEnvironment({ patchState }: StateContext, environment: Config.Environment) { + return patchState({ + environment, + }); + } } function patchRouteDeep( diff --git a/npm/ng-packs/packages/core/src/lib/states/session.state.ts b/npm/ng-packs/packages/core/src/lib/states/session.state.ts index 06372c8e7d..7ea742dce7 100644 --- a/npm/ng-packs/packages/core/src/lib/states/session.state.ts +++ b/npm/ng-packs/packages/core/src/lib/states/session.state.ts @@ -1,14 +1,29 @@ -import { Action, Selector, State, StateContext } from '@ngxs/store'; -import { from } from 'rxjs'; -import { switchMap } from 'rxjs/operators'; +import { + Action, + Selector, + State, + StateContext, + Store, + NgxsOnInit, + Actions, + ofActionSuccessful, +} from '@ngxs/store'; +import { from, fromEvent } from 'rxjs'; +import { switchMap, take } from 'rxjs/operators'; import { GetAppConfiguration } from '../actions/config.actions'; -import { SetLanguage, SetTenant } from '../actions/session.actions'; +import { + SetLanguage, + SetTenant, + ModifyOpenedTabCount, + SetRemember, +} from '../actions/session.actions'; import { ABP, Session } from '../models'; import { LocalizationService } from '../services/localization.service'; +import { OAuthService } from 'angular-oauth2-oidc'; @State({ name: 'SessionState', - defaults: {} as Session.State, + defaults: { sessionDetail: { openedTabCount: 0 } } as Session.State, }) export class SessionState { @Selector() @@ -21,7 +36,42 @@ export class SessionState { return tenant; } - constructor(private localizationService: LocalizationService) {} + @Selector() + static getSessionDetail({ sessionDetail }: Session.State): Session.SessionDetail { + return sessionDetail; + } + + constructor( + private localizationService: LocalizationService, + private oAuthService: OAuthService, + private store: Store, + private actions: Actions, + ) { + actions + .pipe(ofActionSuccessful(GetAppConfiguration)) + .pipe(take(1)) + .subscribe(() => { + const { sessionDetail } = this.store.selectSnapshot(SessionState) || { sessionDetail: {} }; + + const fiveMinutesBefore = new Date().valueOf() - 5 * 60 * 1000; + + if ( + sessionDetail.lastExitTime && + sessionDetail.openedTabCount === 0 && + this.oAuthService.hasValidAccessToken() && + sessionDetail.remember === false && + sessionDetail.lastExitTime < fiveMinutesBefore + ) { + this.oAuthService.logOut(); + } + + this.store.dispatch(new ModifyOpenedTabCount('increase')); + + fromEvent(window, 'unload').subscribe(event => { + this.store.dispatch(new ModifyOpenedTabCount('decrease')); + }); + }); + } @Action(SetLanguage) setLanguage({ patchState, dispatch }: StateContext, { payload }: SetLanguage) { @@ -40,4 +90,48 @@ export class SessionState { tenant: payload, }); } + + @Action(SetRemember) + setRemember( + { getState, patchState }: StateContext, + { payload: remember }: SetRemember, + ) { + const { sessionDetail } = getState(); + + patchState({ + sessionDetail: { + ...sessionDetail, + remember, + }, + }); + } + + @Action(ModifyOpenedTabCount) + modifyOpenedTabCount( + { getState, patchState }: StateContext, + { operation }: ModifyOpenedTabCount, + ) { + // tslint:disable-next-line: prefer-const + let { openedTabCount, lastExitTime, ...detail } = + getState().sessionDetail || ({ openedTabCount: 0 } as Session.SessionDetail); + + if (operation === 'increase') { + openedTabCount++; + } else if (operation === 'decrease') { + openedTabCount--; + lastExitTime = new Date().valueOf(); + } + + if (!openedTabCount || openedTabCount < 0) { + openedTabCount = 0; + } + + patchState({ + sessionDetail: { + openedTabCount, + lastExitTime, + ...detail, + }, + }); + } } diff --git a/npm/ng-packs/packages/core/src/lib/tests/config.plugin.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/config.plugin.spec.ts index a5bc046012..aa0e0f553f 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/config.plugin.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/config.plugin.spec.ts @@ -10,6 +10,7 @@ import { ABP } from '../models'; import { ConfigPlugin, NGXS_CONFIG_PLUGIN_OPTIONS } from '../plugins'; import { ConfigState } from '../states'; import { addAbpRoutes } from '../utils'; +import { OAuthModule } from 'angular-oauth2-oidc'; addAbpRoutes([ { @@ -323,6 +324,7 @@ describe('ConfigPlugin', () => { service: ConfigPlugin, imports: [ CoreModule, + OAuthModule.forRoot(), NgxsModule.forRoot([]), RouterTestingModule.withRoutes([ { diff --git a/npm/ng-packs/packages/core/src/lib/tests/session-state.service.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/session-state.service.spec.ts index 8bca7d1ae3..cff6f9e239 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/session-state.service.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/session-state.service.spec.ts @@ -3,13 +3,17 @@ import { SessionStateService } from '../services/session-state.service'; import { SessionState } from '../states/session.state'; import { Store } from '@ngxs/store'; import * as SessionActions from '../actions'; +import { OAuthService } from 'angular-oauth2-oidc'; describe('SessionStateService', () => { let service: SessionStateService; let spectator: SpectatorService; let store: SpyObject; - const createService = createServiceFactory({ service: SessionStateService, mocks: [Store] }); + const createService = createServiceFactory({ + service: SessionStateService, + mocks: [Store, OAuthService], + }); beforeEach(() => { spectator = createService(); service = spectator.service; diff --git a/npm/ng-packs/packages/core/src/lib/tests/session.state.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/session.state.spec.ts index 412ed8d9ab..cdf616e5d2 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/session.state.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/session.state.spec.ts @@ -1,9 +1,11 @@ import { createServiceFactory, SpectatorService } from '@ngneat/spectator/jest'; import { Session } from '../models/session'; -import { LocalizationService } from '../services'; +import { LocalizationService, AuthService } from '../services'; import { SessionState } from '../states'; import { GetAppConfiguration } from '../actions/config.actions'; -import { of } from 'rxjs'; +import { of, Subject } from 'rxjs'; +import { Store, Actions } from '@ngxs/store'; +import { OAuthService } from 'angular-oauth2-oidc'; export class DummyClass {} @@ -18,12 +20,12 @@ describe('SessionState', () => { const createService = createServiceFactory({ service: DummyClass, - mocks: [LocalizationService], + mocks: [LocalizationService, Store, Actions, OAuthService], }); beforeEach(() => { spectator = createService(); - state = new SessionState(spectator.get(LocalizationService)); + state = new SessionState(spectator.get(LocalizationService), null, null, new Subject()); }); describe('#getLanguage', () => { diff --git a/npm/ng-packs/packages/core/src/lib/utils/date-extensions.ts b/npm/ng-packs/packages/core/src/lib/utils/date-extensions.ts index 3522b000c8..8f0d17504d 100644 --- a/npm/ng-packs/packages/core/src/lib/utils/date-extensions.ts +++ b/npm/ng-packs/packages/core/src/lib/utils/date-extensions.ts @@ -2,7 +2,7 @@ export {}; declare global { interface Date { - toLocalISOString(): string; + toLocalISOString?: () => string; } } diff --git a/npm/ng-packs/packages/core/src/lib/utils/route-utils.ts b/npm/ng-packs/packages/core/src/lib/utils/route-utils.ts index 8bbbee60ec..51abe4218b 100644 --- a/npm/ng-packs/packages/core/src/lib/utils/route-utils.ts +++ b/npm/ng-packs/packages/core/src/lib/utils/route-utils.ts @@ -1,4 +1,4 @@ -import { ABP } from '../models'; +import { ABP } from '../models/common'; export function organizeRoutes( routes: ABP.FullRoute[], @@ -33,7 +33,10 @@ export function organizeRoutes( return filteredRoutes; } -export function setChildRoute(routes: ABP.FullRoute[], parentNameArr: ABP.FullRoute[]): ABP.FullRoute[] { +export function setChildRoute( + routes: ABP.FullRoute[], + parentNameArr: ABP.FullRoute[], +): ABP.FullRoute[] { return routes.map(route => { if (route.children && route.children.length) { route.children = setChildRoute(route.children, parentNameArr); diff --git a/npm/ng-packs/packages/feature-management/package.json b/npm/ng-packs/packages/feature-management/package.json index 38cd5ffa9c..ddf32d71af 100644 --- a/npm/ng-packs/packages/feature-management/package.json +++ b/npm/ng-packs/packages/feature-management/package.json @@ -1,13 +1,13 @@ { "name": "@abp/ng.feature-management", - "version": "1.1.1", + "version": "2.0.1", "homepage": "https://abp.io", "repository": { "type": "git", "url": "https://github.com/abpframework/abp.git" }, "dependencies": { - "@abp/ng.theme.shared": "^1.1.1" + "@abp/ng.theme.shared": "^2.0.1" }, "publishConfig": { "access": "public" diff --git a/npm/ng-packs/packages/identity-config/package.json b/npm/ng-packs/packages/identity-config/package.json index c4a75d9fec..385388e007 100644 --- a/npm/ng-packs/packages/identity-config/package.json +++ b/npm/ng-packs/packages/identity-config/package.json @@ -1,6 +1,6 @@ { "name": "@abp/ng.identity.config", - "version": "1.1.1", + "version": "2.0.1", "homepage": "https://abp.io", "repository": { "type": "git", diff --git a/npm/ng-packs/packages/identity/package.json b/npm/ng-packs/packages/identity/package.json index 0bebdd32b8..78890ce7e5 100644 --- a/npm/ng-packs/packages/identity/package.json +++ b/npm/ng-packs/packages/identity/package.json @@ -1,15 +1,15 @@ { "name": "@abp/ng.identity", - "version": "1.1.1", + "version": "2.0.1", "homepage": "https://abp.io", "repository": { "type": "git", "url": "https://github.com/abpframework/abp.git" }, "dependencies": { - "@abp/ng.identity.config": "^1.1.1", - "@abp/ng.permission-management": "^1.1.1", - "@abp/ng.theme.shared": "^1.1.1" + "@abp/ng.identity.config": "^2.0.1", + "@abp/ng.permission-management": "^2.0.1", + "@abp/ng.theme.shared": "^2.0.1" }, "publishConfig": { "access": "public" diff --git a/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html b/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html index 6c4f946c5a..89cbd99789 100644 --- a/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html +++ b/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.html @@ -20,37 +20,29 @@
    - - + - - - - + {{ 'AbpIdentity::Actions' | abpLocalization }} - + {{ 'AbpIdentity::RoleName' | abpLocalization }} - +
    @@ -89,7 +81,8 @@ {{ 'AbpIdentity::Permissions' | abpLocalization }}
    @@ -180,22 +173,3 @@ (abpInit)="init(abpPermissionManagement)" > - - diff --git a/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.ts b/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.ts index 0bd4826699..3ac929bc5d 100644 --- a/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.ts +++ b/npm/ng-packs/packages/identity/src/lib/components/roles/roles.component.ts @@ -36,7 +36,7 @@ export class RolesComponent implements OnInit { providerKey: string; - pageQuery: ABP.PageQueryParams = {}; + pageQuery: ABP.PageQueryParams = { maxResultCount: 10 }; loading = false; @@ -123,9 +123,8 @@ export class RolesComponent implements OnInit { }); } - onPageChange(data) { - this.pageQuery.skipCount = data.first; - this.pageQuery.maxResultCount = data.rows; + onPageChange(page: number) { + this.pageQuery.skipCount = (page - 1) * this.pageQuery.maxResultCount; this.get(); } diff --git a/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html b/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html index e89d72ae72..534bdee970 100644 --- a/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html +++ b/npm/ng-packs/packages/identity/src/lib/components/users/users.component.html @@ -28,37 +28,29 @@ (input.debounce)="onSearch($event.target.value)" />
    - - + - - - - + {{ 'AbpIdentity::Actions' | abpLocalization }} - + {{ 'AbpIdentity::UserName' | abpLocalization }} - + {{ 'AbpIdentity::EmailAddress' | abpLocalization }} - + {{ 'AbpIdentity::PhoneNumber' | abpLocalization }} - +
    @@ -129,7 +121,7 @@ {{ data.phoneNumber }} - +
    @@ -235,8 +227,6 @@ > 0) { + if ( + (passwordRules['Abp.Identity.Password.RequireNonAlphanumeric'] || '').toLowerCase() === 'true' + ) { this.passwordRulesArr.push('special'); } @@ -111,13 +113,13 @@ export class UsersComponent implements OnInit { } } - onSearch(value) { + onSearch(value: string) { this.pageQuery.filter = value; this.get(); } buildForm() { - this.store.dispatch(new GetRoles()).subscribe(() => { + this.store.dispatch(new GetRoles({ maxResultCount: 1000, skipCount: 0 })).subscribe(() => { this.roles = this.store.selectSnapshot(IdentityState.getRoles); this.form = this.fb.group({ userName: [this.selected.userName || '', [Validators.required, Validators.maxLength(256)]], @@ -134,7 +136,9 @@ export class UsersComponent implements OnInit { this.roles.map(role => this.fb.group({ [role.name]: [ - !!snq(() => this.selectedUserRoles.find(userRole => userRole.id === role.id)), + this.selected.id + ? !!snq(() => this.selectedUserRoles.find(userRole => userRole.id === role.id)) + : role.isDefault, ], }), ), @@ -144,7 +148,7 @@ export class UsersComponent implements OnInit { const passwordValidators = [ validatePassword(this.passwordRulesArr), Validators.minLength(this.requiredPasswordLength), - Validators.maxLength(32), + Validators.maxLength(128), ]; this.form.addControl('password', new FormControl('', [...passwordValidators])); @@ -177,7 +181,7 @@ export class UsersComponent implements OnInit { ) .subscribe((state: Identity.State) => { this.selected = state.selectedUser; - this.selectedUserRoles = state.selectedUserRoles; + this.selectedUserRoles = state.selectedUserRoles || []; this.openModal(); }); } @@ -226,9 +230,8 @@ export class UsersComponent implements OnInit { }); } - onPageChange(data) { - this.pageQuery.skipCount = data.first; - this.pageQuery.maxResultCount = data.rows; + onPageChange(page: number) { + this.pageQuery.skipCount = (page - 1) * this.pageQuery.maxResultCount; this.get(); } diff --git a/npm/ng-packs/packages/identity/src/lib/identity.module.ts b/npm/ng-packs/packages/identity/src/lib/identity.module.ts index 20a332c6ce..f11562a11f 100644 --- a/npm/ng-packs/packages/identity/src/lib/identity.module.ts +++ b/npm/ng-packs/packages/identity/src/lib/identity.module.ts @@ -8,7 +8,6 @@ import { NgbTabsetModule, NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'; import { ThemeSharedModule } from '@abp/ng.theme.shared'; import { UsersComponent } from './components/users/users.component'; import { PermissionManagementModule } from '@abp/ng.permission-management'; -import { TableModule } from 'primeng/table'; import { NgxValidateCoreModule } from '@ngx-validate/core'; @NgModule({ @@ -19,7 +18,6 @@ import { NgxValidateCoreModule } from '@ngx-validate/core'; IdentityRoutingModule, NgbTabsetModule, ThemeSharedModule, - TableModule, NgbDropdownModule, PermissionManagementModule, NgxValidateCoreModule, diff --git a/npm/ng-packs/packages/permission-management/package.json b/npm/ng-packs/packages/permission-management/package.json index cc7fdddf2f..e29ab5dcdb 100644 --- a/npm/ng-packs/packages/permission-management/package.json +++ b/npm/ng-packs/packages/permission-management/package.json @@ -1,13 +1,13 @@ { "name": "@abp/ng.permission-management", - "version": "1.1.1", + "version": "2.0.1", "homepage": "https://abp.io", "repository": { "type": "git", "url": "https://github.com/abpframework/abp.git" }, "dependencies": { - "@abp/ng.theme.shared": "^1.1.1" + "@abp/ng.theme.shared": "^2.0.1" }, "publishConfig": { "access": "public" diff --git a/npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.html b/npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.html index 3e4a1ec3a3..59311f379e 100644 --- a/npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.html +++ b/npm/ng-packs/packages/permission-management/src/lib/components/permission-management.component.html @@ -22,7 +22,7 @@
    -
    + -
    +

    {{ selectedGroup?.displayName }}


    diff --git a/npm/ng-packs/packages/setting-management-config/package.json b/npm/ng-packs/packages/setting-management-config/package.json index 5f1606f414..862ce6b27c 100644 --- a/npm/ng-packs/packages/setting-management-config/package.json +++ b/npm/ng-packs/packages/setting-management-config/package.json @@ -1,6 +1,6 @@ { "name": "@abp/ng.setting-management.config", - "version": "1.1.1", + "version": "2.0.1", "homepage": "https://abp.io", "repository": { "type": "git", diff --git a/npm/ng-packs/packages/setting-management/package.json b/npm/ng-packs/packages/setting-management/package.json index 6144b81903..ba64372a23 100644 --- a/npm/ng-packs/packages/setting-management/package.json +++ b/npm/ng-packs/packages/setting-management/package.json @@ -1,14 +1,14 @@ { "name": "@abp/ng.setting-management", - "version": "1.1.1", + "version": "2.0.1", "homepage": "https://abp.io", "repository": { "type": "git", "url": "https://github.com/abpframework/abp.git" }, "dependencies": { - "@abp/ng.setting-management.config": "^1.1.1", - "@abp/ng.theme.shared": "^1.1.1" + "@abp/ng.setting-management.config": "^2.0.1", + "@abp/ng.theme.shared": "^2.0.1" }, "publishConfig": { "access": "public" diff --git a/npm/ng-packs/packages/setting-management/src/lib/components/setting-management.component.html b/npm/ng-packs/packages/setting-management/src/lib/components/setting-management.component.html index 8d5fd0e8d1..c54a581312 100644 --- a/npm/ng-packs/packages/setting-management/src/lib/components/setting-management.component.html +++ b/npm/ng-packs/packages/setting-management/src/lib/components/setting-management.component.html @@ -2,7 +2,7 @@

    {{ 'AbpSettingManagement::Settings' | abpLocalization }}

    - diff --git a/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts b/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts index 0d77596270..fcc2afd3da 100644 --- a/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts +++ b/npm/ng-packs/packages/tenant-management/src/lib/components/tenants/tenants.component.ts @@ -50,7 +50,7 @@ export class TenantsComponent implements OnInit { _useSharedDatabase: boolean; - pageQuery: ABP.PageQueryParams = {}; + pageQuery: ABP.PageQueryParams = { maxResultCount: 10 }; loading = false; @@ -109,7 +109,7 @@ export class TenantsComponent implements OnInit { this.get(); } - onSearch(value) { + onSearch(value: string) { this.pageQuery.filter = value; this.get(); } @@ -246,9 +246,8 @@ export class TenantsComponent implements OnInit { }); } - onPageChange(data) { - this.pageQuery.skipCount = data.first; - this.pageQuery.maxResultCount = data.rows; + onPageChange(page: number) { + this.pageQuery.skipCount = (page - 1) * this.pageQuery.maxResultCount; this.get(); } diff --git a/npm/ng-packs/packages/tenant-management/src/lib/tenant-management.module.ts b/npm/ng-packs/packages/tenant-management/src/lib/tenant-management.module.ts index 218eda45fa..707762ff4b 100644 --- a/npm/ng-packs/packages/tenant-management/src/lib/tenant-management.module.ts +++ b/npm/ng-packs/packages/tenant-management/src/lib/tenant-management.module.ts @@ -3,7 +3,6 @@ import { ThemeSharedModule } from '@abp/ng.theme.shared'; import { NgModule, Provider } from '@angular/core'; import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'; import { NgxsModule } from '@ngxs/store'; -import { TableModule } from 'primeng/table'; import { TenantsComponent } from './components/tenants/tenants.component'; import { TenantManagementState } from './states/tenant-management.state'; import { TenantManagementRoutingModule } from './tenant-management-routing.module'; @@ -17,7 +16,6 @@ import { NgxValidateCoreModule } from '@ngx-validate/core'; NgxsModule.forFeature([TenantManagementState]), NgxValidateCoreModule, CoreModule, - TableModule, ThemeSharedModule, NgbDropdownModule, FeatureManagementModule, diff --git a/npm/ng-packs/packages/theme-basic/package.json b/npm/ng-packs/packages/theme-basic/package.json index 079b52ed22..3279731d0e 100644 --- a/npm/ng-packs/packages/theme-basic/package.json +++ b/npm/ng-packs/packages/theme-basic/package.json @@ -1,13 +1,13 @@ { "name": "@abp/ng.theme.basic", - "version": "1.1.1", + "version": "2.0.1", "homepage": "https://abp.io", "repository": { "type": "git", "url": "https://github.com/abpframework/abp.git" }, "dependencies": { - "@abp/ng.theme.shared": "^1.1.1" + "@abp/ng.theme.shared": "^2.0.1" }, "publishConfig": { "access": "public" diff --git a/npm/ng-packs/packages/theme-basic/src/lib/components/account-layout/account-layout.component.ts b/npm/ng-packs/packages/theme-basic/src/lib/components/account-layout/account-layout.component.ts index 57b8772304..105c756e54 100644 --- a/npm/ng-packs/packages/theme-basic/src/lib/components/account-layout/account-layout.component.ts +++ b/npm/ng-packs/packages/theme-basic/src/lib/components/account-layout/account-layout.component.ts @@ -6,7 +6,7 @@ import { eLayoutType } from '@abp/ng.core'; template: ` - + `, }) export class AccountLayoutComponent { diff --git a/npm/ng-packs/packages/theme-basic/src/lib/components/application-layout/application-layout.component.html b/npm/ng-packs/packages/theme-basic/src/lib/components/application-layout/application-layout.component.html index 2730c0e2ef..8199e7d5b6 100644 --- a/npm/ng-packs/packages/theme-basic/src/lib/components/application-layout/application-layout.component.html +++ b/npm/ng-packs/packages/theme-basic/src/lib/components/application-layout/application-layout.component.html @@ -1,5 +1,5 @@
    - diff --git a/npm/ng-packs/packages/theme-basic/src/lib/components/application-layout/application-layout.component.ts b/npm/ng-packs/packages/theme-basic/src/lib/components/application-layout/application-layout.component.ts index 78c358ca69..7d7947e833 100644 --- a/npm/ng-packs/packages/theme-basic/src/lib/components/application-layout/application-layout.component.ts +++ b/npm/ng-packs/packages/theme-basic/src/lib/components/application-layout/application-layout.component.ts @@ -1,10 +1,10 @@ import { ABP, ApplicationConfiguration, + AuthService, Config, ConfigState, eLayoutType, - GetAppConfiguration, SessionState, SetLanguage, takeUntilDestroy, @@ -14,18 +14,13 @@ import { AfterViewInit, Component, OnDestroy, - QueryList, Renderer2, TemplateRef, TrackByFunction, ViewChild, - ViewChildren, - ElementRef, } from '@angular/core'; -import { NgbDropdown } from '@ng-bootstrap/ng-bootstrap'; import { Navigate, RouterState } from '@ngxs/router-plugin'; import { Select, Store } from '@ngxs/store'; -import { OAuthService } from 'angular-oauth2-oidc'; import compare from 'just-compare'; import { fromEvent, Observable } from 'rxjs'; import { debounceTime, filter, map } from 'rxjs/operators'; @@ -78,7 +73,10 @@ export class ApplicationLayoutComponent implements AfterViewInit, OnDestroy { get defaultLanguage$(): Observable { return this.languages$.pipe( map( - languages => snq(() => languages.find(lang => lang.cultureName === this.selectedLangCulture).displayName), + languages => + snq( + () => languages.find(lang => lang.cultureName === this.selectedLangCulture).displayName, + ), '', ), ); @@ -86,7 +84,11 @@ export class ApplicationLayoutComponent implements AfterViewInit, OnDestroy { get dropdownLanguages$(): Observable { return this.languages$.pipe( - map(languages => snq(() => languages.filter(lang => lang.cultureName !== this.selectedLangCulture)), []), + map( + languages => + snq(() => languages.filter(lang => lang.cultureName !== this.selectedLangCulture)), + [], + ), ); } @@ -100,7 +102,11 @@ export class ApplicationLayoutComponent implements AfterViewInit, OnDestroy { trackElementByFn: TrackByFunction = (_, element) => element; - constructor(private store: Store, private oauthService: OAuthService, private renderer: Renderer2) {} + constructor( + private store: Store, + private renderer: Renderer2, + private authService: AuthService, + ) {} private checkWindowWidth() { setTimeout(() => { @@ -121,7 +127,9 @@ export class ApplicationLayoutComponent implements AfterViewInit, OnDestroy { } ngAfterViewInit() { - const navigations = this.store.selectSnapshot(LayoutState.getNavigationElements).map(({ name }) => name); + const navigations = this.store + .selectSnapshot(LayoutState.getNavigationElements) + .map(({ name }) => name); if (navigations.indexOf('LanguageRef') < 0) { this.store.dispatch( @@ -145,10 +153,7 @@ export class ApplicationLayoutComponent implements AfterViewInit, OnDestroy { this.checkWindowWidth(); fromEvent(window, 'resize') - .pipe( - takeUntilDestroy(this), - debounceTime(150), - ) + .pipe(takeUntilDestroy(this), debounceTime(150)) .subscribe(() => { this.checkWindowWidth(); }); @@ -161,13 +166,13 @@ export class ApplicationLayoutComponent implements AfterViewInit, OnDestroy { } logout() { - this.oauthService.logOut(); - this.store.dispatch( - new Navigate(['/'], null, { - state: { redirectUrl: this.store.selectSnapshot(RouterState).state.url }, - }), - ); - this.store.dispatch(new GetAppConfiguration()); + this.authService.logout().subscribe(() => { + this.store.dispatch( + new Navigate(['/'], null, { + state: { redirectUrl: this.store.selectSnapshot(RouterState).state.url }, + }), + ); + }); } openChange(event: boolean, childrenContainer: HTMLDivElement) { diff --git a/npm/ng-packs/packages/theme-basic/src/lib/components/empty-layout/empty-layout.component.ts b/npm/ng-packs/packages/theme-basic/src/lib/components/empty-layout/empty-layout.component.ts index c6082aadd4..4f1dac52ca 100644 --- a/npm/ng-packs/packages/theme-basic/src/lib/components/empty-layout/empty-layout.component.ts +++ b/npm/ng-packs/packages/theme-basic/src/lib/components/empty-layout/empty-layout.component.ts @@ -6,7 +6,7 @@ import { eLayoutType } from '@abp/ng.core'; template: ` - + `, }) export class EmptyLayoutComponent { diff --git a/npm/ng-packs/packages/theme-basic/src/lib/constants/styles.ts b/npm/ng-packs/packages/theme-basic/src/lib/constants/styles.ts index 269fd0071a..e2fb1d46ec 100644 --- a/npm/ng-packs/packages/theme-basic/src/lib/constants/styles.ts +++ b/npm/ng-packs/packages/theme-basic/src/lib/constants/styles.ts @@ -6,12 +6,10 @@ export default ` .entry-row { margin-bottom: 15px; } - #main-navbar-tools a.dropdown-toggle { text-decoration: none; color: #fff; } - .navbar .dropdown-submenu { position: relative; } @@ -19,15 +17,15 @@ export default ` margin: 0; padding: 0; } - .navbar .dropdown-menu a { - font-size: .9em; - padding: 10px 15px; - display: block; - min-width: 210px; - text-align: left; - border-radius: 0.25rem; - min-height: 44px; - } +.navbar .dropdown-menu a { + font-size: .9em; + padding: 10px 15px; + display: block; + min-width: 210px; + text-align: left; + border-radius: 0.25rem; + min-height: 44px; +} .navbar .dropdown-submenu a::after { transform: rotate(-90deg); position: absolute; @@ -48,13 +46,6 @@ export default ` .container > .card { box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important; } -.abp-confirm .abp-confirm-footer { - background-color: #f4f4f7 !important; -} -.abp-confirm .ui-toast-message-content { - background-color: #fff !important; -} - @media screen and (min-width: 768px) { .navbar .dropdown:hover > .dropdown-menu { display: block; @@ -70,4 +61,66 @@ export default ` .field-validation-error { font-size: 0.8em; } +.ui-table .ui-table-tbody > tr.empty-row > div.empty-row-content { + border: 1px solid #c8c8c8; + } +.abp-loading { + background: rgba(0, 0, 0, 0.1); +} +.modal-backdrop { +background-color: rgba(0, 0, 0, 0.6); +} + +.confirmation .confirmation-backdrop { + background: rgba(0, 0, 0, 0.7) !important; +} + .confirmation .confirmation-dialog { + border: none; + border-radius: 10px; + background-color: #fff; + box-shadow: 0 0 10px -5px rgba(0, 0, 0, 0.5); +} + .confirmation .confirmation-dialog .icon-container .icon { + stroke: #fff; + color: #fff; +} + .confirmation .confirmation-dialog .icon-container.info .icon { + stroke: #2f96b4; + color: #2f96b4; +} + .confirmation .confirmation-dialog .icon-container.success .icon { + stroke: #51a351; + color: #51a351; +} + .confirmation .confirmation-dialog .icon-container.warning .icon { + stroke: #f89406; + color: #f89406; +} + .confirmation .confirmation-dialog .icon-container.error .icon { + stroke: #bd362f; + color: #bd362f; +} + .confirmation .confirmation-dialog .content .title { + color: #222; +} + .confirmation .confirmation-dialog .content .message { + color: #777; +} + .confirmation .confirmation-dialog .footer { + background: transparent; +} + .confirmation .confirmation-dialog .footer .confirmation-button { + background-color: #eee; + color: #777; +} + .confirmation .confirmation-dialog .footer .confirmation-button:hover, .confirmation .confirmation-dialog .footer .confirmation-button:focus, .confirmation .confirmation-dialog .footer .confirmation-button:active { + background-color: #bbb; +} + .confirmation .confirmation-dialog .footer .confirmation-button--confirm { + background-color: #2f96b4; + color: #fff; +} + .confirmation .confirmation-dialog .footer .confirmation-button--confirm:hover { + background-color: #2e819b; +} `; diff --git a/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts b/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts index 00d651f9af..827983b15f 100644 --- a/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts +++ b/npm/ng-packs/packages/theme-basic/src/lib/theme-basic.module.ts @@ -4,7 +4,6 @@ import { NgModule } from '@angular/core'; import { NgbCollapseModule, NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap'; import { NgxValidateCoreModule } from '@ngx-validate/core'; import { NgxsModule } from '@ngxs/store'; -import { ToastModule } from 'primeng/toast'; import { AccountLayoutComponent } from './components/account-layout/account-layout.component'; import { ApplicationLayoutComponent } from './components/application-layout/application-layout.component'; import { EmptyLayoutComponent } from './components/empty-layout/empty-layout.component'; @@ -21,7 +20,6 @@ export const LAYOUTS = [ApplicationLayoutComponent, AccountLayoutComponent, Empt ThemeSharedModule, NgbCollapseModule, NgbDropdownModule, - ToastModule, NgxValidateCoreModule, NgxsModule.forFeature([LayoutState]), NgxValidateCoreModule.forRoot({ @@ -29,9 +27,11 @@ export const LAYOUTS = [ApplicationLayoutComponent, AccountLayoutComponent, Empt blueprints: { email: 'AbpAccount::ThisFieldIsNotAValidEmailAddress.', max: 'AbpAccount::ThisFieldMustBeBetween{0}And{1}[{{ min }},{{ max }}]', - maxlength: 'AbpAccount::ThisFieldMustBeAStringOrArrayTypeWithAMaximumLengthoOf{0}[{{ requiredLength }}]', + maxlength: + 'AbpAccount::ThisFieldMustBeAStringOrArrayTypeWithAMaximumLengthoOf{0}[{{ requiredLength }}]', min: 'AbpAccount::ThisFieldMustBeBetween{0}And{1}[{{ min }},{{ max }}]', - minlength: 'AbpAccount::ThisFieldMustBeAStringOrArrayTypeWithAMinimumLengthOf{0}[{{ requiredLength }}]', + minlength: + 'AbpAccount::ThisFieldMustBeAStringOrArrayTypeWithAMinimumLengthOf{0}[{{ requiredLength }}]', required: 'AbpAccount::ThisFieldIsRequired.', passwordMismatch: 'AbpIdentity::Identity.PasswordConfirmationFailed', }, diff --git a/npm/ng-packs/packages/theme-shared/ng-package.json b/npm/ng-packs/packages/theme-shared/ng-package.json index a879347afd..73ed96741c 100644 --- a/npm/ng-packs/packages/theme-shared/ng-package.json +++ b/npm/ng-packs/packages/theme-shared/ng-package.json @@ -12,7 +12,6 @@ "@ngx-validate/core", "bootstrap", "font-awesome", - "ngx-perfect-scrollbar", "primeicons", "primeng", "chart.js" diff --git a/npm/ng-packs/packages/theme-shared/package.json b/npm/ng-packs/packages/theme-shared/package.json index 9972b3cfd1..c8628551cc 100644 --- a/npm/ng-packs/packages/theme-shared/package.json +++ b/npm/ng-packs/packages/theme-shared/package.json @@ -1,13 +1,13 @@ { "name": "@abp/ng.theme.shared", - "version": "1.1.1", + "version": "2.0.1", "homepage": "https://abp.io", "repository": { "type": "git", "url": "https://github.com/abpframework/abp.git" }, "dependencies": { - "@abp/ng.core": "^1.1.1", + "@abp/ng.core": "^2.0.1", "@angular/cdk": "^8.2.3", "@fortawesome/fontawesome-free": "^5.11.2", "@ng-bootstrap/ng-bootstrap": "^5.1.4", @@ -15,7 +15,6 @@ "bootstrap": "^4.3.1", "chart.js": "^2.9.2", "font-awesome": "^4.7.0", - "ngx-perfect-scrollbar": "^8.0.0", "primeicons": "^2.0.0", "primeng": "^8.1.1" }, diff --git a/npm/ng-packs/packages/theme-shared/src/lib/abstracts/toaster.ts b/npm/ng-packs/packages/theme-shared/src/lib/abstracts/toaster.ts deleted file mode 100644 index d66c29fc3b..0000000000 --- a/npm/ng-packs/packages/theme-shared/src/lib/abstracts/toaster.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { MessageService } from 'primeng/components/common/messageservice'; -import { Observable, Subject } from 'rxjs'; -import { Toaster } from '../models/toaster'; -import { Config } from '@abp/ng.core'; - -export abstract class AbstractToaster { - status$: Subject; - - key = 'abpToast'; - - sticky = false; - - constructor(protected messageService: MessageService) {} - - info(message: Config.LocalizationParam, title: Config.LocalizationParam, options?: T): Observable { - return this.show(message, title, 'info', options); - } - - success(message: Config.LocalizationParam, title: Config.LocalizationParam, options?: T): Observable { - return this.show(message, title, 'success', options); - } - - warn(message: Config.LocalizationParam, title: Config.LocalizationParam, options?: T): Observable { - return this.show(message, title, 'warn', options); - } - - error(message: Config.LocalizationParam, title: Config.LocalizationParam, options?: T): Observable { - return this.show(message, title, 'error', options); - } - - protected show( - message: Config.LocalizationParam, - title: Config.LocalizationParam, - severity: Toaster.Severity, - options?: T, - ): Observable { - this.messageService.clear(this.key); - - this.messageService.add({ - severity, - detail: message || '', - summary: title || '', - ...options, - key: this.key, - ...(typeof (options || ({} as any)).sticky === 'undefined' && { sticky: this.sticky }), - }); - this.status$ = new Subject(); - return this.status$; - } - - clear(status?: Toaster.Status) { - this.messageService.clear(this.key); - this.status$.next(status || Toaster.Status.dismiss); - this.status$.complete(); - } -} diff --git a/npm/ng-packs/packages/theme-shared/src/lib/animations/index.ts b/npm/ng-packs/packages/theme-shared/src/lib/animations/index.ts index 816afbaaa4..d625d76d8e 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/animations/index.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/animations/index.ts @@ -3,3 +3,4 @@ export * from './collapse.animations'; export * from './fade.animations'; export * from './modal.animations'; export * from './slide.animations'; +export * from './toast.animations'; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/animations/toast.animations.ts b/npm/ng-packs/packages/theme-shared/src/lib/animations/toast.animations.ts new file mode 100644 index 0000000000..7ac6a7519b --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/animations/toast.animations.ts @@ -0,0 +1,17 @@ +import { animate, query, style, transition, trigger } from '@angular/animations'; + +export const toastInOut = trigger('toastInOut', [ + transition('* <=> *', [ + query( + ':enter', + [ + style({ opacity: 0, transform: 'translateY(20px)' }), + animate('350ms ease', style({ opacity: 1, transform: 'translateY(0)' })), + ], + { optional: true }, + ), + query(':leave', animate('450ms ease', style({ opacity: 0 })), { + optional: true, + }), + ]), +]); diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts index 9ff4d1e24e..83bef06f26 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts @@ -19,9 +19,9 @@ import { ABP } from '@abp/ng.core'; [attr.type]="buttonType" [ngClass]="buttonClass" [disabled]="loading || disabled" - (click.stop)="abpClick.next($event)" - (focus)="abpFocus.next($event)" - (blur)="abpBlur.next($event)" + (click.stop)="click.next($event); abpClick.next($event)" + (focus)="focus.next($event); abpFocus.next($event)" + (blur)="blur.next($event); abpBlur.next($event)" > @@ -49,6 +49,14 @@ export class ButtonComponent implements OnInit { @Input() attributes: ABP.Dictionary; + // tslint:disable + @Output() readonly click = new EventEmitter(); + + @Output() readonly focus = new EventEmitter(); + + @Output() readonly blur = new EventEmitter(); + // tslint:enable + @Output() readonly abpClick = new EventEmitter(); @Output() readonly abpFocus = new EventEmitter(); diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.html b/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.html new file mode 100644 index 0000000000..f2b1417f14 --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.html @@ -0,0 +1,34 @@ +
    +
    +
    +
    + +
    +
    +

    + {{ data.title | abpLocalization: data.options?.titleLocalizationParams }} +

    +

    + {{ data.message | abpLocalization: data.options?.messageLocalizationParams }} +

    +
    + +
    +
    diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.scss b/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.scss new file mode 100644 index 0000000000..a6d25a4946 --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.scss @@ -0,0 +1,82 @@ +.confirmation { + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + display: flex; + align-items: center; + justify-content: center; + z-index: 1060; + .confirmation-backdrop { + position: fixed; + top: 0; + left: 0; + width: 100vw; + height: 100vh; + z-index: 1061 !important; + } + .confirmation-dialog { + display: flex; + flex-direction: column; + margin: 20px auto; + padding: 0; + width: 450px; + min-height: 300px; + z-index: 1062 !important; + @media screen and (max-width: 500px) { + width: 90vw; + } + .icon-container { + display: flex; + align-items: center; + justify-content: center; + margin: 0 0 10px 0; + padding: 20px; + .icon { + width: 100px; + height: 100px; + stroke-width: 1; + font-size: 80px; + text-align: center; + } + } + .content { + flex-grow: 1; + display: block; + .title { + display: block; + margin: 0; + padding: 0; + font-size: 27px; + font-weight: 600; + text-align: center; + } + .message { + display: block; + margin: 10px auto; + padding: 20px; + font-size: 16px; + font-weight: 400; + text-align: center; + } + } + .footer { + display: flex; + align-items: center; + justify-content: flex-end; + margin: 10px 0 0 0; + padding: 20px; + width: 100%; + .confirmation-button { + display: inline-block; + margin: 0px 5px; + padding: 10px 20px; + border: none; + border-radius: 6px; + font-size: 14px; + font-weight: 600; + } + } + } +} diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.ts index 6ddb5899f1..92188acb34 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/confirmation/confirmation.component.ts @@ -1,61 +1,48 @@ import { Component } from '@angular/core'; import { ConfirmationService } from '../../services/confirmation.service'; -import { Toaster } from '../../models/toaster'; +import { Confirmation } from '../../models/confirmation'; +import { LocalizationService } from '@abp/ng.core'; @Component({ selector: 'abp-confirmation', - // tslint:disable-next-line: component-max-inline-declarations - template: ` - - - -
    - {{ message.summary | abpLocalization: message.titleLocalizationParams }} -
    -
    - {{ message.detail | abpLocalization: message.messageLocalizationParams }} -
    - - -
    -
    - `, + templateUrl: './confirmation.component.html', + styleUrls: ['./confirmation.component.scss'], }) export class ConfirmationComponent { - confirm = Toaster.Status.confirm; - reject = Toaster.Status.reject; - dismiss = Toaster.Status.dismiss; + confirm = Confirmation.Status.confirm; + reject = Confirmation.Status.reject; + dismiss = Confirmation.Status.dismiss; + + visible = false; + + data: Confirmation.DialogData; - constructor(private confirmationService: ConfirmationService) {} + get iconClass(): string { + switch (this.data.severity) { + case 'info': + return 'fa-info-circle'; + case 'success': + return 'fa-check-circle'; + case 'warning': + return 'fa-exclamation-triangle'; + case 'error': + return 'fa-times-circle'; + default: + return 'fa-question-circle'; + } + } + + constructor( + private confirmationService: ConfirmationService, + private localizationService: LocalizationService, + ) { + this.confirmationService.confirmation$.subscribe(confirmation => { + this.data = confirmation; + this.visible = !!confirmation; + }); + } - close(status: Toaster.Status) { + close(status: Confirmation.Status) { this.confirmationService.clear(status); } } diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/index.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/index.ts index c812fc601e..55b7b187d1 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/index.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/index.ts @@ -2,8 +2,11 @@ export * from './breadcrumb/breadcrumb.component'; export * from './button/button.component'; export * from './chart/chart.component'; export * from './confirmation/confirmation.component'; +export * from './loading/loading.component'; export * from './loader-bar/loader-bar.component'; export * from './modal/modal.component'; +export * from './pagination/pagination.component'; +export * from './sort-order-icon/sort-order-icon.component'; export * from './table-empty-message/table-empty-message.component'; +export * from './table/table.component'; export * from './toast/toast.component'; -export * from './sort-order-icon/sort-order-icon.component'; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/loading/loading.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/loading/loading.component.ts new file mode 100644 index 0000000000..c68757b4a0 --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/loading/loading.component.ts @@ -0,0 +1,40 @@ +import { Component, OnInit, ViewEncapsulation } from '@angular/core'; + +@Component({ + selector: 'abp-loading', + template: ` +
    + +
    + `, + encapsulation: ViewEncapsulation.None, + styles: [ + ` + .abp-loading { + position: absolute; + width: 100%; + height: 100%; + top: 0; + left: 0; + z-index: 1040; + } + + .abp-loading .abp-spinner { + position: absolute; + top: 50%; + left: 50%; + font-size: 14px; + -moz-transform: translateX(-50%) translateY(-50%); + -o-transform: translateX(-50%) translateY(-50%); + -ms-transform: translateX(-50%) translateY(-50%); + -webkit-transform: translateX(-50%) translateY(-50%); + transform: translateX(-50%) translateY(-50%); + } + `, + ], +}) +export class LoadingComponent implements OnInit { + constructor() {} + + ngOnInit() {} +} diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.scss b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.scss new file mode 100644 index 0000000000..321bf9342d --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.scss @@ -0,0 +1,25 @@ +.modal { + &.show { + display: block !important; + } + + &-backdrop { + opacity: 0.8; + } + + &::-webkit-scrollbar { + width: 7px; + } + + &::-webkit-scrollbar-track { + background: #ddd; + } + + &::-webkit-scrollbar-thumb { + background: #8a8686; + } + + &-dialog { + z-index: 1050; + } +} diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts index f95e0093b9..8aaaa58076 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts @@ -24,6 +24,7 @@ export type ModalSize = 'sm' | 'md' | 'lg' | 'xl'; selector: 'abp-modal', templateUrl: './modal.component.html', animations: [fadeAnimation], + styleUrls: ['./modal.component.scss'], }) export class ModalComponent implements OnDestroy { @Input() @@ -100,6 +101,20 @@ export class ModalComponent implements OnDestroy { destroy$ = new Subject(); + get isFormDirty(): boolean { + let node: HTMLDivElement; + if (!this.modalContent) { + node = document.getElementById('modal-container') as HTMLDivElement; + } + + const nodes = getFlatNodes( + ((node || this.modalContent.nativeElement).querySelector('#abp-modal-body') as HTMLElement) + .childNodes, + ); + + return hasNgDirty(nodes); + } + constructor(private renderer: Renderer2, private confirmationService: ConfirmationService) {} ngOnDestroy(): void { @@ -109,21 +124,15 @@ export class ModalComponent implements OnDestroy { close() { if (this.busy) return; - let node: HTMLDivElement; - if (!this.modalContent) { - node = document.getElementById('modal-container') as HTMLDivElement; - } - - const nodes = getFlatNodes( - ((node || this.modalContent.nativeElement).querySelector('#abp-modal-body') as HTMLElement).childNodes, - ); - - if (hasNgDirty(nodes)) { + if (this.isFormDirty) { if (this.isConfirmationOpen) return; this.isConfirmationOpen = true; this.confirmationService - .warn('AbpAccount::AreYouSureYouWantToCancelEditingWarningMessage', 'AbpAccount::AreYouSure') + .warn( + 'AbpAccount::AreYouSureYouWantToCancelEditingWarningMessage', + 'AbpAccount::AreYouSure', + ) .subscribe((status: Toaster.Status) => { this.isConfirmationOpen = false; if (status === Toaster.Status.confirm) { @@ -146,6 +155,16 @@ export class ModalComponent implements OnDestroy { this.close(); }); + fromEvent(window, 'beforeunload') + .pipe(takeUntil(this.destroy$)) + .subscribe(event => { + if (this.isFormDirty) { + event.returnValue = true; + } else { + delete event.returnValue; + } + }); + setTimeout(() => { if (!this.abpClose) return; fromEvent(this.abpClose.nativeElement, 'click') @@ -162,7 +181,10 @@ export class ModalComponent implements OnDestroy { function getFlatNodes(nodes: NodeList): HTMLElement[] { return Array.from(nodes).reduce( - (acc, val) => [...acc, ...(val.childNodes && val.childNodes.length ? getFlatNodes(val.childNodes) : [val])], + (acc, val) => [ + ...acc, + ...(val.childNodes && val.childNodes.length ? getFlatNodes(val.childNodes) : [val]), + ], [], ); } diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/pagination/pagination.component.html b/npm/ng-packs/packages/theme-shared/src/lib/components/pagination/pagination.component.html new file mode 100644 index 0000000000..b42f45a148 --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/pagination/pagination.component.html @@ -0,0 +1,38 @@ + diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/pagination/pagination.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/pagination/pagination.component.ts new file mode 100644 index 0000000000..964445c192 --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/pagination/pagination.component.ts @@ -0,0 +1,52 @@ +import { Component, Input, OnInit, Output, EventEmitter, TrackByFunction } from '@angular/core'; + +@Component({ + selector: 'abp-pagination', + templateUrl: 'pagination.component.html', +}) +export class PaginationComponent implements OnInit { + private _value = 1; + @Input() + get value(): number { + return this._value; + } + set value(newValue: number) { + if (this._value === newValue) return; + + this._value = newValue; + this.valueChange.emit(newValue); + } + + @Output() + readonly valueChange = new EventEmitter(); + + @Input() + totalPages = 0; + + get pageArray(): number[] { + const count = this.totalPages < 5 ? this.totalPages : 5; + + if (this.value === 1 || this.value === 2) { + return Array.from(new Array(count)).map((_, index) => index + 1); + } else if (this.value === this.totalPages || this.value === this.totalPages - 1) { + return Array.from(new Array(count)).map((_, index) => this.totalPages - count + 1 + index); + } else { + return [this.value - 2, this.value - 1, this.value, this.value + 1, this.value + 2]; + } + } + + trackByFn: TrackByFunction = (_, page) => page; + + ngOnInit() { + if (!this.value || this.value < 1 || this.value > this.totalPages) { + this.value = 1; + } + } + + changePage(page: number) { + if (page < 1) return; + else if (page > this.totalPages) return; + + this.value = page; + } +} diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/sort-order-icon/sort-order-icon.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/sort-order-icon/sort-order-icon.component.ts index 1e80f8f585..7e5d62fb6a 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/sort-order-icon/sort-order-icon.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/sort-order-icon/sort-order-icon.component.ts @@ -36,9 +36,8 @@ export class SortOrderIconComponent { iconClass: string; get icon(): string { - if (!this.selectedSortKey) return 'sorting'; if (this.selectedSortKey === this.sortKey) return `sorting_${this.order}`; - else return ''; + else return 'sorting'; } sort(key: string) { diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/table/table.component.html b/npm/ng-packs/packages/theme-shared/src/lib/components/table/table.component.html new file mode 100644 index 0000000000..11f4250db8 --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/table/table.component.html @@ -0,0 +1,78 @@ +
    +
    + + +
    +
    + + +
    +
    +
    +
    + + + + +
    +
    +
    +
    + + + +
    +
    +
    +
    + + + + + + +
    +
    + + + + + + + + + + + + + + + + + + + + + +
    + {{ emptyMessage | abpLocalization }} +
    + +
    diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/table/table.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/table/table.component.ts new file mode 100644 index 0000000000..b4ac7eec5f --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/table/table.component.ts @@ -0,0 +1,106 @@ +import { + AfterViewInit, + Component, + ElementRef, + EventEmitter, + Input, + Output, + TemplateRef, + TrackByFunction, + ViewChild, + ViewEncapsulation, +} from '@angular/core'; + +@Component({ + selector: 'abp-table', + templateUrl: 'table.component.html', + styles: [ + ` + .ui-table .ui-table-tbody > tr:nth-child(even):hover, + .ui-table .ui-table-tbody > tr:hover { + filter: brightness(90%); + } + + .ui-table .ui-table-tbody > tr.empty-row:hover { + filter: none; + } + + .ui-table .ui-table-tbody > tr.empty-row > div.empty-row-content { + padding: 10px; + text-align: center; + } + `, + ], + encapsulation: ViewEncapsulation.None, +}) +export class TableComponent { + private _totalRecords: number; + bodyScrollLeft = 0; + + @Input() + value: any[]; + + @Input() + headerTemplate: TemplateRef; + + @Input() + bodyTemplate: TemplateRef; + + @Input() + colgroupTemplate: TemplateRef; + + @Input() + scrollHeight: string; + + @Input() + scrollable: boolean; + + @Input() + rows: number; + + @Input() + page = 1; + + @Input() + trackingProp = 'id'; + + @Input() + emptyMessage = 'AbpAccount::NoDataAvailableInDatatable'; + + @Output() + readonly pageChange = new EventEmitter(); + + @ViewChild('wrapper', { read: ElementRef, static: false }) + wrapperRef: ElementRef; + + @Input() + get totalRecords(): number { + return this._totalRecords || this.value.length; + } + set totalRecords(newValue: number) { + if (newValue < 0) this._totalRecords = 0; + + this._totalRecords = newValue; + } + + get totalPages(): number { + if (!this.rows) { + return; + } + + return Math.ceil(this.totalRecords / this.rows); + } + + get slicedValue(): any[] { + if (!this.rows || this.rows >= this.value.length) { + return this.value; + } + + const start = (this.page - 1) * this.rows; + return this.value.slice(start, start + this.rows); + } + + trackByFn: TrackByFunction = (_, value) => { + return typeof value === 'object' ? value[this.trackingProp] || value : value; + }; +} diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/toast-container/toast-container.component.html b/npm/ng-packs/packages/theme-shared/src/lib/components/toast-container/toast-container.component.html new file mode 100644 index 0000000000..88d45ff04b --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/toast-container/toast-container.component.html @@ -0,0 +1,11 @@ +
    + +
    diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/toast-container/toast-container.component.scss b/npm/ng-packs/packages/theme-shared/src/lib/components/toast-container/toast-container.component.scss new file mode 100644 index 0000000000..ee8289dc56 --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/toast-container/toast-container.component.scss @@ -0,0 +1,13 @@ +.toast-container { + position: fixed; + display: flex; + flex-direction: column; + align-items: center; + justify-content: flex-end; + min-width: 350px; + min-height: 80px; + z-index: 1900; + &.new-on-top { + flex-direction: column-reverse; + } +} diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/toast-container/toast-container.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/toast-container/toast-container.component.ts new file mode 100644 index 0000000000..124dcc5185 --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/toast-container/toast-container.component.ts @@ -0,0 +1,46 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { Toaster } from '../../models/toaster'; +import { toastInOut } from '../../animations/toast.animations'; +import { ToasterService } from '../../services/toaster.service'; + +@Component({ + selector: 'abp-toast-container', + templateUrl: './toast-container.component.html', + styleUrls: ['./toast-container.component.scss'], + animations: [toastInOut], +}) +export class ToastContainerComponent implements OnInit { + toasts = [] as Toaster.Toast[]; + + @Input() + top: string; + + @Input() + right = '30px'; + + @Input() + bottom = '30px'; + + @Input() + left: string; + + @Input() + toastKey: string; + + constructor(private toastService: ToasterService) {} + + ngOnInit() { + this.toastService.toasts$.subscribe(toasts => { + this.toasts = this.toastKey + ? toasts.filter(t => { + return t.options && t.options.containerKey !== this.toastKey; + }) + : toasts; + }); + } + + trackByFunc(index, toast) { + if (!toast) return null; + return toast.options.id; + } +} diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/toast/toast.component.html b/npm/ng-packs/packages/theme-shared/src/lib/components/toast/toast.component.html new file mode 100644 index 0000000000..a7d5e77fb7 --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/toast/toast.component.html @@ -0,0 +1,16 @@ +
    +
    + +
    +
    + +
    + {{ toast.title | abpLocalization: toast.options?.titleLocalizationParams }} +
    +

    + {{ toast.message | abpLocalization: toast.options?.messageLocalizationParams }} +

    +
    +
    diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/toast/toast.component.scss b/npm/ng-packs/packages/theme-shared/src/lib/components/toast/toast.component.scss new file mode 100644 index 0000000000..be5c871082 --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/toast/toast.component.scss @@ -0,0 +1,78 @@ +@mixin fillColor($background, $color) { + border: 2px solid $background; + background-color: $background; + color: $color; + box-shadow: 0 0 10px -5px rgba(#000, 0.4); + &:hover { + border: 2px solid darken($background, 5); + background-color: darken($background, 5); + box-shadow: 0 0 15px -5px rgba(#000, 0.4); + } +} + +.toast { + display: grid; + grid-template-columns: 50px 1fr; + gap: 10px; + margin: 5px 0; + padding: 10px; + border-radius: 0px; + width: 350px; + user-select: none; + box-shadow: 0 0 10px -5px rgba(#000, 0.4); + z-index: 9999; + @include fillColor(#f0f0f0, #000); + opacity: 1; + &.toast-success { + @include fillColor(#51a351, #fff); + } + &.toast-info { + @include fillColor(#2f96b4, #fff); + } + &.toast-warning { + @include fillColor(#f89406, #fff); + } + &.toast-error { + @include fillColor(#bd362f, #fff); + } + .toast-icon { + display: flex; + align-items: center; + justify-content: center; + .icon { + font-size: 36px; + } + } + .toast-content { + position: relative; + .toast-close-button { + position: absolute; + top: 0; + right: 0; + display: flex; + align-items: center; + justify-content: center; + margin: 0; + padding: 0px 5px 0 0; + width: 25px; + height: 25px; + border: none; + border-radius: 50%; + background: transparent; + color: inherit; + &:focus { + outline: none; + } + } + .toast-title { + margin: 0; + padding: 0; + font-size: 1rem; + font-weight: 600; + } + .toast-message { + margin: 0; + padding: 0; + } + } +} diff --git a/npm/ng-packs/packages/theme-shared/src/lib/components/toast/toast.component.ts b/npm/ng-packs/packages/theme-shared/src/lib/components/toast/toast.component.ts index 5d21a535e8..b4465934b6 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/components/toast/toast.component.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/components/toast/toast.component.ts @@ -1,26 +1,56 @@ -import { Component } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; +import { Toaster } from '../../models/toaster'; +import { ToasterService } from '../../services/toaster.service'; +import { LocalizationService } from '@abp/ng.core'; +import snq from 'snq'; @Component({ selector: 'abp-toast', - // tslint:disable-next-line: component-max-inline-declarations - template: ` - - - -
    -
    {{ message.summary | abpLocalization: message.titleLocalizationParams }}
    -
    {{ message.detail | abpLocalization: message.messageLocalizationParams }}
    -
    -
    -
    - `, + templateUrl: './toast.component.html', + styleUrls: ['./toast.component.scss'], }) -export class ToastComponent {} +export class ToastComponent implements OnInit { + @Input() + toast: Toaster.Toast; + + get severityClass(): string { + if (!this.toast || !this.toast.severity) return ''; + return `toast-${this.toast.severity}`; + } + + get iconClass(): string { + switch (this.toast.severity) { + case 'success': + return 'fa-check-circle'; + case 'info': + return 'fa-info-circle'; + case 'warning': + return 'fa-exclamation-triangle'; + case 'error': + return 'fa-times-circle'; + default: + return 'fa-exclamation-circle'; + } + } + + constructor( + private toastService: ToasterService, + private localizationService: LocalizationService, + ) {} + + ngOnInit() { + if (snq(() => this.toast.options.sticky)) return; + const timeout = snq(() => this.toast.options.life) || 5000; + setTimeout(() => { + this.close(); + }, timeout); + } + + close() { + this.toastService.remove(this.toast.options.id); + } + + tap() { + if (this.toast.options && this.toast.options.tapToDismiss) this.close(); + } +} diff --git a/npm/ng-packs/packages/theme-shared/src/lib/constants/styles.ts b/npm/ng-packs/packages/theme-shared/src/lib/constants/styles.ts index 99c651f736..4458117d16 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/constants/styles.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/constants/styles.ts @@ -30,6 +30,7 @@ export default ` .ui-table-scrollable-body::-webkit-scrollbar { height: 5px !important; + width: 5px !important; } .ui-table-scrollable-body::-webkit-scrollbar-track { @@ -40,36 +41,6 @@ export default ` background: #8a8686; } -.modal.show { - display: block !important; -} - -.modal-backdrop { - position: fixed; - top: 0; - left: 0; - width: calc(100% - 7px); - height: 100%; - background-color: rgba(0, 0, 0, 0.6); - z-index: 1040; -} - -.modal::-webkit-scrollbar { - width: 7px; -} - -.modal::-webkit-scrollbar-track { - background: #ddd; -} - -.modal::-webkit-scrollbar-thumb { - background: #8a8686; -} - -.modal-dialog { - z-index: 1050; -} - .abp-ellipsis-inline { display: inline-block; overflow: hidden; @@ -83,112 +54,6 @@ export default ` white-space: nowrap; } -.abp-toast .ui-toast-message { - box-sizing: border-box; - border: 2px solid transparent; - border-radius: 4px; - color: #1b1d29; -} - -.abp-toast .ui-toast-message-content { - padding: 10px; -} - -.abp-toast .ui-toast-message-content .ui-toast-icon { - top: 0; - left: 0; - padding: 10px; -} - -.abp-toast .ui-toast-summary { - margin: 0; - font-weight: 700; -} - -body abp-toast .ui-toast .ui-toast-message.ui-toast-message-error { - border: 2px solid #ba1659; - background-color: #f4f4f7; -} - -body abp-toast .ui-toast .ui-toast-message.ui-toast-message-error .ui-toast-message-content .ui-toast-icon { - color: #ba1659; -} - -body abp-toast .ui-toast .ui-toast-message.ui-toast-message-warn { - border: 2px solid #ed5d98; - background-color: #f4f4f7; -} - -body abp-toast .ui-toast .ui-toast-message.ui-toast-message-warn .ui-toast-message-content .ui-toast-icon { - color: #ed5d98; -} - -body abp-toast .ui-toast .ui-toast-message.ui-toast-message-success { - border: 2px solid #1c9174; - background-color: #f4f4f7; -} - -body abp-toast .ui-toast .ui-toast-message.ui-toast-message-success .ui-toast-message-content .ui-toast-icon { - color: #1c9174; -} - -body abp-toast .ui-toast .ui-toast-message.ui-toast-message-info { - border: 2px solid #fccb31; - background-color: #f4f4f7; -} - -body abp-toast .ui-toast .ui-toast-message.ui-toast-message-info .ui-toast-message-content .ui-toast-icon { - color: #fccb31; -} - -.abp-confirm .ui-toast-message { - box-sizing: border-box; - padding: 0px; - border:0 none; - border-radius: 4px; - background-color: transparent !important; - font-family: "Poppins", sans-serif; - text-align: center; -} - -.abp-confirm .ui-toast-message-content { - padding: 0px; -} - -.abp-confirm .abp-confirm-icon { - margin: 32px 50px 5px !important; - color: #f8bb86 !important; - font-size: 52px !important; -} - -.abp-confirm .ui-toast-close-icon { - display: none !important; -} - -.abp-confirm .abp-confirm-summary { - display: block !important; - margin-bottom: 13px !important; - padding: 13px 16px 0px !important; - font-weight: 600 !important; - font-size: 18px !important; -} - -.abp-confirm .abp-confirm-body { - display: inline-block !important; - padding: 0px 10px !important; -} - -.abp-confirm .abp-confirm-footer { - display: block; - margin-top: 30px; - padding: 16px; - text-align: right; -} - -.abp-confirm .abp-confirm-footer .btn { - margin-left: 10px !important; -} - .ui-widget-overlay { z-index: 1000; } diff --git a/npm/ng-packs/packages/theme-shared/src/lib/directives/index.ts b/npm/ng-packs/packages/theme-shared/src/lib/directives/index.ts index 8efed514bf..aa2725e328 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/directives/index.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/directives/index.ts @@ -1 +1,2 @@ +export * from './loading.directive'; export * from './table-sort.directive'; diff --git a/npm/ng-packs/packages/theme-shared/src/lib/directives/loading.directive.ts b/npm/ng-packs/packages/theme-shared/src/lib/directives/loading.directive.ts new file mode 100644 index 0000000000..40b76cbfc8 --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/directives/loading.directive.ts @@ -0,0 +1,102 @@ +import { + ComponentFactoryResolver, + ComponentRef, + Directive, + ElementRef, + EmbeddedViewRef, + HostBinding, + Injector, + Input, + OnInit, + OnDestroy, + Renderer2, + ViewContainerRef, +} from '@angular/core'; +import { Subscription, timer } from 'rxjs'; +import { take } from 'rxjs/operators'; +import { LoadingComponent } from '../components/loading/loading.component'; + +@Directive({ selector: '[abpLoading]' }) +export class LoadingDirective implements OnInit, OnDestroy { + private _loading: boolean; + + @HostBinding('style.position') + position = 'relative'; + + @Input('abpLoading') + get loading(): boolean { + return this._loading; + } + + set loading(newValue: boolean) { + setTimeout(() => { + if (!newValue && this.timerSubscription) { + this.timerSubscription.unsubscribe(); + this.timerSubscription = null; + this._loading = newValue; + + if (this.rootNode) { + this.renderer.removeChild(this.rootNode.parentElement, this.rootNode); + this.rootNode = null; + } + return; + } + + this.timerSubscription = timer(this.delay) + .pipe(take(1)) + .subscribe(() => { + if (!this.componentRef) { + this.componentRef = this.cdRes + .resolveComponentFactory(LoadingComponent) + .create(this.injector); + } + + if (newValue && !this.rootNode) { + this.rootNode = (this.componentRef.hostView as EmbeddedViewRef).rootNodes[0]; + this.targetElement.appendChild(this.rootNode); + } else { + this.renderer.removeChild(this.rootNode.parentElement, this.rootNode); + this.rootNode = null; + } + + this._loading = newValue; + this.timerSubscription = null; + }); + }, 0); + } + + @Input('abpLoadingTargetElement') + targetElement: HTMLElement; + + @Input('abpLoadingDelay') + delay = 0; + + componentRef: ComponentRef; + rootNode: HTMLDivElement; + timerSubscription: Subscription; + + constructor( + private elRef: ElementRef, + private vcRef: ViewContainerRef, + private cdRes: ComponentFactoryResolver, + private injector: Injector, + private renderer: Renderer2, + ) {} + + ngOnInit() { + if (!this.targetElement) { + const { offsetHeight, offsetWidth } = this.elRef.nativeElement; + if (!offsetHeight && !offsetWidth && this.elRef.nativeElement.children.length) { + this.targetElement = this.elRef.nativeElement.children[0] as HTMLElement; + } else { + this.targetElement = this.elRef.nativeElement; + } + } + } + + ngOnDestroy() { + if (this.timerSubscription) { + this.timerSubscription.unsubscribe(); + } + } +} diff --git a/npm/ng-packs/packages/theme-shared/src/lib/directives/table-sort.directive.ts b/npm/ng-packs/packages/theme-shared/src/lib/directives/table-sort.directive.ts index 5f42cc0144..6563f55d26 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/directives/table-sort.directive.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/directives/table-sort.directive.ts @@ -1,7 +1,17 @@ -import { Directive, Input, Optional, Self, SimpleChanges, OnChanges } from '@angular/core'; -import { Table } from 'primeng/table'; +import { SortOrder, SortPipe } from '@abp/ng.core'; +import { + ChangeDetectorRef, + Directive, + Host, + Input, + OnChanges, + Optional, + Self, + SimpleChanges, +} from '@angular/core'; import clone from 'just-clone'; -import { SortPipe, SortOrder } from '@abp/ng.core'; +import snq from 'snq'; +import { TableComponent } from '../components/table/table.component'; export interface TableSortOptions { key: string; @@ -15,13 +25,30 @@ export interface TableSortOptions { export class TableSortDirective implements OnChanges { @Input() abpTableSort: TableSortOptions; + @Input() value: any[] = []; - constructor(@Optional() @Self() private table: Table, private sortPipe: SortPipe) {} + + get table(): TableComponent | any { + return ( + this.abpTable || snq(() => this.cdRef['_view'].component) || snq(() => this.cdRef['context']) // 'context' for ivy + ); + } + + constructor( + @Host() @Optional() @Self() private abpTable: TableComponent, + private sortPipe: SortPipe, + private cdRef: ChangeDetectorRef, + ) {} + ngOnChanges({ value, abpTableSort }: SimpleChanges) { - if (value || abpTableSort) { + if (this.table && (value || abpTableSort)) { this.abpTableSort = this.abpTableSort || ({} as TableSortOptions); - this.table.value = this.sortPipe.transform(clone(this.value), this.abpTableSort.order, this.abpTableSort.key); + this.table.value = this.sortPipe.transform( + clone(this.value), + this.abpTableSort.order, + this.abpTableSort.key, + ); } } } diff --git a/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts b/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts index e4663c38aa..fedf870c4a 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/handlers/error.handler.ts @@ -57,97 +57,108 @@ export class ErrorHandler { private injector: Injector, @Inject('HTTP_ERROR_CONFIG') private httpErrorConfig: HttpErrorConfig, ) { - this.actions.pipe(ofActionSuccessful(RestOccurError, RouterError, RouterDataResolved)).subscribe(res => { - if (res instanceof RestOccurError) { - const { payload: err = {} as HttpErrorResponse | any } = res; - const body = snq(() => (err as HttpErrorResponse).error.error, DEFAULT_ERROR_MESSAGES.defaultError.title); - - if (err instanceof HttpErrorResponse && err.headers.get('_AbpErrorFormat')) { - const confirmation$ = this.showError(null, null, body); - - if (err.status === 401) { - confirmation$.subscribe(() => { - this.navigateToLogin(); - }); - } - } else { - switch ((err as HttpErrorResponse).status) { - case 401: - this.canCreateCustomError(401) - ? this.show401Page() - : this.showError( - { - key: 'AbpAccount::DefaultErrorMessage401', - defaultValue: DEFAULT_ERROR_MESSAGES.defaultError401.title, - }, - { - key: 'AbpAccount::DefaultErrorMessage401Detail', - defaultValue: DEFAULT_ERROR_MESSAGES.defaultError401.details, - }, - ).subscribe(() => this.navigateToLogin()); - break; - case 403: - this.createErrorComponent({ - title: { - key: 'AbpAccount::DefaultErrorMessage403', - defaultValue: DEFAULT_ERROR_MESSAGES.defaultError403.title, - }, - details: { - key: 'AbpAccount::DefaultErrorMessage403Detail', - defaultValue: DEFAULT_ERROR_MESSAGES.defaultError403.details, - }, - status: 403, - }); - break; - case 404: - this.canCreateCustomError(404) - ? this.show404Page() - : this.showError( - { - key: 'AbpAccount::DefaultErrorMessage404', - defaultValue: DEFAULT_ERROR_MESSAGES.defaultError404.details, - }, - { - key: 'AbpAccount::DefaultErrorMessage404Detail', - defaultValue: DEFAULT_ERROR_MESSAGES.defaultError404.title, - }, - ); - break; - case 500: - this.createErrorComponent({ - title: { - key: 'AbpAccount::500Message', - defaultValue: DEFAULT_ERROR_MESSAGES.defaultError500.title, - }, - details: { - key: 'AbpAccount::InternalServerErrorMessage', - defaultValue: DEFAULT_ERROR_MESSAGES.defaultError500.details, - }, - status: 500, + this.actions + .pipe(ofActionSuccessful(RestOccurError, RouterError, RouterDataResolved)) + .subscribe(res => { + if (res instanceof RestOccurError) { + const { payload: err = {} as HttpErrorResponse | any } = res; + const body = snq( + () => (err as HttpErrorResponse).error.error, + DEFAULT_ERROR_MESSAGES.defaultError.title, + ); + + if (err instanceof HttpErrorResponse && err.headers.get('_AbpErrorFormat')) { + const confirmation$ = this.showError(null, null, body); + + if (err.status === 401) { + confirmation$.subscribe(() => { + this.navigateToLogin(); }); - break; - case 0: - if ((err as HttpErrorResponse).statusText === 'Unknown Error') { + } + } else { + switch ((err as HttpErrorResponse).status) { + case 401: + this.canCreateCustomError(401) + ? this.show401Page() + : this.showError( + { + key: 'AbpAccount::DefaultErrorMessage401', + defaultValue: DEFAULT_ERROR_MESSAGES.defaultError401.title, + }, + { + key: 'AbpAccount::DefaultErrorMessage401Detail', + defaultValue: DEFAULT_ERROR_MESSAGES.defaultError401.details, + }, + ).subscribe(() => this.navigateToLogin()); + break; + case 403: this.createErrorComponent({ title: { - key: 'AbpAccount::DefaultErrorMessage', - defaultValue: DEFAULT_ERROR_MESSAGES.defaultError.title, + key: 'AbpAccount::DefaultErrorMessage403', + defaultValue: DEFAULT_ERROR_MESSAGES.defaultError403.title, }, + details: { + key: 'AbpAccount::DefaultErrorMessage403Detail', + defaultValue: DEFAULT_ERROR_MESSAGES.defaultError403.details, + }, + status: 403, }); - } - break; - default: - this.showError(DEFAULT_ERROR_MESSAGES.defaultError.details, DEFAULT_ERROR_MESSAGES.defaultError.title); - break; + break; + case 404: + this.canCreateCustomError(404) + ? this.show404Page() + : this.showError( + { + key: 'AbpAccount::DefaultErrorMessage404', + defaultValue: DEFAULT_ERROR_MESSAGES.defaultError404.details, + }, + { + key: 'AbpAccount::DefaultErrorMessage404Detail', + defaultValue: DEFAULT_ERROR_MESSAGES.defaultError404.title, + }, + ); + break; + case 500: + this.createErrorComponent({ + title: { + key: 'AbpAccount::500Message', + defaultValue: DEFAULT_ERROR_MESSAGES.defaultError500.title, + }, + details: { + key: 'AbpAccount::InternalServerErrorMessage', + defaultValue: DEFAULT_ERROR_MESSAGES.defaultError500.details, + }, + status: 500, + }); + break; + case 0: + if ((err as HttpErrorResponse).statusText === 'Unknown Error') { + this.createErrorComponent({ + title: { + key: 'AbpAccount::DefaultErrorMessage', + defaultValue: DEFAULT_ERROR_MESSAGES.defaultError.title, + }, + }); + } + break; + default: + this.showError( + DEFAULT_ERROR_MESSAGES.defaultError.details, + DEFAULT_ERROR_MESSAGES.defaultError.title, + ); + break; + } } + } else if ( + res instanceof RouterError && + snq(() => res.event.error.indexOf('Cannot match') > -1, false) + ) { + this.show404Page(); + } else if (res instanceof RouterDataResolved && this.componentRef) { + this.componentRef.destroy(); + this.componentRef = null; } - } else if (res instanceof RouterError && snq(() => res.event.error.indexOf('Cannot match') > -1, false)) { - this.show404Page(); - } else if (res instanceof RouterDataResolved && this.componentRef) { - this.componentRef.destroy(); - this.componentRef = null; - } - }); + }); } private show401Page() { @@ -179,6 +190,9 @@ export class ErrorHandler { if (body.details) { message = body.details; title = body.message; + } else if (body.message) { + title = DEFAULT_ERROR_MESSAGES.defaultError.title; + message = body.message; } else { message = body.message || DEFAULT_ERROR_MESSAGES.defaultError.title; } @@ -192,7 +206,9 @@ export class ErrorHandler { private navigateToLogin() { this.store.dispatch( - new Navigate(['/account/login'], null, { state: { redirectUrl: this.store.selectSnapshot(RouterState.url) } }), + new Navigate(['/account/login'], null, { + state: { redirectUrl: this.store.selectSnapshot(RouterState.url) }, + }), ); } @@ -200,7 +216,9 @@ export class ErrorHandler { const renderer = this.rendererFactory.createRenderer(null, null); const host = renderer.selectRootElement(document.body, true); - this.componentRef = this.cfRes.resolveComponentFactory(HttpErrorWrapperComponent).create(this.injector); + this.componentRef = this.cfRes + .resolveComponentFactory(HttpErrorWrapperComponent) + .create(this.injector); for (const key in this.componentRef.instance) { if (this.componentRef.instance.hasOwnProperty(key)) { diff --git a/npm/ng-packs/packages/theme-shared/src/lib/models/confirmation.ts b/npm/ng-packs/packages/theme-shared/src/lib/models/confirmation.ts index 3249860214..815fd65c20 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/models/confirmation.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/models/confirmation.ts @@ -1,11 +1,29 @@ -import { Toaster } from './toaster'; import { Config } from '@abp/ng.core'; export namespace Confirmation { - export interface Options extends Toaster.Options { + export interface Options { + id?: any; + closable?: boolean; + messageLocalizationParams?: string[]; + titleLocalizationParams?: string[]; hideCancelBtn?: boolean; hideYesBtn?: boolean; cancelText?: Config.LocalizationParam; yesText?: Config.LocalizationParam; } + + export interface DialogData { + message: Config.LocalizationParam; + title?: Config.LocalizationParam; + severity?: Severity; + options?: Partial; + } + + export type Severity = 'neutral' | 'success' | 'info' | 'warning' | 'error'; + + export enum Status { + confirm = 'confirm', + reject = 'reject', + dismiss = 'dismiss', + } } diff --git a/npm/ng-packs/packages/theme-shared/src/lib/models/toaster.ts b/npm/ng-packs/packages/theme-shared/src/lib/models/toaster.ts index f029911dae..27a2b6b460 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/models/toaster.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/models/toaster.ts @@ -1,17 +1,30 @@ +import { Config } from '@abp/ng.core'; + export namespace Toaster { - export interface Options { - id?: any; - closable?: boolean; + export interface ToastOptions { life?: number; sticky?: boolean; - data?: any; + closable?: boolean; + tapToDismiss?: boolean; messageLocalizationParams?: string[]; titleLocalizationParams?: string[]; + id: any; + containerKey?: string; + } + + export interface Toast { + message: Config.LocalizationParam; + title?: Config.LocalizationParam; + severity?: string; + options?: ToastOptions; } - export type Severity = 'success' | 'info' | 'warn' | 'error'; + export type Severity = 'neutral' | 'success' | 'info' | 'warning' | 'error'; - export const enum Status { + /** + * @deprecated Status will be removed from toaster model in v2.2 + */ + export enum Status { confirm = 'confirm', reject = 'reject', dismiss = 'dismiss', diff --git a/npm/ng-packs/packages/theme-shared/src/lib/services/confirmation.service.ts b/npm/ng-packs/packages/theme-shared/src/lib/services/confirmation.service.ts index cceedc22cb..2db6d38091 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/services/confirmation.service.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/services/confirmation.service.ts @@ -1,43 +1,72 @@ import { Injectable } from '@angular/core'; -import { AbstractToaster } from '../abstracts/toaster'; import { Confirmation } from '../models/confirmation'; -import { MessageService } from 'primeng/components/common/messageservice'; -import { fromEvent, Observable, Subject } from 'rxjs'; +import { fromEvent, Observable, Subject, ReplaySubject } from 'rxjs'; import { takeUntil, debounceTime, filter } from 'rxjs/operators'; -import { Toaster } from '../models/toaster'; +import { Config } from '@abp/ng.core'; @Injectable({ providedIn: 'root' }) -export class ConfirmationService extends AbstractToaster { - key = 'abpConfirmation'; +export class ConfirmationService { + status$: Subject; + confirmation$ = new ReplaySubject(1); - sticky = true; + info( + message: Config.LocalizationParam, + title: Config.LocalizationParam, + options?: Partial, + ): Observable { + return this.show(message, title, 'info', options); + } - destroy$ = new Subject(); + success( + message: Config.LocalizationParam, + title: Config.LocalizationParam, + options?: Partial, + ): Observable { + return this.show(message, title, 'success', options); + } - constructor(protected messageService: MessageService) { - super(messageService); + warn( + message: Config.LocalizationParam, + title: Config.LocalizationParam, + options?: Partial, + ): Observable { + return this.show(message, title, 'warning', options); + } + + error( + message: Config.LocalizationParam, + title: Config.LocalizationParam, + options?: Partial, + ): Observable { + return this.show(message, title, 'error', options); } show( - message: string, - title: string, - severity: Toaster.Severity, - options?: Confirmation.Options, - ): Observable { + message: Config.LocalizationParam, + title: Config.LocalizationParam, + severity?: Confirmation.Severity, + options?: Partial, + ): Observable { + this.confirmation$.next({ + message, + title, + severity: severity || 'neutral', + options, + }); + this.status$ = new Subject(); this.listenToEscape(); - return super.show(message, title, severity, options); + return this.status$; } - clear(status?: Toaster.Status) { - super.clear(status); - - this.destroy$.next(); + clear(status?: Confirmation.Status) { + this.confirmation$.next(); + this.status$.next(status || Confirmation.Status.dismiss); } listenToEscape() { fromEvent(document, 'keyup') .pipe( - takeUntil(this.destroy$), + takeUntil(this.status$), debounceTime(150), filter((key: KeyboardEvent) => key && key.key === 'Escape'), ) diff --git a/npm/ng-packs/packages/theme-shared/src/lib/services/toaster.service.ts b/npm/ng-packs/packages/theme-shared/src/lib/services/toaster.service.ts index 9e5858007a..021aa60273 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/services/toaster.service.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/services/toaster.service.ts @@ -1,15 +1,116 @@ import { Injectable } from '@angular/core'; -import { AbstractToaster } from '../abstracts/toaster'; -import { Message } from 'primeng/components/common/message'; -import { MessageService } from 'primeng/components/common/messageservice'; +import { Toaster } from '../models'; +import { ReplaySubject } from 'rxjs'; +import { Config } from '@abp/ng.core'; +import snq from 'snq'; -@Injectable({ providedIn: 'root' }) -export class ToasterService extends AbstractToaster { - constructor(protected messageService: MessageService) { - super(messageService); +@Injectable({ + providedIn: 'root', +}) +export class ToasterService { + toasts$ = new ReplaySubject(1); + + private lastId = -1; + + private toasts = [] as Toaster.Toast[]; + + /** + * Creates an info toast with given parameters. + * @param message Content of the toast + * @param title Title of the toast + * @param options Spesific style or structural options for individual toast + */ + info( + message: Config.LocalizationParam, + title?: Config.LocalizationParam, + options?: Partial, + ) { + return this.show(message, title, 'info', options); + } + + /** + * Creates a success toast with given parameters. + * @param message Content of the toast + * @param title Title of the toast + * @param options Spesific style or structural options for individual toast + */ + success( + message: Config.LocalizationParam, + title?: Config.LocalizationParam, + options?: Partial, + ) { + return this.show(message, title, 'success', options); + } + + /** + * Creates a warning toast with given parameters. + * @param message Content of the toast + * @param title Title of the toast + * @param options Spesific style or structural options for individual toast + */ + warn( + message: Config.LocalizationParam, + title?: Config.LocalizationParam, + options?: Partial, + ) { + return this.show(message, title, 'warning', options); + } + + /** + * Creates an error toast with given parameters. + * @param message Content of the toast + * @param title Title of the toast + * @param options Spesific style or structural options for individual toast + */ + error( + message: Config.LocalizationParam, + title?: Config.LocalizationParam, + options?: Partial, + ) { + return this.show(message, title, 'error', options); + } + + /** + * Creates a toast with given parameters. + * @param message Content of the toast + * @param title Title of the toast + * @param severity Sets color of the toast. "success", "warning" etc. + * @param options Spesific style or structural options for individual toast + */ + + show( + message: Config.LocalizationParam, + title: Config.LocalizationParam = null, + severity: Toaster.Severity = 'neutral', + options = {} as Partial, + ) { + const id = ++this.lastId; + this.toasts.push({ + message, + title, + severity, + options: { closable: true, id, ...options }, + }); + this.toasts$.next(this.toasts); + return id; + } + + /** + * Removes the toast with given id. + * @param id ID of the toast to be removed. + */ + remove(id: number) { + this.toasts = this.toasts.filter(toast => snq(() => toast.options.id) !== id); + this.toasts$.next(this.toasts); } - addAll(messages: Message[]): void { - this.messageService.addAll(messages.map(message => ({ key: this.key, ...message }))); + /** + * Removes all open toasts at once. + */ + clear(key?: string) { + this.toasts = !key + ? [] + : this.toasts.filter(toast => snq(() => toast.options.containerKey) !== key); + this.toasts$.next(this.toasts); } } diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tests/confirmation.service.spec.ts b/npm/ng-packs/packages/theme-shared/src/lib/tests/confirmation.service.spec.ts index 361ec0c020..918ed4e314 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/tests/confirmation.service.spec.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/tests/confirmation.service.spec.ts @@ -3,9 +3,9 @@ import { Component } from '@angular/core'; import { RouterTestingModule } from '@angular/router/testing'; import { createComponentFactory, Spectator } from '@ngneat/spectator/jest'; import { NgxsModule } from '@ngxs/store'; -import { MessageService } from 'primeng/components/common/messageservice'; import { ConfirmationService } from '../services/confirmation.service'; import { ThemeSharedModule } from '../theme-shared.module'; +import { OAuthModule, OAuthService } from 'angular-oauth2-oidc'; @Component({ selector: 'abp-dummy', @@ -23,7 +23,7 @@ describe('ConfirmationService', () => { const createComponent = createComponentFactory({ component: DummyComponent, imports: [CoreModule, ThemeSharedModule.forRoot(), NgxsModule.forRoot(), RouterTestingModule], - providers: [MessageService], + mocks: [OAuthService], }); beforeEach(() => { @@ -31,45 +31,44 @@ describe('ConfirmationService', () => { service = spectator.get(ConfirmationService); }); - it('should display a confirmation popup', () => { + test('should display a confirmation popup', () => { service.info('test', 'title'); spectator.detectChanges(); - expect(spectator.query('p-toast')).toBeTruthy(); - expect(spectator.query('p-toastitem')).toBeTruthy(); - expect(spectator.query('div.abp-confirm-summary')).toHaveText('title'); - expect(spectator.query('div.abp-confirm-body')).toHaveText('test'); + expect(spectator.query('div.confirmation .title')).toHaveText('title'); + expect(spectator.query('div.confirmation .message')).toHaveText('test'); }); - it('should close with ESC key', done => { - service.info('test', 'title'); - spectator.detectChanges(); + test('should close with ESC key', done => { + service.info('test', 'title').subscribe(() => { + setTimeout(() => { + spectator.detectComponentChanges(); + expect(spectator.query('div.confirmation')).toBeFalsy(); + done(); + }, 0); + }); - expect(spectator.query('p-toastitem')).toBeTruthy(); + spectator.detectChanges(); + expect(spectator.query('div.confirmation')).toBeTruthy(); + spectator.dispatchKeyboardEvent('div.confirmation', 'keyup', 'Escape'); + }); - spectator.dispatchKeyboardEvent('abp-confirmation', 'keyup', 'Escape'); - service.destroy$.subscribe(() => { - // expect(spectator.query('p-toastitem')).toBeFalsy(); + test('should close when click cancel button', done => { + service.info('test', 'title', { yesText: 'Sure', cancelText: 'Exit' }).subscribe(() => { spectator.detectComponentChanges(); - expect(spectator.query('p-toastitem')).toBeFalsy(); - done(); + setTimeout(() => { + expect(spectator.query('div.confirmation')).toBeFalsy(); + done(); + }, 0); }); - }); - it('should close when click cancel button', done => { - service.info('test', 'title', { yesText: 'Sure', cancelText: 'Exit' }); spectator.detectChanges(); - expect(spectator.query('p-toastitem')).toBeTruthy(); + expect(spectator.query('div.confirmation')).toBeTruthy(); expect(spectator.query('button#cancel')).toHaveText('Exit'); expect(spectator.query('button#confirm')).toHaveText('Sure'); - service.status$.subscribe(() => { - spectator.detectComponentChanges(); - expect(spectator.query('p-toastitem')).toBeFalsy(); - done(); - }); spectator.click('button#cancel'); }); }); diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tests/error.handler.spec.ts b/npm/ng-packs/packages/theme-shared/src/lib/tests/error.handler.spec.ts index 88ae00a874..d2f2c11e3d 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/tests/error.handler.spec.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/tests/error.handler.spec.ts @@ -6,11 +6,14 @@ import { createRoutingFactory, SpectatorRouting } from '@ngneat/spectator/jest'; import { NgxsModule, Store } from '@ngxs/store'; import { DEFAULT_ERROR_MESSAGES, ErrorHandler } from '../handlers'; import { ThemeSharedModule } from '../theme-shared.module'; -import { MessageService } from 'primeng/components/common/messageservice'; import { RouterError, RouterDataResolved } from '@ngxs/router-plugin'; import { NavigationError, ResolveEnd } from '@angular/router'; +import { OAuthModule, OAuthService } from 'angular-oauth2-oidc'; -@Component({ selector: 'abp-dummy', template: 'dummy works! ' }) +@Component({ + selector: 'abp-dummy', + template: 'dummy works! ', +}) class DummyComponent { constructor(public errorHandler: ErrorHandler) {} } @@ -21,6 +24,7 @@ describe('ErrorHandler', () => { const createComponent = createRoutingFactory({ component: DummyComponent, imports: [CoreModule, ThemeSharedModule.forRoot(), NgxsModule.forRoot([])], + mocks: [OAuthService], stubsEnabled: false, routes: [ { path: '', component: DummyComponent }, @@ -38,33 +42,53 @@ describe('ErrorHandler', () => { it('should display the error component when server error occurs', () => { store.dispatch(new RestOccurError(new HttpErrorResponse({ status: 500 }))); - expect(document.querySelector('.error-template')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultError500.title); - expect(document.querySelector('.error-details')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultError500.details); + expect(document.querySelector('.error-template')).toHaveText( + DEFAULT_ERROR_MESSAGES.defaultError500.title, + ); + expect(document.querySelector('.error-details')).toHaveText( + DEFAULT_ERROR_MESSAGES.defaultError500.details, + ); }); it('should display the error component when authorize error occurs', () => { store.dispatch(new RestOccurError(new HttpErrorResponse({ status: 403 }))); - expect(document.querySelector('.error-template')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultError403.title); - expect(document.querySelector('.error-details')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultError403.details); + expect(document.querySelector('.error-template')).toHaveText( + DEFAULT_ERROR_MESSAGES.defaultError403.title, + ); + expect(document.querySelector('.error-details')).toHaveText( + DEFAULT_ERROR_MESSAGES.defaultError403.details, + ); }); it('should display the error component when unknown error occurs', () => { - store.dispatch(new RestOccurError(new HttpErrorResponse({ status: 0, statusText: 'Unknown Error' }))); - expect(document.querySelector('.error-template')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultError.title); + store.dispatch( + new RestOccurError(new HttpErrorResponse({ status: 0, statusText: 'Unknown Error' })), + ); + expect(document.querySelector('.error-template')).toHaveText( + DEFAULT_ERROR_MESSAGES.defaultError.title, + ); }); it('should display the confirmation when not found error occurs', () => { store.dispatch(new RestOccurError(new HttpErrorResponse({ status: 404 }))); spectator.detectChanges(); - expect(spectator.query('.abp-confirm-summary')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultError404.title); - expect(spectator.query('.abp-confirm-body')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultError404.details); + expect(spectator.query('.confirmation .title')).toHaveText( + DEFAULT_ERROR_MESSAGES.defaultError404.title, + ); + expect(spectator.query('.confirmation .message')).toHaveText( + DEFAULT_ERROR_MESSAGES.defaultError404.details, + ); }); it('should display the confirmation when default error occurs', () => { store.dispatch(new RestOccurError(new HttpErrorResponse({ status: 412 }))); spectator.detectChanges(); - expect(spectator.query('.abp-confirm-summary')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultError.title); - expect(spectator.query('.abp-confirm-body')).toHaveText(DEFAULT_ERROR_MESSAGES.defaultError.details); + expect(spectator.query('.confirmation .title')).toHaveText( + DEFAULT_ERROR_MESSAGES.defaultError.title, + ); + expect(spectator.query('.confirmation .message')).toHaveText( + DEFAULT_ERROR_MESSAGES.defaultError.details, + ); }); it('should display the confirmation when authenticated error occurs', async () => { @@ -103,14 +127,15 @@ describe('ErrorHandler', () => { ); spectator.detectChanges(); - expect(spectator.query('.abp-confirm-summary')).toHaveText('test message'); - expect(spectator.query('.abp-confirm-body')).toHaveText('test detail'); + expect(spectator.query('.title')).toHaveText('test message'); + expect(spectator.query('.confirmation .message')).toHaveText('test detail'); }); }); @Component({ selector: 'abp-dummy-error', - template: '

    {{errorStatus}}

    ', + template: + '

    {{errorStatus}}

    ', }) class DummyErrorComponent { errorStatus; @@ -130,12 +155,16 @@ describe('ErrorHandler with custom error component', () => { imports: [ CoreModule, ThemeSharedModule.forRoot({ - httpErrorConfig: { errorScreen: { component: DummyErrorComponent, forWhichErrors: [401, 403, 404, 500] } }, + httpErrorConfig: { + errorScreen: { component: DummyErrorComponent, forWhichErrors: [401, 403, 404, 500] }, + }, }), NgxsModule.forRoot([]), ErrorModule, ], + mocks: [OAuthService], stubsEnabled: false, + routes: [ { path: '', component: DummyComponent }, { path: 'account/login', component: RouterOutletComponent }, diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tests/loading.directive.spec.ts b/npm/ng-packs/packages/theme-shared/src/lib/tests/loading.directive.spec.ts new file mode 100644 index 0000000000..b359a2000c --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/tests/loading.directive.spec.ts @@ -0,0 +1,93 @@ +import { SpectatorDirective, createDirectiveFactory } from '@ngneat/spectator/jest'; +import { LoadingDirective } from '../directives'; +import { LoadingComponent } from '../components'; + +import { Component } from '@angular/core'; + +@Component({ + selector: 'abp-dummy', + template: '
    Testing Loading Directive
    ', +}) +export class DummyComponent {} + +describe('LoadingDirective', () => { + let spectator: SpectatorDirective; + const createDirective = createDirectiveFactory({ + directive: LoadingDirective, + declarations: [LoadingComponent, DummyComponent], + entryComponents: [LoadingComponent], + }); + + describe('default', () => { + beforeEach(() => { + spectator = createDirective('
    Testing Loading Directive
    ', { + hostProps: { loading: true }, + }); + }); + + it('should create the loading component', done => { + setTimeout(() => { + expect(spectator.directive.rootNode).toBeTruthy(); + expect(spectator.directive.componentRef).toBeTruthy(); + done(); + }, 20); + }); + }); + + describe('with custom target', () => { + const mockTarget = document.createElement('div'); + const spy = jest.spyOn(mockTarget, 'appendChild'); + + beforeEach(() => { + spectator = createDirective( + '
    Testing Loading Directive
    ', + { + hostProps: { loading: true, target: mockTarget, delay: 0 }, + }, + ); + }); + + it('should add the loading component to the DOM', done => { + setTimeout(() => { + expect(spy).toHaveBeenCalled(); + done(); + }, 20); + }); + + it('should remove the loading component to the DOM', done => { + const rendererSpy = jest.spyOn(spectator.directive['renderer'], 'removeChild'); + setTimeout(() => spectator.setHostInput({ loading: false }), 0); + setTimeout(() => { + expect(rendererSpy).toHaveBeenCalled(); + expect(spectator.directive.rootNode).toBeFalsy(); + done(); + }, 20); + }); + + it('should appear with delay', done => { + spectator.setHostInput({ loading: false, delay: 20 }); + spectator.detectChanges(); + setTimeout(() => spectator.setHostInput({ loading: true }), 0); + setTimeout(() => expect(spectator.directive.loading).toBe(false), 15); + setTimeout(() => { + expect(spectator.directive.loading).toBe(true); + done(); + }, 50); + }); + }); + + describe('with a component selector', () => { + beforeEach(() => { + spectator = createDirective('', { + hostProps: { loading: true }, + }); + }); + + it('should select the child element', done => { + setTimeout(() => { + expect(spectator.directive.targetElement.id).toBe('dummy'); + done(); + }, 20); + }); + }); +}); diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tests/modal.component.spec.ts b/npm/ng-packs/packages/theme-shared/src/lib/tests/modal.component.spec.ts index 08656ff2d7..3bdf2e9d07 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/tests/modal.component.spec.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/tests/modal.component.spec.ts @@ -1,20 +1,21 @@ import { LocalizationPipe } from '@abp/ng.core'; import { createHostFactory, SpectatorHost } from '@ngneat/spectator/jest'; import { Store } from '@ngxs/store'; -import { MessageService } from 'primeng/components/common/messageservice'; -import { ToastModule } from 'primeng/toast'; import { timer } from 'rxjs'; import { ButtonComponent, ConfirmationComponent, ModalComponent } from '../components'; +import { RouterTestingModule } from '@angular/router/testing'; describe('ModalComponent', () => { - let spectator: SpectatorHost; + let spectator: SpectatorHost< + ModalComponent, + { visible: boolean; busy: boolean; ngDirty: boolean } + >; let appearFn; let disappearFn; const createHost = createHostFactory({ component: ModalComponent, - imports: [ToastModule], + imports: [RouterTestingModule], declarations: [ConfirmationComponent, LocalizationPipe, ButtonComponent], - providers: [MessageService], mocks: [Store], }); @@ -82,7 +83,7 @@ describe('ModalComponent', () => { spectator.click('#abp-modal-close-button'); expect(disappearFn).not.toHaveBeenCalled(); - expect(spectator.query('p-toast')).toBeTruthy(); + expect(spectator.query('div.confirmation')).toBeTruthy(); spectator.click('button#cancel'); expect(spectator.query('div.modal')).toBeTruthy(); diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tests/pagination.component.spec.ts b/npm/ng-packs/packages/theme-shared/src/lib/tests/pagination.component.spec.ts new file mode 100644 index 0000000000..98f63e75f6 --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/tests/pagination.component.spec.ts @@ -0,0 +1,63 @@ +import { createHostFactory, SpectatorHost } from '@ngneat/spectator/jest'; +import { PaginationComponent } from '../components'; + +describe('PaginationComponent', () => { + let spectator: SpectatorHost; + const createHost = createHostFactory({ + component: PaginationComponent, + }); + + beforeEach(() => { + spectator = createHost( + '', + { + hostProps: { + value: 5, + totalPages: 12, + }, + }, + ); + }); + + it('should add ui-state-active class to current page', () => { + expect(spectator.query('.ui-state-active').textContent).toBe('5'); + }); + + it('should display the correct pages', () => { + expect(spectator.queryAll('.ui-paginator-page').map(node => node.textContent)).toEqual([ + '3', + '4', + '5', + '6', + '7', + ]); + + spectator.click('.ui-paginator-first'); + + expect(spectator.queryAll('.ui-paginator-page').map(node => node.textContent)).toEqual([ + '1', + '2', + '3', + '4', + '5', + ]); + + spectator.setHostInput({ value: 12 }); + + expect(spectator.queryAll('.ui-paginator-page').map(node => node.textContent)).toEqual([ + '8', + '9', + '10', + '11', + '12', + ]); + + spectator.setHostInput({ value: 1, totalPages: 3 }); + + expect(spectator.queryAll('.ui-paginator-page').map(node => node.textContent)).toEqual([ + '1', + '2', + '3', + ]); + }); +}); diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tests/sort-order-icon.component.spec.ts b/npm/ng-packs/packages/theme-shared/src/lib/tests/sort-order-icon.component.spec.ts index d351c39a74..a91f5b76c1 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/tests/sort-order-icon.component.spec.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/tests/sort-order-icon.component.spec.ts @@ -32,7 +32,7 @@ describe('SortOrderIconComponent', () => { component.sort(newKey); expect(component.selectedSortKey).toBe(newKey); expect(component.order).toBe('asc'); - expect(component.icon).toBe(''); + expect(component.icon).toBe('sorting'); }); test('should change order correctly when sort function called', () => { diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tests/table-sort.directive.spec.ts b/npm/ng-packs/packages/theme-shared/src/lib/tests/table-sort.directive.spec.ts index 7c342174e6..231f627fa1 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/tests/table-sort.directive.spec.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/tests/table-sort.directive.spec.ts @@ -1,17 +1,21 @@ import { SpectatorDirective, createDirectiveFactory } from '@ngneat/spectator/jest'; -import { TableModule, Table } from 'primeng/table'; import { TableSortDirective } from '../directives/table-sort.directive'; +import { TableComponent } from '../components/table/table.component'; +import { DummyLocalizationPipe } from './table.component.spec'; +import { PaginationComponent } from '../components'; describe('TableSortDirective', () => { let spectator: SpectatorDirective; let directive: TableSortDirective; const createDirective = createDirectiveFactory({ directive: TableSortDirective, - imports: [TableModule], + declarations: [TableComponent, DummyLocalizationPipe, PaginationComponent], }); beforeEach(() => { - spectator = createDirective(``); + spectator = createDirective( + ``, + ); directive = spectator.directive; }); @@ -21,7 +25,7 @@ describe('TableSortDirective', () => { test('should change table value', () => { expect(directive.value).toEqual([1, 4, 2]); - const table = spectator.query(Table); + const table = spectator.query(TableComponent); expect(table.value).toEqual([1, 2, 4]); }); }); diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tests/table.component.spec.ts b/npm/ng-packs/packages/theme-shared/src/lib/tests/table.component.spec.ts new file mode 100644 index 0000000000..df2894cc3e --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/tests/table.component.spec.ts @@ -0,0 +1,74 @@ +import { createHostFactory, SpectatorHost } from '@ngneat/spectator/jest'; +import { PaginationComponent, TableComponent } from '../components'; + +import { Pipe, PipeTransform } from '@angular/core'; + +@Pipe({ + name: 'abpLocalization', +}) +export class DummyLocalizationPipe implements PipeTransform { + transform(value: any, ...args: any[]): any { + return value; + } +} + +describe('TableComponent', () => { + let spectator: SpectatorHost; + const createHost = createHostFactory({ + component: TableComponent, + declarations: [PaginationComponent, DummyLocalizationPipe], + }); + + describe('without value', () => { + beforeEach(() => { + spectator = createHost( + ` + + + name`, + { + hostProps: { + value: [], + }, + }, + ); + }); + + it('should display the empty message', () => { + expect(spectator.query('tr.empty-row>div')).toHaveText( + 'AbpAccount::NoDataAvailableInDatatable', + ); + }); + + it('should display the header', () => { + expect(spectator.query('thead')).toBeTruthy(); + expect(spectator.query('th')).toHaveText('name'); + }); + + it('should place the colgroup template', () => { + expect(spectator.query('colgroup')).toBeTruthy(); + expect(spectator.query('col')).toBeTruthy(); + }); + }); + + describe('with value', () => { + // TODO + beforeEach(() => { + spectator = createHost( + ` + name + `, + { + hostProps: { + value: [], + }, + }, + ); + }); + }); +}); diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tests/toaster.service.spec.ts b/npm/ng-packs/packages/theme-shared/src/lib/tests/toaster.service.spec.ts index 149ecd1fad..1ac1116c78 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/tests/toaster.service.spec.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/tests/toaster.service.spec.ts @@ -3,14 +3,14 @@ import { Component } from '@angular/core'; import { RouterTestingModule } from '@angular/router/testing'; import { createComponentFactory, Spectator } from '@ngneat/spectator/jest'; import { NgxsModule } from '@ngxs/store'; -import { MessageService } from 'primeng/components/common/messageservice'; import { ToasterService } from '../services/toaster.service'; import { ThemeSharedModule } from '../theme-shared.module'; +import { OAuthService } from 'angular-oauth2-oidc'; @Component({ selector: 'abp-dummy', template: ` - + `, }) class DummyComponent { @@ -23,7 +23,7 @@ describe('ToasterService', () => { const createComponent = createComponentFactory({ component: DummyComponent, imports: [CoreModule, ThemeSharedModule.forRoot(), NgxsModule.forRoot(), RouterTestingModule], - providers: [MessageService], + mocks: [OAuthService], }); beforeEach(() => { @@ -31,59 +31,57 @@ describe('ToasterService', () => { service = spectator.get(ToasterService); }); - it('should display an error toast', () => { + test('should display an error toast', () => { service.error('test', 'title'); spectator.detectChanges(); - expect(spectator.query('p-toast')).toBeTruthy(); - expect(spectator.query('p-toastitem')).toBeTruthy(); - expect(spectator.query('span.ui-toast-icon')).toHaveClass('pi-times'); - expect(spectator.query('div.ui-toast-summary')).toHaveText('title'); - expect(spectator.query('div.ui-toast-detail')).toHaveText('test'); + expect(spectator.query('div.toast')).toBeTruthy(); + expect(spectator.query('.toast-icon i')).toHaveClass('fa-times-circle'); + expect(spectator.query('div.toast-title')).toHaveText('title'); + expect(spectator.query('p.toast-message')).toHaveText('test'); }); - it('should display a warning toast', () => { + test('should display a warning toast', () => { service.warn('test', 'title'); spectator.detectChanges(); - expect(spectator.query('span.ui-toast-icon')).toHaveClass('pi-exclamation-triangle'); + expect(spectator.query('.toast-icon i')).toHaveClass('fa-exclamation-triangle'); }); - it('should display a success toast', () => { + test('should display a success toast', () => { service.success('test', 'title'); spectator.detectChanges(); - expect(spectator.query('span.ui-toast-icon')).toHaveClass('pi-check'); + expect(spectator.query('.toast-icon i')).toHaveClass('fa-check-circle'); }); - it('should display an info toast', () => { + test('should display an info toast', () => { service.info('test', 'title'); spectator.detectChanges(); - expect(spectator.query('span.ui-toast-icon')).toHaveClass('pi-info-circle'); + expect(spectator.query('.toast-icon i')).toHaveClass('fa-info-circle'); }); - it('should display multiple toasts', () => { - service.addAll([ - { summary: 'summary1', detail: 'detail1' }, - { summary: 'summary2', detail: 'detail2' }, - ]); + test('should display multiple toasts', () => { + service.info('detail1', 'summary1'); + service.info('detail2', 'summary2'); + spectator.detectChanges(); - expect(spectator.queryAll('div.ui-toast-summary').map(node => node.textContent.trim())).toEqual([ + expect(spectator.queryAll('div.toast-title').map(node => node.textContent.trim())).toEqual([ 'summary1', 'summary2', ]); - expect(spectator.queryAll('div.ui-toast-detail').map(node => node.textContent.trim())).toEqual([ + expect(spectator.queryAll('p.toast-message').map(node => node.textContent.trim())).toEqual([ 'detail1', 'detail2', ]); }); - it('should remove the opened toast', () => { + test('should remove the opened toasts', () => { service.info('test', 'title'); spectator.detectChanges(); - expect(spectator.query('p-toastitem')).toBeTruthy(); + expect(spectator.query('div.toast')).toBeTruthy(); service.clear(); spectator.detectChanges(); - expect(spectator.query('p-toastitem')).toBeFalsy(); + expect(spectator.query('p-div.toast')).toBeFalsy(); }); }); diff --git a/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts b/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts index b40a4ea05a..33e6144446 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/theme-shared.module.ts @@ -1,9 +1,8 @@ import { CoreModule, LazyLoadService } from '@abp/ng.core'; +import { DatePipe } from '@angular/common'; import { APP_INITIALIZER, Injector, ModuleWithProviders, NgModule } from '@angular/core'; +import { NgbDateParserFormatter } from '@ng-bootstrap/ng-bootstrap'; import { NgxValidateCoreModule } from '@ngx-validate/core'; -import { MessageService } from 'primeng/components/common/messageservice'; -import { ToastModule } from 'primeng/toast'; -import { forkJoin } from 'rxjs'; import { BreadcrumbComponent } from './components/breadcrumb/breadcrumb.component'; import { ButtonComponent } from './components/button/button.component'; import { ChartComponent } from './components/chart/chart.component'; @@ -13,16 +12,19 @@ import { LoaderBarComponent } from './components/loader-bar/loader-bar.component import { ModalComponent } from './components/modal/modal.component'; import { SortOrderIconComponent } from './components/sort-order-icon/sort-order-icon.component'; import { TableEmptyMessageComponent } from './components/table-empty-message/table-empty-message.component'; +import { ToastContainerComponent } from './components/toast-container/toast-container.component'; +import { TableComponent } from './components/table/table.component'; import { ToastComponent } from './components/toast/toast.component'; import styles from './constants/styles'; import { TableSortDirective } from './directives/table-sort.directive'; import { ErrorHandler } from './handlers/error.handler'; -import { chartJsLoaded$ } from './utils/widget-utils'; import { RootParams } from './models/common'; -import { HTTP_ERROR_CONFIG, httpErrorConfigFactory } from './tokens/http-error.token'; -import { NgbDateParserFormatter } from '@ng-bootstrap/ng-bootstrap'; +import { httpErrorConfigFactory, HTTP_ERROR_CONFIG } from './tokens/http-error.token'; import { DateParserFormatter } from './utils/date-parser-formatter'; -import { DatePipe } from '@angular/common'; +import { chartJsLoaded$ } from './utils/widget-utils'; +import { PaginationComponent } from './components/pagination/pagination.component'; +import { LoadingComponent } from './components/loading/loading.component'; +import { LoadingDirective } from './directives/loading.directive'; export function appendScript(injector: Injector) { const fn = () => { @@ -36,7 +38,7 @@ export function appendScript(injector: Injector) { } @NgModule({ - imports: [CoreModule, ToastModule, NgxValidateCoreModule], + imports: [CoreModule, NgxValidateCoreModule], declarations: [ BreadcrumbComponent, ButtonComponent, @@ -44,10 +46,15 @@ export function appendScript(injector: Injector) { ConfirmationComponent, HttpErrorWrapperComponent, LoaderBarComponent, + LoadingComponent, ModalComponent, + PaginationComponent, + TableComponent, TableEmptyMessageComponent, ToastComponent, + ToastContainerComponent, SortOrderIconComponent, + LoadingDirective, TableSortDirective, ], exports: [ @@ -56,14 +63,19 @@ export function appendScript(injector: Injector) { ChartComponent, ConfirmationComponent, LoaderBarComponent, + LoadingComponent, ModalComponent, + PaginationComponent, + TableComponent, TableEmptyMessageComponent, ToastComponent, + ToastContainerComponent, SortOrderIconComponent, + LoadingDirective, TableSortDirective, ], providers: [DatePipe], - entryComponents: [HttpErrorWrapperComponent], + entryComponents: [HttpErrorWrapperComponent, LoadingComponent], }) export class ThemeSharedModule { constructor(private errorHandler: ErrorHandler) {} @@ -78,7 +90,6 @@ export class ThemeSharedModule { deps: [Injector], useFactory: appendScript, }, - { provide: MessageService, useClass: MessageService }, { provide: HTTP_ERROR_CONFIG, useValue: options.httpErrorConfig }, { provide: 'HTTP_ERROR_CONFIG', diff --git a/npm/ng-packs/packages/theme-shared/src/lib/utils/date-parser-formatter.ts b/npm/ng-packs/packages/theme-shared/src/lib/utils/date-parser-formatter.ts index 5bae578d16..a18f6813c8 100644 --- a/npm/ng-packs/packages/theme-shared/src/lib/utils/date-parser-formatter.ts +++ b/npm/ng-packs/packages/theme-shared/src/lib/utils/date-parser-formatter.ts @@ -31,8 +31,17 @@ export class DateParserFormatter extends NgbDateParserFormatter { return { year: toInteger(dateParts[0]), month: null, day: null }; } else if (dateParts.length === 2 && isNumber(dateParts[0]) && isNumber(dateParts[1])) { return { year: toInteger(dateParts[0]), month: toInteger(dateParts[1]), day: null }; - } else if (dateParts.length === 3 && isNumber(dateParts[0]) && isNumber(dateParts[1]) && isNumber(dateParts[2])) { - return { year: toInteger(dateParts[0]), month: toInteger(dateParts[1]), day: toInteger(dateParts[2]) }; + } else if ( + dateParts.length === 3 && + isNumber(dateParts[0]) && + isNumber(dateParts[1]) && + isNumber(dateParts[2]) + ) { + return { + year: toInteger(dateParts[0]), + month: toInteger(dateParts[1]), + day: toInteger(dateParts[2]), + }; } } return null; @@ -40,7 +49,7 @@ export class DateParserFormatter extends NgbDateParserFormatter { format(date: NgbDateStruct): string { if (date && this.datePipe) { - return this.datePipe.transform(new Date(date.year, date.month, date.day), 'shortDate'); + return this.datePipe.transform(new Date(date.year, date.month - 1, date.day), 'shortDate'); } else { return date ? `${date.year}-${isNumber(date.month) ? padNumber(date.month) : ''}-${ diff --git a/npm/ng-packs/scripts/build.js b/npm/ng-packs/scripts/build.ts similarity index 96% rename from npm/ng-packs/scripts/build.js rename to npm/ng-packs/scripts/build.ts index a38dd53a61..049b044033 100644 --- a/npm/ng-packs/scripts/build.js +++ b/npm/ng-packs/scripts/build.ts @@ -1,6 +1,4 @@ -// ESM syntax is supported. import execa from 'execa'; -import fse from 'fs-extra'; import program from 'commander'; (async () => { diff --git a/npm/ng-packs/scripts/index.js b/npm/ng-packs/scripts/index.js index a82d62f972..e69de29bb2 100644 --- a/npm/ng-packs/scripts/index.js +++ b/npm/ng-packs/scripts/index.js @@ -1,4 +0,0 @@ -// Set options as a parameter, environment variable, or rc file. -// eslint-disable-next-line no-global-assign -require = require('esm')(module /* , options */); -module.exports = require('./main.js'); diff --git a/npm/ng-packs/scripts/install-new-dependencies.js b/npm/ng-packs/scripts/install-new-dependencies.ts similarity index 97% rename from npm/ng-packs/scripts/install-new-dependencies.js rename to npm/ng-packs/scripts/install-new-dependencies.ts index c856631ffa..52f93f23d4 100644 --- a/npm/ng-packs/scripts/install-new-dependencies.js +++ b/npm/ng-packs/scripts/install-new-dependencies.ts @@ -1,4 +1,3 @@ -// ESM syntax is supported. import execa from 'execa'; import fse from 'fs-extra'; diff --git a/npm/ng-packs/scripts/package-lock.json b/npm/ng-packs/scripts/package-lock.json index fcce2fbb08..3e8d873de9 100644 --- a/npm/ng-packs/scripts/package-lock.json +++ b/npm/ng-packs/scripts/package-lock.json @@ -4,6 +4,27 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@types/fs-extra": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/@types/fs-extra/-/fs-extra-8.0.1.tgz", + "integrity": "sha512-J00cVDALmi/hJOYsunyT52Hva5TnJeKP5yd1r+mH/ZU0mbYZflR0Z5kw5kITtKTRYMhm1JMClOFYdHnQszEvqw==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "dev": true + }, + "@types/node": { + "version": "13.1.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.1.6.tgz", + "integrity": "sha512-Jg1F+bmxcpENHP23sVKkNuU3uaxPnsBMW0cLjleiikFKomJQbsn0Cqk2yDvQArqzZN6ABfBkZ0To7pQ8sLdWDg==", + "dev": true + }, "ansi-bgblack": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/ansi-bgblack/-/ansi-bgblack-0.1.1.tgz", @@ -261,6 +282,12 @@ "ansi-wrap": "0.1.0" } }, + "arg": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.2.tgz", + "integrity": "sha512-+ytCkGcBtHZ3V2r2Z06AncYO8jz46UEamcspGoU8lHcEbpn6J77QK0vdWvChsclg/tM5XIJC5tnjmPp7Eq6Obg==", + "dev": true + }, "arr-flatten": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", @@ -389,6 +416,12 @@ "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==" }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, "chalk": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", @@ -439,9 +472,9 @@ } }, "commander": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-4.0.1.tgz", - "integrity": "sha512-IPF4ouhCP+qdlcmCedhxX4xiGBPyigb8v5NeUp+0LyhwLgxMqyp3S0vl7TAPfS/hiP7FC3caI/PB9lTmP8r1NA==" + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==" }, "component-emitter": { "version": "1.3.0", @@ -486,6 +519,12 @@ "is-descriptor": "^1.0.0" } }, + "diff": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", + "dev": true + }, "end-of-stream": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", @@ -701,6 +740,15 @@ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=" }, + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + }, "jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", @@ -766,6 +814,12 @@ "js-tokens": "^3.0.0 || ^4.0.0" } }, + "make-error": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz", + "integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==", + "dev": true + }, "map-visit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", @@ -784,6 +838,12 @@ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==" }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, "mixin-object": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/mixin-object/-/mixin-object-2.0.1.tgz", @@ -1178,6 +1238,22 @@ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-support": { + "version": "0.5.16", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.16.tgz", + "integrity": "sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, "static-extend": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", @@ -1280,6 +1356,12 @@ "ansi-regex": "^2.0.0" } }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, "strip-color": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/strip-color/-/strip-color-0.1.0.tgz", @@ -1336,6 +1418,37 @@ "isobject": "^3.0.0" } }, + "ts-node": { + "version": "8.6.1", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-8.6.1.tgz", + "integrity": "sha512-KqPbO7/UuOPE4ANAOV9geZjk6tet6rK2K+DFeEJq6kIXUi0nLkrOMksozGkIlFopOorkStlwar3DdWYrdl7zCw==", + "dev": true, + "requires": { + "arg": "^4.1.0", + "diff": "^4.0.1", + "make-error": "^1.1.1", + "source-map-support": "^0.5.6", + "yn": "^4.0.0" + } + }, + "tsconfig-paths": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz", + "integrity": "sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw==", + "dev": true, + "requires": { + "@types/json5": "^0.0.29", + "json5": "^1.0.1", + "minimist": "^1.2.0", + "strip-bom": "^3.0.0" + } + }, + "typescript": { + "version": "3.7.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.4.tgz", + "integrity": "sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw==", + "dev": true + }, "universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", @@ -1377,6 +1490,12 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" + }, + "yn": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yn/-/yn-4.0.0.tgz", + "integrity": "sha512-huWiiCS4TxKc4SfgmTwW1K7JmXPPAmuXWYy4j9qjQo4+27Kni8mGhAAi1cloRWmBe2EqcLgt3IGqQoRL/MtPgg==", + "dev": true } } } diff --git a/npm/ng-packs/scripts/package.json b/npm/ng-packs/scripts/package.json index 14e83b6d51..144a275924 100644 --- a/npm/ng-packs/scripts/package.json +++ b/npm/ng-packs/scripts/package.json @@ -3,24 +3,27 @@ "version": "1.0.0", "description": "ABP helper scripts", "main": "index.js", - "modules": "[build.js, sync.js]", "scripts": { - "build": "node -r esm build.js", - "build:prod": "node -r esm prod-build.js", - "publish-packages": "node -r esm publish.js", - "install-new-dependencies": "node -r esm install-new-dependencies.js", - "sync": "node -r esm sync.js", - "test": "echo \"Error: no test specified\" && exit 1" + "build": "ts-node -r tsconfig-paths/register build.ts", + "build:prod": "ts-node -r tsconfig-paths/register prod-build.ts", + "publish-packages": "ts-node -r tsconfig-paths/register publish.ts", + "install-new-dependencies": "ts-node -r tsconfig-paths/register install-new-dependencies.ts", + "sync": "ts-node -r tsconfig-paths/register sync.ts" }, "author": "", "dependencies": { "babel-preset-node6": "^11.0.0", - "commander": "^4.0.1", + "commander": "^4.1.1", "execa": "^2.0.3", "fs-extra": "^8.1.0", "prompt-confirm": "^2.0.4" }, "devDependencies": { - "esm": "^3.2.25" + "@types/fs-extra": "^8.0.1", + "@types/node": "^13.1.2", + "esm": "^3.2.25", + "ts-node": "^8.5.4", + "tsconfig-paths": "^3.9.0", + "typescript": "^3.7.4" } } diff --git a/npm/ng-packs/scripts/prod-build.js b/npm/ng-packs/scripts/prod-build.ts similarity index 94% rename from npm/ng-packs/scripts/prod-build.js rename to npm/ng-packs/scripts/prod-build.ts index 2f204b11d7..a6bad4c8c9 100644 --- a/npm/ng-packs/scripts/prod-build.js +++ b/npm/ng-packs/scripts/prod-build.ts @@ -1,4 +1,3 @@ -// ESM syntax is supported. import execa from 'execa'; import fse from 'fs-extra'; diff --git a/npm/ng-packs/scripts/publish.js b/npm/ng-packs/scripts/publish.ts similarity index 64% rename from npm/ng-packs/scripts/publish.js rename to npm/ng-packs/scripts/publish.ts index f5698dedfa..3a8197522f 100644 --- a/npm/ng-packs/scripts/publish.js +++ b/npm/ng-packs/scripts/publish.ts @@ -1,17 +1,21 @@ -// ESM syntax is supported. import execa from 'execa'; import fse from 'fs-extra'; +import program from 'commander'; + +program + .option( + '-v, --nextVersion ', + 'next semantic version. Available versions: ["major", "minor", "patch", "premajor", "preminor", "prepatch", "prerelease", "or type a custom version"]', + ) + .option('-p, --preview', 'publish with preview tag'); + +program.parse(process.argv); const publish = async () => { const versions = ['major', 'minor', 'patch', 'premajor', 'preminor', 'prepatch', 'prerelease']; - let nextSemanticVersion = (process.argv[2] || '').toLowerCase(); - - if (versions.indexOf(nextSemanticVersion) < 0) { - console.log( - "Please enter the next semantic version like this: 'npm run publish patch'. Available versions:\n " + - JSON.stringify(versions), - ); + if (!program.nextVersion) { + console.error('Please provide a version with --nextVersion attribute'); process.exit(1); } @@ -22,7 +26,7 @@ const publish = async () => { await execa( 'yarn', - ['lerna', 'version', nextSemanticVersion, '--yes', '--no-commit-hooks', '--skip-git'], + ['lerna', 'version', program.nextVersion, '--yes', '--no-commit-hooks', '--skip-git'], { stdout: 'inherit', cwd: '../' }, ); @@ -36,7 +40,14 @@ const publish = async () => { await execa( 'yarn', - ['lerna', 'exec', '--', '"npm publish --registry https://registry.npmjs.org"'], + [ + 'lerna', + 'exec', + '--', + `"npm publish --registry https://registry.npmjs.org${ + program.preview ? ' --tag preview' : '' + }"`, + ], { stdout: 'inherit', cwd: '../', diff --git a/npm/ng-packs/scripts/push.js b/npm/ng-packs/scripts/push.ts similarity index 100% rename from npm/ng-packs/scripts/push.js rename to npm/ng-packs/scripts/push.ts diff --git a/npm/ng-packs/scripts/sync.js b/npm/ng-packs/scripts/sync.ts similarity index 89% rename from npm/ng-packs/scripts/sync.js rename to npm/ng-packs/scripts/sync.ts index f2c08d0623..60615a1027 100644 --- a/npm/ng-packs/scripts/sync.js +++ b/npm/ng-packs/scripts/sync.ts @@ -1,4 +1,3 @@ -// ESM syntax is supported. import fse from 'fs-extra'; import execa from 'execa'; @@ -8,7 +7,9 @@ import execa from 'execa'; for (let i = 0; i < projectNames.length; i++) { const project = projectNames[i]; - const { dependencies: distDependencies, version } = await fse.readJson(`../dist/${project}/package.json`); + const { dependencies: distDependencies, version } = await fse.readJson( + `../dist/${project}/package.json`, + ); const srcPackagePath = `../packages/${project}/package.json`; const srcPackage = await fse.readJson(srcPackagePath); @@ -25,7 +26,9 @@ import execa from 'execa'; try { await execa('git', ['add', '../packages/*', '../package.json'], { stdout: 'inherit' }); - await execa('git', ['commit', '-m', 'Update source packages versions', '--no-verify'], { stdout: 'inherit' }); + await execa('git', ['commit', '-m', 'Update source packages versions', '--no-verify'], { + stdout: 'inherit', + }); } catch (error) { console.error(error.stderr); } diff --git a/npm/ng-packs/scripts/tsconfig.json b/npm/ng-packs/scripts/tsconfig.json new file mode 100644 index 0000000000..b8a62178eb --- /dev/null +++ b/npm/ng-packs/scripts/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "declaration": true, + "removeComments": true, + "emitDecoratorMetadata": true, + "experimentalDecorators": true, + "target": "es2017", + "sourceMap": true, + "outDir": "./dist", + "baseUrl": "./", + "incremental": true, + "esModuleInterop": true, + "types": ["node"] + }, + "exclude": ["node_modules", "dist"] +} diff --git a/npm/ng-packs/scripts/yarn.lock b/npm/ng-packs/scripts/yarn.lock new file mode 100644 index 0000000000..b58b42d20b --- /dev/null +++ b/npm/ng-packs/scripts/yarn.lock @@ -0,0 +1,1215 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@types/fs-extra@^8.0.1": + version "8.0.1" + resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-8.0.1.tgz#a2378d6e7e8afea1564e44aafa2e207dadf77686" + integrity sha512-J00cVDALmi/hJOYsunyT52Hva5TnJeKP5yd1r+mH/ZU0mbYZflR0Z5kw5kITtKTRYMhm1JMClOFYdHnQszEvqw== + dependencies: + "@types/node" "*" + +"@types/json5@^0.0.29": + version "0.0.29" + resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" + integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= + +"@types/node@*": + version "13.7.1" + resolved "https://registry.yarnpkg.com/@types/node/-/node-13.7.1.tgz#238eb34a66431b71d2aaddeaa7db166f25971a0d" + integrity sha512-Zq8gcQGmn4txQEJeiXo/KiLpon8TzAl0kmKH4zdWctPj05nWwp1ClMdAVEloqrQKfaC48PNLdgN/aVaLqUrluA== + +"@types/node@^13.1.2": + version "13.1.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-13.1.2.tgz#fe94285bf5e0782e1a9e5a8c482b1c34465fa385" + integrity sha512-B8emQA1qeKerqd1dmIsQYnXi+mmAzTB7flExjmy5X1aVAKFNNNDubkavwR13kR6JnpeLp3aLoJhwn9trWPAyFQ== + +ansi-bgblack@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bgblack/-/ansi-bgblack-0.1.1.tgz#a68ba5007887701b6aafbe3fa0dadfdfa8ee3ca2" + integrity sha1-poulAHiHcBtqr74/oNrf36juPKI= + dependencies: + ansi-wrap "0.1.0" + +ansi-bgblue@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bgblue/-/ansi-bgblue-0.1.1.tgz#67bdc04edc9b9b5278969da196dea3d75c8c3613" + integrity sha1-Z73ATtybm1J4lp2hlt6j11yMNhM= + dependencies: + ansi-wrap "0.1.0" + +ansi-bgcyan@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bgcyan/-/ansi-bgcyan-0.1.1.tgz#58489425600bde9f5507068dd969ebfdb50fe768" + integrity sha1-WEiUJWAL3p9VBwaN2Wnr/bUP52g= + dependencies: + ansi-wrap "0.1.0" + +ansi-bggreen@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bggreen/-/ansi-bggreen-0.1.1.tgz#4e3191248529943f4321e96bf131d1c13816af49" + integrity sha1-TjGRJIUplD9DIelr8THRwTgWr0k= + dependencies: + ansi-wrap "0.1.0" + +ansi-bgmagenta@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bgmagenta/-/ansi-bgmagenta-0.1.1.tgz#9b28432c076eaa999418672a3efbe19391c2c7a1" + integrity sha1-myhDLAduqpmUGGcqPvvhk5HCx6E= + dependencies: + ansi-wrap "0.1.0" + +ansi-bgred@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bgred/-/ansi-bgred-0.1.1.tgz#a76f92838382ba43290a6c1778424f984d6f1041" + integrity sha1-p2+Sg4OCukMpCmwXeEJPmE1vEEE= + dependencies: + ansi-wrap "0.1.0" + +ansi-bgwhite@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bgwhite/-/ansi-bgwhite-0.1.1.tgz#6504651377a58a6ececd0331994e480258e11ba8" + integrity sha1-ZQRlE3elim7OzQMxmU5IAljhG6g= + dependencies: + ansi-wrap "0.1.0" + +ansi-bgyellow@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bgyellow/-/ansi-bgyellow-0.1.1.tgz#c3fe2eb08cd476648029e6874d15a0b38f61d44f" + integrity sha1-w/4usIzUdmSAKeaHTRWgs49h1E8= + dependencies: + ansi-wrap "0.1.0" + +ansi-black@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-black/-/ansi-black-0.1.1.tgz#f6185e889360b2545a1ec50c0bf063fc43032453" + integrity sha1-9hheiJNgslRaHsUMC/Bj/EMDJFM= + dependencies: + ansi-wrap "0.1.0" + +ansi-blue@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-blue/-/ansi-blue-0.1.1.tgz#15b804990e92fc9ca8c5476ce8f699777c21edbf" + integrity sha1-FbgEmQ6S/JyoxUds6PaZd3wh7b8= + dependencies: + ansi-wrap "0.1.0" + +ansi-bold@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-bold/-/ansi-bold-0.1.1.tgz#3e63950af5acc2ae2e670e6f67deb115d1a5f505" + integrity sha1-PmOVCvWswq4uZw5vZ96xFdGl9QU= + dependencies: + ansi-wrap "0.1.0" + +ansi-colors@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-0.2.0.tgz#72c31de2a0d9a2ccd0cac30cc9823eeb2f6434b5" + integrity sha1-csMd4qDZoszQysMMyYI+6y9kNLU= + dependencies: + ansi-bgblack "^0.1.1" + ansi-bgblue "^0.1.1" + ansi-bgcyan "^0.1.1" + ansi-bggreen "^0.1.1" + ansi-bgmagenta "^0.1.1" + ansi-bgred "^0.1.1" + ansi-bgwhite "^0.1.1" + ansi-bgyellow "^0.1.1" + ansi-black "^0.1.1" + ansi-blue "^0.1.1" + ansi-bold "^0.1.1" + ansi-cyan "^0.1.1" + ansi-dim "^0.1.1" + ansi-gray "^0.1.1" + ansi-green "^0.1.1" + ansi-grey "^0.1.1" + ansi-hidden "^0.1.1" + ansi-inverse "^0.1.1" + ansi-italic "^0.1.1" + ansi-magenta "^0.1.1" + ansi-red "^0.1.1" + ansi-reset "^0.1.1" + ansi-strikethrough "^0.1.1" + ansi-underline "^0.1.1" + ansi-white "^0.1.1" + ansi-yellow "^0.1.1" + lazy-cache "^2.0.1" + +ansi-cyan@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-cyan/-/ansi-cyan-0.1.1.tgz#538ae528af8982f28ae30d86f2f17456d2609873" + integrity sha1-U4rlKK+JgvKK4w2G8vF0VtJgmHM= + dependencies: + ansi-wrap "0.1.0" + +ansi-dim@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-dim/-/ansi-dim-0.1.1.tgz#40de4c603aa8086d8e7a86b8ff998d5c36eefd6c" + integrity sha1-QN5MYDqoCG2Oeoa4/5mNXDbu/Ww= + dependencies: + ansi-wrap "0.1.0" + +ansi-gray@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-gray/-/ansi-gray-0.1.1.tgz#2962cf54ec9792c48510a3deb524436861ef7251" + integrity sha1-KWLPVOyXksSFEKPetSRDaGHvclE= + dependencies: + ansi-wrap "0.1.0" + +ansi-green@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-green/-/ansi-green-0.1.1.tgz#8a5d9a979e458d57c40e33580b37390b8e10d0f7" + integrity sha1-il2al55FjVfEDjNYCzc5C44Q0Pc= + dependencies: + ansi-wrap "0.1.0" + +ansi-grey@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-grey/-/ansi-grey-0.1.1.tgz#59d98b6ac2ba19f8a51798e9853fba78339a33c1" + integrity sha1-WdmLasK6GfilF5jphT+6eDOaM8E= + dependencies: + ansi-wrap "0.1.0" + +ansi-hidden@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-hidden/-/ansi-hidden-0.1.1.tgz#ed6a4c498d2bb7cbb289dbf2a8d1dcc8567fae0f" + integrity sha1-7WpMSY0rt8uyidvyqNHcyFZ/rg8= + dependencies: + ansi-wrap "0.1.0" + +ansi-inverse@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-inverse/-/ansi-inverse-0.1.1.tgz#b6af45826fe826bfb528a6c79885794355ccd269" + integrity sha1-tq9Fgm/oJr+1KKbHmIV5Q1XM0mk= + dependencies: + ansi-wrap "0.1.0" + +ansi-italic@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-italic/-/ansi-italic-0.1.1.tgz#104743463f625c142a036739cf85eda688986f23" + integrity sha1-EEdDRj9iXBQqA2c5z4XtpoiYbyM= + dependencies: + ansi-wrap "0.1.0" + +ansi-magenta@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-magenta/-/ansi-magenta-0.1.1.tgz#063b5ba16fb3f23e1cfda2b07c0a89de11e430ae" + integrity sha1-BjtboW+z8j4c/aKwfAqJ3hHkMK4= + dependencies: + ansi-wrap "0.1.0" + +ansi-red@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-red/-/ansi-red-0.1.1.tgz#8c638f9d1080800a353c9c28c8a81ca4705d946c" + integrity sha1-jGOPnRCAgAo1PJwoyKgcpHBdlGw= + dependencies: + ansi-wrap "0.1.0" + +ansi-regex@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-2.1.1.tgz#c3b33ab5ee360d86e0e628f0468ae7ef27d654df" + integrity sha1-w7M6te42DYbg5ijwRorn7yfWVN8= + +ansi-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ansi-regex/-/ansi-regex-3.0.0.tgz#ed0317c322064f79466c02966bddb605ab37d998" + integrity sha1-7QMXwyIGT3lGbAKWa922Bas32Zg= + +ansi-reset@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-reset/-/ansi-reset-0.1.1.tgz#e7e71292c3c7ddcd4d62ef4a6c7c05980911c3b7" + integrity sha1-5+cSksPH3c1NYu9KbHwFmAkRw7c= + dependencies: + ansi-wrap "0.1.0" + +ansi-strikethrough@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-strikethrough/-/ansi-strikethrough-0.1.1.tgz#d84877140b2cff07d1c93ebce69904f68885e568" + integrity sha1-2Eh3FAss/wfRyT685pkE9oiF5Wg= + dependencies: + ansi-wrap "0.1.0" + +ansi-styles@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" + integrity sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4= + +ansi-underline@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-underline/-/ansi-underline-0.1.1.tgz#dfc920f4c97b5977ea162df8ffb988308aaa71a4" + integrity sha1-38kg9Ml7WXfqFi34/7mIMIqqcaQ= + dependencies: + ansi-wrap "0.1.0" + +ansi-white@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-white/-/ansi-white-0.1.1.tgz#9c77b7c193c5ee992e6011d36ec4c921b4578944" + integrity sha1-nHe3wZPF7pkuYBHTbsTJIbRXiUQ= + dependencies: + ansi-wrap "0.1.0" + +ansi-wrap@0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/ansi-wrap/-/ansi-wrap-0.1.0.tgz#a82250ddb0015e9a27ca82e82ea603bbfa45efaf" + integrity sha1-qCJQ3bABXponyoLoLqYDu/pF768= + +ansi-yellow@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/ansi-yellow/-/ansi-yellow-0.1.1.tgz#cb9356f2f46c732f0e3199e6102955a77da83c1d" + integrity sha1-y5NW8vRscy8OMZnmEClVp32oPB0= + dependencies: + ansi-wrap "0.1.0" + +arg@^4.1.0: + version "4.1.2" + resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.2.tgz#e70c90579e02c63d80e3ad4e31d8bfdb8bd50064" + integrity sha512-+ytCkGcBtHZ3V2r2Z06AncYO8jz46UEamcspGoU8lHcEbpn6J77QK0vdWvChsclg/tM5XIJC5tnjmPp7Eq6Obg== + +arr-flatten@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" + integrity sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg== + +arr-swap@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/arr-swap/-/arr-swap-1.0.1.tgz#147590ed65fc815bc07fef0997c2e5823d643534" + integrity sha1-FHWQ7WX8gVvAf+8Jl8Llgj1kNTQ= + dependencies: + is-number "^3.0.0" + +babel-code-frame@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" + integrity sha1-Y/1D99weO7fONZR9uP42mj9Yx0s= + dependencies: + chalk "^1.1.3" + esutils "^2.0.2" + js-tokens "^3.0.2" + +babel-messages@^6.23.0: + version "6.23.0" + resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" + integrity sha1-8830cDhYA1sqKVHG7F7fbGLyYw4= + dependencies: + babel-runtime "^6.22.0" + +babel-plugin-syntax-trailing-function-commas@^6.5.0: + version "6.22.0" + resolved "https://registry.yarnpkg.com/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz#ba0360937f8d06e40180a43fe0d5616fff532cf3" + integrity sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM= + +babel-plugin-transform-es2015-modules-commonjs@^6.7.4: + version "6.26.2" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.2.tgz#58a793863a9e7ca870bdc5a881117ffac27db6f3" + integrity sha512-CV9ROOHEdrjcwhIaJNBGMBCodN+1cfkwtM1SbUHmvyy35KGT7fohbpOxkE2uLz1o6odKK2Ck/tz47z+VqQfi9Q== + dependencies: + babel-plugin-transform-strict-mode "^6.24.1" + babel-runtime "^6.26.0" + babel-template "^6.26.0" + babel-types "^6.26.0" + +babel-plugin-transform-strict-mode@^6.24.1: + version "6.24.1" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz#d5faf7aa578a65bbe591cf5edae04a0c67020758" + integrity sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g= + dependencies: + babel-runtime "^6.22.0" + babel-types "^6.24.1" + +babel-preset-node6@^11.0.0: + version "11.0.0" + resolved "https://registry.yarnpkg.com/babel-preset-node6/-/babel-preset-node6-11.0.0.tgz#0835994517248985a29d18f6d465dab16bb8a7d8" + integrity sha1-CDWZRRckiYWinRj21GXasWu4p9g= + dependencies: + babel-plugin-syntax-trailing-function-commas "^6.5.0" + babel-plugin-transform-es2015-modules-commonjs "^6.7.4" + +babel-runtime@^6.22.0, babel-runtime@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-runtime/-/babel-runtime-6.26.0.tgz#965c7058668e82b55d7bfe04ff2337bc8b5647fe" + integrity sha1-llxwWGaOgrVde/4E/yM3vItWR/4= + dependencies: + core-js "^2.4.0" + regenerator-runtime "^0.11.0" + +babel-template@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.26.0.tgz#de03e2d16396b069f46dd9fff8521fb1a0e35e02" + integrity sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI= + dependencies: + babel-runtime "^6.26.0" + babel-traverse "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + lodash "^4.17.4" + +babel-traverse@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.26.0.tgz#46a9cbd7edcc62c8e5c064e2d2d8d0f4035766ee" + integrity sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4= + dependencies: + babel-code-frame "^6.26.0" + babel-messages "^6.23.0" + babel-runtime "^6.26.0" + babel-types "^6.26.0" + babylon "^6.18.0" + debug "^2.6.8" + globals "^9.18.0" + invariant "^2.2.2" + lodash "^4.17.4" + +babel-types@^6.24.1, babel-types@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.26.0.tgz#a3b073f94ab49eb6fa55cd65227a334380632497" + integrity sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc= + dependencies: + babel-runtime "^6.26.0" + esutils "^2.0.2" + lodash "^4.17.4" + to-fast-properties "^1.0.3" + +babylon@^6.18.0: + version "6.18.0" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.18.0.tgz#af2f3b88fa6f5c1e4c634d1a0f8eac4f55b395e3" + integrity sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ== + +buffer-from@^1.0.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" + integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== + +chalk@^1.1.3: + version "1.1.3" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-1.1.3.tgz#a8115c55e4a702fe4d150abd3872822a7e09fc98" + integrity sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg= + dependencies: + ansi-styles "^2.2.1" + escape-string-regexp "^1.0.2" + has-ansi "^2.0.0" + strip-ansi "^3.0.0" + supports-color "^2.0.0" + +choices-separator@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/choices-separator/-/choices-separator-2.0.0.tgz#92fd1763182d79033f5c5c51d0ba352e5567c696" + integrity sha1-kv0XYxgteQM/XFxR0Lo1LlVnxpY= + dependencies: + ansi-dim "^0.1.1" + debug "^2.6.6" + strip-color "^0.1.0" + +clone-deep@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-1.0.0.tgz#b2f354444b5d4a0ce58faca337ef34da2b14a6c7" + integrity sha512-hmJRX8x1QOJVV+GUjOBzi6iauhPqc9hIF6xitWRBbiPZOBb6vGo/mDRIK9P74RTKSQK7AE8B0DDWY/vpRrPmQw== + dependencies: + for-own "^1.0.0" + is-plain-object "^2.0.4" + kind-of "^5.0.0" + shallow-clone "^1.0.0" + +clone-deep@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/clone-deep/-/clone-deep-4.0.1.tgz#c19fd9bdbbf85942b4fd979c84dcf7d5f07c2387" + integrity sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ== + dependencies: + is-plain-object "^2.0.4" + kind-of "^6.0.2" + shallow-clone "^3.0.0" + +collection-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/collection-visit/-/collection-visit-1.0.0.tgz#4bc0373c164bc3291b4d368c829cf1a80a59dca0" + integrity sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA= + dependencies: + map-visit "^1.0.0" + object-visit "^1.0.0" + +commander@^4.1.1: + version "4.1.1" + resolved "https://registry.yarnpkg.com/commander/-/commander-4.1.1.tgz#9fd602bd936294e9e9ef46a3f4d6964044b18068" + integrity sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA== + +component-emitter@^1.2.1: + version "1.3.0" + resolved "https://registry.yarnpkg.com/component-emitter/-/component-emitter-1.3.0.tgz#16e4070fba8ae29b679f2215853ee181ab2eabc0" + integrity sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg== + +copy-descriptor@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" + integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= + +core-js@^2.4.0: + version "2.6.11" + resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.11.tgz#38831469f9922bded8ee21c9dc46985e0399308c" + integrity sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg== + +cross-spawn@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.1.tgz#0ab56286e0f7c24e153d04cc2aa027e43a9a5d14" + integrity sha512-u7v4o84SwFpD32Z8IIcPZ6z1/ie24O6RU3RbtL5Y316l3KuHVPx9ItBgWQ6VlfAFnRnTtMUrsQ9MUUTuEZjogg== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + +debug@^2.6.6, debug@^2.6.8: + version "2.6.9" + resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f" + integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA== + dependencies: + ms "2.0.0" + +debug@^3.0.1: + version "3.2.6" + resolved "https://registry.yarnpkg.com/debug/-/debug-3.2.6.tgz#e83d17de16d8a7efb7717edbe5fb10135eee629b" + integrity sha512-mel+jf7nrtEl5Pn1Qx46zARXKDpBbvzezse7p7LqINmdoIk8PYP5SySaxEmYv6TZ0JyEKA1hsCId6DIhgITtWQ== + dependencies: + ms "^2.1.1" + +define-property@^0.2.5: + version "0.2.5" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-0.2.5.tgz#c35b1ef918ec3c990f9a5bc57be04aacec5c8116" + integrity sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY= + dependencies: + is-descriptor "^0.1.0" + +define-property@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-1.0.0.tgz#769ebaaf3f4a63aad3af9e8d304c9bbe79bfb0e6" + integrity sha1-dp66rz9KY6rTr56NMEybvnm/sOY= + dependencies: + is-descriptor "^1.0.0" + +define-property@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/define-property/-/define-property-2.0.2.tgz#d459689e8d654ba77e02a817f8710d702cb16e9d" + integrity sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ== + dependencies: + is-descriptor "^1.0.2" + isobject "^3.0.1" + +diff@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.1.tgz#0c667cb467ebbb5cea7f14f135cc2dba7780a8ff" + integrity sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q== + +end-of-stream@^1.1.0: + version "1.4.4" + resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0" + integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q== + dependencies: + once "^1.4.0" + +error-symbol@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/error-symbol/-/error-symbol-0.1.0.tgz#0a4dae37d600d15a29ba453d8ef920f1844333f6" + integrity sha1-Ck2uN9YA0VopukU9jvkg8YRDM/Y= + +escape-string-regexp@^1.0.2: + version "1.0.5" + resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" + integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= + +esm@^3.2.25: + version "3.2.25" + resolved "https://registry.yarnpkg.com/esm/-/esm-3.2.25.tgz#342c18c29d56157688ba5ce31f8431fbb795cc10" + integrity sha512-U1suiZ2oDVWv4zPO56S0NcR5QriEahGtdN2OR6FiOG4WJvcjBVFB0qI4+eKoWFH483PKGuLuu6V8Z4T5g63UVA== + +esutils@^2.0.2: + version "2.0.3" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" + integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== + +execa@^2.0.3: + version "2.1.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-2.1.0.tgz#e5d3ecd837d2a60ec50f3da78fd39767747bbe99" + integrity sha512-Y/URAVapfbYy2Xp/gb6A0E7iR8xeqOCXsuuaoMn7A5PzrXUK84E1gyiEfq0wQd/GHA6GsoHWwhNq8anb0mleIw== + dependencies: + cross-spawn "^7.0.0" + get-stream "^5.0.0" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^3.0.0" + onetime "^5.1.0" + p-finally "^2.0.0" + signal-exit "^3.0.2" + strip-final-newline "^2.0.0" + +extend-shallow@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/extend-shallow/-/extend-shallow-2.0.1.tgz#51af7d614ad9a9f610ea1bafbb989d6b1c56890f" + integrity sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8= + dependencies: + is-extendable "^0.1.0" + +for-in@^0.1.3: + version "0.1.8" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.8.tgz#d8773908e31256109952b1fdb9b3fa867d2775e1" + integrity sha1-2Hc5COMSVhCZUrH9ubP6hn0ndeE= + +for-in@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" + integrity sha1-gQaNKVqBQuwKxybG4iAMMPttXoA= + +for-own@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/for-own/-/for-own-1.0.0.tgz#c63332f415cedc4b04dbfe70cf836494c53cb44b" + integrity sha1-xjMy9BXO3EsE2/5wz4NklMU8tEs= + dependencies: + for-in "^1.0.1" + +fs-extra@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" + integrity sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g== + dependencies: + graceful-fs "^4.2.0" + jsonfile "^4.0.0" + universalify "^0.1.0" + +get-stream@^5.0.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.1.0.tgz#01203cdc92597f9b909067c3e656cc1f4d3c4dc9" + integrity sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw== + dependencies: + pump "^3.0.0" + +globals@^9.18.0: + version "9.18.0" + resolved "https://registry.yarnpkg.com/globals/-/globals-9.18.0.tgz#aa3896b3e69b487f17e31ed2143d69a8e30c2d8a" + integrity sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ== + +graceful-fs@^4.1.6, graceful-fs@^4.2.0: + version "4.2.3" + resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.3.tgz#4a12ff1b60376ef09862c2093edd908328be8423" + integrity sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ== + +has-ansi@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/has-ansi/-/has-ansi-2.0.0.tgz#34f5049ce1ecdf2b0649af3ef24e45ed35416d91" + integrity sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE= + dependencies: + ansi-regex "^2.0.0" + +info-symbol@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/info-symbol/-/info-symbol-0.1.0.tgz#27841d72867ddb4242cd612d79c10633881c6a78" + integrity sha1-J4QdcoZ920JCzWEtecEGM4gcang= + +invariant@^2.2.2: + version "2.2.4" + resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" + integrity sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA== + dependencies: + loose-envify "^1.0.0" + +is-accessor-descriptor@^0.1.6: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" + integrity sha1-qeEss66Nh2cn7u84Q/igiXtcmNY= + dependencies: + kind-of "^3.0.2" + +is-accessor-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz#169c2f6d3df1f992618072365c9b0ea1f6878656" + integrity sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ== + dependencies: + kind-of "^6.0.0" + +is-buffer@^1.1.5: + version "1.1.6" + resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" + integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== + +is-data-descriptor@^0.1.4: + version "0.1.4" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz#0b5ee648388e2c860282e793f1856fec3f301b56" + integrity sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y= + dependencies: + kind-of "^3.0.2" + +is-data-descriptor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz#d84876321d0e7add03990406abbbbd36ba9268c7" + integrity sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ== + dependencies: + kind-of "^6.0.0" + +is-descriptor@^0.1.0: + version "0.1.6" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-0.1.6.tgz#366d8240dde487ca51823b1ab9f07a10a78251ca" + integrity sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg== + dependencies: + is-accessor-descriptor "^0.1.6" + is-data-descriptor "^0.1.4" + kind-of "^5.0.0" + +is-descriptor@^1.0.0, is-descriptor@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-descriptor/-/is-descriptor-1.0.2.tgz#3b159746a66604b04f8c81524ba365c5f14d86ec" + integrity sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg== + dependencies: + is-accessor-descriptor "^1.0.0" + is-data-descriptor "^1.0.0" + kind-of "^6.0.2" + +is-extendable@^0.1.0, is-extendable@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" + integrity sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik= + +is-fullwidth-code-point@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz#a3b30a5c4f199183167aaab93beefae3ddfb654f" + integrity sha1-o7MKXE8ZkYMWeqq5O+764937ZU8= + +is-number@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" + integrity sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU= + dependencies: + kind-of "^3.0.2" + +is-number@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-6.0.0.tgz#e6d15ad31fc262887cccf217ae5f9316f81b1995" + integrity sha512-Wu1VHeILBK8KAWJUAiSZQX94GmOE45Rg6/538fKwiloUu21KncEkYGPqob2oSZ5mUT73vLGrHQjKw3KMPwfDzg== + +is-plain-object@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-2.0.4.tgz#2c163b3fafb1b606d9d17928f05c2a1c38e07677" + integrity sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og== + dependencies: + isobject "^3.0.1" + +is-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" + integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw== + +is-windows@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" + integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA== + +isexe@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10" + integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA= + +isobject@^3.0.0, isobject@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/isobject/-/isobject-3.0.1.tgz#4e431e92b11a9731636aa1f9c8d1ccbcfdab78df" + integrity sha1-TkMekrEalzFjaqH5yNHMvP2reN8= + +"js-tokens@^3.0.0 || ^4.0.0": + version "4.0.0" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" + integrity sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ== + +js-tokens@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.2.tgz#9866df395102130e38f7f996bceb65443209c25b" + integrity sha1-mGbfOVECEw449/mWvOtlRDIJwls= + +json5@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.1.tgz#779fb0018604fa854eacbf6252180d83543e3dbe" + integrity sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow== + dependencies: + minimist "^1.2.0" + +jsonfile@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" + integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss= + optionalDependencies: + graceful-fs "^4.1.6" + +kind-of@^3.0.2, kind-of@^3.0.3: + version "3.2.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64" + integrity sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ= + dependencies: + is-buffer "^1.1.5" + +kind-of@^5.0.0, kind-of@^5.0.2: + version "5.1.0" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-5.1.0.tgz#729c91e2d857b7a419a1f9aa65685c4c33f5845d" + integrity sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw== + +kind-of@^6.0.0, kind-of@^6.0.2: + version "6.0.2" + resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051" + integrity sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA== + +koalas@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/koalas/-/koalas-1.0.2.tgz#318433f074235db78fae5661a02a8ca53ee295cd" + integrity sha1-MYQz8HQjXbePrlZhoCqMpT7ilc0= + +lazy-cache@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/lazy-cache/-/lazy-cache-2.0.2.tgz#b9190a4f913354694840859f8a8f7084d8822264" + integrity sha1-uRkKT5EzVGlIQIWfio9whNiCImQ= + dependencies: + set-getter "^0.1.0" + +lodash@^4.17.4: + version "4.17.15" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" + integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + +log-ok@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/log-ok/-/log-ok-0.1.1.tgz#bea3dd36acd0b8a7240d78736b5b97c65444a334" + integrity sha1-vqPdNqzQuKckDXhza1uXxlREozQ= + dependencies: + ansi-green "^0.1.1" + success-symbol "^0.1.0" + +log-utils@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/log-utils/-/log-utils-0.2.1.tgz#a4c217a0dd9a50515d9b920206091ab3d4e031cf" + integrity sha1-pMIXoN2aUFFdm5ICBgkas9TgMc8= + dependencies: + ansi-colors "^0.2.0" + error-symbol "^0.1.0" + info-symbol "^0.1.0" + log-ok "^0.1.1" + success-symbol "^0.1.0" + time-stamp "^1.0.1" + warning-symbol "^0.1.0" + +loose-envify@^1.0.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" + integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q== + dependencies: + js-tokens "^3.0.0 || ^4.0.0" + +make-error@^1.1.1: + version "1.3.5" + resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.5.tgz#efe4e81f6db28cadd605c70f29c831b58ef776c8" + integrity sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g== + +map-visit@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/map-visit/-/map-visit-1.0.0.tgz#ecdca8f13144e660f1b5bd41f12f3479d98dfb8f" + integrity sha1-7Nyo8TFE5mDxtb1B8S80edmN+48= + dependencies: + object-visit "^1.0.0" + +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + +mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + +minimist@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" + integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= + +mixin-object@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/mixin-object/-/mixin-object-2.0.1.tgz#4fb949441dab182540f1fe035ba60e1947a5e57e" + integrity sha1-T7lJRB2rGCVA8f4DW6YOGUel5X4= + dependencies: + for-in "^0.1.3" + is-extendable "^0.1.1" + +ms@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" + integrity sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g= + +ms@^2.1.1: + version "2.1.2" + resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" + integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== + +mute-stream@0.0.7: + version "0.0.7" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" + integrity sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s= + +npm-run-path@^3.0.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-3.1.0.tgz#7f91be317f6a466efed3c9f2980ad8a4ee8b0fa5" + integrity sha512-Dbl4A/VfiVGLgQv29URL9xshU8XDY1GeLy+fsaZ1AA8JDSfjvr5P5+pzRbWqRSBxk6/DW7MIh8lTM/PaGnP2kg== + dependencies: + path-key "^3.0.0" + +object-copy@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/object-copy/-/object-copy-0.1.0.tgz#7e7d858b781bd7c991a41ba975ed3812754e998c" + integrity sha1-fn2Fi3gb18mRpBupde04EnVOmYw= + dependencies: + copy-descriptor "^0.1.0" + define-property "^0.2.5" + kind-of "^3.0.3" + +object-visit@^1.0.0: + version "1.0.1" + resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" + integrity sha1-95xEk68MU3e1n+OdOV5BBC3QRbs= + dependencies: + isobject "^3.0.0" + +once@^1.3.1, once@^1.4.0: + version "1.4.0" + resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1" + integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E= + dependencies: + wrappy "1" + +onetime@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.0.tgz#fff0f3c91617fe62bb50189636e99ac8a6df7be5" + integrity sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q== + dependencies: + mimic-fn "^2.1.0" + +p-finally@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-2.0.1.tgz#bd6fcaa9c559a096b680806f4d657b3f0f240561" + integrity sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw== + +path-key@^3.0.0, path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + +pointer-symbol@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/pointer-symbol/-/pointer-symbol-1.0.0.tgz#60f9110204ea7a929b62644a21315543cbb3d447" + integrity sha1-YPkRAgTqepKbYmRKITFVQ8uz1Ec= + +prompt-actions@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/prompt-actions/-/prompt-actions-3.0.2.tgz#537eee52241c940379f354a06eae8528e44ceeba" + integrity sha512-dhz2Fl7vK+LPpmnQ/S/eSut4BnH4NZDLyddHKi5uTU/2PDn3grEMGkgsll16V5RpVUh/yxdiam0xsM0RD4xvtg== + dependencies: + debug "^2.6.8" + +prompt-base@^4.0.1: + version "4.1.0" + resolved "https://registry.yarnpkg.com/prompt-base/-/prompt-base-4.1.0.tgz#7b88e4c01b096c83d2f4e501a7e85f0d369ecd1f" + integrity sha512-svGzgLUKZoqomz9SGMkf1hBG8Wl3K7JGuRCXc/Pv7xw8239hhaTBXrmjt7EXA9P/QZzdyT8uNWt9F/iJTXq75g== + dependencies: + component-emitter "^1.2.1" + debug "^3.0.1" + koalas "^1.0.2" + log-utils "^0.2.1" + prompt-actions "^3.0.2" + prompt-question "^5.0.1" + readline-ui "^2.2.3" + readline-utils "^2.2.3" + static-extend "^0.1.2" + +prompt-choices@^4.0.5: + version "4.1.0" + resolved "https://registry.yarnpkg.com/prompt-choices/-/prompt-choices-4.1.0.tgz#6094202c4e55d0762e49c1e53735727e53fd484f" + integrity sha512-ZNYLv6rW9z9n0WdwCkEuS+w5nUAGzRgtRt6GQ5aFNFz6MIcU7nHFlHOwZtzy7RQBk80KzUGPSRQphvMiQzB8pg== + dependencies: + arr-flatten "^1.1.0" + arr-swap "^1.0.1" + choices-separator "^2.0.0" + clone-deep "^4.0.0" + collection-visit "^1.0.0" + define-property "^2.0.2" + is-number "^6.0.0" + kind-of "^6.0.2" + koalas "^1.0.2" + log-utils "^0.2.1" + pointer-symbol "^1.0.0" + radio-symbol "^2.0.0" + set-value "^3.0.0" + strip-color "^0.1.0" + terminal-paginator "^2.0.2" + toggle-array "^1.0.1" + +prompt-confirm@^2.0.4: + version "2.0.4" + resolved "https://registry.yarnpkg.com/prompt-confirm/-/prompt-confirm-2.0.4.tgz#42c06907333e876f2ae8867281e0b9521a4796ca" + integrity sha512-X5lzbC8/kMNHdPOqQPfMKpH4VV2f7v2OTRJoN69ZYBirSwTeQaf9ZhmzPEO9ybMA0YV2Pha5MV27u2/U4ahWfg== + dependencies: + ansi-cyan "^0.1.1" + prompt-base "^4.0.1" + +prompt-question@^5.0.1: + version "5.0.2" + resolved "https://registry.yarnpkg.com/prompt-question/-/prompt-question-5.0.2.tgz#81a479f38f0bafecc758e5d6f7bc586e599610b3" + integrity sha512-wreaLbbu8f5+7zXds199uiT11Ojp59Z4iBi6hONlSLtsKGTvL2UY8VglcxQ3t/X4qWIxsNCg6aT4O8keO65v6Q== + dependencies: + clone-deep "^1.0.0" + debug "^3.0.1" + define-property "^1.0.0" + isobject "^3.0.1" + kind-of "^5.0.2" + koalas "^1.0.2" + prompt-choices "^4.0.5" + +pump@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64" + integrity sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww== + dependencies: + end-of-stream "^1.1.0" + once "^1.3.1" + +radio-symbol@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/radio-symbol/-/radio-symbol-2.0.0.tgz#7aa9bfc50485636d52dd76d6a8e631b290799ae1" + integrity sha1-eqm/xQSFY21S3XbWqOYxspB5muE= + dependencies: + ansi-gray "^0.1.1" + ansi-green "^0.1.1" + is-windows "^1.0.1" + +readline-ui@^2.2.3: + version "2.2.3" + resolved "https://registry.yarnpkg.com/readline-ui/-/readline-ui-2.2.3.tgz#9e873a7668bbd8ca8a5573ce810a6bafb70a5089" + integrity sha512-ix7jz0PxqQqcIuq3yQTHv1TOhlD2IHO74aNO+lSuXsRYm1d+pdyup1yF3zKyLK1wWZrVNGjkzw5tUegO2IDy+A== + dependencies: + component-emitter "^1.2.1" + debug "^2.6.8" + readline-utils "^2.2.1" + string-width "^2.0.0" + +readline-utils@^2.2.1, readline-utils@^2.2.3: + version "2.2.3" + resolved "https://registry.yarnpkg.com/readline-utils/-/readline-utils-2.2.3.tgz#6f847d6b8f1915c391b581c367cd47873862351a" + integrity sha1-b4R9a48ZFcORtYHDZ81HhzhiNRo= + dependencies: + arr-flatten "^1.1.0" + extend-shallow "^2.0.1" + is-buffer "^1.1.5" + is-number "^3.0.0" + is-windows "^1.0.1" + koalas "^1.0.2" + mute-stream "0.0.7" + strip-color "^0.1.0" + window-size "^1.1.0" + +regenerator-runtime@^0.11.0: + version "0.11.1" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" + integrity sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg== + +set-getter@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/set-getter/-/set-getter-0.1.0.tgz#d769c182c9d5a51f409145f2fba82e5e86e80376" + integrity sha1-12nBgsnVpR9AkUXy+6guXoboA3Y= + dependencies: + to-object-path "^0.3.0" + +set-value@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/set-value/-/set-value-3.0.1.tgz#52c82af7653ba69eb1db92e81f5cdb32739b9e95" + integrity sha512-w6n3GUPYAWQj4ZyHWzD7K2FnFXHx9OTwJYbWg+6nXjG8sCLfs9DGv+KlqglKIIJx+ks7MlFuwFW2RBPb+8V+xg== + dependencies: + is-plain-object "^2.0.4" + +shallow-clone@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-1.0.0.tgz#4480cd06e882ef68b2ad88a3ea54832e2c48b571" + integrity sha512-oeXreoKR/SyNJtRJMAKPDSvd28OqEwG4eR/xc856cRGBII7gX9lvAqDxusPm0846z/w/hWYjI1NpKwJ00NHzRA== + dependencies: + is-extendable "^0.1.1" + kind-of "^5.0.0" + mixin-object "^2.0.1" + +shallow-clone@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-3.0.1.tgz#8f2981ad92531f55035b01fb230769a40e02efa3" + integrity sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA== + dependencies: + kind-of "^6.0.2" + +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + +signal-exit@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" + integrity sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0= + +source-map-support@^0.5.6: + version "0.5.16" + resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.16.tgz#0ae069e7fe3ba7538c64c98515e35339eac5a042" + integrity sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ== + dependencies: + buffer-from "^1.0.0" + source-map "^0.6.0" + +source-map@^0.6.0: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== + +static-extend@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/static-extend/-/static-extend-0.1.2.tgz#60809c39cbff55337226fd5e0b520f341f1fb5c6" + integrity sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY= + dependencies: + define-property "^0.2.5" + object-copy "^0.1.0" + +string-width@^2.0.0: + version "2.1.1" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" + integrity sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw== + dependencies: + is-fullwidth-code-point "^2.0.0" + strip-ansi "^4.0.0" + +strip-ansi@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-3.0.1.tgz#6a385fb8853d952d5ff05d0e8aaf94278dc63dcf" + integrity sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8= + dependencies: + ansi-regex "^2.0.0" + +strip-ansi@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-4.0.0.tgz#a8479022eb1ac368a871389b635262c505ee368f" + integrity sha1-qEeQIusaw2iocTibY1JixQXuNo8= + dependencies: + ansi-regex "^3.0.0" + +strip-bom@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/strip-bom/-/strip-bom-3.0.0.tgz#2334c18e9c759f7bdd56fdef7e9ae3d588e68ed3" + integrity sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM= + +strip-color@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/strip-color/-/strip-color-0.1.0.tgz#106f65d3d3e6a2d9401cac0eb0ce8b8a702b4f7b" + integrity sha1-EG9l09PmotlAHKwOsM6LinArT3s= + +strip-final-newline@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== + +success-symbol@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/success-symbol/-/success-symbol-0.1.0.tgz#24022e486f3bf1cdca094283b769c472d3b72897" + integrity sha1-JAIuSG878c3KCUKDt2nEctO3KJc= + +supports-color@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7" + integrity sha1-U10EXOa2Nj+kARcIRimZXp3zJMc= + +terminal-paginator@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/terminal-paginator/-/terminal-paginator-2.0.2.tgz#967e66056f28fe8f55ba7c1eebfb7c3ef371c1d3" + integrity sha512-IZMT5ECF9p4s+sNCV8uvZSW9E1+9zy9Ji9xz2oee8Jfo7hUFpauyjxkhfRcIH6Lu3Wdepv5D1kVRc8Hx74/LfQ== + dependencies: + debug "^2.6.6" + extend-shallow "^2.0.1" + log-utils "^0.2.1" + +time-stamp@^1.0.1: + version "1.1.0" + resolved "https://registry.yarnpkg.com/time-stamp/-/time-stamp-1.1.0.tgz#764a5a11af50561921b133f3b44e618687e0f5c3" + integrity sha1-dkpaEa9QVhkhsTPztE5hhofg9cM= + +to-fast-properties@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-1.0.3.tgz#b83571fa4d8c25b82e231b06e3a3055de4ca1a47" + integrity sha1-uDVx+k2MJbguIxsG46MFXeTKGkc= + +to-object-path@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/to-object-path/-/to-object-path-0.3.0.tgz#297588b7b0e7e0ac08e04e672f85c1f4999e17af" + integrity sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68= + dependencies: + kind-of "^3.0.2" + +toggle-array@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/toggle-array/-/toggle-array-1.0.1.tgz#cbf5840792bd5097f33117ae824c932affe87d58" + integrity sha1-y/WEB5K9UJfzMReugkyTKv/ofVg= + dependencies: + isobject "^3.0.0" + +ts-node@^8.5.4: + version "8.5.4" + resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.5.4.tgz#a152add11fa19c221d0b48962c210cf467262ab2" + integrity sha512-izbVCRV68EasEPQ8MSIGBNK9dc/4sYJJKYA+IarMQct1RtEot6Xp0bXuClsbUSnKpg50ho+aOAx8en5c+y4OFw== + dependencies: + arg "^4.1.0" + diff "^4.0.1" + make-error "^1.1.1" + source-map-support "^0.5.6" + yn "^3.0.0" + +tsconfig-paths@^3.9.0: + version "3.9.0" + resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.9.0.tgz#098547a6c4448807e8fcb8eae081064ee9a3c90b" + integrity sha512-dRcuzokWhajtZWkQsDVKbWyY+jgcLC5sqJhg2PSgf4ZkH2aHPvaOY8YWGhmjb68b5qqTfasSsDO9k7RUiEmZAw== + dependencies: + "@types/json5" "^0.0.29" + json5 "^1.0.1" + minimist "^1.2.0" + strip-bom "^3.0.0" + +typescript@^3.7.4: + version "3.7.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.7.4.tgz#1743a5ec5fef6a1fa9f3e4708e33c81c73876c19" + integrity sha512-A25xv5XCtarLwXpcDNZzCGvW2D1S3/bACratYBx2sax8PefsFhlYmkQicKHvpYflFS8if4zne5zT5kpJ7pzuvw== + +universalify@^0.1.0: + version "0.1.2" + resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66" + integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg== + +warning-symbol@^0.1.0: + version "0.1.0" + resolved "https://registry.yarnpkg.com/warning-symbol/-/warning-symbol-0.1.0.tgz#bb31dd11b7a0f9d67ab2ed95f457b65825bbad21" + integrity sha1-uzHdEbeg+dZ6su2V9Fe2WCW7rSE= + +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + +window-size@^1.1.0: + version "1.1.1" + resolved "https://registry.yarnpkg.com/window-size/-/window-size-1.1.1.tgz#9858586580ada78ab26ecd6978a6e03115c1af20" + integrity sha512-5D/9vujkmVQ7pSmc0SCBmHXbkv6eaHwXEx65MywhmUMsI8sGqJ972APq1lotfcwMKPFLuCFfL8xGHLIp7jaBmA== + dependencies: + define-property "^1.0.0" + is-number "^3.0.0" + +wrappy@1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" + integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8= + +yn@^3.0.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" + integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== diff --git a/npm/ng-packs/yarn.lock b/npm/ng-packs/yarn.lock index e0af31cd07..7662445e41 100644 --- a/npm/ng-packs/yarn.lock +++ b/npm/ng-packs/yarn.lock @@ -2,26 +2,26 @@ # yarn lockfile v1 -"@abp/ng.account.config@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/ng.account.config/-/ng.account.config-1.1.1.tgz#43de54dd12606a6bc10caace9e430bdb136206b6" - integrity sha512-d0Gj/BtB/YtsVMsyFJI+vcX+KE2CCKNpUQ6YC2rmIwPwOkbqV7UtbzMhxgHoG4lTTfh1pxclIOL6WFzQInI4kg== +"@abp/ng.account.config@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/ng.account.config/-/ng.account.config-2.0.1.tgz#7777a09e434d2d592790f8598fd5ec0fbed70161" + integrity sha512-qyunC9FzC5cYL7IgExyVNIzvhBjKQN1Lk35uzCPr2vJTddyEUW+4bdFfSxtwg23O1LWAuMeE4sTAg/pv0R7AUQ== dependencies: tslib "^1.9.0" -"@abp/ng.account@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/ng.account/-/ng.account-1.1.1.tgz#eddce66856d1133c4d7c04e861be019cfea6b25e" - integrity sha512-EUG7Hiv21KuOMmVSCxUBjMOlno4oYIUtrOUMNK/A/y42cr8UwUFmsu7HEx5J30Z0KWBn7w4vWvAy6KenqzMclQ== +"@abp/ng.account@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/ng.account/-/ng.account-2.0.1.tgz#e1e25224a27472a28ff85337000e301174775191" + integrity sha512-bR8xolzq/rtQ+HZnOUDKpR/FT6SSGEFq0r0HMttPG9hiTD1HNthHfx8JaQjPBCAw43WhGIIxLgcRkitu6aXAyA== dependencies: - "@abp/ng.account.config" "^1.1.1" - "@abp/ng.theme.shared" "^1.1.1" + "@abp/ng.account.config" "^2.0.1" + "@abp/ng.theme.shared" "^2.0.1" tslib "^1.9.0" -"@abp/ng.core@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/ng.core/-/ng.core-1.1.1.tgz#a08a06fff8fb58a913b619820120d93fa5120a1b" - integrity sha512-oCYQJPmiYr6UjnW6L5Dhd7rl0wvE2ABjWYT70IDLSaFjxHRlQ2exA2kKft4RMkCT0iPNzEfmdHZyqX/8AHCy8Q== +"@abp/ng.core@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/ng.core/-/ng.core-2.0.1.tgz#11471a2bc96f03c97c5bcea6d0c9fd81284a103a" + integrity sha512-fa2QK7x0VUovxX5JiXZMoBKuE23xjsW6Pp1+ZuFdKxRG8eP5yoAmkLuNKDEhzy9ancDac8wLUetvnUx/QZKCXQ== dependencies: "@ngxs/router-plugin" "^3.5.1" "@ngxs/storage-plugin" "^3.5.1" @@ -32,86 +32,86 @@ snq "^1.0.3" tslib "^1.9.0" -"@abp/ng.feature-management@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/ng.feature-management/-/ng.feature-management-1.1.1.tgz#d431a62fd677229421137c83e3ce1beb44f9d92c" - integrity sha512-Pji1vp9jWQacrRawBFRh/ao1zXE3ktbGmj1X+nCQ3o6Q7EnNattC7/KC6osqvonpfFDxpjEZP4cMyb3H1wHRIA== +"@abp/ng.feature-management@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/ng.feature-management/-/ng.feature-management-2.0.1.tgz#884451d35f642f585eb9bdf7361c859e670f030d" + integrity sha512-11uoLEnTj2shFz3bFTOHsCKixWDQiuaJbsT66ui0Rs9bWUTwMQUu1s4yzAZPHi/ooAFJUTX+H52rWtUnHwpK2A== dependencies: - "@abp/ng.theme.shared" "^1.1.1" + "@abp/ng.theme.shared" "^2.0.1" tslib "^1.9.0" -"@abp/ng.identity.config@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/ng.identity.config/-/ng.identity.config-1.1.1.tgz#da264272ecebfbce99617443048951de317c23f9" - integrity sha512-d5BJBwfHsBoeEYF6dCHeoNVX/nRy1T7HOF6sjkFQN0Jihhk/XOv/r6CpgxnUKasXF0R2wadHrZZZOme6UL7AIw== +"@abp/ng.identity.config@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/ng.identity.config/-/ng.identity.config-2.0.1.tgz#3f3b2c4f70fecb2e02ac35bdb1546f51e54b87fd" + integrity sha512-lNtrKq6+QGYokN59QjteupbMN/LjtwAQlnZ5J75LHK8YoEMMzyVpK2GVKdgO3xrgcvfDSpz+OVjePNxyykbejA== dependencies: tslib "^1.9.0" -"@abp/ng.identity@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/ng.identity/-/ng.identity-1.1.1.tgz#0776db2a4efe96953a7d46ea697689686c75fbf2" - integrity sha512-Gzz+/kgsDhTTrEMiNqDLSJvjTgk0ATy6Ud7uswoA3RCDlfcksbS5J7kHEsc6TRh6bZ1bC368Zj1F/XS7QAj/iA== +"@abp/ng.identity@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/ng.identity/-/ng.identity-2.0.1.tgz#1168ef8186614a229d6e5ada2afecd8885a074af" + integrity sha512-+B2I/xsl3qOb56BZn9gZL8icu9/YS8i9CEYJmBvjxmtUzvUV6GfNhDf83BfThJO7wZn9d+GEbHY544kjKl+kwg== dependencies: - "@abp/ng.identity.config" "^1.1.1" - "@abp/ng.permission-management" "^1.1.1" - "@abp/ng.theme.shared" "^1.1.1" + "@abp/ng.identity.config" "^2.0.1" + "@abp/ng.permission-management" "^2.0.1" + "@abp/ng.theme.shared" "^2.0.1" tslib "^1.9.0" -"@abp/ng.permission-management@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/ng.permission-management/-/ng.permission-management-1.1.1.tgz#f0184639f9bf37a24c7dc3b18953bac0a521f926" - integrity sha512-3Omhdf/VrYjd4RA9R74ttFP4T+J4Kit8A/PjJIaiwV5j8DJ0WQeBek82P3Q3+EfhuS2ehWuSuz/DYmkcxkt1dw== +"@abp/ng.permission-management@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/ng.permission-management/-/ng.permission-management-2.0.1.tgz#9e0abcc014db8bae08b8eb1380fdfbf05e988971" + integrity sha512-eKKvFtix8qoA+Il7o+39o9lMfQcSlcLme+H/Ry5crr865PcxJQ9j0nwoRBfkNRpUb8XbjyDkS3Paink7mSBZVQ== dependencies: - "@abp/ng.theme.shared" "^1.1.1" + "@abp/ng.theme.shared" "^2.0.1" tslib "^1.9.0" -"@abp/ng.setting-management.config@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/ng.setting-management.config/-/ng.setting-management.config-1.1.1.tgz#6e19cb5f7894d2b6c5193f2e72abdac5be076356" - integrity sha512-QvWo8r+dL+IcQW0nRC7sPNhMCScSHcYPqJotUY1QCanEpXU56JIfPYkOKOtt3cJTA9U2jE2hBmv7fi8yTEy6Pg== +"@abp/ng.setting-management.config@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/ng.setting-management.config/-/ng.setting-management.config-2.0.1.tgz#436e6d9ba20f93a7707548057a21cde30cfcd612" + integrity sha512-pizWCfGOCNp+zP3Pc7zPQ3NKHG9lZJTVeE+RxHXQ+TTlg9xKSlojvQnzIwTKfQPQv0lREalDimNA2PXWvzsTAQ== dependencies: tslib "^1.9.0" -"@abp/ng.setting-management@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/ng.setting-management/-/ng.setting-management-1.1.1.tgz#38cfd7c8b6cc0e29bd3a655e1aecff7e35aca10a" - integrity sha512-kwW9xC7xERo5ZDqGC4TaEXZKiHYZ3lIwGn8wVktX53ulGXrKT9N7BSVP8bBMJnJlIMNg7MpxjOYAR90gXrXdZw== +"@abp/ng.setting-management@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/ng.setting-management/-/ng.setting-management-2.0.1.tgz#7fc35fcae6db50ae6c9182feeb066dd91f26dd68" + integrity sha512-CiMzvhhimKn0B6jCcejUW5Io9rm7K2H6+gyIi6G3xrewMqVfyROB6bLebtX7KKy5291qzhqZH0MTQxZQnAMxUQ== dependencies: - "@abp/ng.setting-management.config" "^1.1.1" - "@abp/ng.theme.shared" "^1.1.1" + "@abp/ng.setting-management.config" "^2.0.1" + "@abp/ng.theme.shared" "^2.0.1" tslib "^1.9.0" -"@abp/ng.tenant-management.config@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/ng.tenant-management.config/-/ng.tenant-management.config-1.1.1.tgz#1aee4705e6ec06954d5d04ad78bb02c636dc36ae" - integrity sha512-KoYPIqsm7a/VrMZumfFKBKYwzZm1zzJeyoWpf84PZ2gvhkuh45gYwvXzMHzQu/HQ6FpJ9+NL7ro/uee1ka+DzQ== +"@abp/ng.tenant-management.config@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/ng.tenant-management.config/-/ng.tenant-management.config-2.0.1.tgz#f65a0641dbe57f0128c220fa559c75ebee8e0531" + integrity sha512-EAk1+GEGFB0Uys9FFlrBo1frr8mFp32ogOviw4fCGl0rNZpI+uh7L7q5OQiP2EvK5CDu1OQd9wZm9IVbIWHpHw== dependencies: tslib "^1.9.0" -"@abp/ng.tenant-management@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/ng.tenant-management/-/ng.tenant-management-1.1.1.tgz#b08a9498957f8dd54a2089d7d4cffafb48753508" - integrity sha512-hjs8U+lRA0y2yVa1tVZgm02kxyQdsmyMtzG8ZB76MFJThmMtf3ogrLHRGZ0etgQHe0bmMjkpdC84wS1VtyK5VA== +"@abp/ng.tenant-management@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/ng.tenant-management/-/ng.tenant-management-2.0.1.tgz#182addc7bd800841681e75260173b90ccd88ba07" + integrity sha512-zosVzejfuUG/ZLralkZv860AHxVJ9ScED//ulst8IJG4QWg55pOTgMtHn27HkIb/z45QVWeVAbEENG2SS+ezkQ== dependencies: - "@abp/ng.feature-management" "^1.1.1" - "@abp/ng.tenant-management.config" "^1.1.1" - "@abp/ng.theme.shared" "^1.1.1" + "@abp/ng.feature-management" "^2.0.1" + "@abp/ng.tenant-management.config" "^2.0.1" + "@abp/ng.theme.shared" "^2.0.1" tslib "^1.9.0" -"@abp/ng.theme.basic@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/ng.theme.basic/-/ng.theme.basic-1.1.1.tgz#ee3c3a35f4254a0f727b11bb343ceab3aa975773" - integrity sha512-1z13+H2UhIGDsbsd5uyhuBi3v4lxim1yIECZ3HxFJxIKthHO1wlVb8ka8WrIrxj7JBOl6f9srMCzuCNm2rMGLg== +"@abp/ng.theme.basic@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/ng.theme.basic/-/ng.theme.basic-2.0.1.tgz#af7047dba43b2701ea1d4b9cec8c2bfd52227b1f" + integrity sha512-ExwgzHoyXgtWNhzcs/c2tmZJrJFZQgC0iDC5AWDmOQDf63U2aDujMHiTHRD4lmnB5O5odE9/aN631QnHXj987w== dependencies: - "@abp/ng.theme.shared" "^1.1.1" + "@abp/ng.theme.shared" "^2.0.1" tslib "^1.9.0" -"@abp/ng.theme.shared@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/ng.theme.shared/-/ng.theme.shared-1.1.1.tgz#436b9c909a25cc5722c2a639399d05668a241262" - integrity sha512-eQDrznFKwD63cdO/HPSyGMwIFPmGhv4MAEgITyZkUY76g+owYa/tK+GEjpSqsvQsL//qrHqcG+nwuK9RrCBy+A== +"@abp/ng.theme.shared@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/ng.theme.shared/-/ng.theme.shared-2.0.1.tgz#16dd66f5b54d9b528a22bc48f209b413dc33f52d" + integrity sha512-Yle+dGpYNGMcTEc6/+P1tgKLSgnCkLvG9BfgNdOSFq3vBp5AHj2ip2w2+uX6Svo9Fll8Tth9P6BpRpwvQ3CqwQ== dependencies: - "@abp/ng.core" "^1.1.1" + "@abp/ng.core" "^2.0.1" "@angular/cdk" "^8.2.3" "@fortawesome/fontawesome-free" "^5.11.2" "@ng-bootstrap/ng-bootstrap" "^5.1.4" @@ -119,7 +119,6 @@ bootstrap "^4.3.1" chart.js "^2.9.2" font-awesome "^4.7.0" - ngx-perfect-scrollbar "^8.0.0" primeicons "^2.0.0" primeng "^8.1.1" tslib "^1.9.0" @@ -8488,14 +8487,6 @@ ng-packagr@^5.7.1: terser "^4.1.2" update-notifier "^3.0.0" -ngx-perfect-scrollbar@^8.0.0: - version "8.0.0" - resolved "https://registry.yarnpkg.com/ngx-perfect-scrollbar/-/ngx-perfect-scrollbar-8.0.0.tgz#19c1bbf9b1a36d89b00a68f7834e39427d29182f" - integrity sha512-IXoFbULQnxyJj0gdCcKCLE/6OW9HCP9KARzMCKS1kNxTuzG4DghjM2AaCBRM5/sFwdbn6rqOKMCINtHA8W8YCA== - dependencies: - perfect-scrollbar "^1.4.0" - resize-observer-polyfill "^1.5.0" - ngxs-reset-plugin@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/ngxs-reset-plugin/-/ngxs-reset-plugin-1.2.0.tgz#38dd8363f45cad7410e00ce346a98001241944f8" @@ -9409,11 +9400,6 @@ pbkdf2@^3.0.3: safe-buffer "^5.0.1" sha.js "^2.4.8" -perfect-scrollbar@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/perfect-scrollbar/-/perfect-scrollbar-1.4.0.tgz#5d014ef9775e1f43058a1dbae9ed1daf0e7091f1" - integrity sha512-/2Sk/khljhdrsamjJYS5NjrH+GKEHEwh7zFSiYyxROyYKagkE4kSn2zDQDRTOMo8mpT2jikxx6yI1dG7lNP/hw== - performance-now@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" @@ -10251,11 +10237,6 @@ requires-port@^1.0.0: resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" integrity sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8= -resize-observer-polyfill@^1.5.0: - version "1.5.1" - resolved "https://registry.yarnpkg.com/resize-observer-polyfill/-/resize-observer-polyfill-1.5.1.tgz#0e9020dd3d21024458d4ebd27e23e40269810464" - integrity sha512-LwZrotdHOo12nQuZlHEmtuXdqGoOD0OhaxopaNFxWzInpEgaLWoVuAMbTzixuosCx2nEG58ngzW3vxdWoxIgdg== - resolve-cwd@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/resolve-cwd/-/resolve-cwd-2.0.0.tgz#00a9f7387556e27038eae232caa372a6a59b665a" diff --git a/npm/package.json b/npm/package.json index f8bf5fe835..0dc358279b 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,4 +1,5 @@ { + "version": "2.1.0", "scripts": { "lerna": "lerna", "gulp:app": "node run-gulp-script.js ../templates/app/aspnet-core", @@ -7,11 +8,13 @@ "update:templates": "node abp-package-update-script.js ../templates" }, "devDependencies": { + "@types/fs-extra": "^8.0.1", "glob": "^7.1.5", "lerna": "^3.18.4", "npm-check-updates": "^3.1.25" }, "dependencies": { - "execa": "^3.4.0" + "execa": "^3.4.0", + "fs-extra": "^8.1.0" } } diff --git a/npm/packs/anchor-js/package.json b/npm/packs/anchor-js/package.json index f376a1d718..98c4572723 100644 --- a/npm/packs/anchor-js/package.json +++ b/npm/packs/anchor-js/package.json @@ -1,12 +1,12 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/anchor-js", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/core": "^1.1.1", + "@abp/core": "^2.0.1", "anchor-js": "^4.2.2" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/aspnetcore.mvc.ui.theme.basic/package.json b/npm/packs/aspnetcore.mvc.ui.theme.basic/package.json index 28610d1da2..95161b9b2b 100644 --- a/npm/packs/aspnetcore.mvc.ui.theme.basic/package.json +++ b/npm/packs/aspnetcore.mvc.ui.theme.basic/package.json @@ -1,11 +1,11 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/aspnetcore.mvc.ui.theme.basic", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/aspnetcore.mvc.ui.theme.shared": "^1.1.1" + "@abp/aspnetcore.mvc.ui.theme.shared": "^2.0.1" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/aspnetcore.mvc.ui.theme.shared/package.json b/npm/packs/aspnetcore.mvc.ui.theme.shared/package.json index 399be97a28..7e99b40a89 100644 --- a/npm/packs/aspnetcore.mvc.ui.theme.shared/package.json +++ b/npm/packs/aspnetcore.mvc.ui.theme.shared/package.json @@ -1,24 +1,24 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/aspnetcore.mvc.ui.theme.shared", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/aspnetcore.mvc.ui": "^1.1.1", - "@abp/bootstrap": "^1.1.1", - "@abp/bootstrap-datepicker": "^1.1.1", - "@abp/datatables.net-bs4": "^1.1.1", - "@abp/font-awesome": "^1.1.1", - "@abp/jquery-form": "^1.1.1", - "@abp/jquery-validation-unobtrusive": "^1.1.1", - "@abp/lodash": "^1.1.1", - "@abp/luxon": "^1.1.1", - "@abp/malihu-custom-scrollbar-plugin": "^1.1.1", - "@abp/select2": "^1.1.1", - "@abp/sweetalert": "^1.1.1", - "@abp/timeago": "^1.1.1", - "@abp/toastr": "^1.1.1" + "@abp/aspnetcore.mvc.ui": "^2.0.1", + "@abp/bootstrap": "^2.0.1", + "@abp/bootstrap-datepicker": "^2.0.1", + "@abp/datatables.net-bs4": "^2.0.1", + "@abp/font-awesome": "^2.0.1", + "@abp/jquery-form": "^2.0.1", + "@abp/jquery-validation-unobtrusive": "^2.0.1", + "@abp/lodash": "^2.0.1", + "@abp/luxon": "^2.0.1", + "@abp/malihu-custom-scrollbar-plugin": "^2.0.1", + "@abp/select2": "^2.0.1", + "@abp/sweetalert": "^2.0.1", + "@abp/timeago": "^2.0.1", + "@abp/toastr": "^2.0.1" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/aspnetcore.mvc.ui/package.json b/npm/packs/aspnetcore.mvc.ui/package.json index 2701f22661..f2e702f385 100644 --- a/npm/packs/aspnetcore.mvc.ui/package.json +++ b/npm/packs/aspnetcore.mvc.ui/package.json @@ -1,5 +1,5 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/aspnetcore.mvc.ui", "publishConfig": { "access": "public" @@ -12,5 +12,5 @@ "path": "^0.12.7", "rimraf": "^3.0.0" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/blogging/package.json b/npm/packs/blogging/package.json index 17890549e8..6bc333b0a3 100644 --- a/npm/packs/blogging/package.json +++ b/npm/packs/blogging/package.json @@ -1,13 +1,13 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/blogging", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/aspnetcore.mvc.ui.theme.shared": "^1.1.1", - "@abp/owl.carousel": "^1.1.1", - "@abp/tui-editor": "^1.1.1" + "@abp/aspnetcore.mvc.ui.theme.shared": "^2.0.1", + "@abp/owl.carousel": "^2.0.1", + "@abp/tui-editor": "^2.0.1" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/bootstrap-datepicker/package.json b/npm/packs/bootstrap-datepicker/package.json index 6d3c56f0b0..822d415d9c 100644 --- a/npm/packs/bootstrap-datepicker/package.json +++ b/npm/packs/bootstrap-datepicker/package.json @@ -1,5 +1,5 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/bootstrap-datepicker", "publishConfig": { "access": "public" @@ -7,5 +7,5 @@ "dependencies": { "bootstrap-datepicker": "^1.9.0" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/bootstrap/package.json b/npm/packs/bootstrap/package.json index 9df45d3c42..78ed684187 100644 --- a/npm/packs/bootstrap/package.json +++ b/npm/packs/bootstrap/package.json @@ -1,12 +1,12 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/bootstrap", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/core": "^1.1.1", + "@abp/core": "^2.0.1", "bootstrap": "^4.3.1" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/chart.js/package.json b/npm/packs/chart.js/package.json index 460c8c161d..b1914adccc 100644 --- a/npm/packs/chart.js/package.json +++ b/npm/packs/chart.js/package.json @@ -1,5 +1,5 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/chart.js", "publishConfig": { "access": "public" @@ -7,5 +7,5 @@ "dependencies": { "chart.js": "^2.9.3" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/clipboard/package.json b/npm/packs/clipboard/package.json index c3bdd2a94e..b8564d97de 100644 --- a/npm/packs/clipboard/package.json +++ b/npm/packs/clipboard/package.json @@ -1,12 +1,12 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/clipboard", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/core": "^1.1.1", + "@abp/core": "^2.0.1", "clipboard": "^2.0.4" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/codemirror/package.json b/npm/packs/codemirror/package.json index 87b6c5e58b..cfee638031 100644 --- a/npm/packs/codemirror/package.json +++ b/npm/packs/codemirror/package.json @@ -1,12 +1,12 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/codemirror", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/core": "^1.1.1", + "@abp/core": "^2.0.1", "codemirror": "^5.49.2" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/core/package.json b/npm/packs/core/package.json index f6daa03e49..6453324dd0 100644 --- a/npm/packs/core/package.json +++ b/npm/packs/core/package.json @@ -1,8 +1,8 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/core", "publishConfig": { "access": "public" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/datatables.net-bs4/package.json b/npm/packs/datatables.net-bs4/package.json index eb268338ec..9fbdebeda7 100644 --- a/npm/packs/datatables.net-bs4/package.json +++ b/npm/packs/datatables.net-bs4/package.json @@ -1,12 +1,12 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/datatables.net-bs4", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/datatables.net": "^1.1.1", + "@abp/datatables.net": "^2.0.1", "datatables.net-bs4": "^1.10.20" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/datatables.net/package.json b/npm/packs/datatables.net/package.json index 12249bb984..6ce6d67ea3 100644 --- a/npm/packs/datatables.net/package.json +++ b/npm/packs/datatables.net/package.json @@ -1,12 +1,12 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/datatables.net", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/core": "^1.1.1", + "@abp/core": "^2.0.1", "datatables.net": "^1.10.20" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/docs/package.json b/npm/packs/docs/package.json index 5ab7068fce..7fd061fc94 100644 --- a/npm/packs/docs/package.json +++ b/npm/packs/docs/package.json @@ -1,15 +1,15 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/docs", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/anchor-js": "^1.1.1", - "@abp/clipboard": "^1.1.1", - "@abp/malihu-custom-scrollbar-plugin": "^1.1.1", - "@abp/popper.js": "^1.1.1", - "@abp/prismjs": "^1.1.1" + "@abp/anchor-js": "^2.0.1", + "@abp/clipboard": "^2.0.1", + "@abp/malihu-custom-scrollbar-plugin": "^2.0.1", + "@abp/popper.js": "^2.0.1", + "@abp/prismjs": "^2.0.1" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/flag-icon-css/package.json b/npm/packs/flag-icon-css/package.json index cc53627bcd..08a68f703e 100644 --- a/npm/packs/flag-icon-css/package.json +++ b/npm/packs/flag-icon-css/package.json @@ -1,5 +1,5 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/flag-icon-css", "publishConfig": { "access": "public" @@ -7,5 +7,5 @@ "dependencies": { "flag-icon-css": "^3.4.5" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/font-awesome/package.json b/npm/packs/font-awesome/package.json index 939b16de10..cda6483ff4 100644 --- a/npm/packs/font-awesome/package.json +++ b/npm/packs/font-awesome/package.json @@ -1,12 +1,12 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/font-awesome", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/core": "^1.1.1", + "@abp/core": "^2.0.1", "@fortawesome/fontawesome-free": "^5.11.2" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/highlight.js/package.json b/npm/packs/highlight.js/package.json index 75b58a809d..d37137e0a6 100644 --- a/npm/packs/highlight.js/package.json +++ b/npm/packs/highlight.js/package.json @@ -1,11 +1,11 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/highlight.js", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/core": "^1.1.1" + "@abp/core": "^2.0.1" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/jquery-form/package.json b/npm/packs/jquery-form/package.json index 2601739103..d7209c6b2a 100644 --- a/npm/packs/jquery-form/package.json +++ b/npm/packs/jquery-form/package.json @@ -1,12 +1,12 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/jquery-form", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/jquery": "^1.1.1", + "@abp/jquery": "^2.0.1", "jquery-form": "^4.2.2" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/jquery-validation-unobtrusive/package.json b/npm/packs/jquery-validation-unobtrusive/package.json index 989d3761fd..749e6e033e 100644 --- a/npm/packs/jquery-validation-unobtrusive/package.json +++ b/npm/packs/jquery-validation-unobtrusive/package.json @@ -1,12 +1,12 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/jquery-validation-unobtrusive", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/jquery-validation": "^1.1.1", + "@abp/jquery-validation": "^2.0.1", "jquery-validation-unobtrusive": "^3.2.11" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/jquery-validation/package.json b/npm/packs/jquery-validation/package.json index a9c77623d8..9aa93df7ca 100644 --- a/npm/packs/jquery-validation/package.json +++ b/npm/packs/jquery-validation/package.json @@ -1,12 +1,12 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/jquery-validation", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/jquery": "^1.1.1", + "@abp/jquery": "^2.0.1", "jquery-validation": "^1.19.1" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/jquery/package.json b/npm/packs/jquery/package.json index 4f25863686..5239035cac 100644 --- a/npm/packs/jquery/package.json +++ b/npm/packs/jquery/package.json @@ -1,12 +1,12 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/jquery", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/core": "^1.1.1", + "@abp/core": "^2.0.1", "jquery": "^3.4.1" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/jquery/src/abp.jquery.js b/npm/packs/jquery/src/abp.jquery.js index bf4c920815..76f54df1a0 100644 --- a/npm/packs/jquery/src/abp.jquery.js +++ b/npm/packs/jquery/src/abp.jquery.js @@ -359,13 +359,17 @@ var _loadScript = function (url, loadCallback, failCallback) { _loadFromUrl(url, loadCallback, failCallback, function (urlInfo) { - $.getScript(url) - .done(function () { - urlInfo.succeed(); - }) - .fail(function () { - urlInfo.failed(); - }); + $.get({ + url: url, + dataType: 'text' + }) + .done(function (script) { + $.globalEval(script); + urlInfo.succeed(); + }) + .fail(function () { + urlInfo.failed(); + }); }); }; diff --git a/npm/packs/lodash/package.json b/npm/packs/lodash/package.json index b564805d0c..e53311b8c0 100644 --- a/npm/packs/lodash/package.json +++ b/npm/packs/lodash/package.json @@ -1,12 +1,12 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/lodash", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/core": "^1.1.1", + "@abp/core": "^2.0.1", "lodash": "^4.17.15" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/luxon/package.json b/npm/packs/luxon/package.json index 9d4cd350ad..1d3754724a 100644 --- a/npm/packs/luxon/package.json +++ b/npm/packs/luxon/package.json @@ -1,5 +1,5 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/luxon", "publishConfig": { "access": "public" @@ -7,5 +7,5 @@ "dependencies": { "luxon": "^1.21.3" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/malihu-custom-scrollbar-plugin/package.json b/npm/packs/malihu-custom-scrollbar-plugin/package.json index fc1b413d15..4727381896 100644 --- a/npm/packs/malihu-custom-scrollbar-plugin/package.json +++ b/npm/packs/malihu-custom-scrollbar-plugin/package.json @@ -1,12 +1,12 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/malihu-custom-scrollbar-plugin", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/core": "^1.1.1", + "@abp/core": "^2.0.1", "malihu-custom-scrollbar-plugin": "^3.1.5" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/markdown-it/package.json b/npm/packs/markdown-it/package.json index e06fe91da6..4ebeeb3519 100644 --- a/npm/packs/markdown-it/package.json +++ b/npm/packs/markdown-it/package.json @@ -1,12 +1,12 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/markdown-it", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/core": "^1.1.1", + "@abp/core": "^2.0.1", "markdown-it": "^10.0.0" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/owl.carousel/package.json b/npm/packs/owl.carousel/package.json index 5db205c8f6..7e26cdd205 100644 --- a/npm/packs/owl.carousel/package.json +++ b/npm/packs/owl.carousel/package.json @@ -1,12 +1,12 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/owl.carousel", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/core": "^1.1.1", + "@abp/core": "^2.0.1", "owl.carousel": "^2.3.4" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/popper.js/package.json b/npm/packs/popper.js/package.json index 24a7edc81e..a7434fa3bd 100644 --- a/npm/packs/popper.js/package.json +++ b/npm/packs/popper.js/package.json @@ -1,12 +1,12 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/popper.js", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/core": "^1.1.1", + "@abp/core": "^2.0.1", "popper.js": "^1.16.0" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/prismjs/package.json b/npm/packs/prismjs/package.json index cb55e2b086..0ccb07b681 100644 --- a/npm/packs/prismjs/package.json +++ b/npm/packs/prismjs/package.json @@ -1,12 +1,12 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/prismjs", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/core": "^1.1.1", + "@abp/core": "^2.0.1", "prismjs": "^1.17.1" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/select2/package.json b/npm/packs/select2/package.json index c5185cfa0c..1917c0b14c 100644 --- a/npm/packs/select2/package.json +++ b/npm/packs/select2/package.json @@ -1,12 +1,12 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/select2", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/core": "^1.1.1", + "@abp/core": "^2.0.1", "select2": "^4.0.12" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/sweetalert/package.json b/npm/packs/sweetalert/package.json index e0a0708034..c0886e9e2d 100644 --- a/npm/packs/sweetalert/package.json +++ b/npm/packs/sweetalert/package.json @@ -1,12 +1,12 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/sweetalert", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/core": "^1.1.1", + "@abp/core": "^2.0.1", "sweetalert": "^2.1.2" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/timeago/package.json b/npm/packs/timeago/package.json index d7369d6777..df888fb187 100644 --- a/npm/packs/timeago/package.json +++ b/npm/packs/timeago/package.json @@ -1,12 +1,12 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/timeago", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/jquery": "^1.1.1", + "@abp/jquery": "^2.0.1", "timeago": "^1.6.7" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/toastr/package.json b/npm/packs/toastr/package.json index 00456bbd3e..1abd064435 100644 --- a/npm/packs/toastr/package.json +++ b/npm/packs/toastr/package.json @@ -1,12 +1,12 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/toastr", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/jquery": "^1.1.1", + "@abp/jquery": "^2.0.1", "toastr": "^2.1.4" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/packs/tui-editor/package.json b/npm/packs/tui-editor/package.json index 579718be01..e2956027a2 100644 --- a/npm/packs/tui-editor/package.json +++ b/npm/packs/tui-editor/package.json @@ -1,15 +1,15 @@ { - "version": "1.1.1", + "version": "2.0.1", "name": "@abp/tui-editor", "publishConfig": { "access": "public" }, "dependencies": { - "@abp/codemirror": "^1.1.1", - "@abp/highlight.js": "^1.1.1", - "@abp/jquery": "^1.1.1", - "@abp/markdown-it": "^1.1.1", + "@abp/codemirror": "^2.0.1", + "@abp/highlight.js": "^2.0.1", + "@abp/jquery": "^2.0.1", + "@abp/markdown-it": "^2.0.1", "tui-editor": "^1.4.8" }, - "gitHead": "b926d7a3fed6365550493ec00bdfe9da9dd6c541" + "gitHead": "b7064633947fe074ee60eab4f9bf3237acbc5246" } diff --git a/npm/preview-publish.ps1 b/npm/preview-publish.ps1 new file mode 100644 index 0000000000..d448378750 --- /dev/null +++ b/npm/preview-publish.ps1 @@ -0,0 +1,30 @@ +param( + [string]$Version +) + +npm install + +$NextVersion = $(node get-version.js) + '-preview' + (Get-Date).tostring(“yyyyMMdd”) + '-1' +$rootFolder = (Get-Item -Path "./" -Verbose).FullName + +if(-Not $Version) { +$Version = $NextVersion; +} + +$commands = ( + "cd ng-packs\scripts", + "npm install", + "npm run publish-packages -- --nextVersion $Version --preview", + "cd ../../", + "yarn lerna publish $Version --no-push --yes --no-git-reset --no-commit-hooks --no-git-tag-version --force-publish --dist-tag preview" +) + +foreach ($command in $commands) { + Write-Host $command + Invoke-Expression $command + if($LASTEXITCODE -ne '0' -And $command -notlike '*cd *'){ + Write-Host ("Process failed! " + $command) + Set-Location $rootFolder + exit $LASTEXITCODE + } +} \ No newline at end of file diff --git a/npm/publish.ps1 b/npm/publish.ps1 index 7552eb0505..a510527401 100644 --- a/npm/publish.ps1 +++ b/npm/publish.ps1 @@ -2,19 +2,20 @@ param( [string]$Version ) -if(-Not $Version) { -echo 'Please pass a semantic version like this: ./publish.ps1 -Version patch' -exit -} +npm install +$NextVersion = $(node get-version.js) $rootFolder = (Get-Item -Path "./" -Verbose).FullName +if(-Not $Version) { + $Version = $NextVersion; +} + $commands = ( "cd ng-packs\scripts", "npm install", - "npm run publish-packages -- $Version", + "npm run publish-packages -- --nextVersion $Version", "cd ../../", - "yarn", "yarn lerna publish $Version --no-push --yes --no-git-reset --no-commit-hooks --no-git-tag-version --force-publish", "yarn update:templates", "yarn gulp:app", diff --git a/npm/yarn.lock b/npm/yarn.lock index e0af7da193..b331d5ff22 100644 --- a/npm/yarn.lock +++ b/npm/yarn.lock @@ -832,6 +832,13 @@ resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7" integrity sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g== +"@types/fs-extra@^8.0.1": + version "8.0.1" + resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-8.0.1.tgz#a2378d6e7e8afea1564e44aafa2e207dadf77686" + integrity sha512-J00cVDALmi/hJOYsunyT52Hva5TnJeKP5yd1r+mH/ZU0mbYZflR0Z5kw5kITtKTRYMhm1JMClOFYdHnQszEvqw== + dependencies: + "@types/node" "*" + "@types/glob@^7.1.1": version "7.1.1" resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.1.tgz#aa59a1c6e3fbc421e07ccd31a944c30eba521575" @@ -1609,6 +1616,15 @@ cross-spawn@^6.0.0: shebang-command "^1.2.0" which "^1.2.9" +cross-spawn@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.1.tgz#0ab56286e0f7c24e153d04cc2aa027e43a9a5d14" + integrity sha512-u7v4o84SwFpD32Z8IIcPZ6z1/ie24O6RU3RbtL5Y316l3KuHVPx9ItBgWQ6VlfAFnRnTtMUrsQ9MUUTuEZjogg== + dependencies: + path-key "^3.1.0" + shebang-command "^2.0.0" + which "^2.0.1" + crypto-random-string@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/crypto-random-string/-/crypto-random-string-1.0.0.tgz#a230f64f568310e1498009940790ec99545bca7e" @@ -1930,6 +1946,22 @@ execa@^1.0.0: signal-exit "^3.0.0" strip-eof "^1.0.0" +execa@^3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-3.4.0.tgz#c08ed4550ef65d858fac269ffc8572446f37eb89" + integrity sha512-r9vdGQk4bmCuK1yKQu1KTwcT2zwfWdbdaXfCtAh+5nU/4fSX+JAb7vZGvI5naJrQlvONrEB20jeruESI69530g== + dependencies: + cross-spawn "^7.0.0" + get-stream "^5.0.0" + human-signals "^1.1.1" + is-stream "^2.0.0" + merge-stream "^2.0.0" + npm-run-path "^4.0.0" + onetime "^5.1.0" + p-finally "^2.0.0" + signal-exit "^3.0.2" + strip-final-newline "^2.0.0" + expand-brackets@^2.1.4: version "2.1.4" resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" @@ -2207,7 +2239,7 @@ get-stream@^4.0.0, get-stream@^4.1.0: dependencies: pump "^3.0.0" -get-stream@^5.1.0: +get-stream@^5.0.0, get-stream@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.1.0.tgz#01203cdc92597f9b909067c3e656cc1f4d3c4dc9" integrity sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw== @@ -2510,6 +2542,11 @@ https-proxy-agent@^2.2.1: agent-base "^4.3.0" debug "^3.1.0" +human-signals@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3" + integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw== + humanize-ms@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed" @@ -2837,6 +2874,11 @@ is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" +is-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" + integrity sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw== + is-symbol@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.2.tgz#a055f6ae57192caee329e7a860118b497a950f38" @@ -3280,6 +3322,11 @@ meow@^4.0.0: redent "^2.0.0" trim-newlines "^2.0.0" +merge-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" + integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== + merge2@^1.2.3: version "1.3.0" resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.3.0.tgz#5b366ee83b2f1582c48f87e47cf1a9352103ca81" @@ -3320,6 +3367,11 @@ mimic-fn@^1.0.0: version "1.2.0" resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-1.2.0.tgz#820c86a39334640e99516928bd03fca88057d022" +mimic-fn@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" + integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== + mimic-response@^1.0.0, mimic-response@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-1.0.1.tgz#4923538878eef42063cb8a3e3b0798781487ab1b" @@ -3654,6 +3706,13 @@ npm-run-path@^2.0.0: dependencies: path-key "^2.0.0" +npm-run-path@^4.0.0: + version "4.0.1" + resolved "https://registry.yarnpkg.com/npm-run-path/-/npm-run-path-4.0.1.tgz#b7ecd1e5ed53da8e37a55e1c2269e0b97ed748ea" + integrity sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw== + dependencies: + path-key "^3.0.0" + "npmlog@0 || 1 || 2 || 3 || 4", npmlog@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.1.2.tgz#08a7f2a8bf734604779a9efa4ad5cc717abb954b" @@ -3734,6 +3793,13 @@ onetime@^2.0.0: dependencies: mimic-fn "^1.0.0" +onetime@^5.1.0: + version "5.1.0" + resolved "https://registry.yarnpkg.com/onetime/-/onetime-5.1.0.tgz#fff0f3c91617fe62bb50189636e99ac8a6df7be5" + integrity sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q== + dependencies: + mimic-fn "^2.1.0" + optimist@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/optimist/-/optimist-0.6.1.tgz#da3ea74686fa21a19a111c326e90eb15a0196686" @@ -3775,6 +3841,11 @@ p-finally@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-1.0.0.tgz#3fbcfb15b899a44123b34b6dcc18b724336a2cae" +p-finally@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/p-finally/-/p-finally-2.0.1.tgz#bd6fcaa9c559a096b680806f4d657b3f0f240561" + integrity sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw== + p-limit@^1.1.0: version "1.3.0" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-1.3.0.tgz#b86bd5f0c25690911c7590fcbfc2010d54b3ccb8" @@ -3979,6 +4050,11 @@ path-key@^2.0.0, path-key@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/path-key/-/path-key-2.0.1.tgz#411cadb574c5a140d3a4b1910d40d80cc9f40b40" +path-key@^3.0.0, path-key@^3.1.0: + version "3.1.1" + resolved "https://registry.yarnpkg.com/path-key/-/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375" + integrity sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q== + path-parse@^1.0.5, path-parse@^1.0.6: version "1.0.6" resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.6.tgz#d62dbb5679405d72c4737ec58600e9ddcf06d24c" @@ -4531,10 +4607,22 @@ shebang-command@^1.2.0: dependencies: shebang-regex "^1.0.0" +shebang-command@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea" + integrity sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA== + dependencies: + shebang-regex "^3.0.0" + shebang-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-1.0.0.tgz#da42f49740c0b42db2ca9728571cb190c98efea3" +shebang-regex@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/shebang-regex/-/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172" + integrity sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A== + signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d" @@ -4821,6 +4909,11 @@ strip-eof@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/strip-eof/-/strip-eof-1.0.0.tgz#bb43ff5598a6eb05d89b59fcd129c983313606bf" +strip-final-newline@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/strip-final-newline/-/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad" + integrity sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA== + strip-indent@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-1.0.1.tgz#0c7962a6adefa7bbd4ac366460a638552ae1a0a2" @@ -5207,6 +5300,13 @@ which@1, which@^1.2.9, which@^1.3.1: dependencies: isexe "^2.0.0" +which@^2.0.1: + version "2.0.2" + resolved "https://registry.yarnpkg.com/which/-/which-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1" + integrity sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA== + dependencies: + isexe "^2.0.0" + wide-align@^1.1.0: version "1.1.3" resolved "https://registry.yarnpkg.com/wide-align/-/wide-align-1.1.3.tgz#ae074e6bdc0c14a431e804e624549c633b000457" diff --git a/nupkg/common.ps1 b/nupkg/common.ps1 index eeac13eac8..a582f8c115 100644 --- a/nupkg/common.ps1 +++ b/nupkg/common.ps1 @@ -40,6 +40,7 @@ $projects = ( "framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic", "framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared", "framework/src/Volo.Abp.AspNetCore.Mvc.UI.Widgets", + "framework/src/Volo.Abp.AspNetCore.Serilog", "framework/src/Volo.Abp.AspNetCore.TestBase", "framework/src/Volo.Abp.Auditing", "framework/src/Volo.Abp.Authorization", diff --git a/samples/BasicConsoleApplication/AbpConsoleDemo/AbpConsoleDemo.csproj b/samples/BasicConsoleApplication/AbpConsoleDemo/AbpConsoleDemo.csproj index c3c4e39fd8..9e20015c9f 100644 --- a/samples/BasicConsoleApplication/AbpConsoleDemo/AbpConsoleDemo.csproj +++ b/samples/BasicConsoleApplication/AbpConsoleDemo/AbpConsoleDemo.csproj @@ -1,4 +1,4 @@ - + Exe @@ -7,6 +7,7 @@ + diff --git a/samples/BasicConsoleApplication/AbpConsoleDemo/AppHostedService.cs b/samples/BasicConsoleApplication/AbpConsoleDemo/AppHostedService.cs new file mode 100644 index 0000000000..578c437177 --- /dev/null +++ b/samples/BasicConsoleApplication/AbpConsoleDemo/AppHostedService.cs @@ -0,0 +1,32 @@ +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Volo.Abp; + +namespace AbpConsoleDemo +{ + public class AppHostedService : IHostedService + { + public Task StartAsync(CancellationToken cancellationToken) + { + using (var application = AbpApplicationFactory.Create(options => + { + options.UseAutofac(); //Autofac integration + })) + { + application.Initialize(); + + //Resolve a service and use it + var helloWorldService = application.ServiceProvider.GetService(); + helloWorldService.SayHello(); + + application.Shutdown(); + } + + return Task.CompletedTask; + } + + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; + } +} diff --git a/samples/BasicConsoleApplication/AbpConsoleDemo/Program.cs b/samples/BasicConsoleApplication/AbpConsoleDemo/Program.cs index 651fda3c4f..2c8791f656 100644 --- a/samples/BasicConsoleApplication/AbpConsoleDemo/Program.cs +++ b/samples/BasicConsoleApplication/AbpConsoleDemo/Program.cs @@ -1,28 +1,21 @@ -using System; +using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp; +using Microsoft.Extensions.Hosting; namespace AbpConsoleDemo { class Program { - static void Main(string[] args) + static async Task Main(string[] args) { - using (var application = AbpApplicationFactory.Create(options => - { - options.UseAutofac(); //Autofac integration - })) - { - application.Initialize(); - - //Resolve a service and use it - var helloWorldService = - application.ServiceProvider.GetService(); - helloWorldService.SayHello(); - - Console.WriteLine("Press ENTER to stop application..."); - Console.ReadLine(); - } + await CreateHostBuilder(args).RunConsoleAsync(); } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureServices((hostContext, services) => + { + services.AddHostedService(); + }); } } diff --git a/samples/BookStore-Angular-MongoDb/angular/src/app/shared/shared.module.ts b/samples/BookStore-Angular-MongoDb/angular/src/app/shared/shared.module.ts index 6bae4ea332..6c4c9b016c 100644 --- a/samples/BookStore-Angular-MongoDb/angular/src/app/shared/shared.module.ts +++ b/samples/BookStore-Angular-MongoDb/angular/src/app/shared/shared.module.ts @@ -4,11 +4,26 @@ import { NgModule } from '@angular/core'; import { ThemeBasicModule } from '@abp/ng.theme.basic'; import { ThemeSharedModule } from '@abp/ng.theme.shared'; import { TableModule } from 'primeng/table'; +import { NgxValidateCoreModule } from '@ngx-validate/core'; @NgModule({ declarations: [], - imports: [CoreModule, ThemeSharedModule, ThemeBasicModule, TableModule, NgbDropdownModule], - exports: [CoreModule, ThemeSharedModule, ThemeBasicModule, TableModule, NgbDropdownModule], + imports: [ + CoreModule, + ThemeSharedModule, + ThemeBasicModule, + TableModule, + NgbDropdownModule, + NgxValidateCoreModule, + ], + exports: [ + CoreModule, + ThemeSharedModule, + ThemeBasicModule, + TableModule, + NgbDropdownModule, + NgxValidateCoreModule, + ], providers: [], }) export class SharedModule {} diff --git a/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.DbMigrator/DbMigratorHostedService.cs b/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.DbMigrator/DbMigratorHostedService.cs new file mode 100644 index 0000000000..aef3d88bb5 --- /dev/null +++ b/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.DbMigrator/DbMigratorHostedService.cs @@ -0,0 +1,34 @@ +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Acme.BookStore.Data; +using Serilog; +using Volo.Abp; + +namespace Acme.BookStore.DbMigrator +{ + public class DbMigratorHostedService : IHostedService + { + public async Task StartAsync(CancellationToken cancellationToken) + { + using (var application = AbpApplicationFactory.Create(options => + { + options.UseAutofac(); + options.Services.AddLogging(c => c.AddSerilog()); + })) + { + application.Initialize(); + + await application + .ServiceProvider + .GetRequiredService() + .MigrateAsync(); + + application.Shutdown(); + } + } + + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; + } +} diff --git a/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.DbMigrator/Program.cs b/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.DbMigrator/Program.cs index d3c4034c8a..179c18f4ca 100644 --- a/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.DbMigrator/Program.cs +++ b/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.DbMigrator/Program.cs @@ -1,39 +1,15 @@ -using System.IO; +using System.IO; +using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; -using Acme.BookStore.Data; +using Microsoft.Extensions.Hosting; using Serilog; using Serilog.Events; -using Volo.Abp; -using Volo.Abp.Threading; namespace Acme.BookStore.DbMigrator { class Program { - static void Main(string[] args) - { - ConfigureLogging(); - - using (var application = AbpApplicationFactory.Create(options => - { - options.UseAutofac(); - options.Services.AddLogging(c => c.AddSerilog()); - })) - { - application.Initialize(); - - AsyncHelper.RunSync( - () => application - .ServiceProvider - .GetRequiredService() - .MigrateAsync() - ); - - application.Shutdown(); - } - } - - private static void ConfigureLogging() + static async Task Main(string[] args) { Log.Logger = new LoggerConfiguration() .MinimumLevel.Information() @@ -48,6 +24,15 @@ namespace Acme.BookStore.DbMigrator .WriteTo.File(Path.Combine(Directory.GetCurrentDirectory(), "Logs/logs.txt")) .WriteTo.Console() .CreateLogger(); + + await CreateHostBuilder(args).RunConsoleAsync(); } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureServices((hostContext, services) => + { + services.AddHostedService(); + }); } } diff --git a/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.Domain.Shared/Acme.BookStore.Domain.Shared.csproj b/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.Domain.Shared/Acme.BookStore.Domain.Shared.csproj index acc9b5d652..432792f1b0 100644 --- a/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.Domain.Shared/Acme.BookStore.Domain.Shared.csproj +++ b/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.Domain.Shared/Acme.BookStore.Domain.Shared.csproj @@ -23,4 +23,4 @@ - \ No newline at end of file + diff --git a/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs b/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs index 95241feeb8..6ac58cef9e 100644 --- a/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs +++ b/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs @@ -5,7 +5,7 @@ using Volo.Abp.FeatureManagement; using Volo.Abp.Identity; using Volo.Abp.IdentityServer; using Volo.Abp.Localization; -using Volo.Abp.Localization.Resources.AbpValidation; +using Volo.Abp.Validation.Localization; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement; using Volo.Abp.SettingManagement; diff --git a/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.Domain.Shared/Localization/BookStore/zh-Hans.json b/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.Domain.Shared/Localization/BookStore/zh-Hans.json index 459fc0fefd..23790bde50 100644 --- a/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.Domain.Shared/Localization/BookStore/zh-Hans.json +++ b/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.Domain.Shared/Localization/BookStore/zh-Hans.json @@ -3,6 +3,6 @@ "texts": { "Menu:Home": "首页", "Welcome": "欢迎", - "LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 cn.abp.io." + "LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 abp.io." } } \ No newline at end of file diff --git a/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.HttpApi.Host/Acme.BookStore.HttpApi.Host.csproj b/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.HttpApi.Host/Acme.BookStore.HttpApi.Host.csproj index 46638e1958..0afb022b3e 100644 --- a/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.HttpApi.Host/Acme.BookStore.HttpApi.Host.csproj +++ b/samples/BookStore-Angular-MongoDb/aspnet-core/src/Acme.BookStore.HttpApi.Host/Acme.BookStore.HttpApi.Host.csproj @@ -1,4 +1,4 @@ - + @@ -10,10 +10,10 @@ - + - + diff --git a/samples/BookStore-Angular-MongoDb/aspnet-core/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs b/samples/BookStore-Angular-MongoDb/aspnet-core/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs new file mode 100644 index 0000000000..e41ee7ed31 --- /dev/null +++ b/samples/BookStore-Angular-MongoDb/aspnet-core/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs @@ -0,0 +1,26 @@ +using Microsoft.Extensions.Hosting; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; + +namespace Acme.BookStore.HttpApi.Client.ConsoleTestApp +{ + public class ConsoleTestAppHostedService : IHostedService + { + public async Task StartAsync(CancellationToken cancellationToken) + { + using (var application = AbpApplicationFactory.Create()) + { + application.Initialize(); + + var demo = application.ServiceProvider.GetRequiredService(); + await demo.RunAsync(); + + application.Shutdown(); + } + } + + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; + } +} diff --git a/samples/BookStore-Angular-MongoDb/aspnet-core/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Program.cs b/samples/BookStore-Angular-MongoDb/aspnet-core/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Program.cs index ecef29d963..7d8265158b 100644 --- a/samples/BookStore-Angular-MongoDb/aspnet-core/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Program.cs +++ b/samples/BookStore-Angular-MongoDb/aspnet-core/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Program.cs @@ -1,24 +1,21 @@ -using System; +using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp; -using Volo.Abp.Threading; +using Microsoft.Extensions.Hosting; namespace Acme.BookStore.HttpApi.Client.ConsoleTestApp { class Program { - static void Main(string[] args) + static async Task Main(string[] args) { - using (var application = AbpApplicationFactory.Create()) - { - application.Initialize(); - - var demo = application.ServiceProvider.GetRequiredService(); - AsyncHelper.RunSync(() => demo.RunAsync()); - - Console.WriteLine("Press ENTER to stop application..."); - Console.ReadLine(); - } + await CreateHostBuilder(args).RunConsoleAsync(); } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureServices((hostContext, services) => + { + services.AddHostedService(); + }); } } diff --git a/samples/BookStore-Angular-MongoDb/aspnet-core/test/Acme.BookStore.TestBase/BookStoreTestBase.cs b/samples/BookStore-Angular-MongoDb/aspnet-core/test/Acme.BookStore.TestBase/BookStoreTestBase.cs index 0f44532e7a..9bf254bf5b 100644 --- a/samples/BookStore-Angular-MongoDb/aspnet-core/test/Acme.BookStore.TestBase/BookStoreTestBase.cs +++ b/samples/BookStore-Angular-MongoDb/aspnet-core/test/Acme.BookStore.TestBase/BookStoreTestBase.cs @@ -18,26 +18,6 @@ namespace Acme.BookStore options.UseAutofac(); } - protected virtual void WithUnitOfWork(Action action) - { - WithUnitOfWork(new AbpUnitOfWorkOptions(), action); - } - - protected virtual void WithUnitOfWork(AbpUnitOfWorkOptions options, Action action) - { - using (var scope = ServiceProvider.CreateScope()) - { - var uowManager = scope.ServiceProvider.GetRequiredService(); - - using (var uow = uowManager.Begin(options)) - { - action(); - - uow.Complete(); - } - } - } - protected virtual Task WithUnitOfWorkAsync(Func func) { return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); @@ -57,27 +37,7 @@ namespace Acme.BookStore } } } - - protected virtual TResult WithUnitOfWork(Func func) - { - return WithUnitOfWork(new AbpUnitOfWorkOptions(), func); - } - - protected virtual TResult WithUnitOfWork(AbpUnitOfWorkOptions options, Func func) - { - using (var scope = ServiceProvider.CreateScope()) - { - var uowManager = scope.ServiceProvider.GetRequiredService(); - - using (var uow = uowManager.Begin(options)) - { - var result = func(); - uow.Complete(); - return result; - } - } - } - + protected virtual Task WithUnitOfWorkAsync(Func> func) { return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); diff --git a/samples/BookStore-Modular/application/src/Acme.BookStore.DbMigrator/DbMigratorHostedService.cs b/samples/BookStore-Modular/application/src/Acme.BookStore.DbMigrator/DbMigratorHostedService.cs new file mode 100644 index 0000000000..aef3d88bb5 --- /dev/null +++ b/samples/BookStore-Modular/application/src/Acme.BookStore.DbMigrator/DbMigratorHostedService.cs @@ -0,0 +1,34 @@ +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Acme.BookStore.Data; +using Serilog; +using Volo.Abp; + +namespace Acme.BookStore.DbMigrator +{ + public class DbMigratorHostedService : IHostedService + { + public async Task StartAsync(CancellationToken cancellationToken) + { + using (var application = AbpApplicationFactory.Create(options => + { + options.UseAutofac(); + options.Services.AddLogging(c => c.AddSerilog()); + })) + { + application.Initialize(); + + await application + .ServiceProvider + .GetRequiredService() + .MigrateAsync(); + + application.Shutdown(); + } + } + + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; + } +} diff --git a/samples/BookStore-Modular/application/src/Acme.BookStore.DbMigrator/Program.cs b/samples/BookStore-Modular/application/src/Acme.BookStore.DbMigrator/Program.cs index d3c4034c8a..179c18f4ca 100644 --- a/samples/BookStore-Modular/application/src/Acme.BookStore.DbMigrator/Program.cs +++ b/samples/BookStore-Modular/application/src/Acme.BookStore.DbMigrator/Program.cs @@ -1,39 +1,15 @@ -using System.IO; +using System.IO; +using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; -using Acme.BookStore.Data; +using Microsoft.Extensions.Hosting; using Serilog; using Serilog.Events; -using Volo.Abp; -using Volo.Abp.Threading; namespace Acme.BookStore.DbMigrator { class Program { - static void Main(string[] args) - { - ConfigureLogging(); - - using (var application = AbpApplicationFactory.Create(options => - { - options.UseAutofac(); - options.Services.AddLogging(c => c.AddSerilog()); - })) - { - application.Initialize(); - - AsyncHelper.RunSync( - () => application - .ServiceProvider - .GetRequiredService() - .MigrateAsync() - ); - - application.Shutdown(); - } - } - - private static void ConfigureLogging() + static async Task Main(string[] args) { Log.Logger = new LoggerConfiguration() .MinimumLevel.Information() @@ -48,6 +24,15 @@ namespace Acme.BookStore.DbMigrator .WriteTo.File(Path.Combine(Directory.GetCurrentDirectory(), "Logs/logs.txt")) .WriteTo.Console() .CreateLogger(); + + await CreateHostBuilder(args).RunConsoleAsync(); } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureServices((hostContext, services) => + { + services.AddHostedService(); + }); } } diff --git a/samples/BookStore-Modular/application/src/Acme.BookStore.Domain.Shared/Acme.BookStore.Domain.Shared.csproj b/samples/BookStore-Modular/application/src/Acme.BookStore.Domain.Shared/Acme.BookStore.Domain.Shared.csproj index d0d0942a4a..cd65444d65 100644 --- a/samples/BookStore-Modular/application/src/Acme.BookStore.Domain.Shared/Acme.BookStore.Domain.Shared.csproj +++ b/samples/BookStore-Modular/application/src/Acme.BookStore.Domain.Shared/Acme.BookStore.Domain.Shared.csproj @@ -24,4 +24,4 @@ - \ No newline at end of file + diff --git a/samples/BookStore-Modular/application/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs b/samples/BookStore-Modular/application/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs index 8d6172ee28..188a73118f 100644 --- a/samples/BookStore-Modular/application/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs +++ b/samples/BookStore-Modular/application/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs @@ -6,7 +6,7 @@ using Volo.Abp.FeatureManagement; using Volo.Abp.Identity; using Volo.Abp.IdentityServer; using Volo.Abp.Localization; -using Volo.Abp.Localization.Resources.AbpValidation; +using Volo.Abp.Validation.Localization; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement; using Volo.Abp.SettingManagement; diff --git a/samples/BookStore-Modular/application/src/Acme.BookStore.Domain.Shared/Localization/BookStore/zh-Hans.json b/samples/BookStore-Modular/application/src/Acme.BookStore.Domain.Shared/Localization/BookStore/zh-Hans.json index 459fc0fefd..23790bde50 100644 --- a/samples/BookStore-Modular/application/src/Acme.BookStore.Domain.Shared/Localization/BookStore/zh-Hans.json +++ b/samples/BookStore-Modular/application/src/Acme.BookStore.Domain.Shared/Localization/BookStore/zh-Hans.json @@ -3,6 +3,6 @@ "texts": { "Menu:Home": "首页", "Welcome": "欢迎", - "LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 cn.abp.io." + "LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 abp.io." } } \ No newline at end of file diff --git a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20191018080014_Created_Book_Entity.Designer.cs b/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106083302_Initial.Designer.cs similarity index 97% rename from samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20191018080014_Created_Book_Entity.Designer.cs rename to samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106083302_Initial.Designer.cs index 3c433dbd58..f1c515923e 100644 --- a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20191018080014_Created_Book_Entity.Designer.cs +++ b/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106083302_Initial.Designer.cs @@ -10,67 +10,17 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace Acme.BookStore.Migrations { [DbContext(typeof(BookStoreMigrationsDbContext))] - [Migration("20191018080014_Created_Book_Entity")] - partial class Created_Book_Entity + [Migration("20200106083302_Initial")] + partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0") + .HasAnnotation("ProductVersion", "3.1.0") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - modelBuilder.Entity("Acme.BookStore.Book", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("Price") - .HasColumnType("real"); - - b.Property("PublishDate") - .HasColumnType("datetime2"); - - b.Property("Type") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.ToTable("AppBooks"); - }); - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { b.Property("Id") @@ -562,6 +512,7 @@ namespace Acme.BookStore.Migrations .HasColumnType("datetime2"); b.Property("Email") + .IsRequired() .HasColumnName("Email") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -605,6 +556,7 @@ namespace Acme.BookStore.Migrations .HasMaxLength(64); b.Property("NormalizedEmail") + .IsRequired() .HasColumnName("NormalizedEmail") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -1247,6 +1199,70 @@ namespace Acme.BookStore.Migrations b.ToTable("IdentityServerClientSecrets"); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Data") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(50000); + + b.Property("DeviceCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Expiration") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("SubjectId") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("UserCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.HasIndex("UserCode") + .IsUnique(); + + b.ToTable("IdentityServerDeviceFlowCodes"); + }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") @@ -1503,8 +1519,7 @@ namespace Acme.BookStore.Migrations b.HasKey("Id"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("Name"); b.ToTable("AbpTenants"); }); diff --git a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20191018075950_Initial.cs b/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106083302_Initial.cs similarity index 96% rename from samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20191018075950_Initial.cs rename to samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106083302_Initial.cs index cc04cddbf2..de6dd334dd 100644 --- a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20191018075950_Initial.cs +++ b/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106083302_Initial.cs @@ -184,8 +184,8 @@ namespace Acme.BookStore.Migrations NormalizedUserName = table.Column(maxLength: 256, nullable: false), Name = table.Column(maxLength: 64, nullable: true), Surname = table.Column(maxLength: 64, nullable: true), - Email = table.Column(maxLength: 256, nullable: true), - NormalizedEmail = table.Column(maxLength: 256, nullable: true), + Email = table.Column(maxLength: 256, nullable: false), + NormalizedEmail = table.Column(maxLength: 256, nullable: false), EmailConfirmed = table.Column(nullable: false, defaultValue: false), PasswordHash = table.Column(maxLength: 256, nullable: true), SecurityStamp = table.Column(maxLength: 256, nullable: false), @@ -283,6 +283,27 @@ namespace Acme.BookStore.Migrations table.PrimaryKey("PK_IdentityServerClients", x => x.Id); }); + migrationBuilder.CreateTable( + name: "IdentityServerDeviceFlowCodes", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + DeviceCode = table.Column(maxLength: 200, nullable: false), + UserCode = table.Column(maxLength: 200, nullable: false), + SubjectId = table.Column(maxLength: 200, nullable: true), + ClientId = table.Column(maxLength: 200, nullable: false), + Expiration = table.Column(nullable: false), + Data = table.Column(maxLength: 50000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerDeviceFlowCodes", x => x.Id); + }); + migrationBuilder.CreateTable( name: "IdentityServerIdentityResources", columns: table => new @@ -866,8 +887,7 @@ namespace Acme.BookStore.Migrations migrationBuilder.CreateIndex( name: "IX_AbpTenants_Name", table: "AbpTenants", - column: "Name", - unique: true); + column: "Name"); migrationBuilder.CreateIndex( name: "IX_AbpUserClaims_UserId", @@ -909,6 +929,23 @@ namespace Acme.BookStore.Migrations table: "IdentityServerClients", column: "ClientId"); + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_DeviceCode", + table: "IdentityServerDeviceFlowCodes", + column: "DeviceCode", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_Expiration", + table: "IdentityServerDeviceFlowCodes", + column: "Expiration"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_UserCode", + table: "IdentityServerDeviceFlowCodes", + column: "UserCode", + unique: true); + migrationBuilder.CreateIndex( name: "IX_IdentityServerPersistedGrants_Expiration", table: "IdentityServerPersistedGrants", @@ -997,6 +1034,9 @@ namespace Acme.BookStore.Migrations migrationBuilder.DropTable( name: "IdentityServerClientSecrets"); + migrationBuilder.DropTable( + name: "IdentityServerDeviceFlowCodes"); + migrationBuilder.DropTable( name: "IdentityServerIdentityClaims"); diff --git a/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106083327_Added_Book_Entity.Designer.cs b/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106083327_Added_Book_Entity.Designer.cs new file mode 100644 index 0000000000..fd3a713e5d --- /dev/null +++ b/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106083327_Added_Book_Entity.Designer.cs @@ -0,0 +1,1811 @@ +// +using System; +using Acme.BookStore.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace Acme.BookStore.Migrations +{ + [DbContext(typeof(BookStoreMigrationsDbContext))] + [Migration("20200106083327_Added_Book_Entity")] + partial class Added_Book_Entity + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Acme.BookStore.BookManagement.Books.Book", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("Price") + .HasColumnType("real"); + + b.Property("PublishDate") + .HasColumnType("datetime2"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("BmBooks"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ApplicationName") + .HasColumnName("ApplicationName") + .HasColumnType("nvarchar(96)") + .HasMaxLength(96); + + b.Property("BrowserInfo") + .HasColumnName("BrowserInfo") + .HasColumnType("nvarchar(512)") + .HasMaxLength(512); + + b.Property("ClientId") + .HasColumnName("ClientId") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ClientIpAddress") + .HasColumnName("ClientIpAddress") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ClientName") + .HasColumnName("ClientName") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("Comments") + .HasColumnName("Comments") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CorrelationId") + .HasColumnName("CorrelationId") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("Exceptions") + .HasColumnName("Exceptions") + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); + + b.Property("ExecutionDuration") + .HasColumnName("ExecutionDuration") + .HasColumnType("int"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("HttpMethod") + .HasColumnName("HttpMethod") + .HasColumnType("nvarchar(16)") + .HasMaxLength(16); + + b.Property("HttpStatusCode") + .HasColumnName("HttpStatusCode") + .HasColumnType("int"); + + b.Property("ImpersonatorTenantId") + .HasColumnName("ImpersonatorTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("ImpersonatorUserId") + .HasColumnName("ImpersonatorUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantName") + .HasColumnType("nvarchar(max)"); + + b.Property("Url") + .HasColumnName("Url") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("UserId") + .HasColumnName("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserName") + .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ExecutionTime"); + + b.HasIndex("TenantId", "UserId", "ExecutionTime"); + + b.ToTable("AbpAuditLogs"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnName("AuditLogId") + .HasColumnType("uniqueidentifier"); + + b.Property("ExecutionDuration") + .HasColumnName("ExecutionDuration") + .HasColumnType("int"); + + b.Property("ExecutionTime") + .HasColumnName("ExecutionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("MethodName") + .HasColumnName("MethodName") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("Parameters") + .HasColumnName("Parameters") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.Property("ServiceName") + .HasColumnName("ServiceName") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); + + b.ToTable("AbpAuditLogActions"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnName("AuditLogId") + .HasColumnType("uniqueidentifier"); + + b.Property("ChangeTime") + .HasColumnName("ChangeTime") + .HasColumnType("datetime2"); + + b.Property("ChangeType") + .HasColumnName("ChangeType") + .HasColumnType("tinyint"); + + b.Property("EntityId") + .IsRequired() + .HasColumnName("EntityId") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("EntityTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("EntityTypeFullName") + .IsRequired() + .HasColumnName("EntityTypeFullName") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); + + b.ToTable("AbpEntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EntityChangeId") + .HasColumnType("uniqueidentifier"); + + b.Property("NewValue") + .HasColumnName("NewValue") + .HasColumnType("nvarchar(512)") + .HasMaxLength(512); + + b.Property("OriginalValue") + .HasColumnName("OriginalValue") + .HasColumnType("nvarchar(512)") + .HasMaxLength(512); + + b.Property("PropertyName") + .IsRequired() + .HasColumnName("PropertyName") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("PropertyTypeFullName") + .IsRequired() + .HasColumnName("PropertyTypeFullName") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("EntityChangeId"); + + b.ToTable("AbpEntityPropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsAbandoned") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("JobArgs") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(1048576); + + b.Property("JobName") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("LastTryTime") + .HasColumnType("datetime2"); + + b.Property("NextTryTime") + .HasColumnType("datetime2"); + + b.Property("Priority") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint") + .HasDefaultValue((byte)15); + + b.Property("TryCount") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((short)0); + + b.HasKey("Id"); + + b.HasIndex("IsAbandoned", "NextTryTime"); + + b.ToTable("AbpBackgroundJobs"); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("ProviderKey") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ProviderName") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpFeatureValues"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("Description") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsStatic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("Regex") + .HasColumnType("nvarchar(512)") + .HasMaxLength(512); + + b.Property("RegexDescription") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("Required") + .HasColumnType("bit"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDefault") + .HasColumnName("IsDefault") + .HasColumnType("bit"); + + b.Property("IsPublic") + .HasColumnName("IsPublic") + .HasColumnType("bit"); + + b.Property("IsStatic") + .HasColumnName("IsStatic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("NormalizedName") + .IsRequired() + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") + .HasMaxLength(1024); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AbpRoleClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AccessFailedCount") + .ValueGeneratedOnAdd() + .HasColumnName("AccessFailedCount") + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("Email") + .IsRequired() + .HasColumnName("Email") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnName("EmailConfirmed") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("LockoutEnabled") + .ValueGeneratedOnAdd() + .HasColumnName("LockoutEnabled") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("Name") + .HasColumnName("Name") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("NormalizedEmail") + .IsRequired() + .HasColumnName("NormalizedEmail") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("NormalizedUserName") + .IsRequired() + .HasColumnName("NormalizedUserName") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("PasswordHash") + .HasColumnName("PasswordHash") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("PhoneNumber") + .HasColumnName("PhoneNumber") + .HasColumnType("nvarchar(16)") + .HasMaxLength(16); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnName("PhoneNumberConfirmed") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("SecurityStamp") + .IsRequired() + .HasColumnName("SecurityStamp") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("Surname") + .HasColumnName("Surname") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("TwoFactorEnabled") + .ValueGeneratedOnAdd() + .HasColumnName("TwoFactorEnabled") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("UserName") + .IsRequired() + .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("NormalizedEmail"); + + b.HasIndex("NormalizedUserName"); + + b.HasIndex("UserName"); + + b.ToTable("AbpUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") + .HasMaxLength(1024); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("ProviderKey") + .IsRequired() + .HasColumnType("nvarchar(196)") + .HasMaxLength(196); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("UserId", "LoginProvider"); + + b.HasIndex("LoginProvider", "ProviderKey"); + + b.ToTable("AbpUserLogins"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId", "UserId"); + + b.ToTable("AbpUserRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("Name") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AbpUserTokens"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); + + b.Property("DisplayName") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Properties") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("IdentityServerApiResources"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("ApiResourceId", "Type"); + + b.ToTable("IdentityServerApiClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Description") + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); + + b.Property("DisplayName") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Emphasize") + .HasColumnType("bit"); + + b.Property("Required") + .HasColumnType("bit"); + + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); + + b.HasKey("ApiResourceId", "Name"); + + b.ToTable("IdentityServerApiScopes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Type") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("ApiResourceId", "Name", "Type"); + + b.ToTable("IdentityServerApiScopeClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); + + b.Property("Description") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.Property("Expiration") + .HasColumnType("datetime2"); + + b.HasKey("ApiResourceId", "Type", "Value"); + + b.ToTable("IdentityServerApiSecrets"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AbsoluteRefreshTokenLifetime") + .HasColumnType("int"); + + b.Property("AccessTokenLifetime") + .HasColumnType("int"); + + b.Property("AccessTokenType") + .HasColumnType("int"); + + b.Property("AllowAccessTokensViaBrowser") + .HasColumnType("bit"); + + b.Property("AllowOfflineAccess") + .HasColumnType("bit"); + + b.Property("AllowPlainTextPkce") + .HasColumnType("bit"); + + b.Property("AllowRememberConsent") + .HasColumnType("bit"); + + b.Property("AlwaysIncludeUserClaimsInIdToken") + .HasColumnType("bit"); + + b.Property("AlwaysSendClientClaims") + .HasColumnType("bit"); + + b.Property("AuthorizationCodeLifetime") + .HasColumnType("int"); + + b.Property("BackChannelLogoutSessionRequired") + .HasColumnType("bit"); + + b.Property("BackChannelLogoutUri") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.Property("ClientClaimsPrefix") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ClientName") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ClientUri") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("ConsentLifetime") + .HasColumnType("int"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); + + b.Property("DeviceCodeLifetime") + .HasColumnType("int"); + + b.Property("EnableLocalLogin") + .HasColumnType("bit"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("FrontChannelLogoutSessionRequired") + .HasColumnType("bit"); + + b.Property("FrontChannelLogoutUri") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.Property("IdentityTokenLifetime") + .HasColumnType("int"); + + b.Property("IncludeJwtId") + .HasColumnType("bit"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("LogoUri") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.Property("PairWiseSubjectSalt") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ProtocolType") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("RefreshTokenExpiration") + .HasColumnType("int"); + + b.Property("RefreshTokenUsage") + .HasColumnType("int"); + + b.Property("RequireClientSecret") + .HasColumnType("bit"); + + b.Property("RequireConsent") + .HasColumnType("bit"); + + b.Property("RequirePkce") + .HasColumnType("bit"); + + b.Property("SlidingRefreshTokenLifetime") + .HasColumnType("int"); + + b.Property("UpdateAccessTokenClaimsOnRefresh") + .HasColumnType("bit"); + + b.Property("UserCodeType") + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); + + b.Property("UserSsoLifetime") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.ToTable("IdentityServerClients"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.HasKey("ClientId", "Type", "Value"); + + b.ToTable("IdentityServerClientClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Origin") + .HasColumnType("nvarchar(150)") + .HasMaxLength(150); + + b.HasKey("ClientId", "Origin"); + + b.ToTable("IdentityServerClientCorsOrigins"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("GrantType") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.HasKey("ClientId", "GrantType"); + + b.ToTable("IdentityServerClientGrantTypes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Provider") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("ClientId", "Provider"); + + b.ToTable("IdentityServerClientIdPRestrictions"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("PostLogoutRedirectUri") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.HasKey("ClientId", "PostLogoutRedirectUri"); + + b.ToTable("IdentityServerClientPostLogoutRedirectUris"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Key") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.HasKey("ClientId", "Key"); + + b.ToTable("IdentityServerClientProperties"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("RedirectUri") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.HasKey("ClientId", "RedirectUri"); + + b.ToTable("IdentityServerClientRedirectUris"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Scope") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("ClientId", "Scope"); + + b.ToTable("IdentityServerClientScopes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); + + b.Property("Description") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.Property("Expiration") + .HasColumnType("datetime2"); + + b.HasKey("ClientId", "Type", "Value"); + + b.ToTable("IdentityServerClientSecrets"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Data") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(50000); + + b.Property("DeviceCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Expiration") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("SubjectId") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("UserCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.HasIndex("UserCode") + .IsUnique(); + + b.ToTable("IdentityServerDeviceFlowCodes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => + { + b.Property("Key") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("Data") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(50000); + + b.Property("Expiration") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectId") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Type") + .IsRequired() + .HasColumnType("nvarchar(50)") + .HasMaxLength(50); + + b.HasKey("Key"); + + b.HasIndex("Expiration"); + + b.HasIndex("SubjectId", "ClientId", "Type"); + + b.ToTable("IdentityServerPersistedGrants"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => + { + b.Property("IdentityResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("IdentityResourceId", "Type"); + + b.ToTable("IdentityServerIdentityClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); + + b.Property("DisplayName") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Emphasize") + .HasColumnType("bit"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Properties") + .HasColumnType("nvarchar(max)"); + + b.Property("Required") + .HasColumnType("bit"); + + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.ToTable("IdentityServerIdentityResources"); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("ProviderKey") + .IsRequired() + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ProviderName") + .IsRequired() + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpPermissionGrants"); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("ProviderKey") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ProviderName") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(2048)") + .HasMaxLength(2048); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpSettings"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AbpTenants"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(1024)") + .HasMaxLength(1024); + + b.HasKey("TenantId", "Name"); + + b.ToTable("AbpTenantConnectionStrings"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("Actions") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("EntityChanges") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) + .WithMany("PropertyChanges") + .HasForeignKey("EntityChangeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany("Claims") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Claims") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Logins") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Roles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Tokens") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("UserClaims") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("Scopes") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope", null) + .WithMany("UserClaims") + .HasForeignKey("ApiResourceId", "Name") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("Secrets") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("Claims") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("AllowedCorsOrigins") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("AllowedGrantTypes") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("IdentityProviderRestrictions") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("PostLogoutRedirectUris") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("Properties") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("RedirectUris") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("AllowedScopes") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("ClientSecrets") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) + .WithMany("UserClaims") + .HasForeignKey("IdentityResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.HasOne("Volo.Abp.TenantManagement.Tenant", null) + .WithMany("ConnectionStrings") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20191018081734_Added_Book_Entity.cs b/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106083327_Added_Book_Entity.cs similarity index 100% rename from samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20191018081734_Added_Book_Entity.cs rename to samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106083327_Added_Book_Entity.cs diff --git a/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/BookStoreMigrationsDbContextModelSnapshot.cs b/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/BookStoreMigrationsDbContextModelSnapshot.cs index 0577f0d399..4848f244de 100644 --- a/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/BookStoreMigrationsDbContextModelSnapshot.cs +++ b/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/BookStoreMigrationsDbContextModelSnapshot.cs @@ -15,7 +15,7 @@ namespace Acme.BookStore.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0") + .HasAnnotation("ProductVersion", "3.1.0") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); @@ -560,6 +560,7 @@ namespace Acme.BookStore.Migrations .HasColumnType("datetime2"); b.Property("Email") + .IsRequired() .HasColumnName("Email") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -603,6 +604,7 @@ namespace Acme.BookStore.Migrations .HasMaxLength(64); b.Property("NormalizedEmail") + .IsRequired() .HasColumnName("NormalizedEmail") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -1245,6 +1247,70 @@ namespace Acme.BookStore.Migrations b.ToTable("IdentityServerClientSecrets"); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Data") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(50000); + + b.Property("DeviceCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Expiration") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("SubjectId") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("UserCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.HasIndex("UserCode") + .IsUnique(); + + b.ToTable("IdentityServerDeviceFlowCodes"); + }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") @@ -1501,8 +1567,7 @@ namespace Acme.BookStore.Migrations b.HasKey("Id"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("Name"); b.ToTable("AbpTenants"); }); diff --git a/samples/BookStore-Modular/application/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj b/samples/BookStore-Modular/application/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj index b71bc65d91..d378f9ff00 100644 --- a/samples/BookStore-Modular/application/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj +++ b/samples/BookStore-Modular/application/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj @@ -1,4 +1,4 @@ - + @@ -32,10 +32,10 @@ - + - + diff --git a/samples/BookStore-Modular/application/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs b/samples/BookStore-Modular/application/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs new file mode 100644 index 0000000000..e41ee7ed31 --- /dev/null +++ b/samples/BookStore-Modular/application/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs @@ -0,0 +1,26 @@ +using Microsoft.Extensions.Hosting; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; + +namespace Acme.BookStore.HttpApi.Client.ConsoleTestApp +{ + public class ConsoleTestAppHostedService : IHostedService + { + public async Task StartAsync(CancellationToken cancellationToken) + { + using (var application = AbpApplicationFactory.Create()) + { + application.Initialize(); + + var demo = application.ServiceProvider.GetRequiredService(); + await demo.RunAsync(); + + application.Shutdown(); + } + } + + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; + } +} diff --git a/samples/BookStore-Modular/application/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Program.cs b/samples/BookStore-Modular/application/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Program.cs index ecef29d963..7d8265158b 100644 --- a/samples/BookStore-Modular/application/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Program.cs +++ b/samples/BookStore-Modular/application/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Program.cs @@ -1,24 +1,21 @@ -using System; +using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp; -using Volo.Abp.Threading; +using Microsoft.Extensions.Hosting; namespace Acme.BookStore.HttpApi.Client.ConsoleTestApp { class Program { - static void Main(string[] args) + static async Task Main(string[] args) { - using (var application = AbpApplicationFactory.Create()) - { - application.Initialize(); - - var demo = application.ServiceProvider.GetRequiredService(); - AsyncHelper.RunSync(() => demo.RunAsync()); - - Console.WriteLine("Press ENTER to stop application..."); - Console.ReadLine(); - } + await CreateHostBuilder(args).RunConsoleAsync(); } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureServices((hostContext, services) => + { + services.AddHostedService(); + }); } } diff --git a/samples/BookStore-Modular/application/test/Acme.BookStore.TestBase/BookStoreTestBase.cs b/samples/BookStore-Modular/application/test/Acme.BookStore.TestBase/BookStoreTestBase.cs index 0f44532e7a..979c344f93 100644 --- a/samples/BookStore-Modular/application/test/Acme.BookStore.TestBase/BookStoreTestBase.cs +++ b/samples/BookStore-Modular/application/test/Acme.BookStore.TestBase/BookStoreTestBase.cs @@ -18,26 +18,6 @@ namespace Acme.BookStore options.UseAutofac(); } - protected virtual void WithUnitOfWork(Action action) - { - WithUnitOfWork(new AbpUnitOfWorkOptions(), action); - } - - protected virtual void WithUnitOfWork(AbpUnitOfWorkOptions options, Action action) - { - using (var scope = ServiceProvider.CreateScope()) - { - var uowManager = scope.ServiceProvider.GetRequiredService(); - - using (var uow = uowManager.Begin(options)) - { - action(); - - uow.Complete(); - } - } - } - protected virtual Task WithUnitOfWorkAsync(Func func) { return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); @@ -58,26 +38,6 @@ namespace Acme.BookStore } } - protected virtual TResult WithUnitOfWork(Func func) - { - return WithUnitOfWork(new AbpUnitOfWorkOptions(), func); - } - - protected virtual TResult WithUnitOfWork(AbpUnitOfWorkOptions options, Func func) - { - using (var scope = ServiceProvider.CreateScope()) - { - var uowManager = scope.ServiceProvider.GetRequiredService(); - - using (var uow = uowManager.Begin(options)) - { - var result = func(); - uow.Complete(); - return result; - } - } - } - protected virtual Task WithUnitOfWorkAsync(Func> func) { return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); diff --git a/samples/BookStore-Modular/application/test/Acme.BookStore.Web.Tests/BookStoreWebTestModule.cs b/samples/BookStore-Modular/application/test/Acme.BookStore.Web.Tests/BookStoreWebTestModule.cs index b9d79b1baa..d92f3bbfcf 100644 --- a/samples/BookStore-Modular/application/test/Acme.BookStore.Web.Tests/BookStoreWebTestModule.cs +++ b/samples/BookStore-Modular/application/test/Acme.BookStore.Web.Tests/BookStoreWebTestModule.cs @@ -12,7 +12,7 @@ using Acme.BookStore.Web.Menus; using Volo.Abp; using Volo.Abp.AspNetCore.TestBase; using Volo.Abp.Localization; -using Volo.Abp.Localization.Resources.AbpValidation; +using Volo.Abp.Validation.Localization; using Volo.Abp.Modularity; using Volo.Abp.UI.Navigation; diff --git a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.HttpApi.Host/Acme.BookStore.BookManagement.HttpApi.Host.csproj b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.HttpApi.Host/Acme.BookStore.BookManagement.HttpApi.Host.csproj index db35047e19..60c2276bb4 100644 --- a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.HttpApi.Host/Acme.BookStore.BookManagement.HttpApi.Host.csproj +++ b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.HttpApi.Host/Acme.BookStore.BookManagement.HttpApi.Host.csproj @@ -1,4 +1,4 @@ - + @@ -10,9 +10,9 @@ - + - + diff --git a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/Acme.BookStore.BookManagement.IdentityServer.csproj b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/Acme.BookStore.BookManagement.IdentityServer.csproj index c0eebd425a..c0b6996719 100644 --- a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/Acme.BookStore.BookManagement.IdentityServer.csproj +++ b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/Acme.BookStore.BookManagement.IdentityServer.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -8,9 +8,9 @@ - + - + diff --git a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/Migrations/20191018081038_Initial.Designer.cs b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/Migrations/20191018081038_Initial.Designer.cs deleted file mode 100644 index 0e8868dd77..0000000000 --- a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/Migrations/20191018081038_Initial.Designer.cs +++ /dev/null @@ -1,1610 +0,0 @@ -// -using System; -using Acme.BookStore.BookManagement.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -namespace Acme.BookStore.BookManagement.Migrations -{ - [DbContext(typeof(IdentityServerHostMigrationsDbContext))] - [Migration("20191018081038_Initial")] - partial class Initial - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "3.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ApplicationName") - .HasColumnName("ApplicationName") - .HasColumnType("nvarchar(96)") - .HasMaxLength(96); - - b.Property("BrowserInfo") - .HasColumnName("BrowserInfo") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); - - b.Property("ClientId") - .HasColumnName("ClientId") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ClientIpAddress") - .HasColumnName("ClientIpAddress") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ClientName") - .HasColumnName("ClientName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("Comments") - .HasColumnName("Comments") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("CorrelationId") - .HasColumnName("CorrelationId") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("Exceptions") - .HasColumnName("Exceptions") - .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); - - b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration") - .HasColumnType("int"); - - b.Property("ExecutionTime") - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("HttpMethod") - .HasColumnName("HttpMethod") - .HasColumnType("nvarchar(16)") - .HasMaxLength(16); - - b.Property("HttpStatusCode") - .HasColumnName("HttpStatusCode") - .HasColumnType("int"); - - b.Property("ImpersonatorTenantId") - .HasColumnName("ImpersonatorTenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("ImpersonatorUserId") - .HasColumnName("ImpersonatorUserId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantName") - .HasColumnType("nvarchar(max)"); - - b.Property("Url") - .HasColumnName("Url") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("UserId") - .HasColumnName("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserName") - .HasColumnName("UserName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.HasKey("Id"); - - b.HasIndex("TenantId", "ExecutionTime"); - - b.HasIndex("TenantId", "UserId", "ExecutionTime"); - - b.ToTable("AbpAuditLogs"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AuditLogId") - .HasColumnName("AuditLogId") - .HasColumnType("uniqueidentifier"); - - b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration") - .HasColumnType("int"); - - b.Property("ExecutionTime") - .HasColumnName("ExecutionTime") - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("MethodName") - .HasColumnName("MethodName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("Parameters") - .HasColumnName("Parameters") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("ServiceName") - .HasColumnName("ServiceName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AuditLogId"); - - b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); - - b.ToTable("AbpAuditLogActions"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AuditLogId") - .HasColumnName("AuditLogId") - .HasColumnType("uniqueidentifier"); - - b.Property("ChangeTime") - .HasColumnName("ChangeTime") - .HasColumnType("datetime2"); - - b.Property("ChangeType") - .HasColumnName("ChangeType") - .HasColumnType("tinyint"); - - b.Property("EntityId") - .IsRequired() - .HasColumnName("EntityId") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("EntityTenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("EntityTypeFullName") - .IsRequired() - .HasColumnName("EntityTypeFullName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("AuditLogId"); - - b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); - - b.ToTable("AbpEntityChanges"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("EntityChangeId") - .HasColumnType("uniqueidentifier"); - - b.Property("NewValue") - .HasColumnName("NewValue") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); - - b.Property("OriginalValue") - .HasColumnName("OriginalValue") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); - - b.Property("PropertyName") - .IsRequired() - .HasColumnName("PropertyName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("PropertyTypeFullName") - .IsRequired() - .HasColumnName("PropertyTypeFullName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("EntityChangeId"); - - b.ToTable("AbpEntityPropertyChanges"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("Description") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsStatic") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("Regex") - .HasColumnType("nvarchar(512)") - .HasMaxLength(512); - - b.Property("RegexDescription") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("Required") - .HasColumnType("bit"); - - b.Property("ValueType") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.ToTable("AbpClaimTypes"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .IsRequired() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDefault") - .HasColumnName("IsDefault") - .HasColumnType("bit"); - - b.Property("IsPublic") - .HasColumnName("IsPublic") - .HasColumnType("bit"); - - b.Property("IsStatic") - .HasColumnName("IsStatic") - .HasColumnType("bit"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("NormalizedName") - .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName"); - - b.ToTable("AbpRoles"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ClaimType") - .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("AbpRoleClaims"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AccessFailedCount") - .ValueGeneratedOnAdd() - .HasColumnName("AccessFailedCount") - .HasColumnType("int") - .HasDefaultValue(0); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); - - b.Property("Email") - .HasColumnName("Email") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("EmailConfirmed") - .ValueGeneratedOnAdd() - .HasColumnName("EmailConfirmed") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("LockoutEnabled") - .ValueGeneratedOnAdd() - .HasColumnName("LockoutEnabled") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LockoutEnd") - .HasColumnType("datetimeoffset"); - - b.Property("Name") - .HasColumnName("Name") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("NormalizedEmail") - .HasColumnName("NormalizedEmail") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("NormalizedUserName") - .IsRequired() - .HasColumnName("NormalizedUserName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("PasswordHash") - .HasColumnName("PasswordHash") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("PhoneNumber") - .HasColumnName("PhoneNumber") - .HasColumnType("nvarchar(16)") - .HasMaxLength(16); - - b.Property("PhoneNumberConfirmed") - .ValueGeneratedOnAdd() - .HasColumnName("PhoneNumberConfirmed") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("SecurityStamp") - .IsRequired() - .HasColumnName("SecurityStamp") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("Surname") - .HasColumnName("Surname") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("TenantId") - .HasColumnName("TenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("TwoFactorEnabled") - .ValueGeneratedOnAdd() - .HasColumnName("TwoFactorEnabled") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("UserName") - .IsRequired() - .HasColumnName("UserName") - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.HasKey("Id"); - - b.HasIndex("Email"); - - b.HasIndex("NormalizedEmail"); - - b.HasIndex("NormalizedUserName"); - - b.HasIndex("UserName"); - - b.ToTable("AbpUsers"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("ClaimType") - .IsRequired() - .HasColumnType("nvarchar(256)") - .HasMaxLength(256); - - b.Property("ClaimValue") - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); - - b.Property("TenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("AbpUserClaims"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ProviderDisplayName") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ProviderKey") - .IsRequired() - .HasColumnType("nvarchar(196)") - .HasMaxLength(196); - - b.Property("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "LoginProvider"); - - b.HasIndex("LoginProvider", "ProviderKey"); - - b.ToTable("AbpUserLogins"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.Property("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId", "UserId"); - - b.ToTable("AbpUserRoles"); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("uniqueidentifier"); - - b.Property("LoginProvider") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("Name") - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("TenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("Value") - .HasColumnType("nvarchar(max)"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("AbpUserTokens"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); - - b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Enabled") - .HasColumnType("bit"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Properties") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("IdentityServerApiResources"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => - { - b.Property("ApiResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("ApiResourceId", "Type"); - - b.ToTable("IdentityServerApiClaims"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => - { - b.Property("ApiResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); - - b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Emphasize") - .HasColumnType("bit"); - - b.Property("Required") - .HasColumnType("bit"); - - b.Property("ShowInDiscoveryDocument") - .HasColumnType("bit"); - - b.HasKey("ApiResourceId", "Name"); - - b.ToTable("IdentityServerApiScopes"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => - { - b.Property("ApiResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("ApiResourceId", "Name", "Type"); - - b.ToTable("IdentityServerApiScopeClaims"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => - { - b.Property("ApiResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.Property("Value") - .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); - - b.Property("Description") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("Expiration") - .HasColumnType("datetime2"); - - b.HasKey("ApiResourceId", "Type", "Value"); - - b.ToTable("IdentityServerApiSecrets"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("AbsoluteRefreshTokenLifetime") - .HasColumnType("int"); - - b.Property("AccessTokenLifetime") - .HasColumnType("int"); - - b.Property("AccessTokenType") - .HasColumnType("int"); - - b.Property("AllowAccessTokensViaBrowser") - .HasColumnType("bit"); - - b.Property("AllowOfflineAccess") - .HasColumnType("bit"); - - b.Property("AllowPlainTextPkce") - .HasColumnType("bit"); - - b.Property("AllowRememberConsent") - .HasColumnType("bit"); - - b.Property("AlwaysIncludeUserClaimsInIdToken") - .HasColumnType("bit"); - - b.Property("AlwaysSendClientClaims") - .HasColumnType("bit"); - - b.Property("AuthorizationCodeLifetime") - .HasColumnType("int"); - - b.Property("BackChannelLogoutSessionRequired") - .HasColumnType("bit"); - - b.Property("BackChannelLogoutUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("ClientClaimsPrefix") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ClientId") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ClientName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ClientUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("ConsentLifetime") - .HasColumnType("int"); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); - - b.Property("DeviceCodeLifetime") - .HasColumnType("int"); - - b.Property("EnableLocalLogin") - .HasColumnType("bit"); - - b.Property("Enabled") - .HasColumnType("bit"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("FrontChannelLogoutSessionRequired") - .HasColumnType("bit"); - - b.Property("FrontChannelLogoutUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("IdentityTokenLifetime") - .HasColumnType("int"); - - b.Property("IncludeJwtId") - .HasColumnType("bit"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("LogoUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("PairWiseSubjectSalt") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ProtocolType") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("RefreshTokenExpiration") - .HasColumnType("int"); - - b.Property("RefreshTokenUsage") - .HasColumnType("int"); - - b.Property("RequireClientSecret") - .HasColumnType("bit"); - - b.Property("RequireConsent") - .HasColumnType("bit"); - - b.Property("RequirePkce") - .HasColumnType("bit"); - - b.Property("SlidingRefreshTokenLifetime") - .HasColumnType("int"); - - b.Property("UpdateAccessTokenClaimsOnRefresh") - .HasColumnType("bit"); - - b.Property("UserCodeType") - .HasColumnType("nvarchar(100)") - .HasMaxLength(100); - - b.Property("UserSsoLifetime") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.HasIndex("ClientId"); - - b.ToTable("IdentityServerClients"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.Property("Value") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.HasKey("ClientId", "Type", "Value"); - - b.ToTable("IdentityServerClientClaims"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("Origin") - .HasColumnType("nvarchar(150)") - .HasMaxLength(150); - - b.HasKey("ClientId", "Origin"); - - b.ToTable("IdentityServerClientCorsOrigins"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("GrantType") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.HasKey("ClientId", "GrantType"); - - b.ToTable("IdentityServerClientGrantTypes"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("Provider") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("ClientId", "Provider"); - - b.ToTable("IdentityServerClientIdPRestrictions"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("PostLogoutRedirectUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.HasKey("ClientId", "PostLogoutRedirectUri"); - - b.ToTable("IdentityServerClientPostLogoutRedirectUris"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("Key") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.Property("Value") - .IsRequired() - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.HasKey("ClientId", "Key"); - - b.ToTable("IdentityServerClientProperties"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("RedirectUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.HasKey("ClientId", "RedirectUri"); - - b.ToTable("IdentityServerClientRedirectUris"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("Scope") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("ClientId", "Scope"); - - b.ToTable("IdentityServerClientScopes"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.Property("Value") - .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); - - b.Property("Description") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("Expiration") - .HasColumnType("datetime2"); - - b.HasKey("ClientId", "Type", "Value"); - - b.ToTable("IdentityServerClientSecrets"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => - { - b.Property("Key") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ClientId") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("CreationTime") - .HasColumnType("datetime2"); - - b.Property("Data") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasMaxLength(50000); - - b.Property("Expiration") - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("SubjectId") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Type") - .IsRequired() - .HasColumnType("nvarchar(50)") - .HasMaxLength(50); - - b.HasKey("Key"); - - b.HasIndex("Expiration"); - - b.HasIndex("SubjectId", "ClientId", "Type"); - - b.ToTable("IdentityServerPersistedGrants"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => - { - b.Property("IdentityResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("IdentityResourceId", "Type"); - - b.ToTable("IdentityServerIdentityClaims"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); - - b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Emphasize") - .HasColumnType("bit"); - - b.Property("Enabled") - .HasColumnType("bit"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Properties") - .HasColumnType("nvarchar(max)"); - - b.Property("Required") - .HasColumnType("bit"); - - b.Property("ShowInDiscoveryDocument") - .HasColumnType("bit"); - - b.HasKey("Id"); - - b.ToTable("IdentityServerIdentityResources"); - }); - - modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ProviderKey") - .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ProviderName") - .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("Name", "ProviderName", "ProviderKey"); - - b.ToTable("AbpPermissionGrants"); - }); - - modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ProviderName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("Value") - .IsRequired() - .HasColumnType("nvarchar(2048)") - .HasMaxLength(2048); - - b.HasKey("Id"); - - b.HasIndex("Name", "ProviderName", "ProviderKey"); - - b.ToTable("AbpSettings"); - }); - - modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique(); - - b.ToTable("AbpTenants"); - }); - - modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => - { - b.Property("TenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("Value") - .IsRequired() - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); - - b.HasKey("TenantId", "Name"); - - b.ToTable("AbpTenantConnectionStrings"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => - { - b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) - .WithMany("Actions") - .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => - { - b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) - .WithMany("EntityChanges") - .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => - { - b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) - .WithMany("PropertyChanges") - .HasForeignKey("EntityChangeId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => - { - b.HasOne("Volo.Abp.Identity.IdentityRole", null) - .WithMany("Claims") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => - { - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Claims") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => - { - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Logins") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => - { - b.HasOne("Volo.Abp.Identity.IdentityRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Roles") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => - { - b.HasOne("Volo.Abp.Identity.IdentityUser", null) - .WithMany("Tokens") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => - { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) - .WithMany("UserClaims") - .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => - { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) - .WithMany("Scopes") - .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => - { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope", null) - .WithMany("UserClaims") - .HasForeignKey("ApiResourceId", "Name") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => - { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) - .WithMany("Secrets") - .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("Claims") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("AllowedCorsOrigins") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("AllowedGrantTypes") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("IdentityProviderRestrictions") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("PostLogoutRedirectUris") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("Properties") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("RedirectUris") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("AllowedScopes") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("ClientSecrets") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => - { - b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) - .WithMany("UserClaims") - .HasForeignKey("IdentityResourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => - { - b.HasOne("Volo.Abp.TenantManagement.Tenant", null) - .WithMany("ConnectionStrings") - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/Migrations/20191018081038_Initial.cs b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/Migrations/20191018081038_Initial.cs deleted file mode 100644 index 5fea609471..0000000000 --- a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/Migrations/20191018081038_Initial.cs +++ /dev/null @@ -1,982 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace Acme.BookStore.BookManagement.Migrations -{ - public partial class Initial : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AbpAuditLogs", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(nullable: true), - ApplicationName = table.Column(maxLength: 96, nullable: true), - UserId = table.Column(nullable: true), - UserName = table.Column(maxLength: 256, nullable: true), - TenantId = table.Column(nullable: true), - TenantName = table.Column(nullable: true), - ImpersonatorUserId = table.Column(nullable: true), - ImpersonatorTenantId = table.Column(nullable: true), - ExecutionTime = table.Column(nullable: false), - ExecutionDuration = table.Column(nullable: false), - ClientIpAddress = table.Column(maxLength: 64, nullable: true), - ClientName = table.Column(maxLength: 128, nullable: true), - ClientId = table.Column(maxLength: 64, nullable: true), - CorrelationId = table.Column(maxLength: 64, nullable: true), - BrowserInfo = table.Column(maxLength: 512, nullable: true), - HttpMethod = table.Column(maxLength: 16, nullable: true), - Url = table.Column(maxLength: 256, nullable: true), - Exceptions = table.Column(maxLength: 4000, nullable: true), - Comments = table.Column(maxLength: 256, nullable: true), - HttpStatusCode = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpAuditLogs", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpClaimTypes", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 256, nullable: false), - Name = table.Column(maxLength: 256, nullable: false), - Required = table.Column(nullable: false), - IsStatic = table.Column(nullable: false), - Regex = table.Column(maxLength: 512, nullable: true), - RegexDescription = table.Column(maxLength: 128, nullable: true), - Description = table.Column(maxLength: 256, nullable: true), - ValueType = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpClaimTypes", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpPermissionGrants", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - Name = table.Column(maxLength: 128, nullable: false), - ProviderName = table.Column(maxLength: 64, nullable: false), - ProviderKey = table.Column(maxLength: 64, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpPermissionGrants", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpRoles", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 256, nullable: false), - TenantId = table.Column(nullable: true), - Name = table.Column(maxLength: 256, nullable: false), - NormalizedName = table.Column(maxLength: 256, nullable: false), - IsDefault = table.Column(nullable: false), - IsStatic = table.Column(nullable: false), - IsPublic = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpRoles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpSettings", - columns: table => new - { - Id = table.Column(nullable: false), - Name = table.Column(maxLength: 128, nullable: false), - Value = table.Column(maxLength: 2048, nullable: false), - ProviderName = table.Column(maxLength: 64, nullable: true), - ProviderKey = table.Column(maxLength: 64, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpSettings", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpTenants", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - Name = table.Column(maxLength: 64, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpTenants", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpUsers", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - TenantId = table.Column(nullable: true), - UserName = table.Column(maxLength: 256, nullable: false), - NormalizedUserName = table.Column(maxLength: 256, nullable: false), - Name = table.Column(maxLength: 64, nullable: true), - Surname = table.Column(maxLength: 64, nullable: true), - Email = table.Column(maxLength: 256, nullable: true), - NormalizedEmail = table.Column(maxLength: 256, nullable: true), - EmailConfirmed = table.Column(nullable: false, defaultValue: false), - PasswordHash = table.Column(maxLength: 256, nullable: true), - SecurityStamp = table.Column(maxLength: 256, nullable: false), - PhoneNumber = table.Column(maxLength: 16, nullable: true), - PhoneNumberConfirmed = table.Column(nullable: false, defaultValue: false), - TwoFactorEnabled = table.Column(nullable: false, defaultValue: false), - LockoutEnd = table.Column(nullable: true), - LockoutEnabled = table.Column(nullable: false, defaultValue: false), - AccessFailedCount = table.Column(nullable: false, defaultValue: 0) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpUsers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerApiResources", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Enabled = table.Column(nullable: false), - Properties = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiResources", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClients", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - ClientId = table.Column(maxLength: 200, nullable: false), - ClientName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - ClientUri = table.Column(maxLength: 2000, nullable: true), - LogoUri = table.Column(maxLength: 2000, nullable: true), - Enabled = table.Column(nullable: false), - ProtocolType = table.Column(maxLength: 200, nullable: false), - RequireClientSecret = table.Column(nullable: false), - RequireConsent = table.Column(nullable: false), - AllowRememberConsent = table.Column(nullable: false), - AlwaysIncludeUserClaimsInIdToken = table.Column(nullable: false), - RequirePkce = table.Column(nullable: false), - AllowPlainTextPkce = table.Column(nullable: false), - AllowAccessTokensViaBrowser = table.Column(nullable: false), - FrontChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), - FrontChannelLogoutSessionRequired = table.Column(nullable: false), - BackChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), - BackChannelLogoutSessionRequired = table.Column(nullable: false), - AllowOfflineAccess = table.Column(nullable: false), - IdentityTokenLifetime = table.Column(nullable: false), - AccessTokenLifetime = table.Column(nullable: false), - AuthorizationCodeLifetime = table.Column(nullable: false), - ConsentLifetime = table.Column(nullable: true), - AbsoluteRefreshTokenLifetime = table.Column(nullable: false), - SlidingRefreshTokenLifetime = table.Column(nullable: false), - RefreshTokenUsage = table.Column(nullable: false), - UpdateAccessTokenClaimsOnRefresh = table.Column(nullable: false), - RefreshTokenExpiration = table.Column(nullable: false), - AccessTokenType = table.Column(nullable: false), - EnableLocalLogin = table.Column(nullable: false), - IncludeJwtId = table.Column(nullable: false), - AlwaysSendClientClaims = table.Column(nullable: false), - ClientClaimsPrefix = table.Column(maxLength: 200, nullable: true), - PairWiseSubjectSalt = table.Column(maxLength: 200, nullable: true), - UserSsoLifetime = table.Column(nullable: true), - UserCodeType = table.Column(maxLength: 100, nullable: true), - DeviceCodeLifetime = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClients", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerIdentityResources", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Enabled = table.Column(nullable: false), - Required = table.Column(nullable: false), - Emphasize = table.Column(nullable: false), - ShowInDiscoveryDocument = table.Column(nullable: false), - Properties = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerIdentityResources", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerPersistedGrants", - columns: table => new - { - Key = table.Column(maxLength: 200, nullable: false), - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(nullable: true), - Type = table.Column(maxLength: 50, nullable: false), - SubjectId = table.Column(maxLength: 200, nullable: true), - ClientId = table.Column(maxLength: 200, nullable: false), - CreationTime = table.Column(nullable: false), - Expiration = table.Column(nullable: true), - Data = table.Column(maxLength: 50000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerPersistedGrants", x => x.Key); - }); - - migrationBuilder.CreateTable( - name: "AbpAuditLogActions", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - AuditLogId = table.Column(nullable: false), - ServiceName = table.Column(maxLength: 256, nullable: true), - MethodName = table.Column(maxLength: 128, nullable: true), - Parameters = table.Column(maxLength: 2000, nullable: true), - ExecutionTime = table.Column(nullable: false), - ExecutionDuration = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpAuditLogActions", x => x.Id); - table.ForeignKey( - name: "FK_AbpAuditLogActions_AbpAuditLogs_AuditLogId", - column: x => x.AuditLogId, - principalTable: "AbpAuditLogs", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpEntityChanges", - columns: table => new - { - Id = table.Column(nullable: false), - AuditLogId = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - ChangeTime = table.Column(nullable: false), - ChangeType = table.Column(nullable: false), - EntityTenantId = table.Column(nullable: true), - EntityId = table.Column(maxLength: 128, nullable: false), - EntityTypeFullName = table.Column(maxLength: 128, nullable: false), - ExtraProperties = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpEntityChanges", x => x.Id); - table.ForeignKey( - name: "FK_AbpEntityChanges_AbpAuditLogs_AuditLogId", - column: x => x.AuditLogId, - principalTable: "AbpAuditLogs", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpRoleClaims", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - ClaimType = table.Column(maxLength: 256, nullable: false), - ClaimValue = table.Column(maxLength: 1024, nullable: true), - RoleId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpRoleClaims", x => x.Id); - table.ForeignKey( - name: "FK_AbpRoleClaims_AbpRoles_RoleId", - column: x => x.RoleId, - principalTable: "AbpRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpTenantConnectionStrings", - columns: table => new - { - TenantId = table.Column(nullable: false), - Name = table.Column(maxLength: 64, nullable: false), - Value = table.Column(maxLength: 1024, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpTenantConnectionStrings", x => new { x.TenantId, x.Name }); - table.ForeignKey( - name: "FK_AbpTenantConnectionStrings_AbpTenants_TenantId", - column: x => x.TenantId, - principalTable: "AbpTenants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpUserClaims", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - ClaimType = table.Column(maxLength: 256, nullable: false), - ClaimValue = table.Column(maxLength: 1024, nullable: true), - UserId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpUserClaims", x => x.Id); - table.ForeignKey( - name: "FK_AbpUserClaims_AbpUsers_UserId", - column: x => x.UserId, - principalTable: "AbpUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpUserLogins", - columns: table => new - { - UserId = table.Column(nullable: false), - LoginProvider = table.Column(maxLength: 64, nullable: false), - TenantId = table.Column(nullable: true), - ProviderKey = table.Column(maxLength: 196, nullable: false), - ProviderDisplayName = table.Column(maxLength: 128, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpUserLogins", x => new { x.UserId, x.LoginProvider }); - table.ForeignKey( - name: "FK_AbpUserLogins_AbpUsers_UserId", - column: x => x.UserId, - principalTable: "AbpUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpUserRoles", - columns: table => new - { - UserId = table.Column(nullable: false), - RoleId = table.Column(nullable: false), - TenantId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpUserRoles", x => new { x.UserId, x.RoleId }); - table.ForeignKey( - name: "FK_AbpUserRoles_AbpRoles_RoleId", - column: x => x.RoleId, - principalTable: "AbpRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AbpUserRoles_AbpUsers_UserId", - column: x => x.UserId, - principalTable: "AbpUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpUserTokens", - columns: table => new - { - UserId = table.Column(nullable: false), - LoginProvider = table.Column(maxLength: 64, nullable: false), - Name = table.Column(maxLength: 128, nullable: false), - TenantId = table.Column(nullable: true), - Value = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); - table.ForeignKey( - name: "FK_AbpUserTokens_AbpUsers_UserId", - column: x => x.UserId, - principalTable: "AbpUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerApiClaims", - columns: table => new - { - Type = table.Column(maxLength: 200, nullable: false), - ApiResourceId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiClaims", x => new { x.ApiResourceId, x.Type }); - table.ForeignKey( - name: "FK_IdentityServerApiClaims_IdentityServerApiResources_ApiResourceId", - column: x => x.ApiResourceId, - principalTable: "IdentityServerApiResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerApiScopes", - columns: table => new - { - ApiResourceId = table.Column(nullable: false), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Required = table.Column(nullable: false), - Emphasize = table.Column(nullable: false), - ShowInDiscoveryDocument = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiScopes", x => new { x.ApiResourceId, x.Name }); - table.ForeignKey( - name: "FK_IdentityServerApiScopes_IdentityServerApiResources_ApiResourceId", - column: x => x.ApiResourceId, - principalTable: "IdentityServerApiResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerApiSecrets", - columns: table => new - { - Type = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 4000, nullable: false), - ApiResourceId = table.Column(nullable: false), - Description = table.Column(maxLength: 2000, nullable: true), - Expiration = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiSecrets", x => new { x.ApiResourceId, x.Type, x.Value }); - table.ForeignKey( - name: "FK_IdentityServerApiSecrets_IdentityServerApiResources_ApiResourceId", - column: x => x.ApiResourceId, - principalTable: "IdentityServerApiResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientClaims", - columns: table => new - { - ClientId = table.Column(nullable: false), - Type = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 250, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientClaims", x => new { x.ClientId, x.Type, x.Value }); - table.ForeignKey( - name: "FK_IdentityServerClientClaims_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientCorsOrigins", - columns: table => new - { - ClientId = table.Column(nullable: false), - Origin = table.Column(maxLength: 150, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientCorsOrigins", x => new { x.ClientId, x.Origin }); - table.ForeignKey( - name: "FK_IdentityServerClientCorsOrigins_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientGrantTypes", - columns: table => new - { - ClientId = table.Column(nullable: false), - GrantType = table.Column(maxLength: 250, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientGrantTypes", x => new { x.ClientId, x.GrantType }); - table.ForeignKey( - name: "FK_IdentityServerClientGrantTypes_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientIdPRestrictions", - columns: table => new - { - ClientId = table.Column(nullable: false), - Provider = table.Column(maxLength: 200, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientIdPRestrictions", x => new { x.ClientId, x.Provider }); - table.ForeignKey( - name: "FK_IdentityServerClientIdPRestrictions_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientPostLogoutRedirectUris", - columns: table => new - { - ClientId = table.Column(nullable: false), - PostLogoutRedirectUri = table.Column(maxLength: 2000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientPostLogoutRedirectUris", x => new { x.ClientId, x.PostLogoutRedirectUri }); - table.ForeignKey( - name: "FK_IdentityServerClientPostLogoutRedirectUris_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientProperties", - columns: table => new - { - ClientId = table.Column(nullable: false), - Key = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 2000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientProperties", x => new { x.ClientId, x.Key }); - table.ForeignKey( - name: "FK_IdentityServerClientProperties_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientRedirectUris", - columns: table => new - { - ClientId = table.Column(nullable: false), - RedirectUri = table.Column(maxLength: 2000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientRedirectUris", x => new { x.ClientId, x.RedirectUri }); - table.ForeignKey( - name: "FK_IdentityServerClientRedirectUris_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientScopes", - columns: table => new - { - ClientId = table.Column(nullable: false), - Scope = table.Column(maxLength: 200, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientScopes", x => new { x.ClientId, x.Scope }); - table.ForeignKey( - name: "FK_IdentityServerClientScopes_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientSecrets", - columns: table => new - { - Type = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 4000, nullable: false), - ClientId = table.Column(nullable: false), - Description = table.Column(maxLength: 2000, nullable: true), - Expiration = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientSecrets", x => new { x.ClientId, x.Type, x.Value }); - table.ForeignKey( - name: "FK_IdentityServerClientSecrets_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerIdentityClaims", - columns: table => new - { - Type = table.Column(maxLength: 200, nullable: false), - IdentityResourceId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerIdentityClaims", x => new { x.IdentityResourceId, x.Type }); - table.ForeignKey( - name: "FK_IdentityServerIdentityClaims_IdentityServerIdentityResources_IdentityResourceId", - column: x => x.IdentityResourceId, - principalTable: "IdentityServerIdentityResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpEntityPropertyChanges", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - EntityChangeId = table.Column(nullable: false), - NewValue = table.Column(maxLength: 512, nullable: true), - OriginalValue = table.Column(maxLength: 512, nullable: true), - PropertyName = table.Column(maxLength: 128, nullable: false), - PropertyTypeFullName = table.Column(maxLength: 64, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpEntityPropertyChanges", x => x.Id); - table.ForeignKey( - name: "FK_AbpEntityPropertyChanges_AbpEntityChanges_EntityChangeId", - column: x => x.EntityChangeId, - principalTable: "AbpEntityChanges", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerApiScopeClaims", - columns: table => new - { - Type = table.Column(maxLength: 200, nullable: false), - ApiResourceId = table.Column(nullable: false), - Name = table.Column(maxLength: 200, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiScopeClaims", x => new { x.ApiResourceId, x.Name, x.Type }); - table.ForeignKey( - name: "FK_IdentityServerApiScopeClaims_IdentityServerApiScopes_ApiResourceId_Name", - columns: x => new { x.ApiResourceId, x.Name }, - principalTable: "IdentityServerApiScopes", - principalColumns: new[] { "ApiResourceId", "Name" }, - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_AbpAuditLogActions_AuditLogId", - table: "AbpAuditLogActions", - column: "AuditLogId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpAuditLogActions_TenantId_ServiceName_MethodName_ExecutionTime", - table: "AbpAuditLogActions", - columns: new[] { "TenantId", "ServiceName", "MethodName", "ExecutionTime" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpAuditLogs_TenantId_ExecutionTime", - table: "AbpAuditLogs", - columns: new[] { "TenantId", "ExecutionTime" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpAuditLogs_TenantId_UserId_ExecutionTime", - table: "AbpAuditLogs", - columns: new[] { "TenantId", "UserId", "ExecutionTime" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpEntityChanges_AuditLogId", - table: "AbpEntityChanges", - column: "AuditLogId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpEntityChanges_TenantId_EntityTypeFullName_EntityId", - table: "AbpEntityChanges", - columns: new[] { "TenantId", "EntityTypeFullName", "EntityId" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpEntityPropertyChanges_EntityChangeId", - table: "AbpEntityPropertyChanges", - column: "EntityChangeId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpPermissionGrants_Name_ProviderName_ProviderKey", - table: "AbpPermissionGrants", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpRoleClaims_RoleId", - table: "AbpRoleClaims", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpRoles_NormalizedName", - table: "AbpRoles", - column: "NormalizedName"); - - migrationBuilder.CreateIndex( - name: "IX_AbpSettings_Name_ProviderName_ProviderKey", - table: "AbpSettings", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpTenants_Name", - table: "AbpTenants", - column: "Name", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_AbpUserClaims_UserId", - table: "AbpUserClaims", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpUserLogins_LoginProvider_ProviderKey", - table: "AbpUserLogins", - columns: new[] { "LoginProvider", "ProviderKey" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpUserRoles_RoleId_UserId", - table: "AbpUserRoles", - columns: new[] { "RoleId", "UserId" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpUsers_Email", - table: "AbpUsers", - column: "Email"); - - migrationBuilder.CreateIndex( - name: "IX_AbpUsers_NormalizedEmail", - table: "AbpUsers", - column: "NormalizedEmail"); - - migrationBuilder.CreateIndex( - name: "IX_AbpUsers_NormalizedUserName", - table: "AbpUsers", - column: "NormalizedUserName"); - - migrationBuilder.CreateIndex( - name: "IX_AbpUsers_UserName", - table: "AbpUsers", - column: "UserName"); - - migrationBuilder.CreateIndex( - name: "IX_IdentityServerClients_ClientId", - table: "IdentityServerClients", - column: "ClientId"); - - migrationBuilder.CreateIndex( - name: "IX_IdentityServerPersistedGrants_Expiration", - table: "IdentityServerPersistedGrants", - column: "Expiration"); - - migrationBuilder.CreateIndex( - name: "IX_IdentityServerPersistedGrants_SubjectId_ClientId_Type", - table: "IdentityServerPersistedGrants", - columns: new[] { "SubjectId", "ClientId", "Type" }); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AbpAuditLogActions"); - - migrationBuilder.DropTable( - name: "AbpClaimTypes"); - - migrationBuilder.DropTable( - name: "AbpEntityPropertyChanges"); - - migrationBuilder.DropTable( - name: "AbpPermissionGrants"); - - migrationBuilder.DropTable( - name: "AbpRoleClaims"); - - migrationBuilder.DropTable( - name: "AbpSettings"); - - migrationBuilder.DropTable( - name: "AbpTenantConnectionStrings"); - - migrationBuilder.DropTable( - name: "AbpUserClaims"); - - migrationBuilder.DropTable( - name: "AbpUserLogins"); - - migrationBuilder.DropTable( - name: "AbpUserRoles"); - - migrationBuilder.DropTable( - name: "AbpUserTokens"); - - migrationBuilder.DropTable( - name: "IdentityServerApiClaims"); - - migrationBuilder.DropTable( - name: "IdentityServerApiScopeClaims"); - - migrationBuilder.DropTable( - name: "IdentityServerApiSecrets"); - - migrationBuilder.DropTable( - name: "IdentityServerClientClaims"); - - migrationBuilder.DropTable( - name: "IdentityServerClientCorsOrigins"); - - migrationBuilder.DropTable( - name: "IdentityServerClientGrantTypes"); - - migrationBuilder.DropTable( - name: "IdentityServerClientIdPRestrictions"); - - migrationBuilder.DropTable( - name: "IdentityServerClientPostLogoutRedirectUris"); - - migrationBuilder.DropTable( - name: "IdentityServerClientProperties"); - - migrationBuilder.DropTable( - name: "IdentityServerClientRedirectUris"); - - migrationBuilder.DropTable( - name: "IdentityServerClientScopes"); - - migrationBuilder.DropTable( - name: "IdentityServerClientSecrets"); - - migrationBuilder.DropTable( - name: "IdentityServerIdentityClaims"); - - migrationBuilder.DropTable( - name: "IdentityServerPersistedGrants"); - - migrationBuilder.DropTable( - name: "AbpEntityChanges"); - - migrationBuilder.DropTable( - name: "AbpTenants"); - - migrationBuilder.DropTable( - name: "AbpRoles"); - - migrationBuilder.DropTable( - name: "AbpUsers"); - - migrationBuilder.DropTable( - name: "IdentityServerApiScopes"); - - migrationBuilder.DropTable( - name: "IdentityServerClients"); - - migrationBuilder.DropTable( - name: "IdentityServerIdentityResources"); - - migrationBuilder.DropTable( - name: "AbpAuditLogs"); - - migrationBuilder.DropTable( - name: "IdentityServerApiResources"); - } - } -} diff --git a/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20191018081718_Initial.Designer.cs b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/Migrations/20200106082830_Initial.Designer.cs similarity index 96% rename from samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20191018081718_Initial.Designer.cs rename to samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/Migrations/20200106082830_Initial.Designer.cs index 58a98448a6..226a9a8c6c 100644 --- a/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20191018081718_Initial.Designer.cs +++ b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/Migrations/20200106082830_Initial.Designer.cs @@ -1,23 +1,23 @@ // using System; -using Acme.BookStore.EntityFrameworkCore; +using Acme.BookStore.BookManagement.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -namespace Acme.BookStore.Migrations +namespace Acme.BookStore.BookManagement.Migrations { - [DbContext(typeof(BookStoreMigrationsDbContext))] - [Migration("20191018081718_Initial")] + [DbContext(typeof(IdentityServerHostMigrationsDbContext))] + [Migration("20200106082830_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0") + .HasAnnotation("ProductVersion", "3.1.0") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); @@ -268,92 +268,6 @@ namespace Acme.BookStore.Migrations b.ToTable("AbpEntityPropertyChanges"); }); - modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsAbandoned") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("JobArgs") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasMaxLength(1048576); - - b.Property("JobName") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("LastTryTime") - .HasColumnType("datetime2"); - - b.Property("NextTryTime") - .HasColumnType("datetime2"); - - b.Property("Priority") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint") - .HasDefaultValue((byte)15); - - b.Property("TryCount") - .ValueGeneratedOnAdd() - .HasColumnType("smallint") - .HasDefaultValue((short)0); - - b.HasKey("Id"); - - b.HasIndex("IsAbandoned", "NextTryTime"); - - b.ToTable("AbpBackgroundJobs"); - }); - - modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ProviderName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("Value") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.HasKey("Id"); - - b.HasIndex("Name", "ProviderName", "ProviderKey"); - - b.ToTable("AbpFeatureValues"); - }); - modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => { b.Property("Id") @@ -512,6 +426,7 @@ namespace Acme.BookStore.Migrations .HasColumnType("datetime2"); b.Property("Email") + .IsRequired() .HasColumnName("Email") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -555,6 +470,7 @@ namespace Acme.BookStore.Migrations .HasMaxLength(64); b.Property("NormalizedEmail") + .IsRequired() .HasColumnName("NormalizedEmail") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -1197,6 +1113,70 @@ namespace Acme.BookStore.Migrations b.ToTable("IdentityServerClientSecrets"); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Data") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(50000); + + b.Property("DeviceCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Expiration") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("SubjectId") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("UserCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.HasIndex("UserCode") + .IsUnique(); + + b.ToTable("IdentityServerDeviceFlowCodes"); + }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") @@ -1453,8 +1433,7 @@ namespace Acme.BookStore.Migrations b.HasKey("Id"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("Name"); b.ToTable("AbpTenants"); }); diff --git a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/Migrations/20200106082830_Initial.cs b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/Migrations/20200106082830_Initial.cs new file mode 100644 index 0000000000..29fd4e6387 --- /dev/null +++ b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/Migrations/20200106082830_Initial.cs @@ -0,0 +1,1022 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Acme.BookStore.BookManagement.Migrations +{ + public partial class Initial : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "AbpAuditLogs", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + ApplicationName = table.Column(maxLength: 96, nullable: true), + UserId = table.Column(nullable: true), + UserName = table.Column(maxLength: 256, nullable: true), + TenantId = table.Column(nullable: true), + TenantName = table.Column(nullable: true), + ImpersonatorUserId = table.Column(nullable: true), + ImpersonatorTenantId = table.Column(nullable: true), + ExecutionTime = table.Column(nullable: false), + ExecutionDuration = table.Column(nullable: false), + ClientIpAddress = table.Column(maxLength: 64, nullable: true), + ClientName = table.Column(maxLength: 128, nullable: true), + ClientId = table.Column(maxLength: 64, nullable: true), + CorrelationId = table.Column(maxLength: 64, nullable: true), + BrowserInfo = table.Column(maxLength: 512, nullable: true), + HttpMethod = table.Column(maxLength: 16, nullable: true), + Url = table.Column(maxLength: 256, nullable: true), + Exceptions = table.Column(maxLength: 4000, nullable: true), + Comments = table.Column(maxLength: 256, nullable: true), + HttpStatusCode = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpAuditLogs", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpClaimTypes", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(maxLength: 256, nullable: false), + Name = table.Column(maxLength: 256, nullable: false), + Required = table.Column(nullable: false), + IsStatic = table.Column(nullable: false), + Regex = table.Column(maxLength: 512, nullable: true), + RegexDescription = table.Column(maxLength: 128, nullable: true), + Description = table.Column(maxLength: 256, nullable: true), + ValueType = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpClaimTypes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpPermissionGrants", + columns: table => new + { + Id = table.Column(nullable: false), + TenantId = table.Column(nullable: true), + Name = table.Column(maxLength: 128, nullable: false), + ProviderName = table.Column(maxLength: 64, nullable: false), + ProviderKey = table.Column(maxLength: 64, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpPermissionGrants", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpRoles", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(maxLength: 256, nullable: false), + TenantId = table.Column(nullable: true), + Name = table.Column(maxLength: 256, nullable: false), + NormalizedName = table.Column(maxLength: 256, nullable: false), + IsDefault = table.Column(nullable: false), + IsStatic = table.Column(nullable: false), + IsPublic = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpRoles", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpSettings", + columns: table => new + { + Id = table.Column(nullable: false), + Name = table.Column(maxLength: 128, nullable: false), + Value = table.Column(maxLength: 2048, nullable: false), + ProviderName = table.Column(maxLength: 64, nullable: true), + ProviderKey = table.Column(maxLength: 64, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpSettings", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpTenants", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + IsDeleted = table.Column(nullable: false, defaultValue: false), + DeleterId = table.Column(nullable: true), + DeletionTime = table.Column(nullable: true), + Name = table.Column(maxLength: 64, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpTenants", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpUsers", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + IsDeleted = table.Column(nullable: false, defaultValue: false), + DeleterId = table.Column(nullable: true), + DeletionTime = table.Column(nullable: true), + TenantId = table.Column(nullable: true), + UserName = table.Column(maxLength: 256, nullable: false), + NormalizedUserName = table.Column(maxLength: 256, nullable: false), + Name = table.Column(maxLength: 64, nullable: true), + Surname = table.Column(maxLength: 64, nullable: true), + Email = table.Column(maxLength: 256, nullable: false), + NormalizedEmail = table.Column(maxLength: 256, nullable: false), + EmailConfirmed = table.Column(nullable: false, defaultValue: false), + PasswordHash = table.Column(maxLength: 256, nullable: true), + SecurityStamp = table.Column(maxLength: 256, nullable: false), + PhoneNumber = table.Column(maxLength: 16, nullable: true), + PhoneNumberConfirmed = table.Column(nullable: false, defaultValue: false), + TwoFactorEnabled = table.Column(nullable: false, defaultValue: false), + LockoutEnd = table.Column(nullable: true), + LockoutEnabled = table.Column(nullable: false, defaultValue: false), + AccessFailedCount = table.Column(nullable: false, defaultValue: 0) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUsers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerApiResources", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + IsDeleted = table.Column(nullable: false, defaultValue: false), + DeleterId = table.Column(nullable: true), + DeletionTime = table.Column(nullable: true), + Name = table.Column(maxLength: 200, nullable: false), + DisplayName = table.Column(maxLength: 200, nullable: true), + Description = table.Column(maxLength: 1000, nullable: true), + Enabled = table.Column(nullable: false), + Properties = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiResources", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClients", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + IsDeleted = table.Column(nullable: false, defaultValue: false), + DeleterId = table.Column(nullable: true), + DeletionTime = table.Column(nullable: true), + ClientId = table.Column(maxLength: 200, nullable: false), + ClientName = table.Column(maxLength: 200, nullable: true), + Description = table.Column(maxLength: 1000, nullable: true), + ClientUri = table.Column(maxLength: 2000, nullable: true), + LogoUri = table.Column(maxLength: 2000, nullable: true), + Enabled = table.Column(nullable: false), + ProtocolType = table.Column(maxLength: 200, nullable: false), + RequireClientSecret = table.Column(nullable: false), + RequireConsent = table.Column(nullable: false), + AllowRememberConsent = table.Column(nullable: false), + AlwaysIncludeUserClaimsInIdToken = table.Column(nullable: false), + RequirePkce = table.Column(nullable: false), + AllowPlainTextPkce = table.Column(nullable: false), + AllowAccessTokensViaBrowser = table.Column(nullable: false), + FrontChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), + FrontChannelLogoutSessionRequired = table.Column(nullable: false), + BackChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), + BackChannelLogoutSessionRequired = table.Column(nullable: false), + AllowOfflineAccess = table.Column(nullable: false), + IdentityTokenLifetime = table.Column(nullable: false), + AccessTokenLifetime = table.Column(nullable: false), + AuthorizationCodeLifetime = table.Column(nullable: false), + ConsentLifetime = table.Column(nullable: true), + AbsoluteRefreshTokenLifetime = table.Column(nullable: false), + SlidingRefreshTokenLifetime = table.Column(nullable: false), + RefreshTokenUsage = table.Column(nullable: false), + UpdateAccessTokenClaimsOnRefresh = table.Column(nullable: false), + RefreshTokenExpiration = table.Column(nullable: false), + AccessTokenType = table.Column(nullable: false), + EnableLocalLogin = table.Column(nullable: false), + IncludeJwtId = table.Column(nullable: false), + AlwaysSendClientClaims = table.Column(nullable: false), + ClientClaimsPrefix = table.Column(maxLength: 200, nullable: true), + PairWiseSubjectSalt = table.Column(maxLength: 200, nullable: true), + UserSsoLifetime = table.Column(nullable: true), + UserCodeType = table.Column(maxLength: 100, nullable: true), + DeviceCodeLifetime = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClients", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerDeviceFlowCodes", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + DeviceCode = table.Column(maxLength: 200, nullable: false), + UserCode = table.Column(maxLength: 200, nullable: false), + SubjectId = table.Column(maxLength: 200, nullable: true), + ClientId = table.Column(maxLength: 200, nullable: false), + Expiration = table.Column(nullable: false), + Data = table.Column(maxLength: 50000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerDeviceFlowCodes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerIdentityResources", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + IsDeleted = table.Column(nullable: false, defaultValue: false), + DeleterId = table.Column(nullable: true), + DeletionTime = table.Column(nullable: true), + Name = table.Column(maxLength: 200, nullable: false), + DisplayName = table.Column(maxLength: 200, nullable: true), + Description = table.Column(maxLength: 1000, nullable: true), + Enabled = table.Column(nullable: false), + Required = table.Column(nullable: false), + Emphasize = table.Column(nullable: false), + ShowInDiscoveryDocument = table.Column(nullable: false), + Properties = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerIdentityResources", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerPersistedGrants", + columns: table => new + { + Key = table.Column(maxLength: 200, nullable: false), + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + Type = table.Column(maxLength: 50, nullable: false), + SubjectId = table.Column(maxLength: 200, nullable: true), + ClientId = table.Column(maxLength: 200, nullable: false), + CreationTime = table.Column(nullable: false), + Expiration = table.Column(nullable: true), + Data = table.Column(maxLength: 50000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerPersistedGrants", x => x.Key); + }); + + migrationBuilder.CreateTable( + name: "AbpAuditLogActions", + columns: table => new + { + Id = table.Column(nullable: false), + TenantId = table.Column(nullable: true), + AuditLogId = table.Column(nullable: false), + ServiceName = table.Column(maxLength: 256, nullable: true), + MethodName = table.Column(maxLength: 128, nullable: true), + Parameters = table.Column(maxLength: 2000, nullable: true), + ExecutionTime = table.Column(nullable: false), + ExecutionDuration = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpAuditLogActions", x => x.Id); + table.ForeignKey( + name: "FK_AbpAuditLogActions_AbpAuditLogs_AuditLogId", + column: x => x.AuditLogId, + principalTable: "AbpAuditLogs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpEntityChanges", + columns: table => new + { + Id = table.Column(nullable: false), + AuditLogId = table.Column(nullable: false), + TenantId = table.Column(nullable: true), + ChangeTime = table.Column(nullable: false), + ChangeType = table.Column(nullable: false), + EntityTenantId = table.Column(nullable: true), + EntityId = table.Column(maxLength: 128, nullable: false), + EntityTypeFullName = table.Column(maxLength: 128, nullable: false), + ExtraProperties = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpEntityChanges", x => x.Id); + table.ForeignKey( + name: "FK_AbpEntityChanges_AbpAuditLogs_AuditLogId", + column: x => x.AuditLogId, + principalTable: "AbpAuditLogs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpRoleClaims", + columns: table => new + { + Id = table.Column(nullable: false), + TenantId = table.Column(nullable: true), + ClaimType = table.Column(maxLength: 256, nullable: false), + ClaimValue = table.Column(maxLength: 1024, nullable: true), + RoleId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpRoleClaims", x => x.Id); + table.ForeignKey( + name: "FK_AbpRoleClaims_AbpRoles_RoleId", + column: x => x.RoleId, + principalTable: "AbpRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpTenantConnectionStrings", + columns: table => new + { + TenantId = table.Column(nullable: false), + Name = table.Column(maxLength: 64, nullable: false), + Value = table.Column(maxLength: 1024, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpTenantConnectionStrings", x => new { x.TenantId, x.Name }); + table.ForeignKey( + name: "FK_AbpTenantConnectionStrings_AbpTenants_TenantId", + column: x => x.TenantId, + principalTable: "AbpTenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserClaims", + columns: table => new + { + Id = table.Column(nullable: false), + TenantId = table.Column(nullable: true), + ClaimType = table.Column(maxLength: 256, nullable: false), + ClaimValue = table.Column(maxLength: 1024, nullable: true), + UserId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserClaims", x => x.Id); + table.ForeignKey( + name: "FK_AbpUserClaims_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserLogins", + columns: table => new + { + UserId = table.Column(nullable: false), + LoginProvider = table.Column(maxLength: 64, nullable: false), + TenantId = table.Column(nullable: true), + ProviderKey = table.Column(maxLength: 196, nullable: false), + ProviderDisplayName = table.Column(maxLength: 128, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserLogins", x => new { x.UserId, x.LoginProvider }); + table.ForeignKey( + name: "FK_AbpUserLogins_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserRoles", + columns: table => new + { + UserId = table.Column(nullable: false), + RoleId = table.Column(nullable: false), + TenantId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserRoles", x => new { x.UserId, x.RoleId }); + table.ForeignKey( + name: "FK_AbpUserRoles_AbpRoles_RoleId", + column: x => x.RoleId, + principalTable: "AbpRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AbpUserRoles_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserTokens", + columns: table => new + { + UserId = table.Column(nullable: false), + LoginProvider = table.Column(maxLength: 64, nullable: false), + Name = table.Column(maxLength: 128, nullable: false), + TenantId = table.Column(nullable: true), + Value = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); + table.ForeignKey( + name: "FK_AbpUserTokens_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerApiClaims", + columns: table => new + { + Type = table.Column(maxLength: 200, nullable: false), + ApiResourceId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiClaims", x => new { x.ApiResourceId, x.Type }); + table.ForeignKey( + name: "FK_IdentityServerApiClaims_IdentityServerApiResources_ApiResourceId", + column: x => x.ApiResourceId, + principalTable: "IdentityServerApiResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerApiScopes", + columns: table => new + { + ApiResourceId = table.Column(nullable: false), + Name = table.Column(maxLength: 200, nullable: false), + DisplayName = table.Column(maxLength: 200, nullable: true), + Description = table.Column(maxLength: 1000, nullable: true), + Required = table.Column(nullable: false), + Emphasize = table.Column(nullable: false), + ShowInDiscoveryDocument = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiScopes", x => new { x.ApiResourceId, x.Name }); + table.ForeignKey( + name: "FK_IdentityServerApiScopes_IdentityServerApiResources_ApiResourceId", + column: x => x.ApiResourceId, + principalTable: "IdentityServerApiResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerApiSecrets", + columns: table => new + { + Type = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 4000, nullable: false), + ApiResourceId = table.Column(nullable: false), + Description = table.Column(maxLength: 2000, nullable: true), + Expiration = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiSecrets", x => new { x.ApiResourceId, x.Type, x.Value }); + table.ForeignKey( + name: "FK_IdentityServerApiSecrets_IdentityServerApiResources_ApiResourceId", + column: x => x.ApiResourceId, + principalTable: "IdentityServerApiResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientClaims", + columns: table => new + { + ClientId = table.Column(nullable: false), + Type = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 250, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientClaims", x => new { x.ClientId, x.Type, x.Value }); + table.ForeignKey( + name: "FK_IdentityServerClientClaims_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientCorsOrigins", + columns: table => new + { + ClientId = table.Column(nullable: false), + Origin = table.Column(maxLength: 150, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientCorsOrigins", x => new { x.ClientId, x.Origin }); + table.ForeignKey( + name: "FK_IdentityServerClientCorsOrigins_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientGrantTypes", + columns: table => new + { + ClientId = table.Column(nullable: false), + GrantType = table.Column(maxLength: 250, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientGrantTypes", x => new { x.ClientId, x.GrantType }); + table.ForeignKey( + name: "FK_IdentityServerClientGrantTypes_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientIdPRestrictions", + columns: table => new + { + ClientId = table.Column(nullable: false), + Provider = table.Column(maxLength: 200, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientIdPRestrictions", x => new { x.ClientId, x.Provider }); + table.ForeignKey( + name: "FK_IdentityServerClientIdPRestrictions_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientPostLogoutRedirectUris", + columns: table => new + { + ClientId = table.Column(nullable: false), + PostLogoutRedirectUri = table.Column(maxLength: 2000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientPostLogoutRedirectUris", x => new { x.ClientId, x.PostLogoutRedirectUri }); + table.ForeignKey( + name: "FK_IdentityServerClientPostLogoutRedirectUris_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientProperties", + columns: table => new + { + ClientId = table.Column(nullable: false), + Key = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 2000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientProperties", x => new { x.ClientId, x.Key }); + table.ForeignKey( + name: "FK_IdentityServerClientProperties_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientRedirectUris", + columns: table => new + { + ClientId = table.Column(nullable: false), + RedirectUri = table.Column(maxLength: 2000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientRedirectUris", x => new { x.ClientId, x.RedirectUri }); + table.ForeignKey( + name: "FK_IdentityServerClientRedirectUris_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientScopes", + columns: table => new + { + ClientId = table.Column(nullable: false), + Scope = table.Column(maxLength: 200, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientScopes", x => new { x.ClientId, x.Scope }); + table.ForeignKey( + name: "FK_IdentityServerClientScopes_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientSecrets", + columns: table => new + { + Type = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 4000, nullable: false), + ClientId = table.Column(nullable: false), + Description = table.Column(maxLength: 2000, nullable: true), + Expiration = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientSecrets", x => new { x.ClientId, x.Type, x.Value }); + table.ForeignKey( + name: "FK_IdentityServerClientSecrets_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerIdentityClaims", + columns: table => new + { + Type = table.Column(maxLength: 200, nullable: false), + IdentityResourceId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerIdentityClaims", x => new { x.IdentityResourceId, x.Type }); + table.ForeignKey( + name: "FK_IdentityServerIdentityClaims_IdentityServerIdentityResources_IdentityResourceId", + column: x => x.IdentityResourceId, + principalTable: "IdentityServerIdentityResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpEntityPropertyChanges", + columns: table => new + { + Id = table.Column(nullable: false), + TenantId = table.Column(nullable: true), + EntityChangeId = table.Column(nullable: false), + NewValue = table.Column(maxLength: 512, nullable: true), + OriginalValue = table.Column(maxLength: 512, nullable: true), + PropertyName = table.Column(maxLength: 128, nullable: false), + PropertyTypeFullName = table.Column(maxLength: 64, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpEntityPropertyChanges", x => x.Id); + table.ForeignKey( + name: "FK_AbpEntityPropertyChanges_AbpEntityChanges_EntityChangeId", + column: x => x.EntityChangeId, + principalTable: "AbpEntityChanges", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerApiScopeClaims", + columns: table => new + { + Type = table.Column(maxLength: 200, nullable: false), + ApiResourceId = table.Column(nullable: false), + Name = table.Column(maxLength: 200, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiScopeClaims", x => new { x.ApiResourceId, x.Name, x.Type }); + table.ForeignKey( + name: "FK_IdentityServerApiScopeClaims_IdentityServerApiScopes_ApiResourceId_Name", + columns: x => new { x.ApiResourceId, x.Name }, + principalTable: "IdentityServerApiScopes", + principalColumns: new[] { "ApiResourceId", "Name" }, + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_AbpAuditLogActions_AuditLogId", + table: "AbpAuditLogActions", + column: "AuditLogId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpAuditLogActions_TenantId_ServiceName_MethodName_ExecutionTime", + table: "AbpAuditLogActions", + columns: new[] { "TenantId", "ServiceName", "MethodName", "ExecutionTime" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpAuditLogs_TenantId_ExecutionTime", + table: "AbpAuditLogs", + columns: new[] { "TenantId", "ExecutionTime" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpAuditLogs_TenantId_UserId_ExecutionTime", + table: "AbpAuditLogs", + columns: new[] { "TenantId", "UserId", "ExecutionTime" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpEntityChanges_AuditLogId", + table: "AbpEntityChanges", + column: "AuditLogId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpEntityChanges_TenantId_EntityTypeFullName_EntityId", + table: "AbpEntityChanges", + columns: new[] { "TenantId", "EntityTypeFullName", "EntityId" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpEntityPropertyChanges_EntityChangeId", + table: "AbpEntityPropertyChanges", + column: "EntityChangeId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpPermissionGrants_Name_ProviderName_ProviderKey", + table: "AbpPermissionGrants", + columns: new[] { "Name", "ProviderName", "ProviderKey" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpRoleClaims_RoleId", + table: "AbpRoleClaims", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpRoles_NormalizedName", + table: "AbpRoles", + column: "NormalizedName"); + + migrationBuilder.CreateIndex( + name: "IX_AbpSettings_Name_ProviderName_ProviderKey", + table: "AbpSettings", + columns: new[] { "Name", "ProviderName", "ProviderKey" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpTenants_Name", + table: "AbpTenants", + column: "Name"); + + migrationBuilder.CreateIndex( + name: "IX_AbpUserClaims_UserId", + table: "AbpUserClaims", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpUserLogins_LoginProvider_ProviderKey", + table: "AbpUserLogins", + columns: new[] { "LoginProvider", "ProviderKey" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpUserRoles_RoleId_UserId", + table: "AbpUserRoles", + columns: new[] { "RoleId", "UserId" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpUsers_Email", + table: "AbpUsers", + column: "Email"); + + migrationBuilder.CreateIndex( + name: "IX_AbpUsers_NormalizedEmail", + table: "AbpUsers", + column: "NormalizedEmail"); + + migrationBuilder.CreateIndex( + name: "IX_AbpUsers_NormalizedUserName", + table: "AbpUsers", + column: "NormalizedUserName"); + + migrationBuilder.CreateIndex( + name: "IX_AbpUsers_UserName", + table: "AbpUsers", + column: "UserName"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerClients_ClientId", + table: "IdentityServerClients", + column: "ClientId"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_DeviceCode", + table: "IdentityServerDeviceFlowCodes", + column: "DeviceCode", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_Expiration", + table: "IdentityServerDeviceFlowCodes", + column: "Expiration"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_UserCode", + table: "IdentityServerDeviceFlowCodes", + column: "UserCode", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerPersistedGrants_Expiration", + table: "IdentityServerPersistedGrants", + column: "Expiration"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerPersistedGrants_SubjectId_ClientId_Type", + table: "IdentityServerPersistedGrants", + columns: new[] { "SubjectId", "ClientId", "Type" }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AbpAuditLogActions"); + + migrationBuilder.DropTable( + name: "AbpClaimTypes"); + + migrationBuilder.DropTable( + name: "AbpEntityPropertyChanges"); + + migrationBuilder.DropTable( + name: "AbpPermissionGrants"); + + migrationBuilder.DropTable( + name: "AbpRoleClaims"); + + migrationBuilder.DropTable( + name: "AbpSettings"); + + migrationBuilder.DropTable( + name: "AbpTenantConnectionStrings"); + + migrationBuilder.DropTable( + name: "AbpUserClaims"); + + migrationBuilder.DropTable( + name: "AbpUserLogins"); + + migrationBuilder.DropTable( + name: "AbpUserRoles"); + + migrationBuilder.DropTable( + name: "AbpUserTokens"); + + migrationBuilder.DropTable( + name: "IdentityServerApiClaims"); + + migrationBuilder.DropTable( + name: "IdentityServerApiScopeClaims"); + + migrationBuilder.DropTable( + name: "IdentityServerApiSecrets"); + + migrationBuilder.DropTable( + name: "IdentityServerClientClaims"); + + migrationBuilder.DropTable( + name: "IdentityServerClientCorsOrigins"); + + migrationBuilder.DropTable( + name: "IdentityServerClientGrantTypes"); + + migrationBuilder.DropTable( + name: "IdentityServerClientIdPRestrictions"); + + migrationBuilder.DropTable( + name: "IdentityServerClientPostLogoutRedirectUris"); + + migrationBuilder.DropTable( + name: "IdentityServerClientProperties"); + + migrationBuilder.DropTable( + name: "IdentityServerClientRedirectUris"); + + migrationBuilder.DropTable( + name: "IdentityServerClientScopes"); + + migrationBuilder.DropTable( + name: "IdentityServerClientSecrets"); + + migrationBuilder.DropTable( + name: "IdentityServerDeviceFlowCodes"); + + migrationBuilder.DropTable( + name: "IdentityServerIdentityClaims"); + + migrationBuilder.DropTable( + name: "IdentityServerPersistedGrants"); + + migrationBuilder.DropTable( + name: "AbpEntityChanges"); + + migrationBuilder.DropTable( + name: "AbpTenants"); + + migrationBuilder.DropTable( + name: "AbpRoles"); + + migrationBuilder.DropTable( + name: "AbpUsers"); + + migrationBuilder.DropTable( + name: "IdentityServerApiScopes"); + + migrationBuilder.DropTable( + name: "IdentityServerClients"); + + migrationBuilder.DropTable( + name: "IdentityServerIdentityResources"); + + migrationBuilder.DropTable( + name: "AbpAuditLogs"); + + migrationBuilder.DropTable( + name: "IdentityServerApiResources"); + } + } +} diff --git a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs index 6dceb1571b..57cf043bd1 100644 --- a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs +++ b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs @@ -15,7 +15,7 @@ namespace Acme.BookStore.BookManagement.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0") + .HasAnnotation("ProductVersion", "3.1.0") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); @@ -424,6 +424,7 @@ namespace Acme.BookStore.BookManagement.Migrations .HasColumnType("datetime2"); b.Property("Email") + .IsRequired() .HasColumnName("Email") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -467,6 +468,7 @@ namespace Acme.BookStore.BookManagement.Migrations .HasMaxLength(64); b.Property("NormalizedEmail") + .IsRequired() .HasColumnName("NormalizedEmail") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -1109,6 +1111,70 @@ namespace Acme.BookStore.BookManagement.Migrations b.ToTable("IdentityServerClientSecrets"); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Data") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(50000); + + b.Property("DeviceCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Expiration") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("SubjectId") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("UserCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.HasIndex("UserCode") + .IsUnique(); + + b.ToTable("IdentityServerDeviceFlowCodes"); + }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") @@ -1365,8 +1431,7 @@ namespace Acme.BookStore.BookManagement.Migrations b.HasKey("Id"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("Name"); b.ToTable("AbpTenants"); }); diff --git a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Host/Acme.BookStore.BookManagement.Web.Host.csproj b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Host/Acme.BookStore.BookManagement.Web.Host.csproj index 0534b56365..34f8bcf4c1 100644 --- a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Host/Acme.BookStore.BookManagement.Web.Host.csproj +++ b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Host/Acme.BookStore.BookManagement.Web.Host.csproj @@ -1,4 +1,4 @@ - + @@ -10,9 +10,9 @@ - + - + diff --git a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/Acme.BookStore.BookManagement.Web.Unified.csproj b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/Acme.BookStore.BookManagement.Web.Unified.csproj index 9fb034d5fe..d54a64710b 100644 --- a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/Acme.BookStore.BookManagement.Web.Unified.csproj +++ b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/Acme.BookStore.BookManagement.Web.Unified.csproj @@ -1,4 +1,4 @@ - + @@ -10,9 +10,9 @@ - + - + diff --git a/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20191018081320_Initial.Designer.cs b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/Migrations/20200106082340_Initial.Designer.cs similarity index 56% rename from samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20191018081320_Initial.Designer.cs rename to samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/Migrations/20200106082340_Initial.Designer.cs index 874183e1ee..caf8dac8ce 100644 --- a/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20191018081320_Initial.Designer.cs +++ b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/Migrations/20200106082340_Initial.Designer.cs @@ -1,26 +1,76 @@ // using System; -using AuthServer.Host.EntityFrameworkCore; +using Acme.BookStore.BookManagement.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -namespace AuthServer.Host.Migrations +namespace Acme.BookStore.BookManagement.Migrations { - [DbContext(typeof(AuthServerDbContext))] - [Migration("20191018081320_Initial")] + [DbContext(typeof(UnifiedDbContext))] + [Migration("20200106082340_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0") + .HasAnnotation("ProductVersion", "3.1.0") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + modelBuilder.Entity("Acme.BookStore.BookManagement.Books.Book", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("Price") + .HasColumnType("real"); + + b.Property("PublishDate") + .HasColumnType("datetime2"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("BmBooks"); + }); + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { b.Property("Id") @@ -426,6 +476,7 @@ namespace AuthServer.Host.Migrations .HasColumnType("datetime2"); b.Property("Email") + .IsRequired() .HasColumnName("Email") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -469,6 +520,7 @@ namespace AuthServer.Host.Migrations .HasMaxLength(64); b.Property("NormalizedEmail") + .IsRequired() .HasColumnName("NormalizedEmail") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -632,231 +684,79 @@ namespace AuthServer.Host.Migrations b.ToTable("AbpUserTokens"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); - - b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Enabled") - .HasColumnType("bit"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Properties") - .HasColumnType("nvarchar(max)"); - - b.HasKey("Id"); - - b.ToTable("IdentityServerApiResources"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => - { - b.Property("ApiResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); - b.HasKey("ApiResourceId", "Type"); + b.Property("ProviderKey") + .IsRequired() + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); - b.ToTable("IdentityServerApiClaims"); - }); + b.Property("ProviderName") + .IsRequired() + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => - { - b.Property("ApiResourceId") + b.Property("TenantId") .HasColumnType("uniqueidentifier"); - b.Property("Name") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); - - b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Emphasize") - .HasColumnType("bit"); - - b.Property("Required") - .HasColumnType("bit"); - - b.Property("ShowInDiscoveryDocument") - .HasColumnType("bit"); + b.HasKey("Id"); - b.HasKey("ApiResourceId", "Name"); + b.HasIndex("Name", "ProviderName", "ProviderKey"); - b.ToTable("IdentityServerApiScopes"); + b.ToTable("AbpPermissionGrants"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { - b.Property("ApiResourceId") + b.Property("Id") + .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); b.Property("Name") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("ApiResourceId", "Name", "Type"); - - b.ToTable("IdentityServerApiScopeClaims"); - }); + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => - { - b.Property("ApiResourceId") - .HasColumnType("uniqueidentifier"); + b.Property("ProviderKey") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); - b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + b.Property("ProviderName") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); b.Property("Value") - .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); - - b.Property("Description") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); + .IsRequired() + .HasColumnType("nvarchar(2048)") + .HasMaxLength(2048); - b.Property("Expiration") - .HasColumnType("datetime2"); + b.HasKey("Id"); - b.HasKey("ApiResourceId", "Type", "Value"); + b.HasIndex("Name", "ProviderName", "ProviderKey"); - b.ToTable("IdentityServerApiSecrets"); + b.ToTable("AbpSettings"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => { b.Property("Id") .ValueGeneratedOnAdd() .HasColumnType("uniqueidentifier"); - b.Property("AbsoluteRefreshTokenLifetime") - .HasColumnType("int"); - - b.Property("AccessTokenLifetime") - .HasColumnType("int"); - - b.Property("AccessTokenType") - .HasColumnType("int"); - - b.Property("AllowAccessTokensViaBrowser") - .HasColumnType("bit"); - - b.Property("AllowOfflineAccess") - .HasColumnType("bit"); - - b.Property("AllowPlainTextPkce") - .HasColumnType("bit"); - - b.Property("AllowRememberConsent") - .HasColumnType("bit"); - - b.Property("AlwaysIncludeUserClaimsInIdToken") - .HasColumnType("bit"); - - b.Property("AlwaysSendClientClaims") - .HasColumnType("bit"); - - b.Property("AuthorizationCodeLifetime") - .HasColumnType("int"); - - b.Property("BackChannelLogoutSessionRequired") - .HasColumnType("bit"); - - b.Property("BackChannelLogoutUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("ClientClaimsPrefix") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ClientId") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ClientName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ClientUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - b.Property("ConcurrencyStamp") .IsConcurrencyToken() .HasColumnName("ConcurrencyStamp") .HasColumnType("nvarchar(max)"); - b.Property("ConsentLifetime") - .HasColumnType("int"); - b.Property("CreationTime") .HasColumnName("CreationTime") .HasColumnType("datetime2"); @@ -873,36 +773,10 @@ namespace AuthServer.Host.Migrations .HasColumnName("DeletionTime") .HasColumnType("datetime2"); - b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); - - b.Property("DeviceCodeLifetime") - .HasColumnType("int"); - - b.Property("EnableLocalLogin") - .HasColumnType("bit"); - - b.Property("Enabled") - .HasColumnType("bit"); - b.Property("ExtraProperties") .HasColumnName("ExtraProperties") .HasColumnType("nvarchar(max)"); - b.Property("FrontChannelLogoutSessionRequired") - .HasColumnType("bit"); - - b.Property("FrontChannelLogoutUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("IdentityTokenLifetime") - .HasColumnType("int"); - - b.Property("IncludeJwtId") - .HasColumnType("bit"); - b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") @@ -917,414 +791,47 @@ namespace AuthServer.Host.Migrations .HasColumnName("LastModifierId") .HasColumnType("uniqueidentifier"); - b.Property("LogoUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("PairWiseSubjectSalt") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ProtocolType") + b.Property("Name") .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("RefreshTokenExpiration") - .HasColumnType("int"); - - b.Property("RefreshTokenUsage") - .HasColumnType("int"); - - b.Property("RequireClientSecret") - .HasColumnType("bit"); - - b.Property("RequireConsent") - .HasColumnType("bit"); - - b.Property("RequirePkce") - .HasColumnType("bit"); - - b.Property("SlidingRefreshTokenLifetime") - .HasColumnType("int"); - - b.Property("UpdateAccessTokenClaimsOnRefresh") - .HasColumnType("bit"); - - b.Property("UserCodeType") - .HasColumnType("nvarchar(100)") - .HasMaxLength(100); - - b.Property("UserSsoLifetime") - .HasColumnType("int"); + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); b.HasKey("Id"); - b.HasIndex("ClientId"); + b.HasIndex("Name"); - b.ToTable("IdentityServerClients"); + b.ToTable("AbpTenants"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => { - b.Property("ClientId") + b.Property("TenantId") .HasColumnType("uniqueidentifier"); - b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + b.Property("Name") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); b.Property("Value") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); + .IsRequired() + .HasColumnType("nvarchar(1024)") + .HasMaxLength(1024); - b.HasKey("ClientId", "Type", "Value"); + b.HasKey("TenantId", "Name"); - b.ToTable("IdentityServerClientClaims"); + b.ToTable("AbpTenantConnectionStrings"); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("Origin") - .HasColumnType("nvarchar(150)") - .HasMaxLength(150); - - b.HasKey("ClientId", "Origin"); - - b.ToTable("IdentityServerClientCorsOrigins"); + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("Actions") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("GrantType") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.HasKey("ClientId", "GrantType"); - - b.ToTable("IdentityServerClientGrantTypes"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("Provider") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("ClientId", "Provider"); - - b.ToTable("IdentityServerClientIdPRestrictions"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("PostLogoutRedirectUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.HasKey("ClientId", "PostLogoutRedirectUri"); - - b.ToTable("IdentityServerClientPostLogoutRedirectUris"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("Key") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.Property("Value") - .IsRequired() - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.HasKey("ClientId", "Key"); - - b.ToTable("IdentityServerClientProperties"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("RedirectUri") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.HasKey("ClientId", "RedirectUri"); - - b.ToTable("IdentityServerClientRedirectUris"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("Scope") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("ClientId", "Scope"); - - b.ToTable("IdentityServerClientScopes"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => - { - b.Property("ClientId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("nvarchar(250)") - .HasMaxLength(250); - - b.Property("Value") - .HasColumnType("nvarchar(4000)") - .HasMaxLength(4000); - - b.Property("Description") - .HasColumnType("nvarchar(2000)") - .HasMaxLength(2000); - - b.Property("Expiration") - .HasColumnType("datetime2"); - - b.HasKey("ClientId", "Type", "Value"); - - b.ToTable("IdentityServerClientSecrets"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => - { - b.Property("Key") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ClientId") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("CreationTime") - .HasColumnType("datetime2"); - - b.Property("Data") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasMaxLength(50000); - - b.Property("Expiration") - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("SubjectId") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Type") - .IsRequired() - .HasColumnType("nvarchar(50)") - .HasMaxLength(50); - - b.HasKey("Key"); - - b.HasIndex("Expiration"); - - b.HasIndex("SubjectId", "ClientId", "Type"); - - b.ToTable("IdentityServerPersistedGrants"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => - { - b.Property("IdentityResourceId") - .HasColumnType("uniqueidentifier"); - - b.Property("Type") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.HasKey("IdentityResourceId", "Type"); - - b.ToTable("IdentityServerIdentityClaims"); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); - - b.Property("Description") - .HasColumnType("nvarchar(1000)") - .HasMaxLength(1000); - - b.Property("DisplayName") - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Emphasize") - .HasColumnType("bit"); - - b.Property("Enabled") - .HasColumnType("bit"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(200)") - .HasMaxLength(200); - - b.Property("Properties") - .HasColumnType("nvarchar(max)"); - - b.Property("Required") - .HasColumnType("bit"); - - b.Property("ShowInDiscoveryDocument") - .HasColumnType("bit"); - - b.HasKey("Id"); - - b.ToTable("IdentityServerIdentityResources"); - }); - - modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ProviderKey") - .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ProviderName") - .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("TenantId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("Id"); - - b.HasIndex("Name", "ProviderName", "ProviderKey"); - - b.ToTable("AbpPermissionGrants"); - }); - - modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ProviderName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("Value") - .IsRequired() - .HasColumnType("nvarchar(2048)") - .HasMaxLength(2048); - - b.HasKey("Id"); - - b.HasIndex("Name", "ProviderName", "ProviderKey"); - - b.ToTable("AbpSettings"); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => - { - b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) - .WithMany("Actions") - .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => { b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) .WithMany("EntityChanges") @@ -1393,128 +900,11 @@ namespace AuthServer.Host.Migrations .IsRequired(); }); - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => - { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) - .WithMany("UserClaims") - .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => - { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) - .WithMany("Scopes") - .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => - { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope", null) - .WithMany("UserClaims") - .HasForeignKey("ApiResourceId", "Name") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => - { - b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) - .WithMany("Secrets") - .HasForeignKey("ApiResourceId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("Claims") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("AllowedCorsOrigins") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("AllowedGrantTypes") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("IdentityProviderRestrictions") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("PostLogoutRedirectUris") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("Properties") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("RedirectUris") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("AllowedScopes") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => - { - b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) - .WithMany("ClientSecrets") - .HasForeignKey("ClientId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); - - modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => { - b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) - .WithMany("UserClaims") - .HasForeignKey("IdentityResourceId") + b.HasOne("Volo.Abp.TenantManagement.Tenant", null) + .WithMany("ConnectionStrings") + .HasForeignKey("TenantId") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); diff --git a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/Migrations/20190527144415_Initial.cs b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/Migrations/20200106082340_Initial.cs similarity index 95% rename from samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/Migrations/20190527144415_Initial.cs rename to samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/Migrations/20200106082340_Initial.cs index 3fedb57cbd..ffe7dc0462 100644 --- a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/Migrations/20190527144415_Initial.cs +++ b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/Migrations/20200106082340_Initial.cs @@ -148,8 +148,8 @@ namespace Acme.BookStore.BookManagement.Migrations NormalizedUserName = table.Column(maxLength: 256, nullable: false), Name = table.Column(maxLength: 64, nullable: true), Surname = table.Column(maxLength: 64, nullable: true), - Email = table.Column(maxLength: 256, nullable: true), - NormalizedEmail = table.Column(maxLength: 256, nullable: true), + Email = table.Column(maxLength: 256, nullable: false), + NormalizedEmail = table.Column(maxLength: 256, nullable: false), EmailConfirmed = table.Column(nullable: false, defaultValue: false), PasswordHash = table.Column(maxLength: 256, nullable: true), SecurityStamp = table.Column(maxLength: 256, nullable: false), @@ -165,6 +165,27 @@ namespace Acme.BookStore.BookManagement.Migrations table.PrimaryKey("PK_AbpUsers", x => x.Id); }); + migrationBuilder.CreateTable( + name: "BmBooks", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + Name = table.Column(maxLength: 128, nullable: false), + Type = table.Column(nullable: false), + PublishDate = table.Column(nullable: false), + Price = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_BmBooks", x => x.Id); + }); + migrationBuilder.CreateTable( name: "AbpAuditLogActions", columns: table => new @@ -424,8 +445,7 @@ namespace Acme.BookStore.BookManagement.Migrations migrationBuilder.CreateIndex( name: "IX_AbpTenants_Name", table: "AbpTenants", - column: "Name", - unique: true); + column: "Name"); migrationBuilder.CreateIndex( name: "IX_AbpUserClaims_UserId", @@ -498,6 +518,9 @@ namespace Acme.BookStore.BookManagement.Migrations migrationBuilder.DropTable( name: "AbpUserTokens"); + migrationBuilder.DropTable( + name: "BmBooks"); + migrationBuilder.DropTable( name: "AbpEntityChanges"); diff --git a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs index 3f0e01c2bb..1a18f42708 100644 --- a/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs +++ b/samples/BookStore-Modular/modules/book-management/host/Acme.BookStore.BookManagement.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs @@ -1,10 +1,10 @@ // using System; +using Acme.BookStore.BookManagement.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Acme.BookStore.BookManagement.EntityFrameworkCore; namespace Acme.BookStore.BookManagement.Migrations { @@ -15,84 +15,156 @@ namespace Acme.BookStore.BookManagement.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.2.4-servicing-10062") + .HasAnnotation("ProductVersion", "3.1.0") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + modelBuilder.Entity("Acme.BookStore.BookManagement.Books.Book", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("Price") + .HasColumnType("real"); + + b.Property("PublishDate") + .HasColumnType("datetime2"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("BmBooks"); + }); + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ApplicationName") .HasColumnName("ApplicationName") + .HasColumnType("nvarchar(96)") .HasMaxLength(96); b.Property("BrowserInfo") .HasColumnName("BrowserInfo") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("ClientId") .HasColumnName("ClientId") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ClientIpAddress") .HasColumnName("ClientIpAddress") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ClientName") .HasColumnName("ClientName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("Comments") .HasColumnName("Comments") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("ConcurrencyStamp"); + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CorrelationId") .HasColumnName("CorrelationId") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Exceptions") .HasColumnName("Exceptions") + .HasColumnType("nvarchar(4000)") .HasMaxLength(4000); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration"); + .HasColumnName("ExecutionDuration") + .HasColumnType("int"); - b.Property("ExecutionTime"); + b.Property("ExecutionTime") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("HttpMethod") .HasColumnName("HttpMethod") + .HasColumnType("nvarchar(16)") .HasMaxLength(16); b.Property("HttpStatusCode") - .HasColumnName("HttpStatusCode"); + .HasColumnName("HttpStatusCode") + .HasColumnType("int"); b.Property("ImpersonatorTenantId") - .HasColumnName("ImpersonatorTenantId"); + .HasColumnName("ImpersonatorTenantId") + .HasColumnType("uniqueidentifier"); b.Property("ImpersonatorUserId") - .HasColumnName("ImpersonatorUserId"); + .HasColumnName("ImpersonatorUserId") + .HasColumnType("uniqueidentifier"); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantName"); + b.Property("TenantName") + .HasColumnType("nvarchar(max)"); b.Property("Url") .HasColumnName("Url") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("UserId") - .HasColumnName("UserId"); + .HasColumnName("UserId") + .HasColumnType("uniqueidentifier"); b.Property("UserName") .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -107,33 +179,42 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId"); + .HasColumnName("AuditLogId") + .HasColumnType("uniqueidentifier"); b.Property("ExecutionDuration") - .HasColumnName("ExecutionDuration"); + .HasColumnName("ExecutionDuration") + .HasColumnType("int"); b.Property("ExecutionTime") - .HasColumnName("ExecutionTime"); + .HasColumnName("ExecutionTime") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("MethodName") .HasColumnName("MethodName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("Parameters") .HasColumnName("Parameters") + .HasColumnType("nvarchar(2000)") .HasMaxLength(2000); b.Property("ServiceName") .HasColumnName("ServiceName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -147,34 +228,43 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AuditLogId") - .HasColumnName("AuditLogId"); + .HasColumnName("AuditLogId") + .HasColumnType("uniqueidentifier"); b.Property("ChangeTime") - .HasColumnName("ChangeTime"); + .HasColumnName("ChangeTime") + .HasColumnType("datetime2"); b.Property("ChangeType") - .HasColumnName("ChangeType"); + .HasColumnName("ChangeType") + .HasColumnType("tinyint"); b.Property("EntityId") .IsRequired() .HasColumnName("EntityId") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("EntityTenantId"); + b.Property("EntityTenantId") + .HasColumnType("uniqueidentifier"); b.Property("EntityTypeFullName") .IsRequired() .HasColumnName("EntityTypeFullName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -188,29 +278,36 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); - b.Property("EntityChangeId"); + b.Property("EntityChangeId") + .HasColumnType("uniqueidentifier"); b.Property("NewValue") .HasColumnName("NewValue") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("OriginalValue") .HasColumnName("OriginalValue") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("PropertyName") .IsRequired() .HasColumnName("PropertyName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("PropertyTypeFullName") .IsRequired() .HasColumnName("PropertyTypeFullName") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -222,35 +319,45 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .IsRequired() .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Description") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); - b.Property("IsStatic"); + b.Property("IsStatic") + .HasColumnType("bit"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Regex") + .HasColumnType("nvarchar(512)") .HasMaxLength(512); b.Property("RegexDescription") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("Required"); + b.Property("Required") + .HasColumnType("bit"); - b.Property("ValueType"); + b.Property("ValueType") + .HasColumnType("int"); b.HasKey("Id"); @@ -260,35 +367,44 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() .IsRequired() .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDefault") - .HasColumnName("IsDefault"); + .HasColumnName("IsDefault") + .HasColumnType("bit"); b.Property("IsPublic") - .HasColumnName("IsPublic"); + .HasColumnName("IsPublic") + .HasColumnType("bit"); b.Property("IsStatic") - .HasColumnName("IsStatic"); + .HasColumnName("IsStatic") + .HasColumnType("bit"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedName") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -300,18 +416,22 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("uniqueidentifier"); b.Property("ClaimType") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -323,105 +443,133 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("AccessFailedCount") .ValueGeneratedOnAdd() .HasColumnName("AccessFailedCount") + .HasColumnType("int") .HasDefaultValue(0); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("Email") + .IsRequired() .HasColumnName("Email") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("EmailConfirmed") .ValueGeneratedOnAdd() .HasColumnName("EmailConfirmed") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("LockoutEnabled") .ValueGeneratedOnAdd() .HasColumnName("LockoutEnabled") + .HasColumnType("bit") .HasDefaultValue(false); - b.Property("LockoutEnd"); + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); b.Property("Name") .HasColumnName("Name") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("NormalizedEmail") + .IsRequired() .HasColumnName("NormalizedEmail") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("NormalizedUserName") .IsRequired() .HasColumnName("NormalizedUserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("PasswordHash") .HasColumnName("PasswordHash") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("PhoneNumber") .HasColumnName("PhoneNumber") + .HasColumnType("nvarchar(16)") .HasMaxLength(16); b.Property("PhoneNumberConfirmed") .ValueGeneratedOnAdd() .HasColumnName("PhoneNumberConfirmed") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("SecurityStamp") .IsRequired() .HasColumnName("SecurityStamp") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("Surname") .HasColumnName("Surname") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("TenantId") - .HasColumnName("TenantId"); + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); b.Property("TwoFactorEnabled") .ValueGeneratedOnAdd() .HasColumnName("TwoFactorEnabled") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("UserName") .IsRequired() .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.HasKey("Id"); @@ -440,18 +588,22 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .HasColumnType("uniqueidentifier"); b.Property("ClaimType") .IsRequired() + .HasColumnType("nvarchar(256)") .HasMaxLength(256); b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -462,19 +614,24 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") .IsRequired() + .HasColumnType("nvarchar(196)") .HasMaxLength(196); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("UserId", "LoginProvider"); @@ -485,11 +642,14 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); - b.Property("RoleId"); + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("UserId", "RoleId"); @@ -500,17 +660,22 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => { - b.Property("UserId"); + b.Property("UserId") + .HasColumnType("uniqueidentifier"); b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Name") + .HasColumnType("nvarchar(128)") .HasMaxLength(128); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); - b.Property("Value"); + b.Property("Value") + .HasColumnType("nvarchar(max)"); b.HasKey("UserId", "LoginProvider", "Name"); @@ -520,21 +685,26 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderName") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.HasKey("Id"); @@ -546,20 +716,25 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(128)") .HasMaxLength(128); b.Property("ProviderKey") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("ProviderName") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Value") .IsRequired() + .HasColumnType("nvarchar(2048)") .HasMaxLength(2048); b.HasKey("Id"); @@ -572,59 +747,72 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => { b.Property("Id") - .ValueGeneratedOnAdd(); + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); b.Property("ConcurrencyStamp") .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp"); + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); b.Property("CreationTime") - .HasColumnName("CreationTime"); + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); b.Property("CreatorId") - .HasColumnName("CreatorId"); + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); b.Property("DeleterId") - .HasColumnName("DeleterId"); + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); b.Property("DeletionTime") - .HasColumnName("DeletionTime"); + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); b.Property("ExtraProperties") - .HasColumnName("ExtraProperties"); + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); b.Property("IsDeleted") .ValueGeneratedOnAdd() .HasColumnName("IsDeleted") + .HasColumnType("bit") .HasDefaultValue(false); b.Property("LastModificationTime") - .HasColumnName("LastModificationTime"); + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); b.Property("LastModifierId") - .HasColumnName("LastModifierId"); + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); b.Property("Name") .IsRequired() + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.HasKey("Id"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("Name"); b.ToTable("AbpTenants"); }); modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => { - b.Property("TenantId"); + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); b.Property("Name") + .HasColumnType("nvarchar(64)") .HasMaxLength(64); b.Property("Value") .IsRequired() + .HasColumnType("nvarchar(1024)") .HasMaxLength(1024); b.HasKey("TenantId", "Name"); @@ -634,79 +822,89 @@ namespace Acme.BookStore.BookManagement.Migrations modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => { - b.HasOne("Volo.Abp.AuditLogging.AuditLog") + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) .WithMany("Actions") .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => { - b.HasOne("Volo.Abp.AuditLogging.AuditLog") + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) .WithMany("EntityChanges") .HasForeignKey("AuditLogId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => { - b.HasOne("Volo.Abp.AuditLogging.EntityChange") + b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) .WithMany("PropertyChanges") .HasForeignKey("EntityChangeId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => { - b.HasOne("Volo.Abp.Identity.IdentityRole") + b.HasOne("Volo.Abp.Identity.IdentityRole", null) .WithMany("Claims") .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Claims") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Logins") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => { - b.HasOne("Volo.Abp.Identity.IdentityRole") + b.HasOne("Volo.Abp.Identity.IdentityRole", null) .WithMany() .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Roles") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => { - b.HasOne("Volo.Abp.Identity.IdentityUser") + b.HasOne("Volo.Abp.Identity.IdentityUser", null) .WithMany("Tokens") .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => { - b.HasOne("Volo.Abp.TenantManagement.Tenant") + b.HasOne("Volo.Abp.TenantManagement.Tenant", null) .WithMany("ConnectionStrings") .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade); + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); }); #pragma warning restore 612, 618 } diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Acme.BookStore.BookManagement.Application.Contracts.csproj b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Acme.BookStore.BookManagement.Application.Contracts.csproj index 4c1d84fa66..d653e6da26 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Acme.BookStore.BookManagement.Application.Contracts.csproj +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application.Contracts/Acme.BookStore.BookManagement.Application.Contracts.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application/Acme.BookStore.BookManagement.Application.csproj b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application/Acme.BookStore.BookManagement.Application.csproj index 45097c877b..83ebec65c8 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application/Acme.BookStore.BookManagement.Application.csproj +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Application/Acme.BookStore.BookManagement.Application.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/Acme.BookStore.BookManagement.Domain.Shared.csproj b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/Acme.BookStore.BookManagement.Domain.Shared.csproj index 377f6df9b3..0c81261452 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/Acme.BookStore.BookManagement.Domain.Shared.csproj +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/Acme.BookStore.BookManagement.Domain.Shared.csproj @@ -1,4 +1,4 @@ - + @@ -8,7 +8,7 @@ - + diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/BookManagementDomainSharedModule.cs b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/BookManagementDomainSharedModule.cs index 7e56eb6f18..0217782b5e 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/BookManagementDomainSharedModule.cs +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain.Shared/BookManagementDomainSharedModule.cs @@ -2,7 +2,7 @@ using Volo.Abp.Localization; using Acme.BookStore.BookManagement.Localization; using Volo.Abp.Localization.ExceptionHandling; -using Volo.Abp.Localization.Resources.AbpValidation; +using Volo.Abp.Validation.Localization; using Volo.Abp.VirtualFileSystem; namespace Acme.BookStore.BookManagement diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/Acme.BookStore.BookManagement.Domain.csproj b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/Acme.BookStore.BookManagement.Domain.csproj index 05176a1c2a..eac420d7f3 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/Acme.BookStore.BookManagement.Domain.csproj +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Domain/Acme.BookStore.BookManagement.Domain.csproj @@ -1,4 +1,4 @@ - + @@ -12,4 +12,4 @@ - \ No newline at end of file + diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/Acme.BookStore.BookManagement.EntityFrameworkCore.csproj b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/Acme.BookStore.BookManagement.EntityFrameworkCore.csproj index 5d0a8647fe..978ac17da5 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/Acme.BookStore.BookManagement.EntityFrameworkCore.csproj +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.EntityFrameworkCore/Acme.BookStore.BookManagement.EntityFrameworkCore.csproj @@ -1,9 +1,9 @@ - + - netstandard2.1 + netstandard2.0 Acme.BookStore.BookManagement diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.HttpApi.Client/Acme.BookStore.BookManagement.HttpApi.Client.csproj b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.HttpApi.Client/Acme.BookStore.BookManagement.HttpApi.Client.csproj index 5b821bf6c3..a2fdfdf62d 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.HttpApi.Client/Acme.BookStore.BookManagement.HttpApi.Client.csproj +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.HttpApi.Client/Acme.BookStore.BookManagement.HttpApi.Client.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.HttpApi/Acme.BookStore.BookManagement.HttpApi.csproj b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.HttpApi/Acme.BookStore.BookManagement.HttpApi.csproj index 191d172412..246074bbdf 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.HttpApi/Acme.BookStore.BookManagement.HttpApi.csproj +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.HttpApi/Acme.BookStore.BookManagement.HttpApi.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.MongoDB/Acme.BookStore.BookManagement.MongoDB.csproj b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.MongoDB/Acme.BookStore.BookManagement.MongoDB.csproj index dd5bf6c2f7..68f65a2c1a 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.MongoDB/Acme.BookStore.BookManagement.MongoDB.csproj +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.MongoDB/Acme.BookStore.BookManagement.MongoDB.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.MongoDB/MongoDB/BookManagementMongoDbContext.cs b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.MongoDB/MongoDB/BookManagementMongoDbContext.cs index 9ee4ae0379..46bd6e13b1 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.MongoDB/MongoDB/BookManagementMongoDbContext.cs +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.MongoDB/MongoDB/BookManagementMongoDbContext.cs @@ -1,4 +1,6 @@ -using Volo.Abp.Data; +using Acme.BookStore.BookManagement.Books; +using MongoDB.Driver; +using Volo.Abp.Data; using Volo.Abp.MongoDB; namespace Acme.BookStore.BookManagement.MongoDB @@ -8,6 +10,8 @@ namespace Acme.BookStore.BookManagement.MongoDB { public static string CollectionPrefix { get; set; } = BookManagementConsts.DefaultDbTablePrefix; + public IMongoCollection Books => Collection(); + /* Add mongo collections here. Example: * public IMongoCollection Questions => Collection(); */ @@ -21,5 +25,6 @@ namespace Acme.BookStore.BookManagement.MongoDB options.CollectionPrefix = CollectionPrefix; }); } + } } \ No newline at end of file diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.MongoDB/MongoDB/BookManagementMongoDbContextExtensions.cs b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.MongoDB/MongoDB/BookManagementMongoDbContextExtensions.cs index f32ad21f3a..76c4f16ff9 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.MongoDB/MongoDB/BookManagementMongoDbContextExtensions.cs +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.MongoDB/MongoDB/BookManagementMongoDbContextExtensions.cs @@ -1,4 +1,5 @@ using System; +using Acme.BookStore.BookManagement.Books; using Volo.Abp; using Volo.Abp.MongoDB; @@ -15,6 +16,11 @@ namespace Acme.BookStore.BookManagement.MongoDB var options = new BookManagementMongoModelBuilderConfigurationOptions(); optionsAction?.Invoke(options); + + builder.Entity(b => + { + b.CollectionName = options.CollectionPrefix + "Books"; + }); } } } \ No newline at end of file diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.MongoDB/MongoDB/BookManagementMongoDbModule.cs b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.MongoDB/MongoDB/BookManagementMongoDbModule.cs index 3f01a07f55..dd1c852c01 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.MongoDB/MongoDB/BookManagementMongoDbModule.cs +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.MongoDB/MongoDB/BookManagementMongoDbModule.cs @@ -14,6 +14,7 @@ namespace Acme.BookStore.BookManagement.MongoDB { context.Services.AddMongoDbContext(options => { + options.AddDefaultRepositories(); /* Add custom repositories here. Example: * options.AddRepository(); */ diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.MongoDB/MongoDB/IBookManagementMongoDbContext.cs b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.MongoDB/MongoDB/IBookManagementMongoDbContext.cs index 5df9220350..5d1c9e6525 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.MongoDB/MongoDB/IBookManagementMongoDbContext.cs +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.MongoDB/MongoDB/IBookManagementMongoDbContext.cs @@ -1,4 +1,6 @@ -using Volo.Abp.Data; +using Acme.BookStore.BookManagement.Books; +using MongoDB.Driver; +using Volo.Abp.Data; using Volo.Abp.MongoDB; namespace Acme.BookStore.BookManagement.MongoDB @@ -6,6 +8,8 @@ namespace Acme.BookStore.BookManagement.MongoDB [ConnectionStringName("BookManagement")] public interface IBookManagementMongoDbContext : IAbpMongoDbContext { + IMongoCollection Books { get; } + /* Define mongo collections here. Example: * IMongoCollection Questions { get; } */ diff --git a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Acme.BookStore.BookManagement.Web.csproj b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Acme.BookStore.BookManagement.Web.csproj index fd2fb9a015..c598fd0932 100644 --- a/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Acme.BookStore.BookManagement.Web.csproj +++ b/samples/BookStore-Modular/modules/book-management/src/Acme.BookStore.BookManagement.Web/Acme.BookStore.BookManagement.Web.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/BookStore-Modular/modules/book-management/test/Acme.BookStore.BookManagement.HttpApi.Client.ConsoleTestApp/Acme.BookStore.BookManagement.HttpApi.Client.ConsoleTestApp.csproj b/samples/BookStore-Modular/modules/book-management/test/Acme.BookStore.BookManagement.HttpApi.Client.ConsoleTestApp/Acme.BookStore.BookManagement.HttpApi.Client.ConsoleTestApp.csproj index 92b2378eef..463c12d939 100644 --- a/samples/BookStore-Modular/modules/book-management/test/Acme.BookStore.BookManagement.HttpApi.Client.ConsoleTestApp/Acme.BookStore.BookManagement.HttpApi.Client.ConsoleTestApp.csproj +++ b/samples/BookStore-Modular/modules/book-management/test/Acme.BookStore.BookManagement.HttpApi.Client.ConsoleTestApp/Acme.BookStore.BookManagement.HttpApi.Client.ConsoleTestApp.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/samples/BookStore-Modular/modules/book-management/test/Acme.BookStore.BookManagement.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs b/samples/BookStore-Modular/modules/book-management/test/Acme.BookStore.BookManagement.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs new file mode 100644 index 0000000000..aec5d0252d --- /dev/null +++ b/samples/BookStore-Modular/modules/book-management/test/Acme.BookStore.BookManagement.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs @@ -0,0 +1,26 @@ +using Microsoft.Extensions.Hosting; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; + +namespace Acme.BookStore.BookManagement +{ + public class ConsoleTestAppHostedService : IHostedService + { + public async Task StartAsync(CancellationToken cancellationToken) + { + using (var application = AbpApplicationFactory.Create()) + { + application.Initialize(); + + var demo = application.ServiceProvider.GetRequiredService(); + await demo.RunAsync(); + + application.Shutdown(); + } + } + + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; + } +} diff --git a/samples/BookStore-Modular/modules/book-management/test/Acme.BookStore.BookManagement.HttpApi.Client.ConsoleTestApp/Program.cs b/samples/BookStore-Modular/modules/book-management/test/Acme.BookStore.BookManagement.HttpApi.Client.ConsoleTestApp/Program.cs index 9b6e256930..f69d97f590 100644 --- a/samples/BookStore-Modular/modules/book-management/test/Acme.BookStore.BookManagement.HttpApi.Client.ConsoleTestApp/Program.cs +++ b/samples/BookStore-Modular/modules/book-management/test/Acme.BookStore.BookManagement.HttpApi.Client.ConsoleTestApp/Program.cs @@ -1,24 +1,21 @@ -using System; +using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp; -using Volo.Abp.Threading; +using Microsoft.Extensions.Hosting; namespace Acme.BookStore.BookManagement { class Program { - static void Main(string[] args) + static async Task Main(string[] args) { - using (var application = AbpApplicationFactory.Create()) - { - application.Initialize(); - - var demo = application.ServiceProvider.GetRequiredService(); - AsyncHelper.RunSync(() => demo.RunAsync()); - - Console.WriteLine("Press ENTER to stop application..."); - Console.ReadLine(); - } + await CreateHostBuilder(args).RunConsoleAsync(); } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureServices((hostContext, services) => + { + services.AddHostedService(); + }); } } diff --git a/samples/BookStore-Modular/modules/book-management/test/Acme.BookStore.BookManagement.TestBase/BookManagementTestBase.cs b/samples/BookStore-Modular/modules/book-management/test/Acme.BookStore.BookManagement.TestBase/BookManagementTestBase.cs index dea660609e..2072748cf2 100644 --- a/samples/BookStore-Modular/modules/book-management/test/Acme.BookStore.BookManagement.TestBase/BookManagementTestBase.cs +++ b/samples/BookStore-Modular/modules/book-management/test/Acme.BookStore.BookManagement.TestBase/BookManagementTestBase.cs @@ -17,26 +17,6 @@ namespace Acme.BookStore.BookManagement options.UseAutofac(); } - protected virtual void WithUnitOfWork(Action action) - { - WithUnitOfWork(new AbpUnitOfWorkOptions(), action); - } - - protected virtual void WithUnitOfWork(AbpUnitOfWorkOptions options, Action action) - { - using (var scope = ServiceProvider.CreateScope()) - { - var uowManager = scope.ServiceProvider.GetRequiredService(); - - using (var uow = uowManager.Begin(options)) - { - action(); - - uow.Complete(); - } - } - } - protected virtual Task WithUnitOfWorkAsync(Func func) { return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); @@ -57,26 +37,6 @@ namespace Acme.BookStore.BookManagement } } - protected virtual TResult WithUnitOfWork(Func func) - { - return WithUnitOfWork(new AbpUnitOfWorkOptions(), func); - } - - protected virtual TResult WithUnitOfWork(AbpUnitOfWorkOptions options, Func func) - { - using (var scope = ServiceProvider.CreateScope()) - { - var uowManager = scope.ServiceProvider.GetRequiredService(); - - using (var uow = uowManager.Begin(options)) - { - var result = func(); - uow.Complete(); - return result; - } - } - } - protected virtual Task WithUnitOfWorkAsync(Func> func) { return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); diff --git a/samples/BookStore/src/Acme.BookStore.Application.Contracts/Acme.BookStore.Application.Contracts.csproj b/samples/BookStore/src/Acme.BookStore.Application.Contracts/Acme.BookStore.Application.Contracts.csproj index ba56e3b6b0..f84f643d0a 100644 --- a/samples/BookStore/src/Acme.BookStore.Application.Contracts/Acme.BookStore.Application.Contracts.csproj +++ b/samples/BookStore/src/Acme.BookStore.Application.Contracts/Acme.BookStore.Application.Contracts.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj b/samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj index be36aa7a2c..ba6fe2cf12 100644 --- a/samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj +++ b/samples/BookStore/src/Acme.BookStore.Application/Acme.BookStore.Application.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/BookStore/src/Acme.BookStore.Application/BookStoreApplicationModule.cs b/samples/BookStore/src/Acme.BookStore.Application/BookStoreApplicationModule.cs index a97917f774..80488be0e8 100644 --- a/samples/BookStore/src/Acme.BookStore.Application/BookStoreApplicationModule.cs +++ b/samples/BookStore/src/Acme.BookStore.Application/BookStoreApplicationModule.cs @@ -1,4 +1,5 @@ -using Volo.Abp.AutoMapper; +using Volo.Abp.Account; +using Volo.Abp.AutoMapper; using Volo.Abp.FeatureManagement; using Volo.Abp.Identity; using Volo.Abp.Modularity; @@ -10,6 +11,7 @@ namespace Acme.BookStore [DependsOn( typeof(BookStoreDomainModule), typeof(BookStoreApplicationContractsModule), + typeof(AbpAccountApplicationModule), typeof(AbpIdentityApplicationModule), typeof(AbpPermissionManagementApplicationModule), typeof(AbpTenantManagementApplicationModule), diff --git a/samples/BookStore/src/Acme.BookStore.DbMigrator/Acme.BookStore.DbMigrator.csproj b/samples/BookStore/src/Acme.BookStore.DbMigrator/Acme.BookStore.DbMigrator.csproj index 6003aa8be2..c77b3ae1eb 100644 --- a/samples/BookStore/src/Acme.BookStore.DbMigrator/Acme.BookStore.DbMigrator.csproj +++ b/samples/BookStore/src/Acme.BookStore.DbMigrator/Acme.BookStore.DbMigrator.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/BookStore/src/Acme.BookStore.DbMigrator/DbMigratorHostedService.cs b/samples/BookStore/src/Acme.BookStore.DbMigrator/DbMigratorHostedService.cs new file mode 100644 index 0000000000..aef3d88bb5 --- /dev/null +++ b/samples/BookStore/src/Acme.BookStore.DbMigrator/DbMigratorHostedService.cs @@ -0,0 +1,34 @@ +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using Acme.BookStore.Data; +using Serilog; +using Volo.Abp; + +namespace Acme.BookStore.DbMigrator +{ + public class DbMigratorHostedService : IHostedService + { + public async Task StartAsync(CancellationToken cancellationToken) + { + using (var application = AbpApplicationFactory.Create(options => + { + options.UseAutofac(); + options.Services.AddLogging(c => c.AddSerilog()); + })) + { + application.Initialize(); + + await application + .ServiceProvider + .GetRequiredService() + .MigrateAsync(); + + application.Shutdown(); + } + } + + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; + } +} diff --git a/samples/BookStore/src/Acme.BookStore.DbMigrator/Program.cs b/samples/BookStore/src/Acme.BookStore.DbMigrator/Program.cs index d3c4034c8a..179c18f4ca 100644 --- a/samples/BookStore/src/Acme.BookStore.DbMigrator/Program.cs +++ b/samples/BookStore/src/Acme.BookStore.DbMigrator/Program.cs @@ -1,39 +1,15 @@ -using System.IO; +using System.IO; +using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; -using Acme.BookStore.Data; +using Microsoft.Extensions.Hosting; using Serilog; using Serilog.Events; -using Volo.Abp; -using Volo.Abp.Threading; namespace Acme.BookStore.DbMigrator { class Program { - static void Main(string[] args) - { - ConfigureLogging(); - - using (var application = AbpApplicationFactory.Create(options => - { - options.UseAutofac(); - options.Services.AddLogging(c => c.AddSerilog()); - })) - { - application.Initialize(); - - AsyncHelper.RunSync( - () => application - .ServiceProvider - .GetRequiredService() - .MigrateAsync() - ); - - application.Shutdown(); - } - } - - private static void ConfigureLogging() + static async Task Main(string[] args) { Log.Logger = new LoggerConfiguration() .MinimumLevel.Information() @@ -48,6 +24,15 @@ namespace Acme.BookStore.DbMigrator .WriteTo.File(Path.Combine(Directory.GetCurrentDirectory(), "Logs/logs.txt")) .WriteTo.Console() .CreateLogger(); + + await CreateHostBuilder(args).RunConsoleAsync(); } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureServices((hostContext, services) => + { + services.AddHostedService(); + }); } } diff --git a/samples/BookStore/src/Acme.BookStore.Domain.Shared/Acme.BookStore.Domain.Shared.csproj b/samples/BookStore/src/Acme.BookStore.Domain.Shared/Acme.BookStore.Domain.Shared.csproj index d9a183a46f..2d65790558 100644 --- a/samples/BookStore/src/Acme.BookStore.Domain.Shared/Acme.BookStore.Domain.Shared.csproj +++ b/samples/BookStore/src/Acme.BookStore.Domain.Shared/Acme.BookStore.Domain.Shared.csproj @@ -1,4 +1,4 @@ - + @@ -23,4 +23,4 @@ - \ No newline at end of file + diff --git a/samples/BookStore/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs b/samples/BookStore/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs index 95241feeb8..6ac58cef9e 100644 --- a/samples/BookStore/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs +++ b/samples/BookStore/src/Acme.BookStore.Domain.Shared/BookStoreDomainSharedModule.cs @@ -5,7 +5,7 @@ using Volo.Abp.FeatureManagement; using Volo.Abp.Identity; using Volo.Abp.IdentityServer; using Volo.Abp.Localization; -using Volo.Abp.Localization.Resources.AbpValidation; +using Volo.Abp.Validation.Localization; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement; using Volo.Abp.SettingManagement; diff --git a/samples/BookStore/src/Acme.BookStore.Domain.Shared/Localization/BookStore/zh-Hans.json b/samples/BookStore/src/Acme.BookStore.Domain.Shared/Localization/BookStore/zh-Hans.json index 86fe3582bb..a79ebcb9a8 100644 --- a/samples/BookStore/src/Acme.BookStore.Domain.Shared/Localization/BookStore/zh-Hans.json +++ b/samples/BookStore/src/Acme.BookStore.Domain.Shared/Localization/BookStore/zh-Hans.json @@ -3,7 +3,7 @@ "texts": { "Menu:Home": "首页", "Welcome": "欢迎", - "LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 cn.abp.io.", + "LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 abp.io.", "Menu:BookStore": "图书商店", "Menu:Books": "图书", "Name": "名称", diff --git a/samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj b/samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj index dc2df7a7fe..583d62d90f 100644 --- a/samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj +++ b/samples/BookStore/src/Acme.BookStore.Domain/Acme.BookStore.Domain.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj index fadc1c8e0c..f8594c4ef9 100644 --- a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj +++ b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Acme.BookStore.EntityFrameworkCore.DbMigrations.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20191018081734_Added_Book_Entity.Designer.cs b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106080124_Initial.Designer.cs similarity index 97% rename from samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20191018081734_Added_Book_Entity.Designer.cs rename to samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106080124_Initial.Designer.cs index 105259f357..75e551cd05 100644 --- a/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20191018081734_Added_Book_Entity.Designer.cs +++ b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106080124_Initial.Designer.cs @@ -10,67 +10,17 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace Acme.BookStore.Migrations { [DbContext(typeof(BookStoreMigrationsDbContext))] - [Migration("20191018081734_Added_Book_Entity")] - partial class Added_Book_Entity + [Migration("20200106080124_Initial")] + partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0") + .HasAnnotation("ProductVersion", "3.1.0") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - modelBuilder.Entity("Acme.BookStore.BookManagement.Books.Book", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("Price") - .HasColumnType("real"); - - b.Property("PublishDate") - .HasColumnType("datetime2"); - - b.Property("Type") - .HasColumnType("int"); - - b.HasKey("Id"); - - b.ToTable("BmBooks"); - }); - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { b.Property("Id") @@ -562,6 +512,7 @@ namespace Acme.BookStore.Migrations .HasColumnType("datetime2"); b.Property("Email") + .IsRequired() .HasColumnName("Email") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -605,6 +556,7 @@ namespace Acme.BookStore.Migrations .HasMaxLength(64); b.Property("NormalizedEmail") + .IsRequired() .HasColumnName("NormalizedEmail") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -1247,6 +1199,70 @@ namespace Acme.BookStore.Migrations b.ToTable("IdentityServerClientSecrets"); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Data") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(50000); + + b.Property("DeviceCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Expiration") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("SubjectId") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("UserCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.HasIndex("UserCode") + .IsUnique(); + + b.ToTable("IdentityServerDeviceFlowCodes"); + }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") @@ -1503,8 +1519,7 @@ namespace Acme.BookStore.Migrations b.HasKey("Id"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("Name"); b.ToTable("AbpTenants"); }); diff --git a/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20191018081718_Initial.cs b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106080124_Initial.cs similarity index 96% rename from samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20191018081718_Initial.cs rename to samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106080124_Initial.cs index cc04cddbf2..de6dd334dd 100644 --- a/samples/BookStore-Modular/application/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20191018081718_Initial.cs +++ b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106080124_Initial.cs @@ -184,8 +184,8 @@ namespace Acme.BookStore.Migrations NormalizedUserName = table.Column(maxLength: 256, nullable: false), Name = table.Column(maxLength: 64, nullable: true), Surname = table.Column(maxLength: 64, nullable: true), - Email = table.Column(maxLength: 256, nullable: true), - NormalizedEmail = table.Column(maxLength: 256, nullable: true), + Email = table.Column(maxLength: 256, nullable: false), + NormalizedEmail = table.Column(maxLength: 256, nullable: false), EmailConfirmed = table.Column(nullable: false, defaultValue: false), PasswordHash = table.Column(maxLength: 256, nullable: true), SecurityStamp = table.Column(maxLength: 256, nullable: false), @@ -283,6 +283,27 @@ namespace Acme.BookStore.Migrations table.PrimaryKey("PK_IdentityServerClients", x => x.Id); }); + migrationBuilder.CreateTable( + name: "IdentityServerDeviceFlowCodes", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + DeviceCode = table.Column(maxLength: 200, nullable: false), + UserCode = table.Column(maxLength: 200, nullable: false), + SubjectId = table.Column(maxLength: 200, nullable: true), + ClientId = table.Column(maxLength: 200, nullable: false), + Expiration = table.Column(nullable: false), + Data = table.Column(maxLength: 50000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerDeviceFlowCodes", x => x.Id); + }); + migrationBuilder.CreateTable( name: "IdentityServerIdentityResources", columns: table => new @@ -866,8 +887,7 @@ namespace Acme.BookStore.Migrations migrationBuilder.CreateIndex( name: "IX_AbpTenants_Name", table: "AbpTenants", - column: "Name", - unique: true); + column: "Name"); migrationBuilder.CreateIndex( name: "IX_AbpUserClaims_UserId", @@ -909,6 +929,23 @@ namespace Acme.BookStore.Migrations table: "IdentityServerClients", column: "ClientId"); + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_DeviceCode", + table: "IdentityServerDeviceFlowCodes", + column: "DeviceCode", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_Expiration", + table: "IdentityServerDeviceFlowCodes", + column: "Expiration"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_UserCode", + table: "IdentityServerDeviceFlowCodes", + column: "UserCode", + unique: true); + migrationBuilder.CreateIndex( name: "IX_IdentityServerPersistedGrants_Expiration", table: "IdentityServerPersistedGrants", @@ -997,6 +1034,9 @@ namespace Acme.BookStore.Migrations migrationBuilder.DropTable( name: "IdentityServerClientSecrets"); + migrationBuilder.DropTable( + name: "IdentityServerDeviceFlowCodes"); + migrationBuilder.DropTable( name: "IdentityServerIdentityClaims"); diff --git a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106080206_Created_Book_Entity.Designer.cs b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106080206_Created_Book_Entity.Designer.cs new file mode 100644 index 0000000000..03c3855341 --- /dev/null +++ b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106080206_Created_Book_Entity.Designer.cs @@ -0,0 +1,1811 @@ +// +using System; +using Acme.BookStore.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace Acme.BookStore.Migrations +{ + [DbContext(typeof(BookStoreMigrationsDbContext))] + [Migration("20200106080206_Created_Book_Entity")] + partial class Created_Book_Entity + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "3.1.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Acme.BookStore.Book", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("Price") + .HasColumnType("real"); + + b.Property("PublishDate") + .HasColumnType("datetime2"); + + b.Property("Type") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("AppBooks"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ApplicationName") + .HasColumnName("ApplicationName") + .HasColumnType("nvarchar(96)") + .HasMaxLength(96); + + b.Property("BrowserInfo") + .HasColumnName("BrowserInfo") + .HasColumnType("nvarchar(512)") + .HasMaxLength(512); + + b.Property("ClientId") + .HasColumnName("ClientId") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ClientIpAddress") + .HasColumnName("ClientIpAddress") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ClientName") + .HasColumnName("ClientName") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("Comments") + .HasColumnName("Comments") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CorrelationId") + .HasColumnName("CorrelationId") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("Exceptions") + .HasColumnName("Exceptions") + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); + + b.Property("ExecutionDuration") + .HasColumnName("ExecutionDuration") + .HasColumnType("int"); + + b.Property("ExecutionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("HttpMethod") + .HasColumnName("HttpMethod") + .HasColumnType("nvarchar(16)") + .HasMaxLength(16); + + b.Property("HttpStatusCode") + .HasColumnName("HttpStatusCode") + .HasColumnType("int"); + + b.Property("ImpersonatorTenantId") + .HasColumnName("ImpersonatorTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("ImpersonatorUserId") + .HasColumnName("ImpersonatorUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantName") + .HasColumnType("nvarchar(max)"); + + b.Property("Url") + .HasColumnName("Url") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("UserId") + .HasColumnName("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserName") + .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("TenantId", "ExecutionTime"); + + b.HasIndex("TenantId", "UserId", "ExecutionTime"); + + b.ToTable("AbpAuditLogs"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnName("AuditLogId") + .HasColumnType("uniqueidentifier"); + + b.Property("ExecutionDuration") + .HasColumnName("ExecutionDuration") + .HasColumnType("int"); + + b.Property("ExecutionTime") + .HasColumnName("ExecutionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("MethodName") + .HasColumnName("MethodName") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("Parameters") + .HasColumnName("Parameters") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.Property("ServiceName") + .HasColumnName("ServiceName") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime"); + + b.ToTable("AbpAuditLogActions"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AuditLogId") + .HasColumnName("AuditLogId") + .HasColumnType("uniqueidentifier"); + + b.Property("ChangeTime") + .HasColumnName("ChangeTime") + .HasColumnType("datetime2"); + + b.Property("ChangeType") + .HasColumnName("ChangeType") + .HasColumnType("tinyint"); + + b.Property("EntityId") + .IsRequired() + .HasColumnName("EntityId") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("EntityTenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("EntityTypeFullName") + .IsRequired() + .HasColumnName("EntityTypeFullName") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("AuditLogId"); + + b.HasIndex("TenantId", "EntityTypeFullName", "EntityId"); + + b.ToTable("AbpEntityChanges"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("EntityChangeId") + .HasColumnType("uniqueidentifier"); + + b.Property("NewValue") + .HasColumnName("NewValue") + .HasColumnType("nvarchar(512)") + .HasMaxLength(512); + + b.Property("OriginalValue") + .HasColumnName("OriginalValue") + .HasColumnType("nvarchar(512)") + .HasMaxLength(512); + + b.Property("PropertyName") + .IsRequired() + .HasColumnName("PropertyName") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("PropertyTypeFullName") + .IsRequired() + .HasColumnName("PropertyTypeFullName") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("EntityChangeId"); + + b.ToTable("AbpEntityPropertyChanges"); + }); + + modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsAbandoned") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("JobArgs") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(1048576); + + b.Property("JobName") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("LastTryTime") + .HasColumnType("datetime2"); + + b.Property("NextTryTime") + .HasColumnType("datetime2"); + + b.Property("Priority") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint") + .HasDefaultValue((byte)15); + + b.Property("TryCount") + .ValueGeneratedOnAdd() + .HasColumnType("smallint") + .HasDefaultValue((short)0); + + b.HasKey("Id"); + + b.HasIndex("IsAbandoned", "NextTryTime"); + + b.ToTable("AbpBackgroundJobs"); + }); + + modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("ProviderKey") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ProviderName") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpFeatureValues"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("Description") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsStatic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("Regex") + .HasColumnType("nvarchar(512)") + .HasMaxLength(512); + + b.Property("RegexDescription") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("Required") + .HasColumnType("bit"); + + b.Property("ValueType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("AbpClaimTypes"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .IsRequired() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDefault") + .HasColumnName("IsDefault") + .HasColumnType("bit"); + + b.Property("IsPublic") + .HasColumnName("IsPublic") + .HasColumnType("bit"); + + b.Property("IsStatic") + .HasColumnName("IsStatic") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("NormalizedName") + .IsRequired() + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName"); + + b.ToTable("AbpRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") + .HasMaxLength(1024); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("AbpRoleClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AccessFailedCount") + .ValueGeneratedOnAdd() + .HasColumnName("AccessFailedCount") + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("Email") + .IsRequired() + .HasColumnName("Email") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("EmailConfirmed") + .ValueGeneratedOnAdd() + .HasColumnName("EmailConfirmed") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("LockoutEnabled") + .ValueGeneratedOnAdd() + .HasColumnName("LockoutEnabled") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LockoutEnd") + .HasColumnType("datetimeoffset"); + + b.Property("Name") + .HasColumnName("Name") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("NormalizedEmail") + .IsRequired() + .HasColumnName("NormalizedEmail") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("NormalizedUserName") + .IsRequired() + .HasColumnName("NormalizedUserName") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("PasswordHash") + .HasColumnName("PasswordHash") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("PhoneNumber") + .HasColumnName("PhoneNumber") + .HasColumnType("nvarchar(16)") + .HasMaxLength(16); + + b.Property("PhoneNumberConfirmed") + .ValueGeneratedOnAdd() + .HasColumnName("PhoneNumberConfirmed") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("SecurityStamp") + .IsRequired() + .HasColumnName("SecurityStamp") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("Surname") + .HasColumnName("Surname") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("TenantId") + .HasColumnName("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("TwoFactorEnabled") + .ValueGeneratedOnAdd() + .HasColumnName("TwoFactorEnabled") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("UserName") + .IsRequired() + .HasColumnName("UserName") + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("Email"); + + b.HasIndex("NormalizedEmail"); + + b.HasIndex("NormalizedUserName"); + + b.HasIndex("UserName"); + + b.ToTable("AbpUsers"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ClaimType") + .IsRequired() + .HasColumnType("nvarchar(256)") + .HasMaxLength(256); + + b.Property("ClaimValue") + .HasColumnType("nvarchar(1024)") + .HasMaxLength(1024); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("AbpUserClaims"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ProviderDisplayName") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("ProviderKey") + .IsRequired() + .HasColumnType("nvarchar(196)") + .HasMaxLength(196); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("UserId", "LoginProvider"); + + b.HasIndex("LoginProvider", "ProviderKey"); + + b.ToTable("AbpUserLogins"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId", "UserId"); + + b.ToTable("AbpUserRoles"); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.Property("LoginProvider") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("Name") + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Value") + .HasColumnType("nvarchar(max)"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("AbpUserTokens"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); + + b.Property("DisplayName") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Properties") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("IdentityServerApiResources"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("ApiResourceId", "Type"); + + b.ToTable("IdentityServerApiClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Description") + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); + + b.Property("DisplayName") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Emphasize") + .HasColumnType("bit"); + + b.Property("Required") + .HasColumnType("bit"); + + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); + + b.HasKey("ApiResourceId", "Name"); + + b.ToTable("IdentityServerApiScopes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Type") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("ApiResourceId", "Name", "Type"); + + b.ToTable("IdentityServerApiScopeClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => + { + b.Property("ApiResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); + + b.Property("Description") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.Property("Expiration") + .HasColumnType("datetime2"); + + b.HasKey("ApiResourceId", "Type", "Value"); + + b.ToTable("IdentityServerApiSecrets"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.Client", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("AbsoluteRefreshTokenLifetime") + .HasColumnType("int"); + + b.Property("AccessTokenLifetime") + .HasColumnType("int"); + + b.Property("AccessTokenType") + .HasColumnType("int"); + + b.Property("AllowAccessTokensViaBrowser") + .HasColumnType("bit"); + + b.Property("AllowOfflineAccess") + .HasColumnType("bit"); + + b.Property("AllowPlainTextPkce") + .HasColumnType("bit"); + + b.Property("AllowRememberConsent") + .HasColumnType("bit"); + + b.Property("AlwaysIncludeUserClaimsInIdToken") + .HasColumnType("bit"); + + b.Property("AlwaysSendClientClaims") + .HasColumnType("bit"); + + b.Property("AuthorizationCodeLifetime") + .HasColumnType("int"); + + b.Property("BackChannelLogoutSessionRequired") + .HasColumnType("bit"); + + b.Property("BackChannelLogoutUri") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.Property("ClientClaimsPrefix") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ClientName") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ClientUri") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("ConsentLifetime") + .HasColumnType("int"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); + + b.Property("DeviceCodeLifetime") + .HasColumnType("int"); + + b.Property("EnableLocalLogin") + .HasColumnType("bit"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("FrontChannelLogoutSessionRequired") + .HasColumnType("bit"); + + b.Property("FrontChannelLogoutUri") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.Property("IdentityTokenLifetime") + .HasColumnType("int"); + + b.Property("IncludeJwtId") + .HasColumnType("bit"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("LogoUri") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.Property("PairWiseSubjectSalt") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ProtocolType") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("RefreshTokenExpiration") + .HasColumnType("int"); + + b.Property("RefreshTokenUsage") + .HasColumnType("int"); + + b.Property("RequireClientSecret") + .HasColumnType("bit"); + + b.Property("RequireConsent") + .HasColumnType("bit"); + + b.Property("RequirePkce") + .HasColumnType("bit"); + + b.Property("SlidingRefreshTokenLifetime") + .HasColumnType("int"); + + b.Property("UpdateAccessTokenClaimsOnRefresh") + .HasColumnType("bit"); + + b.Property("UserCodeType") + .HasColumnType("nvarchar(100)") + .HasMaxLength(100); + + b.Property("UserSsoLifetime") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ClientId"); + + b.ToTable("IdentityServerClients"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.HasKey("ClientId", "Type", "Value"); + + b.ToTable("IdentityServerClientClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Origin") + .HasColumnType("nvarchar(150)") + .HasMaxLength(150); + + b.HasKey("ClientId", "Origin"); + + b.ToTable("IdentityServerClientCorsOrigins"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("GrantType") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.HasKey("ClientId", "GrantType"); + + b.ToTable("IdentityServerClientGrantTypes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Provider") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("ClientId", "Provider"); + + b.ToTable("IdentityServerClientIdPRestrictions"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("PostLogoutRedirectUri") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.HasKey("ClientId", "PostLogoutRedirectUri"); + + b.ToTable("IdentityServerClientPostLogoutRedirectUris"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Key") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.HasKey("ClientId", "Key"); + + b.ToTable("IdentityServerClientProperties"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("RedirectUri") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.HasKey("ClientId", "RedirectUri"); + + b.ToTable("IdentityServerClientRedirectUris"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Scope") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("ClientId", "Scope"); + + b.ToTable("IdentityServerClientScopes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => + { + b.Property("ClientId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("nvarchar(250)") + .HasMaxLength(250); + + b.Property("Value") + .HasColumnType("nvarchar(4000)") + .HasMaxLength(4000); + + b.Property("Description") + .HasColumnType("nvarchar(2000)") + .HasMaxLength(2000); + + b.Property("Expiration") + .HasColumnType("datetime2"); + + b.HasKey("ClientId", "Type", "Value"); + + b.ToTable("IdentityServerClientSecrets"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Data") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(50000); + + b.Property("DeviceCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Expiration") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("SubjectId") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("UserCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.HasIndex("UserCode") + .IsUnique(); + + b.ToTable("IdentityServerDeviceFlowCodes"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => + { + b.Property("Key") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnType("datetime2"); + + b.Property("Data") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(50000); + + b.Property("Expiration") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("SubjectId") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Type") + .IsRequired() + .HasColumnType("nvarchar(50)") + .HasMaxLength(50); + + b.HasKey("Key"); + + b.HasIndex("Expiration"); + + b.HasIndex("SubjectId", "ClientId", "Type"); + + b.ToTable("IdentityServerPersistedGrants"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => + { + b.Property("IdentityResourceId") + .HasColumnType("uniqueidentifier"); + + b.Property("Type") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("IdentityResourceId", "Type"); + + b.ToTable("IdentityServerIdentityClaims"); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(1000)") + .HasMaxLength(1000); + + b.Property("DisplayName") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Emphasize") + .HasColumnType("bit"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Properties") + .HasColumnType("nvarchar(max)"); + + b.Property("Required") + .HasColumnType("bit"); + + b.Property("ShowInDiscoveryDocument") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.ToTable("IdentityServerIdentityResources"); + }); + + modelBuilder.Entity("Volo.Abp.PermissionManagement.PermissionGrant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("ProviderKey") + .IsRequired() + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ProviderName") + .IsRequired() + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpPermissionGrants"); + }); + + modelBuilder.Entity("Volo.Abp.SettingManagement.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(128)") + .HasMaxLength(128); + + b.Property("ProviderKey") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("ProviderName") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(2048)") + .HasMaxLength(2048); + + b.HasKey("Id"); + + b.HasIndex("Name", "ProviderName", "ProviderKey"); + + b.ToTable("AbpSettings"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeleterId") + .HasColumnName("DeleterId") + .HasColumnType("uniqueidentifier"); + + b.Property("DeletionTime") + .HasColumnName("DeletionTime") + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("bit") + .HasDefaultValue(false); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime2"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.HasKey("Id"); + + b.HasIndex("Name"); + + b.ToTable("AbpTenants"); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.Property("TenantId") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .HasColumnType("nvarchar(64)") + .HasMaxLength(64); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(1024)") + .HasMaxLength(1024); + + b.HasKey("TenantId", "Name"); + + b.ToTable("AbpTenantConnectionStrings"); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("Actions") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) + .WithMany("EntityChanges") + .HasForeignKey("AuditLogId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b => + { + b.HasOne("Volo.Abp.AuditLogging.EntityChange", null) + .WithMany("PropertyChanges") + .HasForeignKey("EntityChangeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityRoleClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany("Claims") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserClaim", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Claims") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserLogin", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Logins") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserRole", b => + { + b.HasOne("Volo.Abp.Identity.IdentityRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Roles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.Identity.IdentityUserToken", b => + { + b.HasOne("Volo.Abp.Identity.IdentityUser", null) + .WithMany("Tokens") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiResourceClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("UserClaims") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScope", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("Scopes") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiScopeClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiScope", null) + .WithMany("UserClaims") + .HasForeignKey("ApiResourceId", "Name") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.ApiResources.ApiSecret", b => + { + b.HasOne("Volo.Abp.IdentityServer.ApiResources.ApiResource", null) + .WithMany("Secrets") + .HasForeignKey("ApiResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("Claims") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientCorsOrigin", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("AllowedCorsOrigins") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientGrantType", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("AllowedGrantTypes") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientIdPRestriction", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("IdentityProviderRestrictions") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientPostLogoutRedirectUri", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("PostLogoutRedirectUris") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientProperty", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("Properties") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientRedirectUri", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("RedirectUris") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientScope", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("AllowedScopes") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.Clients.ClientSecret", b => + { + b.HasOne("Volo.Abp.IdentityServer.Clients.Client", null) + .WithMany("ClientSecrets") + .HasForeignKey("ClientId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.IdentityServer.IdentityResources.IdentityClaim", b => + { + b.HasOne("Volo.Abp.IdentityServer.IdentityResources.IdentityResource", null) + .WithMany("UserClaims") + .HasForeignKey("IdentityResourceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => + { + b.HasOne("Volo.Abp.TenantManagement.Tenant", null) + .WithMany("ConnectionStrings") + .HasForeignKey("TenantId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20191018080014_Created_Book_Entity.cs b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106080206_Created_Book_Entity.cs similarity index 100% rename from samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20191018080014_Created_Book_Entity.cs rename to samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20200106080206_Created_Book_Entity.cs diff --git a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/BookStoreMigrationsDbContextModelSnapshot.cs b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/BookStoreMigrationsDbContextModelSnapshot.cs index ced549a616..21087299a6 100644 --- a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/BookStoreMigrationsDbContextModelSnapshot.cs +++ b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/BookStoreMigrationsDbContextModelSnapshot.cs @@ -15,7 +15,7 @@ namespace Acme.BookStore.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0") + .HasAnnotation("ProductVersion", "3.1.0") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); @@ -560,6 +560,7 @@ namespace Acme.BookStore.Migrations .HasColumnType("datetime2"); b.Property("Email") + .IsRequired() .HasColumnName("Email") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -603,6 +604,7 @@ namespace Acme.BookStore.Migrations .HasMaxLength(64); b.Property("NormalizedEmail") + .IsRequired() .HasColumnName("NormalizedEmail") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -1245,6 +1247,70 @@ namespace Acme.BookStore.Migrations b.ToTable("IdentityServerClientSecrets"); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Data") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(50000); + + b.Property("DeviceCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Expiration") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("SubjectId") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("UserCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.HasIndex("UserCode") + .IsUnique(); + + b.ToTable("IdentityServerDeviceFlowCodes"); + }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") @@ -1501,8 +1567,7 @@ namespace Acme.BookStore.Migrations b.HasKey("Id"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("Name"); b.ToTable("AbpTenants"); }); diff --git a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj index 028b89d57a..f26ef0b75c 100644 --- a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj +++ b/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore/Acme.BookStore.EntityFrameworkCore.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/BookStore/src/Acme.BookStore.HttpApi.Client/Acme.BookStore.HttpApi.Client.csproj b/samples/BookStore/src/Acme.BookStore.HttpApi.Client/Acme.BookStore.HttpApi.Client.csproj index 1aaceaa8aa..c7f51afe34 100644 --- a/samples/BookStore/src/Acme.BookStore.HttpApi.Client/Acme.BookStore.HttpApi.Client.csproj +++ b/samples/BookStore/src/Acme.BookStore.HttpApi.Client/Acme.BookStore.HttpApi.Client.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/BookStore/src/Acme.BookStore.HttpApi/Acme.BookStore.HttpApi.csproj b/samples/BookStore/src/Acme.BookStore.HttpApi/Acme.BookStore.HttpApi.csproj index 1b664dea92..c9b3502524 100644 --- a/samples/BookStore/src/Acme.BookStore.HttpApi/Acme.BookStore.HttpApi.csproj +++ b/samples/BookStore/src/Acme.BookStore.HttpApi/Acme.BookStore.HttpApi.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj b/samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj index 153b6f38e3..61c73a3da8 100644 --- a/samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj +++ b/samples/BookStore/src/Acme.BookStore.Web/Acme.BookStore.Web.csproj @@ -1,4 +1,4 @@ - + @@ -23,9 +23,9 @@ - + - + diff --git a/samples/BookStore/test/Acme.BookStore.Application.Tests/Acme.BookStore.Application.Tests.csproj b/samples/BookStore/test/Acme.BookStore.Application.Tests/Acme.BookStore.Application.Tests.csproj index 01f80db3bd..ae2a3df88f 100644 --- a/samples/BookStore/test/Acme.BookStore.Application.Tests/Acme.BookStore.Application.Tests.csproj +++ b/samples/BookStore/test/Acme.BookStore.Application.Tests/Acme.BookStore.Application.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/BookStore/test/Acme.BookStore.Domain.Tests/Acme.BookStore.Domain.Tests.csproj b/samples/BookStore/test/Acme.BookStore.Domain.Tests/Acme.BookStore.Domain.Tests.csproj index af4d93ed74..1f9b387058 100644 --- a/samples/BookStore/test/Acme.BookStore.Domain.Tests/Acme.BookStore.Domain.Tests.csproj +++ b/samples/BookStore/test/Acme.BookStore.Domain.Tests/Acme.BookStore.Domain.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/BookStore/test/Acme.BookStore.EntityFrameworkCore.Tests/Acme.BookStore.EntityFrameworkCore.Tests.csproj b/samples/BookStore/test/Acme.BookStore.EntityFrameworkCore.Tests/Acme.BookStore.EntityFrameworkCore.Tests.csproj index b326d0ccf5..dd2137ad06 100644 --- a/samples/BookStore/test/Acme.BookStore.EntityFrameworkCore.Tests/Acme.BookStore.EntityFrameworkCore.Tests.csproj +++ b/samples/BookStore/test/Acme.BookStore.EntityFrameworkCore.Tests/Acme.BookStore.EntityFrameworkCore.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/BookStore/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj b/samples/BookStore/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj index 7620a76c90..c4387a063f 100644 --- a/samples/BookStore/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj +++ b/samples/BookStore/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Acme.BookStore.HttpApi.Client.ConsoleTestApp.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/samples/BookStore/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs b/samples/BookStore/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs new file mode 100644 index 0000000000..e41ee7ed31 --- /dev/null +++ b/samples/BookStore/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs @@ -0,0 +1,26 @@ +using Microsoft.Extensions.Hosting; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; + +namespace Acme.BookStore.HttpApi.Client.ConsoleTestApp +{ + public class ConsoleTestAppHostedService : IHostedService + { + public async Task StartAsync(CancellationToken cancellationToken) + { + using (var application = AbpApplicationFactory.Create()) + { + application.Initialize(); + + var demo = application.ServiceProvider.GetRequiredService(); + await demo.RunAsync(); + + application.Shutdown(); + } + } + + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; + } +} diff --git a/samples/BookStore/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Program.cs b/samples/BookStore/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Program.cs index ecef29d963..7d8265158b 100644 --- a/samples/BookStore/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Program.cs +++ b/samples/BookStore/test/Acme.BookStore.HttpApi.Client.ConsoleTestApp/Program.cs @@ -1,24 +1,21 @@ -using System; +using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp; -using Volo.Abp.Threading; +using Microsoft.Extensions.Hosting; namespace Acme.BookStore.HttpApi.Client.ConsoleTestApp { class Program { - static void Main(string[] args) + static async Task Main(string[] args) { - using (var application = AbpApplicationFactory.Create()) - { - application.Initialize(); - - var demo = application.ServiceProvider.GetRequiredService(); - AsyncHelper.RunSync(() => demo.RunAsync()); - - Console.WriteLine("Press ENTER to stop application..."); - Console.ReadLine(); - } + await CreateHostBuilder(args).RunConsoleAsync(); } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureServices((hostContext, services) => + { + services.AddHostedService(); + }); } } diff --git a/samples/BookStore/test/Acme.BookStore.TestBase/Acme.BookStore.TestBase.csproj b/samples/BookStore/test/Acme.BookStore.TestBase/Acme.BookStore.TestBase.csproj index 516e550f01..48bcc4510d 100644 --- a/samples/BookStore/test/Acme.BookStore.TestBase/Acme.BookStore.TestBase.csproj +++ b/samples/BookStore/test/Acme.BookStore.TestBase/Acme.BookStore.TestBase.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/BookStore/test/Acme.BookStore.TestBase/BookStoreTestBase.cs b/samples/BookStore/test/Acme.BookStore.TestBase/BookStoreTestBase.cs index 0f44532e7a..979c344f93 100644 --- a/samples/BookStore/test/Acme.BookStore.TestBase/BookStoreTestBase.cs +++ b/samples/BookStore/test/Acme.BookStore.TestBase/BookStoreTestBase.cs @@ -18,26 +18,6 @@ namespace Acme.BookStore options.UseAutofac(); } - protected virtual void WithUnitOfWork(Action action) - { - WithUnitOfWork(new AbpUnitOfWorkOptions(), action); - } - - protected virtual void WithUnitOfWork(AbpUnitOfWorkOptions options, Action action) - { - using (var scope = ServiceProvider.CreateScope()) - { - var uowManager = scope.ServiceProvider.GetRequiredService(); - - using (var uow = uowManager.Begin(options)) - { - action(); - - uow.Complete(); - } - } - } - protected virtual Task WithUnitOfWorkAsync(Func func) { return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); @@ -58,26 +38,6 @@ namespace Acme.BookStore } } - protected virtual TResult WithUnitOfWork(Func func) - { - return WithUnitOfWork(new AbpUnitOfWorkOptions(), func); - } - - protected virtual TResult WithUnitOfWork(AbpUnitOfWorkOptions options, Func func) - { - using (var scope = ServiceProvider.CreateScope()) - { - var uowManager = scope.ServiceProvider.GetRequiredService(); - - using (var uow = uowManager.Begin(options)) - { - var result = func(); - uow.Complete(); - return result; - } - } - } - protected virtual Task WithUnitOfWorkAsync(Func> func) { return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); diff --git a/samples/BookStore/test/Acme.BookStore.Web.Tests/Acme.BookStore.Web.Tests.csproj b/samples/BookStore/test/Acme.BookStore.Web.Tests/Acme.BookStore.Web.Tests.csproj index 30f34edd0d..bcf4331704 100644 --- a/samples/BookStore/test/Acme.BookStore.Web.Tests/Acme.BookStore.Web.Tests.csproj +++ b/samples/BookStore/test/Acme.BookStore.Web.Tests/Acme.BookStore.Web.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/BookStore/test/Acme.BookStore.Web.Tests/BookStoreWebTestModule.cs b/samples/BookStore/test/Acme.BookStore.Web.Tests/BookStoreWebTestModule.cs index 166ade18d6..440fadf865 100644 --- a/samples/BookStore/test/Acme.BookStore.Web.Tests/BookStoreWebTestModule.cs +++ b/samples/BookStore/test/Acme.BookStore.Web.Tests/BookStoreWebTestModule.cs @@ -12,7 +12,7 @@ using Acme.BookStore.Web.Menus; using Volo.Abp; using Volo.Abp.AspNetCore.TestBase; using Volo.Abp.Localization; -using Volo.Abp.Localization.Resources.AbpValidation; +using Volo.Abp.Validation.Localization; using Volo.Abp.Modularity; using Volo.Abp.UI.Navigation; diff --git a/samples/DashboardDemo/src/DashboardDemo.Application.Contracts/DashboardDemo.Application.Contracts.csproj b/samples/DashboardDemo/src/DashboardDemo.Application.Contracts/DashboardDemo.Application.Contracts.csproj index eac22963c5..bcbbde642b 100644 --- a/samples/DashboardDemo/src/DashboardDemo.Application.Contracts/DashboardDemo.Application.Contracts.csproj +++ b/samples/DashboardDemo/src/DashboardDemo.Application.Contracts/DashboardDemo.Application.Contracts.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/DashboardDemo/src/DashboardDemo.Application/DashboardDemo.Application.csproj b/samples/DashboardDemo/src/DashboardDemo.Application/DashboardDemo.Application.csproj index 4161f43bf5..f47f8bac12 100644 --- a/samples/DashboardDemo/src/DashboardDemo.Application/DashboardDemo.Application.csproj +++ b/samples/DashboardDemo/src/DashboardDemo.Application/DashboardDemo.Application.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/DashboardDemo/src/DashboardDemo.DbMigrator/DashboardDemo.DbMigrator.csproj b/samples/DashboardDemo/src/DashboardDemo.DbMigrator/DashboardDemo.DbMigrator.csproj index cb4d1b1604..469d5a2773 100644 --- a/samples/DashboardDemo/src/DashboardDemo.DbMigrator/DashboardDemo.DbMigrator.csproj +++ b/samples/DashboardDemo/src/DashboardDemo.DbMigrator/DashboardDemo.DbMigrator.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/DashboardDemo/src/DashboardDemo.DbMigrator/DbMigratorHostedService.cs b/samples/DashboardDemo/src/DashboardDemo.DbMigrator/DbMigratorHostedService.cs new file mode 100644 index 0000000000..dcfd612adc --- /dev/null +++ b/samples/DashboardDemo/src/DashboardDemo.DbMigrator/DbMigratorHostedService.cs @@ -0,0 +1,34 @@ +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using DashboardDemo.Data; +using Serilog; +using Volo.Abp; + +namespace DashboardDemo.DbMigrator +{ + public class DbMigratorHostedService : IHostedService + { + public async Task StartAsync(CancellationToken cancellationToken) + { + using (var application = AbpApplicationFactory.Create(options => + { + options.UseAutofac(); + options.Services.AddLogging(c => c.AddSerilog()); + })) + { + application.Initialize(); + + await application + .ServiceProvider + .GetRequiredService() + .MigrateAsync(); + + application.Shutdown(); + } + } + + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; + } +} diff --git a/samples/DashboardDemo/src/DashboardDemo.DbMigrator/Program.cs b/samples/DashboardDemo/src/DashboardDemo.DbMigrator/Program.cs index 3cfe1b680a..ccfa70ea32 100644 --- a/samples/DashboardDemo/src/DashboardDemo.DbMigrator/Program.cs +++ b/samples/DashboardDemo/src/DashboardDemo.DbMigrator/Program.cs @@ -1,39 +1,15 @@ -using System.IO; +using System.IO; +using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; -using DashboardDemo.Data; +using Microsoft.Extensions.Hosting; using Serilog; using Serilog.Events; -using Volo.Abp; -using Volo.Abp.Threading; namespace DashboardDemo.DbMigrator { class Program { - static void Main(string[] args) - { - ConfigureLogging(); - - using (var application = AbpApplicationFactory.Create(options => - { - options.UseAutofac(); - options.Services.AddLogging(c => c.AddSerilog()); - })) - { - application.Initialize(); - - AsyncHelper.RunSync( - () => application - .ServiceProvider - .GetRequiredService() - .MigrateAsync() - ); - - application.Shutdown(); - } - } - - private static void ConfigureLogging() + static async Task Main(string[] args) { Log.Logger = new LoggerConfiguration() .MinimumLevel.Information() @@ -48,6 +24,15 @@ namespace DashboardDemo.DbMigrator .WriteTo.File(Path.Combine(Directory.GetCurrentDirectory(), "Logs/logs.txt")) .WriteTo.Console() .CreateLogger(); + + await CreateHostBuilder(args).RunConsoleAsync(); } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureServices((hostContext, services) => + { + services.AddHostedService(); + }); } } diff --git a/samples/DashboardDemo/src/DashboardDemo.Domain.Shared/DashboardDemo.Domain.Shared.csproj b/samples/DashboardDemo/src/DashboardDemo.Domain.Shared/DashboardDemo.Domain.Shared.csproj index 81bef40c1b..287fa93f57 100644 --- a/samples/DashboardDemo/src/DashboardDemo.Domain.Shared/DashboardDemo.Domain.Shared.csproj +++ b/samples/DashboardDemo/src/DashboardDemo.Domain.Shared/DashboardDemo.Domain.Shared.csproj @@ -1,4 +1,4 @@ - + @@ -23,4 +23,4 @@ - \ No newline at end of file + diff --git a/samples/DashboardDemo/src/DashboardDemo.Domain.Shared/DashboardDemoDomainSharedModule.cs b/samples/DashboardDemo/src/DashboardDemo.Domain.Shared/DashboardDemoDomainSharedModule.cs index ad6d56630b..dd9c1833ca 100644 --- a/samples/DashboardDemo/src/DashboardDemo.Domain.Shared/DashboardDemoDomainSharedModule.cs +++ b/samples/DashboardDemo/src/DashboardDemo.Domain.Shared/DashboardDemoDomainSharedModule.cs @@ -5,7 +5,7 @@ using Volo.Abp.FeatureManagement; using Volo.Abp.Identity; using Volo.Abp.IdentityServer; using Volo.Abp.Localization; -using Volo.Abp.Localization.Resources.AbpValidation; +using Volo.Abp.Validation.Localization; using Volo.Abp.Modularity; using Volo.Abp.PermissionManagement; using Volo.Abp.SettingManagement; diff --git a/samples/DashboardDemo/src/DashboardDemo.Domain.Shared/Localization/DashboardDemo/zh-Hans.json b/samples/DashboardDemo/src/DashboardDemo.Domain.Shared/Localization/DashboardDemo/zh-Hans.json index 459fc0fefd..23790bde50 100644 --- a/samples/DashboardDemo/src/DashboardDemo.Domain.Shared/Localization/DashboardDemo/zh-Hans.json +++ b/samples/DashboardDemo/src/DashboardDemo.Domain.Shared/Localization/DashboardDemo/zh-Hans.json @@ -3,6 +3,6 @@ "texts": { "Menu:Home": "首页", "Welcome": "欢迎", - "LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 cn.abp.io." + "LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 abp.io." } } \ No newline at end of file diff --git a/samples/DashboardDemo/src/DashboardDemo.Domain/DashboardDemo.Domain.csproj b/samples/DashboardDemo/src/DashboardDemo.Domain/DashboardDemo.Domain.csproj index 4d8065b1d4..efc5e29899 100644 --- a/samples/DashboardDemo/src/DashboardDemo.Domain/DashboardDemo.Domain.csproj +++ b/samples/DashboardDemo/src/DashboardDemo.Domain/DashboardDemo.Domain.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/DashboardDemo.EntityFrameworkCore.DbMigrations.csproj b/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/DashboardDemo.EntityFrameworkCore.DbMigrations.csproj index e276e160a2..c43e011cba 100644 --- a/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/DashboardDemo.EntityFrameworkCore.DbMigrations.csproj +++ b/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/DashboardDemo.EntityFrameworkCore.DbMigrations.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20191018081444_Initial.Designer.cs b/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20200106080501_Initial.Designer.cs similarity index 96% rename from samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20191018081444_Initial.Designer.cs rename to samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20200106080501_Initial.Designer.cs index 7cf33e8b48..f53d59ada9 100644 --- a/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20191018081444_Initial.Designer.cs +++ b/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20200106080501_Initial.Designer.cs @@ -10,14 +10,14 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion; namespace DashboardDemo.Migrations { [DbContext(typeof(DashboardDemoMigrationsDbContext))] - [Migration("20191018081444_Initial")] + [Migration("20200106080501_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0") + .HasAnnotation("ProductVersion", "3.1.0") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); @@ -512,6 +512,7 @@ namespace DashboardDemo.Migrations .HasColumnType("datetime2"); b.Property("Email") + .IsRequired() .HasColumnName("Email") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -555,6 +556,7 @@ namespace DashboardDemo.Migrations .HasMaxLength(64); b.Property("NormalizedEmail") + .IsRequired() .HasColumnName("NormalizedEmail") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -1197,6 +1199,70 @@ namespace DashboardDemo.Migrations b.ToTable("IdentityServerClientSecrets"); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Data") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(50000); + + b.Property("DeviceCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Expiration") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("SubjectId") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("UserCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.HasIndex("UserCode") + .IsUnique(); + + b.ToTable("IdentityServerDeviceFlowCodes"); + }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") @@ -1453,8 +1519,7 @@ namespace DashboardDemo.Migrations b.HasKey("Id"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("Name"); b.ToTable("AbpTenants"); }); diff --git a/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20191018081444_Initial.cs b/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20200106080501_Initial.cs similarity index 96% rename from samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20191018081444_Initial.cs rename to samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20200106080501_Initial.cs index c866a45920..26ee745e1e 100644 --- a/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20191018081444_Initial.cs +++ b/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/20200106080501_Initial.cs @@ -184,8 +184,8 @@ namespace DashboardDemo.Migrations NormalizedUserName = table.Column(maxLength: 256, nullable: false), Name = table.Column(maxLength: 64, nullable: true), Surname = table.Column(maxLength: 64, nullable: true), - Email = table.Column(maxLength: 256, nullable: true), - NormalizedEmail = table.Column(maxLength: 256, nullable: true), + Email = table.Column(maxLength: 256, nullable: false), + NormalizedEmail = table.Column(maxLength: 256, nullable: false), EmailConfirmed = table.Column(nullable: false, defaultValue: false), PasswordHash = table.Column(maxLength: 256, nullable: true), SecurityStamp = table.Column(maxLength: 256, nullable: false), @@ -283,6 +283,27 @@ namespace DashboardDemo.Migrations table.PrimaryKey("PK_IdentityServerClients", x => x.Id); }); + migrationBuilder.CreateTable( + name: "IdentityServerDeviceFlowCodes", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + DeviceCode = table.Column(maxLength: 200, nullable: false), + UserCode = table.Column(maxLength: 200, nullable: false), + SubjectId = table.Column(maxLength: 200, nullable: true), + ClientId = table.Column(maxLength: 200, nullable: false), + Expiration = table.Column(nullable: false), + Data = table.Column(maxLength: 50000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerDeviceFlowCodes", x => x.Id); + }); + migrationBuilder.CreateTable( name: "IdentityServerIdentityResources", columns: table => new @@ -866,8 +887,7 @@ namespace DashboardDemo.Migrations migrationBuilder.CreateIndex( name: "IX_AbpTenants_Name", table: "AbpTenants", - column: "Name", - unique: true); + column: "Name"); migrationBuilder.CreateIndex( name: "IX_AbpUserClaims_UserId", @@ -909,6 +929,23 @@ namespace DashboardDemo.Migrations table: "IdentityServerClients", column: "ClientId"); + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_DeviceCode", + table: "IdentityServerDeviceFlowCodes", + column: "DeviceCode", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_Expiration", + table: "IdentityServerDeviceFlowCodes", + column: "Expiration"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_UserCode", + table: "IdentityServerDeviceFlowCodes", + column: "UserCode", + unique: true); + migrationBuilder.CreateIndex( name: "IX_IdentityServerPersistedGrants_Expiration", table: "IdentityServerPersistedGrants", @@ -997,6 +1034,9 @@ namespace DashboardDemo.Migrations migrationBuilder.DropTable( name: "IdentityServerClientSecrets"); + migrationBuilder.DropTable( + name: "IdentityServerDeviceFlowCodes"); + migrationBuilder.DropTable( name: "IdentityServerIdentityClaims"); diff --git a/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/DashboardDemoMigrationsDbContextModelSnapshot.cs b/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/DashboardDemoMigrationsDbContextModelSnapshot.cs index 7849c5b198..c4f257e7d0 100644 --- a/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/DashboardDemoMigrationsDbContextModelSnapshot.cs +++ b/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore.DbMigrations/Migrations/DashboardDemoMigrationsDbContextModelSnapshot.cs @@ -15,7 +15,7 @@ namespace DashboardDemo.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0") + .HasAnnotation("ProductVersion", "3.1.0") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); @@ -510,6 +510,7 @@ namespace DashboardDemo.Migrations .HasColumnType("datetime2"); b.Property("Email") + .IsRequired() .HasColumnName("Email") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -553,6 +554,7 @@ namespace DashboardDemo.Migrations .HasMaxLength(64); b.Property("NormalizedEmail") + .IsRequired() .HasColumnName("NormalizedEmail") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -1195,6 +1197,70 @@ namespace DashboardDemo.Migrations b.ToTable("IdentityServerClientSecrets"); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Data") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(50000); + + b.Property("DeviceCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Expiration") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("SubjectId") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("UserCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.HasIndex("UserCode") + .IsUnique(); + + b.ToTable("IdentityServerDeviceFlowCodes"); + }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") @@ -1451,8 +1517,7 @@ namespace DashboardDemo.Migrations b.HasKey("Id"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("Name"); b.ToTable("AbpTenants"); }); diff --git a/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore/DashboardDemo.EntityFrameworkCore.csproj b/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore/DashboardDemo.EntityFrameworkCore.csproj index 7095ccc19e..4bf2843c3c 100644 --- a/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore/DashboardDemo.EntityFrameworkCore.csproj +++ b/samples/DashboardDemo/src/DashboardDemo.EntityFrameworkCore/DashboardDemo.EntityFrameworkCore.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/DashboardDemo/src/DashboardDemo.HttpApi.Client/DashboardDemo.HttpApi.Client.csproj b/samples/DashboardDemo/src/DashboardDemo.HttpApi.Client/DashboardDemo.HttpApi.Client.csproj index 658ec3f724..4e61bfd981 100644 --- a/samples/DashboardDemo/src/DashboardDemo.HttpApi.Client/DashboardDemo.HttpApi.Client.csproj +++ b/samples/DashboardDemo/src/DashboardDemo.HttpApi.Client/DashboardDemo.HttpApi.Client.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/DashboardDemo/src/DashboardDemo.HttpApi/DashboardDemo.HttpApi.csproj b/samples/DashboardDemo/src/DashboardDemo.HttpApi/DashboardDemo.HttpApi.csproj index 2afac6c2b8..b4887240c1 100644 --- a/samples/DashboardDemo/src/DashboardDemo.HttpApi/DashboardDemo.HttpApi.csproj +++ b/samples/DashboardDemo/src/DashboardDemo.HttpApi/DashboardDemo.HttpApi.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/DashboardDemo/src/DashboardDemo.Web/DashboardDemo.Web.csproj b/samples/DashboardDemo/src/DashboardDemo.Web/DashboardDemo.Web.csproj index 466a7359bc..eb2ba910aa 100644 --- a/samples/DashboardDemo/src/DashboardDemo.Web/DashboardDemo.Web.csproj +++ b/samples/DashboardDemo/src/DashboardDemo.Web/DashboardDemo.Web.csproj @@ -1,4 +1,4 @@ - + @@ -31,9 +31,9 @@ - + - + diff --git a/samples/DashboardDemo/test/DashboardDemo.Application.Tests/DashboardDemo.Application.Tests.csproj b/samples/DashboardDemo/test/DashboardDemo.Application.Tests/DashboardDemo.Application.Tests.csproj index 66ac6f7698..06eddb4a01 100644 --- a/samples/DashboardDemo/test/DashboardDemo.Application.Tests/DashboardDemo.Application.Tests.csproj +++ b/samples/DashboardDemo/test/DashboardDemo.Application.Tests/DashboardDemo.Application.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/DashboardDemo/test/DashboardDemo.Domain.Tests/DashboardDemo.Domain.Tests.csproj b/samples/DashboardDemo/test/DashboardDemo.Domain.Tests/DashboardDemo.Domain.Tests.csproj index 28f2ae7aee..ad14581a96 100644 --- a/samples/DashboardDemo/test/DashboardDemo.Domain.Tests/DashboardDemo.Domain.Tests.csproj +++ b/samples/DashboardDemo/test/DashboardDemo.Domain.Tests/DashboardDemo.Domain.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/DashboardDemo/test/DashboardDemo.EntityFrameworkCore.Tests/DashboardDemo.EntityFrameworkCore.Tests.csproj b/samples/DashboardDemo/test/DashboardDemo.EntityFrameworkCore.Tests/DashboardDemo.EntityFrameworkCore.Tests.csproj index 2d4e5d409e..3ee3d1e46f 100644 --- a/samples/DashboardDemo/test/DashboardDemo.EntityFrameworkCore.Tests/DashboardDemo.EntityFrameworkCore.Tests.csproj +++ b/samples/DashboardDemo/test/DashboardDemo.EntityFrameworkCore.Tests/DashboardDemo.EntityFrameworkCore.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/DashboardDemo/test/DashboardDemo.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs b/samples/DashboardDemo/test/DashboardDemo.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs new file mode 100644 index 0000000000..b10baf1daa --- /dev/null +++ b/samples/DashboardDemo/test/DashboardDemo.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs @@ -0,0 +1,26 @@ +using Microsoft.Extensions.Hosting; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; + +namespace DashboardDemo.HttpApi.Client.ConsoleTestApp +{ + public class ConsoleTestAppHostedService : IHostedService + { + public async Task StartAsync(CancellationToken cancellationToken) + { + using (var application = AbpApplicationFactory.Create()) + { + application.Initialize(); + + var demo = application.ServiceProvider.GetRequiredService(); + await demo.RunAsync(); + + application.Shutdown(); + } + } + + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; + } +} diff --git a/samples/DashboardDemo/test/DashboardDemo.HttpApi.Client.ConsoleTestApp/DashboardDemo.HttpApi.Client.ConsoleTestApp.csproj b/samples/DashboardDemo/test/DashboardDemo.HttpApi.Client.ConsoleTestApp/DashboardDemo.HttpApi.Client.ConsoleTestApp.csproj index ad5b3b7caa..ea3b5f2a53 100644 --- a/samples/DashboardDemo/test/DashboardDemo.HttpApi.Client.ConsoleTestApp/DashboardDemo.HttpApi.Client.ConsoleTestApp.csproj +++ b/samples/DashboardDemo/test/DashboardDemo.HttpApi.Client.ConsoleTestApp/DashboardDemo.HttpApi.Client.ConsoleTestApp.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/samples/DashboardDemo/test/DashboardDemo.HttpApi.Client.ConsoleTestApp/Program.cs b/samples/DashboardDemo/test/DashboardDemo.HttpApi.Client.ConsoleTestApp/Program.cs index c48298d7d4..7ba0e8151e 100644 --- a/samples/DashboardDemo/test/DashboardDemo.HttpApi.Client.ConsoleTestApp/Program.cs +++ b/samples/DashboardDemo/test/DashboardDemo.HttpApi.Client.ConsoleTestApp/Program.cs @@ -1,24 +1,21 @@ -using System; +using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp; -using Volo.Abp.Threading; +using Microsoft.Extensions.Hosting; namespace DashboardDemo.HttpApi.Client.ConsoleTestApp { class Program { - static void Main(string[] args) + static async Task Main(string[] args) { - using (var application = AbpApplicationFactory.Create()) - { - application.Initialize(); - - var demo = application.ServiceProvider.GetRequiredService(); - AsyncHelper.RunSync(() => demo.RunAsync()); - - Console.WriteLine("Press ENTER to stop application..."); - Console.ReadLine(); - } + await CreateHostBuilder(args).RunConsoleAsync(); } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureServices((hostContext, services) => + { + services.AddHostedService(); + }); } } diff --git a/samples/DashboardDemo/test/DashboardDemo.TestBase/DashboardDemo.TestBase.csproj b/samples/DashboardDemo/test/DashboardDemo.TestBase/DashboardDemo.TestBase.csproj index fc0fe296f5..7f010a8d7b 100644 --- a/samples/DashboardDemo/test/DashboardDemo.TestBase/DashboardDemo.TestBase.csproj +++ b/samples/DashboardDemo/test/DashboardDemo.TestBase/DashboardDemo.TestBase.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/DashboardDemo/test/DashboardDemo.TestBase/DashboardDemoTestBase.cs b/samples/DashboardDemo/test/DashboardDemo.TestBase/DashboardDemoTestBase.cs index 937a515d14..057755dd14 100644 --- a/samples/DashboardDemo/test/DashboardDemo.TestBase/DashboardDemoTestBase.cs +++ b/samples/DashboardDemo/test/DashboardDemo.TestBase/DashboardDemoTestBase.cs @@ -18,26 +18,6 @@ namespace DashboardDemo options.UseAutofac(); } - protected virtual void WithUnitOfWork(Action action) - { - WithUnitOfWork(new AbpUnitOfWorkOptions(), action); - } - - protected virtual void WithUnitOfWork(AbpUnitOfWorkOptions options, Action action) - { - using (var scope = ServiceProvider.CreateScope()) - { - var uowManager = scope.ServiceProvider.GetRequiredService(); - - using (var uow = uowManager.Begin(options)) - { - action(); - - uow.Complete(); - } - } - } - protected virtual Task WithUnitOfWorkAsync(Func func) { return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); @@ -58,26 +38,6 @@ namespace DashboardDemo } } - protected virtual TResult WithUnitOfWork(Func func) - { - return WithUnitOfWork(new AbpUnitOfWorkOptions(), func); - } - - protected virtual TResult WithUnitOfWork(AbpUnitOfWorkOptions options, Func func) - { - using (var scope = ServiceProvider.CreateScope()) - { - var uowManager = scope.ServiceProvider.GetRequiredService(); - - using (var uow = uowManager.Begin(options)) - { - var result = func(); - uow.Complete(); - return result; - } - } - } - protected virtual Task WithUnitOfWorkAsync(Func> func) { return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); diff --git a/samples/DashboardDemo/test/DashboardDemo.Web.Tests/DashboardDemo.Web.Tests.csproj b/samples/DashboardDemo/test/DashboardDemo.Web.Tests/DashboardDemo.Web.Tests.csproj index 91bf825be1..0ef41fe9c9 100644 --- a/samples/DashboardDemo/test/DashboardDemo.Web.Tests/DashboardDemo.Web.Tests.csproj +++ b/samples/DashboardDemo/test/DashboardDemo.Web.Tests/DashboardDemo.Web.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/samples/DashboardDemo/test/DashboardDemo.Web.Tests/DashboardDemoWebTestModule.cs b/samples/DashboardDemo/test/DashboardDemo.Web.Tests/DashboardDemoWebTestModule.cs index 9e551d04d1..1f7db0ce9c 100644 --- a/samples/DashboardDemo/test/DashboardDemo.Web.Tests/DashboardDemoWebTestModule.cs +++ b/samples/DashboardDemo/test/DashboardDemo.Web.Tests/DashboardDemoWebTestModule.cs @@ -12,7 +12,7 @@ using DashboardDemo.Web.Menus; using Volo.Abp; using Volo.Abp.AspNetCore.TestBase; using Volo.Abp.Localization; -using Volo.Abp.Localization.Resources.AbpValidation; +using Volo.Abp.Validation.Localization; using Volo.Abp.Modularity; using Volo.Abp.UI.Navigation; diff --git a/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServer.Host.csproj b/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServer.Host.csproj index 337657a831..c828edc0ae 100644 --- a/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServer.Host.csproj +++ b/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServer.Host.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -12,7 +12,7 @@ - + @@ -29,6 +29,7 @@ + diff --git a/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServerHostModule.cs b/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServerHostModule.cs index 7ff9ae7c51..9c9ccd2a99 100644 --- a/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServerHostModule.cs +++ b/samples/MicroserviceDemo/applications/AuthServer.Host/AuthServerHostModule.cs @@ -1,9 +1,10 @@ -using AuthServer.Host.EntityFrameworkCore; +using AuthServer.Host.EntityFrameworkCore; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.DataProtection; using Microsoft.Extensions.DependencyInjection; using StackExchange.Redis; using Volo.Abp; +using Volo.Abp.Account; using Volo.Abp.Account.Web; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; using Volo.Abp.Auditing; @@ -34,6 +35,7 @@ namespace AuthServer.Host typeof(AbpSettingManagementEntityFrameworkCoreModule), typeof(AbpIdentityEntityFrameworkCoreModule), typeof(AbpIdentityApplicationContractsModule), + typeof(AbpAccountApplicationModule), typeof(AbpIdentityServerEntityFrameworkCoreModule), typeof(AbpEntityFrameworkCoreSqlServerModule), typeof(AbpAccountWebIdentityServerModule), diff --git a/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20191018081320_Initial.cs b/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20191018081320_Initial.cs deleted file mode 100644 index a1448d0e0c..0000000000 --- a/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20191018081320_Initial.cs +++ /dev/null @@ -1,930 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -namespace AuthServer.Host.Migrations -{ - public partial class Initial : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "AbpAuditLogs", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(nullable: true), - ApplicationName = table.Column(maxLength: 96, nullable: true), - UserId = table.Column(nullable: true), - UserName = table.Column(maxLength: 256, nullable: true), - TenantId = table.Column(nullable: true), - TenantName = table.Column(nullable: true), - ImpersonatorUserId = table.Column(nullable: true), - ImpersonatorTenantId = table.Column(nullable: true), - ExecutionTime = table.Column(nullable: false), - ExecutionDuration = table.Column(nullable: false), - ClientIpAddress = table.Column(maxLength: 64, nullable: true), - ClientName = table.Column(maxLength: 128, nullable: true), - ClientId = table.Column(maxLength: 64, nullable: true), - CorrelationId = table.Column(maxLength: 64, nullable: true), - BrowserInfo = table.Column(maxLength: 512, nullable: true), - HttpMethod = table.Column(maxLength: 16, nullable: true), - Url = table.Column(maxLength: 256, nullable: true), - Exceptions = table.Column(maxLength: 4000, nullable: true), - Comments = table.Column(maxLength: 256, nullable: true), - HttpStatusCode = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpAuditLogs", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpClaimTypes", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 256, nullable: false), - Name = table.Column(maxLength: 256, nullable: false), - Required = table.Column(nullable: false), - IsStatic = table.Column(nullable: false), - Regex = table.Column(maxLength: 512, nullable: true), - RegexDescription = table.Column(maxLength: 128, nullable: true), - Description = table.Column(maxLength: 256, nullable: true), - ValueType = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpClaimTypes", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpPermissionGrants", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - Name = table.Column(maxLength: 128, nullable: false), - ProviderName = table.Column(maxLength: 64, nullable: false), - ProviderKey = table.Column(maxLength: 64, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpPermissionGrants", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpRoles", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(maxLength: 256, nullable: false), - TenantId = table.Column(nullable: true), - Name = table.Column(maxLength: 256, nullable: false), - NormalizedName = table.Column(maxLength: 256, nullable: false), - IsDefault = table.Column(nullable: false), - IsStatic = table.Column(nullable: false), - IsPublic = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpRoles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpSettings", - columns: table => new - { - Id = table.Column(nullable: false), - Name = table.Column(maxLength: 128, nullable: false), - Value = table.Column(maxLength: 2048, nullable: false), - ProviderName = table.Column(maxLength: 64, nullable: true), - ProviderKey = table.Column(maxLength: 64, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpSettings", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "AbpUsers", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - TenantId = table.Column(nullable: true), - UserName = table.Column(maxLength: 256, nullable: false), - NormalizedUserName = table.Column(maxLength: 256, nullable: false), - Name = table.Column(maxLength: 64, nullable: true), - Surname = table.Column(maxLength: 64, nullable: true), - Email = table.Column(maxLength: 256, nullable: true), - NormalizedEmail = table.Column(maxLength: 256, nullable: true), - EmailConfirmed = table.Column(nullable: false, defaultValue: false), - PasswordHash = table.Column(maxLength: 256, nullable: true), - SecurityStamp = table.Column(maxLength: 256, nullable: false), - PhoneNumber = table.Column(maxLength: 16, nullable: true), - PhoneNumberConfirmed = table.Column(nullable: false, defaultValue: false), - TwoFactorEnabled = table.Column(nullable: false, defaultValue: false), - LockoutEnd = table.Column(nullable: true), - LockoutEnabled = table.Column(nullable: false, defaultValue: false), - AccessFailedCount = table.Column(nullable: false, defaultValue: 0) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpUsers", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerApiResources", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Enabled = table.Column(nullable: false), - Properties = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiResources", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClients", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - ClientId = table.Column(maxLength: 200, nullable: false), - ClientName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - ClientUri = table.Column(maxLength: 2000, nullable: true), - LogoUri = table.Column(maxLength: 2000, nullable: true), - Enabled = table.Column(nullable: false), - ProtocolType = table.Column(maxLength: 200, nullable: false), - RequireClientSecret = table.Column(nullable: false), - RequireConsent = table.Column(nullable: false), - AllowRememberConsent = table.Column(nullable: false), - AlwaysIncludeUserClaimsInIdToken = table.Column(nullable: false), - RequirePkce = table.Column(nullable: false), - AllowPlainTextPkce = table.Column(nullable: false), - AllowAccessTokensViaBrowser = table.Column(nullable: false), - FrontChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), - FrontChannelLogoutSessionRequired = table.Column(nullable: false), - BackChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), - BackChannelLogoutSessionRequired = table.Column(nullable: false), - AllowOfflineAccess = table.Column(nullable: false), - IdentityTokenLifetime = table.Column(nullable: false), - AccessTokenLifetime = table.Column(nullable: false), - AuthorizationCodeLifetime = table.Column(nullable: false), - ConsentLifetime = table.Column(nullable: true), - AbsoluteRefreshTokenLifetime = table.Column(nullable: false), - SlidingRefreshTokenLifetime = table.Column(nullable: false), - RefreshTokenUsage = table.Column(nullable: false), - UpdateAccessTokenClaimsOnRefresh = table.Column(nullable: false), - RefreshTokenExpiration = table.Column(nullable: false), - AccessTokenType = table.Column(nullable: false), - EnableLocalLogin = table.Column(nullable: false), - IncludeJwtId = table.Column(nullable: false), - AlwaysSendClientClaims = table.Column(nullable: false), - ClientClaimsPrefix = table.Column(maxLength: 200, nullable: true), - PairWiseSubjectSalt = table.Column(maxLength: 200, nullable: true), - UserSsoLifetime = table.Column(nullable: true), - UserCodeType = table.Column(maxLength: 100, nullable: true), - DeviceCodeLifetime = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClients", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerIdentityResources", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Enabled = table.Column(nullable: false), - Required = table.Column(nullable: false), - Emphasize = table.Column(nullable: false), - ShowInDiscoveryDocument = table.Column(nullable: false), - Properties = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerIdentityResources", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerPersistedGrants", - columns: table => new - { - Key = table.Column(maxLength: 200, nullable: false), - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(nullable: true), - Type = table.Column(maxLength: 50, nullable: false), - SubjectId = table.Column(maxLength: 200, nullable: true), - ClientId = table.Column(maxLength: 200, nullable: false), - CreationTime = table.Column(nullable: false), - Expiration = table.Column(nullable: true), - Data = table.Column(maxLength: 50000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerPersistedGrants", x => x.Key); - }); - - migrationBuilder.CreateTable( - name: "AbpAuditLogActions", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - AuditLogId = table.Column(nullable: false), - ServiceName = table.Column(maxLength: 256, nullable: true), - MethodName = table.Column(maxLength: 128, nullable: true), - Parameters = table.Column(maxLength: 2000, nullable: true), - ExecutionTime = table.Column(nullable: false), - ExecutionDuration = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpAuditLogActions", x => x.Id); - table.ForeignKey( - name: "FK_AbpAuditLogActions_AbpAuditLogs_AuditLogId", - column: x => x.AuditLogId, - principalTable: "AbpAuditLogs", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpEntityChanges", - columns: table => new - { - Id = table.Column(nullable: false), - AuditLogId = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - ChangeTime = table.Column(nullable: false), - ChangeType = table.Column(nullable: false), - EntityTenantId = table.Column(nullable: true), - EntityId = table.Column(maxLength: 128, nullable: false), - EntityTypeFullName = table.Column(maxLength: 128, nullable: false), - ExtraProperties = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpEntityChanges", x => x.Id); - table.ForeignKey( - name: "FK_AbpEntityChanges_AbpAuditLogs_AuditLogId", - column: x => x.AuditLogId, - principalTable: "AbpAuditLogs", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpRoleClaims", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - ClaimType = table.Column(maxLength: 256, nullable: false), - ClaimValue = table.Column(maxLength: 1024, nullable: true), - RoleId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpRoleClaims", x => x.Id); - table.ForeignKey( - name: "FK_AbpRoleClaims_AbpRoles_RoleId", - column: x => x.RoleId, - principalTable: "AbpRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpUserClaims", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - ClaimType = table.Column(maxLength: 256, nullable: false), - ClaimValue = table.Column(maxLength: 1024, nullable: true), - UserId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpUserClaims", x => x.Id); - table.ForeignKey( - name: "FK_AbpUserClaims_AbpUsers_UserId", - column: x => x.UserId, - principalTable: "AbpUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpUserLogins", - columns: table => new - { - UserId = table.Column(nullable: false), - LoginProvider = table.Column(maxLength: 64, nullable: false), - TenantId = table.Column(nullable: true), - ProviderKey = table.Column(maxLength: 196, nullable: false), - ProviderDisplayName = table.Column(maxLength: 128, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpUserLogins", x => new { x.UserId, x.LoginProvider }); - table.ForeignKey( - name: "FK_AbpUserLogins_AbpUsers_UserId", - column: x => x.UserId, - principalTable: "AbpUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpUserRoles", - columns: table => new - { - UserId = table.Column(nullable: false), - RoleId = table.Column(nullable: false), - TenantId = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpUserRoles", x => new { x.UserId, x.RoleId }); - table.ForeignKey( - name: "FK_AbpUserRoles_AbpRoles_RoleId", - column: x => x.RoleId, - principalTable: "AbpRoles", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_AbpUserRoles_AbpUsers_UserId", - column: x => x.UserId, - principalTable: "AbpUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpUserTokens", - columns: table => new - { - UserId = table.Column(nullable: false), - LoginProvider = table.Column(maxLength: 64, nullable: false), - Name = table.Column(maxLength: 128, nullable: false), - TenantId = table.Column(nullable: true), - Value = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); - table.ForeignKey( - name: "FK_AbpUserTokens_AbpUsers_UserId", - column: x => x.UserId, - principalTable: "AbpUsers", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerApiClaims", - columns: table => new - { - Type = table.Column(maxLength: 200, nullable: false), - ApiResourceId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiClaims", x => new { x.ApiResourceId, x.Type }); - table.ForeignKey( - name: "FK_IdentityServerApiClaims_IdentityServerApiResources_ApiResourceId", - column: x => x.ApiResourceId, - principalTable: "IdentityServerApiResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerApiScopes", - columns: table => new - { - ApiResourceId = table.Column(nullable: false), - Name = table.Column(maxLength: 200, nullable: false), - DisplayName = table.Column(maxLength: 200, nullable: true), - Description = table.Column(maxLength: 1000, nullable: true), - Required = table.Column(nullable: false), - Emphasize = table.Column(nullable: false), - ShowInDiscoveryDocument = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiScopes", x => new { x.ApiResourceId, x.Name }); - table.ForeignKey( - name: "FK_IdentityServerApiScopes_IdentityServerApiResources_ApiResourceId", - column: x => x.ApiResourceId, - principalTable: "IdentityServerApiResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerApiSecrets", - columns: table => new - { - Type = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 4000, nullable: false), - ApiResourceId = table.Column(nullable: false), - Description = table.Column(maxLength: 2000, nullable: true), - Expiration = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiSecrets", x => new { x.ApiResourceId, x.Type, x.Value }); - table.ForeignKey( - name: "FK_IdentityServerApiSecrets_IdentityServerApiResources_ApiResourceId", - column: x => x.ApiResourceId, - principalTable: "IdentityServerApiResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientClaims", - columns: table => new - { - ClientId = table.Column(nullable: false), - Type = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 250, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientClaims", x => new { x.ClientId, x.Type, x.Value }); - table.ForeignKey( - name: "FK_IdentityServerClientClaims_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientCorsOrigins", - columns: table => new - { - ClientId = table.Column(nullable: false), - Origin = table.Column(maxLength: 150, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientCorsOrigins", x => new { x.ClientId, x.Origin }); - table.ForeignKey( - name: "FK_IdentityServerClientCorsOrigins_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientGrantTypes", - columns: table => new - { - ClientId = table.Column(nullable: false), - GrantType = table.Column(maxLength: 250, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientGrantTypes", x => new { x.ClientId, x.GrantType }); - table.ForeignKey( - name: "FK_IdentityServerClientGrantTypes_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientIdPRestrictions", - columns: table => new - { - ClientId = table.Column(nullable: false), - Provider = table.Column(maxLength: 200, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientIdPRestrictions", x => new { x.ClientId, x.Provider }); - table.ForeignKey( - name: "FK_IdentityServerClientIdPRestrictions_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientPostLogoutRedirectUris", - columns: table => new - { - ClientId = table.Column(nullable: false), - PostLogoutRedirectUri = table.Column(maxLength: 2000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientPostLogoutRedirectUris", x => new { x.ClientId, x.PostLogoutRedirectUri }); - table.ForeignKey( - name: "FK_IdentityServerClientPostLogoutRedirectUris_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientProperties", - columns: table => new - { - ClientId = table.Column(nullable: false), - Key = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 2000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientProperties", x => new { x.ClientId, x.Key }); - table.ForeignKey( - name: "FK_IdentityServerClientProperties_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientRedirectUris", - columns: table => new - { - ClientId = table.Column(nullable: false), - RedirectUri = table.Column(maxLength: 2000, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientRedirectUris", x => new { x.ClientId, x.RedirectUri }); - table.ForeignKey( - name: "FK_IdentityServerClientRedirectUris_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientScopes", - columns: table => new - { - ClientId = table.Column(nullable: false), - Scope = table.Column(maxLength: 200, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientScopes", x => new { x.ClientId, x.Scope }); - table.ForeignKey( - name: "FK_IdentityServerClientScopes_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerClientSecrets", - columns: table => new - { - Type = table.Column(maxLength: 250, nullable: false), - Value = table.Column(maxLength: 4000, nullable: false), - ClientId = table.Column(nullable: false), - Description = table.Column(maxLength: 2000, nullable: true), - Expiration = table.Column(nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerClientSecrets", x => new { x.ClientId, x.Type, x.Value }); - table.ForeignKey( - name: "FK_IdentityServerClientSecrets_IdentityServerClients_ClientId", - column: x => x.ClientId, - principalTable: "IdentityServerClients", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerIdentityClaims", - columns: table => new - { - Type = table.Column(maxLength: 200, nullable: false), - IdentityResourceId = table.Column(nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerIdentityClaims", x => new { x.IdentityResourceId, x.Type }); - table.ForeignKey( - name: "FK_IdentityServerIdentityClaims_IdentityServerIdentityResources_IdentityResourceId", - column: x => x.IdentityResourceId, - principalTable: "IdentityServerIdentityResources", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "AbpEntityPropertyChanges", - columns: table => new - { - Id = table.Column(nullable: false), - TenantId = table.Column(nullable: true), - EntityChangeId = table.Column(nullable: false), - NewValue = table.Column(maxLength: 512, nullable: true), - OriginalValue = table.Column(maxLength: 512, nullable: true), - PropertyName = table.Column(maxLength: 128, nullable: false), - PropertyTypeFullName = table.Column(maxLength: 64, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpEntityPropertyChanges", x => x.Id); - table.ForeignKey( - name: "FK_AbpEntityPropertyChanges_AbpEntityChanges_EntityChangeId", - column: x => x.EntityChangeId, - principalTable: "AbpEntityChanges", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "IdentityServerApiScopeClaims", - columns: table => new - { - Type = table.Column(maxLength: 200, nullable: false), - ApiResourceId = table.Column(nullable: false), - Name = table.Column(maxLength: 200, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_IdentityServerApiScopeClaims", x => new { x.ApiResourceId, x.Name, x.Type }); - table.ForeignKey( - name: "FK_IdentityServerApiScopeClaims_IdentityServerApiScopes_ApiResourceId_Name", - columns: x => new { x.ApiResourceId, x.Name }, - principalTable: "IdentityServerApiScopes", - principalColumns: new[] { "ApiResourceId", "Name" }, - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_AbpAuditLogActions_AuditLogId", - table: "AbpAuditLogActions", - column: "AuditLogId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpAuditLogActions_TenantId_ServiceName_MethodName_ExecutionTime", - table: "AbpAuditLogActions", - columns: new[] { "TenantId", "ServiceName", "MethodName", "ExecutionTime" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpAuditLogs_TenantId_ExecutionTime", - table: "AbpAuditLogs", - columns: new[] { "TenantId", "ExecutionTime" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpAuditLogs_TenantId_UserId_ExecutionTime", - table: "AbpAuditLogs", - columns: new[] { "TenantId", "UserId", "ExecutionTime" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpEntityChanges_AuditLogId", - table: "AbpEntityChanges", - column: "AuditLogId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpEntityChanges_TenantId_EntityTypeFullName_EntityId", - table: "AbpEntityChanges", - columns: new[] { "TenantId", "EntityTypeFullName", "EntityId" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpEntityPropertyChanges_EntityChangeId", - table: "AbpEntityPropertyChanges", - column: "EntityChangeId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpPermissionGrants_Name_ProviderName_ProviderKey", - table: "AbpPermissionGrants", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpRoleClaims_RoleId", - table: "AbpRoleClaims", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpRoles_NormalizedName", - table: "AbpRoles", - column: "NormalizedName"); - - migrationBuilder.CreateIndex( - name: "IX_AbpSettings_Name_ProviderName_ProviderKey", - table: "AbpSettings", - columns: new[] { "Name", "ProviderName", "ProviderKey" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpUserClaims_UserId", - table: "AbpUserClaims", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_AbpUserLogins_LoginProvider_ProviderKey", - table: "AbpUserLogins", - columns: new[] { "LoginProvider", "ProviderKey" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpUserRoles_RoleId_UserId", - table: "AbpUserRoles", - columns: new[] { "RoleId", "UserId" }); - - migrationBuilder.CreateIndex( - name: "IX_AbpUsers_Email", - table: "AbpUsers", - column: "Email"); - - migrationBuilder.CreateIndex( - name: "IX_AbpUsers_NormalizedEmail", - table: "AbpUsers", - column: "NormalizedEmail"); - - migrationBuilder.CreateIndex( - name: "IX_AbpUsers_NormalizedUserName", - table: "AbpUsers", - column: "NormalizedUserName"); - - migrationBuilder.CreateIndex( - name: "IX_AbpUsers_UserName", - table: "AbpUsers", - column: "UserName"); - - migrationBuilder.CreateIndex( - name: "IX_IdentityServerClients_ClientId", - table: "IdentityServerClients", - column: "ClientId"); - - migrationBuilder.CreateIndex( - name: "IX_IdentityServerPersistedGrants_Expiration", - table: "IdentityServerPersistedGrants", - column: "Expiration"); - - migrationBuilder.CreateIndex( - name: "IX_IdentityServerPersistedGrants_SubjectId_ClientId_Type", - table: "IdentityServerPersistedGrants", - columns: new[] { "SubjectId", "ClientId", "Type" }); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "AbpAuditLogActions"); - - migrationBuilder.DropTable( - name: "AbpClaimTypes"); - - migrationBuilder.DropTable( - name: "AbpEntityPropertyChanges"); - - migrationBuilder.DropTable( - name: "AbpPermissionGrants"); - - migrationBuilder.DropTable( - name: "AbpRoleClaims"); - - migrationBuilder.DropTable( - name: "AbpSettings"); - - migrationBuilder.DropTable( - name: "AbpUserClaims"); - - migrationBuilder.DropTable( - name: "AbpUserLogins"); - - migrationBuilder.DropTable( - name: "AbpUserRoles"); - - migrationBuilder.DropTable( - name: "AbpUserTokens"); - - migrationBuilder.DropTable( - name: "IdentityServerApiClaims"); - - migrationBuilder.DropTable( - name: "IdentityServerApiScopeClaims"); - - migrationBuilder.DropTable( - name: "IdentityServerApiSecrets"); - - migrationBuilder.DropTable( - name: "IdentityServerClientClaims"); - - migrationBuilder.DropTable( - name: "IdentityServerClientCorsOrigins"); - - migrationBuilder.DropTable( - name: "IdentityServerClientGrantTypes"); - - migrationBuilder.DropTable( - name: "IdentityServerClientIdPRestrictions"); - - migrationBuilder.DropTable( - name: "IdentityServerClientPostLogoutRedirectUris"); - - migrationBuilder.DropTable( - name: "IdentityServerClientProperties"); - - migrationBuilder.DropTable( - name: "IdentityServerClientRedirectUris"); - - migrationBuilder.DropTable( - name: "IdentityServerClientScopes"); - - migrationBuilder.DropTable( - name: "IdentityServerClientSecrets"); - - migrationBuilder.DropTable( - name: "IdentityServerIdentityClaims"); - - migrationBuilder.DropTable( - name: "IdentityServerPersistedGrants"); - - migrationBuilder.DropTable( - name: "AbpEntityChanges"); - - migrationBuilder.DropTable( - name: "AbpRoles"); - - migrationBuilder.DropTable( - name: "AbpUsers"); - - migrationBuilder.DropTable( - name: "IdentityServerApiScopes"); - - migrationBuilder.DropTable( - name: "IdentityServerClients"); - - migrationBuilder.DropTable( - name: "IdentityServerIdentityResources"); - - migrationBuilder.DropTable( - name: "AbpAuditLogs"); - - migrationBuilder.DropTable( - name: "IdentityServerApiResources"); - } - } -} diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20191127124541_Initial.Designer.cs b/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20200106080946_Initial.Designer.cs similarity index 96% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20191127124541_Initial.Designer.cs rename to samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20200106080946_Initial.Designer.cs index 0733f562cd..d2a14947aa 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20191127124541_Initial.Designer.cs +++ b/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20200106080946_Initial.Designer.cs @@ -1,23 +1,23 @@ // using System; +using AuthServer.Host.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using MyCompanyName.MyProjectName.EntityFrameworkCore; -namespace MyCompanyName.MyProjectName.Migrations +namespace AuthServer.Host.Migrations { - [DbContext(typeof(IdentityServerHostMigrationsDbContext))] - [Migration("20191127124541_Initial")] + [DbContext(typeof(AuthServerDbContext))] + [Migration("20200106080946_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0") + .HasAnnotation("ProductVersion", "3.1.0") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); @@ -426,6 +426,7 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("datetime2"); b.Property("Email") + .IsRequired() .HasColumnName("Email") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -469,6 +470,7 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(64); b.Property("NormalizedEmail") + .IsRequired() .HasColumnName("NormalizedEmail") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -1111,6 +1113,70 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("IdentityServerClientSecrets"); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Data") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(50000); + + b.Property("DeviceCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Expiration") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("SubjectId") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("UserCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.HasIndex("UserCode") + .IsUnique(); + + b.ToTable("IdentityServerDeviceFlowCodes"); + }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") @@ -1315,82 +1381,6 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpSettings"); }); - modelBuilder.Entity("Volo.Abp.TenantManagement.Tenant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnName("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("CreatorId") - .HasColumnName("CreatorId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeleterId") - .HasColumnName("DeleterId") - .HasColumnType("uniqueidentifier"); - - b.Property("DeletionTime") - .HasColumnName("DeletionTime") - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsDeleted") - .ValueGeneratedOnAdd() - .HasColumnName("IsDeleted") - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastModificationTime") - .HasColumnName("LastModificationTime") - .HasColumnType("datetime2"); - - b.Property("LastModifierId") - .HasColumnName("LastModifierId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.HasKey("Id"); - - b.HasIndex("Name"); - - b.ToTable("AbpTenants"); - }); - - modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => - { - b.Property("TenantId") - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("Value") - .IsRequired() - .HasColumnType("nvarchar(1024)") - .HasMaxLength(1024); - - b.HasKey("TenantId", "Name"); - - b.ToTable("AbpTenantConnectionStrings"); - }); - modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b => { b.HasOne("Volo.Abp.AuditLogging.AuditLog", null) @@ -1594,15 +1584,6 @@ namespace MyCompanyName.MyProjectName.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - - modelBuilder.Entity("Volo.Abp.TenantManagement.TenantConnectionString", b => - { - b.HasOne("Volo.Abp.TenantManagement.Tenant", null) - .WithMany("ConnectionStrings") - .HasForeignKey("TenantId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - }); #pragma warning restore 612, 618 } } diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20191127124541_Initial.cs b/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20200106080946_Initial.cs similarity index 96% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20191127124541_Initial.cs rename to samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20200106080946_Initial.cs index 217c00a646..7e1b1eb08c 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20191127124541_Initial.cs +++ b/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/20200106080946_Initial.cs @@ -1,7 +1,7 @@ using System; using Microsoft.EntityFrameworkCore.Migrations; -namespace MyCompanyName.MyProjectName.Migrations +namespace AuthServer.Host.Migrations { public partial class Initial : Migration { @@ -108,27 +108,6 @@ namespace MyCompanyName.MyProjectName.Migrations table.PrimaryKey("PK_AbpSettings", x => x.Id); }); - migrationBuilder.CreateTable( - name: "AbpTenants", - columns: table => new - { - Id = table.Column(nullable: false), - ExtraProperties = table.Column(nullable: true), - ConcurrencyStamp = table.Column(nullable: true), - CreationTime = table.Column(nullable: false), - CreatorId = table.Column(nullable: true), - LastModificationTime = table.Column(nullable: true), - LastModifierId = table.Column(nullable: true), - IsDeleted = table.Column(nullable: false, defaultValue: false), - DeleterId = table.Column(nullable: true), - DeletionTime = table.Column(nullable: true), - Name = table.Column(maxLength: 64, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpTenants", x => x.Id); - }); - migrationBuilder.CreateTable( name: "AbpUsers", columns: table => new @@ -148,8 +127,8 @@ namespace MyCompanyName.MyProjectName.Migrations NormalizedUserName = table.Column(maxLength: 256, nullable: false), Name = table.Column(maxLength: 64, nullable: true), Surname = table.Column(maxLength: 64, nullable: true), - Email = table.Column(maxLength: 256, nullable: true), - NormalizedEmail = table.Column(maxLength: 256, nullable: true), + Email = table.Column(maxLength: 256, nullable: false), + NormalizedEmail = table.Column(maxLength: 256, nullable: false), EmailConfirmed = table.Column(nullable: false, defaultValue: false), PasswordHash = table.Column(maxLength: 256, nullable: true), SecurityStamp = table.Column(maxLength: 256, nullable: false), @@ -247,6 +226,27 @@ namespace MyCompanyName.MyProjectName.Migrations table.PrimaryKey("PK_IdentityServerClients", x => x.Id); }); + migrationBuilder.CreateTable( + name: "IdentityServerDeviceFlowCodes", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + DeviceCode = table.Column(maxLength: 200, nullable: false), + UserCode = table.Column(maxLength: 200, nullable: false), + SubjectId = table.Column(maxLength: 200, nullable: true), + ClientId = table.Column(maxLength: 200, nullable: false), + Expiration = table.Column(nullable: false), + Data = table.Column(maxLength: 50000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerDeviceFlowCodes", x => x.Id); + }); + migrationBuilder.CreateTable( name: "IdentityServerIdentityResources", columns: table => new @@ -366,25 +366,6 @@ namespace MyCompanyName.MyProjectName.Migrations onDelete: ReferentialAction.Cascade); }); - migrationBuilder.CreateTable( - name: "AbpTenantConnectionStrings", - columns: table => new - { - TenantId = table.Column(nullable: false), - Name = table.Column(maxLength: 64, nullable: false), - Value = table.Column(maxLength: 1024, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_AbpTenantConnectionStrings", x => new { x.TenantId, x.Name }); - table.ForeignKey( - name: "FK_AbpTenantConnectionStrings_AbpTenants_TenantId", - column: x => x.TenantId, - principalTable: "AbpTenants", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - migrationBuilder.CreateTable( name: "AbpUserClaims", columns: table => new @@ -817,11 +798,6 @@ namespace MyCompanyName.MyProjectName.Migrations table: "AbpSettings", columns: new[] { "Name", "ProviderName", "ProviderKey" }); - migrationBuilder.CreateIndex( - name: "IX_AbpTenants_Name", - table: "AbpTenants", - column: "Name"); - migrationBuilder.CreateIndex( name: "IX_AbpUserClaims_UserId", table: "AbpUserClaims", @@ -862,6 +838,23 @@ namespace MyCompanyName.MyProjectName.Migrations table: "IdentityServerClients", column: "ClientId"); + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_DeviceCode", + table: "IdentityServerDeviceFlowCodes", + column: "DeviceCode", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_Expiration", + table: "IdentityServerDeviceFlowCodes", + column: "Expiration"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_UserCode", + table: "IdentityServerDeviceFlowCodes", + column: "UserCode", + unique: true); + migrationBuilder.CreateIndex( name: "IX_IdentityServerPersistedGrants_Expiration", table: "IdentityServerPersistedGrants", @@ -893,9 +886,6 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "AbpSettings"); - migrationBuilder.DropTable( - name: "AbpTenantConnectionStrings"); - migrationBuilder.DropTable( name: "AbpUserClaims"); @@ -944,6 +934,9 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "IdentityServerClientSecrets"); + migrationBuilder.DropTable( + name: "IdentityServerDeviceFlowCodes"); + migrationBuilder.DropTable( name: "IdentityServerIdentityClaims"); @@ -953,9 +946,6 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "AbpEntityChanges"); - migrationBuilder.DropTable( - name: "AbpTenants"); - migrationBuilder.DropTable( name: "AbpRoles"); diff --git a/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/AuthServerDbContextModelSnapshot.cs b/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/AuthServerDbContextModelSnapshot.cs index c79748f7f9..81f7c5f23b 100644 --- a/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/AuthServerDbContextModelSnapshot.cs +++ b/samples/MicroserviceDemo/applications/AuthServer.Host/Migrations/AuthServerDbContextModelSnapshot.cs @@ -15,7 +15,7 @@ namespace AuthServer.Host.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0") + .HasAnnotation("ProductVersion", "3.1.0") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); @@ -424,6 +424,7 @@ namespace AuthServer.Host.Migrations .HasColumnType("datetime2"); b.Property("Email") + .IsRequired() .HasColumnName("Email") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -467,6 +468,7 @@ namespace AuthServer.Host.Migrations .HasMaxLength(64); b.Property("NormalizedEmail") + .IsRequired() .HasColumnName("NormalizedEmail") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -1109,6 +1111,70 @@ namespace AuthServer.Host.Migrations b.ToTable("IdentityServerClientSecrets"); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Data") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(50000); + + b.Property("DeviceCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Expiration") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("SubjectId") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("UserCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.HasIndex("UserCode") + .IsUnique(); + + b.ToTable("IdentityServerDeviceFlowCodes"); + }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") diff --git a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminApp.Host.csproj b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminApp.Host.csproj index 911593b16a..bc29c3d237 100644 --- a/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminApp.Host.csproj +++ b/samples/MicroserviceDemo/applications/BackendAdminApp.Host/BackendAdminApp.Host.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -12,10 +12,10 @@ - + - + diff --git a/samples/MicroserviceDemo/applications/ConsoleClientDemo/ConsoleClientDemo.csproj b/samples/MicroserviceDemo/applications/ConsoleClientDemo/ConsoleClientDemo.csproj index 0e9b3e5faa..7ee4c756aa 100644 --- a/samples/MicroserviceDemo/applications/ConsoleClientDemo/ConsoleClientDemo.csproj +++ b/samples/MicroserviceDemo/applications/ConsoleClientDemo/ConsoleClientDemo.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/samples/MicroserviceDemo/applications/ConsoleClientDemo/ConsoleClientDemoHostedService.cs b/samples/MicroserviceDemo/applications/ConsoleClientDemo/ConsoleClientDemoHostedService.cs new file mode 100644 index 0000000000..e07c8564eb --- /dev/null +++ b/samples/MicroserviceDemo/applications/ConsoleClientDemo/ConsoleClientDemoHostedService.cs @@ -0,0 +1,33 @@ +using Microsoft.Extensions.Hosting; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; +using Serilog; + +namespace ConsoleClientDemo +{ + public class ConsoleClientDemoHostedService : IHostedService + { + public async Task StartAsync(CancellationToken cancellationToken) + { + using (var application = AbpApplicationFactory.Create(options => + { + options.Services.AddLogging(loggingBuilder => + { + loggingBuilder.AddSerilog(dispose: true); + }); + })) + { + application.Initialize(); + + var demo = application.ServiceProvider.GetRequiredService(); + await demo.RunAsync(); + + application.Shutdown(); + } + } + + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; + } +} diff --git a/samples/MicroserviceDemo/applications/ConsoleClientDemo/Program.cs b/samples/MicroserviceDemo/applications/ConsoleClientDemo/Program.cs index 9626e874a1..40082b1d2a 100644 --- a/samples/MicroserviceDemo/applications/ConsoleClientDemo/Program.cs +++ b/samples/MicroserviceDemo/applications/ConsoleClientDemo/Program.cs @@ -1,48 +1,14 @@ -using Serilog; -using Serilog.Events; -using System; +using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp; -using Volo.Abp.Threading; +using Microsoft.Extensions.Hosting; +using Serilog; +using Serilog.Events; namespace ConsoleClientDemo { internal class Program { - private static void Main(string[] args) - { - InitializeSerilog(); - - Log.Information("Starting ConsoleClientDemo..."); - - try - { - using (var application = AbpApplicationFactory.Create(options => - { - options.Services.AddLogging(loggingBuilder => - { - loggingBuilder.AddSerilog(dispose: true); - }); - })) - { - application.Initialize(); - - var demo = application.ServiceProvider.GetRequiredService(); - AsyncHelper.RunSync(() => demo.RunAsync()); - - Console.WriteLine("Press ENTER to stop application..."); - Console.ReadLine(); - } - } - catch (Exception ex) - { - Log.Error(ex.Message); - Log.Error(ex.StackTrace); - throw; - } - } - - private static void InitializeSerilog() + static async Task Main(string[] args) { Log.Logger = new LoggerConfiguration() .MinimumLevel.Debug() @@ -50,6 +16,17 @@ namespace ConsoleClientDemo .Enrich.FromLogContext() .WriteTo.File("Logs/logs.txt") .CreateLogger(); + + Log.Information("Starting ConsoleClientDemo..."); + + await CreateHostBuilder(args).RunConsoleAsync(); } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureServices((hostContext, services) => + { + services.AddHostedService(); + }); } } diff --git a/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSite.Host.csproj b/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSite.Host.csproj index 5574e33b3b..2370ae2a7a 100644 --- a/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSite.Host.csproj +++ b/samples/MicroserviceDemo/applications/PublicWebSite.Host/PublicWebSite.Host.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -12,7 +12,7 @@ - + diff --git a/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj index 9d2d4c3cae..89c3bdb5be 100644 --- a/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj +++ b/samples/MicroserviceDemo/gateways/BackendAdminAppGateway.Host/BackendAdminAppGateway.Host.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -12,10 +12,10 @@ - + - + diff --git a/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj b/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj index 8d7d8bf135..c46183b709 100644 --- a/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj +++ b/samples/MicroserviceDemo/gateways/InternalGateway.Host/InternalGateway.Host.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -12,10 +12,10 @@ - + - + @@ -45,5 +45,4 @@ - diff --git a/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj b/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj index 2c01555e87..82f3b5440b 100644 --- a/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj +++ b/samples/MicroserviceDemo/gateways/PublicWebSiteGateway.Host/PublicWebSiteGateway.Host.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -12,10 +12,10 @@ - + - + @@ -44,4 +44,4 @@ - \ No newline at end of file + diff --git a/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingService.Host.csproj b/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingService.Host.csproj index 5a9c5375d0..5bb58b92ec 100644 --- a/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingService.Host.csproj +++ b/samples/MicroserviceDemo/microservices/BloggingService.Host/BloggingService.Host.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -12,10 +12,10 @@ - + - + diff --git a/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityService.Host.csproj b/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityService.Host.csproj index 09e91582ab..11f7485be2 100644 --- a/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityService.Host.csproj +++ b/samples/MicroserviceDemo/microservices/IdentityService.Host/IdentityService.Host.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -12,10 +12,10 @@ - + - + diff --git a/samples/MicroserviceDemo/microservices/ProductService.Host/ProductService.Host.csproj b/samples/MicroserviceDemo/microservices/ProductService.Host/ProductService.Host.csproj index f871ed5983..133a7f70b6 100644 --- a/samples/MicroserviceDemo/microservices/ProductService.Host/ProductService.Host.csproj +++ b/samples/MicroserviceDemo/microservices/ProductService.Host/ProductService.Host.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 @@ -12,10 +12,10 @@ - + - + diff --git a/samples/MicroserviceDemo/modules/product/src/ProductManagement.Application.Contracts/ProductManagement.Application.Contracts.csproj b/samples/MicroserviceDemo/modules/product/src/ProductManagement.Application.Contracts/ProductManagement.Application.Contracts.csproj index dd5556e22c..0274d88e7f 100644 --- a/samples/MicroserviceDemo/modules/product/src/ProductManagement.Application.Contracts/ProductManagement.Application.Contracts.csproj +++ b/samples/MicroserviceDemo/modules/product/src/ProductManagement.Application.Contracts/ProductManagement.Application.Contracts.csproj @@ -1,4 +1,4 @@ - + netstandard2.0 diff --git a/samples/MicroserviceDemo/modules/product/src/ProductManagement.Application/ProductManagement.Application.csproj b/samples/MicroserviceDemo/modules/product/src/ProductManagement.Application/ProductManagement.Application.csproj index e8979089f2..3ff28200ce 100644 --- a/samples/MicroserviceDemo/modules/product/src/ProductManagement.Application/ProductManagement.Application.csproj +++ b/samples/MicroserviceDemo/modules/product/src/ProductManagement.Application/ProductManagement.Application.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/samples/MicroserviceDemo/modules/product/src/ProductManagement.Domain.Shared/ProductManagement.Domain.Shared.csproj b/samples/MicroserviceDemo/modules/product/src/ProductManagement.Domain.Shared/ProductManagement.Domain.Shared.csproj index 18c95e3826..d39dd59d83 100644 --- a/samples/MicroserviceDemo/modules/product/src/ProductManagement.Domain.Shared/ProductManagement.Domain.Shared.csproj +++ b/samples/MicroserviceDemo/modules/product/src/ProductManagement.Domain.Shared/ProductManagement.Domain.Shared.csproj @@ -1,4 +1,4 @@ - + netstandard2.0 diff --git a/samples/MicroserviceDemo/modules/product/src/ProductManagement.Domain/ProductManagement.Domain.csproj b/samples/MicroserviceDemo/modules/product/src/ProductManagement.Domain/ProductManagement.Domain.csproj index c542289d4c..f739951b4e 100644 --- a/samples/MicroserviceDemo/modules/product/src/ProductManagement.Domain/ProductManagement.Domain.csproj +++ b/samples/MicroserviceDemo/modules/product/src/ProductManagement.Domain/ProductManagement.Domain.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/samples/MicroserviceDemo/modules/product/src/ProductManagement.EntityFrameworkCore/ProductManagement.EntityFrameworkCore.csproj b/samples/MicroserviceDemo/modules/product/src/ProductManagement.EntityFrameworkCore/ProductManagement.EntityFrameworkCore.csproj index 6fa636813c..1e7d3e5cfe 100644 --- a/samples/MicroserviceDemo/modules/product/src/ProductManagement.EntityFrameworkCore/ProductManagement.EntityFrameworkCore.csproj +++ b/samples/MicroserviceDemo/modules/product/src/ProductManagement.EntityFrameworkCore/ProductManagement.EntityFrameworkCore.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/samples/MicroserviceDemo/modules/product/src/ProductManagement.HttpApi.Client/ProductManagement.HttpApi.Client.csproj b/samples/MicroserviceDemo/modules/product/src/ProductManagement.HttpApi.Client/ProductManagement.HttpApi.Client.csproj index 3ac801cadc..ddc1e0a023 100644 --- a/samples/MicroserviceDemo/modules/product/src/ProductManagement.HttpApi.Client/ProductManagement.HttpApi.Client.csproj +++ b/samples/MicroserviceDemo/modules/product/src/ProductManagement.HttpApi.Client/ProductManagement.HttpApi.Client.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/samples/MicroserviceDemo/modules/product/src/ProductManagement.HttpApi/ProductManagement.HttpApi.csproj b/samples/MicroserviceDemo/modules/product/src/ProductManagement.HttpApi/ProductManagement.HttpApi.csproj index de724336b5..a24813ac32 100644 --- a/samples/MicroserviceDemo/modules/product/src/ProductManagement.HttpApi/ProductManagement.HttpApi.csproj +++ b/samples/MicroserviceDemo/modules/product/src/ProductManagement.HttpApi/ProductManagement.HttpApi.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/ProductManagement.Web.csproj b/samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/ProductManagement.Web.csproj index a4690d2ceb..d6e31e865c 100644 --- a/samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/ProductManagement.Web.csproj +++ b/samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/ProductManagement.Web.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/ProductManagementWebModule.cs b/samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/ProductManagementWebModule.cs index aa1c36303f..9fdd1dd8cd 100644 --- a/samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/ProductManagementWebModule.cs +++ b/samples/MicroserviceDemo/modules/product/src/ProductManagement.Web/ProductManagementWebModule.cs @@ -6,7 +6,7 @@ using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; using Volo.Abp.AutoMapper; using Volo.Abp.Localization; -using Volo.Abp.Localization.Resources.AbpValidation; +using Volo.Abp.Validation.Localization; using Volo.Abp.Modularity; using Volo.Abp.UI.Navigation; using Volo.Abp.VirtualFileSystem; diff --git a/samples/MicroserviceDemo/modules/product/test/ProductManagement.Application.Tests/ProductManagement.Application.Tests.csproj b/samples/MicroserviceDemo/modules/product/test/ProductManagement.Application.Tests/ProductManagement.Application.Tests.csproj index 6e2e2fcd0f..87a2c15d52 100644 --- a/samples/MicroserviceDemo/modules/product/test/ProductManagement.Application.Tests/ProductManagement.Application.Tests.csproj +++ b/samples/MicroserviceDemo/modules/product/test/ProductManagement.Application.Tests/ProductManagement.Application.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/samples/MicroserviceDemo/modules/product/test/ProductManagement.Domain.Tests/ProductManagement.Domain.Tests.csproj b/samples/MicroserviceDemo/modules/product/test/ProductManagement.Domain.Tests/ProductManagement.Domain.Tests.csproj index 4ba80b1a97..c09b228d30 100644 --- a/samples/MicroserviceDemo/modules/product/test/ProductManagement.Domain.Tests/ProductManagement.Domain.Tests.csproj +++ b/samples/MicroserviceDemo/modules/product/test/ProductManagement.Domain.Tests/ProductManagement.Domain.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/samples/MicroserviceDemo/modules/product/test/ProductManagement.Domain.Tests/ProductManagement/ProductManagementDomainTestBase.cs b/samples/MicroserviceDemo/modules/product/test/ProductManagement.Domain.Tests/ProductManagement/ProductManagementDomainTestBase.cs index 062c57b44b..de73af7a37 100644 --- a/samples/MicroserviceDemo/modules/product/test/ProductManagement.Domain.Tests/ProductManagement/ProductManagementDomainTestBase.cs +++ b/samples/MicroserviceDemo/modules/product/test/ProductManagement.Domain.Tests/ProductManagement/ProductManagementDomainTestBase.cs @@ -9,26 +9,6 @@ namespace ProductManagement { #region WithUnitOfWork - protected virtual void WithUnitOfWork(Action action) - { - WithUnitOfWork(new AbpUnitOfWorkOptions(), action); - } - - protected virtual void WithUnitOfWork(AbpUnitOfWorkOptions options, Action action) - { - using (var scope = ServiceProvider.CreateScope()) - { - var uowManager = scope.ServiceProvider.GetRequiredService(); - - using (var uow = uowManager.Begin(options)) - { - action(); - - uow.Complete(); - } - } - } - protected virtual Task WithUnitOfWorkAsync(Func func) { return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); @@ -49,26 +29,6 @@ namespace ProductManagement } } - protected virtual TResult WithUnitOfWork(Func func) - { - return WithUnitOfWork(new AbpUnitOfWorkOptions(), func); - } - - protected virtual TResult WithUnitOfWork(AbpUnitOfWorkOptions options, Func func) - { - using (var scope = ServiceProvider.CreateScope()) - { - var uowManager = scope.ServiceProvider.GetRequiredService(); - - using (var uow = uowManager.Begin(options)) - { - var result = func(); - uow.Complete(); - return result; - } - } - } - protected virtual Task WithUnitOfWorkAsync(Func> func) { return WithUnitOfWorkAsync(new AbpUnitOfWorkOptions(), func); diff --git a/samples/MicroserviceDemo/modules/product/test/ProductManagement.EntityFrameworkCore.Tests/ProductManagement.EntityFrameworkCore.Tests.csproj b/samples/MicroserviceDemo/modules/product/test/ProductManagement.EntityFrameworkCore.Tests/ProductManagement.EntityFrameworkCore.Tests.csproj index 6a10664e46..9efdef58cf 100644 --- a/samples/MicroserviceDemo/modules/product/test/ProductManagement.EntityFrameworkCore.Tests/ProductManagement.EntityFrameworkCore.Tests.csproj +++ b/samples/MicroserviceDemo/modules/product/test/ProductManagement.EntityFrameworkCore.Tests/ProductManagement.EntityFrameworkCore.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/samples/MicroserviceDemo/modules/product/test/ProductManagement.TestBase/ProductManagement.TestBase.csproj b/samples/MicroserviceDemo/modules/product/test/ProductManagement.TestBase/ProductManagement.TestBase.csproj index 7d0ffde718..a23148b147 100644 --- a/samples/MicroserviceDemo/modules/product/test/ProductManagement.TestBase/ProductManagement.TestBase.csproj +++ b/samples/MicroserviceDemo/modules/product/test/ProductManagement.TestBase/ProductManagement.TestBase.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.1 diff --git a/samples/RabbitMqEventBus/App1/App1.csproj b/samples/RabbitMqEventBus/App1/App1.csproj index bc811a5de1..c6fede0a2c 100644 --- a/samples/RabbitMqEventBus/App1/App1.csproj +++ b/samples/RabbitMqEventBus/App1/App1.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/samples/RabbitMqEventBus/App2/App2.csproj b/samples/RabbitMqEventBus/App2/App2.csproj index bc811a5de1..c6fede0a2c 100644 --- a/samples/RabbitMqEventBus/App2/App2.csproj +++ b/samples/RabbitMqEventBus/App2/App2.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/samples/RabbitMqEventBus/SharedModule/SharedModule.csproj b/samples/RabbitMqEventBus/SharedModule/SharedModule.csproj index c659ddff0b..df09f473f1 100644 --- a/samples/RabbitMqEventBus/SharedModule/SharedModule.csproj +++ b/samples/RabbitMqEventBus/SharedModule/SharedModule.csproj @@ -1,4 +1,4 @@ - + netstandard2.0 diff --git a/templates/app/angular/package.json b/templates/app/angular/package.json index 83842616a7..838cf86bb6 100644 --- a/templates/app/angular/package.json +++ b/templates/app/angular/package.json @@ -13,11 +13,11 @@ }, "private": true, "dependencies": { - "@abp/ng.account": "^1.1.1", - "@abp/ng.identity": "^1.1.1", - "@abp/ng.setting-management": "^1.1.1", - "@abp/ng.tenant-management": "^1.1.1", - "@abp/ng.theme.basic": "^1.1.1", + "@abp/ng.account": "^2.0.1", + "@abp/ng.identity": "^2.0.1", + "@abp/ng.setting-management": "^2.0.1", + "@abp/ng.tenant-management": "^2.0.1", + "@abp/ng.theme.basic": "^2.0.1", "@angular/animations": "~8.2.14", "@angular/common": "~8.2.14", "@angular/compiler": "~8.2.14", diff --git a/templates/app/angular/src/app/shared/shared.module.ts b/templates/app/angular/src/app/shared/shared.module.ts index 6bae4ea332..6c4c9b016c 100644 --- a/templates/app/angular/src/app/shared/shared.module.ts +++ b/templates/app/angular/src/app/shared/shared.module.ts @@ -4,11 +4,26 @@ import { NgModule } from '@angular/core'; import { ThemeBasicModule } from '@abp/ng.theme.basic'; import { ThemeSharedModule } from '@abp/ng.theme.shared'; import { TableModule } from 'primeng/table'; +import { NgxValidateCoreModule } from '@ngx-validate/core'; @NgModule({ declarations: [], - imports: [CoreModule, ThemeSharedModule, ThemeBasicModule, TableModule, NgbDropdownModule], - exports: [CoreModule, ThemeSharedModule, ThemeBasicModule, TableModule, NgbDropdownModule], + imports: [ + CoreModule, + ThemeSharedModule, + ThemeBasicModule, + TableModule, + NgbDropdownModule, + NgxValidateCoreModule, + ], + exports: [ + CoreModule, + ThemeSharedModule, + ThemeBasicModule, + TableModule, + NgbDropdownModule, + NgxValidateCoreModule, + ], providers: [], }) export class SharedModule {} diff --git a/templates/app/angular/src/favicon.ico b/templates/app/angular/src/favicon.ico index 8081c7ceaf..39695854d2 100644 Binary files a/templates/app/angular/src/favicon.ico and b/templates/app/angular/src/favicon.ico differ diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Application.Contracts/MyCompanyName.MyProjectName.Application.Contracts.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Application.Contracts/MyCompanyName.MyProjectName.Application.Contracts.csproj index 90af8423a9..818b7059de 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Application.Contracts/MyCompanyName.MyProjectName.Application.Contracts.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Application.Contracts/MyCompanyName.MyProjectName.Application.Contracts.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyCompanyName.MyProjectName.Application.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyCompanyName.MyProjectName.Application.csproj index 165267af77..583492c8b1 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyCompanyName.MyProjectName.Application.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyCompanyName.MyProjectName.Application.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator/DbMigratorHostedService.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator/DbMigratorHostedService.cs new file mode 100644 index 0000000000..730a7f7369 --- /dev/null +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator/DbMigratorHostedService.cs @@ -0,0 +1,34 @@ +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; +using MyCompanyName.MyProjectName.Data; +using Serilog; +using Volo.Abp; + +namespace MyCompanyName.MyProjectName.DbMigrator +{ + public class DbMigratorHostedService : IHostedService + { + public async Task StartAsync(CancellationToken cancellationToken) + { + using (var application = AbpApplicationFactory.Create(options => + { + options.UseAutofac(); + options.Services.AddLogging(c => c.AddSerilog()); + })) + { + application.Initialize(); + + await application + .ServiceProvider + .GetRequiredService() + .MigrateAsync(); + + application.Shutdown(); + } + } + + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; + } +} diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator/MyCompanyName.MyProjectName.DbMigrator.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator/MyCompanyName.MyProjectName.DbMigrator.csproj index 0f2e701d93..a4e6b5adb1 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator/MyCompanyName.MyProjectName.DbMigrator.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator/MyCompanyName.MyProjectName.DbMigrator.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator/Program.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator/Program.cs index 1a9175bbee..d1556ea371 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator/Program.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator/Program.cs @@ -1,39 +1,15 @@ -using System.IO; +using System.IO; +using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; -using MyCompanyName.MyProjectName.Data; +using Microsoft.Extensions.Hosting; using Serilog; using Serilog.Events; -using Volo.Abp; -using Volo.Abp.Threading; namespace MyCompanyName.MyProjectName.DbMigrator { class Program { - static void Main(string[] args) - { - ConfigureLogging(); - - using (var application = AbpApplicationFactory.Create(options => - { - options.UseAutofac(); - options.Services.AddLogging(c => c.AddSerilog()); - })) - { - application.Initialize(); - - AsyncHelper.RunSync( - () => application - .ServiceProvider - .GetRequiredService() - .MigrateAsync() - ); - - application.Shutdown(); - } - } - - private static void ConfigureLogging() + static async Task Main(string[] args) { Log.Logger = new LoggerConfiguration() .MinimumLevel.Information() @@ -48,6 +24,15 @@ namespace MyCompanyName.MyProjectName.DbMigrator .WriteTo.File(Path.Combine(Directory.GetCurrentDirectory(), "Logs/logs.txt")) .WriteTo.Console() .CreateLogger(); + + await CreateHostBuilder(args).RunConsoleAsync(); } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureServices((hostContext, services) => + { + services.AddHostedService(); + }); } } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/Localization/MyProjectName/zh-Hans.json b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/Localization/MyProjectName/zh-Hans.json index 459fc0fefd..23790bde50 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/Localization/MyProjectName/zh-Hans.json +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/Localization/MyProjectName/zh-Hans.json @@ -3,6 +3,6 @@ "texts": { "Menu:Home": "首页", "Welcome": "欢迎", - "LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 cn.abp.io." + "LongWelcomeMessage": "欢迎来到该应用程序. 这是一个基于ABP框架的启动项目. 有关更多信息, 请访问 abp.io." } } \ No newline at end of file diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/Localization/MyProjectName/zh-Hant.json b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/Localization/MyProjectName/zh-Hant.json new file mode 100644 index 0000000000..31e0ab5a47 --- /dev/null +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/Localization/MyProjectName/zh-Hant.json @@ -0,0 +1,8 @@ +{ + "culture": "zh-Hant", + "texts": { + "Menu:Home": "首頁", + "Welcome": "歡迎", + "LongWelcomeMessage": "歡迎來到此應用程式. 這是一個基於ABP框架的起始專案. 有關更多訊息, 請瀏覽 abp.io." + } + } \ No newline at end of file diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyCompanyName.MyProjectName.Domain.Shared.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyCompanyName.MyProjectName.Domain.Shared.csproj index 262569df97..f0b3cc8b33 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyCompanyName.MyProjectName.Domain.Shared.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyCompanyName.MyProjectName.Domain.Shared.csproj @@ -1,4 +1,4 @@ - + @@ -23,4 +23,4 @@ - \ No newline at end of file + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/Data/MyProjectNameDbMigrationService.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/Data/MyProjectNameDbMigrationService.cs index f6fd008e66..cde75d4ca7 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/Data/MyProjectNameDbMigrationService.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/Data/MyProjectNameDbMigrationService.cs @@ -1,8 +1,12 @@ -using System.Threading.Tasks; +using System; +using System.Linq; +using System.Threading.Tasks; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Volo.Abp.Data; using Volo.Abp.DependencyInjection; +using Volo.Abp.MultiTenancy; +using Volo.Abp.TenantManagement; namespace MyCompanyName.MyProjectName.Data { @@ -12,13 +16,19 @@ namespace MyCompanyName.MyProjectName.Data private readonly IDataSeeder _dataSeeder; private readonly IMyProjectNameDbSchemaMigrator _dbSchemaMigrator; + private readonly ITenantRepository _tenantRepository; + private readonly ICurrentTenant _currentTenant; public MyProjectNameDbMigrationService( IDataSeeder dataSeeder, - IMyProjectNameDbSchemaMigrator dbSchemaMigrator) + IMyProjectNameDbSchemaMigrator dbSchemaMigrator, + ITenantRepository tenantRepository, + ICurrentTenant currentTenant) { _dataSeeder = dataSeeder; _dbSchemaMigrator = dbSchemaMigrator; + _tenantRepository = tenantRepository; + _currentTenant = currentTenant; Logger = NullLogger.Instance; } @@ -27,13 +37,43 @@ namespace MyCompanyName.MyProjectName.Data { Logger.LogInformation("Started database migrations..."); - Logger.LogInformation("Migrating database schema..."); + await MigrateHostDatabaseAsync(); + + var i = 0; + var tenants = await _tenantRepository.GetListAsync(); + foreach (var tenant in tenants) + { + i++; + + using (_currentTenant.Change(tenant.Id)) + { + Logger.LogInformation($"Migrating {tenant.Name} database schema... ({i} of {tenants.Count})"); + await MigrateTenantDatabasesAsync(tenant); + Logger.LogInformation($"Successfully completed {tenant.Name} database migrations."); + } + } + + Logger.LogInformation("Successfully completed database migrations."); + } + + private async Task MigrateHostDatabaseAsync() + { + Logger.LogInformation("Migrating host database schema..."); await _dbSchemaMigrator.MigrateAsync(); - Logger.LogInformation("Executing database seed..."); + Logger.LogInformation("Executing host database seed..."); await _dataSeeder.SeedAsync(); - Logger.LogInformation("Successfully completed database migrations."); + Logger.LogInformation("Successfully completed host database migrations."); + } + + private async Task MigrateTenantDatabasesAsync(Tenant tenant) + { + Logger.LogInformation($"Migrating schema for {tenant.Name} database..."); + await _dbSchemaMigrator.MigrateAsync(); + + Logger.LogInformation($"Executing {tenant.Name} tenant database seed..."); + await _dataSeeder.SeedAsync(tenant.Id); } } } \ No newline at end of file diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/MyCompanyName.MyProjectName.Domain.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/MyCompanyName.MyProjectName.Domain.csproj index 13a78ff079..2078a20b56 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/MyCompanyName.MyProjectName.Domain.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain/MyCompanyName.MyProjectName.Domain.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/EntityFrameworkCoreMyProjectNameDbSchemaMigrator.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/EntityFrameworkCoreMyProjectNameDbSchemaMigrator.cs index 7064697d1a..71bd4e9059 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/EntityFrameworkCoreMyProjectNameDbSchemaMigrator.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/EntityFrameworkCore/EntityFrameworkCoreMyProjectNameDbSchemaMigrator.cs @@ -1,24 +1,36 @@ -using System.Threading.Tasks; +using System; +using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.DependencyInjection; using MyCompanyName.MyProjectName.Data; using Volo.Abp.DependencyInjection; namespace MyCompanyName.MyProjectName.EntityFrameworkCore { [Dependency(ReplaceServices = true)] - public class EntityFrameworkCoreMyProjectNameDbSchemaMigrator + public class EntityFrameworkCoreMyProjectNameDbSchemaMigrator : IMyProjectNameDbSchemaMigrator, ITransientDependency { - private readonly MyProjectNameMigrationsDbContext _dbContext; + private readonly IServiceProvider _serviceProvider; - public EntityFrameworkCoreMyProjectNameDbSchemaMigrator(MyProjectNameMigrationsDbContext dbContext) + public EntityFrameworkCoreMyProjectNameDbSchemaMigrator( + IServiceProvider serviceProvider) { - _dbContext = dbContext; + _serviceProvider = serviceProvider; } public async Task MigrateAsync() { - await _dbContext.Database.MigrateAsync(); + /* We intentionally resolving the MyProjectNameMigrationsDbContext + * from IServiceProvider (instead of directly injecting it) + * to properly get the connection string of the current tenant in the + * current scope. + */ + + await _serviceProvider + .GetRequiredService() + .Database + .MigrateAsync(); } } } \ No newline at end of file diff --git a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20191018075950_Initial.Designer.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200106080719_Initial.Designer.cs similarity index 96% rename from samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20191018075950_Initial.Designer.cs rename to templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200106080719_Initial.Designer.cs index 6d33227240..252d7d8c3d 100644 --- a/samples/BookStore/src/Acme.BookStore.EntityFrameworkCore.DbMigrations/Migrations/20191018075950_Initial.Designer.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200106080719_Initial.Designer.cs @@ -1,23 +1,23 @@ // using System; -using Acme.BookStore.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using MyCompanyName.MyProjectName.EntityFrameworkCore; -namespace Acme.BookStore.Migrations +namespace MyCompanyName.MyProjectName.Migrations { - [DbContext(typeof(BookStoreMigrationsDbContext))] - [Migration("20191018075950_Initial")] + [DbContext(typeof(MyProjectNameMigrationsDbContext))] + [Migration("20200106080719_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0") + .HasAnnotation("ProductVersion", "3.1.0") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); @@ -512,6 +512,7 @@ namespace Acme.BookStore.Migrations .HasColumnType("datetime2"); b.Property("Email") + .IsRequired() .HasColumnName("Email") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -555,6 +556,7 @@ namespace Acme.BookStore.Migrations .HasMaxLength(64); b.Property("NormalizedEmail") + .IsRequired() .HasColumnName("NormalizedEmail") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -1197,6 +1199,70 @@ namespace Acme.BookStore.Migrations b.ToTable("IdentityServerClientSecrets"); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Data") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(50000); + + b.Property("DeviceCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Expiration") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("SubjectId") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("UserCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.HasIndex("UserCode") + .IsUnique(); + + b.ToTable("IdentityServerDeviceFlowCodes"); + }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") @@ -1453,8 +1519,7 @@ namespace Acme.BookStore.Migrations b.HasKey("Id"); - b.HasIndex("Name") - .IsUnique(); + b.HasIndex("Name"); b.ToTable("AbpTenants"); }); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20191218090017_Initial.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200106080719_Initial.cs similarity index 96% rename from templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20191218090017_Initial.cs rename to templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200106080719_Initial.cs index c7b0e07a56..170372b3e0 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20191218090017_Initial.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20200106080719_Initial.cs @@ -283,6 +283,27 @@ namespace MyCompanyName.MyProjectName.Migrations table.PrimaryKey("PK_IdentityServerClients", x => x.Id); }); + migrationBuilder.CreateTable( + name: "IdentityServerDeviceFlowCodes", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + DeviceCode = table.Column(maxLength: 200, nullable: false), + UserCode = table.Column(maxLength: 200, nullable: false), + SubjectId = table.Column(maxLength: 200, nullable: true), + ClientId = table.Column(maxLength: 200, nullable: false), + Expiration = table.Column(nullable: false), + Data = table.Column(maxLength: 50000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerDeviceFlowCodes", x => x.Id); + }); + migrationBuilder.CreateTable( name: "IdentityServerIdentityResources", columns: table => new @@ -908,6 +929,23 @@ namespace MyCompanyName.MyProjectName.Migrations table: "IdentityServerClients", column: "ClientId"); + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_DeviceCode", + table: "IdentityServerDeviceFlowCodes", + column: "DeviceCode", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_Expiration", + table: "IdentityServerDeviceFlowCodes", + column: "Expiration"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_UserCode", + table: "IdentityServerDeviceFlowCodes", + column: "UserCode", + unique: true); + migrationBuilder.CreateIndex( name: "IX_IdentityServerPersistedGrants_Expiration", table: "IdentityServerPersistedGrants", @@ -996,6 +1034,9 @@ namespace MyCompanyName.MyProjectName.Migrations migrationBuilder.DropTable( name: "IdentityServerClientSecrets"); + migrationBuilder.DropTable( + name: "IdentityServerDeviceFlowCodes"); + migrationBuilder.DropTable( name: "IdentityServerIdentityClaims"); diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs index 460515931f..9b3096b4ba 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/MyProjectNameMigrationsDbContextModelSnapshot.cs @@ -1197,6 +1197,70 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("IdentityServerClientSecrets"); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Data") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(50000); + + b.Property("DeviceCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Expiration") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("SubjectId") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("UserCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.HasIndex("UserCode") + .IsUnique(); + + b.ToTable("IdentityServerDeviceFlowCodes"); + }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations.csproj index a16e4c2ca5..cc8c7876ee 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/MyCompanyName.MyProjectName.EntityFrameworkCore.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/MyCompanyName.MyProjectName.EntityFrameworkCore.csproj index b6a1de012d..f6bb500e62 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/MyCompanyName.MyProjectName.EntityFrameworkCore.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/MyCompanyName.MyProjectName.EntityFrameworkCore.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/MyCompanyName.MyProjectName.HttpApi.Client.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/MyCompanyName.MyProjectName.HttpApi.Client.csproj index 42d25166ef..4c70886aaa 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/MyCompanyName.MyProjectName.HttpApi.Client.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/MyCompanyName.MyProjectName.HttpApi.Client.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj index 19435bb1fa..20d35f5d01 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj @@ -1,4 +1,4 @@ - + @@ -6,20 +6,21 @@ netcoreapp3.1 MyCompanyName.MyProjectName true - MyCompanyName-MyProjectName-4681b4fd-151f-4221-84a4-929d86723e4c + MyCompanyName.MyProjectName-4681b4fd-151f-4221-84a4-929d86723e4c - + - + + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs index 59ba519ce4..63b9689b18 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs @@ -15,6 +15,7 @@ using Microsoft.OpenApi.Models; using Volo.Abp; using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy; +using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.Autofac; using Volo.Abp.Caching; using Volo.Abp.Localization; @@ -28,7 +29,8 @@ namespace MyCompanyName.MyProjectName typeof(AbpAutofacModule), typeof(AbpAspNetCoreMvcUiMultiTenancyModule), typeof(MyProjectNameApplicationModule), - typeof(MyProjectNameEntityFrameworkCoreDbMigrationsModule) + typeof(MyProjectNameEntityFrameworkCoreDbMigrationsModule), + typeof(AbpAspNetCoreSerilogModule) )] public class MyProjectNameHttpApiHostModule : AbpModule { @@ -111,6 +113,7 @@ namespace MyCompanyName.MyProjectName options.Languages.Add(new LanguageInfo("pt-BR", "pt-BR", "Português")); 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", "繁體中文")); }); } @@ -178,6 +181,7 @@ namespace MyCompanyName.MyProjectName }); app.UseAuditing(); + app.UseAbpSerilogEnrichers(); app.UseMvcWithDefaultRouteAndArea(); } } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj index 038e2e4016..5b8db548fd 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyCompanyName.MyProjectName.HttpApi.HostWithIds.csproj @@ -1,4 +1,4 @@ - + @@ -6,20 +6,21 @@ netcoreapp3.1 MyCompanyName.MyProjectName true - MyCompanyName-MyProjectName-4681b4fd-151f-4221-84a4-929d86723e4c + MyCompanyName.MyProjectName-4681b4fd-151f-4221-84a4-929d86723e4c - + - + + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyProjectNameHttpApiHostModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyProjectNameHttpApiHostModule.cs index a60d2ddb35..80aa44c647 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyProjectNameHttpApiHostModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/MyProjectNameHttpApiHostModule.cs @@ -18,6 +18,7 @@ using Volo.Abp.Account.Web; using Volo.Abp.AspNetCore.Authentication.JwtBearer; using Volo.Abp.AspNetCore.MultiTenancy; using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.Autofac; using Volo.Abp.Localization; using Volo.Abp.Modularity; @@ -34,7 +35,8 @@ namespace MyCompanyName.MyProjectName typeof(MyProjectNameEntityFrameworkCoreDbMigrationsModule), typeof(AbpAspNetCoreMvcUiBasicThemeModule), typeof(AbpAspNetCoreAuthenticationJwtBearerModule), - typeof(AbpAccountWebIdentityServerModule) + typeof(AbpAccountWebIdentityServerModule), + typeof(AbpAspNetCoreSerilogModule) )] public class MyProjectNameHttpApiHostModule : AbpModule { @@ -120,6 +122,7 @@ namespace MyCompanyName.MyProjectName options.Languages.Add(new LanguageInfo("pt-BR", "pt-BR", "Português")); 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", "繁體中文")); }); } @@ -172,6 +175,7 @@ namespace MyCompanyName.MyProjectName }); app.UseAuditing(); + app.UseAbpSerilogEnrichers(); app.UseMvcWithDefaultRouteAndArea(); } } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/package.json b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/package.json index 35b0592f57..96b4f2fdbf 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/package.json +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/package.json @@ -3,6 +3,6 @@ "name": "my-app", "private": true, "dependencies": { - "@abp/aspnetcore.mvc.ui.theme.basic": "^1.1.1" + "@abp/aspnetcore.mvc.ui.theme.basic": "^2.0.1" } } \ No newline at end of file diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/yarn.lock b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/yarn.lock index 313032453c..3ef9fe6a7f 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/yarn.lock +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.HostWithIds/yarn.lock @@ -2,37 +2,37 @@ # yarn lockfile v1 -"@abp/aspnetcore.mvc.ui.theme.basic@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-1.1.1.tgz#a3d21f8cc5ede2e85b881fe69d9ecd5fc2268e47" - integrity sha512-ooXtCM3TWN69RU7xs6avnzOQBXzsiHY5BEIogzSBialZC4uG5H56qrIr4MbsFNae+PQM23Mw2tnJ/Z7dutURCQ== +"@abp/aspnetcore.mvc.ui.theme.basic@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-2.0.1.tgz#e336c8e3b52b04177fc4039c54f67984f8230f6f" + integrity sha512-yMYL8Q1DdS5Dt8nHz5K0ca+4uQ853iOLts/gWmJ4YybWxn4BMu17hlFWpdbmYrtLCW8n45yRYy8dp+9go8zCQw== dependencies: - "@abp/aspnetcore.mvc.ui.theme.shared" "^1.1.1" + "@abp/aspnetcore.mvc.ui.theme.shared" "^2.0.1" -"@abp/aspnetcore.mvc.ui.theme.shared@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-1.1.1.tgz#b5eb57bcebcf211a75cf7d540dcc89a0f9ade013" - integrity sha512-LilSyefzT1+rcTU7vbWxcO8TwBgGZIx6QbMUrDicSTH6LLJ9S5+yNaGNJbbZKDG6qx0BEoC1u8dE8KCUshwxoQ== - dependencies: - "@abp/aspnetcore.mvc.ui" "^1.1.1" - "@abp/bootstrap" "^1.1.1" - "@abp/bootstrap-datepicker" "^1.1.1" - "@abp/datatables.net-bs4" "^1.1.1" - "@abp/font-awesome" "^1.1.1" - "@abp/jquery-form" "^1.1.1" - "@abp/jquery-validation-unobtrusive" "^1.1.1" - "@abp/lodash" "^1.1.1" - "@abp/luxon" "^1.1.1" - "@abp/malihu-custom-scrollbar-plugin" "^1.1.1" - "@abp/select2" "^1.1.1" - "@abp/sweetalert" "^1.1.1" - "@abp/timeago" "^1.1.1" - "@abp/toastr" "^1.1.1" - -"@abp/aspnetcore.mvc.ui@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-1.1.1.tgz#9d693516b6a215dfd2113db9ef52f02881a3e1d5" - integrity sha512-wZbptVCSxZzEjkJx+/sWrH9Pikp9nOy7V8Htz+L+S7/qAzfXu5PRVV8ahddfAcDHRk30buRhdbJlCVdt6hkZ6g== +"@abp/aspnetcore.mvc.ui.theme.shared@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-2.0.1.tgz#2bad208bfc422e6be12f22431c713180d924e17c" + integrity sha512-6/ZnF4dFbmpiqDIx3Lc2NJpCNcpmvrEh6kDZC5x9q3ICTPK/CgspM7dVG2dSpFFkXbDNoGH6i/wJwEUWHOKzYQ== + dependencies: + "@abp/aspnetcore.mvc.ui" "^2.0.1" + "@abp/bootstrap" "^2.0.1" + "@abp/bootstrap-datepicker" "^2.0.1" + "@abp/datatables.net-bs4" "^2.0.1" + "@abp/font-awesome" "^2.0.1" + "@abp/jquery-form" "^2.0.1" + "@abp/jquery-validation-unobtrusive" "^2.0.1" + "@abp/lodash" "^2.0.1" + "@abp/luxon" "^2.0.1" + "@abp/malihu-custom-scrollbar-plugin" "^2.0.1" + "@abp/select2" "^2.0.1" + "@abp/sweetalert" "^2.0.1" + "@abp/timeago" "^2.0.1" + "@abp/toastr" "^2.0.1" + +"@abp/aspnetcore.mvc.ui@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-2.0.1.tgz#2c319182f7ab5f99059df4d36cf894deeba20023" + integrity sha512-bLTyfqoPrzHrdPIw3twJrILO99fzHJZrUJmJDuk5cT1Ox+bCv3AAxi7UEEaOQdjDdZlURq86SKM5x/EndeGpHA== dependencies: ansi-colors "^4.1.1" extend-object "^1.0.0" @@ -41,135 +41,135 @@ path "^0.12.7" rimraf "^3.0.0" -"@abp/bootstrap-datepicker@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-1.1.1.tgz#fb1ceec1df24f384a6349c4acfb3627e02e4a42f" - integrity sha512-RIQLSrKBu/cTAU2lFenSAoKcMp7wgF4e3nP4/iOu5ZtCgti5vUjMEcqEvBxtlwKTHMXsTG4GtNKqjTwjXMjONQ== +"@abp/bootstrap-datepicker@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-2.0.1.tgz#458361b7c7ba8c4fc260e9117ae52f054cbab705" + integrity sha512-mkF2ioq1UxOw7K2IDzzjuLco/V/HNkB5t7HqDfnNt9JFEt71ms2xRFe8KLxpr9MUWB9MdzlGo4ywyHzGxA61mg== dependencies: bootstrap-datepicker "^1.9.0" -"@abp/bootstrap@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-1.1.1.tgz#e16fae6ff6b18096276219edf3483fd8f41c925d" - integrity sha512-OIaGJaizhI8UNfy4bnw2xT2Z0QG7BJJrjxOPGepfd4jn/AUi/vFdOpJFWvu2P9PwSzRmn/LuSlr2WONDOdPVWQ== +"@abp/bootstrap@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-2.0.1.tgz#78d6a7c0787787fd92f8d19c7f8cfee05d8f863e" + integrity sha512-GFAho519IBIK0199LCK5NpuaG44w0Tmjjmxns3V+MbzdXGa5d3hZzuPDhYv6hOB9Aj5d0UIqT39KmvrbHAgvuQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" bootstrap "^4.3.1" -"@abp/core@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/core/-/core-1.1.1.tgz#1379145980d6b142fd0123200c60ffb206149d56" - integrity sha512-OvUG7xRvk8nSqwC1s45YPnTuhC2OWe1AVa1nnC6FVHMH/g1Je7UJwnbu47K7uNS+lDRJUIktNbufYKiwutEjRg== +"@abp/core@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/core/-/core-2.0.1.tgz#441b231f7deb4356f71fdc853873ee3e7eacebea" + integrity sha512-5m5Buci+efcmkxPkVWAIAad6idvXS5qSqK/oq8fJj2I4J95ug8CUWRwg7cFzZGLljUKX6kEbCtB//NBCoI+aJA== -"@abp/datatables.net-bs4@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-1.1.1.tgz#c7e79534c2e4b51b3e98bcc0df3292cb08ae9d2e" - integrity sha512-t40xQIGBMLPZiSbcZHW3AwE8uk+xcl7OitBT1jym0XPKVtgJsHez3ynDE5v/PjHe+ColCG8lTRjRnNoXo5dzDw== +"@abp/datatables.net-bs4@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-2.0.1.tgz#fac4afdd44784f3cdd395830cda4b2781a817c05" + integrity sha512-jD2cxrPSxfzjM6xSDBiHJuxk6wj6wBQsD4+Go0kOicQSEzDef9CCN8hi8NsCITosAXVAEIoHGwE1uTlK6sir5Q== dependencies: - "@abp/datatables.net" "^1.1.1" + "@abp/datatables.net" "^2.0.1" datatables.net-bs4 "^1.10.20" -"@abp/datatables.net@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-1.1.1.tgz#de8b362c29f452188624536cdd6feccad2b533e6" - integrity sha512-y76IDBlgc0n1YgQqJ+9cfzXpLwr2arhdIfSmqX+qRXz6GfVNY7e3JijkFSgDKUzKGYo1HZMzgJmDmeNIRwMZsQ== +"@abp/datatables.net@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-2.0.1.tgz#3a0a5e5a836fe058d43798139349d92996ea9478" + integrity sha512-xEsvLofWj0W1ieplwEM4j5SEpoW3zS/yRQczHGMWBTR1Uazy0ysqQwMau+nRsNz7z12cFfooVG2mNzfkWRa84g== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" datatables.net "^1.10.20" -"@abp/font-awesome@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-1.1.1.tgz#7f0a210eb7611d75542028b0c88a0c83f1d9db50" - integrity sha512-6RHbixi7IVWAb3JCHrUmEYD3HmAH4R75Nuo54LvFzATrh4G6gdBONIeDuTo79OTxe4Zhp+WLxeA49Y21kt77mg== +"@abp/font-awesome@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-2.0.1.tgz#738e5d8a93c29ba13f019a1f0198b9272c644e5c" + integrity sha512-+2yQ3RRMTkj0QsxbYB1gHzqEM+/yiFpuXakKTHxFnCZjgZhmmU229hm14xWbpyWsKohbtrr4R/te1WBrqryqPA== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" "@fortawesome/fontawesome-free" "^5.11.2" -"@abp/jquery-form@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-1.1.1.tgz#1dae1145da720e222efcb396906c3fbe5a3dd29f" - integrity sha512-AIIdN36f8xwr4LgiNnBHohJ5tlxh/r+DuDtXcScpZN6GWBE+XgUotN0pZIIva82IxCyUNdDudzgluX9IjI+00w== +"@abp/jquery-form@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-2.0.1.tgz#e92b9ad75a4f08c63b1005d97d8baeb689ebfe6c" + integrity sha512-A/imqgswwLrU+mR1oyDeVW5PDCIBQk/sMtU/PvRXaNL9c59nU5EVWIuPzORDzpkoECtuNMqStjERHc9IROMjnA== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" jquery-form "^4.2.2" -"@abp/jquery-validation-unobtrusive@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-1.1.1.tgz#aeba0883260f47ab22a39343817b1811fc2b81a9" - integrity sha512-q1b0KG8l3DXUiW8JXdq9l1jR/CwgzrZdxwdKGLB2J/oxHlywQIb7yrjR6WGCshjPpcx2SkOL0j/ZXMIMh533hQ== +"@abp/jquery-validation-unobtrusive@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-2.0.1.tgz#e4ed82f6432bba68139210552a9e7800d838d788" + integrity sha512-72XyC3megf6VXm283pCXB5kctbNLmI/EtfoIEp+FffTUmxCoL+gEEnqb1V+7dMUm5QYCNDnhYWk7K6TTxBPGPw== dependencies: - "@abp/jquery-validation" "^1.1.1" + "@abp/jquery-validation" "^2.0.1" jquery-validation-unobtrusive "^3.2.11" -"@abp/jquery-validation@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-1.1.1.tgz#03febd285ce9d7e5681619897967b0ccde7e8e04" - integrity sha512-YvAjIW8epp+ddu01BTUkZWPfEADAvNPJeUrrZ6OpcPWM15Tf+ddr4ATgJ1LCg0Bh5F09iQC855osow3lt8sc7g== +"@abp/jquery-validation@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-2.0.1.tgz#f0287d8687275b400a15d4ce8dc76d40b8b38cee" + integrity sha512-18teWDVaMVHGEHc8eGuK7yUG+H6HxlKBRtB0L+VCYiUYsnTKshu+4DvSf0QTtGcbKquY8ui9AwgDnWZJ8Qqjqg== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" jquery-validation "^1.19.1" -"@abp/jquery@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-1.1.1.tgz#56928814bb3df73c1c0014d4b18fef09ec06e195" - integrity sha512-kj4BTtXF0VbCzCqRXnRVEbGndR3F8NlbBhVQN6BQktOuZta3fvx7f2+pSok8vQv0ddmqUFY7FTT2Ei3l4363LQ== +"@abp/jquery@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-2.0.1.tgz#0048b2344523c1c1d602d81291adf35fe9234d62" + integrity sha512-daM0nlxHW3iGoLh8sq03/co2dF9aM6LYqj5hFAHnmwx0UunDnS0rXkgbRieu66tGPvk325Qb2S1Ibpjn8/CqAQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" jquery "^3.4.1" -"@abp/lodash@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-1.1.1.tgz#aa6ef3a85b9827796e295f440b29f0611c508b5f" - integrity sha512-nH7bRS28Tf4hEXcpKHd1IM+MzYTqX8t3htGmsLX4UESQd52eODYOIldtX6gm3OW1O6ECwW6si/o0M2pTEpQqvg== +"@abp/lodash@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-2.0.1.tgz#2f8932eddcc54d569ff37525d5da5219c68247c4" + integrity sha512-YsnQwXDH1EAz/fUs42E5TxclMaHN00oSWqGNmWrVqPMIw671sjyFf8QwQWIQujlo/7hXNYMxwmh5VGqR0TKNqQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" lodash "^4.17.15" -"@abp/luxon@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-1.1.1.tgz#ec389270d78bb271d52163ab3773f549aa91751e" - integrity sha512-WNu8JRSb5FDXfcDwjMYyeYeUN48uuDc/I2cdo3xd1rcY+lbmbzxoG9IYOlE8cRHdgX3z82qsZXFs2lcAy0Le2g== +"@abp/luxon@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-2.0.1.tgz#6d0780254699171a509ab6bd5b1dd1a6ebc96468" + integrity sha512-tVdGgfH/ZvKAUYDiVB9x7WnyrXtUQGl7grvdFnXU8fzH0X8HNsQ4cSswlfMNQhiew8es93UqsjCx9VU8wZT08g== dependencies: luxon "^1.21.3" -"@abp/malihu-custom-scrollbar-plugin@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-1.1.1.tgz#73f8423c29d646dc7f0f270d1d7ef05947333e2a" - integrity sha512-n4b4QK/L1Czdx0oOpUR/bWjK9VENexfUSV/aMjwzHhDmEFABAmEfhIpudCYDwewGswrd7C9agmBvakv2rwPQeA== +"@abp/malihu-custom-scrollbar-plugin@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-2.0.1.tgz#7099199447db1d49eebd12519bbecba80a49c243" + integrity sha512-Ljqt/poELw9xGr+fh29Ui/cA1zFLcOTZzy6/OyGUWW+BaMGjY8CY5k47ZlI0Vo3MGZpHu0AECKF95/P0RqBd9w== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" malihu-custom-scrollbar-plugin "^3.1.5" -"@abp/select2@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-1.1.1.tgz#777967821cfcc4bd1c9fc895e913427fbb330abe" - integrity sha512-t0qcJhD+uo2+XWr4nmMQLAx7MRGQUBdZ81YmGty045ReoSaEKQf4haLkzBcMzpBRusiyMQO/PbxjtwMw/xJQTQ== +"@abp/select2@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-2.0.1.tgz#f274a3fc51e79fd556012844b54bbbfa0d7fedbf" + integrity sha512-RertY05XH+UWp+zipVt0BKGW7Rm3Yn5EZOKKTwlFJ0ciUfPRxkVl70I4xSEgm3Naq83WEH2MmwyOx4yntKZoaQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" select2 "^4.0.12" -"@abp/sweetalert@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-1.1.1.tgz#e055ea46eb4e3d53e623ee0aada9b2d16fea5610" - integrity sha512-V6K/qg7J/bdFmom2kaXYeiLvcmLHFl+MacPX4yYAK2biZdb2pWOkUdmcAzZdOT+UruKfLRhvraVC2uXDySi9NA== +"@abp/sweetalert@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-2.0.1.tgz#8198f43855392d0c07eeb0faac0d68ed5bbdf6b2" + integrity sha512-ZfbQqUNc1PuzchZzCnmhPMuy2mXAvtVEi3CZiLLAy2DHq+jf3Q3jUG9X6hZiqGuyl+Aq5htTX3HLfimca+gVxg== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" sweetalert "^2.1.2" -"@abp/timeago@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-1.1.1.tgz#b626087ca35fb325e8e8a337552694fcbb8a6bf9" - integrity sha512-QYYih/4n6XhCqkRw7fBfyg58T5CHqJHyz7SAfq86RiKAJ4jVtjdSVxj3XKxz8eCb56wZGsO1xXXStI3vdLwwNw== +"@abp/timeago@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-2.0.1.tgz#1f82b07abc281363ada06909143ff09adcee2c13" + integrity sha512-zxvoOt2N7ikF1lZ5EBbSWuNdPsn6Z1O+JtnF5B73WEZ0JGp3wVrLN10RkvHLyDqI86dn0SKrocXvFCMEIot7vA== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" timeago "^1.6.7" -"@abp/toastr@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-1.1.1.tgz#aeb6a8ef8004fce136997f9ee3af7dd241890d50" - integrity sha512-GDewBppm+0FO6kTTy0huczoH9P5q6lFicHFAoEawAMkuWJFW/Ihv/YnEvKGDQwGftuVSWexfqBMN/RZ5YSOiGQ== +"@abp/toastr@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-2.0.1.tgz#3f41d53bdb66a0b1fe400ae190958540ce2616c1" + integrity sha512-cgOlPVuOyw+4Av9ZXqaQIdKzMTJCpxdd60hSm4drYoq0m7wQADL0X5LB7rH/8i/oPvn+BAD2gRomGZEhTSgouw== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" toastr "^2.1.4" "@fortawesome/fontawesome-free@^5.11.2": diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi/MyCompanyName.MyProjectName.HttpApi.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi/MyCompanyName.MyProjectName.HttpApi.csproj index 639a3115bd..00f7d4477f 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi/MyCompanyName.MyProjectName.HttpApi.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi/MyCompanyName.MyProjectName.HttpApi.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj index aecc6831be..160fcffc46 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj @@ -1,4 +1,4 @@ - + @@ -12,7 +12,7 @@ true false true - MyCompanyName-MyProjectName-4681b4fd-151f-4221-84a4-929d86723e4c + MyCompanyName.MyProjectName-4681b4fd-151f-4221-84a4-929d86723e4c @@ -32,7 +32,7 @@ - + @@ -43,6 +43,8 @@ + + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs index 2e2211791e..c20e77adf1 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs @@ -18,6 +18,7 @@ using Volo.Abp.AspNetCore.Mvc.UI; using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; +using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.Auditing; using Volo.Abp.Autofac; using Volo.Abp.BackgroundJobs; @@ -35,7 +36,8 @@ namespace MyCompanyName.MyProjectName typeof(AbpAccountWebIdentityServerModule), typeof(AbpAccountApplicationModule), typeof(AbpAspNetCoreMvcUiBasicThemeModule), - typeof(MyProjectNameEntityFrameworkCoreDbMigrationsModule) + typeof(MyProjectNameEntityFrameworkCoreDbMigrationsModule), + typeof(AbpAspNetCoreSerilogModule) )] public class MyProjectNameIdentityServerModule : AbpModule { @@ -59,6 +61,7 @@ namespace MyCompanyName.MyProjectName options.Languages.Add(new LanguageInfo("pt-BR", "pt-BR", "Português")); 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", "繁體中文")); }); Configure(options => @@ -149,6 +152,7 @@ namespace MyCompanyName.MyProjectName app.UseAuthorization(); app.UseAbpRequestLocalization(); app.UseAuditing(); + app.UseAbpSerilogEnrichers(); app.UseMvcWithDefaultRouteAndArea(); } } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/package.json b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/package.json index 436db35985..5aa3341b9c 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/package.json +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/package.json @@ -3,6 +3,6 @@ "name": "my-app-identityserver", "private": true, "dependencies": { - "@abp/aspnetcore.mvc.ui.theme.basic": "^1.1.1" + "@abp/aspnetcore.mvc.ui.theme.basic": "^2.0.1" } } \ No newline at end of file diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/yarn.lock b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/yarn.lock index 12cad6c691..8d232d1d09 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/yarn.lock +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.IdentityServer/yarn.lock @@ -2,37 +2,37 @@ # yarn lockfile v1 -"@abp/aspnetcore.mvc.ui.theme.basic@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-1.1.1.tgz#a3d21f8cc5ede2e85b881fe69d9ecd5fc2268e47" - integrity sha512-ooXtCM3TWN69RU7xs6avnzOQBXzsiHY5BEIogzSBialZC4uG5H56qrIr4MbsFNae+PQM23Mw2tnJ/Z7dutURCQ== +"@abp/aspnetcore.mvc.ui.theme.basic@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-2.0.1.tgz#e336c8e3b52b04177fc4039c54f67984f8230f6f" + integrity sha512-yMYL8Q1DdS5Dt8nHz5K0ca+4uQ853iOLts/gWmJ4YybWxn4BMu17hlFWpdbmYrtLCW8n45yRYy8dp+9go8zCQw== dependencies: - "@abp/aspnetcore.mvc.ui.theme.shared" "^1.1.1" + "@abp/aspnetcore.mvc.ui.theme.shared" "^2.0.1" -"@abp/aspnetcore.mvc.ui.theme.shared@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-1.1.1.tgz#b5eb57bcebcf211a75cf7d540dcc89a0f9ade013" - integrity sha512-LilSyefzT1+rcTU7vbWxcO8TwBgGZIx6QbMUrDicSTH6LLJ9S5+yNaGNJbbZKDG6qx0BEoC1u8dE8KCUshwxoQ== - dependencies: - "@abp/aspnetcore.mvc.ui" "^1.1.1" - "@abp/bootstrap" "^1.1.1" - "@abp/bootstrap-datepicker" "^1.1.1" - "@abp/datatables.net-bs4" "^1.1.1" - "@abp/font-awesome" "^1.1.1" - "@abp/jquery-form" "^1.1.1" - "@abp/jquery-validation-unobtrusive" "^1.1.1" - "@abp/lodash" "^1.1.1" - "@abp/luxon" "^1.1.1" - "@abp/malihu-custom-scrollbar-plugin" "^1.1.1" - "@abp/select2" "^1.1.1" - "@abp/sweetalert" "^1.1.1" - "@abp/timeago" "^1.1.1" - "@abp/toastr" "^1.1.1" - -"@abp/aspnetcore.mvc.ui@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-1.1.1.tgz#9d693516b6a215dfd2113db9ef52f02881a3e1d5" - integrity sha512-wZbptVCSxZzEjkJx+/sWrH9Pikp9nOy7V8Htz+L+S7/qAzfXu5PRVV8ahddfAcDHRk30buRhdbJlCVdt6hkZ6g== +"@abp/aspnetcore.mvc.ui.theme.shared@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-2.0.1.tgz#2bad208bfc422e6be12f22431c713180d924e17c" + integrity sha512-6/ZnF4dFbmpiqDIx3Lc2NJpCNcpmvrEh6kDZC5x9q3ICTPK/CgspM7dVG2dSpFFkXbDNoGH6i/wJwEUWHOKzYQ== + dependencies: + "@abp/aspnetcore.mvc.ui" "^2.0.1" + "@abp/bootstrap" "^2.0.1" + "@abp/bootstrap-datepicker" "^2.0.1" + "@abp/datatables.net-bs4" "^2.0.1" + "@abp/font-awesome" "^2.0.1" + "@abp/jquery-form" "^2.0.1" + "@abp/jquery-validation-unobtrusive" "^2.0.1" + "@abp/lodash" "^2.0.1" + "@abp/luxon" "^2.0.1" + "@abp/malihu-custom-scrollbar-plugin" "^2.0.1" + "@abp/select2" "^2.0.1" + "@abp/sweetalert" "^2.0.1" + "@abp/timeago" "^2.0.1" + "@abp/toastr" "^2.0.1" + +"@abp/aspnetcore.mvc.ui@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-2.0.1.tgz#2c319182f7ab5f99059df4d36cf894deeba20023" + integrity sha512-bLTyfqoPrzHrdPIw3twJrILO99fzHJZrUJmJDuk5cT1Ox+bCv3AAxi7UEEaOQdjDdZlURq86SKM5x/EndeGpHA== dependencies: ansi-colors "^4.1.1" extend-object "^1.0.0" @@ -41,135 +41,135 @@ path "^0.12.7" rimraf "^3.0.0" -"@abp/bootstrap-datepicker@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-1.1.1.tgz#fb1ceec1df24f384a6349c4acfb3627e02e4a42f" - integrity sha512-RIQLSrKBu/cTAU2lFenSAoKcMp7wgF4e3nP4/iOu5ZtCgti5vUjMEcqEvBxtlwKTHMXsTG4GtNKqjTwjXMjONQ== +"@abp/bootstrap-datepicker@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-2.0.1.tgz#458361b7c7ba8c4fc260e9117ae52f054cbab705" + integrity sha512-mkF2ioq1UxOw7K2IDzzjuLco/V/HNkB5t7HqDfnNt9JFEt71ms2xRFe8KLxpr9MUWB9MdzlGo4ywyHzGxA61mg== dependencies: bootstrap-datepicker "^1.9.0" -"@abp/bootstrap@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-1.1.1.tgz#e16fae6ff6b18096276219edf3483fd8f41c925d" - integrity sha512-OIaGJaizhI8UNfy4bnw2xT2Z0QG7BJJrjxOPGepfd4jn/AUi/vFdOpJFWvu2P9PwSzRmn/LuSlr2WONDOdPVWQ== +"@abp/bootstrap@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-2.0.1.tgz#78d6a7c0787787fd92f8d19c7f8cfee05d8f863e" + integrity sha512-GFAho519IBIK0199LCK5NpuaG44w0Tmjjmxns3V+MbzdXGa5d3hZzuPDhYv6hOB9Aj5d0UIqT39KmvrbHAgvuQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" bootstrap "^4.3.1" -"@abp/core@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/core/-/core-1.1.1.tgz#1379145980d6b142fd0123200c60ffb206149d56" - integrity sha512-OvUG7xRvk8nSqwC1s45YPnTuhC2OWe1AVa1nnC6FVHMH/g1Je7UJwnbu47K7uNS+lDRJUIktNbufYKiwutEjRg== +"@abp/core@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/core/-/core-2.0.1.tgz#441b231f7deb4356f71fdc853873ee3e7eacebea" + integrity sha512-5m5Buci+efcmkxPkVWAIAad6idvXS5qSqK/oq8fJj2I4J95ug8CUWRwg7cFzZGLljUKX6kEbCtB//NBCoI+aJA== -"@abp/datatables.net-bs4@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-1.1.1.tgz#c7e79534c2e4b51b3e98bcc0df3292cb08ae9d2e" - integrity sha512-t40xQIGBMLPZiSbcZHW3AwE8uk+xcl7OitBT1jym0XPKVtgJsHez3ynDE5v/PjHe+ColCG8lTRjRnNoXo5dzDw== +"@abp/datatables.net-bs4@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-2.0.1.tgz#fac4afdd44784f3cdd395830cda4b2781a817c05" + integrity sha512-jD2cxrPSxfzjM6xSDBiHJuxk6wj6wBQsD4+Go0kOicQSEzDef9CCN8hi8NsCITosAXVAEIoHGwE1uTlK6sir5Q== dependencies: - "@abp/datatables.net" "^1.1.1" + "@abp/datatables.net" "^2.0.1" datatables.net-bs4 "^1.10.20" -"@abp/datatables.net@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-1.1.1.tgz#de8b362c29f452188624536cdd6feccad2b533e6" - integrity sha512-y76IDBlgc0n1YgQqJ+9cfzXpLwr2arhdIfSmqX+qRXz6GfVNY7e3JijkFSgDKUzKGYo1HZMzgJmDmeNIRwMZsQ== +"@abp/datatables.net@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-2.0.1.tgz#3a0a5e5a836fe058d43798139349d92996ea9478" + integrity sha512-xEsvLofWj0W1ieplwEM4j5SEpoW3zS/yRQczHGMWBTR1Uazy0ysqQwMau+nRsNz7z12cFfooVG2mNzfkWRa84g== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" datatables.net "^1.10.20" -"@abp/font-awesome@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-1.1.1.tgz#7f0a210eb7611d75542028b0c88a0c83f1d9db50" - integrity sha512-6RHbixi7IVWAb3JCHrUmEYD3HmAH4R75Nuo54LvFzATrh4G6gdBONIeDuTo79OTxe4Zhp+WLxeA49Y21kt77mg== +"@abp/font-awesome@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-2.0.1.tgz#738e5d8a93c29ba13f019a1f0198b9272c644e5c" + integrity sha512-+2yQ3RRMTkj0QsxbYB1gHzqEM+/yiFpuXakKTHxFnCZjgZhmmU229hm14xWbpyWsKohbtrr4R/te1WBrqryqPA== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" "@fortawesome/fontawesome-free" "^5.11.2" -"@abp/jquery-form@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-1.1.1.tgz#1dae1145da720e222efcb396906c3fbe5a3dd29f" - integrity sha512-AIIdN36f8xwr4LgiNnBHohJ5tlxh/r+DuDtXcScpZN6GWBE+XgUotN0pZIIva82IxCyUNdDudzgluX9IjI+00w== +"@abp/jquery-form@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-2.0.1.tgz#e92b9ad75a4f08c63b1005d97d8baeb689ebfe6c" + integrity sha512-A/imqgswwLrU+mR1oyDeVW5PDCIBQk/sMtU/PvRXaNL9c59nU5EVWIuPzORDzpkoECtuNMqStjERHc9IROMjnA== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" jquery-form "^4.2.2" -"@abp/jquery-validation-unobtrusive@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-1.1.1.tgz#aeba0883260f47ab22a39343817b1811fc2b81a9" - integrity sha512-q1b0KG8l3DXUiW8JXdq9l1jR/CwgzrZdxwdKGLB2J/oxHlywQIb7yrjR6WGCshjPpcx2SkOL0j/ZXMIMh533hQ== +"@abp/jquery-validation-unobtrusive@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-2.0.1.tgz#e4ed82f6432bba68139210552a9e7800d838d788" + integrity sha512-72XyC3megf6VXm283pCXB5kctbNLmI/EtfoIEp+FffTUmxCoL+gEEnqb1V+7dMUm5QYCNDnhYWk7K6TTxBPGPw== dependencies: - "@abp/jquery-validation" "^1.1.1" + "@abp/jquery-validation" "^2.0.1" jquery-validation-unobtrusive "^3.2.11" -"@abp/jquery-validation@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-1.1.1.tgz#03febd285ce9d7e5681619897967b0ccde7e8e04" - integrity sha512-YvAjIW8epp+ddu01BTUkZWPfEADAvNPJeUrrZ6OpcPWM15Tf+ddr4ATgJ1LCg0Bh5F09iQC855osow3lt8sc7g== +"@abp/jquery-validation@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-2.0.1.tgz#f0287d8687275b400a15d4ce8dc76d40b8b38cee" + integrity sha512-18teWDVaMVHGEHc8eGuK7yUG+H6HxlKBRtB0L+VCYiUYsnTKshu+4DvSf0QTtGcbKquY8ui9AwgDnWZJ8Qqjqg== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" jquery-validation "^1.19.1" -"@abp/jquery@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-1.1.1.tgz#56928814bb3df73c1c0014d4b18fef09ec06e195" - integrity sha512-kj4BTtXF0VbCzCqRXnRVEbGndR3F8NlbBhVQN6BQktOuZta3fvx7f2+pSok8vQv0ddmqUFY7FTT2Ei3l4363LQ== +"@abp/jquery@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-2.0.1.tgz#0048b2344523c1c1d602d81291adf35fe9234d62" + integrity sha512-daM0nlxHW3iGoLh8sq03/co2dF9aM6LYqj5hFAHnmwx0UunDnS0rXkgbRieu66tGPvk325Qb2S1Ibpjn8/CqAQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" jquery "^3.4.1" -"@abp/lodash@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-1.1.1.tgz#aa6ef3a85b9827796e295f440b29f0611c508b5f" - integrity sha512-nH7bRS28Tf4hEXcpKHd1IM+MzYTqX8t3htGmsLX4UESQd52eODYOIldtX6gm3OW1O6ECwW6si/o0M2pTEpQqvg== +"@abp/lodash@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-2.0.1.tgz#2f8932eddcc54d569ff37525d5da5219c68247c4" + integrity sha512-YsnQwXDH1EAz/fUs42E5TxclMaHN00oSWqGNmWrVqPMIw671sjyFf8QwQWIQujlo/7hXNYMxwmh5VGqR0TKNqQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" lodash "^4.17.15" -"@abp/luxon@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-1.1.1.tgz#ec389270d78bb271d52163ab3773f549aa91751e" - integrity sha512-WNu8JRSb5FDXfcDwjMYyeYeUN48uuDc/I2cdo3xd1rcY+lbmbzxoG9IYOlE8cRHdgX3z82qsZXFs2lcAy0Le2g== +"@abp/luxon@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-2.0.1.tgz#6d0780254699171a509ab6bd5b1dd1a6ebc96468" + integrity sha512-tVdGgfH/ZvKAUYDiVB9x7WnyrXtUQGl7grvdFnXU8fzH0X8HNsQ4cSswlfMNQhiew8es93UqsjCx9VU8wZT08g== dependencies: luxon "^1.21.3" -"@abp/malihu-custom-scrollbar-plugin@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-1.1.1.tgz#73f8423c29d646dc7f0f270d1d7ef05947333e2a" - integrity sha512-n4b4QK/L1Czdx0oOpUR/bWjK9VENexfUSV/aMjwzHhDmEFABAmEfhIpudCYDwewGswrd7C9agmBvakv2rwPQeA== +"@abp/malihu-custom-scrollbar-plugin@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-2.0.1.tgz#7099199447db1d49eebd12519bbecba80a49c243" + integrity sha512-Ljqt/poELw9xGr+fh29Ui/cA1zFLcOTZzy6/OyGUWW+BaMGjY8CY5k47ZlI0Vo3MGZpHu0AECKF95/P0RqBd9w== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" malihu-custom-scrollbar-plugin "^3.1.5" -"@abp/select2@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-1.1.1.tgz#777967821cfcc4bd1c9fc895e913427fbb330abe" - integrity sha512-t0qcJhD+uo2+XWr4nmMQLAx7MRGQUBdZ81YmGty045ReoSaEKQf4haLkzBcMzpBRusiyMQO/PbxjtwMw/xJQTQ== +"@abp/select2@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-2.0.1.tgz#f274a3fc51e79fd556012844b54bbbfa0d7fedbf" + integrity sha512-RertY05XH+UWp+zipVt0BKGW7Rm3Yn5EZOKKTwlFJ0ciUfPRxkVl70I4xSEgm3Naq83WEH2MmwyOx4yntKZoaQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" select2 "^4.0.12" -"@abp/sweetalert@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-1.1.1.tgz#e055ea46eb4e3d53e623ee0aada9b2d16fea5610" - integrity sha512-V6K/qg7J/bdFmom2kaXYeiLvcmLHFl+MacPX4yYAK2biZdb2pWOkUdmcAzZdOT+UruKfLRhvraVC2uXDySi9NA== +"@abp/sweetalert@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-2.0.1.tgz#8198f43855392d0c07eeb0faac0d68ed5bbdf6b2" + integrity sha512-ZfbQqUNc1PuzchZzCnmhPMuy2mXAvtVEi3CZiLLAy2DHq+jf3Q3jUG9X6hZiqGuyl+Aq5htTX3HLfimca+gVxg== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" sweetalert "^2.1.2" -"@abp/timeago@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-1.1.1.tgz#b626087ca35fb325e8e8a337552694fcbb8a6bf9" - integrity sha512-QYYih/4n6XhCqkRw7fBfyg58T5CHqJHyz7SAfq86RiKAJ4jVtjdSVxj3XKxz8eCb56wZGsO1xXXStI3vdLwwNw== +"@abp/timeago@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-2.0.1.tgz#1f82b07abc281363ada06909143ff09adcee2c13" + integrity sha512-zxvoOt2N7ikF1lZ5EBbSWuNdPsn6Z1O+JtnF5B73WEZ0JGp3wVrLN10RkvHLyDqI86dn0SKrocXvFCMEIot7vA== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" timeago "^1.6.7" -"@abp/toastr@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-1.1.1.tgz#aeb6a8ef8004fce136997f9ee3af7dd241890d50" - integrity sha512-GDewBppm+0FO6kTTy0huczoH9P5q6lFicHFAoEawAMkuWJFW/Ihv/YnEvKGDQwGftuVSWexfqBMN/RZ5YSOiGQ== +"@abp/toastr@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-2.0.1.tgz#3f41d53bdb66a0b1fe400ae190958540ce2616c1" + integrity sha512-cgOlPVuOyw+4Av9ZXqaQIdKzMTJCpxdd60hSm4drYoq0m7wQADL0X5LB7rH/8i/oPvn+BAD2gRomGZEhTSgouw== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" toastr "^2.1.4" "@fortawesome/fontawesome-free@^5.11.2": diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MyCompanyName.MyProjectName.MongoDB.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MyCompanyName.MyProjectName.MongoDB.csproj index 178ad5de8c..d17f40e727 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MyCompanyName.MyProjectName.MongoDB.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MyCompanyName.MyProjectName.MongoDB.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Menus/MyProjectNameMenuContributor.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Menus/MyProjectNameMenuContributor.cs index f7ef2c2093..2a12f2ee32 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Menus/MyProjectNameMenuContributor.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/Menus/MyProjectNameMenuContributor.cs @@ -8,6 +8,7 @@ using MyCompanyName.MyProjectName.MultiTenancy; using Volo.Abp.Account.Localization; using Volo.Abp.TenantManagement.Web.Navigation; using Volo.Abp.UI.Navigation; +using Volo.Abp.Users; namespace MyCompanyName.MyProjectName.Web.Menus { @@ -51,11 +52,15 @@ namespace MyCompanyName.MyProjectName.Web.Menus { var l = context.ServiceProvider.GetRequiredService>(); var accountStringLocalizer = context.ServiceProvider.GetRequiredService>(); + var currentUser = context.ServiceProvider.GetRequiredService(); var identityServerUrl = _configuration["AuthServer:Authority"] ?? ""; - context.Menu.AddItem(new ApplicationMenuItem("Account.Manage", accountStringLocalizer["ManageYourProfile"], $"{identityServerUrl.EnsureEndsWith('/')}Account/Manage", icon: "fa fa-cog", order: 1000, null, "_blank")); - context.Menu.AddItem(new ApplicationMenuItem("Account.Logout", l["Logout"], url: "/Account/Logout", icon: "fa fa-power-off", order: int.MaxValue - 1000)); + if (currentUser.IsAuthenticated) + { + context.Menu.AddItem(new ApplicationMenuItem("Account.Manage", accountStringLocalizer["ManageYourProfile"], $"{identityServerUrl.EnsureEndsWith('/')}Account/Manage", icon: "fa fa-cog", order: 1000, null, "_blank")); + context.Menu.AddItem(new ApplicationMenuItem("Account.Logout", l["Logout"], url: "/Account/Logout", icon: "fa fa-power-off", order: int.MaxValue - 1000)); + } return Task.CompletedTask; } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj index 66864acc82..697cbe1b44 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj @@ -1,4 +1,4 @@ - + @@ -12,14 +12,14 @@ true false true - MyCompanyName-MyProjectName-4681b4fd-151f-4221-84a4-929d86723e4c + MyCompanyName.MyProjectName-4681b4fd-151f-4221-84a4-929d86723e4c - + - + @@ -29,6 +29,8 @@ + + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs index 28afed0c7c..d2b050644f 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebModule.cs @@ -22,6 +22,7 @@ using Volo.Abp.AspNetCore.Mvc.UI; using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; +using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.Autofac; using Volo.Abp.AutoMapper; using Volo.Abp.Caching; @@ -49,7 +50,8 @@ namespace MyCompanyName.MyProjectName.Web typeof(AbpFeatureManagementWebModule), typeof(AbpHttpClientIdentityModelModule), typeof(AbpIdentityWebModule), - typeof(AbpTenantManagementWebModule) + typeof(AbpTenantManagementWebModule), + typeof(AbpAspNetCoreSerilogModule) )] public class MyProjectNameWebModule : AbpModule { @@ -241,7 +243,7 @@ namespace MyCompanyName.MyProjectName.Web }); app.UseAuditing(); - + app.UseAbpSerilogEnrichers(); app.UseMvcWithDefaultRouteAndArea(); } } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/package.json b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/package.json index 35b0592f57..96b4f2fdbf 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/package.json +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/package.json @@ -3,6 +3,6 @@ "name": "my-app", "private": true, "dependencies": { - "@abp/aspnetcore.mvc.ui.theme.basic": "^1.1.1" + "@abp/aspnetcore.mvc.ui.theme.basic": "^2.0.1" } } \ No newline at end of file diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/yarn.lock b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/yarn.lock index 12cad6c691..8d232d1d09 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/yarn.lock +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web.Host/yarn.lock @@ -2,37 +2,37 @@ # yarn lockfile v1 -"@abp/aspnetcore.mvc.ui.theme.basic@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-1.1.1.tgz#a3d21f8cc5ede2e85b881fe69d9ecd5fc2268e47" - integrity sha512-ooXtCM3TWN69RU7xs6avnzOQBXzsiHY5BEIogzSBialZC4uG5H56qrIr4MbsFNae+PQM23Mw2tnJ/Z7dutURCQ== +"@abp/aspnetcore.mvc.ui.theme.basic@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-2.0.1.tgz#e336c8e3b52b04177fc4039c54f67984f8230f6f" + integrity sha512-yMYL8Q1DdS5Dt8nHz5K0ca+4uQ853iOLts/gWmJ4YybWxn4BMu17hlFWpdbmYrtLCW8n45yRYy8dp+9go8zCQw== dependencies: - "@abp/aspnetcore.mvc.ui.theme.shared" "^1.1.1" + "@abp/aspnetcore.mvc.ui.theme.shared" "^2.0.1" -"@abp/aspnetcore.mvc.ui.theme.shared@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-1.1.1.tgz#b5eb57bcebcf211a75cf7d540dcc89a0f9ade013" - integrity sha512-LilSyefzT1+rcTU7vbWxcO8TwBgGZIx6QbMUrDicSTH6LLJ9S5+yNaGNJbbZKDG6qx0BEoC1u8dE8KCUshwxoQ== - dependencies: - "@abp/aspnetcore.mvc.ui" "^1.1.1" - "@abp/bootstrap" "^1.1.1" - "@abp/bootstrap-datepicker" "^1.1.1" - "@abp/datatables.net-bs4" "^1.1.1" - "@abp/font-awesome" "^1.1.1" - "@abp/jquery-form" "^1.1.1" - "@abp/jquery-validation-unobtrusive" "^1.1.1" - "@abp/lodash" "^1.1.1" - "@abp/luxon" "^1.1.1" - "@abp/malihu-custom-scrollbar-plugin" "^1.1.1" - "@abp/select2" "^1.1.1" - "@abp/sweetalert" "^1.1.1" - "@abp/timeago" "^1.1.1" - "@abp/toastr" "^1.1.1" - -"@abp/aspnetcore.mvc.ui@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-1.1.1.tgz#9d693516b6a215dfd2113db9ef52f02881a3e1d5" - integrity sha512-wZbptVCSxZzEjkJx+/sWrH9Pikp9nOy7V8Htz+L+S7/qAzfXu5PRVV8ahddfAcDHRk30buRhdbJlCVdt6hkZ6g== +"@abp/aspnetcore.mvc.ui.theme.shared@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-2.0.1.tgz#2bad208bfc422e6be12f22431c713180d924e17c" + integrity sha512-6/ZnF4dFbmpiqDIx3Lc2NJpCNcpmvrEh6kDZC5x9q3ICTPK/CgspM7dVG2dSpFFkXbDNoGH6i/wJwEUWHOKzYQ== + dependencies: + "@abp/aspnetcore.mvc.ui" "^2.0.1" + "@abp/bootstrap" "^2.0.1" + "@abp/bootstrap-datepicker" "^2.0.1" + "@abp/datatables.net-bs4" "^2.0.1" + "@abp/font-awesome" "^2.0.1" + "@abp/jquery-form" "^2.0.1" + "@abp/jquery-validation-unobtrusive" "^2.0.1" + "@abp/lodash" "^2.0.1" + "@abp/luxon" "^2.0.1" + "@abp/malihu-custom-scrollbar-plugin" "^2.0.1" + "@abp/select2" "^2.0.1" + "@abp/sweetalert" "^2.0.1" + "@abp/timeago" "^2.0.1" + "@abp/toastr" "^2.0.1" + +"@abp/aspnetcore.mvc.ui@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-2.0.1.tgz#2c319182f7ab5f99059df4d36cf894deeba20023" + integrity sha512-bLTyfqoPrzHrdPIw3twJrILO99fzHJZrUJmJDuk5cT1Ox+bCv3AAxi7UEEaOQdjDdZlURq86SKM5x/EndeGpHA== dependencies: ansi-colors "^4.1.1" extend-object "^1.0.0" @@ -41,135 +41,135 @@ path "^0.12.7" rimraf "^3.0.0" -"@abp/bootstrap-datepicker@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-1.1.1.tgz#fb1ceec1df24f384a6349c4acfb3627e02e4a42f" - integrity sha512-RIQLSrKBu/cTAU2lFenSAoKcMp7wgF4e3nP4/iOu5ZtCgti5vUjMEcqEvBxtlwKTHMXsTG4GtNKqjTwjXMjONQ== +"@abp/bootstrap-datepicker@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-2.0.1.tgz#458361b7c7ba8c4fc260e9117ae52f054cbab705" + integrity sha512-mkF2ioq1UxOw7K2IDzzjuLco/V/HNkB5t7HqDfnNt9JFEt71ms2xRFe8KLxpr9MUWB9MdzlGo4ywyHzGxA61mg== dependencies: bootstrap-datepicker "^1.9.0" -"@abp/bootstrap@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-1.1.1.tgz#e16fae6ff6b18096276219edf3483fd8f41c925d" - integrity sha512-OIaGJaizhI8UNfy4bnw2xT2Z0QG7BJJrjxOPGepfd4jn/AUi/vFdOpJFWvu2P9PwSzRmn/LuSlr2WONDOdPVWQ== +"@abp/bootstrap@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-2.0.1.tgz#78d6a7c0787787fd92f8d19c7f8cfee05d8f863e" + integrity sha512-GFAho519IBIK0199LCK5NpuaG44w0Tmjjmxns3V+MbzdXGa5d3hZzuPDhYv6hOB9Aj5d0UIqT39KmvrbHAgvuQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" bootstrap "^4.3.1" -"@abp/core@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/core/-/core-1.1.1.tgz#1379145980d6b142fd0123200c60ffb206149d56" - integrity sha512-OvUG7xRvk8nSqwC1s45YPnTuhC2OWe1AVa1nnC6FVHMH/g1Je7UJwnbu47K7uNS+lDRJUIktNbufYKiwutEjRg== +"@abp/core@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/core/-/core-2.0.1.tgz#441b231f7deb4356f71fdc853873ee3e7eacebea" + integrity sha512-5m5Buci+efcmkxPkVWAIAad6idvXS5qSqK/oq8fJj2I4J95ug8CUWRwg7cFzZGLljUKX6kEbCtB//NBCoI+aJA== -"@abp/datatables.net-bs4@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-1.1.1.tgz#c7e79534c2e4b51b3e98bcc0df3292cb08ae9d2e" - integrity sha512-t40xQIGBMLPZiSbcZHW3AwE8uk+xcl7OitBT1jym0XPKVtgJsHez3ynDE5v/PjHe+ColCG8lTRjRnNoXo5dzDw== +"@abp/datatables.net-bs4@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-2.0.1.tgz#fac4afdd44784f3cdd395830cda4b2781a817c05" + integrity sha512-jD2cxrPSxfzjM6xSDBiHJuxk6wj6wBQsD4+Go0kOicQSEzDef9CCN8hi8NsCITosAXVAEIoHGwE1uTlK6sir5Q== dependencies: - "@abp/datatables.net" "^1.1.1" + "@abp/datatables.net" "^2.0.1" datatables.net-bs4 "^1.10.20" -"@abp/datatables.net@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-1.1.1.tgz#de8b362c29f452188624536cdd6feccad2b533e6" - integrity sha512-y76IDBlgc0n1YgQqJ+9cfzXpLwr2arhdIfSmqX+qRXz6GfVNY7e3JijkFSgDKUzKGYo1HZMzgJmDmeNIRwMZsQ== +"@abp/datatables.net@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-2.0.1.tgz#3a0a5e5a836fe058d43798139349d92996ea9478" + integrity sha512-xEsvLofWj0W1ieplwEM4j5SEpoW3zS/yRQczHGMWBTR1Uazy0ysqQwMau+nRsNz7z12cFfooVG2mNzfkWRa84g== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" datatables.net "^1.10.20" -"@abp/font-awesome@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-1.1.1.tgz#7f0a210eb7611d75542028b0c88a0c83f1d9db50" - integrity sha512-6RHbixi7IVWAb3JCHrUmEYD3HmAH4R75Nuo54LvFzATrh4G6gdBONIeDuTo79OTxe4Zhp+WLxeA49Y21kt77mg== +"@abp/font-awesome@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-2.0.1.tgz#738e5d8a93c29ba13f019a1f0198b9272c644e5c" + integrity sha512-+2yQ3RRMTkj0QsxbYB1gHzqEM+/yiFpuXakKTHxFnCZjgZhmmU229hm14xWbpyWsKohbtrr4R/te1WBrqryqPA== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" "@fortawesome/fontawesome-free" "^5.11.2" -"@abp/jquery-form@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-1.1.1.tgz#1dae1145da720e222efcb396906c3fbe5a3dd29f" - integrity sha512-AIIdN36f8xwr4LgiNnBHohJ5tlxh/r+DuDtXcScpZN6GWBE+XgUotN0pZIIva82IxCyUNdDudzgluX9IjI+00w== +"@abp/jquery-form@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-2.0.1.tgz#e92b9ad75a4f08c63b1005d97d8baeb689ebfe6c" + integrity sha512-A/imqgswwLrU+mR1oyDeVW5PDCIBQk/sMtU/PvRXaNL9c59nU5EVWIuPzORDzpkoECtuNMqStjERHc9IROMjnA== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" jquery-form "^4.2.2" -"@abp/jquery-validation-unobtrusive@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-1.1.1.tgz#aeba0883260f47ab22a39343817b1811fc2b81a9" - integrity sha512-q1b0KG8l3DXUiW8JXdq9l1jR/CwgzrZdxwdKGLB2J/oxHlywQIb7yrjR6WGCshjPpcx2SkOL0j/ZXMIMh533hQ== +"@abp/jquery-validation-unobtrusive@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-2.0.1.tgz#e4ed82f6432bba68139210552a9e7800d838d788" + integrity sha512-72XyC3megf6VXm283pCXB5kctbNLmI/EtfoIEp+FffTUmxCoL+gEEnqb1V+7dMUm5QYCNDnhYWk7K6TTxBPGPw== dependencies: - "@abp/jquery-validation" "^1.1.1" + "@abp/jquery-validation" "^2.0.1" jquery-validation-unobtrusive "^3.2.11" -"@abp/jquery-validation@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-1.1.1.tgz#03febd285ce9d7e5681619897967b0ccde7e8e04" - integrity sha512-YvAjIW8epp+ddu01BTUkZWPfEADAvNPJeUrrZ6OpcPWM15Tf+ddr4ATgJ1LCg0Bh5F09iQC855osow3lt8sc7g== +"@abp/jquery-validation@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-2.0.1.tgz#f0287d8687275b400a15d4ce8dc76d40b8b38cee" + integrity sha512-18teWDVaMVHGEHc8eGuK7yUG+H6HxlKBRtB0L+VCYiUYsnTKshu+4DvSf0QTtGcbKquY8ui9AwgDnWZJ8Qqjqg== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" jquery-validation "^1.19.1" -"@abp/jquery@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-1.1.1.tgz#56928814bb3df73c1c0014d4b18fef09ec06e195" - integrity sha512-kj4BTtXF0VbCzCqRXnRVEbGndR3F8NlbBhVQN6BQktOuZta3fvx7f2+pSok8vQv0ddmqUFY7FTT2Ei3l4363LQ== +"@abp/jquery@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-2.0.1.tgz#0048b2344523c1c1d602d81291adf35fe9234d62" + integrity sha512-daM0nlxHW3iGoLh8sq03/co2dF9aM6LYqj5hFAHnmwx0UunDnS0rXkgbRieu66tGPvk325Qb2S1Ibpjn8/CqAQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" jquery "^3.4.1" -"@abp/lodash@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-1.1.1.tgz#aa6ef3a85b9827796e295f440b29f0611c508b5f" - integrity sha512-nH7bRS28Tf4hEXcpKHd1IM+MzYTqX8t3htGmsLX4UESQd52eODYOIldtX6gm3OW1O6ECwW6si/o0M2pTEpQqvg== +"@abp/lodash@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-2.0.1.tgz#2f8932eddcc54d569ff37525d5da5219c68247c4" + integrity sha512-YsnQwXDH1EAz/fUs42E5TxclMaHN00oSWqGNmWrVqPMIw671sjyFf8QwQWIQujlo/7hXNYMxwmh5VGqR0TKNqQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" lodash "^4.17.15" -"@abp/luxon@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-1.1.1.tgz#ec389270d78bb271d52163ab3773f549aa91751e" - integrity sha512-WNu8JRSb5FDXfcDwjMYyeYeUN48uuDc/I2cdo3xd1rcY+lbmbzxoG9IYOlE8cRHdgX3z82qsZXFs2lcAy0Le2g== +"@abp/luxon@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-2.0.1.tgz#6d0780254699171a509ab6bd5b1dd1a6ebc96468" + integrity sha512-tVdGgfH/ZvKAUYDiVB9x7WnyrXtUQGl7grvdFnXU8fzH0X8HNsQ4cSswlfMNQhiew8es93UqsjCx9VU8wZT08g== dependencies: luxon "^1.21.3" -"@abp/malihu-custom-scrollbar-plugin@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-1.1.1.tgz#73f8423c29d646dc7f0f270d1d7ef05947333e2a" - integrity sha512-n4b4QK/L1Czdx0oOpUR/bWjK9VENexfUSV/aMjwzHhDmEFABAmEfhIpudCYDwewGswrd7C9agmBvakv2rwPQeA== +"@abp/malihu-custom-scrollbar-plugin@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-2.0.1.tgz#7099199447db1d49eebd12519bbecba80a49c243" + integrity sha512-Ljqt/poELw9xGr+fh29Ui/cA1zFLcOTZzy6/OyGUWW+BaMGjY8CY5k47ZlI0Vo3MGZpHu0AECKF95/P0RqBd9w== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" malihu-custom-scrollbar-plugin "^3.1.5" -"@abp/select2@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-1.1.1.tgz#777967821cfcc4bd1c9fc895e913427fbb330abe" - integrity sha512-t0qcJhD+uo2+XWr4nmMQLAx7MRGQUBdZ81YmGty045ReoSaEKQf4haLkzBcMzpBRusiyMQO/PbxjtwMw/xJQTQ== +"@abp/select2@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-2.0.1.tgz#f274a3fc51e79fd556012844b54bbbfa0d7fedbf" + integrity sha512-RertY05XH+UWp+zipVt0BKGW7Rm3Yn5EZOKKTwlFJ0ciUfPRxkVl70I4xSEgm3Naq83WEH2MmwyOx4yntKZoaQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" select2 "^4.0.12" -"@abp/sweetalert@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-1.1.1.tgz#e055ea46eb4e3d53e623ee0aada9b2d16fea5610" - integrity sha512-V6K/qg7J/bdFmom2kaXYeiLvcmLHFl+MacPX4yYAK2biZdb2pWOkUdmcAzZdOT+UruKfLRhvraVC2uXDySi9NA== +"@abp/sweetalert@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-2.0.1.tgz#8198f43855392d0c07eeb0faac0d68ed5bbdf6b2" + integrity sha512-ZfbQqUNc1PuzchZzCnmhPMuy2mXAvtVEi3CZiLLAy2DHq+jf3Q3jUG9X6hZiqGuyl+Aq5htTX3HLfimca+gVxg== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" sweetalert "^2.1.2" -"@abp/timeago@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-1.1.1.tgz#b626087ca35fb325e8e8a337552694fcbb8a6bf9" - integrity sha512-QYYih/4n6XhCqkRw7fBfyg58T5CHqJHyz7SAfq86RiKAJ4jVtjdSVxj3XKxz8eCb56wZGsO1xXXStI3vdLwwNw== +"@abp/timeago@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-2.0.1.tgz#1f82b07abc281363ada06909143ff09adcee2c13" + integrity sha512-zxvoOt2N7ikF1lZ5EBbSWuNdPsn6Z1O+JtnF5B73WEZ0JGp3wVrLN10RkvHLyDqI86dn0SKrocXvFCMEIot7vA== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" timeago "^1.6.7" -"@abp/toastr@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-1.1.1.tgz#aeb6a8ef8004fce136997f9ee3af7dd241890d50" - integrity sha512-GDewBppm+0FO6kTTy0huczoH9P5q6lFicHFAoEawAMkuWJFW/Ihv/YnEvKGDQwGftuVSWexfqBMN/RZ5YSOiGQ== +"@abp/toastr@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-2.0.1.tgz#3f41d53bdb66a0b1fe400ae190958540ce2616c1" + integrity sha512-cgOlPVuOyw+4Av9ZXqaQIdKzMTJCpxdd60hSm4drYoq0m7wQADL0X5LB7rH/8i/oPvn+BAD2gRomGZEhTSgouw== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" toastr "^2.1.4" "@fortawesome/fontawesome-free@^5.11.2": diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj index 9540447c74..ce1087911b 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj @@ -1,4 +1,4 @@ - + @@ -12,7 +12,7 @@ true false true - MyCompanyName-MyProjectName-4681b4fd-151f-4221-84a4-929d86723e4c + MyCompanyName.MyProjectName-4681b4fd-151f-4221-84a4-929d86723e4c @@ -32,10 +32,10 @@ - + - + @@ -47,6 +47,7 @@ + diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs index 87626719f3..89cf3c1358 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs @@ -23,6 +23,7 @@ using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; +using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.Autofac; using Volo.Abp.AutoMapper; using Volo.Abp.FeatureManagement; @@ -47,7 +48,8 @@ namespace MyCompanyName.MyProjectName.Web typeof(AbpAccountWebIdentityServerModule), typeof(AbpAspNetCoreMvcUiBasicThemeModule), typeof(AbpAspNetCoreAuthenticationJwtBearerModule), - typeof(AbpTenantManagementWebModule) + typeof(AbpTenantManagementWebModule), + typeof(AbpAspNetCoreSerilogModule) )] public class MyProjectNameWebModule : AbpModule { @@ -152,6 +154,7 @@ namespace MyCompanyName.MyProjectName.Web options.Languages.Add(new LanguageInfo("pt-BR", "pt-BR", "Português")); 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", "繁體中文")); }); } @@ -198,7 +201,6 @@ namespace MyCompanyName.MyProjectName.Web { app.UseErrorPage(); } - app.UseVirtualFiles(); app.UseRouting(); app.UseAuthentication(); @@ -208,18 +210,16 @@ namespace MyCompanyName.MyProjectName.Web { app.UseMultiTenancy(); } - app.UseIdentityServer(); app.UseAuthorization(); app.UseAbpRequestLocalization(); - app.UseSwagger(); app.UseSwaggerUI(options => { options.SwaggerEndpoint("/swagger/v1/swagger.json", "MyProjectName API"); }); - app.UseAuditing(); + app.UseAbpSerilogEnrichers(); app.UseMvcWithDefaultRouteAndArea(); } } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/package.json b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/package.json index 35b0592f57..96b4f2fdbf 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/package.json +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/package.json @@ -3,6 +3,6 @@ "name": "my-app", "private": true, "dependencies": { - "@abp/aspnetcore.mvc.ui.theme.basic": "^1.1.1" + "@abp/aspnetcore.mvc.ui.theme.basic": "^2.0.1" } } \ No newline at end of file diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/yarn.lock b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/yarn.lock index 313032453c..3ef9fe6a7f 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/yarn.lock +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Web/yarn.lock @@ -2,37 +2,37 @@ # yarn lockfile v1 -"@abp/aspnetcore.mvc.ui.theme.basic@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-1.1.1.tgz#a3d21f8cc5ede2e85b881fe69d9ecd5fc2268e47" - integrity sha512-ooXtCM3TWN69RU7xs6avnzOQBXzsiHY5BEIogzSBialZC4uG5H56qrIr4MbsFNae+PQM23Mw2tnJ/Z7dutURCQ== +"@abp/aspnetcore.mvc.ui.theme.basic@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-2.0.1.tgz#e336c8e3b52b04177fc4039c54f67984f8230f6f" + integrity sha512-yMYL8Q1DdS5Dt8nHz5K0ca+4uQ853iOLts/gWmJ4YybWxn4BMu17hlFWpdbmYrtLCW8n45yRYy8dp+9go8zCQw== dependencies: - "@abp/aspnetcore.mvc.ui.theme.shared" "^1.1.1" + "@abp/aspnetcore.mvc.ui.theme.shared" "^2.0.1" -"@abp/aspnetcore.mvc.ui.theme.shared@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-1.1.1.tgz#b5eb57bcebcf211a75cf7d540dcc89a0f9ade013" - integrity sha512-LilSyefzT1+rcTU7vbWxcO8TwBgGZIx6QbMUrDicSTH6LLJ9S5+yNaGNJbbZKDG6qx0BEoC1u8dE8KCUshwxoQ== - dependencies: - "@abp/aspnetcore.mvc.ui" "^1.1.1" - "@abp/bootstrap" "^1.1.1" - "@abp/bootstrap-datepicker" "^1.1.1" - "@abp/datatables.net-bs4" "^1.1.1" - "@abp/font-awesome" "^1.1.1" - "@abp/jquery-form" "^1.1.1" - "@abp/jquery-validation-unobtrusive" "^1.1.1" - "@abp/lodash" "^1.1.1" - "@abp/luxon" "^1.1.1" - "@abp/malihu-custom-scrollbar-plugin" "^1.1.1" - "@abp/select2" "^1.1.1" - "@abp/sweetalert" "^1.1.1" - "@abp/timeago" "^1.1.1" - "@abp/toastr" "^1.1.1" - -"@abp/aspnetcore.mvc.ui@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-1.1.1.tgz#9d693516b6a215dfd2113db9ef52f02881a3e1d5" - integrity sha512-wZbptVCSxZzEjkJx+/sWrH9Pikp9nOy7V8Htz+L+S7/qAzfXu5PRVV8ahddfAcDHRk30buRhdbJlCVdt6hkZ6g== +"@abp/aspnetcore.mvc.ui.theme.shared@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-2.0.1.tgz#2bad208bfc422e6be12f22431c713180d924e17c" + integrity sha512-6/ZnF4dFbmpiqDIx3Lc2NJpCNcpmvrEh6kDZC5x9q3ICTPK/CgspM7dVG2dSpFFkXbDNoGH6i/wJwEUWHOKzYQ== + dependencies: + "@abp/aspnetcore.mvc.ui" "^2.0.1" + "@abp/bootstrap" "^2.0.1" + "@abp/bootstrap-datepicker" "^2.0.1" + "@abp/datatables.net-bs4" "^2.0.1" + "@abp/font-awesome" "^2.0.1" + "@abp/jquery-form" "^2.0.1" + "@abp/jquery-validation-unobtrusive" "^2.0.1" + "@abp/lodash" "^2.0.1" + "@abp/luxon" "^2.0.1" + "@abp/malihu-custom-scrollbar-plugin" "^2.0.1" + "@abp/select2" "^2.0.1" + "@abp/sweetalert" "^2.0.1" + "@abp/timeago" "^2.0.1" + "@abp/toastr" "^2.0.1" + +"@abp/aspnetcore.mvc.ui@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-2.0.1.tgz#2c319182f7ab5f99059df4d36cf894deeba20023" + integrity sha512-bLTyfqoPrzHrdPIw3twJrILO99fzHJZrUJmJDuk5cT1Ox+bCv3AAxi7UEEaOQdjDdZlURq86SKM5x/EndeGpHA== dependencies: ansi-colors "^4.1.1" extend-object "^1.0.0" @@ -41,135 +41,135 @@ path "^0.12.7" rimraf "^3.0.0" -"@abp/bootstrap-datepicker@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-1.1.1.tgz#fb1ceec1df24f384a6349c4acfb3627e02e4a42f" - integrity sha512-RIQLSrKBu/cTAU2lFenSAoKcMp7wgF4e3nP4/iOu5ZtCgti5vUjMEcqEvBxtlwKTHMXsTG4GtNKqjTwjXMjONQ== +"@abp/bootstrap-datepicker@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-2.0.1.tgz#458361b7c7ba8c4fc260e9117ae52f054cbab705" + integrity sha512-mkF2ioq1UxOw7K2IDzzjuLco/V/HNkB5t7HqDfnNt9JFEt71ms2xRFe8KLxpr9MUWB9MdzlGo4ywyHzGxA61mg== dependencies: bootstrap-datepicker "^1.9.0" -"@abp/bootstrap@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-1.1.1.tgz#e16fae6ff6b18096276219edf3483fd8f41c925d" - integrity sha512-OIaGJaizhI8UNfy4bnw2xT2Z0QG7BJJrjxOPGepfd4jn/AUi/vFdOpJFWvu2P9PwSzRmn/LuSlr2WONDOdPVWQ== +"@abp/bootstrap@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-2.0.1.tgz#78d6a7c0787787fd92f8d19c7f8cfee05d8f863e" + integrity sha512-GFAho519IBIK0199LCK5NpuaG44w0Tmjjmxns3V+MbzdXGa5d3hZzuPDhYv6hOB9Aj5d0UIqT39KmvrbHAgvuQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" bootstrap "^4.3.1" -"@abp/core@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/core/-/core-1.1.1.tgz#1379145980d6b142fd0123200c60ffb206149d56" - integrity sha512-OvUG7xRvk8nSqwC1s45YPnTuhC2OWe1AVa1nnC6FVHMH/g1Je7UJwnbu47K7uNS+lDRJUIktNbufYKiwutEjRg== +"@abp/core@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/core/-/core-2.0.1.tgz#441b231f7deb4356f71fdc853873ee3e7eacebea" + integrity sha512-5m5Buci+efcmkxPkVWAIAad6idvXS5qSqK/oq8fJj2I4J95ug8CUWRwg7cFzZGLljUKX6kEbCtB//NBCoI+aJA== -"@abp/datatables.net-bs4@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-1.1.1.tgz#c7e79534c2e4b51b3e98bcc0df3292cb08ae9d2e" - integrity sha512-t40xQIGBMLPZiSbcZHW3AwE8uk+xcl7OitBT1jym0XPKVtgJsHez3ynDE5v/PjHe+ColCG8lTRjRnNoXo5dzDw== +"@abp/datatables.net-bs4@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-2.0.1.tgz#fac4afdd44784f3cdd395830cda4b2781a817c05" + integrity sha512-jD2cxrPSxfzjM6xSDBiHJuxk6wj6wBQsD4+Go0kOicQSEzDef9CCN8hi8NsCITosAXVAEIoHGwE1uTlK6sir5Q== dependencies: - "@abp/datatables.net" "^1.1.1" + "@abp/datatables.net" "^2.0.1" datatables.net-bs4 "^1.10.20" -"@abp/datatables.net@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-1.1.1.tgz#de8b362c29f452188624536cdd6feccad2b533e6" - integrity sha512-y76IDBlgc0n1YgQqJ+9cfzXpLwr2arhdIfSmqX+qRXz6GfVNY7e3JijkFSgDKUzKGYo1HZMzgJmDmeNIRwMZsQ== +"@abp/datatables.net@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-2.0.1.tgz#3a0a5e5a836fe058d43798139349d92996ea9478" + integrity sha512-xEsvLofWj0W1ieplwEM4j5SEpoW3zS/yRQczHGMWBTR1Uazy0ysqQwMau+nRsNz7z12cFfooVG2mNzfkWRa84g== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" datatables.net "^1.10.20" -"@abp/font-awesome@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-1.1.1.tgz#7f0a210eb7611d75542028b0c88a0c83f1d9db50" - integrity sha512-6RHbixi7IVWAb3JCHrUmEYD3HmAH4R75Nuo54LvFzATrh4G6gdBONIeDuTo79OTxe4Zhp+WLxeA49Y21kt77mg== +"@abp/font-awesome@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-2.0.1.tgz#738e5d8a93c29ba13f019a1f0198b9272c644e5c" + integrity sha512-+2yQ3RRMTkj0QsxbYB1gHzqEM+/yiFpuXakKTHxFnCZjgZhmmU229hm14xWbpyWsKohbtrr4R/te1WBrqryqPA== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" "@fortawesome/fontawesome-free" "^5.11.2" -"@abp/jquery-form@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-1.1.1.tgz#1dae1145da720e222efcb396906c3fbe5a3dd29f" - integrity sha512-AIIdN36f8xwr4LgiNnBHohJ5tlxh/r+DuDtXcScpZN6GWBE+XgUotN0pZIIva82IxCyUNdDudzgluX9IjI+00w== +"@abp/jquery-form@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-2.0.1.tgz#e92b9ad75a4f08c63b1005d97d8baeb689ebfe6c" + integrity sha512-A/imqgswwLrU+mR1oyDeVW5PDCIBQk/sMtU/PvRXaNL9c59nU5EVWIuPzORDzpkoECtuNMqStjERHc9IROMjnA== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" jquery-form "^4.2.2" -"@abp/jquery-validation-unobtrusive@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-1.1.1.tgz#aeba0883260f47ab22a39343817b1811fc2b81a9" - integrity sha512-q1b0KG8l3DXUiW8JXdq9l1jR/CwgzrZdxwdKGLB2J/oxHlywQIb7yrjR6WGCshjPpcx2SkOL0j/ZXMIMh533hQ== +"@abp/jquery-validation-unobtrusive@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-2.0.1.tgz#e4ed82f6432bba68139210552a9e7800d838d788" + integrity sha512-72XyC3megf6VXm283pCXB5kctbNLmI/EtfoIEp+FffTUmxCoL+gEEnqb1V+7dMUm5QYCNDnhYWk7K6TTxBPGPw== dependencies: - "@abp/jquery-validation" "^1.1.1" + "@abp/jquery-validation" "^2.0.1" jquery-validation-unobtrusive "^3.2.11" -"@abp/jquery-validation@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-1.1.1.tgz#03febd285ce9d7e5681619897967b0ccde7e8e04" - integrity sha512-YvAjIW8epp+ddu01BTUkZWPfEADAvNPJeUrrZ6OpcPWM15Tf+ddr4ATgJ1LCg0Bh5F09iQC855osow3lt8sc7g== +"@abp/jquery-validation@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-2.0.1.tgz#f0287d8687275b400a15d4ce8dc76d40b8b38cee" + integrity sha512-18teWDVaMVHGEHc8eGuK7yUG+H6HxlKBRtB0L+VCYiUYsnTKshu+4DvSf0QTtGcbKquY8ui9AwgDnWZJ8Qqjqg== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" jquery-validation "^1.19.1" -"@abp/jquery@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-1.1.1.tgz#56928814bb3df73c1c0014d4b18fef09ec06e195" - integrity sha512-kj4BTtXF0VbCzCqRXnRVEbGndR3F8NlbBhVQN6BQktOuZta3fvx7f2+pSok8vQv0ddmqUFY7FTT2Ei3l4363LQ== +"@abp/jquery@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-2.0.1.tgz#0048b2344523c1c1d602d81291adf35fe9234d62" + integrity sha512-daM0nlxHW3iGoLh8sq03/co2dF9aM6LYqj5hFAHnmwx0UunDnS0rXkgbRieu66tGPvk325Qb2S1Ibpjn8/CqAQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" jquery "^3.4.1" -"@abp/lodash@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-1.1.1.tgz#aa6ef3a85b9827796e295f440b29f0611c508b5f" - integrity sha512-nH7bRS28Tf4hEXcpKHd1IM+MzYTqX8t3htGmsLX4UESQd52eODYOIldtX6gm3OW1O6ECwW6si/o0M2pTEpQqvg== +"@abp/lodash@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-2.0.1.tgz#2f8932eddcc54d569ff37525d5da5219c68247c4" + integrity sha512-YsnQwXDH1EAz/fUs42E5TxclMaHN00oSWqGNmWrVqPMIw671sjyFf8QwQWIQujlo/7hXNYMxwmh5VGqR0TKNqQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" lodash "^4.17.15" -"@abp/luxon@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-1.1.1.tgz#ec389270d78bb271d52163ab3773f549aa91751e" - integrity sha512-WNu8JRSb5FDXfcDwjMYyeYeUN48uuDc/I2cdo3xd1rcY+lbmbzxoG9IYOlE8cRHdgX3z82qsZXFs2lcAy0Le2g== +"@abp/luxon@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-2.0.1.tgz#6d0780254699171a509ab6bd5b1dd1a6ebc96468" + integrity sha512-tVdGgfH/ZvKAUYDiVB9x7WnyrXtUQGl7grvdFnXU8fzH0X8HNsQ4cSswlfMNQhiew8es93UqsjCx9VU8wZT08g== dependencies: luxon "^1.21.3" -"@abp/malihu-custom-scrollbar-plugin@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-1.1.1.tgz#73f8423c29d646dc7f0f270d1d7ef05947333e2a" - integrity sha512-n4b4QK/L1Czdx0oOpUR/bWjK9VENexfUSV/aMjwzHhDmEFABAmEfhIpudCYDwewGswrd7C9agmBvakv2rwPQeA== +"@abp/malihu-custom-scrollbar-plugin@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-2.0.1.tgz#7099199447db1d49eebd12519bbecba80a49c243" + integrity sha512-Ljqt/poELw9xGr+fh29Ui/cA1zFLcOTZzy6/OyGUWW+BaMGjY8CY5k47ZlI0Vo3MGZpHu0AECKF95/P0RqBd9w== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" malihu-custom-scrollbar-plugin "^3.1.5" -"@abp/select2@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-1.1.1.tgz#777967821cfcc4bd1c9fc895e913427fbb330abe" - integrity sha512-t0qcJhD+uo2+XWr4nmMQLAx7MRGQUBdZ81YmGty045ReoSaEKQf4haLkzBcMzpBRusiyMQO/PbxjtwMw/xJQTQ== +"@abp/select2@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-2.0.1.tgz#f274a3fc51e79fd556012844b54bbbfa0d7fedbf" + integrity sha512-RertY05XH+UWp+zipVt0BKGW7Rm3Yn5EZOKKTwlFJ0ciUfPRxkVl70I4xSEgm3Naq83WEH2MmwyOx4yntKZoaQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" select2 "^4.0.12" -"@abp/sweetalert@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-1.1.1.tgz#e055ea46eb4e3d53e623ee0aada9b2d16fea5610" - integrity sha512-V6K/qg7J/bdFmom2kaXYeiLvcmLHFl+MacPX4yYAK2biZdb2pWOkUdmcAzZdOT+UruKfLRhvraVC2uXDySi9NA== +"@abp/sweetalert@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-2.0.1.tgz#8198f43855392d0c07eeb0faac0d68ed5bbdf6b2" + integrity sha512-ZfbQqUNc1PuzchZzCnmhPMuy2mXAvtVEi3CZiLLAy2DHq+jf3Q3jUG9X6hZiqGuyl+Aq5htTX3HLfimca+gVxg== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" sweetalert "^2.1.2" -"@abp/timeago@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-1.1.1.tgz#b626087ca35fb325e8e8a337552694fcbb8a6bf9" - integrity sha512-QYYih/4n6XhCqkRw7fBfyg58T5CHqJHyz7SAfq86RiKAJ4jVtjdSVxj3XKxz8eCb56wZGsO1xXXStI3vdLwwNw== +"@abp/timeago@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-2.0.1.tgz#1f82b07abc281363ada06909143ff09adcee2c13" + integrity sha512-zxvoOt2N7ikF1lZ5EBbSWuNdPsn6Z1O+JtnF5B73WEZ0JGp3wVrLN10RkvHLyDqI86dn0SKrocXvFCMEIot7vA== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" timeago "^1.6.7" -"@abp/toastr@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-1.1.1.tgz#aeb6a8ef8004fce136997f9ee3af7dd241890d50" - integrity sha512-GDewBppm+0FO6kTTy0huczoH9P5q6lFicHFAoEawAMkuWJFW/Ihv/YnEvKGDQwGftuVSWexfqBMN/RZ5YSOiGQ== +"@abp/toastr@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-2.0.1.tgz#3f41d53bdb66a0b1fe400ae190958540ce2616c1" + integrity sha512-cgOlPVuOyw+4Av9ZXqaQIdKzMTJCpxdd60hSm4drYoq0m7wQADL0X5LB7rH/8i/oPvn+BAD2gRomGZEhTSgouw== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" toastr "^2.1.4" "@fortawesome/fontawesome-free@^5.11.2": diff --git a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Application.Tests/MyCompanyName.MyProjectName.Application.Tests.csproj b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Application.Tests/MyCompanyName.MyProjectName.Application.Tests.csproj index c23b6af8d5..05ccfc13de 100644 --- a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Application.Tests/MyCompanyName.MyProjectName.Application.Tests.csproj +++ b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Application.Tests/MyCompanyName.MyProjectName.Application.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Domain.Tests/MyCompanyName.MyProjectName.Domain.Tests.csproj b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Domain.Tests/MyCompanyName.MyProjectName.Domain.Tests.csproj index 12f900e989..72183bd433 100644 --- a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Domain.Tests/MyCompanyName.MyProjectName.Domain.Tests.csproj +++ b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Domain.Tests/MyCompanyName.MyProjectName.Domain.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.EntityFrameworkCore.Tests/MyCompanyName.MyProjectName.EntityFrameworkCore.Tests.csproj b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.EntityFrameworkCore.Tests/MyCompanyName.MyProjectName.EntityFrameworkCore.Tests.csproj index ad2d6683a1..96034c840f 100644 --- a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.EntityFrameworkCore.Tests/MyCompanyName.MyProjectName.EntityFrameworkCore.Tests.csproj +++ b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.EntityFrameworkCore.Tests/MyCompanyName.MyProjectName.EntityFrameworkCore.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs new file mode 100644 index 0000000000..ae929ced30 --- /dev/null +++ b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs @@ -0,0 +1,26 @@ +using Microsoft.Extensions.Hosting; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; + +namespace MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp +{ + public class ConsoleTestAppHostedService : IHostedService + { + public async Task StartAsync(CancellationToken cancellationToken) + { + using (var application = AbpApplicationFactory.Create()) + { + application.Initialize(); + + var demo = application.ServiceProvider.GetRequiredService(); + await demo.RunAsync(); + + application.Shutdown(); + } + } + + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; + } +} diff --git a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp.csproj b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp.csproj index b03bbcef1a..a70855393d 100644 --- a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp.csproj +++ b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/Program.cs b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/Program.cs index ada0212483..1e24d8a349 100644 --- a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/Program.cs +++ b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/Program.cs @@ -1,24 +1,21 @@ -using System; +using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp; -using Volo.Abp.Threading; +using Microsoft.Extensions.Hosting; namespace MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp { class Program { - static void Main(string[] args) + static async Task Main(string[] args) { - using (var application = AbpApplicationFactory.Create()) - { - application.Initialize(); - - var demo = application.ServiceProvider.GetRequiredService(); - AsyncHelper.RunSync(() => demo.RunAsync()); - - Console.WriteLine("Press ENTER to stop application..."); - Console.ReadLine(); - } + await CreateHostBuilder(args).RunConsoleAsync(); } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureServices((hostContext, services) => + { + services.AddHostedService(); + }); } } diff --git a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.MongoDB.Tests/MyCompanyName.MyProjectName.MongoDB.Tests.csproj b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.MongoDB.Tests/MyCompanyName.MyProjectName.MongoDB.Tests.csproj index caab5d1c24..db0433cdae 100644 --- a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.MongoDB.Tests/MyCompanyName.MyProjectName.MongoDB.Tests.csproj +++ b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.MongoDB.Tests/MyCompanyName.MyProjectName.MongoDB.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.TestBase/MyCompanyName.MyProjectName.TestBase.csproj b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.TestBase/MyCompanyName.MyProjectName.TestBase.csproj index b1f6aa363f..15eebd7f35 100644 --- a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.TestBase/MyCompanyName.MyProjectName.TestBase.csproj +++ b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.TestBase/MyCompanyName.MyProjectName.TestBase.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Web.Tests/MyCompanyName.MyProjectName.Web.Tests.csproj b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Web.Tests/MyCompanyName.MyProjectName.Web.Tests.csproj index 92649a5877..0805fabd29 100644 --- a/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Web.Tests/MyCompanyName.MyProjectName.Web.Tests.csproj +++ b/templates/app/aspnet-core/test/MyCompanyName.MyProjectName.Web.Tests/MyCompanyName.MyProjectName.Web.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/module/angular/package.json b/templates/module/angular/package.json index 49b31d0796..f010e4687f 100644 --- a/templates/module/angular/package.json +++ b/templates/module/angular/package.json @@ -12,11 +12,11 @@ }, "private": true, "dependencies": { - "@abp/ng.account": "^1.1.1", - "@abp/ng.theme.basic": "^1.1.1", - "@abp/ng.identity": "^1.1.1", - "@abp/ng.tenant-management": "^1.1.1", - "@abp/ng.setting-management": "^1.1.1", + "@abp/ng.account": "^2.0.1", + "@abp/ng.theme.basic": "^2.0.1", + "@abp/ng.identity": "^2.0.1", + "@abp/ng.tenant-management": "^2.0.1", + "@abp/ng.setting-management": "^2.0.1", "@angular/animations": "~8.2.14", "@angular/common": "~8.2.14", "@angular/compiler": "~8.2.14", diff --git a/templates/module/angular/projects/my-project-name-config/package.json b/templates/module/angular/projects/my-project-name-config/package.json index 90001f09a1..295cda7b47 100644 --- a/templates/module/angular/projects/my-project-name-config/package.json +++ b/templates/module/angular/projects/my-project-name-config/package.json @@ -2,6 +2,6 @@ "name": "my-project-name.config", "version": "0.0.1", "peerDependencies": { - "@abp/ng.core": ">=1.1.1" + "@abp/ng.core": ">=2.0.1" } } diff --git a/templates/module/angular/projects/my-project-name/package.json b/templates/module/angular/projects/my-project-name/package.json index 0010e857cb..1af22c7fee 100644 --- a/templates/module/angular/projects/my-project-name/package.json +++ b/templates/module/angular/projects/my-project-name/package.json @@ -2,7 +2,7 @@ "name": "my-project-name", "version": "0.0.1", "dependencies": { - "@abp/ng.theme.shared": "^1.1.1", + "@abp/ng.theme.shared": "^2.0.1", "my-project-name.config": "^0.0.1" } } diff --git a/templates/module/angular/src/app/shared/shared.module.ts b/templates/module/angular/src/app/shared/shared.module.ts index 6bae4ea332..6c4c9b016c 100644 --- a/templates/module/angular/src/app/shared/shared.module.ts +++ b/templates/module/angular/src/app/shared/shared.module.ts @@ -4,11 +4,26 @@ import { NgModule } from '@angular/core'; import { ThemeBasicModule } from '@abp/ng.theme.basic'; import { ThemeSharedModule } from '@abp/ng.theme.shared'; import { TableModule } from 'primeng/table'; +import { NgxValidateCoreModule } from '@ngx-validate/core'; @NgModule({ declarations: [], - imports: [CoreModule, ThemeSharedModule, ThemeBasicModule, TableModule, NgbDropdownModule], - exports: [CoreModule, ThemeSharedModule, ThemeBasicModule, TableModule, NgbDropdownModule], + imports: [ + CoreModule, + ThemeSharedModule, + ThemeBasicModule, + TableModule, + NgbDropdownModule, + NgxValidateCoreModule, + ], + exports: [ + CoreModule, + ThemeSharedModule, + ThemeBasicModule, + TableModule, + NgbDropdownModule, + NgxValidateCoreModule, + ], providers: [], }) export class SharedModule {} diff --git a/templates/module/angular/src/favicon.ico b/templates/module/angular/src/favicon.ico index 8081c7ceaf..39695854d2 100644 Binary files a/templates/module/angular/src/favicon.ico and b/templates/module/angular/src/favicon.ico differ diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Host.Shared/MyCompanyName.MyProjectName.Host.Shared.csproj b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Host.Shared/MyCompanyName.MyProjectName.Host.Shared.csproj index 9b5949c5fe..8cb063a10b 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Host.Shared/MyCompanyName.MyProjectName.Host.Shared.csproj +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Host.Shared/MyCompanyName.MyProjectName.Host.Shared.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/EntityFrameworkCore/MyProjectHttpApiHostMigrationsDbContext.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/EntityFrameworkCore/MyProjectNameHttpApiHostMigrationsDbContext.cs similarity index 61% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/EntityFrameworkCore/MyProjectHttpApiHostMigrationsDbContext.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/EntityFrameworkCore/MyProjectNameHttpApiHostMigrationsDbContext.cs index 1e3386b031..64faa3f630 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/EntityFrameworkCore/MyProjectHttpApiHostMigrationsDbContext.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/EntityFrameworkCore/MyProjectNameHttpApiHostMigrationsDbContext.cs @@ -3,9 +3,9 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.EntityFrameworkCore { - public class MyProjectHttpApiHostMigrationsDbContext : AbpDbContext + public class MyProjectNameHttpApiHostMigrationsDbContext : AbpDbContext { - public MyProjectHttpApiHostMigrationsDbContext(DbContextOptions options) + public MyProjectNameHttpApiHostMigrationsDbContext(DbContextOptions options) : base(options) { diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/EntityFrameworkCore/MyProjectHttpApiHostMigrationsDbContextFactory.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/EntityFrameworkCore/MyProjectNameHttpApiHostMigrationsDbContextFactory.cs similarity index 60% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/EntityFrameworkCore/MyProjectHttpApiHostMigrationsDbContextFactory.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/EntityFrameworkCore/MyProjectNameHttpApiHostMigrationsDbContextFactory.cs index 8b83ae0091..f396202197 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/EntityFrameworkCore/MyProjectHttpApiHostMigrationsDbContextFactory.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/EntityFrameworkCore/MyProjectNameHttpApiHostMigrationsDbContextFactory.cs @@ -5,16 +5,16 @@ using Microsoft.Extensions.Configuration; namespace MyCompanyName.MyProjectName.EntityFrameworkCore { - public class MyProjectHttpApiHostMigrationsDbContextFactory : IDesignTimeDbContextFactory + public class MyProjectNameHttpApiHostMigrationsDbContextFactory : IDesignTimeDbContextFactory { - public MyProjectHttpApiHostMigrationsDbContext CreateDbContext(string[] args) + public MyProjectNameHttpApiHostMigrationsDbContext CreateDbContext(string[] args) { var configuration = BuildConfiguration(); - var builder = new DbContextOptionsBuilder() - .UseSqlServer(configuration.GetConnectionString("Default")); + var builder = new DbContextOptionsBuilder() + .UseSqlServer(configuration.GetConnectionString("MyProjectName")); - return new MyProjectHttpApiHostMigrationsDbContext(builder.Options); + return new MyProjectNameHttpApiHostMigrationsDbContext(builder.Options); } private static IConfigurationRoot BuildConfiguration() diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj index fe10668840..897e84c66e 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyCompanyName.MyProjectName.HttpApi.Host.csproj @@ -1,4 +1,4 @@ - + @@ -6,19 +6,20 @@ netcoreapp3.1 MyCompanyName.MyProjectName true - MyCompanyName-MyProjectName-c2d31439-b723-48e2-b061-5ebd7aeb6010 + MyCompanyName.MyProjectName-c2d31439-b723-48e2-b061-5ebd7aeb6010 - + - + + diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs index f48706663e..b501ed5fe5 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs @@ -15,6 +15,7 @@ using Swashbuckle.AspNetCore.Swagger; using Volo.Abp; using Volo.Abp.AspNetCore.MultiTenancy; using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy; +using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.AuditLogging.EntityFrameworkCore; using Volo.Abp.Autofac; using Volo.Abp.Caching; @@ -39,7 +40,8 @@ namespace MyCompanyName.MyProjectName typeof(AbpEntityFrameworkCoreSqlServerModule), typeof(AbpAuditLoggingEntityFrameworkCoreModule), typeof(AbpPermissionManagementEntityFrameworkCoreModule), - typeof(AbpSettingManagementEntityFrameworkCoreModule) + typeof(AbpSettingManagementEntityFrameworkCoreModule), + typeof(AbpAspNetCoreSerilogModule) )] public class MyProjectNameHttpApiHostModule : AbpModule { @@ -86,6 +88,7 @@ namespace MyCompanyName.MyProjectName options.Languages.Add(new LanguageInfo("pt-BR", "pt-BR", "Português")); 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", "繁體中文")); }); //Updates AbpClaimTypes to be compatible with identity server claims. @@ -166,6 +169,7 @@ namespace MyCompanyName.MyProjectName options.SwaggerEndpoint("/swagger/v1/swagger.json", "Support APP API"); }); app.UseAuditing(); + app.UseAbpSerilogEnrichers(); app.UseMvcWithDefaultRouteAndArea(); } } diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20191218090017_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200106080828_Initial.Designer.cs similarity index 96% rename from templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20191218090017_Initial.Designer.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200106080828_Initial.Designer.cs index 282d8490be..d3c4fe12b3 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore.DbMigrations/Migrations/20191218090017_Initial.Designer.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200106080828_Initial.Designer.cs @@ -9,8 +9,8 @@ using MyCompanyName.MyProjectName.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { - [DbContext(typeof(MyProjectNameMigrationsDbContext))] - [Migration("20191218090017_Initial")] + [DbContext(typeof(IdentityServerHostMigrationsDbContext))] + [Migration("20200106080828_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -268,92 +268,6 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("AbpEntityPropertyChanges"); }); - modelBuilder.Entity("Volo.Abp.BackgroundJobs.BackgroundJobRecord", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("ConcurrencyStamp") - .HasColumnType("nvarchar(max)"); - - b.Property("CreationTime") - .HasColumnName("CreationTime") - .HasColumnType("datetime2"); - - b.Property("ExtraProperties") - .HasColumnName("ExtraProperties") - .HasColumnType("nvarchar(max)"); - - b.Property("IsAbandoned") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("JobArgs") - .IsRequired() - .HasColumnType("nvarchar(max)") - .HasMaxLength(1048576); - - b.Property("JobName") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("LastTryTime") - .HasColumnType("datetime2"); - - b.Property("NextTryTime") - .HasColumnType("datetime2"); - - b.Property("Priority") - .ValueGeneratedOnAdd() - .HasColumnType("tinyint") - .HasDefaultValue((byte)15); - - b.Property("TryCount") - .ValueGeneratedOnAdd() - .HasColumnType("smallint") - .HasDefaultValue((short)0); - - b.HasKey("Id"); - - b.HasIndex("IsAbandoned", "NextTryTime"); - - b.ToTable("AbpBackgroundJobs"); - }); - - modelBuilder.Entity("Volo.Abp.FeatureManagement.FeatureValue", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier"); - - b.Property("Name") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.Property("ProviderKey") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("ProviderName") - .HasColumnType("nvarchar(64)") - .HasMaxLength(64); - - b.Property("Value") - .IsRequired() - .HasColumnType("nvarchar(128)") - .HasMaxLength(128); - - b.HasKey("Id"); - - b.HasIndex("Name", "ProviderName", "ProviderKey"); - - b.ToTable("AbpFeatureValues"); - }); - modelBuilder.Entity("Volo.Abp.Identity.IdentityClaimType", b => { b.Property("Id") @@ -1199,6 +1113,70 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("IdentityServerClientSecrets"); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Data") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(50000); + + b.Property("DeviceCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Expiration") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("SubjectId") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("UserCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.HasIndex("UserCode") + .IsUnique(); + + b.ToTable("IdentityServerDeviceFlowCodes"); + }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200106080828_Initial.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200106080828_Initial.cs new file mode 100644 index 0000000000..29cc3396eb --- /dev/null +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20200106080828_Initial.cs @@ -0,0 +1,1022 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace MyCompanyName.MyProjectName.Migrations +{ + public partial class Initial : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "AbpAuditLogs", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + ApplicationName = table.Column(maxLength: 96, nullable: true), + UserId = table.Column(nullable: true), + UserName = table.Column(maxLength: 256, nullable: true), + TenantId = table.Column(nullable: true), + TenantName = table.Column(nullable: true), + ImpersonatorUserId = table.Column(nullable: true), + ImpersonatorTenantId = table.Column(nullable: true), + ExecutionTime = table.Column(nullable: false), + ExecutionDuration = table.Column(nullable: false), + ClientIpAddress = table.Column(maxLength: 64, nullable: true), + ClientName = table.Column(maxLength: 128, nullable: true), + ClientId = table.Column(maxLength: 64, nullable: true), + CorrelationId = table.Column(maxLength: 64, nullable: true), + BrowserInfo = table.Column(maxLength: 512, nullable: true), + HttpMethod = table.Column(maxLength: 16, nullable: true), + Url = table.Column(maxLength: 256, nullable: true), + Exceptions = table.Column(maxLength: 4000, nullable: true), + Comments = table.Column(maxLength: 256, nullable: true), + HttpStatusCode = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpAuditLogs", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpClaimTypes", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(maxLength: 256, nullable: false), + Name = table.Column(maxLength: 256, nullable: false), + Required = table.Column(nullable: false), + IsStatic = table.Column(nullable: false), + Regex = table.Column(maxLength: 512, nullable: true), + RegexDescription = table.Column(maxLength: 128, nullable: true), + Description = table.Column(maxLength: 256, nullable: true), + ValueType = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpClaimTypes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpPermissionGrants", + columns: table => new + { + Id = table.Column(nullable: false), + TenantId = table.Column(nullable: true), + Name = table.Column(maxLength: 128, nullable: false), + ProviderName = table.Column(maxLength: 64, nullable: false), + ProviderKey = table.Column(maxLength: 64, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpPermissionGrants", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpRoles", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(maxLength: 256, nullable: false), + TenantId = table.Column(nullable: true), + Name = table.Column(maxLength: 256, nullable: false), + NormalizedName = table.Column(maxLength: 256, nullable: false), + IsDefault = table.Column(nullable: false), + IsStatic = table.Column(nullable: false), + IsPublic = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpRoles", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpSettings", + columns: table => new + { + Id = table.Column(nullable: false), + Name = table.Column(maxLength: 128, nullable: false), + Value = table.Column(maxLength: 2048, nullable: false), + ProviderName = table.Column(maxLength: 64, nullable: true), + ProviderKey = table.Column(maxLength: 64, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpSettings", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpTenants", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + IsDeleted = table.Column(nullable: false, defaultValue: false), + DeleterId = table.Column(nullable: true), + DeletionTime = table.Column(nullable: true), + Name = table.Column(maxLength: 64, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpTenants", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "AbpUsers", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + IsDeleted = table.Column(nullable: false, defaultValue: false), + DeleterId = table.Column(nullable: true), + DeletionTime = table.Column(nullable: true), + TenantId = table.Column(nullable: true), + UserName = table.Column(maxLength: 256, nullable: false), + NormalizedUserName = table.Column(maxLength: 256, nullable: false), + Name = table.Column(maxLength: 64, nullable: true), + Surname = table.Column(maxLength: 64, nullable: true), + Email = table.Column(maxLength: 256, nullable: false), + NormalizedEmail = table.Column(maxLength: 256, nullable: false), + EmailConfirmed = table.Column(nullable: false, defaultValue: false), + PasswordHash = table.Column(maxLength: 256, nullable: true), + SecurityStamp = table.Column(maxLength: 256, nullable: false), + PhoneNumber = table.Column(maxLength: 16, nullable: true), + PhoneNumberConfirmed = table.Column(nullable: false, defaultValue: false), + TwoFactorEnabled = table.Column(nullable: false, defaultValue: false), + LockoutEnd = table.Column(nullable: true), + LockoutEnabled = table.Column(nullable: false, defaultValue: false), + AccessFailedCount = table.Column(nullable: false, defaultValue: 0) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUsers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerApiResources", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + IsDeleted = table.Column(nullable: false, defaultValue: false), + DeleterId = table.Column(nullable: true), + DeletionTime = table.Column(nullable: true), + Name = table.Column(maxLength: 200, nullable: false), + DisplayName = table.Column(maxLength: 200, nullable: true), + Description = table.Column(maxLength: 1000, nullable: true), + Enabled = table.Column(nullable: false), + Properties = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiResources", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClients", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + IsDeleted = table.Column(nullable: false, defaultValue: false), + DeleterId = table.Column(nullable: true), + DeletionTime = table.Column(nullable: true), + ClientId = table.Column(maxLength: 200, nullable: false), + ClientName = table.Column(maxLength: 200, nullable: true), + Description = table.Column(maxLength: 1000, nullable: true), + ClientUri = table.Column(maxLength: 2000, nullable: true), + LogoUri = table.Column(maxLength: 2000, nullable: true), + Enabled = table.Column(nullable: false), + ProtocolType = table.Column(maxLength: 200, nullable: false), + RequireClientSecret = table.Column(nullable: false), + RequireConsent = table.Column(nullable: false), + AllowRememberConsent = table.Column(nullable: false), + AlwaysIncludeUserClaimsInIdToken = table.Column(nullable: false), + RequirePkce = table.Column(nullable: false), + AllowPlainTextPkce = table.Column(nullable: false), + AllowAccessTokensViaBrowser = table.Column(nullable: false), + FrontChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), + FrontChannelLogoutSessionRequired = table.Column(nullable: false), + BackChannelLogoutUri = table.Column(maxLength: 2000, nullable: true), + BackChannelLogoutSessionRequired = table.Column(nullable: false), + AllowOfflineAccess = table.Column(nullable: false), + IdentityTokenLifetime = table.Column(nullable: false), + AccessTokenLifetime = table.Column(nullable: false), + AuthorizationCodeLifetime = table.Column(nullable: false), + ConsentLifetime = table.Column(nullable: true), + AbsoluteRefreshTokenLifetime = table.Column(nullable: false), + SlidingRefreshTokenLifetime = table.Column(nullable: false), + RefreshTokenUsage = table.Column(nullable: false), + UpdateAccessTokenClaimsOnRefresh = table.Column(nullable: false), + RefreshTokenExpiration = table.Column(nullable: false), + AccessTokenType = table.Column(nullable: false), + EnableLocalLogin = table.Column(nullable: false), + IncludeJwtId = table.Column(nullable: false), + AlwaysSendClientClaims = table.Column(nullable: false), + ClientClaimsPrefix = table.Column(maxLength: 200, nullable: true), + PairWiseSubjectSalt = table.Column(maxLength: 200, nullable: true), + UserSsoLifetime = table.Column(nullable: true), + UserCodeType = table.Column(maxLength: 100, nullable: true), + DeviceCodeLifetime = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClients", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerDeviceFlowCodes", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + DeviceCode = table.Column(maxLength: 200, nullable: false), + UserCode = table.Column(maxLength: 200, nullable: false), + SubjectId = table.Column(maxLength: 200, nullable: true), + ClientId = table.Column(maxLength: 200, nullable: false), + Expiration = table.Column(nullable: false), + Data = table.Column(maxLength: 50000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerDeviceFlowCodes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerIdentityResources", + columns: table => new + { + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + CreationTime = table.Column(nullable: false), + CreatorId = table.Column(nullable: true), + LastModificationTime = table.Column(nullable: true), + LastModifierId = table.Column(nullable: true), + IsDeleted = table.Column(nullable: false, defaultValue: false), + DeleterId = table.Column(nullable: true), + DeletionTime = table.Column(nullable: true), + Name = table.Column(maxLength: 200, nullable: false), + DisplayName = table.Column(maxLength: 200, nullable: true), + Description = table.Column(maxLength: 1000, nullable: true), + Enabled = table.Column(nullable: false), + Required = table.Column(nullable: false), + Emphasize = table.Column(nullable: false), + ShowInDiscoveryDocument = table.Column(nullable: false), + Properties = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerIdentityResources", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerPersistedGrants", + columns: table => new + { + Key = table.Column(maxLength: 200, nullable: false), + Id = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true), + ConcurrencyStamp = table.Column(nullable: true), + Type = table.Column(maxLength: 50, nullable: false), + SubjectId = table.Column(maxLength: 200, nullable: true), + ClientId = table.Column(maxLength: 200, nullable: false), + CreationTime = table.Column(nullable: false), + Expiration = table.Column(nullable: true), + Data = table.Column(maxLength: 50000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerPersistedGrants", x => x.Key); + }); + + migrationBuilder.CreateTable( + name: "AbpAuditLogActions", + columns: table => new + { + Id = table.Column(nullable: false), + TenantId = table.Column(nullable: true), + AuditLogId = table.Column(nullable: false), + ServiceName = table.Column(maxLength: 256, nullable: true), + MethodName = table.Column(maxLength: 128, nullable: true), + Parameters = table.Column(maxLength: 2000, nullable: true), + ExecutionTime = table.Column(nullable: false), + ExecutionDuration = table.Column(nullable: false), + ExtraProperties = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpAuditLogActions", x => x.Id); + table.ForeignKey( + name: "FK_AbpAuditLogActions_AbpAuditLogs_AuditLogId", + column: x => x.AuditLogId, + principalTable: "AbpAuditLogs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpEntityChanges", + columns: table => new + { + Id = table.Column(nullable: false), + AuditLogId = table.Column(nullable: false), + TenantId = table.Column(nullable: true), + ChangeTime = table.Column(nullable: false), + ChangeType = table.Column(nullable: false), + EntityTenantId = table.Column(nullable: true), + EntityId = table.Column(maxLength: 128, nullable: false), + EntityTypeFullName = table.Column(maxLength: 128, nullable: false), + ExtraProperties = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpEntityChanges", x => x.Id); + table.ForeignKey( + name: "FK_AbpEntityChanges_AbpAuditLogs_AuditLogId", + column: x => x.AuditLogId, + principalTable: "AbpAuditLogs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpRoleClaims", + columns: table => new + { + Id = table.Column(nullable: false), + TenantId = table.Column(nullable: true), + ClaimType = table.Column(maxLength: 256, nullable: false), + ClaimValue = table.Column(maxLength: 1024, nullable: true), + RoleId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpRoleClaims", x => x.Id); + table.ForeignKey( + name: "FK_AbpRoleClaims_AbpRoles_RoleId", + column: x => x.RoleId, + principalTable: "AbpRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpTenantConnectionStrings", + columns: table => new + { + TenantId = table.Column(nullable: false), + Name = table.Column(maxLength: 64, nullable: false), + Value = table.Column(maxLength: 1024, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpTenantConnectionStrings", x => new { x.TenantId, x.Name }); + table.ForeignKey( + name: "FK_AbpTenantConnectionStrings_AbpTenants_TenantId", + column: x => x.TenantId, + principalTable: "AbpTenants", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserClaims", + columns: table => new + { + Id = table.Column(nullable: false), + TenantId = table.Column(nullable: true), + ClaimType = table.Column(maxLength: 256, nullable: false), + ClaimValue = table.Column(maxLength: 1024, nullable: true), + UserId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserClaims", x => x.Id); + table.ForeignKey( + name: "FK_AbpUserClaims_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserLogins", + columns: table => new + { + UserId = table.Column(nullable: false), + LoginProvider = table.Column(maxLength: 64, nullable: false), + TenantId = table.Column(nullable: true), + ProviderKey = table.Column(maxLength: 196, nullable: false), + ProviderDisplayName = table.Column(maxLength: 128, nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserLogins", x => new { x.UserId, x.LoginProvider }); + table.ForeignKey( + name: "FK_AbpUserLogins_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserRoles", + columns: table => new + { + UserId = table.Column(nullable: false), + RoleId = table.Column(nullable: false), + TenantId = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserRoles", x => new { x.UserId, x.RoleId }); + table.ForeignKey( + name: "FK_AbpUserRoles_AbpRoles_RoleId", + column: x => x.RoleId, + principalTable: "AbpRoles", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_AbpUserRoles_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpUserTokens", + columns: table => new + { + UserId = table.Column(nullable: false), + LoginProvider = table.Column(maxLength: 64, nullable: false), + Name = table.Column(maxLength: 128, nullable: false), + TenantId = table.Column(nullable: true), + Value = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpUserTokens", x => new { x.UserId, x.LoginProvider, x.Name }); + table.ForeignKey( + name: "FK_AbpUserTokens_AbpUsers_UserId", + column: x => x.UserId, + principalTable: "AbpUsers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerApiClaims", + columns: table => new + { + Type = table.Column(maxLength: 200, nullable: false), + ApiResourceId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiClaims", x => new { x.ApiResourceId, x.Type }); + table.ForeignKey( + name: "FK_IdentityServerApiClaims_IdentityServerApiResources_ApiResourceId", + column: x => x.ApiResourceId, + principalTable: "IdentityServerApiResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerApiScopes", + columns: table => new + { + ApiResourceId = table.Column(nullable: false), + Name = table.Column(maxLength: 200, nullable: false), + DisplayName = table.Column(maxLength: 200, nullable: true), + Description = table.Column(maxLength: 1000, nullable: true), + Required = table.Column(nullable: false), + Emphasize = table.Column(nullable: false), + ShowInDiscoveryDocument = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiScopes", x => new { x.ApiResourceId, x.Name }); + table.ForeignKey( + name: "FK_IdentityServerApiScopes_IdentityServerApiResources_ApiResourceId", + column: x => x.ApiResourceId, + principalTable: "IdentityServerApiResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerApiSecrets", + columns: table => new + { + Type = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 4000, nullable: false), + ApiResourceId = table.Column(nullable: false), + Description = table.Column(maxLength: 2000, nullable: true), + Expiration = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiSecrets", x => new { x.ApiResourceId, x.Type, x.Value }); + table.ForeignKey( + name: "FK_IdentityServerApiSecrets_IdentityServerApiResources_ApiResourceId", + column: x => x.ApiResourceId, + principalTable: "IdentityServerApiResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientClaims", + columns: table => new + { + ClientId = table.Column(nullable: false), + Type = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 250, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientClaims", x => new { x.ClientId, x.Type, x.Value }); + table.ForeignKey( + name: "FK_IdentityServerClientClaims_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientCorsOrigins", + columns: table => new + { + ClientId = table.Column(nullable: false), + Origin = table.Column(maxLength: 150, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientCorsOrigins", x => new { x.ClientId, x.Origin }); + table.ForeignKey( + name: "FK_IdentityServerClientCorsOrigins_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientGrantTypes", + columns: table => new + { + ClientId = table.Column(nullable: false), + GrantType = table.Column(maxLength: 250, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientGrantTypes", x => new { x.ClientId, x.GrantType }); + table.ForeignKey( + name: "FK_IdentityServerClientGrantTypes_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientIdPRestrictions", + columns: table => new + { + ClientId = table.Column(nullable: false), + Provider = table.Column(maxLength: 200, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientIdPRestrictions", x => new { x.ClientId, x.Provider }); + table.ForeignKey( + name: "FK_IdentityServerClientIdPRestrictions_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientPostLogoutRedirectUris", + columns: table => new + { + ClientId = table.Column(nullable: false), + PostLogoutRedirectUri = table.Column(maxLength: 2000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientPostLogoutRedirectUris", x => new { x.ClientId, x.PostLogoutRedirectUri }); + table.ForeignKey( + name: "FK_IdentityServerClientPostLogoutRedirectUris_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientProperties", + columns: table => new + { + ClientId = table.Column(nullable: false), + Key = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 2000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientProperties", x => new { x.ClientId, x.Key }); + table.ForeignKey( + name: "FK_IdentityServerClientProperties_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientRedirectUris", + columns: table => new + { + ClientId = table.Column(nullable: false), + RedirectUri = table.Column(maxLength: 2000, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientRedirectUris", x => new { x.ClientId, x.RedirectUri }); + table.ForeignKey( + name: "FK_IdentityServerClientRedirectUris_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientScopes", + columns: table => new + { + ClientId = table.Column(nullable: false), + Scope = table.Column(maxLength: 200, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientScopes", x => new { x.ClientId, x.Scope }); + table.ForeignKey( + name: "FK_IdentityServerClientScopes_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerClientSecrets", + columns: table => new + { + Type = table.Column(maxLength: 250, nullable: false), + Value = table.Column(maxLength: 4000, nullable: false), + ClientId = table.Column(nullable: false), + Description = table.Column(maxLength: 2000, nullable: true), + Expiration = table.Column(nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerClientSecrets", x => new { x.ClientId, x.Type, x.Value }); + table.ForeignKey( + name: "FK_IdentityServerClientSecrets_IdentityServerClients_ClientId", + column: x => x.ClientId, + principalTable: "IdentityServerClients", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerIdentityClaims", + columns: table => new + { + Type = table.Column(maxLength: 200, nullable: false), + IdentityResourceId = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerIdentityClaims", x => new { x.IdentityResourceId, x.Type }); + table.ForeignKey( + name: "FK_IdentityServerIdentityClaims_IdentityServerIdentityResources_IdentityResourceId", + column: x => x.IdentityResourceId, + principalTable: "IdentityServerIdentityResources", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "AbpEntityPropertyChanges", + columns: table => new + { + Id = table.Column(nullable: false), + TenantId = table.Column(nullable: true), + EntityChangeId = table.Column(nullable: false), + NewValue = table.Column(maxLength: 512, nullable: true), + OriginalValue = table.Column(maxLength: 512, nullable: true), + PropertyName = table.Column(maxLength: 128, nullable: false), + PropertyTypeFullName = table.Column(maxLength: 64, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_AbpEntityPropertyChanges", x => x.Id); + table.ForeignKey( + name: "FK_AbpEntityPropertyChanges_AbpEntityChanges_EntityChangeId", + column: x => x.EntityChangeId, + principalTable: "AbpEntityChanges", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "IdentityServerApiScopeClaims", + columns: table => new + { + Type = table.Column(maxLength: 200, nullable: false), + ApiResourceId = table.Column(nullable: false), + Name = table.Column(maxLength: 200, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_IdentityServerApiScopeClaims", x => new { x.ApiResourceId, x.Name, x.Type }); + table.ForeignKey( + name: "FK_IdentityServerApiScopeClaims_IdentityServerApiScopes_ApiResourceId_Name", + columns: x => new { x.ApiResourceId, x.Name }, + principalTable: "IdentityServerApiScopes", + principalColumns: new[] { "ApiResourceId", "Name" }, + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_AbpAuditLogActions_AuditLogId", + table: "AbpAuditLogActions", + column: "AuditLogId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpAuditLogActions_TenantId_ServiceName_MethodName_ExecutionTime", + table: "AbpAuditLogActions", + columns: new[] { "TenantId", "ServiceName", "MethodName", "ExecutionTime" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpAuditLogs_TenantId_ExecutionTime", + table: "AbpAuditLogs", + columns: new[] { "TenantId", "ExecutionTime" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpAuditLogs_TenantId_UserId_ExecutionTime", + table: "AbpAuditLogs", + columns: new[] { "TenantId", "UserId", "ExecutionTime" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpEntityChanges_AuditLogId", + table: "AbpEntityChanges", + column: "AuditLogId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpEntityChanges_TenantId_EntityTypeFullName_EntityId", + table: "AbpEntityChanges", + columns: new[] { "TenantId", "EntityTypeFullName", "EntityId" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpEntityPropertyChanges_EntityChangeId", + table: "AbpEntityPropertyChanges", + column: "EntityChangeId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpPermissionGrants_Name_ProviderName_ProviderKey", + table: "AbpPermissionGrants", + columns: new[] { "Name", "ProviderName", "ProviderKey" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpRoleClaims_RoleId", + table: "AbpRoleClaims", + column: "RoleId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpRoles_NormalizedName", + table: "AbpRoles", + column: "NormalizedName"); + + migrationBuilder.CreateIndex( + name: "IX_AbpSettings_Name_ProviderName_ProviderKey", + table: "AbpSettings", + columns: new[] { "Name", "ProviderName", "ProviderKey" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpTenants_Name", + table: "AbpTenants", + column: "Name"); + + migrationBuilder.CreateIndex( + name: "IX_AbpUserClaims_UserId", + table: "AbpUserClaims", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_AbpUserLogins_LoginProvider_ProviderKey", + table: "AbpUserLogins", + columns: new[] { "LoginProvider", "ProviderKey" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpUserRoles_RoleId_UserId", + table: "AbpUserRoles", + columns: new[] { "RoleId", "UserId" }); + + migrationBuilder.CreateIndex( + name: "IX_AbpUsers_Email", + table: "AbpUsers", + column: "Email"); + + migrationBuilder.CreateIndex( + name: "IX_AbpUsers_NormalizedEmail", + table: "AbpUsers", + column: "NormalizedEmail"); + + migrationBuilder.CreateIndex( + name: "IX_AbpUsers_NormalizedUserName", + table: "AbpUsers", + column: "NormalizedUserName"); + + migrationBuilder.CreateIndex( + name: "IX_AbpUsers_UserName", + table: "AbpUsers", + column: "UserName"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerClients_ClientId", + table: "IdentityServerClients", + column: "ClientId"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_DeviceCode", + table: "IdentityServerDeviceFlowCodes", + column: "DeviceCode", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_Expiration", + table: "IdentityServerDeviceFlowCodes", + column: "Expiration"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerDeviceFlowCodes_UserCode", + table: "IdentityServerDeviceFlowCodes", + column: "UserCode", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerPersistedGrants_Expiration", + table: "IdentityServerPersistedGrants", + column: "Expiration"); + + migrationBuilder.CreateIndex( + name: "IX_IdentityServerPersistedGrants_SubjectId_ClientId_Type", + table: "IdentityServerPersistedGrants", + columns: new[] { "SubjectId", "ClientId", "Type" }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "AbpAuditLogActions"); + + migrationBuilder.DropTable( + name: "AbpClaimTypes"); + + migrationBuilder.DropTable( + name: "AbpEntityPropertyChanges"); + + migrationBuilder.DropTable( + name: "AbpPermissionGrants"); + + migrationBuilder.DropTable( + name: "AbpRoleClaims"); + + migrationBuilder.DropTable( + name: "AbpSettings"); + + migrationBuilder.DropTable( + name: "AbpTenantConnectionStrings"); + + migrationBuilder.DropTable( + name: "AbpUserClaims"); + + migrationBuilder.DropTable( + name: "AbpUserLogins"); + + migrationBuilder.DropTable( + name: "AbpUserRoles"); + + migrationBuilder.DropTable( + name: "AbpUserTokens"); + + migrationBuilder.DropTable( + name: "IdentityServerApiClaims"); + + migrationBuilder.DropTable( + name: "IdentityServerApiScopeClaims"); + + migrationBuilder.DropTable( + name: "IdentityServerApiSecrets"); + + migrationBuilder.DropTable( + name: "IdentityServerClientClaims"); + + migrationBuilder.DropTable( + name: "IdentityServerClientCorsOrigins"); + + migrationBuilder.DropTable( + name: "IdentityServerClientGrantTypes"); + + migrationBuilder.DropTable( + name: "IdentityServerClientIdPRestrictions"); + + migrationBuilder.DropTable( + name: "IdentityServerClientPostLogoutRedirectUris"); + + migrationBuilder.DropTable( + name: "IdentityServerClientProperties"); + + migrationBuilder.DropTable( + name: "IdentityServerClientRedirectUris"); + + migrationBuilder.DropTable( + name: "IdentityServerClientScopes"); + + migrationBuilder.DropTable( + name: "IdentityServerClientSecrets"); + + migrationBuilder.DropTable( + name: "IdentityServerDeviceFlowCodes"); + + migrationBuilder.DropTable( + name: "IdentityServerIdentityClaims"); + + migrationBuilder.DropTable( + name: "IdentityServerPersistedGrants"); + + migrationBuilder.DropTable( + name: "AbpEntityChanges"); + + migrationBuilder.DropTable( + name: "AbpTenants"); + + migrationBuilder.DropTable( + name: "AbpRoles"); + + migrationBuilder.DropTable( + name: "AbpUsers"); + + migrationBuilder.DropTable( + name: "IdentityServerApiScopes"); + + migrationBuilder.DropTable( + name: "IdentityServerClients"); + + migrationBuilder.DropTable( + name: "IdentityServerIdentityResources"); + + migrationBuilder.DropTable( + name: "AbpAuditLogs"); + + migrationBuilder.DropTable( + name: "IdentityServerApiResources"); + } + } +} diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs index 7e25b0e36a..33aa2b4ded 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs @@ -15,7 +15,7 @@ namespace MyCompanyName.MyProjectName.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.0.0") + .HasAnnotation("ProductVersion", "3.1.0") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); @@ -424,6 +424,7 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnType("datetime2"); b.Property("Email") + .IsRequired() .HasColumnName("Email") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -467,6 +468,7 @@ namespace MyCompanyName.MyProjectName.Migrations .HasMaxLength(64); b.Property("NormalizedEmail") + .IsRequired() .HasColumnName("NormalizedEmail") .HasColumnType("nvarchar(256)") .HasMaxLength(256); @@ -1109,6 +1111,70 @@ namespace MyCompanyName.MyProjectName.Migrations b.ToTable("IdentityServerClientSecrets"); }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Devices.DeviceFlowCodes", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b.Property("ClientId") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("nvarchar(max)"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime2"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("uniqueidentifier"); + + b.Property("Data") + .IsRequired() + .HasColumnType("nvarchar(max)") + .HasMaxLength(50000); + + b.Property("DeviceCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("Expiration") + .IsRequired() + .HasColumnType("datetime2"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("nvarchar(max)"); + + b.Property("SubjectId") + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.Property("UserCode") + .IsRequired() + .HasColumnType("nvarchar(200)") + .HasMaxLength(200); + + b.HasKey("Id"); + + b.HasIndex("DeviceCode") + .IsUnique(); + + b.HasIndex("Expiration"); + + b.HasIndex("UserCode") + .IsUnique(); + + b.ToTable("IdentityServerDeviceFlowCodes"); + }); + modelBuilder.Entity("Volo.Abp.IdentityServer.Grants.PersistedGrant", b => { b.Property("Key") diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj index c2a1d1dde6..946f3156f4 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj @@ -1,16 +1,16 @@ - + netcoreapp3.1 MyCompanyName.MyProjectName true - MyCompanyName-MyProjectName-c2d31439-b723-48e2-b061-5ebd7aeb6010 + MyCompanyName.MyProjectName-c2d31439-b723-48e2-b061-5ebd7aeb6010 - + - + @@ -21,7 +21,9 @@ + + diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs index 76d930d7ea..b92fe455b5 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs @@ -11,11 +11,13 @@ using StackExchange.Redis; using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.Swagger; using Volo.Abp; +using Volo.Abp.Account; using Volo.Abp.Account.Web; using Volo.Abp.AspNetCore.Authentication.JwtBearer; using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; +using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.Auditing; using Volo.Abp.AuditLogging.EntityFrameworkCore; using Volo.Abp.Autofac; @@ -44,6 +46,7 @@ namespace MyCompanyName.MyProjectName { [DependsOn( typeof(AbpAccountWebIdentityServerModule), + typeof(AbpAccountApplicationModule), typeof(AbpAspNetCoreMvcUiMultiTenancyModule), typeof(AbpAspNetCoreMvcModule), typeof(AbpAspNetCoreMvcUiBasicThemeModule), @@ -64,7 +67,8 @@ namespace MyCompanyName.MyProjectName typeof(AbpTenantManagementApplicationModule), typeof(AbpTenantManagementHttpApiModule), typeof(AbpAspNetCoreAuthenticationJwtBearerModule), - typeof(MyProjectNameApplicationContractsModule) + typeof(MyProjectNameApplicationContractsModule), + typeof(AbpAspNetCoreSerilogModule) )] public class MyProjectNameIdentityServerModule : AbpModule { @@ -95,6 +99,7 @@ namespace MyCompanyName.MyProjectName options.Languages.Add(new LanguageInfo("pt-BR", "pt-BR", "Português")); 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", "繁體中文")); }); Configure(options => @@ -187,6 +192,7 @@ namespace MyCompanyName.MyProjectName options.SwaggerEndpoint("/swagger/v1/swagger.json", "Support APP API"); }); app.UseAuditing(); + app.UseAbpSerilogEnrichers(); app.UseMvcWithDefaultRouteAndArea(); SeedData(context); diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/package.json b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/package.json index 436db35985..5aa3341b9c 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/package.json +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/package.json @@ -3,6 +3,6 @@ "name": "my-app-identityserver", "private": true, "dependencies": { - "@abp/aspnetcore.mvc.ui.theme.basic": "^1.1.1" + "@abp/aspnetcore.mvc.ui.theme.basic": "^2.0.1" } } \ No newline at end of file diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/yarn.lock b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/yarn.lock index 12cad6c691..8d232d1d09 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/yarn.lock +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/yarn.lock @@ -2,37 +2,37 @@ # yarn lockfile v1 -"@abp/aspnetcore.mvc.ui.theme.basic@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-1.1.1.tgz#a3d21f8cc5ede2e85b881fe69d9ecd5fc2268e47" - integrity sha512-ooXtCM3TWN69RU7xs6avnzOQBXzsiHY5BEIogzSBialZC4uG5H56qrIr4MbsFNae+PQM23Mw2tnJ/Z7dutURCQ== +"@abp/aspnetcore.mvc.ui.theme.basic@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-2.0.1.tgz#e336c8e3b52b04177fc4039c54f67984f8230f6f" + integrity sha512-yMYL8Q1DdS5Dt8nHz5K0ca+4uQ853iOLts/gWmJ4YybWxn4BMu17hlFWpdbmYrtLCW8n45yRYy8dp+9go8zCQw== dependencies: - "@abp/aspnetcore.mvc.ui.theme.shared" "^1.1.1" + "@abp/aspnetcore.mvc.ui.theme.shared" "^2.0.1" -"@abp/aspnetcore.mvc.ui.theme.shared@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-1.1.1.tgz#b5eb57bcebcf211a75cf7d540dcc89a0f9ade013" - integrity sha512-LilSyefzT1+rcTU7vbWxcO8TwBgGZIx6QbMUrDicSTH6LLJ9S5+yNaGNJbbZKDG6qx0BEoC1u8dE8KCUshwxoQ== - dependencies: - "@abp/aspnetcore.mvc.ui" "^1.1.1" - "@abp/bootstrap" "^1.1.1" - "@abp/bootstrap-datepicker" "^1.1.1" - "@abp/datatables.net-bs4" "^1.1.1" - "@abp/font-awesome" "^1.1.1" - "@abp/jquery-form" "^1.1.1" - "@abp/jquery-validation-unobtrusive" "^1.1.1" - "@abp/lodash" "^1.1.1" - "@abp/luxon" "^1.1.1" - "@abp/malihu-custom-scrollbar-plugin" "^1.1.1" - "@abp/select2" "^1.1.1" - "@abp/sweetalert" "^1.1.1" - "@abp/timeago" "^1.1.1" - "@abp/toastr" "^1.1.1" - -"@abp/aspnetcore.mvc.ui@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-1.1.1.tgz#9d693516b6a215dfd2113db9ef52f02881a3e1d5" - integrity sha512-wZbptVCSxZzEjkJx+/sWrH9Pikp9nOy7V8Htz+L+S7/qAzfXu5PRVV8ahddfAcDHRk30buRhdbJlCVdt6hkZ6g== +"@abp/aspnetcore.mvc.ui.theme.shared@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-2.0.1.tgz#2bad208bfc422e6be12f22431c713180d924e17c" + integrity sha512-6/ZnF4dFbmpiqDIx3Lc2NJpCNcpmvrEh6kDZC5x9q3ICTPK/CgspM7dVG2dSpFFkXbDNoGH6i/wJwEUWHOKzYQ== + dependencies: + "@abp/aspnetcore.mvc.ui" "^2.0.1" + "@abp/bootstrap" "^2.0.1" + "@abp/bootstrap-datepicker" "^2.0.1" + "@abp/datatables.net-bs4" "^2.0.1" + "@abp/font-awesome" "^2.0.1" + "@abp/jquery-form" "^2.0.1" + "@abp/jquery-validation-unobtrusive" "^2.0.1" + "@abp/lodash" "^2.0.1" + "@abp/luxon" "^2.0.1" + "@abp/malihu-custom-scrollbar-plugin" "^2.0.1" + "@abp/select2" "^2.0.1" + "@abp/sweetalert" "^2.0.1" + "@abp/timeago" "^2.0.1" + "@abp/toastr" "^2.0.1" + +"@abp/aspnetcore.mvc.ui@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-2.0.1.tgz#2c319182f7ab5f99059df4d36cf894deeba20023" + integrity sha512-bLTyfqoPrzHrdPIw3twJrILO99fzHJZrUJmJDuk5cT1Ox+bCv3AAxi7UEEaOQdjDdZlURq86SKM5x/EndeGpHA== dependencies: ansi-colors "^4.1.1" extend-object "^1.0.0" @@ -41,135 +41,135 @@ path "^0.12.7" rimraf "^3.0.0" -"@abp/bootstrap-datepicker@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-1.1.1.tgz#fb1ceec1df24f384a6349c4acfb3627e02e4a42f" - integrity sha512-RIQLSrKBu/cTAU2lFenSAoKcMp7wgF4e3nP4/iOu5ZtCgti5vUjMEcqEvBxtlwKTHMXsTG4GtNKqjTwjXMjONQ== +"@abp/bootstrap-datepicker@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-2.0.1.tgz#458361b7c7ba8c4fc260e9117ae52f054cbab705" + integrity sha512-mkF2ioq1UxOw7K2IDzzjuLco/V/HNkB5t7HqDfnNt9JFEt71ms2xRFe8KLxpr9MUWB9MdzlGo4ywyHzGxA61mg== dependencies: bootstrap-datepicker "^1.9.0" -"@abp/bootstrap@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-1.1.1.tgz#e16fae6ff6b18096276219edf3483fd8f41c925d" - integrity sha512-OIaGJaizhI8UNfy4bnw2xT2Z0QG7BJJrjxOPGepfd4jn/AUi/vFdOpJFWvu2P9PwSzRmn/LuSlr2WONDOdPVWQ== +"@abp/bootstrap@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-2.0.1.tgz#78d6a7c0787787fd92f8d19c7f8cfee05d8f863e" + integrity sha512-GFAho519IBIK0199LCK5NpuaG44w0Tmjjmxns3V+MbzdXGa5d3hZzuPDhYv6hOB9Aj5d0UIqT39KmvrbHAgvuQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" bootstrap "^4.3.1" -"@abp/core@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/core/-/core-1.1.1.tgz#1379145980d6b142fd0123200c60ffb206149d56" - integrity sha512-OvUG7xRvk8nSqwC1s45YPnTuhC2OWe1AVa1nnC6FVHMH/g1Je7UJwnbu47K7uNS+lDRJUIktNbufYKiwutEjRg== +"@abp/core@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/core/-/core-2.0.1.tgz#441b231f7deb4356f71fdc853873ee3e7eacebea" + integrity sha512-5m5Buci+efcmkxPkVWAIAad6idvXS5qSqK/oq8fJj2I4J95ug8CUWRwg7cFzZGLljUKX6kEbCtB//NBCoI+aJA== -"@abp/datatables.net-bs4@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-1.1.1.tgz#c7e79534c2e4b51b3e98bcc0df3292cb08ae9d2e" - integrity sha512-t40xQIGBMLPZiSbcZHW3AwE8uk+xcl7OitBT1jym0XPKVtgJsHez3ynDE5v/PjHe+ColCG8lTRjRnNoXo5dzDw== +"@abp/datatables.net-bs4@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-2.0.1.tgz#fac4afdd44784f3cdd395830cda4b2781a817c05" + integrity sha512-jD2cxrPSxfzjM6xSDBiHJuxk6wj6wBQsD4+Go0kOicQSEzDef9CCN8hi8NsCITosAXVAEIoHGwE1uTlK6sir5Q== dependencies: - "@abp/datatables.net" "^1.1.1" + "@abp/datatables.net" "^2.0.1" datatables.net-bs4 "^1.10.20" -"@abp/datatables.net@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-1.1.1.tgz#de8b362c29f452188624536cdd6feccad2b533e6" - integrity sha512-y76IDBlgc0n1YgQqJ+9cfzXpLwr2arhdIfSmqX+qRXz6GfVNY7e3JijkFSgDKUzKGYo1HZMzgJmDmeNIRwMZsQ== +"@abp/datatables.net@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-2.0.1.tgz#3a0a5e5a836fe058d43798139349d92996ea9478" + integrity sha512-xEsvLofWj0W1ieplwEM4j5SEpoW3zS/yRQczHGMWBTR1Uazy0ysqQwMau+nRsNz7z12cFfooVG2mNzfkWRa84g== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" datatables.net "^1.10.20" -"@abp/font-awesome@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-1.1.1.tgz#7f0a210eb7611d75542028b0c88a0c83f1d9db50" - integrity sha512-6RHbixi7IVWAb3JCHrUmEYD3HmAH4R75Nuo54LvFzATrh4G6gdBONIeDuTo79OTxe4Zhp+WLxeA49Y21kt77mg== +"@abp/font-awesome@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-2.0.1.tgz#738e5d8a93c29ba13f019a1f0198b9272c644e5c" + integrity sha512-+2yQ3RRMTkj0QsxbYB1gHzqEM+/yiFpuXakKTHxFnCZjgZhmmU229hm14xWbpyWsKohbtrr4R/te1WBrqryqPA== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" "@fortawesome/fontawesome-free" "^5.11.2" -"@abp/jquery-form@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-1.1.1.tgz#1dae1145da720e222efcb396906c3fbe5a3dd29f" - integrity sha512-AIIdN36f8xwr4LgiNnBHohJ5tlxh/r+DuDtXcScpZN6GWBE+XgUotN0pZIIva82IxCyUNdDudzgluX9IjI+00w== +"@abp/jquery-form@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-2.0.1.tgz#e92b9ad75a4f08c63b1005d97d8baeb689ebfe6c" + integrity sha512-A/imqgswwLrU+mR1oyDeVW5PDCIBQk/sMtU/PvRXaNL9c59nU5EVWIuPzORDzpkoECtuNMqStjERHc9IROMjnA== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" jquery-form "^4.2.2" -"@abp/jquery-validation-unobtrusive@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-1.1.1.tgz#aeba0883260f47ab22a39343817b1811fc2b81a9" - integrity sha512-q1b0KG8l3DXUiW8JXdq9l1jR/CwgzrZdxwdKGLB2J/oxHlywQIb7yrjR6WGCshjPpcx2SkOL0j/ZXMIMh533hQ== +"@abp/jquery-validation-unobtrusive@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-2.0.1.tgz#e4ed82f6432bba68139210552a9e7800d838d788" + integrity sha512-72XyC3megf6VXm283pCXB5kctbNLmI/EtfoIEp+FffTUmxCoL+gEEnqb1V+7dMUm5QYCNDnhYWk7K6TTxBPGPw== dependencies: - "@abp/jquery-validation" "^1.1.1" + "@abp/jquery-validation" "^2.0.1" jquery-validation-unobtrusive "^3.2.11" -"@abp/jquery-validation@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-1.1.1.tgz#03febd285ce9d7e5681619897967b0ccde7e8e04" - integrity sha512-YvAjIW8epp+ddu01BTUkZWPfEADAvNPJeUrrZ6OpcPWM15Tf+ddr4ATgJ1LCg0Bh5F09iQC855osow3lt8sc7g== +"@abp/jquery-validation@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-2.0.1.tgz#f0287d8687275b400a15d4ce8dc76d40b8b38cee" + integrity sha512-18teWDVaMVHGEHc8eGuK7yUG+H6HxlKBRtB0L+VCYiUYsnTKshu+4DvSf0QTtGcbKquY8ui9AwgDnWZJ8Qqjqg== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" jquery-validation "^1.19.1" -"@abp/jquery@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-1.1.1.tgz#56928814bb3df73c1c0014d4b18fef09ec06e195" - integrity sha512-kj4BTtXF0VbCzCqRXnRVEbGndR3F8NlbBhVQN6BQktOuZta3fvx7f2+pSok8vQv0ddmqUFY7FTT2Ei3l4363LQ== +"@abp/jquery@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-2.0.1.tgz#0048b2344523c1c1d602d81291adf35fe9234d62" + integrity sha512-daM0nlxHW3iGoLh8sq03/co2dF9aM6LYqj5hFAHnmwx0UunDnS0rXkgbRieu66tGPvk325Qb2S1Ibpjn8/CqAQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" jquery "^3.4.1" -"@abp/lodash@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-1.1.1.tgz#aa6ef3a85b9827796e295f440b29f0611c508b5f" - integrity sha512-nH7bRS28Tf4hEXcpKHd1IM+MzYTqX8t3htGmsLX4UESQd52eODYOIldtX6gm3OW1O6ECwW6si/o0M2pTEpQqvg== +"@abp/lodash@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-2.0.1.tgz#2f8932eddcc54d569ff37525d5da5219c68247c4" + integrity sha512-YsnQwXDH1EAz/fUs42E5TxclMaHN00oSWqGNmWrVqPMIw671sjyFf8QwQWIQujlo/7hXNYMxwmh5VGqR0TKNqQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" lodash "^4.17.15" -"@abp/luxon@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-1.1.1.tgz#ec389270d78bb271d52163ab3773f549aa91751e" - integrity sha512-WNu8JRSb5FDXfcDwjMYyeYeUN48uuDc/I2cdo3xd1rcY+lbmbzxoG9IYOlE8cRHdgX3z82qsZXFs2lcAy0Le2g== +"@abp/luxon@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-2.0.1.tgz#6d0780254699171a509ab6bd5b1dd1a6ebc96468" + integrity sha512-tVdGgfH/ZvKAUYDiVB9x7WnyrXtUQGl7grvdFnXU8fzH0X8HNsQ4cSswlfMNQhiew8es93UqsjCx9VU8wZT08g== dependencies: luxon "^1.21.3" -"@abp/malihu-custom-scrollbar-plugin@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-1.1.1.tgz#73f8423c29d646dc7f0f270d1d7ef05947333e2a" - integrity sha512-n4b4QK/L1Czdx0oOpUR/bWjK9VENexfUSV/aMjwzHhDmEFABAmEfhIpudCYDwewGswrd7C9agmBvakv2rwPQeA== +"@abp/malihu-custom-scrollbar-plugin@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-2.0.1.tgz#7099199447db1d49eebd12519bbecba80a49c243" + integrity sha512-Ljqt/poELw9xGr+fh29Ui/cA1zFLcOTZzy6/OyGUWW+BaMGjY8CY5k47ZlI0Vo3MGZpHu0AECKF95/P0RqBd9w== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" malihu-custom-scrollbar-plugin "^3.1.5" -"@abp/select2@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-1.1.1.tgz#777967821cfcc4bd1c9fc895e913427fbb330abe" - integrity sha512-t0qcJhD+uo2+XWr4nmMQLAx7MRGQUBdZ81YmGty045ReoSaEKQf4haLkzBcMzpBRusiyMQO/PbxjtwMw/xJQTQ== +"@abp/select2@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-2.0.1.tgz#f274a3fc51e79fd556012844b54bbbfa0d7fedbf" + integrity sha512-RertY05XH+UWp+zipVt0BKGW7Rm3Yn5EZOKKTwlFJ0ciUfPRxkVl70I4xSEgm3Naq83WEH2MmwyOx4yntKZoaQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" select2 "^4.0.12" -"@abp/sweetalert@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-1.1.1.tgz#e055ea46eb4e3d53e623ee0aada9b2d16fea5610" - integrity sha512-V6K/qg7J/bdFmom2kaXYeiLvcmLHFl+MacPX4yYAK2biZdb2pWOkUdmcAzZdOT+UruKfLRhvraVC2uXDySi9NA== +"@abp/sweetalert@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-2.0.1.tgz#8198f43855392d0c07eeb0faac0d68ed5bbdf6b2" + integrity sha512-ZfbQqUNc1PuzchZzCnmhPMuy2mXAvtVEi3CZiLLAy2DHq+jf3Q3jUG9X6hZiqGuyl+Aq5htTX3HLfimca+gVxg== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" sweetalert "^2.1.2" -"@abp/timeago@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-1.1.1.tgz#b626087ca35fb325e8e8a337552694fcbb8a6bf9" - integrity sha512-QYYih/4n6XhCqkRw7fBfyg58T5CHqJHyz7SAfq86RiKAJ4jVtjdSVxj3XKxz8eCb56wZGsO1xXXStI3vdLwwNw== +"@abp/timeago@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-2.0.1.tgz#1f82b07abc281363ada06909143ff09adcee2c13" + integrity sha512-zxvoOt2N7ikF1lZ5EBbSWuNdPsn6Z1O+JtnF5B73WEZ0JGp3wVrLN10RkvHLyDqI86dn0SKrocXvFCMEIot7vA== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" timeago "^1.6.7" -"@abp/toastr@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-1.1.1.tgz#aeb6a8ef8004fce136997f9ee3af7dd241890d50" - integrity sha512-GDewBppm+0FO6kTTy0huczoH9P5q6lFicHFAoEawAMkuWJFW/Ihv/YnEvKGDQwGftuVSWexfqBMN/RZ5YSOiGQ== +"@abp/toastr@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-2.0.1.tgz#3f41d53bdb66a0b1fe400ae190958540ce2616c1" + integrity sha512-cgOlPVuOyw+4Av9ZXqaQIdKzMTJCpxdd60hSm4drYoq0m7wQADL0X5LB7rH/8i/oPvn+BAD2gRomGZEhTSgouw== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" toastr "^2.1.4" "@fortawesome/fontawesome-free@^5.11.2": diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/Controllers/AccountController.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/Controllers/AccountController.cs new file mode 100644 index 0000000000..318e7191a2 --- /dev/null +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/Controllers/AccountController.cs @@ -0,0 +1,9 @@ +using Volo.Abp.AspNetCore.Mvc.Authentication; + +namespace MyCompanyName.MyProjectName.Controllers +{ + public class AccountController : ChallengeAccountController + { + + } +} diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj index 663a908ad8..338f55bc5f 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyCompanyName.MyProjectName.Web.Host.csproj @@ -1,4 +1,4 @@ - + @@ -6,16 +6,17 @@ netcoreapp3.1 MyCompanyName.MyProjectName true - MyCompanyName-MyProjectName-c2d31439-b723-48e2-b061-5ebd7aeb6010 + MyCompanyName.MyProjectName-c2d31439-b723-48e2-b061-5ebd7aeb6010 - + - + + @@ -27,6 +28,7 @@ + @@ -50,5 +52,5 @@ Always - + diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostMenuContributor.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostMenuContributor.cs new file mode 100644 index 0000000000..430a1c237c --- /dev/null +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostMenuContributor.cs @@ -0,0 +1,60 @@ +using System; +using System.Threading.Tasks; +using Localization.Resources.AbpUi; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Localization; +using MyCompanyName.MyProjectName.Localization; +using Volo.Abp.UI.Navigation; +using Volo.Abp.Users; + +namespace MyCompanyName.MyProjectName +{ + public class MyProjectNameWebHostMenuContributor : IMenuContributor + { + private readonly IConfiguration _configuration; + + public MyProjectNameWebHostMenuContributor(IConfiguration configuration) + { + _configuration = configuration; + } + + public Task ConfigureMenuAsync(MenuConfigurationContext context) + { + if (context.Menu.Name == StandardMenus.User) + { + AddLogoutItemToMenu(context); + } + + return Task.CompletedTask; + } + + private void AddLogoutItemToMenu(MenuConfigurationContext context) + { + var currentUser = context.ServiceProvider.GetRequiredService(); + var l = context.ServiceProvider.GetRequiredService>(); + + if (currentUser.IsAuthenticated) + { + context.Menu.Items.Add(new ApplicationMenuItem( + "Account.Manage", + l["ManageYourProfile"], + $"{_configuration["AuthServer:Authority"].EnsureEndsWith('/')}Account/Manage", + icon: "fa fa-cog", + order: int.MaxValue - 1001, + null, + "_blank") + ); + + + context.Menu.Items.Add(new ApplicationMenuItem( + "Account.Logout", + l["Logout"], + "/Account/Logout", + "fas fa-power-off", + order: int.MaxValue - 1000 + )); + } + } + } +} \ No newline at end of file diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostModule.cs index 6eb3dc9ea3..41fb8fc7f2 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostModule.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/MyProjectNameWebHostModule.cs @@ -21,6 +21,7 @@ using Volo.Abp.AspNetCore.Mvc.UI; using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; +using Volo.Abp.AspNetCore.Serilog; using Volo.Abp.Autofac; using Volo.Abp.AutoMapper; using Volo.Abp.Caching; @@ -37,6 +38,7 @@ using Volo.Abp.TenantManagement; using Volo.Abp.TenantManagement.Web; using Volo.Abp.UI.Navigation.Urls; using Volo.Abp.UI; +using Volo.Abp.UI.Navigation; using Volo.Abp.VirtualFileSystem; namespace MyCompanyName.MyProjectName @@ -54,7 +56,8 @@ namespace MyCompanyName.MyProjectName typeof(AbpTenantManagementWebModule), typeof(AbpTenantManagementHttpApiClientModule), typeof(AbpFeatureManagementHttpApiClientModule), - typeof(AbpPermissionManagementHttpApiClientModule) + typeof(AbpPermissionManagementHttpApiClientModule), + typeof(AbpAspNetCoreSerilogModule) )] public class MyProjectNameWebHostModule : AbpModule { @@ -76,6 +79,7 @@ namespace MyCompanyName.MyProjectName var hostingEnvironment = context.Services.GetHostingEnvironment(); var configuration = context.Services.GetConfiguration(); + ConfigureMenu(configuration); ConfigureCache(configuration); ConfigureUrls(configuration); ConfigureAuthentication(context, configuration); @@ -85,7 +89,15 @@ namespace MyCompanyName.MyProjectName ConfigureMultiTenancy(); ConfigureRedis(context, configuration, hostingEnvironment); } - + + private void ConfigureMenu(IConfiguration configuration) + { + Configure(options => + { + options.MenuContributors.Add(new MyProjectNameWebHostMenuContributor(configuration)); + }); + } + private void ConfigureCache(IConfiguration configuration) { Configure(options => @@ -239,7 +251,7 @@ namespace MyCompanyName.MyProjectName }); app.UseAuditing(); - + app.UseAbpSerilogEnrichers(); app.UseMvcWithDefaultRouteAndArea(); } } diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/package.json b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/package.json index 35b0592f57..96b4f2fdbf 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/package.json +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/package.json @@ -3,6 +3,6 @@ "name": "my-app", "private": true, "dependencies": { - "@abp/aspnetcore.mvc.ui.theme.basic": "^1.1.1" + "@abp/aspnetcore.mvc.ui.theme.basic": "^2.0.1" } } \ No newline at end of file diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/yarn.lock b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/yarn.lock index 12cad6c691..8d232d1d09 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/yarn.lock +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Host/yarn.lock @@ -2,37 +2,37 @@ # yarn lockfile v1 -"@abp/aspnetcore.mvc.ui.theme.basic@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-1.1.1.tgz#a3d21f8cc5ede2e85b881fe69d9ecd5fc2268e47" - integrity sha512-ooXtCM3TWN69RU7xs6avnzOQBXzsiHY5BEIogzSBialZC4uG5H56qrIr4MbsFNae+PQM23Mw2tnJ/Z7dutURCQ== +"@abp/aspnetcore.mvc.ui.theme.basic@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-2.0.1.tgz#e336c8e3b52b04177fc4039c54f67984f8230f6f" + integrity sha512-yMYL8Q1DdS5Dt8nHz5K0ca+4uQ853iOLts/gWmJ4YybWxn4BMu17hlFWpdbmYrtLCW8n45yRYy8dp+9go8zCQw== dependencies: - "@abp/aspnetcore.mvc.ui.theme.shared" "^1.1.1" + "@abp/aspnetcore.mvc.ui.theme.shared" "^2.0.1" -"@abp/aspnetcore.mvc.ui.theme.shared@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-1.1.1.tgz#b5eb57bcebcf211a75cf7d540dcc89a0f9ade013" - integrity sha512-LilSyefzT1+rcTU7vbWxcO8TwBgGZIx6QbMUrDicSTH6LLJ9S5+yNaGNJbbZKDG6qx0BEoC1u8dE8KCUshwxoQ== - dependencies: - "@abp/aspnetcore.mvc.ui" "^1.1.1" - "@abp/bootstrap" "^1.1.1" - "@abp/bootstrap-datepicker" "^1.1.1" - "@abp/datatables.net-bs4" "^1.1.1" - "@abp/font-awesome" "^1.1.1" - "@abp/jquery-form" "^1.1.1" - "@abp/jquery-validation-unobtrusive" "^1.1.1" - "@abp/lodash" "^1.1.1" - "@abp/luxon" "^1.1.1" - "@abp/malihu-custom-scrollbar-plugin" "^1.1.1" - "@abp/select2" "^1.1.1" - "@abp/sweetalert" "^1.1.1" - "@abp/timeago" "^1.1.1" - "@abp/toastr" "^1.1.1" - -"@abp/aspnetcore.mvc.ui@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-1.1.1.tgz#9d693516b6a215dfd2113db9ef52f02881a3e1d5" - integrity sha512-wZbptVCSxZzEjkJx+/sWrH9Pikp9nOy7V8Htz+L+S7/qAzfXu5PRVV8ahddfAcDHRk30buRhdbJlCVdt6hkZ6g== +"@abp/aspnetcore.mvc.ui.theme.shared@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-2.0.1.tgz#2bad208bfc422e6be12f22431c713180d924e17c" + integrity sha512-6/ZnF4dFbmpiqDIx3Lc2NJpCNcpmvrEh6kDZC5x9q3ICTPK/CgspM7dVG2dSpFFkXbDNoGH6i/wJwEUWHOKzYQ== + dependencies: + "@abp/aspnetcore.mvc.ui" "^2.0.1" + "@abp/bootstrap" "^2.0.1" + "@abp/bootstrap-datepicker" "^2.0.1" + "@abp/datatables.net-bs4" "^2.0.1" + "@abp/font-awesome" "^2.0.1" + "@abp/jquery-form" "^2.0.1" + "@abp/jquery-validation-unobtrusive" "^2.0.1" + "@abp/lodash" "^2.0.1" + "@abp/luxon" "^2.0.1" + "@abp/malihu-custom-scrollbar-plugin" "^2.0.1" + "@abp/select2" "^2.0.1" + "@abp/sweetalert" "^2.0.1" + "@abp/timeago" "^2.0.1" + "@abp/toastr" "^2.0.1" + +"@abp/aspnetcore.mvc.ui@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-2.0.1.tgz#2c319182f7ab5f99059df4d36cf894deeba20023" + integrity sha512-bLTyfqoPrzHrdPIw3twJrILO99fzHJZrUJmJDuk5cT1Ox+bCv3AAxi7UEEaOQdjDdZlURq86SKM5x/EndeGpHA== dependencies: ansi-colors "^4.1.1" extend-object "^1.0.0" @@ -41,135 +41,135 @@ path "^0.12.7" rimraf "^3.0.0" -"@abp/bootstrap-datepicker@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-1.1.1.tgz#fb1ceec1df24f384a6349c4acfb3627e02e4a42f" - integrity sha512-RIQLSrKBu/cTAU2lFenSAoKcMp7wgF4e3nP4/iOu5ZtCgti5vUjMEcqEvBxtlwKTHMXsTG4GtNKqjTwjXMjONQ== +"@abp/bootstrap-datepicker@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-2.0.1.tgz#458361b7c7ba8c4fc260e9117ae52f054cbab705" + integrity sha512-mkF2ioq1UxOw7K2IDzzjuLco/V/HNkB5t7HqDfnNt9JFEt71ms2xRFe8KLxpr9MUWB9MdzlGo4ywyHzGxA61mg== dependencies: bootstrap-datepicker "^1.9.0" -"@abp/bootstrap@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-1.1.1.tgz#e16fae6ff6b18096276219edf3483fd8f41c925d" - integrity sha512-OIaGJaizhI8UNfy4bnw2xT2Z0QG7BJJrjxOPGepfd4jn/AUi/vFdOpJFWvu2P9PwSzRmn/LuSlr2WONDOdPVWQ== +"@abp/bootstrap@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-2.0.1.tgz#78d6a7c0787787fd92f8d19c7f8cfee05d8f863e" + integrity sha512-GFAho519IBIK0199LCK5NpuaG44w0Tmjjmxns3V+MbzdXGa5d3hZzuPDhYv6hOB9Aj5d0UIqT39KmvrbHAgvuQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" bootstrap "^4.3.1" -"@abp/core@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/core/-/core-1.1.1.tgz#1379145980d6b142fd0123200c60ffb206149d56" - integrity sha512-OvUG7xRvk8nSqwC1s45YPnTuhC2OWe1AVa1nnC6FVHMH/g1Je7UJwnbu47K7uNS+lDRJUIktNbufYKiwutEjRg== +"@abp/core@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/core/-/core-2.0.1.tgz#441b231f7deb4356f71fdc853873ee3e7eacebea" + integrity sha512-5m5Buci+efcmkxPkVWAIAad6idvXS5qSqK/oq8fJj2I4J95ug8CUWRwg7cFzZGLljUKX6kEbCtB//NBCoI+aJA== -"@abp/datatables.net-bs4@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-1.1.1.tgz#c7e79534c2e4b51b3e98bcc0df3292cb08ae9d2e" - integrity sha512-t40xQIGBMLPZiSbcZHW3AwE8uk+xcl7OitBT1jym0XPKVtgJsHez3ynDE5v/PjHe+ColCG8lTRjRnNoXo5dzDw== +"@abp/datatables.net-bs4@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-2.0.1.tgz#fac4afdd44784f3cdd395830cda4b2781a817c05" + integrity sha512-jD2cxrPSxfzjM6xSDBiHJuxk6wj6wBQsD4+Go0kOicQSEzDef9CCN8hi8NsCITosAXVAEIoHGwE1uTlK6sir5Q== dependencies: - "@abp/datatables.net" "^1.1.1" + "@abp/datatables.net" "^2.0.1" datatables.net-bs4 "^1.10.20" -"@abp/datatables.net@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-1.1.1.tgz#de8b362c29f452188624536cdd6feccad2b533e6" - integrity sha512-y76IDBlgc0n1YgQqJ+9cfzXpLwr2arhdIfSmqX+qRXz6GfVNY7e3JijkFSgDKUzKGYo1HZMzgJmDmeNIRwMZsQ== +"@abp/datatables.net@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-2.0.1.tgz#3a0a5e5a836fe058d43798139349d92996ea9478" + integrity sha512-xEsvLofWj0W1ieplwEM4j5SEpoW3zS/yRQczHGMWBTR1Uazy0ysqQwMau+nRsNz7z12cFfooVG2mNzfkWRa84g== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" datatables.net "^1.10.20" -"@abp/font-awesome@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-1.1.1.tgz#7f0a210eb7611d75542028b0c88a0c83f1d9db50" - integrity sha512-6RHbixi7IVWAb3JCHrUmEYD3HmAH4R75Nuo54LvFzATrh4G6gdBONIeDuTo79OTxe4Zhp+WLxeA49Y21kt77mg== +"@abp/font-awesome@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-2.0.1.tgz#738e5d8a93c29ba13f019a1f0198b9272c644e5c" + integrity sha512-+2yQ3RRMTkj0QsxbYB1gHzqEM+/yiFpuXakKTHxFnCZjgZhmmU229hm14xWbpyWsKohbtrr4R/te1WBrqryqPA== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" "@fortawesome/fontawesome-free" "^5.11.2" -"@abp/jquery-form@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-1.1.1.tgz#1dae1145da720e222efcb396906c3fbe5a3dd29f" - integrity sha512-AIIdN36f8xwr4LgiNnBHohJ5tlxh/r+DuDtXcScpZN6GWBE+XgUotN0pZIIva82IxCyUNdDudzgluX9IjI+00w== +"@abp/jquery-form@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-2.0.1.tgz#e92b9ad75a4f08c63b1005d97d8baeb689ebfe6c" + integrity sha512-A/imqgswwLrU+mR1oyDeVW5PDCIBQk/sMtU/PvRXaNL9c59nU5EVWIuPzORDzpkoECtuNMqStjERHc9IROMjnA== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" jquery-form "^4.2.2" -"@abp/jquery-validation-unobtrusive@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-1.1.1.tgz#aeba0883260f47ab22a39343817b1811fc2b81a9" - integrity sha512-q1b0KG8l3DXUiW8JXdq9l1jR/CwgzrZdxwdKGLB2J/oxHlywQIb7yrjR6WGCshjPpcx2SkOL0j/ZXMIMh533hQ== +"@abp/jquery-validation-unobtrusive@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-2.0.1.tgz#e4ed82f6432bba68139210552a9e7800d838d788" + integrity sha512-72XyC3megf6VXm283pCXB5kctbNLmI/EtfoIEp+FffTUmxCoL+gEEnqb1V+7dMUm5QYCNDnhYWk7K6TTxBPGPw== dependencies: - "@abp/jquery-validation" "^1.1.1" + "@abp/jquery-validation" "^2.0.1" jquery-validation-unobtrusive "^3.2.11" -"@abp/jquery-validation@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-1.1.1.tgz#03febd285ce9d7e5681619897967b0ccde7e8e04" - integrity sha512-YvAjIW8epp+ddu01BTUkZWPfEADAvNPJeUrrZ6OpcPWM15Tf+ddr4ATgJ1LCg0Bh5F09iQC855osow3lt8sc7g== +"@abp/jquery-validation@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-2.0.1.tgz#f0287d8687275b400a15d4ce8dc76d40b8b38cee" + integrity sha512-18teWDVaMVHGEHc8eGuK7yUG+H6HxlKBRtB0L+VCYiUYsnTKshu+4DvSf0QTtGcbKquY8ui9AwgDnWZJ8Qqjqg== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" jquery-validation "^1.19.1" -"@abp/jquery@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-1.1.1.tgz#56928814bb3df73c1c0014d4b18fef09ec06e195" - integrity sha512-kj4BTtXF0VbCzCqRXnRVEbGndR3F8NlbBhVQN6BQktOuZta3fvx7f2+pSok8vQv0ddmqUFY7FTT2Ei3l4363LQ== +"@abp/jquery@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-2.0.1.tgz#0048b2344523c1c1d602d81291adf35fe9234d62" + integrity sha512-daM0nlxHW3iGoLh8sq03/co2dF9aM6LYqj5hFAHnmwx0UunDnS0rXkgbRieu66tGPvk325Qb2S1Ibpjn8/CqAQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" jquery "^3.4.1" -"@abp/lodash@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-1.1.1.tgz#aa6ef3a85b9827796e295f440b29f0611c508b5f" - integrity sha512-nH7bRS28Tf4hEXcpKHd1IM+MzYTqX8t3htGmsLX4UESQd52eODYOIldtX6gm3OW1O6ECwW6si/o0M2pTEpQqvg== +"@abp/lodash@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-2.0.1.tgz#2f8932eddcc54d569ff37525d5da5219c68247c4" + integrity sha512-YsnQwXDH1EAz/fUs42E5TxclMaHN00oSWqGNmWrVqPMIw671sjyFf8QwQWIQujlo/7hXNYMxwmh5VGqR0TKNqQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" lodash "^4.17.15" -"@abp/luxon@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-1.1.1.tgz#ec389270d78bb271d52163ab3773f549aa91751e" - integrity sha512-WNu8JRSb5FDXfcDwjMYyeYeUN48uuDc/I2cdo3xd1rcY+lbmbzxoG9IYOlE8cRHdgX3z82qsZXFs2lcAy0Le2g== +"@abp/luxon@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-2.0.1.tgz#6d0780254699171a509ab6bd5b1dd1a6ebc96468" + integrity sha512-tVdGgfH/ZvKAUYDiVB9x7WnyrXtUQGl7grvdFnXU8fzH0X8HNsQ4cSswlfMNQhiew8es93UqsjCx9VU8wZT08g== dependencies: luxon "^1.21.3" -"@abp/malihu-custom-scrollbar-plugin@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-1.1.1.tgz#73f8423c29d646dc7f0f270d1d7ef05947333e2a" - integrity sha512-n4b4QK/L1Czdx0oOpUR/bWjK9VENexfUSV/aMjwzHhDmEFABAmEfhIpudCYDwewGswrd7C9agmBvakv2rwPQeA== +"@abp/malihu-custom-scrollbar-plugin@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-2.0.1.tgz#7099199447db1d49eebd12519bbecba80a49c243" + integrity sha512-Ljqt/poELw9xGr+fh29Ui/cA1zFLcOTZzy6/OyGUWW+BaMGjY8CY5k47ZlI0Vo3MGZpHu0AECKF95/P0RqBd9w== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" malihu-custom-scrollbar-plugin "^3.1.5" -"@abp/select2@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-1.1.1.tgz#777967821cfcc4bd1c9fc895e913427fbb330abe" - integrity sha512-t0qcJhD+uo2+XWr4nmMQLAx7MRGQUBdZ81YmGty045ReoSaEKQf4haLkzBcMzpBRusiyMQO/PbxjtwMw/xJQTQ== +"@abp/select2@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-2.0.1.tgz#f274a3fc51e79fd556012844b54bbbfa0d7fedbf" + integrity sha512-RertY05XH+UWp+zipVt0BKGW7Rm3Yn5EZOKKTwlFJ0ciUfPRxkVl70I4xSEgm3Naq83WEH2MmwyOx4yntKZoaQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" select2 "^4.0.12" -"@abp/sweetalert@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-1.1.1.tgz#e055ea46eb4e3d53e623ee0aada9b2d16fea5610" - integrity sha512-V6K/qg7J/bdFmom2kaXYeiLvcmLHFl+MacPX4yYAK2biZdb2pWOkUdmcAzZdOT+UruKfLRhvraVC2uXDySi9NA== +"@abp/sweetalert@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-2.0.1.tgz#8198f43855392d0c07eeb0faac0d68ed5bbdf6b2" + integrity sha512-ZfbQqUNc1PuzchZzCnmhPMuy2mXAvtVEi3CZiLLAy2DHq+jf3Q3jUG9X6hZiqGuyl+Aq5htTX3HLfimca+gVxg== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" sweetalert "^2.1.2" -"@abp/timeago@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-1.1.1.tgz#b626087ca35fb325e8e8a337552694fcbb8a6bf9" - integrity sha512-QYYih/4n6XhCqkRw7fBfyg58T5CHqJHyz7SAfq86RiKAJ4jVtjdSVxj3XKxz8eCb56wZGsO1xXXStI3vdLwwNw== +"@abp/timeago@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-2.0.1.tgz#1f82b07abc281363ada06909143ff09adcee2c13" + integrity sha512-zxvoOt2N7ikF1lZ5EBbSWuNdPsn6Z1O+JtnF5B73WEZ0JGp3wVrLN10RkvHLyDqI86dn0SKrocXvFCMEIot7vA== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" timeago "^1.6.7" -"@abp/toastr@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-1.1.1.tgz#aeb6a8ef8004fce136997f9ee3af7dd241890d50" - integrity sha512-GDewBppm+0FO6kTTy0huczoH9P5q6lFicHFAoEawAMkuWJFW/Ihv/YnEvKGDQwGftuVSWexfqBMN/RZ5YSOiGQ== +"@abp/toastr@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-2.0.1.tgz#3f41d53bdb66a0b1fe400ae190958540ce2616c1" + integrity sha512-cgOlPVuOyw+4Av9ZXqaQIdKzMTJCpxdd60hSm4drYoq0m7wQADL0X5LB7rH/8i/oPvn+BAD2gRomGZEhTSgouw== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" toastr "^2.1.4" "@fortawesome/fontawesome-free@^5.11.2": diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20191218090727_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200106080643_Initial.Designer.cs similarity index 99% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20191218090727_Initial.Designer.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200106080643_Initial.Designer.cs index 5ce29ab888..93e8a25a34 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20191218090727_Initial.Designer.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200106080643_Initial.Designer.cs @@ -10,7 +10,7 @@ using MyCompanyName.MyProjectName.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(UnifiedDbContext))] - [Migration("20191218090727_Initial")] + [Migration("20200106080643_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20191218090727_Initial.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200106080643_Initial.cs similarity index 100% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20191218090727_Initial.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20200106080643_Initial.cs diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyCompanyName.MyProjectName.Web.Unified.csproj b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyCompanyName.MyProjectName.Web.Unified.csproj index dd930afbb0..9277615d12 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyCompanyName.MyProjectName.Web.Unified.csproj +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyCompanyName.MyProjectName.Web.Unified.csproj @@ -1,4 +1,4 @@ - + @@ -6,19 +6,21 @@ netcoreapp3.1 MyCompanyName.MyProjectName true - MyCompanyName-MyProjectName-c2d31439-b723-48e2-b061-5ebd7aeb6010 + MyCompanyName.MyProjectName-c2d31439-b723-48e2-b061-5ebd7aeb6010 - + - + + + diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs index 2f5b250e02..cdd5de9398 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs @@ -8,9 +8,11 @@ using MyCompanyName.MyProjectName.Web; using Microsoft.OpenApi.Models; using Swashbuckle.AspNetCore.Swagger; using Volo.Abp; +using Volo.Abp.Account; using Volo.Abp.Account.Web; using Volo.Abp.AspNetCore.Mvc.UI.Theme.Basic; 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.Data; @@ -42,6 +44,7 @@ namespace MyCompanyName.MyProjectName typeof(AbpAuditLoggingEntityFrameworkCoreModule), typeof(AbpAutofacModule), typeof(AbpAccountWebModule), + typeof(AbpAccountApplicationModule), typeof(AbpEntityFrameworkCoreSqlServerModule), typeof(AbpSettingManagementEntityFrameworkCoreModule), typeof(AbpPermissionManagementEntityFrameworkCoreModule), @@ -54,7 +57,8 @@ namespace MyCompanyName.MyProjectName typeof(AbpTenantManagementWebModule), typeof(AbpTenantManagementApplicationModule), typeof(AbpTenantManagementEntityFrameworkCoreModule), - typeof(AbpAspNetCoreMvcUiBasicThemeModule) + typeof(AbpAspNetCoreMvcUiBasicThemeModule), + typeof(AbpAspNetCoreSerilogModule) )] public class MyProjectNameWebUnifiedModule : AbpModule { @@ -94,7 +98,8 @@ namespace MyCompanyName.MyProjectName options.Languages.Add(new LanguageInfo("en", "en", "English")); options.Languages.Add(new LanguageInfo("pt-BR", "pt-BR", "Português (Brasil)")); options.Languages.Add(new LanguageInfo("tr", "tr", "Türkçe")); - options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "Chinese")); + options.Languages.Add(new LanguageInfo("zh-Hans", "zh-Hans", "简体中文")); + options.Languages.Add(new LanguageInfo("zh-Hant", "zh-Hant", "繁體中文")); }); Configure(options => @@ -135,6 +140,7 @@ namespace MyCompanyName.MyProjectName app.UseAbpRequestLocalization(); app.UseAuditing(); + app.UseAbpSerilogEnrichers(); app.UseMvcWithDefaultRouteAndArea(); using (var scope = context.ServiceProvider.CreateScope()) diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/package.json b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/package.json index 35b0592f57..96b4f2fdbf 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/package.json +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/package.json @@ -3,6 +3,6 @@ "name": "my-app", "private": true, "dependencies": { - "@abp/aspnetcore.mvc.ui.theme.basic": "^1.1.1" + "@abp/aspnetcore.mvc.ui.theme.basic": "^2.0.1" } } \ No newline at end of file diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/yarn.lock b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/yarn.lock index ad0afae66a..521220bb7e 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/yarn.lock +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/yarn.lock @@ -2,37 +2,37 @@ # yarn lockfile v1 -"@abp/aspnetcore.mvc.ui.theme.basic@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-1.1.1.tgz#a3d21f8cc5ede2e85b881fe69d9ecd5fc2268e47" - integrity sha512-ooXtCM3TWN69RU7xs6avnzOQBXzsiHY5BEIogzSBialZC4uG5H56qrIr4MbsFNae+PQM23Mw2tnJ/Z7dutURCQ== +"@abp/aspnetcore.mvc.ui.theme.basic@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.basic/-/aspnetcore.mvc.ui.theme.basic-2.0.1.tgz#e336c8e3b52b04177fc4039c54f67984f8230f6f" + integrity sha512-yMYL8Q1DdS5Dt8nHz5K0ca+4uQ853iOLts/gWmJ4YybWxn4BMu17hlFWpdbmYrtLCW8n45yRYy8dp+9go8zCQw== dependencies: - "@abp/aspnetcore.mvc.ui.theme.shared" "^1.1.1" + "@abp/aspnetcore.mvc.ui.theme.shared" "^2.0.1" -"@abp/aspnetcore.mvc.ui.theme.shared@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-1.1.1.tgz#b5eb57bcebcf211a75cf7d540dcc89a0f9ade013" - integrity sha512-LilSyefzT1+rcTU7vbWxcO8TwBgGZIx6QbMUrDicSTH6LLJ9S5+yNaGNJbbZKDG6qx0BEoC1u8dE8KCUshwxoQ== - dependencies: - "@abp/aspnetcore.mvc.ui" "^1.1.1" - "@abp/bootstrap" "^1.1.1" - "@abp/bootstrap-datepicker" "^1.1.1" - "@abp/datatables.net-bs4" "^1.1.1" - "@abp/font-awesome" "^1.1.1" - "@abp/jquery-form" "^1.1.1" - "@abp/jquery-validation-unobtrusive" "^1.1.1" - "@abp/lodash" "^1.1.1" - "@abp/luxon" "^1.1.1" - "@abp/malihu-custom-scrollbar-plugin" "^1.1.1" - "@abp/select2" "^1.1.1" - "@abp/sweetalert" "^1.1.1" - "@abp/timeago" "^1.1.1" - "@abp/toastr" "^1.1.1" - -"@abp/aspnetcore.mvc.ui@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-1.1.1.tgz#9d693516b6a215dfd2113db9ef52f02881a3e1d5" - integrity sha512-wZbptVCSxZzEjkJx+/sWrH9Pikp9nOy7V8Htz+L+S7/qAzfXu5PRVV8ahddfAcDHRk30buRhdbJlCVdt6hkZ6g== +"@abp/aspnetcore.mvc.ui.theme.shared@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui.theme.shared/-/aspnetcore.mvc.ui.theme.shared-2.0.1.tgz#2bad208bfc422e6be12f22431c713180d924e17c" + integrity sha512-6/ZnF4dFbmpiqDIx3Lc2NJpCNcpmvrEh6kDZC5x9q3ICTPK/CgspM7dVG2dSpFFkXbDNoGH6i/wJwEUWHOKzYQ== + dependencies: + "@abp/aspnetcore.mvc.ui" "^2.0.1" + "@abp/bootstrap" "^2.0.1" + "@abp/bootstrap-datepicker" "^2.0.1" + "@abp/datatables.net-bs4" "^2.0.1" + "@abp/font-awesome" "^2.0.1" + "@abp/jquery-form" "^2.0.1" + "@abp/jquery-validation-unobtrusive" "^2.0.1" + "@abp/lodash" "^2.0.1" + "@abp/luxon" "^2.0.1" + "@abp/malihu-custom-scrollbar-plugin" "^2.0.1" + "@abp/select2" "^2.0.1" + "@abp/sweetalert" "^2.0.1" + "@abp/timeago" "^2.0.1" + "@abp/toastr" "^2.0.1" + +"@abp/aspnetcore.mvc.ui@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/aspnetcore.mvc.ui/-/aspnetcore.mvc.ui-2.0.1.tgz#2c319182f7ab5f99059df4d36cf894deeba20023" + integrity sha512-bLTyfqoPrzHrdPIw3twJrILO99fzHJZrUJmJDuk5cT1Ox+bCv3AAxi7UEEaOQdjDdZlURq86SKM5x/EndeGpHA== dependencies: ansi-colors "^4.1.1" extend-object "^1.0.0" @@ -41,135 +41,135 @@ path "^0.12.7" rimraf "^3.0.0" -"@abp/bootstrap-datepicker@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-1.1.1.tgz#fb1ceec1df24f384a6349c4acfb3627e02e4a42f" - integrity sha512-RIQLSrKBu/cTAU2lFenSAoKcMp7wgF4e3nP4/iOu5ZtCgti5vUjMEcqEvBxtlwKTHMXsTG4GtNKqjTwjXMjONQ== +"@abp/bootstrap-datepicker@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/bootstrap-datepicker/-/bootstrap-datepicker-2.0.1.tgz#458361b7c7ba8c4fc260e9117ae52f054cbab705" + integrity sha512-mkF2ioq1UxOw7K2IDzzjuLco/V/HNkB5t7HqDfnNt9JFEt71ms2xRFe8KLxpr9MUWB9MdzlGo4ywyHzGxA61mg== dependencies: bootstrap-datepicker "^1.9.0" -"@abp/bootstrap@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-1.1.1.tgz#e16fae6ff6b18096276219edf3483fd8f41c925d" - integrity sha512-OIaGJaizhI8UNfy4bnw2xT2Z0QG7BJJrjxOPGepfd4jn/AUi/vFdOpJFWvu2P9PwSzRmn/LuSlr2WONDOdPVWQ== +"@abp/bootstrap@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/bootstrap/-/bootstrap-2.0.1.tgz#78d6a7c0787787fd92f8d19c7f8cfee05d8f863e" + integrity sha512-GFAho519IBIK0199LCK5NpuaG44w0Tmjjmxns3V+MbzdXGa5d3hZzuPDhYv6hOB9Aj5d0UIqT39KmvrbHAgvuQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" bootstrap "^4.3.1" -"@abp/core@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/core/-/core-1.1.1.tgz#1379145980d6b142fd0123200c60ffb206149d56" - integrity sha512-OvUG7xRvk8nSqwC1s45YPnTuhC2OWe1AVa1nnC6FVHMH/g1Je7UJwnbu47K7uNS+lDRJUIktNbufYKiwutEjRg== +"@abp/core@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/core/-/core-2.0.1.tgz#441b231f7deb4356f71fdc853873ee3e7eacebea" + integrity sha512-5m5Buci+efcmkxPkVWAIAad6idvXS5qSqK/oq8fJj2I4J95ug8CUWRwg7cFzZGLljUKX6kEbCtB//NBCoI+aJA== -"@abp/datatables.net-bs4@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-1.1.1.tgz#c7e79534c2e4b51b3e98bcc0df3292cb08ae9d2e" - integrity sha512-t40xQIGBMLPZiSbcZHW3AwE8uk+xcl7OitBT1jym0XPKVtgJsHez3ynDE5v/PjHe+ColCG8lTRjRnNoXo5dzDw== +"@abp/datatables.net-bs4@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/datatables.net-bs4/-/datatables.net-bs4-2.0.1.tgz#fac4afdd44784f3cdd395830cda4b2781a817c05" + integrity sha512-jD2cxrPSxfzjM6xSDBiHJuxk6wj6wBQsD4+Go0kOicQSEzDef9CCN8hi8NsCITosAXVAEIoHGwE1uTlK6sir5Q== dependencies: - "@abp/datatables.net" "^1.1.1" + "@abp/datatables.net" "^2.0.1" datatables.net-bs4 "^1.10.20" -"@abp/datatables.net@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-1.1.1.tgz#de8b362c29f452188624536cdd6feccad2b533e6" - integrity sha512-y76IDBlgc0n1YgQqJ+9cfzXpLwr2arhdIfSmqX+qRXz6GfVNY7e3JijkFSgDKUzKGYo1HZMzgJmDmeNIRwMZsQ== +"@abp/datatables.net@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/datatables.net/-/datatables.net-2.0.1.tgz#3a0a5e5a836fe058d43798139349d92996ea9478" + integrity sha512-xEsvLofWj0W1ieplwEM4j5SEpoW3zS/yRQczHGMWBTR1Uazy0ysqQwMau+nRsNz7z12cFfooVG2mNzfkWRa84g== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" datatables.net "^1.10.20" -"@abp/font-awesome@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-1.1.1.tgz#7f0a210eb7611d75542028b0c88a0c83f1d9db50" - integrity sha512-6RHbixi7IVWAb3JCHrUmEYD3HmAH4R75Nuo54LvFzATrh4G6gdBONIeDuTo79OTxe4Zhp+WLxeA49Y21kt77mg== +"@abp/font-awesome@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/font-awesome/-/font-awesome-2.0.1.tgz#738e5d8a93c29ba13f019a1f0198b9272c644e5c" + integrity sha512-+2yQ3RRMTkj0QsxbYB1gHzqEM+/yiFpuXakKTHxFnCZjgZhmmU229hm14xWbpyWsKohbtrr4R/te1WBrqryqPA== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" "@fortawesome/fontawesome-free" "^5.11.2" -"@abp/jquery-form@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-1.1.1.tgz#1dae1145da720e222efcb396906c3fbe5a3dd29f" - integrity sha512-AIIdN36f8xwr4LgiNnBHohJ5tlxh/r+DuDtXcScpZN6GWBE+XgUotN0pZIIva82IxCyUNdDudzgluX9IjI+00w== +"@abp/jquery-form@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery-form/-/jquery-form-2.0.1.tgz#e92b9ad75a4f08c63b1005d97d8baeb689ebfe6c" + integrity sha512-A/imqgswwLrU+mR1oyDeVW5PDCIBQk/sMtU/PvRXaNL9c59nU5EVWIuPzORDzpkoECtuNMqStjERHc9IROMjnA== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" jquery-form "^4.2.2" -"@abp/jquery-validation-unobtrusive@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-1.1.1.tgz#aeba0883260f47ab22a39343817b1811fc2b81a9" - integrity sha512-q1b0KG8l3DXUiW8JXdq9l1jR/CwgzrZdxwdKGLB2J/oxHlywQIb7yrjR6WGCshjPpcx2SkOL0j/ZXMIMh533hQ== +"@abp/jquery-validation-unobtrusive@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation-unobtrusive/-/jquery-validation-unobtrusive-2.0.1.tgz#e4ed82f6432bba68139210552a9e7800d838d788" + integrity sha512-72XyC3megf6VXm283pCXB5kctbNLmI/EtfoIEp+FffTUmxCoL+gEEnqb1V+7dMUm5QYCNDnhYWk7K6TTxBPGPw== dependencies: - "@abp/jquery-validation" "^1.1.1" + "@abp/jquery-validation" "^2.0.1" jquery-validation-unobtrusive "^3.2.11" -"@abp/jquery-validation@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-1.1.1.tgz#03febd285ce9d7e5681619897967b0ccde7e8e04" - integrity sha512-YvAjIW8epp+ddu01BTUkZWPfEADAvNPJeUrrZ6OpcPWM15Tf+ddr4ATgJ1LCg0Bh5F09iQC855osow3lt8sc7g== +"@abp/jquery-validation@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery-validation/-/jquery-validation-2.0.1.tgz#f0287d8687275b400a15d4ce8dc76d40b8b38cee" + integrity sha512-18teWDVaMVHGEHc8eGuK7yUG+H6HxlKBRtB0L+VCYiUYsnTKshu+4DvSf0QTtGcbKquY8ui9AwgDnWZJ8Qqjqg== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" jquery-validation "^1.19.1" -"@abp/jquery@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-1.1.1.tgz#56928814bb3df73c1c0014d4b18fef09ec06e195" - integrity sha512-kj4BTtXF0VbCzCqRXnRVEbGndR3F8NlbBhVQN6BQktOuZta3fvx7f2+pSok8vQv0ddmqUFY7FTT2Ei3l4363LQ== +"@abp/jquery@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/jquery/-/jquery-2.0.1.tgz#0048b2344523c1c1d602d81291adf35fe9234d62" + integrity sha512-daM0nlxHW3iGoLh8sq03/co2dF9aM6LYqj5hFAHnmwx0UunDnS0rXkgbRieu66tGPvk325Qb2S1Ibpjn8/CqAQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" jquery "^3.4.1" -"@abp/lodash@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-1.1.1.tgz#aa6ef3a85b9827796e295f440b29f0611c508b5f" - integrity sha512-nH7bRS28Tf4hEXcpKHd1IM+MzYTqX8t3htGmsLX4UESQd52eODYOIldtX6gm3OW1O6ECwW6si/o0M2pTEpQqvg== +"@abp/lodash@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/lodash/-/lodash-2.0.1.tgz#2f8932eddcc54d569ff37525d5da5219c68247c4" + integrity sha512-YsnQwXDH1EAz/fUs42E5TxclMaHN00oSWqGNmWrVqPMIw671sjyFf8QwQWIQujlo/7hXNYMxwmh5VGqR0TKNqQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" lodash "^4.17.15" -"@abp/luxon@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-1.1.1.tgz#ec389270d78bb271d52163ab3773f549aa91751e" - integrity sha512-WNu8JRSb5FDXfcDwjMYyeYeUN48uuDc/I2cdo3xd1rcY+lbmbzxoG9IYOlE8cRHdgX3z82qsZXFs2lcAy0Le2g== +"@abp/luxon@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/luxon/-/luxon-2.0.1.tgz#6d0780254699171a509ab6bd5b1dd1a6ebc96468" + integrity sha512-tVdGgfH/ZvKAUYDiVB9x7WnyrXtUQGl7grvdFnXU8fzH0X8HNsQ4cSswlfMNQhiew8es93UqsjCx9VU8wZT08g== dependencies: luxon "^1.21.3" -"@abp/malihu-custom-scrollbar-plugin@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-1.1.1.tgz#73f8423c29d646dc7f0f270d1d7ef05947333e2a" - integrity sha512-n4b4QK/L1Czdx0oOpUR/bWjK9VENexfUSV/aMjwzHhDmEFABAmEfhIpudCYDwewGswrd7C9agmBvakv2rwPQeA== +"@abp/malihu-custom-scrollbar-plugin@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/malihu-custom-scrollbar-plugin/-/malihu-custom-scrollbar-plugin-2.0.1.tgz#7099199447db1d49eebd12519bbecba80a49c243" + integrity sha512-Ljqt/poELw9xGr+fh29Ui/cA1zFLcOTZzy6/OyGUWW+BaMGjY8CY5k47ZlI0Vo3MGZpHu0AECKF95/P0RqBd9w== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" malihu-custom-scrollbar-plugin "^3.1.5" -"@abp/select2@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-1.1.1.tgz#777967821cfcc4bd1c9fc895e913427fbb330abe" - integrity sha512-t0qcJhD+uo2+XWr4nmMQLAx7MRGQUBdZ81YmGty045ReoSaEKQf4haLkzBcMzpBRusiyMQO/PbxjtwMw/xJQTQ== +"@abp/select2@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/select2/-/select2-2.0.1.tgz#f274a3fc51e79fd556012844b54bbbfa0d7fedbf" + integrity sha512-RertY05XH+UWp+zipVt0BKGW7Rm3Yn5EZOKKTwlFJ0ciUfPRxkVl70I4xSEgm3Naq83WEH2MmwyOx4yntKZoaQ== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" select2 "^4.0.12" -"@abp/sweetalert@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-1.1.1.tgz#e055ea46eb4e3d53e623ee0aada9b2d16fea5610" - integrity sha512-V6K/qg7J/bdFmom2kaXYeiLvcmLHFl+MacPX4yYAK2biZdb2pWOkUdmcAzZdOT+UruKfLRhvraVC2uXDySi9NA== +"@abp/sweetalert@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/sweetalert/-/sweetalert-2.0.1.tgz#8198f43855392d0c07eeb0faac0d68ed5bbdf6b2" + integrity sha512-ZfbQqUNc1PuzchZzCnmhPMuy2mXAvtVEi3CZiLLAy2DHq+jf3Q3jUG9X6hZiqGuyl+Aq5htTX3HLfimca+gVxg== dependencies: - "@abp/core" "^1.1.1" + "@abp/core" "^2.0.1" sweetalert "^2.1.2" -"@abp/timeago@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-1.1.1.tgz#b626087ca35fb325e8e8a337552694fcbb8a6bf9" - integrity sha512-QYYih/4n6XhCqkRw7fBfyg58T5CHqJHyz7SAfq86RiKAJ4jVtjdSVxj3XKxz8eCb56wZGsO1xXXStI3vdLwwNw== +"@abp/timeago@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/timeago/-/timeago-2.0.1.tgz#1f82b07abc281363ada06909143ff09adcee2c13" + integrity sha512-zxvoOt2N7ikF1lZ5EBbSWuNdPsn6Z1O+JtnF5B73WEZ0JGp3wVrLN10RkvHLyDqI86dn0SKrocXvFCMEIot7vA== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" timeago "^1.6.7" -"@abp/toastr@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-1.1.1.tgz#aeb6a8ef8004fce136997f9ee3af7dd241890d50" - integrity sha512-GDewBppm+0FO6kTTy0huczoH9P5q6lFicHFAoEawAMkuWJFW/Ihv/YnEvKGDQwGftuVSWexfqBMN/RZ5YSOiGQ== +"@abp/toastr@^2.0.1": + version "2.0.1" + resolved "https://registry.yarnpkg.com/@abp/toastr/-/toastr-2.0.1.tgz#3f41d53bdb66a0b1fe400ae190958540ce2616c1" + integrity sha512-cgOlPVuOyw+4Av9ZXqaQIdKzMTJCpxdd60hSm4drYoq0m7wQADL0X5LB7rH/8i/oPvn+BAD2gRomGZEhTSgouw== dependencies: - "@abp/jquery" "^1.1.1" + "@abp/jquery" "^2.0.1" toastr "^2.1.4" "@fortawesome/fontawesome-free@^5.11.2": diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application.Contracts/MyCompanyName.MyProjectName.Application.Contracts.csproj b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application.Contracts/MyCompanyName.MyProjectName.Application.Contracts.csproj index fba582f665..c572d2bee1 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application.Contracts/MyCompanyName.MyProjectName.Application.Contracts.csproj +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application.Contracts/MyCompanyName.MyProjectName.Application.Contracts.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyCompanyName.MyProjectName.Application.csproj b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyCompanyName.MyProjectName.Application.csproj index 04cbe3d9c1..c24b0db2a5 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyCompanyName.MyProjectName.Application.csproj +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyCompanyName.MyProjectName.Application.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyProjectNameAppService.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyProjectNameAppService.cs index 31bfbeb0de..71bb06e43f 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyProjectNameAppService.cs +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyProjectNameAppService.cs @@ -8,6 +8,7 @@ namespace MyCompanyName.MyProjectName protected MyProjectNameAppService() { LocalizationResource = typeof(MyProjectNameResource); + ObjectMapperContext = typeof(MyProjectNameApplicationModule); } } } diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyProjectNameApplicationModule.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyProjectNameApplicationModule.cs index bb0e72e856..457c1bc51b 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyProjectNameApplicationModule.cs +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Application/MyProjectNameApplicationModule.cs @@ -1,4 +1,5 @@ -using Volo.Abp.AutoMapper; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.AutoMapper; using Volo.Abp.Modularity; using Volo.Abp.Application; @@ -14,6 +15,7 @@ namespace MyCompanyName.MyProjectName { public override void ConfigureServices(ServiceConfigurationContext context) { + context.Services.AddAutoMapperObjectMapper(); Configure(options => { options.AddMaps(validate: true); diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/Localization/MyProjectName/en.json b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/Localization/MyProjectName/en.json index 92e4e9582b..171d9a1220 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/Localization/MyProjectName/en.json +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/Localization/MyProjectName/en.json @@ -1,6 +1,6 @@ { "culture": "en", "texts": { - + "ManageYourProfile": "Manage your profile" } } \ No newline at end of file diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/Localization/MyProjectName/tr.json b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/Localization/MyProjectName/tr.json new file mode 100644 index 0000000000..2b48193353 --- /dev/null +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/Localization/MyProjectName/tr.json @@ -0,0 +1,6 @@ +{ + "culture": "tr", + "texts": { + "ManageYourProfile": "Profil ynetimi" + } +} \ No newline at end of file diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyCompanyName.MyProjectName.Domain.Shared.csproj b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyCompanyName.MyProjectName.Domain.Shared.csproj index 6afc84fe77..3483fb41cd 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyCompanyName.MyProjectName.Domain.Shared.csproj +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyCompanyName.MyProjectName.Domain.Shared.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain/MyCompanyName.MyProjectName.Domain.csproj b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain/MyCompanyName.MyProjectName.Domain.csproj index 26ff6449ea..2902edbe3d 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain/MyCompanyName.MyProjectName.Domain.csproj +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Domain/MyCompanyName.MyProjectName.Domain.csproj @@ -1,4 +1,4 @@ - + @@ -12,4 +12,4 @@ - \ No newline at end of file + diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/MyCompanyName.MyProjectName.EntityFrameworkCore.csproj b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/MyCompanyName.MyProjectName.EntityFrameworkCore.csproj index 6060761768..101992f75e 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/MyCompanyName.MyProjectName.EntityFrameworkCore.csproj +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/MyCompanyName.MyProjectName.EntityFrameworkCore.csproj @@ -1,9 +1,9 @@ - + - netstandard2.1 + netstandard2.0 MyCompanyName.MyProjectName diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/MyCompanyName.MyProjectName.HttpApi.Client.csproj b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/MyCompanyName.MyProjectName.HttpApi.Client.csproj index de13c7ca19..1466849524 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/MyCompanyName.MyProjectName.HttpApi.Client.csproj +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/MyCompanyName.MyProjectName.HttpApi.Client.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi/MyCompanyName.MyProjectName.HttpApi.csproj b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi/MyCompanyName.MyProjectName.HttpApi.csproj index ba4e986b5c..df14ec39e9 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi/MyCompanyName.MyProjectName.HttpApi.csproj +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi/MyCompanyName.MyProjectName.HttpApi.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MyCompanyName.MyProjectName.MongoDB.csproj b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MyCompanyName.MyProjectName.MongoDB.csproj index 05e4a798d6..0d2c58c6a4 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MyCompanyName.MyProjectName.MongoDB.csproj +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.MongoDB/MyCompanyName.MyProjectName.MongoDB.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj index bb17b03a01..41e6fc059d 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyCompanyName.MyProjectName.Web.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs index 213161e296..8e378a6bc2 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/MyProjectNameWebModule.cs @@ -42,6 +42,7 @@ namespace MyCompanyName.MyProjectName.Web options.FileSets.AddEmbedded("MyCompanyName.MyProjectName.Web"); }); + context.Services.AddAutoMapperObjectMapper(); Configure(options => { options.AddMaps(validate: true); diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/Pages/MyProjectName/Index.cshtml.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/Pages/MyProjectName/Index.cshtml.cs index a9c43a1c88..bb6a7a4da8 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/Pages/MyProjectName/Index.cshtml.cs +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/Pages/MyProjectName/Index.cshtml.cs @@ -1,13 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.RazorPages; - namespace MyCompanyName.MyProjectName.Web.Pages.MyProjectName { - public class IndexModel : PageModel + public class IndexModel : MyProjectNamePageModel { public void OnGet() { diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/Pages/MyProjectNamePageModel.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/Pages/MyProjectNamePageModel.cs index d0b9c04a45..e1470049ac 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/Pages/MyProjectNamePageModel.cs +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/Pages/MyProjectNamePageModel.cs @@ -10,6 +10,7 @@ namespace MyCompanyName.MyProjectName.Web.Pages protected MyProjectNamePageModel() { LocalizationResourceType = typeof(MyProjectNameResource); + ObjectMapperContext = typeof(MyProjectNameWebModule); } } } \ No newline at end of file diff --git a/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.Application.Tests/MyCompanyName.MyProjectName.Application.Tests.csproj b/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.Application.Tests/MyCompanyName.MyProjectName.Application.Tests.csproj index 3aab1f8ff9..d3561b3d90 100644 --- a/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.Application.Tests/MyCompanyName.MyProjectName.Application.Tests.csproj +++ b/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.Application.Tests/MyCompanyName.MyProjectName.Application.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.Domain.Tests/MyCompanyName.MyProjectName.Domain.Tests.csproj b/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.Domain.Tests/MyCompanyName.MyProjectName.Domain.Tests.csproj index fec1bbe88b..968f46f080 100644 --- a/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.Domain.Tests/MyCompanyName.MyProjectName.Domain.Tests.csproj +++ b/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.Domain.Tests/MyCompanyName.MyProjectName.Domain.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.EntityFrameworkCore.Tests/MyCompanyName.MyProjectName.EntityFrameworkCore.Tests.csproj b/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.EntityFrameworkCore.Tests/MyCompanyName.MyProjectName.EntityFrameworkCore.Tests.csproj index e45d914ca5..4448a56b41 100644 --- a/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.EntityFrameworkCore.Tests/MyCompanyName.MyProjectName.EntityFrameworkCore.Tests.csproj +++ b/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.EntityFrameworkCore.Tests/MyCompanyName.MyProjectName.EntityFrameworkCore.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs b/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs new file mode 100644 index 0000000000..1ea99ce263 --- /dev/null +++ b/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/ConsoleTestAppHostedService.cs @@ -0,0 +1,26 @@ +using Microsoft.Extensions.Hosting; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; + +namespace MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp +{ + public class ConsoleTestAppHostedService : IHostedService + { + public async Task StartAsync(CancellationToken cancellationToken) + { + using (var application = AbpApplicationFactory.Create()) + { + application.Initialize(); + + var demo = application.ServiceProvider.GetRequiredService(); + await demo.RunAsync(); + + application.Shutdown(); + } + } + + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; + } +} diff --git a/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp.csproj b/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp.csproj index 98be0699f3..35f7e7344c 100644 --- a/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp.csproj +++ b/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp.csproj @@ -1,4 +1,4 @@ - + Exe diff --git a/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/Program.cs b/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/Program.cs index 23192c4e92..1e24d8a349 100644 --- a/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/Program.cs +++ b/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp/Program.cs @@ -1,24 +1,21 @@ -using System; +using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; -using Volo.Abp; -using Volo.Abp.Threading; +using Microsoft.Extensions.Hosting; -namespace MyCompanyName.MyProjectName +namespace MyCompanyName.MyProjectName.HttpApi.Client.ConsoleTestApp { class Program { - static void Main(string[] args) + static async Task Main(string[] args) { - using (var application = AbpApplicationFactory.Create()) - { - application.Initialize(); - - var demo = application.ServiceProvider.GetRequiredService(); - AsyncHelper.RunSync(() => demo.RunAsync()); - - Console.WriteLine("Press ENTER to stop application..."); - Console.ReadLine(); - } + await CreateHostBuilder(args).RunConsoleAsync(); } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .ConfigureServices((hostContext, services) => + { + services.AddHostedService(); + }); } } diff --git a/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.MongoDB.Tests/MyCompanyName.MyProjectName.MongoDB.Tests.csproj b/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.MongoDB.Tests/MyCompanyName.MyProjectName.MongoDB.Tests.csproj index 6ad7da064f..e2e63120e2 100644 --- a/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.MongoDB.Tests/MyCompanyName.MyProjectName.MongoDB.Tests.csproj +++ b/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.MongoDB.Tests/MyCompanyName.MyProjectName.MongoDB.Tests.csproj @@ -1,4 +1,4 @@ - + diff --git a/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.TestBase/MyCompanyName.MyProjectName.TestBase.csproj b/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.TestBase/MyCompanyName.MyProjectName.TestBase.csproj index 0345987266..33361c5f89 100644 --- a/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.TestBase/MyCompanyName.MyProjectName.TestBase.csproj +++ b/templates/module/aspnet-core/test/MyCompanyName.MyProjectName.TestBase/MyCompanyName.MyProjectName.TestBase.csproj @@ -1,4 +1,4 @@ - + diff --git a/test-all.ps1 b/test-all.ps1 deleted file mode 100644 index 10ed0a9583..0000000000 --- a/test-all.ps1 +++ /dev/null @@ -1,39 +0,0 @@ -# COMMON PATHS - -$rootFolder = (Get-Item -Path "./" -Verbose).FullName - -# List of solutions - -$solutionPaths = ( - "framework", - "modules/users", - "modules/permission-management", - "modules/setting-management", - "modules/feature-management", - "modules/identity", - "modules/identityserver", - "modules/tenant-management", - "modules/account", - "modules/docs", - "modules/blogging", - "modules/audit-logging", - "modules/background-jobs", - "modules/client-simulation", - "templates/module/aspnet-core", - "templates/app/aspnet-core" -) - -# Test all solutions - -foreach ($solutionPath in $solutionPaths) { - $solutionAbsPath = (Join-Path $rootFolder $solutionPath) - Set-Location $solutionAbsPath - dotnet test --no-build --no-restore - if (-Not $?) { - Write-Host ("Test failed for the solution: " + $solutionPath) - Set-Location $rootFolder - exit $LASTEXITCODE - } -} - -Set-Location $rootFolder