diff --git a/.gitignore b/.gitignore index 407241c7fc..3c5c4f89da 100644 --- a/.gitignore +++ b/.gitignore @@ -269,6 +269,7 @@ modules/blog/app/Volo.BlogTestApp/Logs/*.* modules/blogging/app/Volo.BloggingTestApp/Logs/*.* modules/blogging/app/Volo.BloggingTestApp/wwwroot/files/*.* modules/docs/app/VoloDocs.Web/Logs/*.* +modules/setting-management/app/Volo.Abp.SettingManagement.DemoApp/Logs/*.* templates/module/app/MyCompanyName.MyProjectName.DemoApp/Logs/*.* templates/mvc/src/MyCompanyName.MyProjectName.Web/Logs/*.* diff --git a/README.md b/README.md index a73e9ef3ed..a56f0c98b8 100644 --- a/README.md +++ b/README.md @@ -105,3 +105,7 @@ ABP is a community-driven open source project. See [the contribution guide](http ## Support the ABP Framework Love ABP Framework? **Please give a star** to this repository :star: + +## ABP Commercial + +See also [ABP Commercial](https://commercial.abp.io/) if you are looking for pre-built application modules, professional themes, code generation tooling and premium support for the ABP Framework. diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json index cf6b6a124c..51d818aad7 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json @@ -35,6 +35,7 @@ "NameFilter": "Name", "CreationTime": "Creation time", "IsPro": "Is pro", + "IsFreeToActiveLicenseOwners": "Free to license owners", "ShowOnModuleList": "Show on module list", "EfCoreConfigureMethodName": "Configure method name", "IsProFilter": "Is pro", @@ -90,6 +91,7 @@ "UserNotFound": "User not found", "{0}WillBeRemovedFromDevelopers": "{0} Will be removed from developers, do you confirm?", "{0}WillBeRemovedFromOwners": "{0} Will be removed from owners, do you confirm?", + "{0}WillBeRemovedFromMembers": "{0} Will be removed from members, do you confirm?", "Computers": "Computers", "UniqueComputerId": "Unique computer id", "LastSeenDate": "Last seen date", @@ -199,9 +201,22 @@ "Optional": "Optional", "CreateArticleLanguageInfo": "The language in which the post is written", "Enum:ContentSource:2": "Video Post", + "VideoPreview": "Video Preview", + "VideoPreviewErrorMessage": "Given video url couldn't retrieve from Youtube. This can be caused by either video is private or the given URL is not available.", "DeleteCoverImage": "Delete Cover Image", "DeleteCoverImageConfirmationMessage": "Are you sure you want to delete the cover image for \"{0}\"?", - "DeleteCoverImageSuccessMessage": "Cover image successfully deleted" - + "DeleteCoverImageSuccessMessage": "Cover image successfully deleted", + "PaymentsOf": "Payments of", + "ShowPaymentsOfOrganization": "Show payments", + "Date": "Date", + "Products": "Products", + "TotalAmount": "Total amount", + "Currency": "Currency", + "Gateway": "Gateway", + "State": "State", + "FailReason": "Fail reason", + "ReIndexAllPosts": "ReIndex All Posts", + "ReIndexAllPostsConfirmationMessage": "Are you sure to reindex all posts?", + "SuccessfullyReIndexAllPosts": "Successfully reindex for all posts" } } diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/tr.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/tr.json index 1884b0025f..34ee392140 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/tr.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/tr.json @@ -163,6 +163,9 @@ "Enum:ContentSource:2": "Video İçerik", "DeleteCoverImage": "Kapak Fotoğrafını Sil", "DeleteCoverImageConfirmationMessage": "Kapak fotoğrafını \"{0}\" isimli makale için silmek istediğinize emin misiniz?", - "DeleteCoverImageSuccessMessage": "Kapak fotoğrafı başarılı bir şekilde silinmiştir" + "DeleteCoverImageSuccessMessage": "Kapak fotoğrafı başarılı bir şekilde silinmiştir", + "ReIndexAllPosts": "Yeniden indeksle", + "ReIndexAllPostsConfirmationMessage": "Tüm gönderileri yeniden indeksleyeceğinizden emin misiniz?", + "SuccessfullyReIndexAllPosts": "Tüm gönderiler başarıyla yeniden indekslendi" } } \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/en.json index 71dc425dc6..eedfd4bccd 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/en.json @@ -30,6 +30,8 @@ "Permission:License": "License", "Permission:UserInfo": "Usere info", "SeeDocuments": "See Documents", - "Samples": "Samples" + "Samples": "Samples", + "Framework": "Framework", + "Support": "Support" } } \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/zh-Hans.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/zh-Hans.json index f061408c98..01550612d4 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/zh-Hans.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Base/Localization/Resources/zh-Hans.json @@ -30,6 +30,8 @@ "Permission:License": "许可", "Permission:UserInfo": "用户信息", "SeeDocuments": "查看文档", - "Samples": "示例" + "Samples": "示例", + "Framework": "框架", + "Support": "支持" } } \ 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 c6eb1ad645..b03d57cee0 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/en.json @@ -34,6 +34,257 @@ "JoinOurMarketingNewsletter": "Join our marketing newsletter", "WouldLikeToReceiveMarketingMaterials": "I would like to receive marketing materials like product deals & special offers.", "StartUsingYourLicenseNow": "Start using your license now!", - "WelcomePage": "Welcome Page" - } + "WelcomePage": "Welcome Page", + "UnsubscriptionExpireEmail": "Unsubscribe from license expire date reminder emails", + "UnsubscribeLicenseExpireEmailReminderMessage": "This email subscription only contains reminding your license expiration date.", + "UnsubscribeFromLicenseExpireEmails": "If you don't want to receive the emails about your license expiration date, you can unsubscribe at any time you want.", + "Unsubscribe": "Unsubscribe", + "NotOrganizationMember": "You are not member of any organization.", + "UnsubscribeLicenseExpirationEmailSuccessTitle": "Successfully unsubscribed", + "UnsubscribeLicenseExpirationEmailSuccessMessage": "You will not receive license expiration date reminder emails anymore.", + "IndexPageHeroSection": "A complete web development platformbuilt-on framework", + "AbpCommercialShortDescription": "ABP Commercial provides pre-built application modules, rapid application development tooling, professional UI themes, premium support and more.", + "LiveDemo": "Live Demo", + "GetLicence" :"Get a Licence", + "Application": "Application", + "StartupTemplates": "Startup Templates", + "Startup": "Startup", + "Templates": "Templates", + "Developer": "Developer", + "Tools": "Tools", + "Premium": "Premium", + "PremiumSupport": "Premium Support", + "PremiumForumSupport": "Premium Forum Support", + "UI": "UI", + "Themes": "Themes", + "JoinOurNewsletter": "Join Our Newsletter", + "Send": "Send", + "Learn": "Learn", + "AdditionalServices": "Additional Services", + "WhatIsABPFramework": "WHAT IS THE ABP FRAMEWORK?", + "OpenSourceBaseFramework": "Open Source Base Framework", + "ABPFrameworkExplanation": "

ABP Commercial is based on the ABP Framework, an open source and community driven web application framework for ASP.NET Core.

ABP Framework provides an excellent infrastructure to write maintainable, extensible and testable code with best practices.

Built on and integrated to popular tools you already know. Low learning curve, easy adaptation, comfortable development.

", + "Modular": "Modular", + "MicroserviceCompatible": "Microservice compatible", + "DomainDrivenDesignInfrastructure": "Domain Driven Design Infrastructure", + "MultiTenancy": "Multi-Tenancy", + "DistributedMessaging": "Distributed Messaging", + "DynamicProxying": "Dynamic Proxying", + "BackgroundJobs": "Background Jobs", + "AuditLogging": "Audit Logging", + "BLOBStoring": "BLOB Storing", + "BundlingMinification": "Bundling & Minification", + "AdvancedLocalization": "Advanced Localization", + "ManyMore": "Many more", + "ExploreTheABPFramework": "Explore the ABP Framework", + "WhyUseTheABPCommercial": "Why Use The ABP Commercial?", + "WhyUseTheABPCommercialExplanation": "

Building enterprise-grade web applications can be complex and time-consuming.

ABP Commercial offers the perfect base infrastructure necessary for all modern enterprise-grade ASP.NET Core based solutions. Right from the design to deployment, the entire development cycle is empowered by ABP's built-in features & modules.

", + "StartupTemplatesShortDescription": "Startup templates make you jump-start to your project in a few seconds.", + "UIFrameworksOptions": "UI frameworks options;", + "DatabaseProviderOptions": "Database provider options;", + "PreBuiltApplicationModules": "Pre-Built Application Modules", + "PreBuiltApplicationModulesShortDescription": "Most common application requirements are already developed for you as reusable modules.", + "Account": "Account", + "Blogging": "Blogging", + "Identity": "Identity", + "IdentityServer": "Identity Server", + "Saas": "Saas", + "LanguageManagement": "Language Management", + "TextTemplateManagement": "Text Template Management", + "See All Modules": "SeeAllModules", + "ABPSuite": "ABP Suite", + "AbpSuiteShortDescription": "ABP Suite is a complementary tool to the ABP Commercial.", + "AbpSuiteExplanation": "It allows you to build web pages in a matter of minutes. It's a .NET Core Global tool which can be installed from the command line. It can create a new ABP solution, generate CRUD pages from the database to the front-end.", + "Details": "Details", + "LeptonTheme": "Lepton Theme", + "ProfessionalModernUIThemes": "Professional, modern UI themes", + "LeptonThemeExplanation": "Lepton provides a gamut of Bootstrap admin themes that serve as a solid foundation for any project requiring admin dashboard.", + "DefaultTheme": "Default Theme", + "MaterialTheme": "Material Theme", + "Default2Theme": "Default 2 Theme", + "DarkTheme": "Dark Theme", + "DarkBlueTheme": "Dark Blue Theme", + "LightTheme": "Light Theme", + "ProudToWorkWith": "Proud to Work With", + "OurConsumers": "Hundreds of enterprises and developers over 50 countries worldwide rely on ABP Commercial.", + "JoinOurConsumers": "Join them and build amazing products fast.", + "AdditionalServicesExplanation": "Do you need additional or custom services? We and our partners can provide;", + "CustomProjectDevelopment": "Custom Project Development", + "CustomProjectDevelopmentExplanation": "Dedicated developers for your custom projects.", + "PortingExistingProjects": "Porting Existing Projects", + "PortingExistingProjectsExplanation": "Migrating your legacy projects to the ABP platform.", + "LiveSupport": "Live Support", + "LiveSupportExplanation": "Live remote support option when you need it.", + "Training": "Training", + "TrainingExplanation": "Dedicated training for your developers.", + "OnBoarding": "Onboarding", + "OnBoardingExplanation": "Help to setup your development, CI & CD environments.", + "PrioritizedTechnicalSupport": "Prioritized Technical Support", + "PremiumSupportExplanation": "Beside the great community support of the ABP framework, our support team answers technical questions and problems of the commercial users with high priority.", + "SeeTheSupportOptions": "See the Support Options", + "Contact": "Contact", + "TellUsWhatYouNeed": "Tell us what you need.", + "YourMessage": "Your Message", + "YourFullName": "Your full name", + "EmailField": "E-mail Address", + "YourEmailAddress": "Your e-mail address", + "HowMayWeHelpYou": "How may we help you", + "SendMessage": "Send Message", + "Success": "Success", + "WeWillReplyYou.": "Your message is sent! We will reply you in a short time.", + "GoHome": "Go Home", + "CreateLiveDemo": "Create Live Demo", + "RegisterToTheNewsletter": "Register to the newsletter to get information on happenings about ABP.IO, like new releases.", + "EnterYourEmailOrLogin": "Enter your e-mail address to create your demo or Login using your existing account.", + "ApplicationTemplate": "Application Template", + "ApplicationTemplateExplanation": "Application startup template is used to create a new web application.", + "EfCoreProvider": "Entity Framework (Supports SQL Server, MySQL, PostgreSQL, Oracle and others)", + "AlreadyIncludedInTemplateModules": "Following modules are already included and configured in this template:", + "ApplicationTemplateArchitecture": "This application template also supports tiered architecture where UI layer, API layer and the authentication service are physically separated.", + "SeeTheGuideOrGoToTheLiveDemo": "See the developer guide for technical information about this template or go to the live demo.", + "DeveloperGuide": "Developer Guide", + "ModuleTemplate": "Module Template", + "ModuleTemplateExplanation1": "You want to create a module and reuse across different applications? This startup template prepares everything to start to create a reusable application module or a microservice.", + "ModuleTemplateExplanation2": "

You can support single or multiple UI frameworks, single or multiple database providers for a single module. The startup template is configured to run and test your module in a minimal application in addition to the unit and integration test infrastructure.

See the developer guide for technical information about this template.

", + "WithAllStyleOptions": "with all style options", + "Demo": "Demo", + "SeeAllModules": "See All Modules", + "ABPCLIExplanation": "ABP CLI (Command Line Interface) is a command line tool to perform some common operations for ABP based solutions.", + "ABPSuiteEasilyCURD": "ABP Suite is a tool which allows you to easily create CRUD pages", + "WeAreHereToHelp": "We are Here to Help", + "BrowseOrAskQuestion": "You can browse our help topics or search in frequently asked questions, or you can ask us a question by using the contact form.", + "SearchQuestionPlaceholder": "Search in frequently asked questions", + "WhatIsTheABPCommercial": "What is the ABP Commercial?", + "WhatAreDifferencesThanAbpFramework": "What are the differences between the open source ABP Framework and the ABP Commercial?", + "ABPCommercialExplanation": "ABP Commercial is a set of premium modules, tools, themes and services built on top of the open source ABP framework. ABP Commercial is being developed and supported by the same team behind the ABP framework.", + "WhatAreDifferencesThanABPFrameworkExplanation": "

ABP framework is a modular, themeable, micro-service compatible application development framework for ASP.NET Core. It provides a complete architecture and a strong infrastructure to make you focusing on your own business code rather than repeating yourself for every new project. It is based on software development best practices and popular tools you already know.

ABP framework is completely free, open source and community-driven. It also provides a free theme and some pre-built modules (e.g. identity management and tenant management).

", + "VisitTheFrameworkVSCommercialDocument": "Visit the following link, for more information {1} ", + "ABPCommercialFollowingBenefits": "ABP Commercial adds the following benefits on top of the ABP framework;", + "Professional": "Professional", + "UIThemes": "UI themes", + "EnterpriseModules": "Enterprise ready, feature rich, pre-built application modules (e.g. Identity Server management, SaaS management, language management)", + "ToolingToSupport": "Tooling to support your development productivity (e.g. ABP Suite)", + "PremiumSupportLink": "Premium support", + "WhatDoIDownloadABPCommercial": "What do I download when I purchase the ABP Commercial?", + "CreateUnlimitedSolutions": "Once you purchase an ABP Commercial license, you will be able to create unlimited solutions like described in the Getting Started document.", + "ABPCommercialSolutionExplanation": "When you create a new application, you get a Visual Studio solution (a startup template) based on your preferences. The downloaded solution has commercial modules and themes already installed and configured for you. You can remove a pre-installed module or add another module if you like. All modules and themes are used a NuGet/NPM packages by default.", + "StartDevelopWithTutorials": "The downloaded solution is well architected and documented. You can start to develop your own business code based on it following the tutorials", + "TryTheCommercialDemo": "You can try the demo to see a sample application created using the ABP Commercial startup template.", + "HowManyProducts": "How many different products/solutions can I build using the ABP Commercial?", + "HowManyProductsExplanation": "There is no limit to create an ABP project. You can create as many project as you want, develop and upload them to different servers.", + "HowManyDevelopers": "How many developers can work on the ABP Commercial?", + "HowManyDevelopersExplanation": "ABP Commercial licenses are per developer. Different license types have different developer limits. However, you can add more developers to any license type whenever you need. See the prices page for license types, developer limits and additional developer costs.", + "ChangingLicenseType": "Can I change my license type in the future?", + "ChangingLicenseTypeExplanation": "You can always add new developers in your same license type. See also \"How many developers can work on the ABP Commercial?\". You can also upgrade to a higher license by paying the calculated price difference. When you upgrade to a higher license plan, you get the benefits of the new plan, but the license upgrade does not change the license expiry date.", + "LicenseExtendUpgradeDiff": "What is the difference between license extend and upgrade?", + "LicenseExtendUpgradeDiffExplanation": "Extending: By extending/renewing your license, you will continue to get premium support and get major updates for the modules and themes. Besides, you will be able to continue creating new projects. And you will still be able to use ABP Suite which speeds up your development.
Upgrading: By upgrading your license, you will promote to a higher license plan which will allow you to get additional benefits. See the license comparison table to check the differences between the license plans.On the other hand, when you upgrade, your license expiry date will not change!To extend your license end date, you need to extend your license.", + "LicenseRenewalCost": "What is the license renewal cost after 1 year?", + "LicenseRenewalCostExplanation": "You can renew (extend) your license by paying %80 of the current license price. For example; Standard ABP Team License is ${0} and renewal price of the Team License is ${1}.", + "IsSourceCodeIncluded": "Does my license include the source code of the commercial modules and themes?", + "IsSourceCodeIncludedExplanation1": "Depends on the license type you've purchased:", + "IsSourceCodeIncludedExplanation2": "Team: Your solution uses the modules and the themes as NuGet and NPM packages. It doesn't include their source code. In this way, you can easily upgrade these modules and themes whenever a new version is available. However, you can not get the source code of the modules and the themes.", + "IsSourceCodeIncludedExplanation3": "Business/Enterprise: In addition to the Team license, you are able to download the source code of any module or theme you need. You can even remove the NuGet/NPM package references for a particular module and add its source code directly to your solution to fully change it.", + "IsSourceCodeIncludedExplanation4": "

Including the source code of a module to your solution gives you the maximum freedom to customize that module. However, then it will not be possible to automatically upgrade the module when a new version is released.

None of the licenses include the ABP Suite source code, which is an external tool that generates code for you and assist to your development.

See the pricing page for other differences between the license types.

", + "ChangingDevelopers": "Can I change the registered developers of my organization in the future?", + "ChangingDevelopersExplanation": "In addition to add new developers to your license, you can also change the existing developers (you can remove a developer and add a new one to the same seat) without any additional cost.", + "WhatHappensWhenLicenseEnds": "What happens when my license period ends?", + "WhatHappensWhenLicenseEndsExplanation1": "ABP Commercial has perpetual license type.After your license expires, you can continue developing your project. And you are not obliged to renew your license. After your license expires;", + "WhatHappensWhenLicenseEndsExplanation2": "You can not create new solutions using the ABP Commercial, but you can continue to develop your existing applications forever.", + "WhatHappensWhenLicenseEndsExplanation3": "You will be able to get updates for the modules and themes within your MAJOR version. For example; if you are using v3.2.0 of a module, you can still get updates for v3.x.x (v3.3.0, v3.5.2... etc.) of that module. But you cannot get updates for the next major version (like v4.x, v5.x)", + "WhatHappensWhenLicenseEndsExplanation4": "You can not install new modules and themes added to the ABP Commercial platform after your license ends.", + "WhatHappensWhenLicenseEndsExplanation5": "You can not use the ABP Suite.", + "WhatHappensWhenLicenseEndsExplanation6": "You can not get the premium support anymore.", + "WhatHappensWhenLicenseEndsExplanation7": "You can renew your subscription if you want to continue to get these benefits. There is a 20% discount when you renew your subscription.", + "WhenShouldIRenewMyLicense": "When should I renew my license?", + "WhenShouldIRenewMyLicenseExplanation1": "If you renew your license within 1 month after your license expires, %20 discount will be applied to total license price.", + "WhenShouldIRenewMyLicenseExplanation2": "If you renew your license after 1 month from your license expire date, the renew price will be same as license purchase price and there will be no discount for your renewal.", + "TrialPlan": "Do you have a trial plan?", + "TrialPlanExplanation": "For now, ABP Commercial doesn't have a trial plan. For the Team licenses we provide 30 days money back guarantee. You can just request a refund in the first 30 days. For the Business and Enterprise licenses, we provide 60% refund in 30 days. This is because Business and Enterprise licenses include the full source code of all the modules and the themes.", + "DoYouAcceptBankWireTransfer": "Do you accept bank wire transfer?", + "DoYouAcceptBankWireTransferExplanation": "Yes, we accept bank wire transfer.
After sending the license amount via bank wire transfer, send us your receipt and the requested license type via e-mail.
Our international bank account information:", + "HowToUpgrade": "How to upgrade existing applications when a new version is available?", + "HowToUpgradeExplanation1": "When you create a new application using ABP Commercial, all the modules and the theme are used as NuGet and NPM packages. So, you can easily upgrade the packages when a new version is available.", + "HowToUpgradeExplanation2": "In addition to the standard NuGet/NPM upgrades, ABP CLI provides an update command that automatically finds and upgrades all ABP related packages in your solution.", + "DatabaseSupport": "Which database systems are supported?", + "DatabaseSupportExplanation": "ABP Framework itself is database agnostic and can work with any database provider by its nature. See the data access document for a list of currently implemented providers.", + "UISupport": "Which UI frameworks are supported?", + "Supported": "Supported", + "UISupportExplanation": "ABP Framework itself is UI framework agnostic and can work with any UI framework. However, startup templates, module UIs and themes were not implemented for all UI frameworks. See the getting started document for the up-to-date list of UI options.", + "MicroserviceSupport": "Does it support the micro-service architecture?", + "MicroserviceSupportExplanation1": "One of the major goals of the ABP framework is to provide a convenient infrastructure to create micro-service solutions. See the micro-service architecture document to understand how it helps to create micro-service systems.", + "MicroserviceSupportExplanation2": "All the ABP Commercial modules are designed to support micro-service deployment scenarios (with its own API and database) by following the module development best practices document.", + "MicroserviceSupportExplanation3": "We provide a sample micro-service demo solutionthat demonstrates a micro-service architecture implementation to help you to create your own solution.", + "MicroserviceSupportExplanation4": "So, the short answer is \"yes, it supports micro-service architecture\".", + "MicroserviceSupportExplanation5": "However, a micro-service system is a solution and every solution will have different requirements, network topology, communication scenarios, authentication possibilities, database separation/sharing decisions, runtime configurations, 3rd party system integrations and many more.", + "MicroserviceSupportExplanation6": "The ABP Framework and the ABP Commercial provides infrastructure for micro-service scenarios, micro-service compatible modules, samples and documentation to help you to build your own solution. But don't expect to directly download your dream solution pre-built for you. You will need to understand it and bring some parts together based on your requirements.", + "WhereCanIDownloadSourceCode": "Where can I download source-code?", + "WhereCanIDownloadSourceCodeExplanation": "You can download the source code of all ABP modules, Angular packages and themes via ABP Suite or ABP CLI. See How to download source-code?", + "ComputerLimitation": "How many computers can a developer login when developing ABP?", + "ComputerLimitationExplanation": "We specifically permit {0} computers per individual/licensed developer. Whenever there is a need for a developer to develop ABP Commercial products on a third machine, an e-mail should be sent to license@abp.io explaining the situation and we will then make the appropriate allocation in our system.", + "RefundPolicy": "Do you have a refund policy?", + "RefundPolicyExplanation": "You can request a refund within 30 days of your license purchase. The Business and Enterprise license types have source-code download option, therefore refunds are not available for the Business and Enterprise (and any licenses that include a right to receive source-code). In addition, no refunds are made for renewals and second license purchases.", + "HowCanIRefundVat": "How can I refund VAT?", + "HowCanIRefundVatExplanation1": "If you made the payment using 2Checkout, you can refund VAT via your 2Checkout account:", + "HowCanIRefundVatExplanation2": "Log in into your 2Checkout account", + "HowCanIRefundVatExplanation3": "Find the appropriate order and press \"Refund Belated VAT\" (enter your VAT ID)", + "HowCanIGetMyInvoice": "How can I get my invoice?", + "HowCanIGetMyInvoiceExplanation": "There are 2 payment gateways for purchasing a license: PayU and 2Checkout. If you purchase your license through 2Checkout gateway, it sends the PDF invoice to your email address, see 2Checkout invoicing. If you purchase through the PayU gateway or via bank wire transfer, we will prepare and send your invoice. You can request your invoice from the organization management page.", + "Forum": "Forum", + "SupportExplanation": "ABP Commercial licenses provides a premium forum support by a team consists of the ABP Framework experts.", + "PrivateTicket": "Private Ticket", + "PrivateTicketExplanation": "Enterprise License also includes a private support with e-mail and ticket system.", + "AbpSuiteExplanation1": "ABP Suite allows you to build web pages in a matter of minutes. It's a .NET Core Global tool that can be installed from the command line.", + "AbpSuiteExplanation2": "It can create a new ABP solution, generate CRUD pages from the database to the front-end. For technical overview see the document", + "FastEasy": "Fast & Easy", + "AbpSuiteExplanation3": "ABP Suite allows you to easily create CRUD pages. You just need to define your entity and its properties, let the rest to ABP Suite for you! ABP Suite generates all the necessary code for your CRUD page in a few seconds. It supports Angular, MVC and Blazor user interfaces.", + "RichOptions": "Rich Options", + "AbpSuiteExplanation4": "ABP Suite supports multiple UI options like Razor Pages and Angular.It also supports multiple databases like MongoDB and all databases supported by EntityFramework Core (MS SQL Server, Oracle, MySql, PostgreSQL and more).", + "AbpSuiteExplanation5": "Good thing is that, you don't have to worry about those options. ABP Suite understands your project type and generates the code for your project and places the generated code in correct place in your project.", + "SourceCode": "Source Code", + "AbpSuiteExplanation6": "ABP Suite generates the source code for you! It doesn't generate magic files to generate the web page. ABP Suite generates the source code for Entity, Repository, Application Service, Code First Migration, JavaScript/TypeScript and CSHTML/HTML and necessary Interfaces as well. ABP Suite also generates the code according to Best Practices of software development, so you don't have to worry about generated code's quality.", + "AbpSuiteExplanation7": "Since you have the source code of building blocks of the generated CRUD page in correct application layers, you can easily modify the source code and inject your custom/bussiness logic to the generated code.", + "CrossPlatform": "Cross Platform", + "AbpSuiteExplanation8": "ABP Suite is built with .NET Core and it is cross platform. It runs as a web application on your local computer. You can run it on Windows, Mac and Linux", + "OtherFeatures": "Other Features", + "OtherFeatures1": "Updates NuGet and NPM packages on your solution easily.", + "OtherFeatures2": "Regenerates already generated pages from scratch.", + "OtherFeatures3": "Creates new solutions", + "ThanksForCreatingProject": "Thanks for Creating Your Project!", + "HotToRunSolution": "How to run your solution?", + "HotToRunSolutionExplanation": "See getting started document to learn how to configure and run your solution.", + "GettingStarted": "Getting Started", + "WebAppDevTutorial": "Web App Dev Tutorial", + "WebAppDevTutorialExplanation": "See web application development tutorial document for a step by step development sample.", + "Document": "Document", + "UsingABPSuiteToCURD": "Using ABP Suite for CRUD Page Generation & Tooling", + "SeeABPSuiteDocument": "See ABP Suite document to learn the usage of ABP Suite.", + "AskQuestionsOnSupport": "You can ask questions on ABP Commercial Support.", + "Documentation": "Documentation", + "SeeModulesDocument": "See modules document for a list of all commercial (pro) modules and their documents.", + "Pricing": "Pricing", + "PricingExplanation": "Choose the features and functionality your business needs today. Easily upgrade as your business grows.", + "Team": "Team", + "Business": "Business", + "Enterprise": "Enterprise", + "Custom": "Custom", + "IncludedDeveloperLicenses": "Included developer licenses", + "CustomLicenceOrAdditionalServices": "Need custom licence or additional services?", + "CustomOrVolumeLicense": "Custom or volume license", + "LiveTrainingSupport": "Live training & support", + "AndMore": "and more", + "AdditionalDeveloperLicense": "Additional developer license", + "ProjectCount": "Project count", + "AllProModules": "All pro modules", + "AllProThemes": "All pro themes", + "AllProStartupTemplates": "All pro startup templates", + "SourceCodeOfAllModules": "Source code of all modules", + "SourceCodeOfAllThemes": "Source code of all themes", + "PerpetualLicense": "Perpetual license", + "UnlimitedServerDeployment": "Unlimited server deployment", + "YearUpgrade": "1 year upgrade", + "YearPremiumForumSupport": "1 year premium forum support", + "ForumSupportIncidentCountYear": "Forum support incident count/year", + "PrivateTicketEmailSupport": "Private ticket & email support", + "BuyNow": "Buy Now" + } } \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/zh-Hans.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/zh-Hans.json index 82c23450a0..0e1e61dba8 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/zh-Hans.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Commercial/Localization/Resources/zh-Hans.json @@ -16,7 +16,7 @@ "Name": "名称", "EmailAddress": "电子邮件地址", "Developers": "开发者", - "LicenseType": "许可证类型", + "LicenseType": "许可类型", "Manage": "管理", "StartDate": "开始日期", "EndDate": "结束日期", @@ -33,7 +33,258 @@ "EmailNotValid": "请输入有效的电子邮件地址", "JoinOurMarketingNewsletter": "加入我们的营销简讯", "WouldLikeToReceiveMarketingMaterials": "我想收到市场营销资料,例如产品交易和特别优惠.", - "StartUsingYourLicenseNow": "立即开始使用你的许可证", - "WelcomePage": "欢迎页面" + "StartUsingYourLicenseNow": "立即开始使用你的许可", + "WelcomePage": "欢迎页面", + "UnsubscriptionExpireEmail": "退订许可到期提醒邮件", + "UnsubscribeLicenseExpireEmailReminderMessage": "此电子邮件订阅仅提醒你许可的到期日期.", + "UnsubscribeFromLicenseExpireEmails": "如果你不想收到关于许可到期邮件,你可以在任何时间取消订阅.", + "Unsubscribe": "取消订阅", + "NotOrganizationMember": "你不是任何组织的成员.", + "UnsubscribeLicenseExpirationEmailSuccessTitle": "退订成功", + "UnsubscribeLicenseExpirationEmailSuccessMessage": "你不会再收到任何许可到期提醒邮件.", + "IndexPageHeroSection": "一个完整的web开发平台基于 框架", + "AbpCommercialShortDescription": "ABP商业版提供了预构建的应用程序模块, 快速的应用程序开发工具, 专业的UI主题, 高级支持等.", + "LiveDemo": "在线演示", + "GetLicence" :"获得许可", + "Application": "应用程序", + "StartupTemplates": "启动模板", + "Startup": "启动", + "Templates": "模板", + "Developer": "开发人员", + "Tools": "工具", + "Premium": "高级", + "PremiumSupport": "高级支持", + "PremiumForumSupport": "高级论坛支持", + "UI": "UI", + "Themes": "主题", + "JoinOurNewsletter": "加入我们的时事通讯", + "Send": "发送", + "Learn": "学习", + "AdditionalServices": "额外的服务", + "WhatIsABPFramework": "什么是ABP框架?", + "OpenSourceBaseFramework": "开源的框架", + "ABPFrameworkExplanation": "

ABP商业版基于ABP框架, 这是一个开源和社区驱动的ASP.NET Core web应用程序开发框架.

ABP框架提供了出色的基础设施, 使用最佳实践编写可维护,可扩展,可测试的代码.

基于你已经知道的流行工具. 低学习曲线,容易适应,舒适的开发体检.

", + "Modular": "模块化", + "MicroserviceCompatible": "微服务兼容", + "DomainDrivenDesignInfrastructure": "领域驱动设计基础设施", + "MultiTenancy": "多租户", + "DistributedMessaging": "分布式消息", + "DynamicProxying": "动态代理", + "BackgroundJobs": "后台作业", + "AuditLogging": "审计日志", + "BLOBStoring": "BLOB存储", + "BundlingMinification": "捆绑 & 压缩", + "AdvancedLocalization": "高级本地化", + "ManyMore": "以及更多", + "ExploreTheABPFramework": "探索ABP框架", + "WhyUseTheABPCommercial": "为什么使用ABP商业版?", + "WhyUseTheABPCommercialExplanation": "

构建企业级的web应用程序可能复杂和耗时.

ABP商业版提供所有现代企业级基于ASP.NET Core的解决方案所需要的基础设施. 从设计到部署,整个开发生命周期都由ABP的内置功能和模块提供支持.

", + "StartupTemplatesShortDescription": "启动模板使你在几秒内快速启动项目.", + "UIFrameworksOptions": "UI框架选项;", + "DatabaseProviderOptions": "数据库提供程序选项;", + "PreBuiltApplicationModules": "预构建的应用程序模块", + "PreBuiltApplicationModulesShortDescription": "大多数常见的应用程序需求已经做为可重用的模块为你开发了.", + "Account": "账户", + "Blogging": "博客", + "Identity": "Identity", + "IdentityServer": "Identity Server", + "Saas": "Saas", + "LanguageManagement": "语言管理", + "TextTemplateManagement": "文本模板管理", + "See All Modules": "查看所有的模块", + "ABPSuite": "ABP Suite", + "AbpSuiteShortDescription": "ABP Suite是ABP商业版的辅助工具.", + "AbpSuiteExplanation": "它让你在几分钟内构建web页面. 它是一个.Net Core全局工具,可以使用命令行安装. 它可以创建一个新的ABP解决方案,从数据库生成前端CURD页面.", + "Details": "详情", + "LeptonTheme": "Lepton主题", + "ProfessionalModernUIThemes": "专业, 现代化的UI主题", + "LeptonThemeExplanation": "Lepton提供了一系列的Bootstrap管理主题,为任何需要管理仪表盘的项目提供了坚实的基础.", + "DefaultTheme": "默认主题", + "MaterialTheme": "Material主题", + "Default2Theme": "默认主题2", + "DarkTheme": "深色主题", + "DarkBlueTheme": "深蓝主题", + "LightTheme": "浅色主题", + "ProudToWorkWith": "荣幸与你合作", + "OurConsumers": "全球50多个国家的数百家企业和开发商使用ABP商业版.", + "JoinOurConsumers": "加它他们并快速构建令人惊叹的产品.", + "AdditionalServicesExplanation": "你是否需要额外或自定义的服务? 我们和我们的合作伙伴可以提供;", + "CustomProjectDevelopment": "自定义项目开发", + "CustomProjectDevelopmentExplanation": "专为你的自定义的开发人员.", + "PortingExistingProjects": "移植现有项目", + "PortingExistingProjectsExplanation": "将你的迁移传统项目迁移到ABP平台.", + "LiveSupport": "实时支持", + "LiveSupportExplanation": "在你需要时,可以实时提供远程支持选项.", + "Training": "培训", + "TrainingExplanation": "为你的开发人员提供专门培训.", + "OnBoarding": "管理", + "OnBoardingExplanation": "帮助设置你的开发,CI和CD环境.", + "PrioritizedTechnicalSupport": "优先的技术支持", + "PremiumSupportExplanation": "除了社区对ABP框架出色支持外,我们的支持团队会优先回答商业用户的技术问题.", + "SeeTheSupportOptions": "查看支持选项", + "Contact": "联系", + "TellUsWhatYouNeed": "告诉我们你需要什么.", + "YourMessage": "你的消息", + "YourFullName": "你的全名", + "EmailField": "E-mail地址", + "YourEmailAddress": "你的e-mail地址", + "HowMayWeHelpYou": "我们如何帮助你", + "SendMessage": "发送消息", + "Success": "成功", + "WeWillReplyYou.": "你的消息已经发送! 我们会在短时间内给你答复.", + "GoHome": "回到主页面", + "CreateLiveDemo": "创建在线演示", + "RegisterToTheNewsletter": "注册到时事简报以获取有关ABP.IO的消息,比如新发布的内容.", + "EnterYourEmailOrLogin": "输入你的e-mail地址来创建你的演示或者使用你的已有账号登录.", + "ApplicationTemplate": "应用程序模板", + "ApplicationTemplateExplanation": "应用程序启动模板用于创建新的web应用程序.", + "EfCoreProvider": "Entity Framework (支持 SQL Server, MySQL, PostgreSQL, Oracle 和其它)", + "AlreadyIncludedInTemplateModules": "以下模块已经包含并配置在此模板中:", + "ApplicationTemplateArchitecture": "应用程序模板还支持UI,API,身份验证服务器物理分离的分层架构.", + "SeeTheGuideOrGoToTheLiveDemo": "查看开发人员指南或者查看在线演示了解更多关于模板的信息.", + "DeveloperGuide": "开发人员指南", + "ModuleTemplate": "模块模块", + "ModuleTemplateExplanation1": "你是否想要创建可在不同应用程序之间重用的模块? 这个启动模板准备好了一切来创建可重用的应用程序模块或微服务.", + "ModuleTemplateExplanation2": "

你可以为一个模块支持单个或多个UI框架, 单个或多个数据库提供程序. 除了单元测试和集成测试基础架构外,启动模板被配置为在一个最小的应用程序中运行和测试你的模块.

查看开发人员指南了解有关此模板的技术信息.

", + "WithAllStyleOptions": "使用所有的样式选项", + "Demo": "演示", + "SeeAllModules": "查看所有的模块", + "ABPCLIExplanation": "ABP CLI(命令行页面)是一个执行基于ABP解决方案的一些常见操作的命令行工具.", + "ABPSuiteEasilyCURD": "ABP Suite是一个使你轻松创建CURD页面的工具", + "WeAreHereToHelp": "我们在这里为你提供帮助", + "BrowseOrAskQuestion": "你可以浏览我们的帮助主题或搜索常见的问题, 或者你可以使用联系表单向我们提问.", + "SearchQuestionPlaceholder": "搜索常见的问题", + "WhatIsTheABPCommercial": "什么是ABP商业版?", + "WhatAreDifferencesThanAbpFramework": "ABP框架与ABP商业版有什么不同?", + "ABPCommercialExplanation": "ABP商业版是一套基于开源ABP框架之上的高级模块,工具,主题和服务. ABP商业版由ABP框架背后的同一团队开发和支持.", + "WhatAreDifferencesThanABPFrameworkExplanation": "

ABP框架是模块化,主题化,微服务兼容的ASP.NET Core应用程序开发框架. 它提供了一个完整的架构和强大的基础设施,让你专注于自己的业务代码而不是重复自己的每一个项目. 它基于软件开发的最佳实践和你已经知道的流行工具

ABP框架是完全免费,开源和由社区驱动的. 它还提供了一个免费的主题和一些预构建的模块 (如 identity管理和租户管理).

", + "VisitTheFrameworkVSCommercialDocument": "访问以下链接,了解更多信息 {1} ", + "ABPCommercialFollowingBenefits": "ABP商业版在ABP框架之上添加了以下好处;", + "Professional": "专业的", + "UIThemes": "UI主题", + "EnterpriseModules": "企业就绪,功能丰富,预构建的应用程序模块 (如 Identity Server管理, SaaS管理, 语言管理)", + "ToolingToSupport": "支持你的生产力的工具(如. ABP Suite)", + "PremiumSupportLink": "高级支持", + "WhatDoIDownloadABPCommercial": "购买ABP商业版后我可以下载什么?", + "CreateUnlimitedSolutions": "一旦你购买了ABP商业许可, 你可以创建入门文档中描述的无限的解决方案.", + "ABPCommercialSolutionExplanation": "创建新应用程序时,将根据你的首选项获得Visual Studio解决方案(启动模板). 下载的解决方案已为你安装并配置了商业模块和主题. 你可以删除预装的模块,也可以根据需要添加其他模块. 默认情况下所有模块和主题都使用NuGet/NPM软件包.", + "StartDevelopWithTutorials": "下载的解决方案经过精心设计和记录, 你可以根据教程来开发自己的业务代码.", + "TryTheCommercialDemo": "你可以尝试示例来查看使用ABP商业模板创建的示例应用程序.", + "HowManyProducts": "使用ABP商业版,我可以构建多少不同的产品/解决方案?", + "HowManyProductsExplanation": "创建ABP项目没有限制. 你可以根据需要创建任意数量的项目,进行开发并将其部署到其他服务器.", + "HowManyDevelopers": "有多少开发者可以参与ABP商业版工作?", + "HowManyDevelopersExplanation": "ABP商业许可是针对每个开发人员的. 不同的许可类型具有不同的开发人员限制. 但是你可以在需要时将更多开发人员添加到任何许可类型. 查看许可类型,开发人员限制和额外的开发人员成本的价格页面.", + "ChangingLicenseType": "将来更改我的许可类型吗?", + "ChangingLicenseTypeExplanation": "你始终可以在同一许可中添加新的开发人员. 参阅 \"有多少开发者可以参与ABP商业版工作?\". 你还可以通过支付计算出的价格差来升级到更高的许可. 当你升级到更高的许可计划时,可以享受新计划的好处,但是许可升级不会更改许可的到期日期.", + "LicenseExtendUpgradeDiff": "许可扩展和升级有什么区别?", + "LicenseExtendUpgradeDiffExplanation": "扩展: 通过扩展/更新许可,你将继续获得高级支持,并获得有关模块和主题的重大更新. 此外你将能够继续创建新项目. 而且你仍然可以使用ABP Suite来加快开发速度.
升级: 通过升级许可,你将升级到更高的许可计划,这将使你获得更多好处. 查看 许可比较表来检查许可计划之间的差异. 另一方面,当你升级时你的许可到期日期不会改变!要延长你的许可终止日期,你需要延长你的许可.", + "LicenseRenewalCost": "一年后的许可续期费用是多少?", + "LicenseRenewalCostExplanation": "你可以通过支付当前许可价格的%80来续订(扩展)你的许可. 例如; 标准ABP团队许可为 ${0} 续订价格是 ${1}.", + "IsSourceCodeIncluded": "我的许可是否包括商业模块和主题的源代码?", + "IsSourceCodeIncludedExplanation1": "取决于你购买的许可类型:", + "IsSourceCodeIncludedExplanation2": "团队: 你的解决方案将这些模块和主题作为NuGet和NPM包使用. 它不包括其源代码. 这样,只要有新版本可用,你就可以轻松升级这些模块和主题. 但是,你无法获取模块和主题的源代码.", + "IsSourceCodeIncludedExplanation3": "商业/企业: 除了团队许可外,你还可以下载所需的任何模块或主题的源代码. 你甚至可以删除特定模块的NuGet/NPM软件包引用,并将其源代码直接添加到你的解决方案中以完全更改它.", + "IsSourceCodeIncludedExplanation4": "

将模块的源代码包含到解决方案中,可以最大程度地自定义该模块. 但是当新版本发布时,将无法自动升级模块.

这些许可均不包含ABP Suite源代码,该源代码是一个外部工具,可以为你生成代码并帮助你进行开发

有关许可类型之间的其它差异查看定价页面.

", + "ChangingDevelopers": "我将来可以更改我组织的注册开发人员吗?", + "ChangingDevelopersExplanation": "除了将新的开发人员添加到你的许可中之外,你还可以更改现有的开发人员(可以删除一个开发人员并将新的开发人员添加到同一位置),而无需任何额外费用.", + "WhatHappensWhenLicenseEnds": "我的许可期限结束后会怎样?", + "WhatHappensWhenLicenseEndsExplanation1": "ABP商业版具有永久许可类型.许可到期后, 你可以继续开发你的项目.并且你没有义务续订许可.许可到期后;", + "WhatHappensWhenLicenseEndsExplanation2": "你不能使用ABP商业版创建新的解决方案,但可以永远继续开发现有的应用程序.", + "WhatHappensWhenLicenseEndsExplanation3": "你能够在你的主版本中获得模块和主题的更新.例如;如果你使用的是模块的v3.2.0版本,你仍然可以获得v3.x.x版本的更新.(v3.3.0 v3.5.2…等等)的.但是你无法获得下一个主要版本(如v4.x,v5.x)的更新", + "WhatHappensWhenLicenseEndsExplanation4": "许可到期后,你无法安装添加到ABP商业平台的新模块和主题.", + "WhatHappensWhenLicenseEndsExplanation5": "你不能使用ABP Suite.", + "WhatHappensWhenLicenseEndsExplanation6": "你不再获得高级支持.", + "WhatHappensWhenLicenseEndsExplanation7": "如果你想继续获得这些好处,可以继续续订. 续订时有20%的折扣.", + "WhenShouldIRenewMyLicense": "我什么时候应该续订我的许可?", + "WhenShouldIRenewMyLicenseExplanation1": "如果你在许可到期后的 1个月内续订许可,则许可总价将享受%20的折扣.", + "WhenShouldIRenewMyLicenseExplanation2": "如果你在你的许可过期日期1个月后更新你的许可,更新价格将与许可购买价格相同,你的更新将没有折扣.", + "TrialPlan": "你们有试用计划吗?", + "TrialPlanExplanation": "目前,ABP商业版还没有试用计划.对于团队许可,我们提供30天的退款保证.你可以在30天内要求退款.对于企业营业执照,我们提供30天内60%的退款.这是因为商业和企业许可包含所有模块和主题的完整源代码.", + "DoYouAcceptBankWireTransfer": "你们接受银行电汇吗?", + "DoYouAcceptBankWireTransferExplanation": "是的,我们接受银行电汇.
通过银行电汇转账,通过电子邮件将收据和所要求的许可类型发送给我们.
我们的国际银行帐户信息:", + "HowToUpgrade": "可用新版本时如何升级现有应用程序?", + "HowToUpgradeExplanation1": "使用ABP商业版创建新应用程序时,所有模块和主题均用作NuGet和NPM软件包. 因此,当有新版本可用时,你可以轻松升级软件包.", + "HowToUpgradeExplanation2": "除了标准的NuGet/NPM升级之外, ABP CLI 还提供了一条更新命令,该命令可自动查找和升级解决方案中的所有与ABP相关的软件包.", + "DatabaseSupport": "支持哪些数据库系统?", + "DatabaseSupportExplanation": "ABP框架本身与数据库无关,并且就其性质而言,可以与任何数据库提供程序一起使用. 请参阅数据访问文档以获取当前实现的提供程序的列表.", + "UISupport": "支持哪些UI框架?", + "Supported": "支持的", + "UISupportExplanation": "ABP框架本身与UI框架无关,并且可以与任何UI框架一起使用. 但是,并非针对所有UI框架都实现了启动模板,模块UI和主题. 有关UI选项的最新列表,请参见入门文档.", + "MicroserviceSupport": "它是否支持微服务架构?", + "MicroserviceSupportExplanation1": "ABP框架的主要目标之一是为创建微服务解决方案提供便利的基础架构. 请参阅微服务体系结构文档,以了解它如何帮助创建微服务系统.", + "MicroserviceSupportExplanation2": "所有的ABP商业模块通过模块开发最佳实践文档被设计为支持微服务部署场景(使用自己的API和数据库).", + "MicroserviceSupportExplanation3": "我们提供了一个示例微服务演示解决方案,该示例演示了一种微服务架构实现,可帮助你创建自己的解决方案.", + "MicroserviceSupportExplanation4": "所以简短的答案是 \"是的, 它支持微服务体系结构\".", + "MicroserviceSupportExplanation5": "但是,微服务系统是一个解决方案,每个解决方案都有不同的要求,网络拓扑,通信场景,身份验证可能性,数据库分离/共享决策,运行时配置,第三方系统集成等等.", + "MicroserviceSupportExplanation6": "ABP框架和ABP商业版提供了微服务方案,微服务兼容模块,示例和文档的基础结构,以帮助你构建自己的解决方案. 但是不要期望直接下载为你预先构建的梦想解决方案. 你将需要了解它,并根据需要将某些部分组合在一起.", + "WhereCanIDownloadSourceCode": "在哪里可以下载源代码?", + "WhereCanIDownloadSourceCodeExplanation": "你可以通过ABP Suite或ABP CLI下载所有ABP模块,Angular软件包和主题的源代码. 请参见如何下载源代码?", + "ComputerLimitation": "开发人员在开发ABP时可以登录到多少台计算机?", + "ComputerLimitationExplanation": "我们特别允许每个个人/许可的开发人员使用 {0}台计算机. 每当需要开发人员在第三台计算机上开发ABP商业产品时,都应将电子邮件发送到license@abp.io,以说明情况,然后我们将在系统中进行适当分配.", + "RefundPolicy": "你们有退款政策吗?", + "RefundPolicyExplanation": "你可以在购买许可的30天内请求退款.商业和企业许可类型都有源代码下载选项,因此商业和企业(以及任何包含获得源代码的权利的许可)都不能退款.此外,续展和购买第二次许可也不退款.", + "HowCanIRefundVat": "我该如何退还增值税?", + "HowCanIRefundVatExplanation1": "如果你使用2Checkout付款,则可以通过2Checkout帐户退还增值税:", + "HowCanIRefundVatExplanation2": "登录到你的2Checkout账户", + "HowCanIRefundVatExplanation3": "找到适当的订单,然后按\"退还已延期的增值税\"(输入你的增值税ID", + "HowCanIGetMyInvoice": "我如何获得发票?", + "HowCanIGetMyInvoiceExplanation": "有两个用于购买许可的支付网关:PayU和2Checkout. 如果你通过2Checkout网关购买许可,则它将PDF发票发送到你的电子邮件地址,请参阅2Checkout发票.如果你是通过PayU网关或通过银行电汇购买的,我们将准备并发送你的发票. 你可以从组织管理页面索取发票.", + "Forum": "论坛", + "SupportExplanation": "ABP商业版许可包含由ABP框架专家组成的团队提供的高级论坛支持.", + "PrivateTicket": "私有票", + "PrivateTicketExplanation": "企业许可还包含带有电子邮件和票系统的私人支持.", + "AbpSuiteExplanation1": "ABP Suite使你在几分钟内构建web页面. 它是一个.NET Core Global工具,可以使用命令行安装.", + "AbpSuiteExplanation2": "它可以创建一个新的ABP解决方案, 从数据库生成前端CURD页面. 有关技术概述查看文档", + "FastEasy": "快速并且简单", + "AbpSuiteExplanation3": "ABP Suite允许你轻松的创建CURD页面. 你只需要定义你的实体和它的属性, 其它的让ABP Suite帮你完成! ABP Suite会在几秒内为你生成CURD页面和必要的代码. 它支持Angular, MVC和 Blazor用户界面.", + "RichOptions": "丰富的选项", + "AbpSuiteExplanation4": "ABP Suite支持多个UI选项,例如 Razor Pages和Angular.它还支持多个数据库, 如 MongoDB 和EntityFramework Core支持的所有数据库(MS SQL Server, Oracle, MySql, PostgreSQL 和 更多).", + "AbpSuiteExplanation5": "好消息是, 你不必担心这些选项. ABP Suite了解你的项目类型并且将生成的代码放到项目中正确的位置.", + "SourceCode": "源码", + "AbpSuiteExplanation6": "ABP Suite为你生成源代码! 它不会生成魔法文件来生成web页面. ABP Suite为实体, 仓储, 应用程序, Code First迁移, JavaScript/TypeScript 和 CSHTML/HTML以及必要的页面生成源代码. ABP Suite根据软件开发的最佳实践来生成代码, 所以你不必担心生成的代码的质量.", + "AbpSuiteExplanation7": "由于你有应用程序层中生成的CURD页面的构建块的源代码, 因此你可以轻松修改源码并将自定义/业务逻辑注入到所生成的代码中.", + "CrossPlatform": "跨平台", + "AbpSuiteExplanation8": "ABP Suite使用.NET Core构建并且它是跨平台的. 它在你的本地电脑中运行为web应用程序. 你可以在Windows, Mac和Linux上运行它", + "OtherFeatures": "其他功能", + "OtherFeatures1": "轻松更新你的解决方案的NuGet和NPM包.", + "OtherFeatures2": "重新生成已经生成的页面.", + "OtherFeatures3": "创建新的解决方案", + "ThanksForCreatingProject": "感谢你创建你的项目!", + "HotToRunSolution": "如何运行你的解决方案?", + "HotToRunSolutionExplanation": "查看入门文档来学习如何配置和运行你的解决方案.", + "GettingStarted": "入门", + "WebAppDevTutorial": "Web应用开发教程", + "WebAppDevTutorialExplanation": "查看web应用程序开发教程文档来一步一步的了解开发示例.", + "Document": "文档", + "UsingABPSuiteToCURD": "使用ABP Suite来生成CURD页面", + "SeeABPSuiteDocument": "查看ABP Suite文档学习如何使用ABP Suite.", + "AskQuestionsOnSupport": "你可以在ABP商业支持提出问题.", + "Documentation": "文档", + "SeeModulesDocument": "查看模块文档获取所有商业(专业)模块列表和它们的文档.", + "Pricing": "价格", + "PricingExplanation": "选择当前业务需要的特性和功能. 随着业务增长轻松升级.", + "Team": "团队", + "Business": "商业", + "Enterprise": "企业", + "Custom": "自定义", + "IncludedDeveloperLicenses": "包括开发人员许可", + "CustomLicenceOrAdditionalServices": "需要自定义许可与额外服务?", + "CustomOrVolumeLicense": "自定义或批量许可", + "LiveTrainingSupport": "现场培训和支持", + "AndMore": "和更多", + "AdditionalDeveloperLicense": "额外的开发人员许可", + "ProjectCount": "项目数量", + "AllProModules": "所有模块", + "AllProThemes": "所有主题", + "AllProStartupTemplates": "所有专业启动模板", + "SourceCodeOfAllModules": "所有模块的源码", + "SourceCodeOfAllThemes": "所有主题的源码", + "PerpetualLicense": "永久的许可", + "UnlimitedServerDeployment": "无限制的服务器部署", + "YearUpgrade": "1年升级", + "YearPremiumForumSupport": "1年高级论坛支持", + "ForumSupportIncidentCountYear": "论坛支持事件数量/年", + "PrivateTicketEmailSupport": "私有票和email支持", + "BuyNow": "现在购买" } } \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json index 5bf922f012..9c5ae26f89 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Community/Localization/Resources/en.json @@ -132,6 +132,12 @@ "ChooseYourContentType": "Please choose the way you want to add your content.", "PostContentViaGithub": "I want to add my article with GitHub in accordance with the markdown rules.", "PostContentViaYoutube": "I want to share my videos available on Youtube here.", - "PostContentViaExternalSource": "I want to add the content I published on another platform here." + "PostContentViaExternalSource": "I want to add the content I published on another platform here.", + "GitHubUserNameValidationMessage": "Your Github username can not include whitespace, please be sure your Github username is correct.", + "PersonalSiteUrlValidationMessage": "Your personal site URL can not include whitespace, please be sure your personal site URL is correct.", + "TwitterUserNameValidationMessage": "Your Twitter username can not include whitespace, please be sure your Twitter username is correct.", + "LinkedinUrlValidationMessage": "Your Linkedin URL can not include whitespace, please be sure your Linkedin URL is correct.", + "NoPostsFound": "No posts found!", + "SearchInPosts": "Search in posts..." } } diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/de-DE.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/de-DE.json index 523247a7b6..052b3235eb 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/de-DE.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/de-DE.json @@ -185,6 +185,8 @@ "SeeCliDocumentForMoreInformation": "Weitere Optionen finden Sie im ABP CLI-Dokument oder wählen Sie oben die Registerkarte \"Direkter Download\".", "Optional": "Optional", "LocalFrameworkRef": "Behalten Sie die lokale Projektreferenz für die Framework-Pakete bei.", - "SelectLanguage": "Sprache auswählen" + "SelectLanguage": "Sprache auswählen", + "LatestArticleOnCommunity": "Neuester Artikel zur ABP Community", + "Register": "Registrieren" } } \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en-GB.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en-GB.json index cd0592524d..c0a168a6c2 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en-GB.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en-GB.json @@ -193,6 +193,7 @@ "MultipleDBOptions": "Multiple Database Providers", "MultipleUIOptionsExplanation": "The core framework is designed as UI independent and can work with any type of UI system, while there are multiple pre-built and integrated options are provided out of the box.", "MultipleDBOptionsExplanation": "The framework can work with any data source, while the following providers are officially developed and supported:", - "SelectLanguage": "Select language" + "SelectLanguage": "Select language", + "LatestArticleOnCommunity": "Latest Article on ABP Community" } } \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json index bdc7364788..fff1876a67 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json @@ -8,6 +8,7 @@ "ProjectName": "Project name", "ProjectType": "Project type", "DatabaseProvider": "Database provider", + "DatabaseManagementSystem": "Database management system", "NTier": "N-Tier", "IncludeUserInterface": "Include user interface", "CreateNow": "Create now", @@ -193,6 +194,8 @@ "MultipleDBOptions": "Multiple Database Providers", "MultipleUIOptionsExplanation": "The core framework is designed as UI independent and can work with any type of UI system, while there are multiple pre-built and integrated options are provided out of the box.", "MultipleDBOptionsExplanation": "The framework can work with any data source, while the following providers are officially developed and supported;", - "SelectLanguage": "Select language" + "SelectLanguage": "Select language", + "LatestArticleOnCommunity": "Latest Article on ABP Community", + "Register": "Register" } } diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/es.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/es.json index 06d197d82e..4911144609 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/es.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/es.json @@ -185,6 +185,8 @@ "SeeCliDocumentForMoreInformation": "Ver el documento ABP CLI para más opciones o selecciona la \"Direct Download\" pestaña de arriba.", "Optional": "Opcional", "LocalFrameworkRef": "Mantén la referencia al proyecto local para los paquetes del framework.", - "SelectLanguage": "Vali keel" + "SelectLanguage": "Vali keel", + "LatestArticleOnCommunity": "Último artículo sobre la comunidad ABP", + "Register": "Registrarse" } } \ No newline at end of file diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json index d01d847716..e187a628f2 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/zh-Hans.json @@ -193,6 +193,8 @@ "MultipleDBOptions": "多个数据库提供程序", "MultipleUIOptionsExplanation": "核心框架设计为独立与UI,可以和任何类型的UI系统一起使用. 同时提供了多个开箱即用的预构建集成选项.", "MultipleDBOptionsExplanation": "该框架可以使用任何数据源,并且以下提供程序已得到正式开发和支持;", - "SelectLanguage": "选择语言" + "SelectLanguage": "选择语言", + "LatestArticleOnCommunity": "关于ABP社区的最新文章", + "Register": "寄存器" } } diff --git a/common.props b/common.props index 5254c91876..593fe92213 100644 --- a/common.props +++ b/common.props @@ -1,7 +1,7 @@ - latest - 4.3.0 + latest + 4.3.0 $(NoWarn);CS1591;CS0436 https://abp.io/assets/abp_nupkg.png https://abp.io/ diff --git a/docs/en/Application-Services.md b/docs/en/Application-Services.md index 7fe9825f2a..5d779ec8c9 100644 --- a/docs/en/Application-Services.md +++ b/docs/en/Application-Services.md @@ -43,12 +43,14 @@ public class Book : AggregateRoot { if (string.IsNullOrWhiteSpace(name)) { - throw new ArgumentException($"name can not be empty or white space!"); + throw new ArgumentException( + $"name can not be empty or white space!"); } if (name.Length > MaxNameLength) { - throw new ArgumentException($"name can not be longer than {MaxNameLength} chars!"); + throw new ArgumentException( + $"name can not be longer than {MaxNameLength} chars!"); } return name; @@ -349,8 +351,9 @@ public class DistrictAppService protected async override Task GetEntityByIdAsync(DistrictKey id) { + var queryable = await Repository.GetQueryableAsync(); return await AsyncQueryableExecuter.FirstOrDefaultAsync( - Repository.Where(d => d.CityId == id.CityId && d.Name == id.Name) + queryable.Where(d => d.CityId == id.CityId && d.Name == id.Name) ); } } diff --git a/docs/en/AspNet-Boilerplate-Migration-Guide.md b/docs/en/AspNet-Boilerplate-Migration-Guide.md index f4c2ec712b..52a2fced6a 100644 --- a/docs/en/AspNet-Boilerplate-Migration-Guide.md +++ b/docs/en/AspNet-Boilerplate-Migration-Guide.md @@ -184,7 +184,7 @@ public class PersonAppService : ApplicationService, IPersonAppService } ```` -ABP Framework's repository doesn't have this method. Instead, it implements the `IQueryable` itself. So, you can directly use LINQ on the repository: +ABP Framework's repository have `GetQueryableAsync` instead: ````csharp public class PersonAppService : ApplicationService, IPersonAppService @@ -198,14 +198,15 @@ public class PersonAppService : ApplicationService, IPersonAppService public async Task DoIt() { - var people = await _personRepository + var queryable = await _personRepository.GetQueryableAsync(); + var people = await queryable .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. +> 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. See the [repository document](Repositories.md) for alternative approaches for async query execution. #### FirstOrDefault(predicate), Single()... Methods diff --git a/docs/en/Background-Jobs-RabbitMq.md b/docs/en/Background-Jobs-RabbitMq.md index 2ee478ed17..16b8b0981a 100644 --- a/docs/en/Background-Jobs-RabbitMq.md +++ b/docs/en/Background-Jobs-RabbitMq.md @@ -66,6 +66,26 @@ Defining multiple connections is allowed. In this case, you can use different co } ```` +If you need to connect to the RabbitMQ cluster, you can use the `;` character to separate the host names. + +**Example: Connect to the RabbitMQ cluster** + +```json +{ + "RabbitMQ": { + "Connections": { + "Default": { + "HostName": "123.123.123.123;234.234.234.234" + } + }, + "EventBus": { + "ClientName": "MyClientName", + "ExchangeName": "MyExchangeName" + } + } +} +``` + #### AbpRabbitMqOptions `AbpRabbitMqOptions` class can be used to configure the connection strings for the RabbitMQ. You can configure this options inside the `ConfigureServices` of your [module](Module-Development-Basics.md). diff --git a/docs/en/Best-Practices/Entity-Framework-Core-Integration.md b/docs/en/Best-Practices/Entity-Framework-Core-Integration.md index f487f9d61d..4db6518201 100644 --- a/docs/en/Best-Practices/Entity-Framework-Core-Integration.md +++ b/docs/en/Best-Practices/Entity-Framework-Core-Integration.md @@ -16,11 +16,13 @@ [ConnectionStringName("AbpIdentity")] public interface IIdentityDbContext : IEfCoreDbContext { - DbSet Users { get; set; } - DbSet Roles { get; set; } + DbSet Users { get; } + DbSet Roles { get; } } ```` +* **Do not** define `set;` for the properties in this interface. + ### DbContext class * **Do** inherit the `DbContext` from the `AbpDbContext` class. @@ -144,7 +146,7 @@ public virtual async Task FindByNormalizedUserNameAsync( bool includeDetails = true, CancellationToken cancellationToken = default) { - return await DbSet + return await (await GetDbSetAsync()) .IncludeDetails(includeDetails) .FirstOrDefaultAsync( u => u.NormalizedUserName == normalizedUserName, @@ -175,14 +177,15 @@ public static IQueryable IncludeDetails( } ```` -* **Do** use the `IncludeDetails` extension method in the repository methods just like used in the example code above (see FindByNormalizedUserNameAsync). +* **Do** use the `IncludeDetails` extension method in the repository methods just like used in the example code above (see `FindByNormalizedUserNameAsync`). - **Do** override `WithDetails` method of the repository for aggregates root which have **sub collections**. Example: ````C# -public override IQueryable WithDetails() +public override async Task> WithDetailsAsync() { - return GetQueryable().IncludeDetails(); // Uses the extension method defined above + // Uses the extension method defined above + return (await GetQueryableAsync()).IncludeDetails(); } ```` diff --git a/docs/en/Best-Practices/MongoDB-Integration.md b/docs/en/Best-Practices/MongoDB-Integration.md index 74a0e429f1..90f7871a70 100644 --- a/docs/en/Best-Practices/MongoDB-Integration.md +++ b/docs/en/Best-Practices/MongoDB-Integration.md @@ -128,7 +128,7 @@ public async Task FindByNormalizedUserNameAsync( bool includeDetails = true, CancellationToken cancellationToken = default) { - return await GetMongoQueryable() + return await (await GetMongoQueryableAsync()) .FirstOrDefaultAsync( u => u.NormalizedUserName == normalizedUserName, GetCancellationToken(cancellationToken) @@ -139,8 +139,8 @@ public async Task FindByNormalizedUserNameAsync( `GetCancellationToken` fallbacks to the `ICancellationTokenProvider.Token` to obtain the cancellation token if it is not provided by the caller code. * **Do** ignore the `includeDetails` parameters for the repository implementation since MongoDB loads the aggregate root as a whole (including sub collections) by default. -* **Do** use the `GetMongoQueryable()` method to obtain an `IQueryable` to perform queries wherever possible. Because; - * `GetMongoQueryable()` method automatically uses the `ApplyDataFilters` method to filter the data based on the current data filters (like soft delete and multi-tenancy). +* **Do** use the `GetMongoQueryableAsync()` method to obtain an `IQueryable` to perform queries wherever possible. Because; + * `GetMongoQueryableAsync()` method automatically uses the `ApplyDataFilters` method to filter the data based on the current data filters (like soft delete and multi-tenancy). * Using `IQueryable` makes the code as much as similar to the EF Core repository implementation and easy to write and read. * **Do** implement data filtering if it is not possible to use the `GetMongoQueryable()` method. diff --git a/docs/en/Best-Practices/Repositories.md b/docs/en/Best-Practices/Repositories.md index c0058df433..4f646a7d94 100644 --- a/docs/en/Best-Practices/Repositories.md +++ b/docs/en/Best-Practices/Repositories.md @@ -42,24 +42,6 @@ Task FindByNormalizedUserNameAsync( ); ```` -* **Do** create a **synchronous extension** method for each asynchronous repository method. Example: - -````C# -public static class IdentityUserRepositoryExtensions -{ - public static IdentityUser FindByNormalizedUserName( - this IIdentityUserRepository repository, - [NotNull] string normalizedUserName) - { - return AsyncHelper.RunSync( - () => repository.FindByNormalizedUserNameAsync(normalizedUserName) - ); - } -} -```` - -This will allow synchronous code to use the repository methods easier. - * **Do** add an optional `bool includeDetails = true` parameter (default value is `true`) for every repository method which returns a **single entity**. Example: ````C# diff --git a/docs/en/Blob-Storing-Aliyun.md b/docs/en/Blob-Storing-Aliyun.md index 6cdebb3acc..4060e5ba26 100644 --- a/docs/en/Blob-Storing-Aliyun.md +++ b/docs/en/Blob-Storing-Aliyun.md @@ -36,7 +36,7 @@ Configure(options => aliyun.Policy = "policy"; aliyun.DurationSeconds = "expiration date"; aliyun.ContainerName = "your aliyun container name"; - aliyun.CreateContainerIfNotExists = false; + aliyun.CreateContainerIfNotExists = true; }); }); }); diff --git a/docs/en/Blob-Storing-Aws.md b/docs/en/Blob-Storing-Aws.md index 05e3caa183..aa7707e5d3 100644 --- a/docs/en/Blob-Storing-Aws.md +++ b/docs/en/Blob-Storing-Aws.md @@ -39,7 +39,7 @@ Configure(options => Aws.Policy = "policy"; Aws.DurationSeconds = "expiration date"; Aws.ContainerName = "your Aws container name"; - Aws.CreateContainerIfNotExists = false; + Aws.CreateContainerIfNotExists = true; }); }); }); diff --git a/docs/en/Blob-Storing-Azure.md b/docs/en/Blob-Storing-Azure.md index de6ed63152..99833e71c0 100644 --- a/docs/en/Blob-Storing-Azure.md +++ b/docs/en/Blob-Storing-Azure.md @@ -29,7 +29,7 @@ Configure(options => { azure.ConnectionString = "your azure connection string"; azure.ContainerName = "your azure container name"; - azure.CreateContainerIfNotExists = false; + azure.CreateContainerIfNotExists = true; }); }); }); diff --git a/docs/en/Blog-Posts/2021-01-28 v4_2_Release_Stable/POST.md b/docs/en/Blog-Posts/2021-01-28 v4_2_Release_Stable/POST.md new file mode 100644 index 0000000000..fac8484411 --- /dev/null +++ b/docs/en/Blog-Posts/2021-01-28 v4_2_Release_Stable/POST.md @@ -0,0 +1,53 @@ +# ABP.IO Platform 4.2 Final Has Been Released! + +[ABP Framework](https://abp.io/) and [ABP Commercial](https://commercial.abp.io/) 4.2 versions have been released today. + +## What's New With 4.2? + +Since all the new features are already explained in details with the [4.2 RC Announcement Post](https://blog.abp.io/abp/ABP-IO-Platform-v4-2-RC-Has-Been-Released), I will not repeat all the details again. See the [RC Blog Post](https://blog.abp.io/abp/ABP-IO-Platform-v4-2-RC-Has-Been-Released) for all the features and enhancements. + +## Creating New Solutions + +You can create a new solution with the ABP Framework version 4.2 by either using the `abp new` command or using the **direct download** tab on the [get started page](https://abp.io/get-started). + +> See the [getting started document](https://docs.abp.io/en/abp/latest/Getting-Started) for details. + +## How to Upgrade an Existing Solution + +### Install/Update the ABP CLI + +First of all, install the ABP CLI or upgrade to the latest version. + +If you haven't installed yet: + +```bash +dotnet tool install -g Volo.Abp.Cli +``` + +To update an existing installation: + +```bash +dotnet tool update -g Volo.Abp.Cli +``` + +### ABP UPDATE Command + +[ABP CLI](https://docs.abp.io/en/abp/latest/CLI) provides a handy command to update all the ABP related NuGet and NPM packages in your solution with a single command: + +```bash +abp update +``` + +Run this command in the root folder of your solution. + +## Migration Guide + +Check [the migration guide](https://docs.abp.io/en/abp/latest/Migration-Guides/Abp-4_2) for the applications with the version 4.x upgrading to the version 4.2. + +> It is strongly recommended to check the migration guide for this version. Especially, the new `IRepository.GetQueryableAsync()` method is a core change should be considered after upgrading the solution. + +## About the Next Version + +The next feature version will be 4.3. It is planned to release the 4.3 RC (Release Candidate) on March 11 and the final version on March 25, 2021. + +We decided to slow down the feature development for the [next milestone](https://github.com/abpframework/abp/milestone/49). We will continue to improve the existing features and introduce new ones, sure, but wanted to have more time for the planning, documentation, creating guides and improving the development experience. \ No newline at end of file diff --git a/docs/en/CLI.md b/docs/en/CLI.md index fc76aa997b..d4a33a2a12 100644 --- a/docs/en/CLI.md +++ b/docs/en/CLI.md @@ -31,6 +31,7 @@ Here, the list of all available commands before explaining their details: * **`update`**: Automatically updates all ABP related NuGet and NPM packages in a solution. * **`add-package`**: Adds an ABP package to a project. * **`add-module`**: Adds a [multi-package application module](https://docs.abp.io/en/abp/latest/Modules/Index) to a solution. +* **`list-modules`**: Lists names of open-source application modules. * **`get-source`**: Downloads the source code of a module. * **`generate-proxy`**: Generates client side proxies to use HTTP API endpoints. * **`remove-proxy`**: Removes previously generated client side proxies. @@ -202,6 +203,26 @@ abp add-module ProductManagement --new --add-to-solution-file * `--with-source-code`: Downloads the source code of the module to your solution folder and uses local project references instead of NuGet/NPM packages. This options is always `True` if `--new` is used. * `--add-to-solution-file`: Adds the downloaded/created module to your solution file, so you will also see the projects of the module when you open the solution on a IDE. (only available when `--with-source-code` is `True`.) +### list-modules + +Lists names of open-source application modules. + +Usage + +````bash +abp list-modules [options] +```` + +Example: + +```bash +abp list-modules +``` + +#### Options + +* `--include-pro-modules`: Includes commercial (pro) modules in the output. + ### get-source Downloads the source code of a module to your computer. diff --git a/docs/en/Caching.md b/docs/en/Caching.md index 042f13ffe0..7dbf02d875 100644 --- a/docs/en/Caching.md +++ b/docs/en/Caching.md @@ -242,12 +242,15 @@ In addition, all of the `IDistributedCache` (and `IDistributedCache< ## Batch Operations -ABP's distributed cache interfaces provide methods to perform batch get/set methods those improves the performance when you want to get or set multiple cache items in a single method call. +ABP's distributed cache interfaces provide methods to perform batch methods those improves the performance when you want to batch operation multiple cache items in a single method call. * `SetManyAsync` and `SetMany` methods can be used to set multiple values to the cache. * `GetManyAsync` and `GetMany` methods can be used to retrieve multiple values from the cache. +* `GetOrAddManyAsync` and `GetOrAddMany` methods can be used to retrieve multiple values and set missing values from the cache +* `RefreshManyAsync` and `RefreshMany` methods can be used to resets the sliding expiration timeout of multiple values from the cache +* `RemoveManyAsync` and `RemoveMany` methods can be used to remove multiple values from the cache -> These are not standard methods of the ASP.NET Core caching. So, some providers may not support them. They are supported by the [ABP Redis Cache integration package](Redis-Cache.md). If the provider doesn't support, it fallbacks to `SetAsync` and `GetAsync` methods (called once for each item). +> These are not standard methods of the ASP.NET Core caching. So, some providers may not support them. They are supported by the [ABP Redis Cache integration package](Redis-Cache.md). If the provider doesn't support, it fallbacks to `SetAsync` and `GetAsync` ... methods (called once for each item). ## Advanced Topics diff --git a/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/POST.md b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/POST.md new file mode 100644 index 0000000000..f30f31d541 --- /dev/null +++ b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/POST.md @@ -0,0 +1,103 @@ +## Using MatBlazor UI Components With the ABP Framework + +Hi, in this step by step article, I will show you how to integrate [MatBlazor](https://www.matblazor.com/), a blazor UI components into ABP Framework-based applications. + +![example-result](example-result.png) + +*(A screenshot from the example application developed in this article)* + +## Create the Project + +> First thing is to create the project. ABP Framework offers startup templates to get into business faster. + +In this article, I will create a new startup template with EF Core as a database provider and Blazor for UI framework. But if you already have a project with Blazor UI, you don't need to create a new startup template, you can directly implement the following steps to your existing project. + +> If you already have a project with the Blazor UI, you can skip this section. + +* Before starting the development, we will create a new solution named `MatBlazorSample` (or whatever you want). We will create a new startup template with EF Core as a database provider and Blazor for UI framework by using [ABP CLI](https://docs.abp.io/en/abp/latest/CLI): + +````bash +abp new MatBlazorSample -u blazor +```` + +This will create new project inside of `aspnet-core`, so: + +````bash +cd aspnet-core +```` + +and + +````bash +dotnet restore +```` + +* Our project boilerplate will be ready after the download is finished. Then, we can open the solution in the Visual Studio (or any other IDE) and run the `MatBlazorSample.DbMigrator` to create the database and seed initial data (which creates the admin user, admin role, permissions etc.) + +![initial-project](initial-project.png) + +* After database and initial data created, +* Run the `MatBlazorSample.HttpApi.Host` to see our server side working and +* Run the `MatBlazorSample.Blazor` to see our UI working properly. + +> _Default login credentials for admin: username is **admin** and password is **1q2w3E\***_ + +## Install MatBlazor + +You can follow [this documentation](https://www.matblazor.com/) to install MatBlazor packages into your computer. + +### Adding MatBlazor NuGet Packages + +```bash +Install-Package MatBlazor +``` + +### Register MatBlazor Resources + +1. Add the following line to the HEAD section of the `wwwroot/index.html` file within the `MatBlazorSample.Blazor` project: + + ```Razor + + + + + + ``` + +2. In the `MatBlazorSampleBlazorModule` class, call the `AddMatBlazor()` method from your project's `ConfigureServices()` method: + + ```csharp + public override void ConfigureServices(ServiceConfigurationContext context) + { + var environment = context.Services.GetSingletonInstance(); + var builder = context.Services.GetSingletonInstance(); + // ... + builder.Services.AddMatBlazor(); + } + ``` + +3. Register the **MatBlazorSample.Blazor** namespace in the `_Imports.razor` file: + + ```Razor + @using MatBlazor + ``` + +## The Sample Application + +We have created a sample application with [Table](https://www.matblazor.com/Table) example. + +### The Source Code + +You can download the source code from [here](https://github.com/abpframework/abp-samples/tree/master/MatBlazorSample). + +The related files for this example are marked in the following screenshots. + +![table-app-contract](table-app-contract.png) + +![table-application](table-application.png) + +![table-web](table-web.png) + +## Conclusion + +In this article, I've explained how to use [MatBlazor](https://www.matblazor.com/) components in your application. ABP Framework is designed so that it can work with any UI library/framework. \ No newline at end of file diff --git a/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/example-result.png b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/example-result.png new file mode 100644 index 0000000000..89a2fecdce Binary files /dev/null and b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/example-result.png differ diff --git a/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/initial-project.png b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/initial-project.png new file mode 100644 index 0000000000..85e71d5692 Binary files /dev/null and b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/initial-project.png differ diff --git a/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/table-app-contract.png b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/table-app-contract.png new file mode 100644 index 0000000000..8108cdc606 Binary files /dev/null and b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/table-app-contract.png differ diff --git a/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/table-application.png b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/table-application.png new file mode 100644 index 0000000000..7f07af97e1 Binary files /dev/null and b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/table-application.png differ diff --git a/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/table-web.png b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/table-web.png new file mode 100644 index 0000000000..0034aec095 Binary files /dev/null and b/docs/en/Community-Articles/2021-01-20-How-to-Integrate-the-MatBlazor-Blazor-Component/table-web.png differ diff --git a/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/POST.md b/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/POST.md new file mode 100644 index 0000000000..7a854291d5 --- /dev/null +++ b/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/POST.md @@ -0,0 +1,343 @@ +# How to Use PrimeNG Components with the ABP Angular UI + +## Introduction + +In this article, we will use components of the [PrimeNG](https://www.primefaces.org/primeng/) that is a popular UI component library for Angular with the ABP Framework Angular UI that will be generated via [ABP CLI](https://docs.abp.io/en/abp/latest/CLI). + +We will create an organization units page and use PrimeNG's [OrganizationChart](https://primefaces.org/primeng/showcase/#/organizationchart) and [Table](https://primefaces.org/primeng/showcase/#/table) components on the page. + +![Introduction](intro.gif) + +The UI shown above contains many PrimeNG components. You can reach the source code of this rich UI. Take a look at the source code section below. + +> This article does not cover any backend code. I used mock data to provide data source to the components. + +## Pre-Requirements + +The following tools should be installed on your development machine: + +* [.NET Core 5.0+](https://www.microsoft.com/net/download/dotnet-core/) +* [Node v12 or v14](https://nodejs.org/) +* [VS Code](https://code.visualstudio.com/) or another IDE + +## Source Code + +I have prepared a sample project that contains more PrimeNG components than described in this article. You can download the source code [on GitHub](https://github.com/abpframework/abp-samples/tree/master/PrimengSample). + +## Creating a New Solution + +In this step, we will create a new solution that contains Angular UI and backend startup templates. If you have a startup template with Angular UI, you can skip this step. + +Run the following command to install the ABP CLI: + +```bash +dotnet tool install -g Volo.Abp.Cli +``` + +...or update: + +```bash +dotnet tool update -g Volo.Abp.Cli +``` + +Create a new solution named `AbpPrimengSample` by running the following command: + +```bash +abp new AbpPrimengSample -u angular -csf +``` + +See the [ABP CLI documentation](https://docs.abp.io/en/abp/latest/CLI) for all available options. + +You can also use the Direct Download tab on the [Get Started](https://abp.io/get-started) page. + +## Running the Solution + +You can run the solution as described in [here](https://docs.abp.io/en/abp/latest/Getting-Started-Running-Solution?UI=NG&DB=EF&Tiered=No). + +## PrimeNG Setup + +Open the `angular` folder and run the following command to install packages: + +```bash +npm install +``` + +Next, we need to install `primeng` and required packages (`primeicons` and `@angular/cdk`) for the library. Run the command below to install these packages: + +```bash +npm install primeng primeicons @angular/cdk --save +``` + +The packages we have installed; + + - `primeng` is the main package that is a component library. + - `primeicons` is an icon font library. Many PrimeNG components use this font internally. + - `@angular/cdk` is a component dev kit created by the Angular team. Some PrimeNG modules depend on it. + +As the last step of the setup, we should add the required style files for the library to `angular.json`: + +```js +//angular.json + +"projects": { + "AbpPrimengSample": { + //... + "styles": { + "node_modules/primeicons/primeicons.css", + "node_modules/primeng/resources/themes/saga-blue/theme.css", + "node_modules/primeng/resources/primeng.min.css", + //...other styles + } + } +} +``` + +We have added the `primeng.min.css`, Saga Blue theme's `theme.css`, and `primeicons.css` files to the project. You can choose another theme instead of the Sage Blue. See available themes on the [Get Started](https://www.primefaces.org/primeng/showcase/#/setup) document of the PrimeNG. + + +> You have to restart the running `ng serve` process to see the effect of the changes you made in the `angular.json`. + + +## Creating the Organization Units Page + +Run the following command to create a new module named `OrganizationUnits`: + +```bash +npm run ng -- generate module organization-units --route organization-units --module app.module +``` + +Then open the `src/route.provider.ts` and add a new route as an array element to add a navigation link labeled "Organization Units" to the menu: + +```js +//route.provider.ts + +import { eThemeSharedRouteNames } from '@abp/ng.theme.shared'; +//... + +routesService.add([ + //... + { + path: '/organization-units', + name: 'Organization Units', + parentName: eThemeSharedRouteNames.Administration, + iconClass: 'fas fa-sitemap', + layout: eLayoutType.application, + }, +]); +``` + +We have created a lazy-loadable module and defined a menu navigation link. We can navigate to the page as shown below: + +![organization units menu navigation item](organization-units-menu-item.jpg) + +## Using the PrimeNG Components + +### Implementing the Organization Chart Component + +When you would like to use any component from PrimeNG, you have to import the component's module to your module. Since we will use the `OrganizationChart` on the organization units page, we need to import `OrganizationChartModule` into `OrganizationUnitsModule`. + +Open the `src/organization-units/organization-units.module.ts` and add the `OrganizationChartModule` to the imports array as shown below: + +```js +import { OrganizationChartModule } from 'primeng/organizationchart'; +//... + +@NgModule({ + //... + imports: [ + //... + OrganizationChartModule + ], +}) +export class OrganizationUnitsModule {} +``` + +> Since NGCC need to work in some cases, restarting the `ng serve` process would be good when you import any modules from `primeng` package to your module. + +Let's define a mock data source for the `OrganizationChartComponent` and add the component to the page. + +Open the `src/organization-units/organization-units.component.ts` and add two variables as shown below: + +```js +//... +import { TreeNode } from 'primeng/api'; + +@Component(/* component metadata*/) +export class OrganizationUnitsComponent implements OnInit { + //... + + organizationUnits: TreeNode[] = [ + { + label: 'Management', + expanded: true, + children: [ + { + label: 'Selling', + expanded: true, + children: [ + { + label: 'Customer Relations', + }, + { + label: 'Marketing', + }, + ], + }, + { + label: 'Supporting', + expanded: true, + children: [ + { + label: 'Buying', + }, + { + label: 'Human Resources', + }, + ], + }, + ], + }, + ]; + + selectedUnit: TreeNode; +``` + +- First variable is `organizationUnits`. It provides mock data source to `OrganizationChartComponent`. +- Second variable is `selectedUnit`. It keeps chosen unit on the chart. + +Then, open the `src/organization-units/organization-units.component.html` and replace the file content with the following: + +```html +
+
+
Organization Units
+
+
+ +
+
+``` + +We have implemented the `OrganizationChart`. The final UI looks like below: + +![organization chart](organization-chart.jpg) + +## Implementing the Table Component + +In order to use the `TableComponent`, we have to import the `TableModule` to the `OrganizationUnitsModule`. + +Open the `organization-units.module.ts` and add `TableModule` to the imports array as shown below: + +```js +import { TableModule } from 'primeng/table'; +//... + +@NgModule({ + //... + imports: [ + //... + TableModule + ], +}) +export class OrganizationUnitsModule {} +``` + +Open the `organization-units.component.ts` and add a variable named `members` with initial value and add a getter named `tableData` as shown below: + +```js +//... +export class OrganizationUnitsComponent implements OnInit { + //... + + members = [ + { + fullName: 'John Doe', + username: 'John.Doe', + phone: '+1-202-555-0125', + email: 'john.doe@example.com', + parent: 'Customer Relations', + }, + { + fullName: 'Darrion Walter', + username: 'Darrion.Walter', + phone: '+1-262-155-0355', + email: 'Darrion_Walter@example.com', + parent: 'Marketing', + }, + { + fullName: 'Rosa Labadie', + username: 'Rosa.Labadie', + phone: '+1-262-723-2255', + email: 'Rosa.Labadie@example.com', + parent: 'Marketing', + }, + { + fullName: 'Adelle Hills', + username: 'Adelle.Hills', + phone: '+1-491-112-9011', + email: 'Adelle.Hills@example.com', + parent: 'Buying', + }, + { + fullName: 'Brian Hane', + username: 'Brian.Hane', + phone: '+1-772-509-1823', + email: 'Brian.Hane@example.com', + parent: 'Human Resources', + }, + ]; + + get tableData() { + return this.members.filter(user => user.parent === this.selectedUnit.label); + } +``` + +What we have done above? + +- We defined a variable named `members` to provide mock data to the table. +- We have defined a getter named `tableData` to provide filtered data source to the table using `members` variable. + +We are now ready to add the table to the HTML template. + +Open the `organization-units.component.html`, find the `p-organizationChart` tag and place the following code to the bottom of this tag: + +```html +
+
Members of {{ selectedUnit.label }}
+ + + + + Name + Username + Email + Phone + + + + + {{ member.fullName }} + {{ member.username }} + {{ member.email }} + {{ member.phone }} + + + +
+``` + +We have added a new `div` that contains the `TableComponent`. The table appears when an organization unit is selected. +The table contains 4 columns which are name, username, email, and phone for displaying the members' information. + +After adding the table, the final UI looks like this: + +![PrimeNG TableComponent](table.gif) + + +## Conclusion + +We have implemented the PrimeNG component library on the ABP Angular UI project and used two components on a page in a short time. You can use any PrimeNG components by following the documentation. The ABP Angular UI will not block you in any case. diff --git a/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/intro.gif b/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/intro.gif new file mode 100644 index 0000000000..5f96a65422 Binary files /dev/null and b/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/intro.gif differ diff --git a/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/organization-chart.jpg b/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/organization-chart.jpg new file mode 100644 index 0000000000..9d18f35ba1 Binary files /dev/null and b/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/organization-chart.jpg differ diff --git a/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/organization-units-menu-item.jpg b/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/organization-units-menu-item.jpg new file mode 100644 index 0000000000..dc6111f553 Binary files /dev/null and b/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/organization-units-menu-item.jpg differ diff --git a/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/table.gif b/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/table.gif new file mode 100644 index 0000000000..d27dcb26bd Binary files /dev/null and b/docs/en/Community-Articles/2021-01-20-How-to-Use-PrimeNG-Components-with-the-ABP-Angular-UI/table.gif differ diff --git a/docs/en/Customizing-Application-Modules-Overriding-Services.md b/docs/en/Customizing-Application-Modules-Overriding-Services.md index ab6f29816b..081b142ad7 100644 --- a/docs/en/Customizing-Application-Modules-Overriding-Services.md +++ b/docs/en/Customizing-Application-Modules-Overriding-Services.md @@ -196,12 +196,16 @@ This example replaces the `AccountController` (An API Controller defined in the **`[ExposeServices(typeof(AccountController))]` is essential** here since it registers this controller for the `AccountController` in the dependency injection system. `[Dependency(ReplaceServices = true)]` is also recommended to clear the old registration (even the ASP.NET Core DI system selects the last registered one). -In addition, The `AccountController` will be removed from [`ApplicationModel`](https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.applicationmodels.applicationmodel.controllers) because it defines `ExposeServicesAttribute`. If you don't want to remove it, you can configure `AbpAspNetCoreMvcOptions`: +In addition, the `MyAccountController` will be removed from [`ApplicationModel`](https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.mvc.applicationmodels.applicationmodel.controllers) because it defines `ExposeServicesAttribute`. + +If `IncludeSelf = true` is specified, i.e. `[ExposeServices(typeof(AccountController), IncludeSelf = true)]`, then `AccountController` will be removed instead. This is useful for **extending** a controller. + +If you don't want to remove either controller, you can configure `AbpAspNetCoreMvcOptions`: ```csharp Configure(options => { - options.IgnoredControllersOnModelExclusion.AddIfNotContains(typeof(AccountController)); + options.IgnoredControllersOnModelExclusion.AddIfNotContains(typeof(MyAccountController)); }); ``` diff --git a/docs/en/Dependency-Injection.md b/docs/en/Dependency-Injection.md index 335e829461..f94901ad84 100644 --- a/docs/en/Dependency-Injection.md +++ b/docs/en/Dependency-Injection.md @@ -1,6 +1,6 @@ # Dependency Injection -ABP's Dependency Injection system is developed based on Microsoft's [dependency injection extension](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/dependency-injection) library (Microsoft.Extensions.DependencyInjection nuget package). So, it's documentation is valid in ABP too. +ABP's Dependency Injection system is developed based on Microsoft's [dependency injection extension](https://medium.com/volosoft/asp-net-core-dependency-injection-best-practices-tips-tricks-c6e9c67f9d96) library (Microsoft.Extensions.DependencyInjection nuget package). So, it's documentation is valid in ABP too. > While ABP has no core dependency to any 3rd-party DI provider, it's required to use a provider that supports dynamic proxying and some other advanced features to make some ABP features properly work. Startup templates come with Autofac installed. See [Autofac integration](Autofac-Integration.md) document for more information. diff --git a/docs/en/Distributed-Event-Bus-RabbitMQ-Integration.md b/docs/en/Distributed-Event-Bus-RabbitMQ-Integration.md index 9587a111bf..3d99e1e3cf 100644 --- a/docs/en/Distributed-Event-Bus-RabbitMQ-Integration.md +++ b/docs/en/Distributed-Event-Bus-RabbitMQ-Integration.md @@ -90,7 +90,7 @@ You can use any of the [ConnectionFactry](http://rabbitmq.github.io/rabbitmq-dot **Example: Specify the connection port** -````csharp +````json { "RabbitMQ": { "Connections": { @@ -103,6 +103,26 @@ You can use any of the [ConnectionFactry](http://rabbitmq.github.io/rabbitmq-dot } ```` +If you need to connect to the RabbitMQ cluster, you can use the `;` character to separate the host names. + +**Example: Connect to the RabbitMQ cluster** + +```json +{ + "RabbitMQ": { + "Connections": { + "Default": { + "HostName": "123.123.123.123;234.234.234.234" + } + }, + "EventBus": { + "ClientName": "MyClientName", + "ExchangeName": "MyExchangeName" + } + } +} +``` + ### The Options Classes `AbpRabbitMqOptions` and `AbpRabbitMqEventBusOptions` classes can be used to configure the connection strings and event bus options for the RabbitMQ. diff --git a/docs/en/Domain-Driven-Design-Implementation-Guide.md b/docs/en/Domain-Driven-Design-Implementation-Guide.md index 9341df703b..cf2ce6bf14 100644 --- a/docs/en/Domain-Driven-Design-Implementation-Guide.md +++ b/docs/en/Domain-Driven-Design-Implementation-Guide.md @@ -754,7 +754,8 @@ namespace IssueTracking.Issues { var daysAgo30 = DateTime.Now.Subtract(TimeSpan.FromDays(30)); - return await DbSet.Where(i => + var dbSet = await GetDbSetAsync(); + return await dbSet.Where(i => //Open !i.IsClosed && @@ -906,7 +907,8 @@ public class EfCoreIssueRepository : public async Task> GetIssuesAsync(ISpecification spec) { - return await DbSet + var dbSet = await GetDbSetAsync(); + return await dbSet .Where(spec.ToExpression()) .ToListAsync(); } @@ -952,8 +954,9 @@ public class IssueAppService : ApplicationService, IIssueAppService public async Task DoItAsync() { + var queryable = await _issueRepository.GetQueryableAsync(); var issues = AsyncExecuter.ToListAsync( - _issueRepository.Where(new InActiveIssueSpecification()) + queryable.Where(new InActiveIssueSpecification()) ); } } @@ -996,8 +999,9 @@ public class IssueAppService : ApplicationService, IIssueAppService public async Task DoItAsync(Guid milestoneId) { + var queryable = await _issueRepository.GetQueryableAsync(); var issues = AsyncExecuter.ToListAsync( - _issueRepository + queryable .Where( new InActiveIssueSpecification() .And(new MilestoneSpecification(milestoneId)) diff --git a/docs/en/Entity-Framework-Core.md b/docs/en/Entity-Framework-Core.md index b2b216397a..a2c0e79996 100644 --- a/docs/en/Entity-Framework-Core.md +++ b/docs/en/Entity-Framework-Core.md @@ -236,7 +236,8 @@ public class BookRepository public async Task DeleteBooksByType(BookType type) { - await DbContext.Database.ExecuteSqlRawAsync( + var dbContext = await GetDbContextAsync(); + await dbContext.Database.ExecuteSqlRawAsync( $"DELETE FROM Books WHERE Type = {(int)type}" ); } @@ -344,7 +345,7 @@ You have different options when you want to load the related entities while quer #### Repository.WithDetails -`IRepository.WithDetails(...)` can be used to include one relation collection/property to the query. +`IRepository.WithDetailsAsync(...)` can be used to get an `IQueryable` by including one relation collection/property. **Example: Get an order with lines** @@ -355,7 +356,7 @@ using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; using Volo.Abp.Domain.Services; -namespace MyCrm +namespace AbpDemo.Orders { public class OrderManager : DomainService { @@ -368,35 +369,39 @@ namespace MyCrm public async Task TestWithDetails(Guid id) { - var query = _orderRepository - .WithDetails(x => x.Lines) - .Where(x => x.Id == id); - + //Get a IQueryable by including sub collections + var queryable = await _orderRepository.WithDetailsAsync(x => x.Lines); + + //Apply additional LINQ extension methods + var query = queryable.Where(x => x.Id == id); + + //Execute the query and get the result var order = await AsyncExecuter.FirstOrDefaultAsync(query); } } } ```` -> `AsyncExecuter` is used to execute async LINQ extensions without depending on the EF Core. If you add EF Core NuGet package reference to your project, then you can directly use `await _orderRepository.WithDetails(x => x.Lines).FirstOrDefaultAsync()`. But, this time you depend on the EF Core in your domain layer. See the [repository document](Repositories.md) to learn more. +> `AsyncExecuter` is used to execute async LINQ extensions without depending on the EF Core. If you add EF Core NuGet package reference to your project, then you can directly use `await query.FirstOrDefaultAsync()`. But, this time you depend on the EF Core in your domain layer. See the [repository document](Repositories.md) to learn more. **Example: Get a list of orders with their lines** ````csharp public async Task TestWithDetails() { - var query = _orderRepository - .WithDetails(x => x.Lines); + //Get a IQueryable by including sub collections + var queryable = await _orderRepository.WithDetailsAsync(x => x.Lines); - var orders = await AsyncExecuter.ToListAsync(query); + //Execute the query and get the result + var orders = await AsyncExecuter.ToListAsync(queryable); } ```` -> `WithDetails` method can get more than one expression parameter if you need to include more than one navigation property or collection. +> `WithDetailsAsync` method can get more than one expression parameter if you need to include more than one navigation property or collection. #### DefaultWithDetailsFunc -If you don't pass any expression to the `WithDetails` method, then it includes all the details using the `DefaultWithDetailsFunc` option you provide. +If you don't pass any expression to the `WithDetailsAsync` method, then it includes all the details using the `DefaultWithDetailsFunc` option you provide. You can configure `DefaultWithDetailsFunc` for an entity in the `ConfigureServices` method of your [module](Module-Development-Basics.md) in your `EntityFrameworkCore` project. @@ -419,12 +424,15 @@ Then you can use the `WithDetails` without any parameter: ````csharp public async Task TestWithDetails() { - var query = _orderRepository.WithDetails(); - var orders = await AsyncExecuter.ToListAsync(query); + //Get a IQueryable by including all sub collections + var queryable = await _orderRepository.WithDetailsAsync(); + + //Execute the query and get the result + var orders = await AsyncExecuter.ToListAsync(queryable); } ```` -`WithDetails()` executes the expression you've setup as the `DefaultWithDetailsFunc`. +`WithDetailsAsync()` executes the expression you've setup as the `DefaultWithDetailsFunc`. #### Repository Get/Find Methods @@ -466,7 +474,7 @@ public async Task TestWithDetails() #### Alternatives -The repository patters tries to encapsulate the EF Core, so your options are limited. If you need an advanced scenario, you can follow one of the options; +The repository pattern tries to encapsulate the EF Core, so your options are limited. If you need an advanced scenario, you can follow one of the options; * Create a custom repository method and use the complete EF Core API. * Reference to the `Volo.Abp.EntityFrameworkCore` package from your project. In this way, you can directly use `Include` and `ThenInclude` in your code. @@ -550,24 +558,15 @@ See also [lazy loading document](https://docs.microsoft.com/en-us/ef/core/queryi In most cases, you want to hide EF Core APIs behind a repository (this is the main purpose of the repository pattern). However, if you want to access the `DbContext` instance over the repository, you can use `GetDbContext()` or `GetDbSet()` extension methods. Example: ````csharp -public class BookService +public async Task TestAsync() { - private readonly IRepository _bookRepository; - - public BookService(IRepository bookRepository) - { - _bookRepository = bookRepository; - } - - public void Foo() - { - DbContext dbContext = _bookRepository.GetDbContext(); - DbSet books = _bookRepository.GetDbSet(); - } + var dbContext = await _orderRepository.GetDbContextAsync(); + var dbSet = await _orderRepository.GetDbSetAsync(); + //var dbSet = dbContext.Set(); //Alternative, when you have the DbContext } ```` -* `GetDbContext` returns a `DbContext` reference instead of `BookStoreDbContext`. You can cast it, however in most cases you don't need it. +* `GetDbContextAsync` returns a `DbContext` reference instead of `BookStoreDbContext`. You can cast it if you need. However, you don't need it in most cases. > Important: You must reference to the `Volo.Abp.EntityFrameworkCore` package from the project you want to access to the `DbContext`. This breaks encapsulation, but this is what you want in that case. @@ -742,32 +741,36 @@ If you have better logic or using an external library for bulk operations, you c - You may use example template below: ```csharp -public class MyCustomEfCoreBulkOperationProvider : IEfCoreBulkOperationProvider, ITransientDependency -{ - public async Task DeleteManyAsync(IEfCoreRepository repository, - IEnumerable entities, - bool autoSave, - CancellationToken cancellationToken) +public class MyCustomEfCoreBulkOperationProvider + : IEfCoreBulkOperationProvider, ITransientDependency +{ + public async Task DeleteManyAsync( + IEfCoreRepository repository, + IEnumerable entities, + bool autoSave, + CancellationToken cancellationToken) where TDbContext : IEfCoreDbContext where TEntity : class, IEntity { // Your logic here. } - public async Task InsertManyAsync(IEfCoreRepository repository, - IEnumerable entities, - bool autoSave, - CancellationToken cancellationToken) + public async Task InsertManyAsync( + IEfCoreRepository repository, + IEnumerable entities, + bool autoSave, + CancellationToken cancellationToken) where TDbContext : IEfCoreDbContext where TEntity : class, IEntity { // Your logic here. } - public async Task UpdateManyAsync(IEfCoreRepository repository, - IEnumerable entities, - bool autoSave, - CancellationToken cancellationToken) + public async Task UpdateManyAsync( + IEfCoreRepository repository, + IEnumerable entities, + bool autoSave, + CancellationToken cancellationToken) where TDbContext : IEfCoreDbContext where TEntity : class, IEntity { @@ -779,3 +782,4 @@ public class MyCustomEfCoreBulkOperationProvider : IEfCoreBulkOperationProvider, ## See Also * [Entities](Entities.md) +* [Repositories](Repositories.md) diff --git a/docs/en/Migration-Guides/Abp-4_2.md b/docs/en/Migration-Guides/Abp-4_2.md new file mode 100644 index 0000000000..084ae24caa --- /dev/null +++ b/docs/en/Migration-Guides/Abp-4_2.md @@ -0,0 +1,101 @@ +# ABP version 4.2 Migration Guide + +This version has no breaking changes but there is an important change on the repositories that should be applied for your application for an important performance and scalability gain. + +## IRepository.GetQueryableAsync + +`IRepository` interface inherits `IQueryable`, so you can directly use the standard LINQ extension methods, like `Where`, `OrderBy`, `First`, `Sum`... etc. + +**Example: Using LINQ directly over the repository object** + +````csharp +public class BookAppService : ApplicationService, IBookAppService +{ + private readonly IRepository _bookRepository; + + public BookAppService(IRepository bookRepository) + { + _bookRepository = bookRepository; + } + + public async Task DoItInOldWayAsync() + { + //Apply any standard LINQ extension method + var query = _bookRepository + .Where(x => x.Price > 10) + .OrderBy(x => x.Name); + + //Execute the query asynchronously + var books = await AsyncExecuter.ToListAsync(query); + } +} +```` + +*See [the documentation](https://docs.abp.io/en/abp/4.2/Repositories#iqueryable-async-operations) if you wonder what is the `AsyncExecuter`.* + +**Beginning from the version 4.2, the recommended way is using `IRepository.GetQueryableAsync()` to obtain an `IQueryable`, then use the LINQ extension methods over it.** + +**Example: Using the new GetQueryableAsync method** + +````csharp +public async Task DoItInNewWayAsync() +{ + //Use GetQueryableAsync to obtain the IQueryable first + var queryable = await _bookRepository.GetQueryableAsync(); + + //Then apply any standard LINQ extension method + var query = queryable + .Where(x => x.Price > 10) + .OrderBy(x => x.Name); + + //Finally, execute the query asynchronously + var books = await AsyncExecuter.ToListAsync(query); +} +```` + +ABP may start a database transaction when you get an `IQueryable` (If current [Unit Of Work](https://docs.abp.io/en/abp/latest/Unit-Of-Work) is transactional). In this new way, it is possible to **start the database transaction in an asynchronous way**. Previously, we could not get the advantage of asynchronous while starting the transactions. + +> **The new way has a significant performance and scalability gain. The old usage (directly using LINQ over the repositories) will be removed in the next major version (5.0).** You have a lot of time for the change, but we recommend to immediately take the action since the old usage has a big **scalability problem**. + +### Actions to Take + +* Use the repository's queryable feature as explained before. +* If you've overridden `CreateFilteredQuery` in a class derived from `CrudAppService`, you should override the `CreateFilteredQueryAsync` instead and remove the `CreateFilteredQuery` in your class. +* If you've overridden `WithDetails` in your custom repositories, remove it and override `WithDetailsAsync` instead. +* If you've used `DbContext` or `DbSet` properties in your custom repositories, use `GetDbContextAsync()` and `GetDbSetAsync()` methods instead of them. + +You can re-build your solution and check the `Obsolete` warnings to find some of the usages need to change. + +#### About IRepository Async Extension Methods + +Using IRepository Async Extension Methods has no such a problem. The examples below are pretty fine: + +````csharp +var countAll = await _personRepository + .CountAsync(); + +var count = await _personRepository + .CountAsync(x => x.Name.StartsWith("A")); + +var book1984 = await _bookRepository + .FirstOrDefaultAsync(x => x.Name == "John"); +```` + +See the [repository documentation](https://docs.abp.io/en/abp/4.2/Repositories#iqueryable-async-operations) to understand the relation between `IQueryable` and asynchronous operations. + +## .NET Package Upgrades + +ABP uses the latest 5.0.* .NET packages. If your application is using 5.0.0 packages, you may get an error on build. We recommend to depend on the .NET packages like `5.0.*` in the `.csproj` files to use the latest patch versions. + +Example: + +````xml + +```` + +## Blazorise Library Upgrade + +If you are upgrading to 4.2, you also need also upgrade the following packages in your Blazor application; + +* `Blazorise.Bootstrap` to `0.9.3-preview6` +* `Blazorise.Icons.FontAwesome` to `0.9.3-preview6` \ No newline at end of file diff --git a/docs/en/Migration-Guides/Index.md b/docs/en/Migration-Guides/Index.md index 5973ee0a0d..26fe825f50 100644 --- a/docs/en/Migration-Guides/Index.md +++ b/docs/en/Migration-Guides/Index.md @@ -1,5 +1,6 @@ # ABP Framework Migration Guides -* [3.3.x to 4.0 Migration Guide](Abp-4_0.md) -* [2.9.x to 3.0 Migration Guide](../UI/Angular/Migration-Guide-v3.md) +* [4.x to 4.2](Abp-4_2.md) +* [3.3.x to 4.0](Abp-4_0.md) +* [2.9.x to 3.0](../UI/Angular/Migration-Guide-v3.md) diff --git a/docs/en/MongoDB.md b/docs/en/MongoDB.md index 7fae9c3892..a12d216b3d 100644 --- a/docs/en/MongoDB.md +++ b/docs/en/MongoDB.md @@ -149,7 +149,7 @@ public class Book : AggregateRoot } ``` -(`BookType` is a simple enum here) And you want to create a new `Book` entity in a [domain service](Domain-Services.md): +(`BookType` is a simple `enum` here) And you want to create a new `Book` entity in a [domain service](Domain-Services.md): ```csharp public class BookManager : DomainService @@ -215,7 +215,8 @@ public class BookRepository : BookType type, CancellationToken cancellationToken = default(CancellationToken)) { - await Collection.DeleteManyAsync( + var collection = await GetCollectionAsync(cancellationToken); + await collection.DeleteManyAsync( Builders.Filter.Eq(b => b.Type, type), cancellationToken ); @@ -253,7 +254,7 @@ public async override Task DeleteAsync( ### Access to the MongoDB API -In most cases, you want to hide MongoDB APIs behind a repository (this is the main purpose of the repository). However, if you want to access the MongoDB API over the repository, you can use `GetDatabase()` or `GetCollection()` extension methods. Example: +In most cases, you want to hide MongoDB APIs behind a repository (this is the main purpose of the repository). However, if you want to access the MongoDB API over the repository, you can use `GetDatabaseAsync()`, `GetCollectionAsync()` or `GetAggregateAsync()` extension methods. Example: ```csharp public class BookService @@ -265,10 +266,11 @@ public class BookService _bookRepository = bookRepository; } - public void Foo() + public async Task FooAsync() { - IMongoDatabase database = _bookRepository.GetDatabase(); - IMongoCollection books = _bookRepository.GetCollection(); + IMongoDatabase database = await _bookRepository.GetDatabaseAsync(); + IMongoCollection books = await _bookRepository.GetCollectionAsync(); + IAggregateFluent bookAggregate = await _bookRepository.GetAggregateAsync(); } } ``` @@ -390,36 +392,45 @@ If you have better logic or using an external library for bulk operations, you c - You may use example template below: ```csharp -public class MyCustomMongoDbBulkOperationProvider : IMongoDbBulkOperationProvider, ITransientDependency +public class MyCustomMongoDbBulkOperationProvider + : IMongoDbBulkOperationProvider, ITransientDependency { - public async Task DeleteManyAsync(IMongoDbRepository repository, - IEnumerable entities, - IClientSessionHandle sessionHandle, - bool autoSave, - CancellationToken cancellationToken) + public async Task DeleteManyAsync( + IMongoDbRepository repository, + IEnumerable entities, + IClientSessionHandle sessionHandle, + bool autoSave, + CancellationToken cancellationToken) where TEntity : class, IEntity { // Your logic here. } - public async Task InsertManyAsync(IMongoDbRepository repository, - IEnumerable entities, - IClientSessionHandle sessionHandle, - bool autoSave, - CancellationToken cancellationToken) + public async Task InsertManyAsync( + IMongoDbRepository repository, + IEnumerable entities, + IClientSessionHandle sessionHandle, + bool autoSave, + CancellationToken cancellationToken) where TEntity : class, IEntity { // Your logic here. } - public async Task UpdateManyAsync(IMongoDbRepository repository, - IEnumerable entities, - IClientSessionHandle sessionHandle, - bool autoSave, - CancellationToken cancellationToken) + public async Task UpdateManyAsync( + IMongoDbRepository repository, + IEnumerable entities, + IClientSessionHandle sessionHandle, + bool autoSave, + CancellationToken cancellationToken) where TEntity : class, IEntity { // Your logic here. } } -``` \ No newline at end of file +``` + +## See Also + +* [Entities](Entities.md) +* [Repositories](Repositories.md) \ No newline at end of file diff --git a/docs/en/Repositories.md b/docs/en/Repositories.md index a2eb385094..3d0ea84821 100644 --- a/docs/en/Repositories.md +++ b/docs/en/Repositories.md @@ -222,7 +222,8 @@ public class PersonRepository : EfCoreRepository, IPe public async Task FindByNameAsync(string name) { - return await DbContext.Set() + var dbSet = await GetDbSetAsync(); + return await dbSet.Set() .Where(p => p.Name == name) .FirstOrDefaultAsync(); } @@ -235,12 +236,13 @@ You can directly access the data access provider (`DbContext` in this case) to p ## IQueryable & Async Operations -`IRepository` inherits from `IQueryable`, that means you can **directly use LINQ extension methods** on it, as shown in the example of the "*Generic Repositories*" section above. +`IRepository` provides `GetQueryableAsync()` to obtain an `IQueryable`, that means you can **directly use LINQ extension methods** on it, as shown in the example of the "*Querying / LINQ over the Repositories*" section above. **Example: Using the `Where(...)` and the `ToList()` extension methods** ````csharp -var people = _personRepository +var queryable = await _personRepository.GetQueryableAsync(); +var people = queryable .Where(p => p.Name.Contains(nameFilter)) .ToList(); ```` @@ -269,7 +271,8 @@ When you add the NuGet package to your project, you can take full power of the E **Example: Directly using the `ToListAsync()` after adding the EF Core package** ````csharp -var people = _personRepository +var queryable = await _personRepository.GetQueryableAsync(); +var people = queryable .Where(p => p.Name.Contains(nameFilter)) .ToListAsync(); ```` @@ -285,7 +288,8 @@ If you are using [MongoDB](MongoDB.md), you need to add the [Volo.Abp.MongoDB](h **Example: Cast `IQueryable` to `IMongoQueryable` and use `ToListAsync()`** ````csharp -var people = ((IMongoQueryable)_personRepository +var queryable = await _personRepository.GetQueryableAsync(); +var people = ((IMongoQueryable) queryable .Where(p => p.Name.Contains(nameFilter))) .ToListAsync(); ```` @@ -312,10 +316,11 @@ The standard LINQ extension methods are supported: *AllAsync, AnyAsync, AverageA This approach still **has a limitation**. You need to call the extension method directly on the repository object. For example, the below usage is **not supported**: ```csharp -var count = await _bookRepository.Where(x => x.Name.Contains("A")).CountAsync(); +var queryable = await _bookRepository.GetQueryableAsync(); +var count = await queryable.Where(x => x.Name.Contains("A")).CountAsync(); ``` -This is because the object returned from the `Where` method is not a repository object, it is a standard `IQueryable` interface. See the other options for such cases. +This is because the `CountAsync()` method in this example is called on a `IQueryable` interface, not on the repository object. See the other options for such cases. This method is suggested **wherever possible**. @@ -352,8 +357,11 @@ namespace AbpDemo public async Task> GetListAsync(string name) { + //Obtain the IQueryable + var queryable = await _productRepository.GetQueryableAsync(); + //Create the query - var query = _productRepository + var query = queryable .Where(p => p.Name.Contains(name)) .OrderBy(p => p.Name); diff --git a/docs/en/Road-Map.md b/docs/en/Road-Map.md index 6f4213a6bd..0920639106 100644 --- a/docs/en/Road-Map.md +++ b/docs/en/Road-Map.md @@ -18,4 +18,4 @@ You can always check the milestone planning and the prioritized backlog issues o The backlog items are subject to change. We are adding new items and changing priorities based on the community feedbacks and goals of the project. -Vote for your favorite feature on the related GitHub issues (and write your thoughts). You can create an issue on [the GitHub repository](https://github.com/abpframework/abp) for your feature requests, but first search in in the existing issues. \ No newline at end of file +Vote for your favorite feature on the related GitHub issues (and write your thoughts). You can create an issue on [the GitHub repository](https://github.com/abpframework/abp) for your feature requests, but first search in the existing issues. diff --git a/docs/en/Specifications.md b/docs/en/Specifications.md index 036baa749e..bfe1d031d3 100644 --- a/docs/en/Specifications.md +++ b/docs/en/Specifications.md @@ -122,7 +122,8 @@ namespace MyProject public async Task> GetCustomersCanBuyAlcohol() { - var query = _customerRepository.Where( + var queryable = await _customerRepository.GetQueryableAsync(); + var query = queryable.Where( new Age18PlusCustomerSpecification().ToExpression() ); @@ -137,7 +138,8 @@ namespace MyProject Actually, using the `ToExpression()` method is not necessary since the specifications are automatically casted to Expressions. This would also work: ````csharp -var query = _customerRepository.Where( +var queryable = await _customerRepository.GetQueryableAsync(); +var query = queryable.Where( new Age18PlusCustomerSpecification() ); ```` diff --git a/docs/en/Startup-Templates/Module.md b/docs/en/Startup-Templates/Module.md index 2dc0896c65..84b7525944 100644 --- a/docs/en/Startup-Templates/Module.md +++ b/docs/en/Startup-Templates/Module.md @@ -1,4 +1,4 @@ -# MVC Module Startup Template +# Module Startup Template This template can be used to create a **reusable [application module](../Modules/Index.md)** based on the [module development best practices & conventions](../Best-Practices/Index.md). It is also suitable for creating **microservices** (with or without UI). @@ -20,6 +20,20 @@ abp new Acme.IssueManagement -t module - `Acme.IssueManagement` is the solution name, like *YourCompany.YourProduct*. You can use single level, two-levels or three-levels naming. +### Specify the UI Framework + +This template provides multiple UI frameworks: + +* `mvc`: ASP.NET Core MVC UI with Razor Pages (default) +* `blazor`: Blazor UI +* `angular`: Angular UI + +Use `-u` or `--ui` option to specify the UI framework: + +````bash +abp new Acme.IssueManagement -t module -u angular +```` + ### Without User Interface The template comes with an MVC UI by default. You can use `--no-ui` option to not include the UI layer. @@ -160,3 +174,91 @@ You should run the application with the given order: - First, run the `.IdentityServer` since other applications depends on it. - Then run the `.HttpApi.Host` since it is used by the `.Web.Host` application. - Finally, you can run the `.Web.Host` project and login to the application using `admin` as the username and `1q2w3E*` as the password. + +## UI + +### Angular UI + +If you choose `Angular` as the UI framework (using the `-u angular` option), the solution will have a folder called `angular` in it. This is where the client-side code is located. When you open that folder in an IDE, the folder structure will look like below: + +![Folder structure of ABP Angular module project](../images/angular-module-folder-structure.png) + +* _angular/projects/issue-management_ folder contains the Angular module project. +* _angular/projects/dev-app_ folder contains a development application that runs your module. + +The server-side is similar to the solution described above. `*.HttpApi.Host` project serves the API and the `Angular` demo application consumes it. You will not need to run the `.Web.Host` project though. + +#### How to Run the Angular Development App + +For module development, you will need the `dev-app` project up and running. So, here is how we can start the development server. + +First, we need to install dependencies: + +1. Open your terminal at the root folder, i.e. `angular`. +2. Run `yarn` or `npm install`. + +The dependencies will be installed and some of them are ABP modules published as NPM packages. To see all ABP packages, you can run the following command in the `angular` folder: + +```bash +yarn list --pattern abp +``` + +> There is no equivalent of this command in npm. + +The module you will develop depends on two of these ABP packages: _@abp/ng.core_ and _@abp/ng.theme.shared_. Rest of the ABP modules are included in _package.json_ because of the `dev-app` project. + +Once all dependencies are installed, follow the steps below to serve your development app: + +1. Make sure `.IdentityServer` and `*.HttpApi.Host` projects are up and running. +2. Open your terminal at the root folder, i.e. `angular`. +3. Run `yarn start` or `npm start`. + +![ABP Angular module dev-app project](../images/angular-module-dev-app-project.png) + +The issue management page is empty in the beginning. You may change the content in `IssueManagementComponent` at the _angular/projects/issue-management/src/lib/issue-management.component.ts_ path and observe that the view changes accordingly. + +Now, let's have a closer look at some key elements of your project. + +#### Main Module + +`IssueManagementModule` at the _angular/projects/issue-management/src/lib/issue-management.module.ts_ path is the main module of your module project. There are a few things worth mentioning in it: + +- Essential ABP modules, i.e. `CoreModule` and `ThemeSharedModule`, are imported. +- `IssueManagementRoutingModule` is imported. +- `IssueManagementComponent` is declared. +- It is prepared for configurability. The `forLazy` static method enables [a configuration to be passed to the module when it is loaded by the router](https://volosoft.com/blog/how-to-configure-angular-modules-loaded-by-the-router). + + +#### Main Routing Module + +`IssueManagementRoutingModule` at the _angular/projects/issue-management/src/lib/issue-management-routing.module.ts_ path is the main routing module of your module project. It currently does two things: + +- Loads `DynamicLayoutComponent` at base path it is given. +- Loads `IssueManagementComponent` as child to the layout, again at the given base path. + +You can rearrange this module to load more than one component at different routes, but you need to update the route provider at _angular/projects/issue-management/config/src/providers/route.provider.ts_ to match the new routing structure with the routes in the menu. Please check [Modifying the Menu](../UI/Angular/Modifying-the-Menu.md) to see how route providers work. + +#### Config Module + +There is a config module at the _angular/projects/issue-management/config/src/issue-management-config.module.ts_ path. The static `forRoot` method of this module is supposed to be called at the route level. So, you may assume the following will take place: + +```js +@NgModule({ + imports: [ + /* other imports */ + + IssueManagementConfigModule.forRoot(), + ], + + /* rest of the module meta data */ +}) +export class AppModule {} +``` + +You can use this static method to configure an application that uses your module project. An example of such configuration is already implemented and the `ISSUE_MANAGEMENT_ROUTE_PROVIDERS` token is provided here. The method can take options which enables further configuration possibilities. + +The difference between the `forRoot` method of the config module and the `forLazy` method of the main module is that, for smallest bundle size, the former should only be used when you have to configure an app before your module is even loaded. + +#### Testing Angular UI + +Please see the [testing document](../UI/Angular/Testing.md). diff --git a/docs/en/Tutorials/Part-1.md b/docs/en/Tutorials/Part-1.md index 3348679420..4667b8e539 100644 --- a/docs/en/Tutorials/Part-1.md +++ b/docs/en/Tutorials/Part-1.md @@ -189,6 +189,8 @@ Add-Migration "Created_Book_Entity" ![bookstore-pmc-add-book-migration](./images/bookstore-pmc-add-book-migration-v2.png) +> If you get an error like "*Your startup project ... doesn't reference Microsoft.EntityFrameworkCore.Design. This package is required for the Entity Framework Core Tools to work*", right click to the `Acme.BookStore.EntityFrameworkCore.DbMigrations` project and **Set as the Startup Project** and try again. + This will create a new migration class inside the `Migrations` folder of the `Acme.BookStore.EntityFrameworkCore.DbMigrations` project. Before updating the database, read the section below to learn how to seed some initial data to the database. diff --git a/docs/en/Tutorials/Part-10.md b/docs/en/Tutorials/Part-10.md index a9de3a062e..ec68dfe955 100644 --- a/docs/en/Tutorials/Part-10.md +++ b/docs/en/Tutorials/Part-10.md @@ -364,10 +364,11 @@ namespace Acme.BookStore.Books public override async Task GetAsync(Guid id) { - await CheckGetPolicyAsync(); + //Get the IQueryable from the repository + var queryable = await Repository.GetQueryableAsync(); //Prepare a query to join books and authors - var query = from book in Repository + var query = from book in queryable join author in _authorRepository on book.AuthorId equals author.Id where book.Id == id select new { book, author }; @@ -384,17 +385,24 @@ namespace Acme.BookStore.Books return bookDto; } - public override async Task> GetListAsync( - PagedAndSortedResultRequestDto input) + public override async Task> GetListAsync(PagedAndSortedResultRequestDto input) { - await CheckGetListPolicyAsync(); + //Set a default sorting, if not provided + if (input.Sorting.IsNullOrWhiteSpace()) + { + input.Sorting = nameof(Book.Name); + } + + //Get the IQueryable from the repository + var queryable = await Repository.GetQueryableAsync(); //Prepare a query to join books and authors - var query = from book in Repository + var query = from book in queryable join author in _authorRepository on book.AuthorId equals author.Id - orderby input.Sorting + orderby input.Sorting //TODO: Can not sort like that! select new {book, author}; + //Paging query = query .Skip(input.SkipCount) .Take(input.MaxResultCount); @@ -437,7 +445,7 @@ Let's see the changes we've done: * Injected `IAuthorRepository` to query from the authors. * Overrode the `GetAsync` method of the base `CrudAppService`, which returns a single `BookDto` object with the given `id`. * Used a simple LINQ expression to join books and authors and query them together for the given book id. - * Used `AsyncExecuter.FirstOrDefaultAsync(...)` to execute the query and get a result. `AsyncExecuter` was previously used in the `AuthorAppService`. Check the [repository documentation](../Repositories.md) to understand why we've used it. + * Used `AsyncExecuter.FirstOrDefaultAsync(...)` to execute the query and get a result. It is a way to use asynchronous LINQ extensions without depending on the database provider API. Check the [repository documentation](../Repositories.md) to understand why we've used it. * Throws an `EntityNotFoundException` which results an `HTTP 404` (not found) result if requested book was not present in the database. * Finally, created a `BookDto` object using the `ObjectMapper`, then assigning the `AuthorName` manually. * Overrode the `GetListAsync` method of the base `CrudAppService`, which returns a list of books. The logic is similar to the previous method, so you can easily understand the code. @@ -487,8 +495,6 @@ namespace Acme.BookStore.Books public async override Task GetAsync(Guid id) { - await CheckGetPolicyAsync(); - var book = await Repository.GetAsync(id); var bookDto = ObjectMapper.Map(book); @@ -501,17 +507,18 @@ namespace Acme.BookStore.Books public async override Task> GetListAsync(PagedAndSortedResultRequestDto input) { - await CheckGetListPolicyAsync(); - //Set a default sorting, if not provided if (input.Sorting.IsNullOrWhiteSpace()) { input.Sorting = nameof(Book.Name); } + + //Get the IQueryable from the repository + var queryable = await Repository.GetQueryableAsync(); //Get the books var books = await AsyncExecuter.ToListAsync( - Repository + queryable .OrderBy(input.Sorting) .Skip(input.SkipCount) .Take(input.MaxResultCount) @@ -553,8 +560,10 @@ namespace Acme.BookStore.Books .Distinct() .ToArray(); + var queryable = await _authorRepository.GetQueryableAsync(); + var authors = await AsyncExecuter.ToListAsync( - _authorRepository.Where(a => authorIds.Contains(a.Id)) + queryable.Where(a => authorIds.Contains(a.Id)) ); return authors.ToDictionary(x => x.Id, x => x); diff --git a/docs/en/Tutorials/Part-2.md b/docs/en/Tutorials/Part-2.md index 7bc42b1fc9..627b55a476 100644 --- a/docs/en/Tutorials/Part-2.md +++ b/docs/en/Tutorials/Part-2.md @@ -103,7 +103,7 @@ Before starting to the UI development, we first want to prepare the localization Localization texts are located under the `Localization/BookStore` folder of the `Acme.BookStore.Domain.Shared` project: -![bookstore-localization-files](./images/bookstore-localization-files-v2.png) +![bookstore-localization-files](images/bookstore-localization-files-v2.png) Open the `en.json` (*the English translations*) file and change the content as below: @@ -157,7 +157,7 @@ It's time to create something visible and usable! Instead of classic MVC, we wil Create `Books` folder under the `Pages` folder of the `Acme.BookStore.Web` project. Add a new Razor Page by right clicking the Books folder then selecting **Add > Razor Page** menu item. Name it as `Index`: -![bookstore-add-index-page](./images/bookstore-add-index-page-v2.png) +![bookstore-add-index-page](images/bookstore-add-index-page-v2.png) Open the `Index.cshtml` and change the whole content as shown below: @@ -208,7 +208,7 @@ context.Menu.AddItem( Run the project, login to the application with the username `admin` and the password `1q2w3E*` and see the new menu item has been added to the main menu: -![bookstore-menu-items](./images/bookstore-new-menu-item.png) +![bookstore-menu-items](images/bookstore-new-menu-item.png) When you click to the Books menu item under the Book Store parent, you are being redirected to the new empty Books Page. @@ -250,7 +250,7 @@ Change the `Pages/Books/Index.cshtml` as following: Create an `Index.js` file under the `Pages/Books` folder: -![bookstore-index-js-file](./images/bookstore-index-js-file-v3.png) +![bookstore-index-js-file](images/bookstore-index-js-file-v3.png) The content of the file is shown below: @@ -344,8 +344,6 @@ It's time to create something visible and usable! There are some tools that we w - [Ng Bootstrap](https://ng-bootstrap.github.io/#/home) will be used as the UI component library. - [Ngx-Datatable](https://swimlane.gitbook.io/ngx-datatable/) will be used as the datatable library. -### BookModule - Run the following command line to create a new module, named `BookModule` in the root folder of the angular application: ```bash @@ -457,7 +455,7 @@ abp generate-proxy This command will create the following files under the `/src/app/proxy/books` folder: -![Generated files](./images/generated-proxies-3.png) +![Generated files](images/generated-proxies-3.png) ### BookComponent @@ -490,7 +488,7 @@ export class BookComponent implements OnInit { ``` * We imported and injected the generated `BookService`. -* We are using the [ListService](https://docs.abp.io/en/abp/latest/UI/Angular/List-Service), a utility service of the ABP Framework which provides easy pagination, sorting and searching. +* We are using the [ListService](../UI/Angular/List-Service.md), a utility service of the ABP Framework which provides easy pagination, sorting and searching. Open the `/src/app/book/book.component.html` and replace the content as below: @@ -531,7 +529,7 @@ Open the `/src/app/book/book.component.html` and replace the content as below: Now you can see the final result on your browser: -![Book list final result](./images/bookstore-book-list.png) +![Book list final result](images/bookstore-book-list.png) {{else if UI == "Blazor"}} diff --git a/docs/en/Tutorials/Part-3.md b/docs/en/Tutorials/Part-3.md index e58857ec89..ec326ddb65 100644 --- a/docs/en/Tutorials/Part-3.md +++ b/docs/en/Tutorials/Part-3.md @@ -48,13 +48,13 @@ This part is also recorded as a video tutorial and ** Localization key names are arbitrary and no forcing rule. But we prefer the convention used above. +> Localization key names are arbitrary and there is no forcing rule. But we prefer the convention used above. ### Permission Management UI diff --git a/docs/en/Tutorials/Part-6.md b/docs/en/Tutorials/Part-6.md index 69c6574520..d5df8133b7 100644 --- a/docs/en/Tutorials/Part-6.md +++ b/docs/en/Tutorials/Part-6.md @@ -124,7 +124,7 @@ Created this class inside the `Acme.BookStore.Domain.Shared` project since we wi ## AuthorManager: The Domain Service -`Author` constructor and `ChangeName` method is `internal`, so they can be usable only in the domain layer. Create an `AuthorManager` class in the `Authors` folder (namespace) of the `Acme.BookStore.Domain` project: +`Author` constructor and `ChangeName` methods are `internal`, so they can be used only in the domain layer. Create an `AuthorManager` class in the `Authors` folder (namespace) of the `Acme.BookStore.Domain` project: ````csharp using System; @@ -186,7 +186,7 @@ namespace Acme.BookStore.Authors * `AuthorManager` forces to create an author and change name of an author in a controlled way. The application layer (will be introduced later) will use these methods. -> **DDD tip**: Do not introduce domain service methods unless they are really needed and perform some core business rules. For this case, we needed to this service to be able to force the unique name constraint. +> **DDD tip**: Do not introduce domain service methods unless they are really needed and perform some core business rules. For this case, we needed this service to be able to force the unique name constraint. Both methods checks if there is already an author with the given name and throws a special business exception, `AuthorAlreadyExistsException`, defined in the `Acme.BookStore.Domain` project (in the `Authors` folder) as shown below: @@ -226,7 +226,7 @@ This is a unique string represents the error code thrown by your application and "BookStore:00001": "There is already an author with the same name: {name}" ```` -Whenever you throw an `AuthorAlreadyExistsException`, the end use will see a this message on the UI. +Whenever you throw an `AuthorAlreadyExistsException`, the end user will see a nice error message on the UI. ## IAuthorRepository diff --git a/docs/en/Tutorials/Part-7.md b/docs/en/Tutorials/Part-7.md index 97d28691ae..e14237fd59 100644 --- a/docs/en/Tutorials/Part-7.md +++ b/docs/en/Tutorials/Part-7.md @@ -70,7 +70,7 @@ This is just like done for the `Book` entity before, so no need to explain again ## Create a new Database Migration -Open the **Package Manager Console** on Visual Studio and ensure that the **Default project** is `Acme.BookStore.EntityFrameworkCore.DbMigrations` in the Package Manager Console, as shown on the picture below. Also, set the `Acme.BookStore.Web` (or `Acme.BookStore.HttpApi.Host`, depending on your solution) as the **startup project** (right click it on the solution explorer and click to "Set as Startup Project"). +Open the **Package Manager Console** on Visual Studio and ensure that the **Default project** is `Acme.BookStore.EntityFrameworkCore.DbMigrations` in the Package Manager Console, as shown on the picture below. Also, set this project as the **startup project** (right click it on the solution explorer and click to "Set as Startup Project"). Run the following command to create a new database migration: @@ -127,7 +127,8 @@ namespace Acme.BookStore.Authors public async Task FindByNameAsync(string name) { - return await DbSet.FirstOrDefaultAsync(author => author.Name == name); + var dbSet = await GetDbSetAsync(); + return await dbSet.FirstOrDefaultAsync(author => author.Name == name); } public async Task> GetListAsync( @@ -136,7 +137,8 @@ namespace Acme.BookStore.Authors string sorting, string filter = null) { - return await DbSet + var dbSet = await GetDbSetAsync(); + return await dbSet .WhereIf( !filter.IsNullOrWhiteSpace(), author => author.Name.Contains(filter) @@ -186,8 +188,8 @@ namespace Acme.BookStore.Authors public async Task FindByNameAsync(string name) { - return await GetMongoQueryable() - .FirstOrDefaultAsync(author => author.Name == name); + var queryable = await GetMongoQueryableAsync(); + return await queryable.FirstOrDefaultAsync(author => author.Name == name); } public async Task> GetListAsync( @@ -196,7 +198,8 @@ namespace Acme.BookStore.Authors string sorting, string filter = null) { - return await GetMongoQueryable() + var queryable = await GetMongoQueryableAsync(); + return await queryable .WhereIf>( !filter.IsNullOrWhiteSpace(), author => author.Name.Contains(filter) diff --git a/docs/en/Tutorials/Part-8.md b/docs/en/Tutorials/Part-8.md index b7c805c17e..6ab14c714c 100644 --- a/docs/en/Tutorials/Part-8.md +++ b/docs/en/Tutorials/Part-8.md @@ -172,6 +172,7 @@ using System.Threading.Tasks; using Acme.BookStore.Permissions; using Microsoft.AspNetCore.Authorization; using Volo.Abp.Application.Dtos; +using Volo.Abp.Domain.Repositories; namespace Acme.BookStore.Authors { @@ -230,12 +231,10 @@ public async Task> GetListAsync(GetAuthorListDto input input.Filter ); - var totalCount = await AsyncExecuter.CountAsync( - _authorRepository.WhereIf( - !input.Filter.IsNullOrWhiteSpace(), - author => author.Name.Contains(input.Filter) - ) - ); + var totalCount = input.Filter == null + ? await _authorRepository.CountAsync() + : await _authorRepository.CountAsync( + author => author.Name.Contains(input.Filter)); return new PagedResultDto( totalCount, @@ -246,7 +245,7 @@ public async Task> GetListAsync(GetAuthorListDto input * Default sorting is "by author name" which is done in the beginning of the method in case of it wasn't sent by the client. * Used the `IAuthorRepository.GetListAsync` to get a paged, sorted and filtered list of authors from the database. We had implemented it in the previous part of this tutorial. Again, it actually was not needed to create such a method since we could directly query over the repository, but wanted to demonstrate how to create custom repository methods. -* Directly queried from the `AuthorRepository` while getting the count of the authors. We preferred to use the `AsyncExecuter` service which allows us to perform async queries without depending on the EF Core. However, you could depend on the EF Core package and directly use the `_authorRepository.WhereIf(...).ToListAsync()` method. See the [repository document](../Repositories.md) to read the alternative approaches and the discussion. +* Directly queried from the `AuthorRepository` while getting the count of the authors. If a filter is sent, then we are using it to filter entities while getting the count. * Finally, returning a paged result by mapping the list of `Author`s to a list of `AuthorDto`s. ### CreateAsync diff --git a/docs/en/Tutorials/Part-9.md b/docs/en/Tutorials/Part-9.md index a1b4b03e21..c623cfcf46 100644 --- a/docs/en/Tutorials/Part-9.md +++ b/docs/en/Tutorials/Part-9.md @@ -843,8 +843,10 @@ Create a new Razor Component Page, `/Pages/Authors.razor`, in the `Acme.BookStor ````xml @page "/authors" @using Acme.BookStore.Authors +@using Acme.BookStore.Localization @inherits BookStoreComponentBase @inject IAuthorAppService AuthorAppService +@inject AbpBlazorMessageLocalizerHelper LH @@ -917,68 +919,104 @@ Create a new Razor Component Page, `/Pages/Authors.razor`, in the `Acme.BookStor - - @L["NewAuthor"] - - - - - @L["Name"] - - - - @L["BirthDate"] - - - - @L["ShortBio"] - - - - - - - +
+ + @L["NewAuthor"] + + + + + + + @L["Name"] + + + + + + + + + @L["BirthDate"] + + + + + @L["ShortBio"] + + + + + + + + + + + + + +
- - @EditingAuthor.Name - - - - - @L["Name"] - - - - @L["BirthDate"] - - - - @L["ShortBio"] - - - - - - - +
+ + @EditingAuthor.Name + + + + + + + @L["Name"] + + + + + + + + + @L["BirthDate"] + + + + + @L["ShortBio"] + + + + + + + + + + + + + +
```` @@ -1025,6 +1063,10 @@ namespace Acme.BookStore.Blazor.Pages private Modal CreateAuthorModal { get; set; } private Modal EditAuthorModal { get; set; } + private Validations CreateValidationsRef; + + private Validations EditValidationsRef; + public Authors() { NewAuthor = new CreateAuthorDto(); @@ -1079,6 +1121,8 @@ namespace Acme.BookStore.Blazor.Pages private void OpenCreateAuthorModal() { + CreateValidationsRef.ClearAll(); + NewAuthor = new CreateAuthorDto(); CreateAuthorModal.Show(); } @@ -1090,6 +1134,8 @@ namespace Acme.BookStore.Blazor.Pages private void OpenEditAuthorModal(AuthorDto author) { + EditValidationsRef.ClearAll(); + EditingAuthorId = author.Id; EditingAuthor = ObjectMapper.Map(author); EditAuthorModal.Show(); @@ -1114,16 +1160,22 @@ namespace Acme.BookStore.Blazor.Pages private async Task CreateAuthorAsync() { - await AuthorAppService.CreateAsync(NewAuthor); - await GetAuthorsAsync(); - CreateAuthorModal.Hide(); + if (CreateValidationsRef.ValidateAll()) + { + await AuthorAppService.CreateAsync(NewAuthor); + await GetAuthorsAsync(); + CreateAuthorModal.Hide(); + } } private async Task UpdateAuthorAsync() { - await AuthorAppService.UpdateAsync(EditingAuthorId, EditingAuthor); - await GetAuthorsAsync(); - EditAuthorModal.Hide(); + if (EditValidationsRef.ValidateAll()) + { + await AuthorAppService.UpdateAsync(EditingAuthorId, EditingAuthor); + await GetAuthorsAsync(); + EditAuthorModal.Hide(); + } } } } diff --git a/docs/en/UI/Angular/Component-Replacement.md b/docs/en/UI/Angular/Component-Replacement.md index 54a1869c0e..0010a30a2f 100644 --- a/docs/en/UI/Angular/Component-Replacement.md +++ b/docs/en/UI/Angular/Component-Replacement.md @@ -546,4 +546,5 @@ The final UI looks like below: ## See Also +- [How Replaceable Components Work with Extensions](./How-Replaceable-Components-Work-with-Extensions.md) - [How to Replace PermissionManagementComponent](./Permission-Management-Component-Replacement.md) diff --git a/docs/en/UI/Angular/Ellipsis-Directive.md b/docs/en/UI/Angular/Ellipsis-Directive.md new file mode 100644 index 0000000000..c462331574 --- /dev/null +++ b/docs/en/UI/Angular/Ellipsis-Directive.md @@ -0,0 +1,83 @@ +# Ellipsis + +Text inside an HTML element can be truncated easily with an ellipsis by using CSS. To make this even easier, you can use the `EllipsisDirective` which has been exposed by the `@abp/ng.theme.shared` package. + + +## Getting Started + +In order to use the `EllipsisDirective` in an HTML template, the **`ThemeSharedModule`** should be imported into your module like this: + +```js +// ... +import { ThemeSharedModule } from '@abp/ng.theme.shared'; + +@NgModule({ + //... + imports: [..., ThemeSharedModule], +}) +export class MyFeatureModule {} +``` + +or **if you would not like to import** the `ThemeSharedModule`, you can import the **`EllipsisModule`** as shown below: + + +```js +// ... +import { EllipsisModule } from '@abp/ng.theme.shared'; + +@NgModule({ + //... + imports: [..., EllipsisModule], +}) +export class MyFeatureModule {} +``` + +## Usage + +The `EllipsisDirective` is very easy to use. The directive's selector is **`abpEllipsis`**. By adding the `abpEllipsis` attribute to an HTML element, you can activate the `EllipsisDirective` for the HTML element. + +See an example usage: + +```html +

+ Lorem ipsum dolor sit, amet consectetur adipisicing elit. Laboriosam commodi quae aspernatur, + corporis velit et suscipit id consequuntur amet minima expedita cum reiciendis dolorum + cupiditate? Voluptas eaque voluptatum odio deleniti quo vel illum nemo accusamus nulla ratione + impedit dolorum expedita necessitatibus fugiat ullam beatae, optio eum cupiditate ducimus + architecto. +

+``` + +The `abpEllipsis` attribute has been added to the `

` element that containing very long text inside to activate the `EllipsisDirective`. + +See the result: + +![Ellipsis directive result](./images/ellipsis-directive-result1.jpg) + +The long text has been truncated by using the directive. + +The UI before using the directive looks like this: + +![Before using the EllipsisDirective](./images/ellipsis-directive-before.jpg) + +### Specifying Max Width of an HTML Element + +An HTML element max width can be specified as shown below: + +```html +

+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Cumque, optio! +
+ +
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Cumque, optio! +
+ +
+ Lorem ipsum dolor sit amet consectetur adipisicing elit. Cumque, optio! +
+``` + +See the result: + +![Ellipsis directive result 2](./images/ellipsis-directive-result2.jpg) \ No newline at end of file diff --git a/docs/en/UI/Angular/Environment.md b/docs/en/UI/Angular/Environment.md index 8c6fb28ce7..9802eb6264 100644 --- a/docs/en/UI/Angular/Environment.md +++ b/docs/en/UI/Angular/Environment.md @@ -138,10 +138,10 @@ You can use the `getEnvironment` or `getEnvironment$` method of `EnvironmentServ ```js // this.environment is instance of EnvironmentService -const environment = this.environment.getAll(); +const environment = this.environment.getEnvironment(); // or -this.environment.getAll$().subscribe(environment => { +this.environment.getEnvironment$().subscribe(environment => { // use environment here }) ``` @@ -166,7 +166,7 @@ This method returns the `url` of a specific API based on the key given as its on #### How to Set the Environment -`EnvironmentService` has a method named `setState` which allow you to set the state value. +`EnvironmentService` has a method named `setState` which allows you to set the state value. ```js // this.environment is instance of EnvironmentService diff --git a/docs/en/UI/Angular/How-Replaceable-Components-Work-with-Extensions.md b/docs/en/UI/Angular/How-Replaceable-Components-Work-with-Extensions.md new file mode 100644 index 0000000000..d942975646 --- /dev/null +++ b/docs/en/UI/Angular/How-Replaceable-Components-Work-with-Extensions.md @@ -0,0 +1,288 @@ +# How Replaceable Components Work with Extensions + +Additional UI extensibility points ([Entity action extensions](https://docs.abp.io/en/abp/latest/UI/Angular/Entity-Action-Extensions), [data table column extensions](https://docs.abp.io/en/abp/latest/UI/Angular/Data-Table-Column-Extensions), [page toolbar extensions](https://docs.abp.io/en/abp/latest/UI/Angular/Page-Toolbar-Extensions) and others) are used in ABP pages to allow to control entity actions, table columns and page toolbar of a page. If you replace a page, you need to apply some configurations to be able to work extension components in your component. Let's see how to do this by replacing the roles page. + +Create a new module called `MyRolesModule`: + +```bash +yarn ng generate module my-roles --module app +``` + +Create a new component called `MyRolesComponent`: + +```bash +yarn ng generate component my-roles/my-roles --flat --export +``` + +Open the generated `src/app/my-roles/my-roles.component.ts` file and replace its content with the following: + +```js +import { ListService, PagedAndSortedResultRequestDto } from '@abp/ng.core'; +import { + CreateRole, + DeleteRole, + eIdentityComponents, + GetRoleById, + GetRoles, + IdentityRoleDto, + IdentityState, + RolesComponent, + UpdateRole, +} from '@abp/ng.identity'; +import { ePermissionManagementComponents } from '@abp/ng.permission-management'; +import { Confirmation, ConfirmationService } from '@abp/ng.theme.shared'; +import { + EXTENSIONS_IDENTIFIER, + FormPropData, + generateFormFromProps, +} from '@abp/ng.theme.shared/extensions'; +import { Component, Injector, OnInit } from '@angular/core'; +import { FormGroup } from '@angular/forms'; +import { Select, Store } from '@ngxs/store'; +import { Observable } from 'rxjs'; +import { finalize, pluck } from 'rxjs/operators'; + +@Component({ + selector: 'app-my-roles', + templateUrl: './my-roles.component.html', + providers: [ + ListService, + { + provide: EXTENSIONS_IDENTIFIER, + useValue: eIdentityComponents.Roles, + }, + { provide: RolesComponent, useExisting: MyRolesComponent }, + ], +}) +export class MyRolesComponent implements OnInit { + @Select(IdentityState.getRoles) + data$: Observable; + + @Select(IdentityState.getRolesTotalCount) + totalCount$: Observable; + + form: FormGroup; + + selected: IdentityRoleDto; + + isModalVisible: boolean; + + visiblePermissions = false; + + providerKey: string; + + modalBusy = false; + + permissionManagementKey = ePermissionManagementComponents.PermissionManagement; + + onVisiblePermissionChange = event => { + this.visiblePermissions = event; + }; + + constructor( + public readonly list: ListService, + protected confirmationService: ConfirmationService, + protected store: Store, + protected injector: Injector + ) {} + + ngOnInit() { + this.hookToQuery(); + } + + buildForm() { + const data = new FormPropData(this.injector, this.selected); + this.form = generateFormFromProps(data); + } + + openModal() { + this.buildForm(); + this.isModalVisible = true; + } + + add() { + this.selected = {} as IdentityRoleDto; + this.openModal(); + } + + edit(id: string) { + this.store + .dispatch(new GetRoleById(id)) + .pipe(pluck('IdentityState', 'selectedRole')) + .subscribe(selectedRole => { + this.selected = selectedRole; + this.openModal(); + }); + } + + save() { + if (!this.form.valid) return; + this.modalBusy = true; + + this.store + .dispatch( + this.selected.id + ? new UpdateRole({ ...this.selected, ...this.form.value, id: this.selected.id }) + : new CreateRole(this.form.value) + ) + .pipe(finalize(() => (this.modalBusy = false))) + .subscribe(() => { + this.isModalVisible = false; + this.list.get(); + }); + } + + delete(id: string, name: string) { + this.confirmationService + .warn('AbpIdentity::RoleDeletionConfirmationMessage', 'AbpIdentity::AreYouSure', { + messageLocalizationParams: [name], + }) + .subscribe((status: Confirmation.Status) => { + if (status === Confirmation.Status.confirm) { + this.store.dispatch(new DeleteRole(id)).subscribe(() => this.list.get()); + } + }); + } + + private hookToQuery() { + this.list.hookToQuery(query => this.store.dispatch(new GetRoles(query))).subscribe(); + } + + openPermissionsModal(providerKey: string) { + this.providerKey = providerKey; + setTimeout(() => { + this.visiblePermissions = true; + }, 0); + } + + sort(data) { + const { prop, dir } = data.sorts[0]; + this.list.sortKey = prop; + this.list.sortOrder = dir; + } +} +``` + +```js + { + provide: EXTENSIONS_IDENTIFIER, + useValue: eIdentityComponents.Roles, + }, + { + provide: RolesComponent, + useExisting: MyRolesComponent + } +``` + +The two providers we have defined in `MyRolesComponent` are required for the extension components to work correctly. + +* With the first provider, we defined the extension identifier for using `RolesComponent`'s extension actions in the `MyRolesComponent`. +* With the second provider, we have replaced the `RolesComponent` injection with the `MyRolesComponent`. Default extension actions of the `RolesComponent` try to get `RolesComponent` instance. However, the actions can get the `MyRolesComponent` instance after defining the second provider. + +Open the generated `src/app/my-role/my-role.component.html` file and replace its content with the following: + +```html +
+
+
+
+
My Roles
+
+
+ +
+
+
+ +
+ +
+
+ + + +

{%{{{ (selected?.id ? 'AbpIdentity::Edit' : 'AbpIdentity::NewRole') | abpLocalization }}}%}

+
+ + +
+ +
+
+ + + + {%{{{ + 'AbpIdentity::Save' | abpLocalization + }}}%} + +
+ + + +``` + +We have added the `abp-page-toolbar`, `abp-extensible-table`, and `abp-extensible-form` extension components to template of the `MyRolesComponent`. + +You should import the required modules for the `MyRolesComponent` to `MyRolesModule`. Open the `src/my-roles/my-roles.module.ts` file and replace the content with the following: + +```js +import { UiExtensionsModule } from '@abp/ng.theme.shared/extensions'; +import { NgModule } from '@angular/core'; +import { SharedModule } from '../shared/shared.module'; +import { MyRolesComponent } from './my-roles.component'; +import { PermissionManagementModule } from '@abp/ng.permission-management'; + +@NgModule({ + declarations: [MyRolesComponent], + imports: [SharedModule, UiExtensionsModule, PermissionManagementModule], + exports: [MyRolesComponent], +}) +export class MyRolesModule {} +``` + +- `UiExtensionsModule` imported to be able to use the extension components in your component. +- `PermissionManagementModule` imported to be able to use the `abp-permission-*management` in your component. + +As the last step, it is needs to be replaced the `RolesComponent` with the `MyRolesComponent`. Open the `app.component.ts` and modify its content as shown below: + +```js +import { ReplaceableComponentsService } from '@abp/ng.core'; +import { eIdentityComponents } from '@abp/ng.identity'; +import { MyRolesComponent } from './my-roles/my-roles.component'; + +@Component(/* component metadata */) +export class AppComponent { + constructor(private replaceableComponents: ReplaceableComponentsService) { + this.replaceableComponents.add({ component: MyRolesComponent, key: eIdentityComponents.Roles }); + } +} +``` + +After the steps above, the `RolesComponent` has been successfully replaced with the `MyRolesComponent`. When you navigate to the `/identity/roles` URL, you will see the `MyRolesComponent`'s template and see the extension components working correctly. + +![my-roles-component-with-extensions](./images/my-roles-component-with-extensions.jpg) + +![my-roles-component-form-extensions](./images/my-roles-component-form-extensions.jpg) diff --git a/docs/en/UI/Angular/Modal.md b/docs/en/UI/Angular/Modal.md new file mode 100644 index 0000000000..f1583d4813 --- /dev/null +++ b/docs/en/UI/Angular/Modal.md @@ -0,0 +1,248 @@ +# Modal + +`ModalComponent` is a pre-built component exposed by `@abp/ng.theme.shared` package to show modals. The component uses the [`ng-bootstrap`](https://ng-bootstrap.github.io/)'s modal service inside to render a modal. + +The `abp-modal` provides some additional benefits: + + - It is **flexible**. You can pass header, body, footer templates easily by adding the templates to the `abp-modal` content. It can also be implemented quickly. + - Provides several inputs be able to customize the modal and several outputs be able to listen to some events. + - Automatically detects the close button which has a `#abpClose` template variable and closes the modal when pressed this button. + - Automatically detects the `abp-button` and triggers its loading spinner when the `busy` input value of the modal component is true. + - Automatically checks if the form inside the modal **has changed, but not saved**. It warns the user by displaying a [confirmation popup](Confirmation-Service) in this case when a user tries to close the modal or refresh/close the tab of the browser. + + +> Note: A modal can also be rendered by using the `ng-bootstrap` modal. For further information, see [Modal doc](https://ng-bootstrap.github.io/#/components/modal) on the `ng-bootstrap` documentation. + +## Getting Started + +In order to use the `abp-modal` in an HTML template, the **`ThemeSharedModule`** should be imported into your module like this: + +```js +// ... +import { ThemeSharedModule } from '@abp/ng.theme.shared'; + +@NgModule({ + //... + imports: [..., ThemeSharedModule], +}) +export class MyFeatureModule {} +``` + +## Usage + +You can add the `abp-modal` to your component very quickly. See an example: + +```html + + + + + + +

Modal Title

+
+ + +

Modal content

+
+ + + + +
+``` + +```js +// sample.component.ts + +@Component(/* component metadata */) +export class SampleComponent { + isModelOpen = false +} +``` + +![Example modal result](./images/modal-result-1.jpg) + + +See an example form inside a modal: + +```html + + + + +

Book

+
+ + +
+
+ * + +
+ +
+ * + +
+ +
+ * + +
+ +
+ * + +
+ +
+ * + +
+
+
+ + + + + + +
+``` + +```ts +// book.component.ts + +import { Component } from '@angular/core'; +import { FormBuilder, Validators } from '@angular/forms'; + +@Component(/* component metadata */) +export class BookComponent { + form = this.fb.group({ + author: [null, [Validators.required]], + name: [null, [Validators.required]], + price: [null, [Validators.required, Validators.min(0)]], + type: [null, [Validators.required]], + publishDate: [null, [Validators.required]], + }); + + inProgress: boolean; + + isModalOpen: boolean; + + constructor(private fb: FormBuilder, private service: BookService) {} + + save() { + if (this.form.invalid) return; + + this.inProgress = true; + + this.service.save(this.form.value).subscribe(() => { + this.inProgress = false; + }); + } +} +``` + +The modal with form looks like this: + +![Form example result](./images/modal-result-2.jpg) + +## API + +### Inputs + +#### visible + +```js +@Input() visible: boolean +``` + +**`visible`** is a boolean input that determines whether the modal is open. It is also can be used two-way binding. + +#### busy + +```js +@Input() busy: boolean +``` + +**`busy`** is a boolean input that determines whether the busy status of the modal is true. When `busy` is true, the modal cannot be closed and the `abp-button` loading spinner is triggered. + + +#### options + +```js +@Input() options: NgbModalOptions +``` + +**`options`** is an input typed [NgbModalOptions](https://ng-bootstrap.github.io/#/components/modal/api#NgbModalOptions). It is configuration for the `ng-bootstrap` modal. + +#### suppressUnsavedChangesWarning + +```js +@Input() suppressUnsavedChangesWarning: boolean +``` + +**`suppressUnsavedChangesWarning`** is a boolean input that determines whether the confirmation popup triggering active or not. It can also be set globally as shown below: + +```ts +//app.module.ts + +// app.module.ts + +import { SUPPRESS_UNSAVED_CHANGES_WARNING } from '@abp/ng.theme.shared'; + +// ... + +@NgModule({ + // ... + providers: [{provide: SUPPRESS_UNSAVED_CHANGES_WARNING, useValue: true}] +}) +export class AppModule {} +``` + +Note: The `suppressUnsavedChangesWarning` input of `abp-modal` value overrides the `SUPPRESS_UNSAVED_CHANGES_WARNING` injection token value. + +### Outputs + +#### visibleChange + +```js +@Output() readonly visibleChange = new EventEmitter(); +``` + +**`visibleChange`** is an event emitted when the modal visibility has changed. The event payload is a boolean. + +#### appear + +```js + @Output() readonly appear = new EventEmitter(); +``` + +**`appear`** is an event emitted when the modal has opened. + +#### disappear + +```js + @Output() readonly disappear = new EventEmitter(); +``` + +**`disappear`** is an event emitted when the modal has closed. diff --git a/docs/en/UI/Angular/Multi-Tenancy.md b/docs/en/UI/Angular/Multi-Tenancy.md index 7622db6de0..cded16e7d4 100644 --- a/docs/en/UI/Angular/Multi-Tenancy.md +++ b/docs/en/UI/Angular/Multi-Tenancy.md @@ -91,10 +91,10 @@ export const environment = { > **Important Note:** The `application.baseUrl` and the `{0}` placeholder in the value of the `baseUrl` property are required to be able to get tenant from running URL. Other placeholders in API URLs are optional. -After the configuration above, if your app runs on the `mytenant1.mydomain.com`, the app will get tenant name as **mytenant1** and replace the environment object in `ConfigState` on app initialization as follows: +After the configuration above, if your app runs on the `mytenant1.mydomain.com`, the app will get tenant name as **mytenant1** and replace the environment object in `EnvironmentService` on app initialization as follows: ```js -// environment object in ConfigState +// environment object in EnvironmentService { //... diff --git a/docs/en/UI/Angular/Router-Events.md b/docs/en/UI/Angular/Router-Events.md new file mode 100644 index 0000000000..011d405b22 --- /dev/null +++ b/docs/en/UI/Angular/Router-Events.md @@ -0,0 +1,146 @@ +# Router Events Simplified + +`RouterEvents` is a utility service to provide an easy implementation for one of the most frequent needs in Angular templates: `TrackByFunction`. Please see [this page in Angular docs](https://angular.io/guide/template-syntax#ngfor-with-trackby) for its purpose. + + + + +## Benefit + +You can use router events directly and filter them as seen below: + +```js +import { + NavigationEnd, + NavigationError, + NavigationCancel, + Router, +} from '@angular/router'; +import { filter } from 'rxjs/operators'; + +@Injectable() +class SomeService { + navigationFinish$ = this.router.events.pipe( + filter( + event => + event instanceof NavigationEnd || + event instanceof NavigationError || + event instanceof NavigationCancel, + ), + ); + /* Observable */ + + constructor(private router: Router) {} +} +``` + +However, `RouterEvents` makes filtering router events easier. + +```js +import { RouterEvents } from '@abp/ng.core'; + +@Injectable() +class SomeService { + navigationFinish$ = this.routerEvents.getNavigationEvents('End', 'Error', 'Cancel'); + /* Observable */ + + constructor(private routerEvents: RouterEvents) {} +} +``` + +`RouterEvents` also delivers improved type-safety. In the example above, `navigationFinish$` has inferred type of `Observable` whereas it would have `Observable` when router events are filtered directly. + + + + +## Usage + +You do not have to provide `RouterEvents` at the module or component level, because it is already **provided in root**. You can inject and start using it immediately in your components. + + +### How to Get Specific Navigation Events + +You can use `getNavigationEvents` to get a stream of navigation events matching given event keys. + +```js +import { RouterEvents } from '@abp/ng.core'; +import { merge } from 'rxjs'; +import { mapTo } from 'rxjs/operators'; + +@Injectable() +class SomeService { + navigationStart$ = this.routerEvents.getNavigationEvents('Start'); + /* Observable */ + + navigationFinish$ = this.routerEvents.getNavigationEvents('End', 'Error', 'Cancel'); + /* Observable */ + + loading$ = merge( + this.navigationStart$.pipe(mapTo(true)), + this.navigationFinish$.pipe(mapTo(false)), + ); + /* Observable */ + + constructor(private routerEvents: RouterEvents) {} +} +``` + + +### How to Get All Navigation Events + +You can use `getAllNavigationEvents` to get a stream of all navigation events without passing any keys. + +```js +import { RouterEvents, NavigationStart } from '@abp/ng.core'; +import { map } from 'rxjs/operators'; + +@Injectable() +class SomeService { + navigationEvent$ = this.routerEvents.getAllNavigationEvents(); + /* Observable */ + + loading$ = this.navigationEvent$.pipe( + map(event => event instanceof NavigationStart), + ); + /* Observable */ + + constructor(private routerEvents: RouterEvents) {} +} +``` + + +### How to Get Specific Router Events + +You can use `getEvents` to get a stream of router events matching given event constructors. + +```js +import { RouterEvents } from '@abp/ng.core'; +import { ActivationEnd, ChildActivationEnd } from '@angular/router'; + +@Injectable() +class SomeService { + moduleActivation$ = this.routerEvents.getEvents(ActivationEnd, ChildActivationEnd); + /* Observable */ + + constructor(private routerEvents: RouterEvents) {} +} +``` + + +### How to Get All Router Events + +You can use `getEvents` to get a stream of all router events without passing any event constructors. This is nothing different from accessing `events` property of `Router` and is added to the service just for convenience. + +```js +import { RouterEvents } from '@abp/ng.core'; +import { ActivationEnd, ChildActivationEnd } from '@angular/router'; + +@Injectable() +class SomeService { + routerEvent$ = this.routerEvents.getAllEvents(); + /* Observable */ + + constructor(private routerEvents: RouterEvents) {} +} +``` + diff --git a/docs/en/UI/Angular/Service-Proxies.md b/docs/en/UI/Angular/Service-Proxies.md index 8f6b1c4d60..3a10f1b6e8 100644 --- a/docs/en/UI/Angular/Service-Proxies.md +++ b/docs/en/UI/Angular/Service-Proxies.md @@ -137,3 +137,7 @@ export class BookComponent implements OnInit { ``` > Please [see this article](https://github.com/abpframework/abp/blob/dev/docs/en/Blog-Posts/2020-09-07%20Angular-Service-Proxies/POST.md) to learn more about service proxies. + +### Known Limitations + +When you run a project on Visual Studio using IIS Express as the web server, there will be no remote access to your endpoints. This is the default behavior of IIS Express since it explicitly protects you from the security risks of running over the network. However, that will cause the proxy generator to fail because it needs a response from the `/api/abp/api-definition` endpoint. You may serve your endpoints via Kestrel to avoid this. Running `dotnet run` in your command line (at your project folder) will do that for you. diff --git a/docs/en/UI/Angular/Testing.md b/docs/en/UI/Angular/Testing.md index 509fbefe95..bf6d3e1b26 100644 --- a/docs/en/UI/Angular/Testing.md +++ b/docs/en/UI/Angular/Testing.md @@ -374,3 +374,7 @@ Finally, don't forget to run your CI tests with the following command: ```sh npm test -- --prod ``` + +## See Also + +* [ABP Community Video - Unit Testing with the Angular UI](https://community.abp.io/articles/unit-testing-with-the-angular-ui-p4l550q3) diff --git a/docs/en/UI/Angular/images/ellipsis-directive-before.jpg b/docs/en/UI/Angular/images/ellipsis-directive-before.jpg new file mode 100644 index 0000000000..dc534d9a97 Binary files /dev/null and b/docs/en/UI/Angular/images/ellipsis-directive-before.jpg differ diff --git a/docs/en/UI/Angular/images/ellipsis-directive-result1.jpg b/docs/en/UI/Angular/images/ellipsis-directive-result1.jpg new file mode 100644 index 0000000000..fe693f4c8c Binary files /dev/null and b/docs/en/UI/Angular/images/ellipsis-directive-result1.jpg differ diff --git a/docs/en/UI/Angular/images/ellipsis-directive-result2.jpg b/docs/en/UI/Angular/images/ellipsis-directive-result2.jpg new file mode 100644 index 0000000000..3a416bbc05 Binary files /dev/null and b/docs/en/UI/Angular/images/ellipsis-directive-result2.jpg differ diff --git a/docs/en/UI/Angular/images/modal-result-1.jpg b/docs/en/UI/Angular/images/modal-result-1.jpg new file mode 100644 index 0000000000..89dbbc0cb1 Binary files /dev/null and b/docs/en/UI/Angular/images/modal-result-1.jpg differ diff --git a/docs/en/UI/Angular/images/modal-result-2.jpg b/docs/en/UI/Angular/images/modal-result-2.jpg new file mode 100644 index 0000000000..e17f2631ab Binary files /dev/null and b/docs/en/UI/Angular/images/modal-result-2.jpg differ diff --git a/docs/en/UI/Angular/images/my-roles-component-form-extensions.jpg b/docs/en/UI/Angular/images/my-roles-component-form-extensions.jpg new file mode 100644 index 0000000000..a686d26edc Binary files /dev/null and b/docs/en/UI/Angular/images/my-roles-component-form-extensions.jpg differ diff --git a/docs/en/UI/Angular/images/my-roles-component-with-extensions.jpg b/docs/en/UI/Angular/images/my-roles-component-with-extensions.jpg new file mode 100644 index 0000000000..1ac82c40b7 Binary files /dev/null and b/docs/en/UI/Angular/images/my-roles-component-with-extensions.jpg differ diff --git a/docs/en/UI/AspNetCore/Data-Tables.md b/docs/en/UI/AspNetCore/Data-Tables.md index b97d49d562..d5181b2da9 100644 --- a/docs/en/UI/AspNetCore/Data-Tables.md +++ b/docs/en/UI/AspNetCore/Data-Tables.md @@ -110,7 +110,7 @@ The `createAjax` also supports you to customize request parameters and handle th **Example:** ````csharp -var inputAction = function () { +var inputAction = function (requestData, dataTableSettings) { return { id: $('#Id').val(), name: $('#Name').val(), @@ -131,6 +131,15 @@ var responseCallback = function(result) { ajax: abp.libs.datatables.createAjax(acme.bookStore.books.book.getList, inputAction, responseCallback) ```` +If you don't need access or modify the `requestData` or the `dataTableSettings`, you can specify a simple object as the second parameter. + +````js +ajax: abp.libs.datatables.createAjax( + acme.bookStore.books.book.getList, + { id: $('#Id').val(), name: $('#Name').val() } +) +```` + ### Row Actions `rowAction` is an option defined by the ABP Framework to the column definitions to show a drop down button to take actions for a row in the table. diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json index 3fff6d67c1..efca73a484 100644 --- a/docs/en/docs-nav.json +++ b/docs/en/docs-nav.json @@ -807,6 +807,10 @@ "text": "Easy *ngFor trackBy", "path": "UI/Angular/Track-By-Service.md" }, + { + "text": "Router Events", + "path": "UI/Angular/Router-Events.md" + }, { "text": "Inserting Scripts & Styles to DOM", "path": "UI/Angular/Dom-Insertion-Service.md" @@ -819,6 +823,10 @@ "text": "Projecting Angular Content", "path": "UI/Angular/Content-Projection-Service.md" }, + { + "text": "Modal", + "path": "UI/Angular/Modal.md" + }, { "text": "Confirmation Popup", "path": "UI/Angular/Confirmation-Service.md" @@ -830,6 +838,10 @@ { "text": "Page Alerts", "path": "UI/Angular/Page-Alerts.md" + }, + { + "text": "Ellipsis", + "path": "UI/Angular/Ellipsis-Directive.md" } ] }, @@ -847,6 +859,27 @@ { "text": "Custom Setting Page", "path": "UI/Angular/Custom-Setting-Page.md" + }, + { + "text": "Extensions", + "items": [ + { + "text": "Entity Action Extensions", + "path": "UI/Angular/Entity-Action-Extensions.md" + }, + { + "text": "Data Table Column Extensions", + "path": "UI/Angular/Data-Table-Column-Extensions.md" + }, + { + "text": "Page Toolbar Extensions", + "path": "UI/Angular/Page-Toolbar-Extensions.md" + }, + { + "text": "Dynamic Form Extensions", + "path": "UI/Angular/Dynamic-Form-Extensions.md" + } + ] } ] } @@ -1056,10 +1089,6 @@ { "text": "CLI", "path": "CLI.md" - }, - { - "text": "API Documentation", - "path": "{ApiDocumentationUrl}" } ] }, diff --git a/docs/en/images/angular-module-dev-app-project.png b/docs/en/images/angular-module-dev-app-project.png new file mode 100644 index 0000000000..08e0e9fd6c Binary files /dev/null and b/docs/en/images/angular-module-dev-app-project.png differ diff --git a/docs/en/images/angular-module-folder-structure.png b/docs/en/images/angular-module-folder-structure.png new file mode 100644 index 0000000000..ae2333b295 Binary files /dev/null and b/docs/en/images/angular-module-folder-structure.png differ diff --git a/docs/zh-Hans/Background-Jobs-RabbitMq.md b/docs/zh-Hans/Background-Jobs-RabbitMq.md index 979beec872..0f9fb21d8a 100644 --- a/docs/zh-Hans/Background-Jobs-RabbitMq.md +++ b/docs/zh-Hans/Background-Jobs-RabbitMq.md @@ -1,3 +1,153 @@ -# RabbitMQ Background Job Manager +# RabbitMQ 后台作业管理 -待添加 \ No newline at end of file +RabbitMQ 是一个标准的消息队列中间件,虽然它常用于消息传递/分布式事件,但也非常适合存储 FIFO(先进先出) 顺序的后台作业. + +ABP Framework 提供了 [Volo.Abp.BackgroundJobs.RabbitMQ](https://www.nuget.org/packages/Volo.Abp.BackgroundJobs.RabbitMQ) 包,将使用 RabbitMQ 来执行后台作业. + +> 参阅 [后台作业文档](Background-Jobs.md) 学习如何使用后台作业系统,本文只介绍了如何安装和配置 RabbitMQ 集成. + +## 安装 + +使用 ABP CLI 将 [Volo.Abp.BackgroundJobs.RabbitMQ](https://www.nuget.org/packages/Volo.Abp.BackgroundJobs.RabbitMQ) 包添加到你的项目: + +- 如果之前没有安装过 [ABP CLI](https://docs.abp.io/en/abp/latest/CLI),请先安装它. +- 跳转到待安装后台作业管理的项目目录中(包含 `.csproj` 文件的目录),打开终端管理器. +- 执行 `abp add-package Volo.Abp.BackgroundJobs.RabbitMQ` 命令. + +如果你想要手动安装,请先用 NuGet 包管理器安装 [Volo.Abp.BackgroundJobs.RabbitMQ](https://www.nuget.org/packages/Volo.Abp.BackgroundJobs.RabbitMQ) 包到指定项目,之后使在你的 [模块](Module-Development-Basics.md) 上面添加 `[DependsOn(typeof(AbpBackgroundJobsRabbitMqModule))]` 配置依赖. + +## 配置 + +### 默认配置 + +默认配置将会使用标准端口和主机名(localhost)连接到 RabbitMQ 服务,**你不需要进行额外配置**. + +### RabbitMQ 连接 + +你可以使用 ASP.NET Core 的 [标准配置系统](Configuration.md) 对 RabbitMQ 进行详细配置,比如 `appsettings.json` 或者是 [选项类](Options.md). + +#### 通过 `appsettings.json` 文件配置 + +这种方式是配置 RabbitMQ 连接最简单的方式,你可以使用其他的配置源(例如环境变量).这些强大的功能都是由 [ASP.NET Core](https://docs.microsoft.com/zh-cn/aspnet/core/fundamentals/configuration/) 提供的支持. + +**示例: 配置默认的 RabbitMQ 连接** + +```json +{ + "RabbitMQ": { + "Connections": { + "Default": { + "HostName": "123.123.123.123", + "Port": "5672" + } + } + } +} +``` + +你可以在配置文件使用所有 [ConnectionFactry](http://rabbitmq.github.io/rabbitmq-dotnet-client/api/RabbitMQ.Client.ConnectionFactory.html#properties) 的属性,关于这些属性的具体含义,可以查看 RabbitMQ 的 [官方文档](https://www.rabbitmq.com/dotnet-api-guide.html#exchanges-and-queues). + +目前我们允许定义多个连接,多连接的情况适用于不同的后台作业,具体配置信息可以参考下面的 RabbitMQ 后台作业配置说明. + +**示例: 定义两个 RabbitMQ 连接** + +```json +{ + "RabbitMQ": { + "Connections": { + "Default": { + "HostName": "123.123.123.123" + }, + "SecondConnection": { + "HostName": "321.321.321.321" + } + } + } +} +``` + +如果需要连接到 RabbitMQ 集群,你可以指定多个 HostName. + +**示例: 连接到 RabbitMQ 集群** + +```json +{ + "RabbitMQ": { + "Connections": { + "Default": { + "HostName": "123.123.123.123;234.234.234.234" + } + }, + "EventBus": { + "ClientName": "MyClientName", + "ExchangeName": "MyExchangeName" + } + } +} +``` + +#### 使用选项类 + +`AbpRabbitMqOptions` 类型用于配置 RabbitMQ 的连接字符串,你可以在 [模块](Module-Development-Basics.md) 的 `ConfigureService` 方法中进行配置. + +**示例: 配置 RabbitMQ 连接** + +```csharp +Configure(options => +{ + options.Connections.Default.UserName = "user"; + options.Connections.Default.Password = "pass"; + options.Connections.Default.HostName = "123.123.123.123"; + options.Connections.Default.Port = 5672; +}); +``` + +关于选项类,可以结合 `appsettings.json` 文件一起使用.针对同一个属性,在选项类里面对该值进行了设定,会覆盖掉 `appsettings.json` 的值. + +### RabbitMQ 后台作业配置说明 + +#### 后台作业队列的名称 + +默认情况下,每个后台作业都会使用一个单独的队列,结合标准前缀和作业名称来构造一个完整的队列名称.默认的前缀为 `AbpBackgroundJobs`,所以有一个作业的名称是 `EmailSending` 的话,在 RabbitMQ 的队列名称就是 `AbpBackgroundJobs.EmailSending`. + +> 在后台作业的参数类上,可以使用 `BackgroundJobName` 特性指定后台作业的名称.否则的话,后台作业的名称将会是后台作业类的全名(也包含命名空间). + +#### 后台作业使用的连接 + +默认情况下,后台作业都会使用 `Default` 作为默认连接. + +#### 自定义 + +`AbpRabbitMqBackgroundJobOptions` 可以自定义队列名和作业使用的 RabbitMQ 连接. + +**示例: ** + +```csharp +Configure(options => +{ + options.DefaultQueueNamePrefix = "my_app_jobs."; + options.JobQueues[typeof(EmailSendingArgs)] = + new JobQueueConfiguration( + typeof(EmailSendingArgs), + queueName: "my_app_jobs.emails", + connectionName: "SecondConnection" + ); +}); +``` + +- 这个示例将默认的队列名前缀设置为 `my_app_jobs.`,如果多个项目都使用的同一个 RabbitMQ 服务,设置不同的前缀可以避免执行其他项目的后台作业. +- 这里还设置了 `EmailSendingArgs` 绑定的 RabbitMQ 连接. + +`JobQueueConfiguration` 类的构造函数中,还有一些其他的可选参数. + +- `queueName`: 指定后台作业对应的队列名称(全名). +- `connectionName`: 后台作业对应的 RabbitMQ 连接名称,默认是 `Default`. +- `durable`: 可选参数,默认为 `true`. +- `exclusive`: 可选参数,默认为 `false`. +- `autoDelete`: 可选参数,默认为 `false`. + +如果你想要更多地了解 `durable`,`exclusive`,`autoDelete` 的用法,请阅读 RabbitMQ 提供的文档. + +## 另请参阅 + +- [后台作业](Background-Jobs.md) diff --git a/docs/zh-Hans/Best-Practices/Application-Services.md b/docs/zh-Hans/Best-Practices/Application-Services.md index 82a5dc8aba..c99d67d518 100644 --- a/docs/zh-Hans/Best-Practices/Application-Services.md +++ b/docs/zh-Hans/Best-Practices/Application-Services.md @@ -199,7 +199,7 @@ Task VoteAsync(Guid id, VoteType type); #### 查询数据 -* **不推荐** 在应用程序服务方法中使用linq/sql查询来自数据库的数据. 让仓储负责从数据源执行linq/sql查询. +* **不推荐** 在应用服务方法中使用linq/sql查询来自数据库的数据. 让仓储负责从数据源执行linq/sql查询. #### 额外的属性 @@ -210,11 +210,16 @@ Task VoteAsync(Guid id, VoteType type); * **推荐** 总是从数据库中获取所有的相关实体以对他们执行操作. * **推荐** 更新实体后调用存储的Update/UpdateAsync方法.因为并非所有数据库API都支持更改跟踪和自动更新. +#### 处理文件 + +* **不推荐** 在应用服务中使用任何web组件, 例如`IFormFile`和`Stream`. 如果你想接收一个文件, 可以使用`byte[]`. +* **推荐** 使用`Controller`来处理文件上传, 然后将文件的`byte[]`传递给应用服务的方法。 + #### 使用其他应用服务 -* **不推荐** 使用相同 **模块/应用程序** 的其他应用服务. 相反; +* **不推荐** 在同一个模块/应用中使用其他应用服务. 相反; * 使用领域层执行所需的任务. - * 提取新类并在应用程序服务之间共享, 在必要时代码重用. 但要小心不要结合两个用例. 它们在开始时可能看起来相似, 但可能会随时间演变为不同的方向. 请谨慎使用代码共享. + * 提取新类并在应用服务之间共享, 在必要时代码重用. 但要小心不要结合两个用例. 它们在开始时可能看起来相似, 但可能会随时间演变为不同的方向. 请谨慎使用代码共享. * **可以** 在以下情况下使用其他应用服务; * 它们是另一个模块/微服务的一部分. - * 当前模块仅引用已使用模块的application contracts. \ No newline at end of file + * 当前模块仅引用已使用模块的application contracts. diff --git a/docs/zh-Hans/Blob-Storing-Aliyun.md b/docs/zh-Hans/Blob-Storing-Aliyun.md index c8a1e68bc7..eb67fdbab5 100644 --- a/docs/zh-Hans/Blob-Storing-Aliyun.md +++ b/docs/zh-Hans/Blob-Storing-Aliyun.md @@ -36,7 +36,7 @@ Configure(options => aliyun.Policy = "policy"; aliyun.DurationSeconds = "expiration date"; aliyun.ContainerName = "your aliyun container name"; - aliyun.CreateContainerIfNotExists = false; + aliyun.CreateContainerIfNotExists = true; }); }); }); diff --git a/docs/zh-Hans/Blob-Storing-Aws.md b/docs/zh-Hans/Blob-Storing-Aws.md index 7bfb998297..fc98c5a948 100644 --- a/docs/zh-Hans/Blob-Storing-Aws.md +++ b/docs/zh-Hans/Blob-Storing-Aws.md @@ -39,7 +39,7 @@ Configure(options => Aws.Policy = "policy"; Aws.DurationSeconds = "expiration date"; Aws.ContainerName = "your Aws container name"; - Aws.CreateContainerIfNotExists = false; + Aws.CreateContainerIfNotExists = true; }); }); }); diff --git a/docs/zh-Hans/Blob-Storing-Azure.md b/docs/zh-Hans/Blob-Storing-Azure.md index 8eecc1fde3..e1ed3a6d4e 100644 --- a/docs/zh-Hans/Blob-Storing-Azure.md +++ b/docs/zh-Hans/Blob-Storing-Azure.md @@ -29,7 +29,7 @@ Configure(options => { azure.ConnectionString = "your azure connection string"; azure.ContainerName = "your azure container name"; - azure.CreateContainerIfNotExists = false; + azure.CreateContainerIfNotExists = true; }); }); }); diff --git a/docs/zh-Hans/Caching.md b/docs/zh-Hans/Caching.md index 0557ddcb4d..a75199ce47 100644 --- a/docs/zh-Hans/Caching.md +++ b/docs/zh-Hans/Caching.md @@ -192,6 +192,18 @@ public class BookService : ITransientDependency } ```` +## 批量操作 + +ABP的分布式缓存接口定义了以下批量操作方法,当你需要在一个方法中调用多次缓存操作时,这些方法可以提高性能 + +* `SetManyAsync` 和 `SetMany` 方法可以用来设置多个值. +* `GetManyAsync` 和 `GetMany` 方法可以用来从缓存中获取多个值. +* `GetOrAddManyAsync` 和 `GetOrAddMany` 方法可以用来从缓存中获取并添加缺少的值. +* `RefreshManyAsync` 和 `RefreshMany` 方法可以来用重置多个值的滚动过期时间. +* `RemoveManyAsync` 和 `RemoveMany` 方法呆以用来删除多个值. + +> 这些不是标准的ASP.NET Core缓存方法, 所以某些提供程序可能不支持. [ABP Redis集成包](Redis-Cache.md)实现了它们. 如果提供程序不支持,会回退到 `SetAsync` 和 `GetAsync` ... 方法(循环调用). + ### DistributedCacheOptions TODO \ No newline at end of file diff --git a/docs/zh-Hans/Customizing-Application-Modules-Overriding-Services.md b/docs/zh-Hans/Customizing-Application-Modules-Overriding-Services.md index b8abe99cdc..1e9ae77f36 100644 --- a/docs/zh-Hans/Customizing-Application-Modules-Overriding-Services.md +++ b/docs/zh-Hans/Customizing-Application-Modules-Overriding-Services.md @@ -243,7 +243,7 @@ ObjectExtensionManager.Instance 这是定义实体属性的另一种方法( 有关 `ObjectExtensionManager` 更多信息,请参阅[文档](Object-Extensions.md)). 这次我们设置了 `CheckPairDefinitionOnMapping` 为false,在将实体映射到DTO时会跳过定义检查. -如果你不喜欢这种方法,但想简单的向多个对象(DTO)添加单个属, `AddOrUpdateProperty` 可以使用类型数组添加额外的属性: +如果你不喜欢这种方法,但想简单的向多个对象(DTO)添加单个属性, `AddOrUpdateProperty` 可以使用类型数组添加额外的属性: ````csharp ObjectExtensionManager.Instance diff --git a/docs/zh-Hans/Distributed-Event-Bus-RabbitMQ-Integration.md b/docs/zh-Hans/Distributed-Event-Bus-RabbitMQ-Integration.md index 2a1810e309..ab7cb68bd7 100644 --- a/docs/zh-Hans/Distributed-Event-Bus-RabbitMQ-Integration.md +++ b/docs/zh-Hans/Distributed-Event-Bus-RabbitMQ-Integration.md @@ -103,6 +103,26 @@ } ```` +如果需要连接到 RabbitMQ 集群,你可以指定多个 HostName。 + +**示例: 连接到 RabbitMQ 集群** + +```json +{ + "RabbitMQ": { + "Connections": { + "Default": { + "HostName": "123.123.123.123;234.234.234.234" + } + }, + "EventBus": { + "ClientName": "MyClientName", + "ExchangeName": "MyExchangeName" + } + } +} +``` + ### 选项类 `AbpRabbitMqOptions` 和 `AbpRabbitMqEventBusOptions` 类用于配置RabbitMQ的连接字符串和事件总线选项. diff --git a/docs/zh-Hans/Domain-Driven-Design-Implementation-Guide.md b/docs/zh-Hans/Domain-Driven-Design-Implementation-Guide.md index 81755fbf0d..47cab8c02e 100644 --- a/docs/zh-Hans/Domain-Driven-Design-Implementation-Guide.md +++ b/docs/zh-Hans/Domain-Driven-Design-Implementation-Guide.md @@ -1315,7 +1315,7 @@ namespace IssueTracking.Users #### 输出DTO最佳实践 -* 保持**数量较少**的输出DTO,尽可能**重用输入DTO**(例外:不要将输入DTO作为输出DTO). +* 保持**数量较少**的输出DTO,尽可能**重用输出DTO**(例外:不要将输入DTO作为输出DTO). * 输出DTO可以包含比用例需要的属性**更多**的属性. * 针对 **Create** 和 **Update** 方法,返回实体的DTO. @@ -1976,4 +1976,4 @@ public class IssueAppService * "*Domain Driven Design*" by Eric Evans * "*Implementing Domain Driven Design*" by Vaughn Vernon -* "*Clean Architecture*" by Robert C. Martin \ No newline at end of file +* "*Clean Architecture*" by Robert C. Martin diff --git a/docs/zh-Hans/MongoDB.md b/docs/zh-Hans/MongoDB.md index 2ceeb1e00c..af63642a41 100644 --- a/docs/zh-Hans/MongoDB.md +++ b/docs/zh-Hans/MongoDB.md @@ -211,7 +211,7 @@ public async override Task DeleteAsync( #### 访问MongoDB API -大多数情况下,你想要将MongoDB API隐藏在仓储后面(这是仓储的主要目的).如果你想在仓储之上访问MongoDB API,你可以使用`GetDatabase()`或`GetCollection()`方法.例如: +大多数情况下,你想要将MongoDB API隐藏在仓储后面(这是仓储的主要目的).如果你想在仓储之上访问MongoDB API,你可以使用`GetDatabaseAsync()`, `GetAggregateAsync()` 或`GetCollectionAsync()`方法.例如: ```csharp public class BookService @@ -223,10 +223,11 @@ public class BookService _bookRepository = bookRepository; } - public void Foo() + public async Task FooAsync() { - IMongoDatabase database = _bookRepository.GetDatabase(); - IMongoCollection books = _bookRepository.GetCollection(); + IMongoDatabase database = await _bookRepository.GetDatabaseAsync(); + IMongoCollection books = await _bookRepository.GetCollectionAsync(); + IAggregateFluent bookAggregate = await _bookRepository.GetAggregateAsync(); } } ``` diff --git a/docs/zh-Hans/PlugIn-Modules.md b/docs/zh-Hans/PlugIn-Modules.md new file mode 100644 index 0000000000..48a507ac7d --- /dev/null +++ b/docs/zh-Hans/PlugIn-Modules.md @@ -0,0 +1,233 @@ +# 模块化插件 + +可以将[模块](Module-Development-Basics.md)加载为插件.这意味着你可能不需要在解决方案中引用模块的程序集,就可以像其它模块一样在启动应用时加载该模块. + +## 基本用法 + +`IServiceCollection.AddApplication()` 扩展方法可以获取配置插件源的选项. + +**示例: 从文件夹加载插件** + +````csharp +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Modularity.PlugIns; + +namespace MyPlugInDemo.Web +{ + public class Startup + { + public void ConfigureServices(IServiceCollection services) + { + services.AddApplication(options => + { + options.PlugInSources.AddFolder(@"D:\Temp\MyPlugIns"); + }); + } + + public void Configure(IApplicationBuilder app) + { + app.InitializeApplication(); + } + } +} +```` + +* 这是典型的ASP.NET Core应用程序的`Startup`类. +* `PlugInSources.AddFolder`从指定的目录中加载程序集(通常为dll). + +就这样.ABP将在这个目录中发现这些模块,像其它常规一样配置和初始化它们. + +### 插件源 + +`options.PlugInSources`类实际上是`IPlugInSource`接口的一系列实现并且 `AddFolder`方法仅仅是以下表达式的便捷方法: + +````csharp +options.PlugInSources.Add(new FolderPlugInSource(@"D:\Temp\MyPlugIns")); +```` + +> `AddFolder()`方法仅在给定目录下查找程序集文件,而不在子目录中查找.你可以传递一个`SearchOption.AllDirectories`参数作为第二个参数,来递归地查找它的子目录. + +这里有两个内置插件源的示例: + +* `PlugInSources.AddFiles()`方法获取程序集(通常是dll)文件列表.这是使用`FilePlugInSource`类的快捷方式. +* `PlugInSources.AddTypes()`方法获取模块类类型的列表.如果实用化此方法,则需要自己加载模块的程序集,但是在需要时它提供了灵活性.这是使用`TypePlugInSource`类的快捷方式. + +如果需要,你可以创建自己的`IPlugInSource`的接口实现,并像其它方法一样添加到`options.PlugInSources`中. + +## 示例:创建一个简单的插件 + +在一个解决方案中创建一个简单的**类库项目** + +![简单插件库](images/simple-plugin-library.png) + +你可以在模块中添加需要使用的ABP框架包.至少,你应该为这个项目添加包`Volo.Abp.Core`: + +```` +Install-Package Volo.Abp.Core +```` + +每个[模块](Module-Development-Basics.md)必须声明为一个继承自`AbpModule`的类.这里是一个简单的模块类,用于解析一个服务并在应用启动时对其初始化: + +````csharp +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp; +using Volo.Abp.Modularity; + +namespace MyPlugIn +{ + public class MyPlungInModule : AbpModule + { + public override void OnApplicationInitialization(ApplicationInitializationContext context) + { + var myService = context.ServiceProvider + .GetRequiredService(); + + myService.Initialize(); + } + } +} +```` + +`MyService`可以是注册在[依赖注入](Dependency-Injection.md)系统中的任意类,如下所示: + +````csharp +using Microsoft.Extensions.Logging; +using Volo.Abp.DependencyInjection; + +namespace MyPlugIn +{ + public class MyService : ITransientDependency + { + private readonly ILogger _logger; + + public MyService(ILogger logger) + { + _logger = logger; + } + + public void Initialize() + { + _logger.LogInformation("MyService has been initialized"); + } + } +} +```` + +编译这个项目,打开build目录,找到`MyPlugIn.dll`: + +![简单dll插件](images/simple-plug-in-dll-file.png) + +将`MyPlugIn.dll`复制到到插件目录中(此实例为`D:\Temp\MyPlugIns`). + +如果你已经按照上述方式配置了主应用程序(参见“基础用法”部分),那么在应用程序启动时,你可以看到“MyService has been initialized(MyService已经初始化)的日志. + +## 示例:创建一个Razor Pages插件 + +创建内部带视图的插件需要更多的注意. + +> 这个示例假设你已经使用应用程序启动模板和MVC / Razor Pages UI[创建了一个新的Web应用程序](https://abp.io/get-started). + +在解决方案中创建一个新的**类库**项目: + +![简单razor插件](images/simple-razor-plugin.png) + +编辑这个`.csproj`文件内容: + +````xml + + + + net5.0 + Library + true + + + + + + + +```` + +* 将`Sdk`修改为`Microsoft.NET.Sdk.Web`. +* 添加了`OutputType`和`IsPackable`属性. +* 添加了`Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared`NuGet包. + +> 不需要[Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared](https://www.nuget.org/packages/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared) 包.你可以引用更基础的程序包,例如[Volo.Abp.AspNetCore.Mvc](https://www.nuget.org/packages/Volo.Abp.AspNetCore.Mvc/). 但是,如果需要构建一个UI视图/组件,建议参考[Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared](https://www.nuget.org/packages/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared)程序包,因为它是最高级的程序包,不依赖于特定[theme](UI/AspNetCore/Theming.md).如果依赖特定主题没有问题,则可以直接引用该主题的程序包,以便能够使用插件中特定于主题的功能. + +接下来在插件中创建模块类: + +````csharp +using System.IO; +using System.Reflection; +using Microsoft.AspNetCore.Mvc.ApplicationParts; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared; +using Volo.Abp.Modularity; + +namespace MyMvcUIPlugIn +{ + [DependsOn(typeof(AbpAspNetCoreMvcUiThemeSharedModule))] + public class MyMvcUIPlugInModule : AbpModule + { + public override void PreConfigureServices(ServiceConfigurationContext context) + { + PreConfigure(mvcBuilder => + { + // 添加插件程序集 + mvcBuilder.PartManager.ApplicationParts.Add(new AssemblyPart(typeof(MyMvcUIPlugInModule).Assembly)); + + // 添加视图程序集 + var viewDllPath = Path.Combine(Path.GetDirectoryName(typeof(MyMvcUIPlugInModule).Assembly.Location), "MyMvcUIPlugIn.Views.dll"); + var viewAssembly = new CompiledRazorAssemblyPart(Assembly.LoadFrom(viewDllPath)); + mvcBuilder.PartManager.ApplicationParts.Add(viewAssembly); + }); + } + } +} +```` + +* 由于我们添加了相关的NuGet包,因此取决于`AbpAspNetCoreMvcUiThemeSharedModule`. +* 添加插件程序集到ASP.NET Core MVC的`PartManager`中.这是ASP.NET Core所必需的.否则,你插件中的控制器将无法正常工作. +* 添加插件的视图程序集到ASP.NET Core MVC的`PartManager`中.这是ASP.NET Core所必需的.否则,你在插件中的视图将不起作用. + +现在,你可以在`Pages`目录下添加一个razor页面,例如`MyPlugInPage.cshtml`: + +````html +@page +@model MyMvcUIPlugIn.Pages.MyPlugInPage +

Welcome to my plug-in page

+

This page is located inside a plug-in module! :)

+```` + +现在,你可以构建插件项目.它将产生以下输出: + +![simple-razor-plug-in-dll-file](images/simple-razor-plug-in-dll-file.png) + +将`MyMvcUIPlugIn.dll`和`MyMvcUIPlugIn.Views.dll`复制到到插件目录下(此示例中为`D:\Temp\MyPlugIns`). + +如果你已经按照上述方式配置了主应用程序(参见“基础用法”部分),那么在应用程序启动的时候,你应该能够访问`/MyPlugInPage`URL: + +![simple-plugin-output](images/simple-plugin-output.png) + +## 讨论 + +在现实世界中,你的插件可能具有一些外部依赖性.另外,你的应用程序可能被设计为支持插件.所有这些都是你自己的系统要求.ABP做的仅仅是在应用程序启动时加载模块.你在这些模块中执行什么操作由你决定. + +但是,我们可以为一些常见情况提供一些建议. + +### 库依赖 + +对于包/dll依赖,你可以将相关的dll复制到插件目录下.ABP会自动将所有程序集加载到该目录下,并且你的插件将按预期工作. + +> 请参见[Microsoft文档](https://docs.microsoft.com/zh-cn/dotnet/core/tutorials/creating-app-with-plugin-support#plugin-with-library-dependencies). + +### 数据库模式 + +如果你的模块使用关系型数据库和[Entity Framework Core](Entity-Framework-Core.md), 那么它需要在数据库中提供表.有多种不同的方法可确保在应用程序使用插件时创建表.一些例子; + +1. 插件可以检查数据库表是否存在,并在应用程序启动时创建表,或者如果插件已更新且需要进行某些架构更改时,则会迁移它们.你可以使用EF Core的迁移API来做到这一点. +2. 你可以改进`DbMigrator`应用程序,用于查找插件的迁移并执行它们. + +可能还有其它解决方案.例如,如果你的数据库管理员不允许你在应用程序代码中更改数据库模式,则可能需要手动将SQL文件发送给数据库管理员,以将其应用于数据库. diff --git a/docs/zh-Hans/Redis-Cache.md b/docs/zh-Hans/Redis-Cache.md new file mode 100644 index 0000000000..cb82a640d5 --- /dev/null +++ b/docs/zh-Hans/Redis-Cache.md @@ -0,0 +1 @@ +TODO... \ No newline at end of file diff --git a/docs/zh-Hans/Repositories.md b/docs/zh-Hans/Repositories.md index 79186b79da..857df51439 100644 --- a/docs/zh-Hans/Repositories.md +++ b/docs/zh-Hans/Repositories.md @@ -150,7 +150,7 @@ var people = _personRepository * 这里异步方法**不是标准LINQ方法**,它们定义在[Microsoft.EntityFrameworkCore](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore)Nuget包中. * 标准模板应用层与领域层**不引用**EF Core 包以实现数据库提供程序独立. -根据你的需求和开发模式,你可以根据以下选项使用异步方法.s +根据你的需求和开发模式,你可以根据以下选项使用异步方法. > 强烈建议使用异步方法! 在执行数据库查询时不要使用同步LINQ方法,以便能够开发可伸缩的应用程序. diff --git a/docs/zh-Hans/docs-nav.json b/docs/zh-Hans/docs-nav.json index 5d231099c9..4f47dd2760 100644 --- a/docs/zh-Hans/docs-nav.json +++ b/docs/zh-Hans/docs-nav.json @@ -313,7 +313,8 @@ "path": "Module-Development-Basics.md" }, { - "text": "模块插件" + "text": "模块插件", + "path": "PlugIn-Modules.md" }, { "text": "自定义应用模块", diff --git a/docs/zh-Hans/images/simple-plug-in-dll-file.png b/docs/zh-Hans/images/simple-plug-in-dll-file.png new file mode 100644 index 0000000000..3155708d68 Binary files /dev/null and b/docs/zh-Hans/images/simple-plug-in-dll-file.png differ diff --git a/docs/zh-Hans/images/simple-plugin-library.png b/docs/zh-Hans/images/simple-plugin-library.png new file mode 100644 index 0000000000..9fefd57dda Binary files /dev/null and b/docs/zh-Hans/images/simple-plugin-library.png differ diff --git a/docs/zh-Hans/images/simple-plugin-output.png b/docs/zh-Hans/images/simple-plugin-output.png new file mode 100644 index 0000000000..71f6a78c0e Binary files /dev/null and b/docs/zh-Hans/images/simple-plugin-output.png differ diff --git a/docs/zh-Hans/images/simple-razor-plug-in-dll-file.png b/docs/zh-Hans/images/simple-razor-plug-in-dll-file.png new file mode 100644 index 0000000000..06b7a565fe Binary files /dev/null and b/docs/zh-Hans/images/simple-razor-plug-in-dll-file.png differ diff --git a/docs/zh-Hans/images/simple-razor-plugin.png b/docs/zh-Hans/images/simple-razor-plugin.png new file mode 100644 index 0000000000..92e0e00d29 Binary files /dev/null and b/docs/zh-Hans/images/simple-razor-plugin.png differ diff --git a/framework/Volo.Abp.sln b/framework/Volo.Abp.sln index 6e12f98279..1a58c32bde 100644 --- a/framework/Volo.Abp.sln +++ b/framework/Volo.Abp.sln @@ -363,6 +363,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Json.Tests", "test EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Http.Tests", "test\Volo.Abp.Http.Tests\Volo.Abp.Http.Tests.csproj", "{A37BFEB5-7C57-4CDC-93B8-B5CE4BB9ACE1}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.EventBus.Abstractions", "src\Volo.Abp.EventBus.Abstractions\Volo.Abp.EventBus.Abstractions.csproj", "{8FDB3BF7-AD89-43F6-8DEB-C3E29B8801FE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Sms.Aliyun", "src\Volo.Abp.Sms.Aliyun\Volo.Abp.Sms.Aliyun.csproj", "{ACFBA3FB-18CE-4655-9D14-1F1F5C3DFC30}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.Sms.Aliyun.Tests", "test\Volo.Abp.Sms.Aliyun.Tests\Volo.Abp.Sms.Aliyun.Tests.csproj", "{DADEA538-3CA1-4ADE-A7E6-EF77A0CE4401}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1077,6 +1083,18 @@ Global {C9142DED-1F6C-4385-A37D-81E46B233306}.Debug|Any CPU.Build.0 = Debug|Any CPU {A30D63B0-E952-4052-BAEE-38B8BF924093}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A30D63B0-E952-4052-BAEE-38B8BF924093}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8FDB3BF7-AD89-43F6-8DEB-C3E29B8801FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8FDB3BF7-AD89-43F6-8DEB-C3E29B8801FE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8FDB3BF7-AD89-43F6-8DEB-C3E29B8801FE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8FDB3BF7-AD89-43F6-8DEB-C3E29B8801FE}.Release|Any CPU.Build.0 = Release|Any CPU + {ACFBA3FB-18CE-4655-9D14-1F1F5C3DFC30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ACFBA3FB-18CE-4655-9D14-1F1F5C3DFC30}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ACFBA3FB-18CE-4655-9D14-1F1F5C3DFC30}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ACFBA3FB-18CE-4655-9D14-1F1F5C3DFC30}.Release|Any CPU.Build.0 = Release|Any CPU + {DADEA538-3CA1-4ADE-A7E6-EF77A0CE4401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DADEA538-3CA1-4ADE-A7E6-EF77A0CE4401}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DADEA538-3CA1-4ADE-A7E6-EF77A0CE4401}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DADEA538-3CA1-4ADE-A7E6-EF77A0CE4401}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1260,6 +1278,9 @@ Global {A37BFEB5-7C57-4CDC-93B8-B5CE4BB9ACE1} = {447C8A77-E5F0-4538-8687-7383196D04EA} {C9142DED-1F6C-4385-A37D-81E46B233306} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} {A30D63B0-E952-4052-BAEE-38B8BF924093} = {447C8A77-E5F0-4538-8687-7383196D04EA} + {8FDB3BF7-AD89-43F6-8DEB-C3E29B8801FE} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} + {ACFBA3FB-18CE-4655-9D14-1F1F5C3DFC30} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6} + {DADEA538-3CA1-4ADE-A7E6-EF77A0CE4401} = {447C8A77-E5F0-4538-8687-7383196D04EA} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5} diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LoginDisplay.razor b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LoginDisplay.razor index 18ebfbd4ba..eebfb501a5 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LoginDisplay.razor +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LoginDisplay.razor @@ -1,11 +1,14 @@ @using Microsoft.AspNetCore.Components.WebAssembly.Authentication +@using Microsoft.Extensions.Localization @using Volo.Abp.Users @using Volo.Abp.MultiTenancy +@using global::Localization.Resources.AbpUi @inject ICurrentUser CurrentUser @inject ICurrentTenant CurrentTenant @inject IJSRuntime JsRuntime @inject NavigationManager Navigation @inject SignOutSessionStateManager SignOutManager +@inject IStringLocalizer UiLocalizer @@ -28,12 +31,12 @@ } } - Logout + @UiLocalizer["Logout"] -
Log in + @UiLocalizer["Login"] @code{ diff --git a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/SecondLevelNavMenuItem.razor b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/SecondLevelNavMenuItem.razor index f9e47c4c27..d6067021ab 100644 --- a/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/SecondLevelNavMenuItem.razor +++ b/framework/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/SecondLevelNavMenuItem.razor @@ -10,14 +10,12 @@ if (MenuItem.Url != null) { - @if (MenuItem.Icon != null) - { - if (MenuItem.Icon.StartsWith("fa")) - { - - } - } - @MenuItem.DisplayName + + + + + @MenuItem.DisplayName + } } 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 0aeb97e89d..eaf5c753fd 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 @@ -1,7 +1,14 @@ -using System.Threading.Tasks; +using System; +using System.Globalization; +using System.Threading.Tasks; using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Localization; +using Microsoft.AspNetCore.RequestLocalization; +using Microsoft.Extensions.DependencyInjection; using Volo.Abp.DependencyInjection; +using Volo.Abp.Localization; using Volo.Abp.MultiTenancy; +using Volo.Abp.Settings; namespace Volo.Abp.AspNetCore.MultiTenancy { @@ -21,10 +28,71 @@ namespace Volo.Abp.AspNetCore.MultiTenancy public async Task InvokeAsync(HttpContext context, RequestDelegate next) { var tenant = await _tenantConfigurationProvider.GetAsync(saveResolveResult: true); - using (_currentTenant.Change(tenant?.Id, tenant?.Name)) + if (tenant?.Id != _currentTenant.Id) + { + using (_currentTenant.Change(tenant?.Id, tenant?.Name)) + { + var requestCulture = await TryGetRequestCultureAsync(context); + if (requestCulture != null) + { + CultureInfo.CurrentCulture = requestCulture.Culture; + CultureInfo.CurrentUICulture = requestCulture.UICulture; + AbpRequestCultureCookieHelper.SetCultureCookie( + context, + requestCulture + ); + } + + await next(context); + } + } + else { await next(context); } } + + private async Task TryGetRequestCultureAsync(HttpContext httpContext) + { + var requestCultureFeature = httpContext.Features.Get(); + + /* If requestCultureFeature == null, that means the RequestLocalizationMiddleware was not used + * and we don't want to set the culture. */ + if (requestCultureFeature == null) + { + return null; + } + + /* If requestCultureFeature.Provider is not null, that means RequestLocalizationMiddleware + * already picked a language, so we don't need to set the default. */ + if (requestCultureFeature.Provider != null) + { + return null; + } + + var settingProvider = httpContext.RequestServices.GetRequiredService(); + var defaultLanguage = await settingProvider.GetOrNullAsync(LocalizationSettingNames.DefaultLanguage); + if (defaultLanguage.IsNullOrWhiteSpace()) + { + return null; + } + + string culture; + string uiCulture; + + if (defaultLanguage.Contains(';')) + { + var splitted = defaultLanguage.Split(';'); + culture = splitted[0]; + uiCulture = splitted[1]; + } + else + { + culture = defaultLanguage; + uiCulture = defaultLanguage; + } + + return new RequestCulture(culture, uiCulture); + } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClientHelper.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClientHelper.cs index 4b4a0e6301..ae013c4343 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClientHelper.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.Client/Volo/Abp/AspNetCore/Mvc/Client/MvcCachedApplicationConfigurationClientHelper.cs @@ -7,7 +7,8 @@ namespace Volo.Abp.AspNetCore.Mvc.Client { public static string CreateCacheKey(ICurrentUser currentUser) { - return $"ApplicationConfiguration_{currentUser.Id?.ToString("N") ?? "Anonymous"}_{CultureInfo.CurrentUICulture.Name}"; + var userKey = currentUser.Id?.ToString("N") ?? "Anonymous"; + return $"ApplicationConfiguration_{userKey}_{CultureInfo.CurrentUICulture.Name}"; } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/TuiEditor/TuiEditorScriptContributor.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/TuiEditor/TuiEditorScriptContributor.cs index e788c612cf..e2e826445f 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/TuiEditor/TuiEditorScriptContributor.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Packages/Volo/Abp/AspNetCore/Mvc/UI/Packages/TuiEditor/TuiEditorScriptContributor.cs @@ -16,6 +16,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Packages.TuiEditor { public override void ConfigureBundle(BundleConfigurationContext context) { + context.Files.AddIfNotContains("/libs/tui-editor/tui-editor-jquery-patch.js"); context.Files.AddIfNotContains("/libs/to-mark/to-mark.min.js"); if (context.FileProvider.GetFileInfo("/libs/tui-code-snippet/tui-code-snippet.min.js").Exists) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/ToolbarItem.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/ToolbarItem.cs index 9b6ef4becb..4676202c24 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/ToolbarItem.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/Toolbars/ToolbarItem.cs @@ -14,10 +14,14 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars public int Order { get; set; } - public ToolbarItem([NotNull] Type componentType, int order = 0) + [CanBeNull] + public string RequiredPermissionName { get; set; } + + public ToolbarItem([NotNull] Type componentType, int order = 0, string requiredPermissionName = null) { Order = order; ComponentType = Check.NotNull(componentType, nameof(componentType)); + RequiredPermissionName = requiredPermissionName; } } -} \ 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 f1ac30779a..2e97cebecb 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 @@ -1,8 +1,11 @@ using System; +using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Volo.Abp.AspNetCore.Mvc.UI.Theming; +using Volo.Abp.Authorization.Permissions; using Volo.Abp.DependencyInjection; namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars @@ -14,7 +17,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars protected IServiceProvider ServiceProvider { get; } public ToolbarManager( - IOptions options, + IOptions options, IServiceProvider serviceProvider, IThemeManager themeManager) { @@ -35,9 +38,33 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Toolbars { await contributor.ConfigureToolbarAsync(context); } + + await CheckPermissionsAsync(scope.ServiceProvider, toolbar); } return toolbar; } + + protected virtual async Task CheckPermissionsAsync(IServiceProvider serviceProvider, Toolbar toolbar) + { + var requiredPermissionItems = toolbar.Items.Where(x => !x.RequiredPermissionName.IsNullOrWhiteSpace()).ToList(); + + if (requiredPermissionItems.Any()) + { + var permissionChecker = serviceProvider.GetRequiredService(); + var grantResult = await permissionChecker.IsGrantedAsync(requiredPermissionItems.Select(x => x.RequiredPermissionName).Distinct().ToArray()); + + var toBeDeleted = new HashSet(); + foreach (var item in requiredPermissionItems) + { + if (grantResult.Result[item.RequiredPermissionName!] != PermissionGrantResult.Granted) + { + toBeDeleted.Add(item); + } + } + + toolbar.Items.RemoveAll(toBeDeleted.Contains); + } + } } -} \ No newline at end of file +} diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/dom-event-handlers.js b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/dom-event-handlers.js index 431d9093f7..55c604cf4a 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/dom-event-handlers.js +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/dom-event-handlers.js @@ -159,7 +159,7 @@ abp.dom.initializers.initializeDatepickers = function ($rootElement) { $rootElement - .findWithSelf('input.datepicker,input[type=date]') + .findWithSelf('input.datepicker,input[type=date][abp-data-datepicker!=false]') .each(function () { var $input = $(this); $input diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js index a4d32550f8..75d080feda 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/bootstrap/modal-manager.js @@ -39,7 +39,7 @@ $.validator.defaults.ignore = ''; //TODO: Would be better if we can apply only f var _$modal = null; var _$form = null; - var _modalId = 'Modal_' + (Math.floor((Math.random() * 1000000))) + new Date().getTime(); + var _modalId = 'Abp_Modal_' + (Math.floor((Math.random() * 1000000))) + new Date().getTime(); var _modalObject = null; var _publicApi = null; @@ -56,7 +56,12 @@ $.validator.defaults.ignore = ''; //TODO: Would be better if we can apply only f function _createContainer() { _removeContainer(); _$modalContainer = $('
'); - $('body').prepend(_$modalContainer); + var existsModals = $('[id^="Abp_Modal_"]'); + if (existsModals.length) { + existsModals.last().after(_$modalContainer) + } else { + $('body').prepend(_$modalContainer); + } return _$modalContainer; } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-extensions.js b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-extensions.js index b0c4873b59..9895097d99 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-extensions.js +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared/wwwroot/libs/abp/aspnetcore-mvc-ui-theme-shared/datatables/datatables-extensions.js @@ -30,7 +30,7 @@ var htmlEncode = function (html) { return $('
').text(html).html(); } - + var _createDropdownItem = function (record, fieldItem, tableInstance) { var $li = $('
  • '); var $a = $(''); @@ -90,15 +90,15 @@ } $button.append(htmlEncode(firstItem.text)); } - + if (firstItem.enabled && !firstItem.enabled({ record: record, table: tableInstance })) { $button.addClass('disabled'); } - + if (firstItem.action) { $button.click(function (e) { e.preventDefault(); - + if (!$(this).hasClass('disabled')) { if (firstItem.confirmMessage) { abp.message.confirm(firstItem.confirmMessage({ record: record, table: tableInstance })) @@ -217,7 +217,7 @@ var renderRowActions = function (tableInstance, nRow, aData, iDisplayIndex, iDisplayIndexFull) { var columns; - + if (tableInstance.aoColumns) { columns = tableInstance.aoColumns; } else { @@ -334,7 +334,10 @@ }; } return function (requestData, callback, settings) { - var input = inputAction ? inputAction(requestData, settings) : {}; + var input = typeof inputAction === 'function' + ? inputAction(requestData, settings) + : typeof inputAction === 'object' + ? inputAction : {}; //Paging if (settings.oInit.paging) { @@ -463,7 +466,7 @@ datatables.defaultConfigurations.scrollX = true; - datatables.defaultConfigurations.responsive = true; + datatables.defaultConfigurations.responsive = true; datatables.defaultConfigurations.language = function () { return { @@ -484,6 +487,6 @@ }; }; - datatables.defaultConfigurations.dom = '<"dataTable_filters"f>rt<"row dataTable_footer"<"col-auto"l><"col-auto"i><"col"p>>'; + datatables.defaultConfigurations.dom = '<"dataTable_filters"f>rt<"row dataTable_footer"<"col-auto"l><"col-auto mr-auto"i><"col-auto"p>>'; })(jQuery); 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 ad0066db55..a379c8057d 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 @@ -15,7 +15,7 @@ - + diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/RazorPages/AbpPageModel.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/RazorPages/AbpPageModel.cs index 449747d0cc..a2d02bb3fe 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/RazorPages/AbpPageModel.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/AspNetCore/Mvc/UI/RazorPages/AbpPageModel.cs @@ -27,6 +27,7 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.RazorPages { public IAbpLazyServiceProvider LazyServiceProvider { get; set; } + [Obsolete("Use LazyServiceProvider instead.")] public IServiceProvider ServiceProvider { get; set; } protected IClock Clock => LazyServiceProvider.LazyGetRequiredService(); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs index 52f1d251cb..85822414cf 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpController.cs @@ -25,6 +25,7 @@ namespace Volo.Abp.AspNetCore.Mvc { public IAbpLazyServiceProvider LazyServiceProvider { get; set; } + [Obsolete("Use LazyServiceProvider instead.")] public IServiceProvider ServiceProvider { get; set; } protected IUnitOfWorkManager UnitOfWorkManager => LazyServiceProvider.LazyGetRequiredService(); diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpMvcOptionsExtensions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpMvcOptionsExtensions.cs index 8cbba0fc46..873c532ba3 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpMvcOptionsExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpMvcOptionsExtensions.cs @@ -1,7 +1,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.DependencyInjection; using Volo.Abp.AspNetCore.Mvc.Auditing; -using Volo.Abp.AspNetCore.Mvc.Content; +using Volo.Abp.AspNetCore.Mvc.ContentFormatters; using Volo.Abp.AspNetCore.Mvc.Conventions; using Volo.Abp.AspNetCore.Mvc.ExceptionHandling; using Volo.Abp.AspNetCore.Mvc.Features; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpViewComponent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpViewComponent.cs index 2ac02b8ac5..215f31b855 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpViewComponent.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpViewComponent.cs @@ -10,6 +10,7 @@ namespace Volo.Abp.AspNetCore.Mvc { public IAbpLazyServiceProvider LazyServiceProvider { get; set; } + [Obsolete("Use LazyServiceProvider instead.")] public IServiceProvider ServiceProvider { get; set; } protected Type ObjectMapperContext { get; set; } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpRemoteServiceApiDescriptionProvider.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpRemoteServiceApiDescriptionProvider.cs index ae09573d60..1a017e9925 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpRemoteServiceApiDescriptionProvider.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApiExploring/AbpRemoteServiceApiDescriptionProvider.cs @@ -3,6 +3,7 @@ using System.Linq; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.ApiExplorer; +using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.AspNetCore.Mvc.Formatters; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.Extensions.Options; @@ -19,7 +20,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApiExploring public AbpRemoteServiceApiDescriptionProvider( IModelMetadataProvider modelMetadataProvider, - IOptions mvcOptionsAccessor, + IOptions mvcOptionsAccessor, IOptions optionsAccessor) { _modelMetadataProvider = modelMetadataProvider; @@ -41,7 +42,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApiExploring { foreach (var apiResponseType in GetApiResponseTypes()) { - foreach (var result in context.Results.Where(x => IsRemoteService(x.ActionDescriptor))) + foreach (var result in context.Results.Where(IsRemoteService)) { var actionProducesResponseTypeAttributes = ReflectionHelper.GetAttributesOfMemberOrDeclaringType( @@ -62,7 +63,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApiExploring foreach (var apiResponse in _options.SupportedResponseTypes) { apiResponse.ModelMetadata = _modelMetadataProvider.GetMetadataForType(apiResponse.Type); - + foreach (var responseTypeMetadataProvider in _mvcOptions.OutputFormatters.OfType()) { var formatterSupportedContentTypes = responseTypeMetadataProvider.GetSupportedContentTypes(null, apiResponse.Type); @@ -85,10 +86,29 @@ namespace Volo.Abp.AspNetCore.Mvc.ApiExploring return _options.SupportedResponseTypes; } - protected virtual bool IsRemoteService(ActionDescriptor actionDescriptor) + protected virtual bool IsRemoteService(ApiDescription actionDescriptor) { - var remoteServiceAttr = ReflectionHelper.GetSingleAttributeOfMemberOrDeclaringTypeOrDefault(actionDescriptor.GetMethodInfo()); - return remoteServiceAttr != null && remoteServiceAttr.IsEnabled; + if (actionDescriptor.ActionDescriptor is ControllerActionDescriptor controllerActionDescriptor) + { + var remoteServiceAttr = ReflectionHelper.GetSingleAttributeOfMemberOrDeclaringTypeOrDefault(controllerActionDescriptor.MethodInfo); + if (remoteServiceAttr != null && remoteServiceAttr.IsEnabled) + { + return true; + } + + remoteServiceAttr = ReflectionHelper.GetSingleAttributeOfMemberOrDeclaringTypeOrDefault(controllerActionDescriptor.ControllerTypeInfo); + if (remoteServiceAttr != null && remoteServiceAttr.IsEnabled) + { + return true; + } + + if (typeof(IRemoteService).IsAssignableFrom(controllerActionDescriptor.ControllerTypeInfo)) + { + return true; + } + } + + return false; } } -} \ No newline at end of file +} 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 5cd1333f34..ff7f4913a8 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 @@ -25,17 +25,20 @@ namespace Volo.Abp.AspNetCore.Mvc { public ILogger Logger { get; set; } + private readonly AspNetCoreApiDescriptionModelProviderOptions _options; private readonly IApiDescriptionGroupCollectionProvider _descriptionProvider; - private readonly AbpAspNetCoreMvcOptions _options; + private readonly AbpAspNetCoreMvcOptions _abpAspNetCoreMvcOptions; private readonly AbpApiDescriptionModelOptions _modelOptions; public AspNetCoreApiDescriptionModelProvider( + IOptions options, IApiDescriptionGroupCollectionProvider descriptionProvider, - IOptions options, + IOptions abpAspNetCoreMvcOptions, IOptions modelOptions) { - _descriptionProvider = descriptionProvider; _options = options.Value; + _descriptionProvider = descriptionProvider; + _abpAspNetCoreMvcOptions = abpAspNetCoreMvcOptions.Value; _modelOptions = modelOptions.Value; Logger = NullLogger.Instance; @@ -81,15 +84,14 @@ namespace Volo.Abp.AspNetCore.Mvc ); var controllerModel = moduleModel.GetOrAddController( - controllerType.FullName, - CalculateControllerName(controllerType, setting), + _options.ControllerNameGenerator(controllerType, setting), controllerType, _modelOptions.IgnoredInterfaces ); var method = apiDescription.ActionDescriptor.GetMethodInfo(); - var uniqueMethodName = GetUniqueActionName(method); + var uniqueMethodName = _options.ActionNameGenerator(method); if (controllerModel.Actions.ContainsKey(uniqueMethodName)) { Logger.LogWarning( @@ -119,44 +121,6 @@ namespace Volo.Abp.AspNetCore.Mvc AddParameterDescriptionsToModel(actionModel, method, apiDescription); } - private static string CalculateControllerName(Type controllerType, ConventionalControllerSetting setting) - { - var controllerName = controllerType.Name.RemovePostFix("Controller") - .RemovePostFix(ApplicationService.CommonPostfixes); - - if (setting?.UrlControllerNameNormalizer != null) - { - controllerName = - setting.UrlControllerNameNormalizer( - new UrlControllerNameNormalizerContext(setting.RootPath, controllerName)); - } - - return controllerName; - } - - private static string GetUniqueActionName(MethodInfo method) - { - var methodNameBuilder = new StringBuilder(method.Name); - - var parameters = method.GetParameters(); - if (parameters.Any()) - { - methodNameBuilder.Append("By"); - - for (var i = 0; i < parameters.Length; i++) - { - if (i > 0) - { - methodNameBuilder.Append("And"); - } - - methodNameBuilder.Append(parameters[i].Name.ToPascalCase()); - } - } - - return methodNameBuilder.ToString(); - } - private static List GetSupportedVersions(Type controllerType, MethodInfo method, ConventionalControllerSetting setting) { @@ -307,6 +271,7 @@ namespace Volo.Abp.AspNetCore.Mvc actionModel.AddParameter(ParameterApiDescriptionModel.Create( parameterDescription.Name, + _options.ApiParameterNameGenerator?.Invoke(parameterDescription), matchedMethodParamName, parameterDescription.Type, parameterDescription.RouteInfo?.IsOptional ?? false, @@ -377,7 +342,7 @@ namespace Volo.Abp.AspNetCore.Mvc [CanBeNull] private ConventionalControllerSetting FindSetting(Type controllerType) { - foreach (var controllerSetting in _options.ConventionalControllers.ConventionalControllerSettings) + foreach (var controllerSetting in _abpAspNetCoreMvcOptions.ConventionalControllers.ConventionalControllerSettings) { if (controllerSetting.ControllerTypes.Contains(controllerType)) { diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProviderOptions.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProviderOptions.cs new file mode 100644 index 0000000000..f807efcfdf --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProviderOptions.cs @@ -0,0 +1,84 @@ +using System; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Text.Json.Serialization; +using Microsoft.AspNetCore.Mvc.ApiExplorer; +using Microsoft.AspNetCore.Mvc.ModelBinding.Metadata; +using Volo.Abp.Application.Services; +using Volo.Abp.AspNetCore.Mvc.Conventions; + +namespace Volo.Abp.AspNetCore.Mvc +{ + public class AspNetCoreApiDescriptionModelProviderOptions + { + public Func ControllerNameGenerator { get; set; } + + public Func ActionNameGenerator { get; set; } + + public Func ApiParameterNameGenerator { get; set; } + + public AspNetCoreApiDescriptionModelProviderOptions() + { + ControllerNameGenerator = (controllerType, setting) => + { + var controllerName = controllerType.Name.RemovePostFix("Controller") + .RemovePostFix(ApplicationService.CommonPostfixes); + + if (setting?.UrlControllerNameNormalizer != null) + { + controllerName = + setting.UrlControllerNameNormalizer( + new UrlControllerNameNormalizerContext(setting.RootPath, controllerName)); + } + + return controllerName; + }; + + ActionNameGenerator = (method) => + { + var methodNameBuilder = new StringBuilder(method.Name); + + var parameters = method.GetParameters(); + if (parameters.Any()) + { + methodNameBuilder.Append("By"); + + for (var i = 0; i < parameters.Length; i++) + { + if (i > 0) + { + methodNameBuilder.Append("And"); + } + + methodNameBuilder.Append(parameters[i].Name.ToPascalCase()); + } + } + + return methodNameBuilder.ToString(); + }; + + ApiParameterNameGenerator = (apiParameterDescription) => + { + if (apiParameterDescription.ModelMetadata is DefaultModelMetadata defaultModelMetadata) + { + var jsonPropertyNameAttribute = (System.Text.Json.Serialization.JsonPropertyNameAttribute) + defaultModelMetadata?.Attributes?.PropertyAttributes?.FirstOrDefault(x => x is System.Text.Json.Serialization.JsonPropertyNameAttribute); + if (jsonPropertyNameAttribute != null) + { + return jsonPropertyNameAttribute.Name; + } + + var jsonPropertyAttribute = (Newtonsoft.Json.JsonPropertyAttribute) + defaultModelMetadata?.Attributes?.PropertyAttributes?.FirstOrDefault(x => x is Newtonsoft.Json.JsonPropertyAttribute); + if (jsonPropertyAttribute != null) + { + return jsonPropertyAttribute.PropertyName; + } + } + + return null; + }; + } + } +} diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/InternalRemoteStreamContent.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/InternalRemoteStreamContent.cs deleted file mode 100644 index aaaa849f4f..0000000000 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/InternalRemoteStreamContent.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System.IO; -using Microsoft.AspNetCore.Http; -using Volo.Abp.Content; - -namespace Volo.Abp.AspNetCore.Mvc.Content -{ - internal class InternalRemoteStreamContent : IRemoteStreamContent - { - private readonly HttpContext _httpContext; - - public InternalRemoteStreamContent(HttpContext httpContext) - { - _httpContext = httpContext; - } - - public string ContentType => _httpContext.Request.ContentType; - - public long? ContentLength => _httpContext.Request.ContentLength; - - public Stream GetStream() - { - return _httpContext.Request.Body; - } - } -} diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentInputFormatter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentInputFormatter.cs similarity index 70% rename from framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentInputFormatter.cs rename to framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentInputFormatter.cs index a4f5668b7d..ba07e28f77 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentInputFormatter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentInputFormatter.cs @@ -1,10 +1,10 @@ using System; using System.Threading.Tasks; -using Microsoft.Net.Http.Headers; using Microsoft.AspNetCore.Mvc.Formatters; +using Microsoft.Net.Http.Headers; using Volo.Abp.Content; -namespace Volo.Abp.AspNetCore.Mvc.Content +namespace Volo.Abp.AspNetCore.Mvc.ContentFormatters { public class RemoteStreamContentInputFormatter : InputFormatter { @@ -20,9 +20,10 @@ namespace Volo.Abp.AspNetCore.Mvc.Content public override Task ReadRequestBodyAsync(InputFormatterContext context) { - return InputFormatterResult.SuccessAsync( - new InternalRemoteStreamContent(context.HttpContext) - ); + return InputFormatterResult.SuccessAsync(new RemoteStreamContent(context.HttpContext.Request.Body) + { + ContentType = context.HttpContext.Request.ContentType + }); } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentOutputFormatter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentOutputFormatter.cs similarity index 65% rename from framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentOutputFormatter.cs rename to framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentOutputFormatter.cs index 706e514254..685822a4b6 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Content/RemoteStreamContentOutputFormatter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ContentFormatters/RemoteStreamContentOutputFormatter.cs @@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc.Formatters; using Microsoft.Net.Http.Headers; using Volo.Abp.Content; -namespace Volo.Abp.AspNetCore.Mvc.Content +namespace Volo.Abp.AspNetCore.Mvc.ContentFormatters { public class RemoteStreamContentOutputFormatter : OutputFormatter { @@ -21,9 +21,16 @@ namespace Volo.Abp.AspNetCore.Mvc.Content public override async Task WriteResponseBodyAsync(OutputFormatterWriteContext context) { var remoteStream = (IRemoteStreamContent)context.Object; - using (var stream = remoteStream.GetStream()) + + if (remoteStream != null) { - await stream.CopyToAsync(context.HttpContext.Response.Body); + context.HttpContext.Response.ContentType = remoteStream.ContentType; + + using (var stream = remoteStream.GetStream()) + { + stream.Position = 0; + await stream.CopyToAsync(context.HttpContext.Response.Body); + } } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs index 4d1490ec40..996e495588 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs @@ -73,7 +73,7 @@ namespace Volo.Abp.AspNetCore.Mvc.Conventions protected virtual void RemoveDuplicateControllers(ApplicationModel application) { - var derivedControllerModels = new List(); + var controllerModelsToRemove = new List(); foreach (var controllerModel in application.Controllers) { @@ -87,19 +87,42 @@ namespace Volo.Abp.AspNetCore.Mvc.Conventions continue; } + var exposeServicesAttr = ReflectionHelper.GetSingleAttributeOrDefault(controllerModel.ControllerType); + if (exposeServicesAttr.IncludeSelf) + { + var exposedControllerModels = application.Controllers + .Where(cm => exposeServicesAttr.ServiceTypes.Contains(cm.ControllerType)) + .ToArray(); + + controllerModelsToRemove.AddRange(exposedControllerModels); + Logger.LogInformation($"Removing the controller{(exposedControllerModels.Length > 1 ? "s" : "")} {exposeServicesAttr.ServiceTypes.Select(c => c.AssemblyQualifiedName).JoinAsString(", ")} from the application model since {(exposedControllerModels.Length > 1 ? "they are" : "it is")} replaced by the controller: {controllerModel.ControllerType.AssemblyQualifiedName}"); + continue; + } + var baseControllerTypes = controllerModel.ControllerType .GetBaseClasses(typeof(Controller), includeObject: false) .Where(t => !t.IsAbstract) .ToArray(); - if (baseControllerTypes.Length > 0) + if (baseControllerTypes.Length == 0) { - derivedControllerModels.Add(controllerModel); - Logger.LogInformation($"Removing the controller {controllerModel.ControllerType.AssemblyQualifiedName} from the application model since it replaces the controller(s): {baseControllerTypes.Select(c => c.AssemblyQualifiedName).JoinAsString(", ")}"); + continue; } + + var baseControllerModels = application.Controllers + .Where(cm => baseControllerTypes.Contains(cm.ControllerType)) + .ToArray(); + + if (baseControllerModels.Length == 0) + { + continue; + } + + controllerModelsToRemove.Add(controllerModel); + Logger.LogInformation($"Removing the controller {controllerModel.ControllerType.AssemblyQualifiedName} from the application model since it replaces the controller(s): {baseControllerTypes.Select(c => c.AssemblyQualifiedName).JoinAsString(", ")}"); } - application.Controllers.RemoveAll(derivedControllerModels); + application.Controllers.RemoveAll(controllerModelsToRemove); } protected virtual void ConfigureRemoteService(ControllerModel controller, [CanBeNull] ConventionalControllerSetting configuration) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Localization/AbpLanguagesController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Localization/AbpLanguagesController.cs index 06b9c9a620..6b73aa26da 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Localization/AbpLanguagesController.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Localization/AbpLanguagesController.cs @@ -1,7 +1,7 @@ -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Localization; +using Microsoft.AspNetCore.Localization; using Microsoft.AspNetCore.Mvc; using System; +using Microsoft.AspNetCore.RequestLocalization; using Volo.Abp.Localization; namespace Volo.Abp.AspNetCore.Mvc.Localization @@ -20,12 +20,10 @@ namespace Volo.Abp.AspNetCore.Mvc.Localization throw new AbpException("Unknown language: " + culture + ". It must be a valid culture!"); } - string cookieValue = CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(culture, uiCulture)); - - Response.Cookies.Append(CookieRequestCultureProvider.DefaultCookieName, cookieValue, new CookieOptions - { - Expires = Clock.Now.AddYears(2) - }); + AbpRequestCultureCookieHelper.SetCultureCookie( + HttpContext, + new RequestCulture(culture, uiCulture) + ); if (!string.IsNullOrWhiteSpace(returnUrl)) { 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 95a961b814..0512e28f7a 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 @@ -50,7 +50,6 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow return; } - //Begin a new, independent unit of work using (var uow = unitOfWorkManager.Begin(options)) { var result = await next(); @@ -58,6 +57,10 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow { await uow.CompleteAsync(context.HttpContext.RequestAborted); } + else + { + await uow.RollbackAsync(context.HttpContext.RequestAborted); + } } } diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowPageFilter.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowPageFilter.cs index 30c713940f..d808053592 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowPageFilter.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Uow/AbpUowPageFilter.cs @@ -55,7 +55,6 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow return; } - //Begin a new, independent unit of work using (var uow = unitOfWorkManager.Begin(options)) { var result = await next(); @@ -63,6 +62,10 @@ namespace Volo.Abp.AspNetCore.Mvc.Uow { await uow.CompleteAsync(context.HttpContext.RequestAborted); } + else + { + await uow.RollbackAsync(context.HttpContext.RequestAborted); + } } } diff --git a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHub.cs b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHub.cs index a9d9316f41..616cbd3706 100644 --- a/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHub.cs +++ b/framework/src/Volo.Abp.AspNetCore.SignalR/Volo/Abp/AspNetCore/SignalR/AbpHub.cs @@ -17,6 +17,7 @@ namespace Volo.Abp.AspNetCore.SignalR { public IAbpLazyServiceProvider LazyServiceProvider { get; set; } + [Obsolete("Use LazyServiceProvider instead.")] public IServiceProvider ServiceProvider { get; set; } protected ILoggerFactory LoggerFactory => LazyServiceProvider.LazyGetService(); 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 568ecfef7b..a409355ef0 100644 --- a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs +++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/Builder/AbpApplicationBuilderExtensions.cs @@ -6,6 +6,7 @@ using Microsoft.Extensions.Hosting; using Volo.Abp; using Volo.Abp.AspNetCore.Auditing; using Volo.Abp.AspNetCore.ExceptionHandling; +using Volo.Abp.AspNetCore.Security; using Volo.Abp.AspNetCore.Security.Claims; using Volo.Abp.AspNetCore.Tracing; using Volo.Abp.AspNetCore.Uow; @@ -82,5 +83,10 @@ namespace Microsoft.AspNetCore.Builder { return app.UseMiddleware(); } + + public static IApplicationBuilder UseAbpSecurityHeaders(this IApplicationBuilder app) + { + return app.UseMiddleware(); + } } } diff --git a/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestCultureCookieHelper.cs b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestCultureCookieHelper.cs new file mode 100644 index 0000000000..0f27925496 --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore/Microsoft/AspNetCore/RequestLocalization/AbpRequestCultureCookieHelper.cs @@ -0,0 +1,23 @@ +using System; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Localization; + +namespace Microsoft.AspNetCore.RequestLocalization +{ + public static class AbpRequestCultureCookieHelper + { + public static void SetCultureCookie( + HttpContext httpContext, + RequestCulture requestCulture) + { + httpContext.Response.Cookies.Append( + CookieRequestCultureProvider.DefaultCookieName, + CookieRequestCultureProvider.MakeCookieValue(requestCulture), + new CookieOptions + { + Expires = DateTime.Now.AddYears(2) + } + ); + } + } +} diff --git a/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/AbpSecurityHeadersMiddleware.cs b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/AbpSecurityHeadersMiddleware.cs new file mode 100644 index 0000000000..28b0f3a48e --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore/Volo/Abp/AspNetCore/Security/AbpSecurityHeadersMiddleware.cs @@ -0,0 +1,30 @@ +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Primitives; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.AspNetCore.Security +{ + public class AbpSecurityHeadersMiddleware : IMiddleware, ITransientDependency + { + public async Task InvokeAsync(HttpContext context, RequestDelegate next) + { + /*X-Content-Type-Options header tells the browser to not try and “guess” what a mimetype of a resource might be, and to just take what mimetype the server has returned as fact.*/ + AddHeaderIfNotExists(context, "X-Content-Type-Options", "nosniff"); + + /*X-XSS-Protection is a feature of Internet Explorer, Chrome and Safari that stops pages from loading when they detect reflected cross-site scripting (XSS) attacks*/ + AddHeaderIfNotExists(context, "X-XSS-Protection", "1; mode=block"); + + /*The X-Frame-Options HTTP response header can be used to indicate whether or not a browser should be allowed to render a page in a ,