mirror of https://github.com/abpframework/abp.git
585 changed files with 13614 additions and 10907 deletions
@ -0,0 +1,7 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<configuration> |
|||
<packageSources> |
|||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" /> |
|||
<add key="BlazoriseMyGet" value="https://www.myget.org/F/blazorise/api/v3/index.json" /> |
|||
</packageSources> |
|||
</configuration> |
|||
@ -0,0 +1,271 @@ |
|||
# ABP Framework 3.3 RC Has Been Published |
|||
|
|||
We have released the [ABP Framework](https://abp.io/) (and the [ABP Commercial](https://commercial.abp.io/)) `3.3.0-rc.1` today. This blog post introduces the new features and important changes in the new version. |
|||
|
|||
## Get Started with the 3.3 RC.1 |
|||
|
|||
If you want to try the version `3.3.0-rc.1` today, follow the steps below; |
|||
|
|||
1) **Upgrade** the ABP CLI to the version `3.3.0-rc.1` using a command line terminal: |
|||
|
|||
````bash |
|||
dotnet tool update Volo.Abp.Cli -g --version 3.3.0-rc.1 |
|||
```` |
|||
|
|||
**or install** if you haven't installed before: |
|||
|
|||
````bash |
|||
dotnet tool install Volo.Abp.Cli -g --version 3.3.0-rc.1 |
|||
```` |
|||
|
|||
2) Create a **new application** with the `--preview` option: |
|||
|
|||
````bash |
|||
abp new BookStore --preview |
|||
```` |
|||
|
|||
See the [ABP CLI documentation](https://docs.abp.io/en/abp/3.3/CLI) for all the available options. |
|||
|
|||
> You can also use the *Direct Download* tab on the [Get Started](https://abp.io/get-started) page by selecting the Preview checkbox. |
|||
|
|||
## What's new with the ABP Framework 3.3 |
|||
|
|||
### The Blazor UI |
|||
|
|||
We had released an experimental early preview version of the Blazor UI with the [previous version](https://blog.abp.io/abp/ABP-Framework-ABP-Commercial-3.2-RC-With-The-New-Blazor-UI). In this version, we've completed most of the fundamental infrastructure features and the application modules (like identity and tenant management). |
|||
|
|||
It currently has almost the same functionalities as the other UI types (Angular & MVC / Razor Pages). |
|||
|
|||
**Example screenshot**: User management page of the Blazor UI |
|||
|
|||
 |
|||
|
|||
> We've adapted the [Lepton Theme](https://commercial.abp.io/themes) for the ABP Commercial, see the related section below. |
|||
|
|||
We are still working on the fundamentals. So, the next version may introduce breaking changes of the Blazor UI. We will work hard to keep them with the minimal effect on your application code. |
|||
|
|||
#### Breaking Changes on the Blazor UI |
|||
|
|||
There are some breaking changes with the Blazor UI. If you've built an application and upgrade it, your application might not properly work. See [the migration guide](https://docs.abp.io/en/abp/3.3/Migration-Guides/BlazorUI-3_3) for the changes you need to do after upgrading your application. |
|||
|
|||
### Automatic Validation for AntiForgery Token for HTTP APIs |
|||
|
|||
Starting with the version 3.3, all your HTTP API endpoints are **automatically protected** against CSRF attacks, unless you disable it for your application. So, no configuration needed, just upgrade the ABP Framework. |
|||
|
|||
[See the documentation](https://docs.abp.io/en/abp/3.3/CSRF-Anti-Forgery) to if you want to understand why you need it and how ABP Framework solves the problem. |
|||
|
|||
### Rebus Integration Package for the Distributed Event Bus |
|||
|
|||
[Rebus](https://github.com/rebus-org/Rebus) describes itself as "Simple and lean service bus implementation for .NET". There are a lot of integration packages like RabbitMQ and Azure Service Bus for the Rebus. The new [Volo.Abp.EventBus.Rebus](https://www.nuget.org/packages/Volo.Abp.EventBus.Rebus) package allows you to use the Rebus as the [distributed event bus](https://docs.abp.io/en/abp/latest/Distributed-Event-Bus) for the ABP Framework. |
|||
|
|||
See [the documentation](https://docs.abp.io/en/abp/3.3/Distributed-Event-Bus-Rebus-Integration) to learn how to use Rebus with the ABP Framework. |
|||
|
|||
### Async Repository LINQ Extension Methods |
|||
|
|||
You have a problem when you want to use **Async LINQ Extension Methods** (e.g. `FirstOrDefaultAsync(...)`) in your **domain** and **application** layers. These async methods are **not included in the standard LINQ extension methods**. Those are defined by the [Microsoft.EntityFrameworkCore](https://www.nuget.org/packages/Microsoft.EntityFrameworkCore) NuGet package (see [the code](https://github.com/dotnet/efcore/blob/main/src/EFCore/Extensions/EntityFrameworkQueryableExtensions.cs)). To be able to use these `async` methods, you need to reference to the `Microsoft.EntityFrameworkCore` package. |
|||
|
|||
If you don't want to depend on the EF Core in your business layer, then ABP Framework provides the `IAsyncQueryableExecuter` service to execute your queries asynchronously without depending on the EF Core package. You can see [the documentation](https://docs.abp.io/en/abp/latest/Repositories#option-3-iasyncqueryableexecuter) to get more information about this service. |
|||
|
|||
ABP Framework version 3.3 takes this one step further and allows you to directly execute the async LINQ extension methods on the `IRepository` interface. |
|||
|
|||
**Example: Use `CountAsync` and `FirstOrDefaultAsync` methods on the repositories** |
|||
|
|||
````csharp |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Services; |
|||
using Volo.Abp.Domain.Repositories; |
|||
|
|||
namespace MyCompanyName.MyProjectName |
|||
{ |
|||
public class BookAppService : ApplicationService, IBookAppService |
|||
{ |
|||
private readonly IRepository<Book, Guid> _bookRepository; |
|||
|
|||
public BookAppService(IRepository<Book, Guid> bookRepository) |
|||
{ |
|||
_bookRepository = bookRepository; |
|||
} |
|||
|
|||
public async Task DemoAsync() |
|||
{ |
|||
var countAll = await _bookRepository |
|||
.CountAsync(); |
|||
|
|||
var count = await _bookRepository |
|||
.CountAsync(x => x.Name.Contains("A")); |
|||
|
|||
var book1984 = await _bookRepository |
|||
.FirstOrDefaultAsync(x => x.Name == "1984"); |
|||
} |
|||
} |
|||
} |
|||
```` |
|||
|
|||
All the standard LINQ methods are supported: *AllAsync, AnyAsync, AverageAsync, ContainsAsync, CountAsync, FirstAsync, FirstOrDefaultAsync, LastAsync, LastOrDefaultAsync, LongCountAsync, MaxAsync, MinAsync, SingleAsync, SingleOrDefaultAsync, SumAsync, ToArrayAsync, ToListAsync*. |
|||
|
|||
This approach still has a limitation. You need to execute 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(); |
|||
```` |
|||
|
|||
This is because the object returned from the `Where` method is not a repository object, it is a standard `IQueryable`. In such cases, you can still use the `IAsyncQueryableExecuter`: |
|||
|
|||
````csharp |
|||
var count = await AsyncExecuter.CountAsync( |
|||
_bookRepository.Where(x => x.Name.Contains("A")) |
|||
); |
|||
```` |
|||
|
|||
`AsyncExecuter` has all the standard extension methods, so you don't have any restriction here. See [the repository documentation](https://docs.abp.io/en/abp/latest/Repositories#iqueryable-async-operations) for all the options you have. |
|||
|
|||
> ABP Framework does its best to not depend on the EF Core and still be able to use the async LINQ extension methods. However, there is no problem to depend on the EF Core for your application, you can add the `Microsoft.EntityFrameworkCore` NuGet package and use the native methods. |
|||
|
|||
### Stream Support for the Application Service Methods |
|||
|
|||
[Application services](https://docs.abp.io/en/abp/latest/Application-Services) are consumed by clients and the parameters and return values (typically [Data Transfer Objects](https://docs.abp.io/en/abp/latest/Data-Transfer-Objects)). In case of the client is a remote application, then these objects should be serialized & deserialized. |
|||
|
|||
Until the version 3.3, we hadn't suggest to use the `Stream` in the application service contracts, since it is not serializable/deserializable. However, with the version 3.3, ABP Framework properly supports this scenario by introducing the new `IRemoteStreamContent` interface. |
|||
|
|||
Example: An application service that can get or return streams |
|||
|
|||
````csharp |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.Application.Services; |
|||
using Volo.Abp.Content; |
|||
|
|||
namespace MyProject.Test |
|||
{ |
|||
public interface ITestAppService : IApplicationService |
|||
{ |
|||
Task Upload(Guid id, IRemoteStreamContent streamContent); |
|||
Task<IRemoteStreamContent> Download(Guid id); |
|||
} |
|||
} |
|||
```` |
|||
|
|||
The implementation can be as shown below: |
|||
|
|||
````csharp |
|||
using System; |
|||
using System.IO; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp; |
|||
using Volo.Abp.Application.Services; |
|||
using Volo.Abp.Content; |
|||
|
|||
namespace MyProject.Test |
|||
{ |
|||
public class TestAppService : ApplicationService, ITestAppService |
|||
{ |
|||
public Task<IRemoteStreamContent> Download(Guid id) |
|||
{ |
|||
var fs = new FileStream("C:\\Temp\\" + id + ".blob", FileMode.OpenOrCreate); |
|||
return Task.FromResult( |
|||
(IRemoteStreamContent) new RemoteStreamContent(fs) { |
|||
ContentType = "application/octet-stream" |
|||
} |
|||
); |
|||
} |
|||
|
|||
public async Task Upload(Guid id, IRemoteStreamContent streamContent) |
|||
{ |
|||
using (var fs = new FileStream("C:\\Temp\\" + id + ".blob", FileMode.Create)) |
|||
{ |
|||
await streamContent.GetStream().CopyToAsync(fs); |
|||
await fs.FlushAsync(); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
```` |
|||
|
|||
> This is just a demo code. Do it better in your production code :) |
|||
|
|||
Thanks to [@alexandru-bagu](https://github.com/alexandru-bagu) for the great contribution! |
|||
|
|||
### Other Changes |
|||
|
|||
* Upgraded all the .NET Core / ASP.NET Core related packages to the version 3.1.8. If you have additional dependencies to the .NET Core / ASP.NET Core related packages, we suggest you to updates your packages to the version 3.1.8 to have the latest bug and security fixes published by Microsoft. |
|||
* The blogging module now uses the [BLOB Storing](https://docs.abp.io/en/abp/latest/Blob-Storing) system to store images & files of the blog posts. If you are using this module, then you need to manually migrate the local files to the BLOB Storing system after the upgrade. |
|||
* The Angular UI is now redirecting to the profile management page of the MVC UI instead of using its own UI, if you've configured the authorization code flow (which is default since the version 3.2.0). |
|||
|
|||
## What's new with the ABP Commercial 3.3 |
|||
|
|||
### The Blazor UI |
|||
|
|||
We have good news for the ABP Commercial Blazor UI too. We have implemented the [Lepton Theme](https://commercial.abp.io/themes) integration, so it is now available with the Blazor UI. Also, implemented most of the fundamental [modules](https://commercial.abp.io/modules). |
|||
|
|||
**A screenshot from the ABP Commercial startup template with the Blazor UI** |
|||
|
|||
 |
|||
|
|||
There are still missing features and modules. However, we are working on it to have a more complete version in the next release. |
|||
|
|||
#### Breaking Changes on the Blazor UI |
|||
|
|||
There are some breaking changes with the Blazor UI. If you've built an application and upgrade it, your application might not properly work. See the [ABP Commercial Blazor UI v 3.3 Migration Guide](https://docs.abp.io/en/commercial/3.3/migration-guides/blazor-ui-3_3) for the changes you need to do after upgrading your application. |
|||
|
|||
#### Known Issues |
|||
|
|||
When you create a new project, profile management doesn't work, you get an exception because it can't find the `/libs/cropperjs/css/cropper.min.css` file. To fix the issue; |
|||
|
|||
* Add `"@volo/account": "^3.3.0-rc.1"` to the `package.json` in the `.Host` project. |
|||
* Run `yarn` (or `npm install`), then `gulp` on a command line terminal in the root folder of the `.Host` project. |
|||
|
|||
### Multi-Tenant Social Logins |
|||
|
|||
[Account module](https://commercial.abp.io/modules/Volo.Account.Pro) now supports to manage the social/external logins in the UI. You can **enable/disable** and **set options** in the settings page. It also supports to use **different credentials for the tenants** and it is also **configured on the runtime**. |
|||
|
|||
 |
|||
|
|||
### Linked Accounts |
|||
|
|||
Linked user system allows you to link other accounts (including account in a different tenant) with your account, so you can switch between different accounts with a single-click. It is practical since you no longer need to logout and login again with entering the credentials of the target account. |
|||
|
|||
To manage the linked accounts, go to the profile management page from the user menu; |
|||
|
|||
 |
|||
|
|||
### Paypal & Stripe Integrations |
|||
|
|||
The [Payment Module](https://commercial.abp.io/modules/Volo.Payment) was supporting PayU and 2Checkout providers until the version 3.3. It's now integrated to PayPal and Stripe. See the [technical documentation](https://docs.abp.io/en/commercial/latest/modules/payment) to learn how to use it. |
|||
|
|||
### ABP Suite Improvements |
|||
|
|||
We've done a lot of small improvements for the [ABP Suite](https://commercial.abp.io/tools/suite). Some of the enhancements are; |
|||
|
|||
* Show the previously installed modules as *installed* on the module list. |
|||
* Switch between the latest stable, the latest [preview](https://docs.abp.io/en/abp/latest/Previews) and the latest [nightly build](https://docs.abp.io/en/abp/latest/Nightly-Builds) versions of the ABP related packages. |
|||
* Moved the file that stores the *previously created entities* into the solution folder to allow you to store it in your source control system. |
|||
|
|||
### Others |
|||
|
|||
* Added an option to the Account Module to show reCAPTCHA on the login & the registration forms. |
|||
|
|||
Besides the new features introduced in this post, we've done a lot of small other enhancements and bug fixes to provide a better development experience and increase the developer productivity. |
|||
|
|||
## New Articles |
|||
|
|||
The core ABP Framework team & the community continue to publish new articles on the [ABP Community](https://community.abp.io/) web site. The recently published articles are; |
|||
|
|||
* [Replacing Email Templates and Sending Emails](https://community.abp.io/articles/replacing-email-templates-and-sending-emails-jkeb8zzh) (by [@EngincanV](https://community.abp.io/members/EngincanV)) |
|||
* [How to Add Custom Properties to the User Entity](https://community.abp.io/articles/how-to-add-custom-property-to-the-user-entity-6ggxiddr) (by [@berkansasmaz](https://community.abp.io/members/berkansasmaz)) |
|||
* [Using the AdminLTE Theme with the ABP Framework MVC / Razor Pages UI](https://community.abp.io/articles/using-the-adminlte-theme-with-the-abp-framework-mvc-razor-pages-ui-gssbhb7m) (by [@mucahiddanis](https://community.abp.io/members/mucahiddanis)) |
|||
* [Using DevExtreme Angular Components With the ABP Framework](https://community.abp.io/articles/using-devextreme-angular-components-with-the-abp-framework-x5nyvj3i) (by [@bunyamin](https://community.abp.io/members/bunyamin)) |
|||
|
|||
It is appreciated if you want to [submit an article](https://community.abp.io/articles/submit) related to the ABP Framework. |
|||
|
|||
## About the Next Release |
|||
|
|||
The next version will be `4.0.0`. We are releasing a major version, since we will move the ABP Framework to .NET 5.0. We see that for most of the applications this will not be a breaking change and we hope you easily upgrade to it. |
|||
|
|||
The planned 4.0.0-rc.1 (Release Candidate) version date is **November 11**, just after the Microsoft releases the .NET 5.0 final. The planned 4.0.0 final release date is **November 26**. |
|||
|
|||
Follow the [GitHub milestones](https://github.com/abpframework/abp/milestones) for all the planned ABP Framework version release dates. |
|||
|
|||
## Feedback |
|||
|
|||
Please check out the ABP Framework 3.3.0 RC and [provide feedback](https://github.com/abpframework/abp/issues/new) to help us to release a more stable version. The planned release date for the [3.3.0 final](https://github.com/abpframework/abp/milestone/44) version is October 27th. |
|||
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 181 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 199 KiB |
@ -0,0 +1,13 @@ |
|||
# Migration Guide for the Blazor UI from the v3.2 to the v3.3 |
|||
|
|||
## Startup Template Changes |
|||
|
|||
* Remove `Volo.Abp.Account.Blazor` NuGet package from your `.Blazor.csproj` and add `Volo.Abp.TenantManagement.Blazor` NuGet package. |
|||
* Remove the ``typeof(AbpAccountBlazorModule)`` from the dependency list of *YourProjectBlazorModule* class and add the `typeof(AbpTenantManagementBlazorModule)`. |
|||
* Add `@using Volo.Abp.BlazoriseUI` and `@using Volo.Abp.BlazoriseUI.Components` into the `_Imports.razor` file. |
|||
* Remove the `div` with `id="blazor-error-ui"` (with its contents) from the `wwwroot/index.html ` file, since the ABP Framework now shows error messages as a better message box. |
|||
|
|||
## BlazoriseCrudPageBase to AbpCrudPageBase |
|||
|
|||
Renamed `BlazoriseCrudPageBase` to `AbpCrudPageBase`. Just update the usages. It also has some changes, you may need to update method calls/usages manually. |
|||
|
|||
|
After Width: | Height: | Size: 51 KiB |
@ -0,0 +1,24 @@ |
|||
# ASP.NET Core MVC / Razor Pages UI: JavaScript Auth API |
|||
|
|||
Auth API allows you to check permissions (policies) for the current user in the client side. In this way, you can conditionally show/hide UI parts or perform your client side logic based on the current permissions. |
|||
|
|||
> This document only explains the JavaScript API. See the [authorization document](../../../Authorization.md) to understand the ABP authorization & permission system. |
|||
|
|||
## Basic Usage |
|||
|
|||
`abp.auth.isGranted(...)` function is used to check if a permission/policy has granted or not: |
|||
|
|||
````js |
|||
if (abp.auth.isGranted('DeleteUsers')) { |
|||
//TODO: Delete the user |
|||
} else { |
|||
alert("You don't have permission to delete a user!"); |
|||
} |
|||
```` |
|||
|
|||
## Other Fields & Functions |
|||
|
|||
* ` abp.auth.isAnyGranted(...)`: Gets one or more permission/policy names and returns `true` if at least one of them has granted. |
|||
* `abp.auth.areAllGranted(...)`: Gets one or more permission/policy names and returns `true` if all of them of them have granted. |
|||
* `abp.auth.policies`: This is an object where its keys are the permission/policy names. You can find all permission/policy names here. |
|||
* `abp.auth.grantedPolicies`: This is an object where its keys are the permission/policy names. You can find the granted permission/policy names here. |
|||
@ -0,0 +1,56 @@ |
|||
# ASP.NET Core MVC / Razor Pages UI: JavaScript UI Block/Busy API |
|||
|
|||
UI Block API disables (blocks) the page or a part of the page. |
|||
|
|||
## Basic Usage |
|||
|
|||
**Example: Block (disable) the complete page** |
|||
|
|||
````js |
|||
abp.ui.block(); |
|||
```` |
|||
|
|||
**Example: Block (disable) an HTML element** |
|||
|
|||
````js |
|||
abp.ui.block('#MyContainer'); |
|||
```` |
|||
|
|||
**Example: Enables the previously blocked element or page:** |
|||
|
|||
````js |
|||
abp.ui.unblock(); |
|||
```` |
|||
|
|||
## Options |
|||
|
|||
`abp.ui.block()` method can get an options object which may contain the following fields: |
|||
|
|||
* `elm`: An optional selector to find the element to be blocked (e.g. `#MyContainerId`). If not provided, the entire page is blocked. The selector can also be directly passed to the `block()` method as shown above. |
|||
* `busy`: Set to `true` to show a progress indicator on the blocked area. |
|||
* `promise`: A promise object with `always` or `finally` callbacks. This can be helpful if you want to automatically unblock the blocked area when a deferred operation completes. |
|||
|
|||
**Example: Block an element with busy indicator** |
|||
|
|||
````js |
|||
abp.ui.block({ |
|||
elm: '#MySection', |
|||
busy: true |
|||
}); |
|||
```` |
|||
|
|||
The resulting UI will look like below: |
|||
|
|||
 |
|||
|
|||
## setBusy |
|||
|
|||
`abp.ui.setBusy(...)` and `abp.ui.clearBusy()` are shortcut functions if you want to use the block with `busy` option. |
|||
|
|||
**Example: Block with busy** |
|||
|
|||
````js |
|||
abp.ui.setBusy('#MySection'); |
|||
```` |
|||
|
|||
Then you can use `abp.ui.clearBusy();` to re-enable the busy area/page. |
|||
@ -0,0 +1,49 @@ |
|||
# ASP.NET Core MVC / Razor Pages UI: JavaScript CurrentUser API |
|||
|
|||
`abp.currentUser` is an object that contains information about the current user of the application. |
|||
|
|||
> This document only explains the JavaScript API. See the [CurrentUser document](../../../CurrentUser.md) to get information about the current user in the server side. |
|||
|
|||
## Authenticated User |
|||
|
|||
If the user was authenticated, this object will be something like below: |
|||
|
|||
````js |
|||
{ |
|||
isAuthenticated: true, |
|||
id: "34f1f4a7-13cc-4b91-84d1-b91c87afa95f", |
|||
tenantId: null, |
|||
userName: "john", |
|||
name: "John", |
|||
surName: "Nash", |
|||
email: "john.nash@abp.io", |
|||
emailVerified: true, |
|||
phoneNumber: null, |
|||
phoneNumberVerified: false, |
|||
roles: ["moderator","supporter"] |
|||
} |
|||
```` |
|||
|
|||
So, `abp.currentUser.userName` returns `john` in this case. |
|||
|
|||
## Anonymous User |
|||
|
|||
If the user was not authenticated, this object will be something like below: |
|||
|
|||
````js |
|||
{ |
|||
isAuthenticated: false, |
|||
id: null, |
|||
tenantId: null, |
|||
userName: null, |
|||
name: null, |
|||
surName: null, |
|||
email: null, |
|||
emailVerified: false, |
|||
phoneNumber: null, |
|||
phoneNumberVerified: false, |
|||
roles: [] |
|||
} |
|||
```` |
|||
|
|||
You can check `abp.currentUser.isAuthenticated` to understand if the use was authenticated or not. |
|||
@ -0,0 +1,117 @@ |
|||
# ASP.NET Core MVC / Razor Pages UI: JavaScript DOM API |
|||
|
|||
`abp.dom` (Document Object Model) provides events that you can subscribe to get notified when elements dynamically added to and removed from the page (DOM). |
|||
|
|||
It is especially helpful if you want to initialize the new loaded elements. This is generally needed when you dynamically add elements to DOM (for example, get some HTML elements via AJAX) after page initialization. |
|||
|
|||
> ABP uses the [MutationObserver](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver) to observe the changes made on the DOM. |
|||
|
|||
## Node Events |
|||
|
|||
### onNodeAdded |
|||
|
|||
This event is triggered when an element is added to the DOM. Example: |
|||
|
|||
````js |
|||
abp.dom.onNodeAdded(function(args){ |
|||
console.log(args.$el); |
|||
}); |
|||
```` |
|||
|
|||
`args` object has the following fields; |
|||
|
|||
* `$el`: The JQuery selection to get the new element inserted to the DOM. |
|||
|
|||
### onNodeRemoved |
|||
|
|||
This event is triggered when an element is removed from the DOM. Example: |
|||
|
|||
````js |
|||
abp.dom.onNodeRemoved(function(args){ |
|||
console.log(args.$el); |
|||
}); |
|||
```` |
|||
|
|||
`args` object has the following fields; |
|||
|
|||
* `$el`: The JQuery selection to get the element removed from the DOM. |
|||
|
|||
## Pre-Build Initializers |
|||
|
|||
ABP Framework is using the DOM events to initialize some kind of HTML elements when they are added to the DOM after than the page was already initialized. |
|||
|
|||
> Note that the same initializers also work if these elements were already included in the initial DOM. So, whether they are initially or lazy loaded, they work as expected. |
|||
|
|||
### Form Initializer |
|||
|
|||
The Form initializer (defined as `abp.dom.initializers.initializeForms`) initializes the lazy loaded forms; |
|||
|
|||
* Automatically enabled the `unobtrusive` validation on the form. |
|||
* Can automatically show a confirmation message when you submit the form. To enable this feature, just add `data-confirm` attribute with a message (like `data-confirm="Are you sure?"`) to the `form` element. |
|||
* If the `form` element has `data-ajaxForm="true"` attribute, then automatically calls the `.abpAjaxForm()` on the `form` element, to make the form posted via AJAX. |
|||
|
|||
See the [Forms & Validation](../Forms-Validation.md) document for more. |
|||
|
|||
### Script Initializer |
|||
|
|||
Script initializer (`abp.dom.initializers.initializeScript`) can execute a JavaScript code for a DOM element. |
|||
|
|||
**Example: Lazy load a component and execute some code when the element has loaded** |
|||
|
|||
Assume that you've a container to load the element inside: |
|||
|
|||
````html |
|||
<div id="LazyComponent"></div> |
|||
```` |
|||
|
|||
And this is the component that will be loaded via AJAX from the server and inserted into the container: |
|||
|
|||
````html |
|||
<div data-script-class="MyCustomClass"> |
|||
<p>Sample message</p> |
|||
</div> |
|||
```` |
|||
|
|||
`data-script-class="MyCustomClass"` indicates the JavaScript class that will be used to perform some logic on this element: |
|||
|
|||
`MyCustomClass` is a global object defined as shown below: |
|||
|
|||
````js |
|||
MyCustomClass = function(){ |
|||
|
|||
function initDom($el){ |
|||
$el.css('color', 'red'); |
|||
} |
|||
|
|||
return { |
|||
initDom: initDom |
|||
} |
|||
}; |
|||
```` |
|||
|
|||
`initDom` is the function that is called by the ABP Framework. The `$el` argument is the loaded HTML element as a JQuery selection. |
|||
|
|||
Finally, you can load the component inside the container after an AJAX call: |
|||
|
|||
````js |
|||
$(function () { |
|||
setTimeout(function(){ |
|||
$.get('/get-my-element').then(function(response){ |
|||
$('#LazyComponent').html(response); |
|||
}); |
|||
}, 2000); |
|||
}); |
|||
```` |
|||
|
|||
Script Initialization system is especially helpful if you don't know how and when the component will be loaded into the DOM. This can be possible if you've developed a reusable UI component in a library and you want the application developer shouldn't care how to initialize the component in different use cases. |
|||
|
|||
> Script initialization doesn't work if the component was loaded in the initial DOM. In this case, you are responsible to initialize it. |
|||
|
|||
### Other Initializers |
|||
|
|||
The following Bootstrap components and libraries are automatically initialized when they are added to the DOM: |
|||
|
|||
* Tooltip |
|||
* Popover |
|||
* Timeage |
|||
|
|||
@ -0,0 +1,88 @@ |
|||
# ASP.NET Core MVC / Razor Pages UI: JavaScript Events API |
|||
|
|||
`abp.event` object is a simple service that is used to publish and subscribe to global events **in the browser**. |
|||
|
|||
> This API is not related to server side local or distributed events. It works in the browser boundaries to make the UI components (code parts) communicate in a loosely coupled way. |
|||
|
|||
## Basic Usage |
|||
|
|||
### Publishing Events |
|||
|
|||
Use `abp.event.trigger` to publish events. |
|||
|
|||
**Example: Publish a *Basket Updated* event** |
|||
|
|||
````js |
|||
abp.event.trigger('basketUpdated'); |
|||
```` |
|||
|
|||
This will trigger all the subscribed callbacks. |
|||
|
|||
### Subscribing to the Events |
|||
|
|||
Use `abp.event.on` to subscribe to events. |
|||
|
|||
**Example: Consume the *Basket Updated* event** |
|||
|
|||
````js |
|||
abp.event.on('basketUpdated', function() { |
|||
console.log('Handled the basketUpdated event...'); |
|||
}); |
|||
```` |
|||
|
|||
You start to get events after you subscribe to the event. |
|||
|
|||
### Unsubscribing from the Events |
|||
|
|||
If you need to unsubscribe from a pre-subscribed event, you can use the `abp.event.off(eventName, callback)` function. In this case, you have the callback as a separate function declaration. |
|||
|
|||
**Example: Subscribe & Unsubscribe** |
|||
|
|||
````js |
|||
function onBasketUpdated() { |
|||
console.log('Handled the basketUpdated event...'); |
|||
} |
|||
|
|||
//Subscribe |
|||
abp.event.on('basketUpdated', onBasketUpdated); |
|||
|
|||
//Unsubscribe |
|||
abp.event.off('basketUpdated', onBasketUpdated); |
|||
```` |
|||
|
|||
You don't get events after you unsubscribe from the event. |
|||
|
|||
## Event Arguments |
|||
|
|||
You can pass arguments (of any count) to the `trigger` method and get them in the subscription callback. |
|||
|
|||
**Example: Add the basket as the event argument** |
|||
|
|||
````js |
|||
//Subscribe to the event |
|||
abp.event.on('basketUpdated', function(basket) { |
|||
console.log('The new basket object: '); |
|||
console.log(basket); |
|||
}); |
|||
|
|||
//Trigger the event |
|||
abp.event.trigger('basketUpdated', { |
|||
items: [ |
|||
{ |
|||
"productId": "123", |
|||
"count": 2 |
|||
}, |
|||
{ |
|||
"productId": "832", |
|||
"count": 1 |
|||
} |
|||
] |
|||
}); |
|||
```` |
|||
|
|||
### Multiple Arguments |
|||
|
|||
If you want to pass multiple arguments, you can pass like `abp.event.on('basketUpdated', arg0, arg1, agr2)`. Then you can add the same argument list to the callback function on the subscriber side. |
|||
|
|||
> **Tip:** Alternatively, you can send a single object that has a separate field for each argument. This makes easier to extend/change the event arguments in the future without breaking the subscribers. |
|||
|
|||
@ -0,0 +1,15 @@ |
|||
# ASP.NET Core MVC / Razor Pages UI: JavaScript Features API |
|||
|
|||
`abp.features` API allows you to check features or get the values of the features on the client side. You can read the current value of a feature in the client side only if it is allowed by the feature definition (on the server side). |
|||
|
|||
> This document only explains the JavaScript API. See the [Features](../../../Features.md) document to understand the ABP Features system. |
|||
|
|||
## Basic Usage |
|||
|
|||
`abp.features.values` can be used to access to the all feature values. |
|||
|
|||
````js |
|||
var excelExportFeatureValue = abp.features.values["ExportingToExcel"]; |
|||
```` |
|||
|
|||
Then you can check the value of the feature to perform your logic. |
|||
@ -1,3 +1,50 @@ |
|||
# ASP.NET Core MVC / Razor Pages UI: JavaScript Logging API |
|||
|
|||
TODO |
|||
`abp.log` API is used to write simple logs in the client side. |
|||
|
|||
> The logs are written to console, using the `console.log`, by default. |
|||
|
|||
> This document is for simple client side logging. See the [Logging](../../../Logging.md) document for server side logging system. |
|||
|
|||
## Basic Usage |
|||
|
|||
Use one of the `abp.log.xxx(...)` methods based on the severity of your log message. |
|||
|
|||
````js |
|||
abp.log.debug("Some debug log here..."); //Logging a simple debug message |
|||
abp.log.info({ name: "john", age: 42 }); //Logging an object as an information log |
|||
abp.log.warn("A warning message"); //Logging a warning message |
|||
abp.log.error('An error happens...'); //Error message |
|||
abp.log.fatal('Network connection has gone away!'); //Fatal error |
|||
```` |
|||
|
|||
## Log Levels |
|||
|
|||
There are 5 levels for a log message: |
|||
|
|||
* DEBUG = 1 |
|||
* INFO = 2 |
|||
* WARN = 3 |
|||
* ERROR = 4 |
|||
* FATAL = 5 |
|||
|
|||
These are defined in the `abp.log.levels` object (like `abp.log.levels.WARN`). |
|||
|
|||
### Changing the Current Log Level |
|||
|
|||
You can control the log level as shown below: |
|||
|
|||
````js |
|||
abp.log.level = abp.log.levels.WARN; |
|||
```` |
|||
|
|||
Default log level is `DEBUG`. |
|||
|
|||
### Logging with Specifying the Level |
|||
|
|||
Instead of calling `abp.log.info(...)` function, you can use the `abp.log.log` by specifying the log level as a parameter: |
|||
|
|||
````js |
|||
abp.log.log("log message...", abp.log.levels.INFO); |
|||
```` |
|||
|
|||
|
|||
@ -0,0 +1,40 @@ |
|||
# ASP.NET Core MVC / Razor Pages UI: JavaScript Resource Loader API |
|||
|
|||
`abp.ResourceLoader` is a service that can load a JavaScript or CSS file on demand. It guarantees to load the file only once even if you request multiple times. |
|||
|
|||
## Loading Script Files |
|||
|
|||
`abp.ResourceLoader.loadScript(...)` function **loads** a JavaScript file from the server and **executes** it. |
|||
|
|||
**Example: Load a JavaScript file** |
|||
|
|||
````js |
|||
abp.ResourceLoader.loadScript('/Pages/my-script.js'); |
|||
```` |
|||
|
|||
### Parameters |
|||
|
|||
`loadScript` function can get three parameters; |
|||
|
|||
* `url` (required, `string`): The URL of the script file to be loaded. |
|||
* `loadCallback` (optional, `function`): A callback function that is called once the script is loaded & executed. In this callback you can safely use the code in the script file. This callback is called even if the file was loaded before. |
|||
* `failCallback` (optional, `function`): A callback function that is called if loading the script fails. |
|||
|
|||
**Example: Provide the `loadCallback` argument** |
|||
|
|||
````js |
|||
abp.ResourceLoader.loadScript('/Pages/my-script.js', function() { |
|||
console.log('successfully loaded :)'); |
|||
}); |
|||
```` |
|||
|
|||
## Loading Style Files |
|||
|
|||
`abp.ResourceLoader.loadStyle(...)` function adds a `link` element to the `head` of the document for the given URL, so the CSS file is automatically loaded by the browser. |
|||
|
|||
**Example: Load a CSS file** |
|||
|
|||
````js |
|||
abp.ResourceLoader.loadStyle('/Pages/my-styles.css'); |
|||
```` |
|||
|
|||
|
After Width: | Height: | Size: 135 KiB |
@ -1,10 +1,7 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Components.WebAssembly.ExceptionHandling |
|||
namespace Volo.Abp.AspNetCore.Components.WebAssembly.ExceptionHandling |
|||
{ |
|||
public interface IUserExceptionInformer |
|||
{ |
|||
Task InformAsync(UserExceptionInformerContext context); |
|||
void Inform(UserExceptionInformerContext context); |
|||
} |
|||
} |
|||
|
|||
@ -1,7 +1,7 @@ |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.MultiTenancy; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Components.WebAssembly |
|||
namespace Volo.Abp.AspNetCore.Components.WebAssembly.MultiTenancy |
|||
{ |
|||
[Dependency(ReplaceServices = true)] |
|||
public class WebAssemblyCurrentTenantAccessor : ICurrentTenantAccessor, ISingletonDependency |
|||
@ -0,0 +1,35 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using Volo.Abp.DependencyInjection; |
|||
using Volo.Abp.MultiTenancy; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Components.WebAssembly.MultiTenancy |
|||
{ |
|||
public class WebAssemblyRemoteTenantStoreCache : IScopedDependency |
|||
{ |
|||
protected readonly List<TenantConfiguration> CachedTenants = new List<TenantConfiguration>(); |
|||
|
|||
public virtual TenantConfiguration Find(string name) |
|||
{ |
|||
return CachedTenants.FirstOrDefault(t => t.Name == name); |
|||
} |
|||
|
|||
public virtual TenantConfiguration Find(Guid id) |
|||
{ |
|||
return CachedTenants.FirstOrDefault(t => t.Id == id); |
|||
} |
|||
|
|||
public virtual void Set(TenantConfiguration tenant) |
|||
{ |
|||
var existingTenant = Find(tenant.Id); |
|||
if (existingTenant != null) |
|||
{ |
|||
existingTenant.Name = tenant.Name; |
|||
return; |
|||
} |
|||
|
|||
CachedTenants.Add(tenant); |
|||
} |
|||
} |
|||
} |
|||
@ -1,34 +0,0 @@ |
|||
using System; |
|||
using System.Threading.Tasks; |
|||
using Volo.Abp.DependencyInjection; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Components.WebAssembly |
|||
{ |
|||
public class NullUiMessageService : IUiMessageService, ITransientDependency |
|||
{ |
|||
public Task InfoAsync(string message, string title = null, Action<UiMessageOptions> options = null) |
|||
{ |
|||
return Task.CompletedTask; |
|||
} |
|||
|
|||
public Task SuccessAsync(string message, string title = null, Action<UiMessageOptions> options = null) |
|||
{ |
|||
return Task.CompletedTask; |
|||
} |
|||
|
|||
public Task WarnAsync(string message, string title = null, Action<UiMessageOptions> options = null) |
|||
{ |
|||
return Task.CompletedTask; |
|||
} |
|||
|
|||
public Task ErrorAsync(string message, string title = null, Action<UiMessageOptions> options = null) |
|||
{ |
|||
return Task.CompletedTask; |
|||
} |
|||
|
|||
public Task<bool> ConfirmAsync(string message, string title = null, Action<UiMessageOptions> options = null) |
|||
{ |
|||
return Task.FromResult(true); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
using System; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using Volo.Abp.Cli.ProjectBuilding.Building; |
|||
|
|||
namespace Volo.Abp.Cli.ProjectBuilding.Templates |
|||
{ |
|||
public class RandomizeStringEncryptionStep: ProjectBuildPipelineStep |
|||
{ |
|||
public override void Execute(ProjectBuildContext context) |
|||
{ |
|||
var appSettings = context.Files |
|||
.Where(x => !x.IsDirectory && x.Name.EndsWith("appSettings.json", StringComparison.InvariantCultureIgnoreCase)) |
|||
.Where(x => x.Content.IndexOf("StringEncryption", StringComparison.InvariantCultureIgnoreCase) >= 0) |
|||
.ToList(); |
|||
|
|||
const string defaultPassPhrase = "gsKnGZ041HLL4IM8"; |
|||
var randomPassPhrase = GetRandomString(defaultPassPhrase.Length); |
|||
foreach (var appSetting in appSettings) |
|||
{ |
|||
appSetting.NormalizeLineEndings(); |
|||
|
|||
var appSettingLines = appSetting.GetLines(); |
|||
for (var i = 0; i < appSettingLines.Length; i++) |
|||
{ |
|||
if (appSettingLines[i].Contains("DefaultPassPhrase") && appSettingLines[i].Contains(defaultPassPhrase)) |
|||
{ |
|||
appSettingLines[i] = appSettingLines[i].Replace(defaultPassPhrase, randomPassPhrase); |
|||
} |
|||
} |
|||
|
|||
appSetting.SetLines(appSettingLines); |
|||
} |
|||
} |
|||
|
|||
private static string GetRandomString(int length) |
|||
{ |
|||
const string letters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; |
|||
var builder = new StringBuilder(); |
|||
for (var i = 0; i < length; i++) |
|||
{ |
|||
builder.Append(letters[RandomHelper.GetRandom(0, letters.Length)]); |
|||
} |
|||
return builder.ToString(); |
|||
} |
|||
} |
|||
} |
|||
@ -1,13 +1,13 @@ |
|||
using Volo.Abp.EntityFrameworkCore; |
|||
|
|||
namespace Microsoft.EntityFrameworkCore |
|||
{ |
|||
public static class AbpOracleModelBuilderExtensions |
|||
{ |
|||
public static void UseOracle( |
|||
this ModelBuilder modelBuilder) |
|||
{ |
|||
modelBuilder.SetDatabaseProvider(EfCoreDatabaseProvider.Oracle); |
|||
} |
|||
} |
|||
} |
|||
// using Volo.Abp.EntityFrameworkCore;
|
|||
//
|
|||
// namespace Microsoft.EntityFrameworkCore
|
|||
// {
|
|||
// public static class AbpOracleModelBuilderExtensions
|
|||
// {
|
|||
// public static void UseOracle(
|
|||
// this ModelBuilder modelBuilder)
|
|||
// {
|
|||
// modelBuilder.SetDatabaseProvider(EfCoreDatabaseProvider.Oracle);
|
|||
// }
|
|||
// }
|
|||
// }
|
|||
|
|||
@ -1,26 +1,26 @@ |
|||
using JetBrains.Annotations; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using System; |
|||
using Devart.Data.Oracle.Entity; |
|||
using Volo.Abp.EntityFrameworkCore.DependencyInjection; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore |
|||
{ |
|||
public static class AbpDbContextConfigurationContextOracleDevartExtensions |
|||
{ |
|||
public static DbContextOptionsBuilder UseOracle( |
|||
[NotNull] this AbpDbContextConfigurationContext context, |
|||
[CanBeNull] Action<OracleDbContextOptionsBuilder> oracleOptionsAction = null, |
|||
bool useExistingConnectionIfAvailable = false) |
|||
{ |
|||
if (useExistingConnectionIfAvailable && context.ExistingConnection != null) |
|||
{ |
|||
return context.DbContextOptions.UseOracle(context.ExistingConnection, oracleOptionsAction); |
|||
} |
|||
else |
|||
{ |
|||
return context.DbContextOptions.UseOracle(context.ConnectionString, oracleOptionsAction); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
// using JetBrains.Annotations;
|
|||
// using Microsoft.EntityFrameworkCore;
|
|||
// using System;
|
|||
// using Devart.Data.Oracle.Entity;
|
|||
// using Volo.Abp.EntityFrameworkCore.DependencyInjection;
|
|||
//
|
|||
// namespace Volo.Abp.EntityFrameworkCore
|
|||
// {
|
|||
// public static class AbpDbContextConfigurationContextOracleDevartExtensions
|
|||
// {
|
|||
// public static DbContextOptionsBuilder UseOracle(
|
|||
// [NotNull] this AbpDbContextConfigurationContext context,
|
|||
// [CanBeNull] Action<OracleDbContextOptionsBuilder> oracleOptionsAction = null,
|
|||
// bool useExistingConnectionIfAvailable = false)
|
|||
// {
|
|||
// if (useExistingConnectionIfAvailable && context.ExistingConnection != null)
|
|||
// {
|
|||
// return context.DbContextOptions.UseOracle(context.ExistingConnection, oracleOptionsAction);
|
|||
// }
|
|||
// else
|
|||
// {
|
|||
// return context.DbContextOptions.UseOracle(context.ConnectionString, oracleOptionsAction);
|
|||
// }
|
|||
// }
|
|||
// }
|
|||
// }
|
|||
|
|||
@ -1,32 +1,32 @@ |
|||
using JetBrains.Annotations; |
|||
using System; |
|||
using Devart.Data.Oracle.Entity; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore |
|||
{ |
|||
public static class AbpDbContextOptionsOracleDevartExtensions |
|||
{ |
|||
public static void UseOracle( |
|||
[NotNull] this AbpDbContextOptions options, |
|||
[CanBeNull] Action<OracleDbContextOptionsBuilder> oracleOptionsAction = null, |
|||
bool useExistingConnectionIfAvailable = false) |
|||
{ |
|||
options.Configure(context => |
|||
{ |
|||
context.UseOracle(oracleOptionsAction, useExistingConnectionIfAvailable); |
|||
}); |
|||
} |
|||
|
|||
public static void UseOracle<TDbContext>( |
|||
[NotNull] this AbpDbContextOptions options, |
|||
[CanBeNull] Action<OracleDbContextOptionsBuilder> oracleOptionsAction = null, |
|||
bool useExistingConnectionIfAvailable = false) |
|||
where TDbContext : AbpDbContext<TDbContext> |
|||
{ |
|||
options.Configure<TDbContext>(context => |
|||
{ |
|||
context.UseOracle(oracleOptionsAction, useExistingConnectionIfAvailable); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
// using JetBrains.Annotations;
|
|||
// using System;
|
|||
// using Devart.Data.Oracle.Entity;
|
|||
//
|
|||
// namespace Volo.Abp.EntityFrameworkCore
|
|||
// {
|
|||
// public static class AbpDbContextOptionsOracleDevartExtensions
|
|||
// {
|
|||
// public static void UseOracle(
|
|||
// [NotNull] this AbpDbContextOptions options,
|
|||
// [CanBeNull] Action<OracleDbContextOptionsBuilder> oracleOptionsAction = null,
|
|||
// bool useExistingConnectionIfAvailable = false)
|
|||
// {
|
|||
// options.Configure(context =>
|
|||
// {
|
|||
// context.UseOracle(oracleOptionsAction, useExistingConnectionIfAvailable);
|
|||
// });
|
|||
// }
|
|||
//
|
|||
// public static void UseOracle<TDbContext>(
|
|||
// [NotNull] this AbpDbContextOptions options,
|
|||
// [CanBeNull] Action<OracleDbContextOptionsBuilder> oracleOptionsAction = null,
|
|||
// bool useExistingConnectionIfAvailable = false)
|
|||
// where TDbContext : AbpDbContext<TDbContext>
|
|||
// {
|
|||
// options.Configure<TDbContext>(context =>
|
|||
// {
|
|||
// context.UseOracle(oracleOptionsAction, useExistingConnectionIfAvailable);
|
|||
// });
|
|||
// }
|
|||
// }
|
|||
// }
|
|||
|
|||
@ -1,22 +1,22 @@ |
|||
using Volo.Abp.Guids; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore.Oracle.Devart |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpEntityFrameworkCoreModule) |
|||
)] |
|||
public class AbpEntityFrameworkCoreOracleDevartModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpSequentialGuidGeneratorOptions>(options => |
|||
{ |
|||
if (options.DefaultSequentialGuidType == null) |
|||
{ |
|||
options.DefaultSequentialGuidType = SequentialGuidType.SequentialAsBinary; |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
// using Volo.Abp.Guids;
|
|||
// using Volo.Abp.Modularity;
|
|||
//
|
|||
// namespace Volo.Abp.EntityFrameworkCore.Oracle.Devart
|
|||
// {
|
|||
// [DependsOn(
|
|||
// typeof(AbpEntityFrameworkCoreModule)
|
|||
// )]
|
|||
// public class AbpEntityFrameworkCoreOracleDevartModule : AbpModule
|
|||
// {
|
|||
// public override void ConfigureServices(ServiceConfigurationContext context)
|
|||
// {
|
|||
// Configure<AbpSequentialGuidGeneratorOptions>(options =>
|
|||
// {
|
|||
// if (options.DefaultSequentialGuidType == null)
|
|||
// {
|
|||
// options.DefaultSequentialGuidType = SequentialGuidType.SequentialAsBinary;
|
|||
// }
|
|||
// });
|
|||
// }
|
|||
// }
|
|||
// }
|
|||
|
|||
@ -1,25 +1,25 @@ |
|||
using JetBrains.Annotations; |
|||
using Microsoft.EntityFrameworkCore; |
|||
using System; |
|||
using Oracle.EntityFrameworkCore.Infrastructure; |
|||
using Volo.Abp.EntityFrameworkCore.DependencyInjection; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore |
|||
{ |
|||
public static class AbpDbContextConfigurationContextOracleExtensions |
|||
{ |
|||
public static DbContextOptionsBuilder UseOracle( |
|||
[NotNull] this AbpDbContextConfigurationContext context, |
|||
[CanBeNull] Action<OracleDbContextOptionsBuilder> oracleOptionsAction = null) |
|||
{ |
|||
if (context.ExistingConnection != null) |
|||
{ |
|||
return context.DbContextOptions.UseOracle(context.ExistingConnection, oracleOptionsAction); |
|||
} |
|||
else |
|||
{ |
|||
return context.DbContextOptions.UseOracle(context.ConnectionString, oracleOptionsAction); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
// using JetBrains.Annotations;
|
|||
// using Microsoft.EntityFrameworkCore;
|
|||
// using System;
|
|||
// using Oracle.EntityFrameworkCore.Infrastructure;
|
|||
// using Volo.Abp.EntityFrameworkCore.DependencyInjection;
|
|||
//
|
|||
// namespace Volo.Abp.EntityFrameworkCore
|
|||
// {
|
|||
// public static class AbpDbContextConfigurationContextOracleExtensions
|
|||
// {
|
|||
// public static DbContextOptionsBuilder UseOracle(
|
|||
// [NotNull] this AbpDbContextConfigurationContext context,
|
|||
// [CanBeNull] Action<OracleDbContextOptionsBuilder> oracleOptionsAction = null)
|
|||
// {
|
|||
// if (context.ExistingConnection != null)
|
|||
// {
|
|||
// return context.DbContextOptions.UseOracle(context.ExistingConnection, oracleOptionsAction);
|
|||
// }
|
|||
// else
|
|||
// {
|
|||
// return context.DbContextOptions.UseOracle(context.ConnectionString, oracleOptionsAction);
|
|||
// }
|
|||
// }
|
|||
// }
|
|||
// }
|
|||
|
|||
@ -1,30 +1,30 @@ |
|||
using JetBrains.Annotations; |
|||
using System; |
|||
using Oracle.EntityFrameworkCore.Infrastructure; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore |
|||
{ |
|||
public static class AbpDbContextOptionsOracleExtensions |
|||
{ |
|||
public static void UseOracle( |
|||
[NotNull] this AbpDbContextOptions options, |
|||
[CanBeNull] Action<OracleDbContextOptionsBuilder> oracleOptionsAction = null) |
|||
{ |
|||
options.Configure(context => |
|||
{ |
|||
context.UseOracle(oracleOptionsAction); |
|||
}); |
|||
} |
|||
|
|||
public static void UseOracle<TDbContext>( |
|||
[NotNull] this AbpDbContextOptions options, |
|||
[CanBeNull] Action<OracleDbContextOptionsBuilder> oracleOptionsAction = null) |
|||
where TDbContext : AbpDbContext<TDbContext> |
|||
{ |
|||
options.Configure<TDbContext>(context => |
|||
{ |
|||
context.UseOracle(oracleOptionsAction); |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
// using JetBrains.Annotations;
|
|||
// using System;
|
|||
// using Oracle.EntityFrameworkCore.Infrastructure;
|
|||
//
|
|||
// namespace Volo.Abp.EntityFrameworkCore
|
|||
// {
|
|||
// public static class AbpDbContextOptionsOracleExtensions
|
|||
// {
|
|||
// public static void UseOracle(
|
|||
// [NotNull] this AbpDbContextOptions options,
|
|||
// [CanBeNull] Action<OracleDbContextOptionsBuilder> oracleOptionsAction = null)
|
|||
// {
|
|||
// options.Configure(context =>
|
|||
// {
|
|||
// context.UseOracle(oracleOptionsAction);
|
|||
// });
|
|||
// }
|
|||
//
|
|||
// public static void UseOracle<TDbContext>(
|
|||
// [NotNull] this AbpDbContextOptions options,
|
|||
// [CanBeNull] Action<OracleDbContextOptionsBuilder> oracleOptionsAction = null)
|
|||
// where TDbContext : AbpDbContext<TDbContext>
|
|||
// {
|
|||
// options.Configure<TDbContext>(context =>
|
|||
// {
|
|||
// context.UseOracle(oracleOptionsAction);
|
|||
// });
|
|||
// }
|
|||
// }
|
|||
// }
|
|||
|
|||
@ -1,22 +1,22 @@ |
|||
using Volo.Abp.Guids; |
|||
using Volo.Abp.Modularity; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore.Oracle |
|||
{ |
|||
[DependsOn( |
|||
typeof(AbpEntityFrameworkCoreModule) |
|||
)] |
|||
public class AbpEntityFrameworkCoreOracleModule : AbpModule |
|||
{ |
|||
public override void ConfigureServices(ServiceConfigurationContext context) |
|||
{ |
|||
Configure<AbpSequentialGuidGeneratorOptions>(options => |
|||
{ |
|||
if (options.DefaultSequentialGuidType == null) |
|||
{ |
|||
options.DefaultSequentialGuidType = SequentialGuidType.SequentialAsBinary; |
|||
} |
|||
}); |
|||
} |
|||
} |
|||
} |
|||
// using Volo.Abp.Guids;
|
|||
// using Volo.Abp.Modularity;
|
|||
//
|
|||
// namespace Volo.Abp.EntityFrameworkCore.Oracle
|
|||
// {
|
|||
// [DependsOn(
|
|||
// typeof(AbpEntityFrameworkCoreModule)
|
|||
// )]
|
|||
// public class AbpEntityFrameworkCoreOracleModule : AbpModule
|
|||
// {
|
|||
// public override void ConfigureServices(ServiceConfigurationContext context)
|
|||
// {
|
|||
// Configure<AbpSequentialGuidGeneratorOptions>(options =>
|
|||
// {
|
|||
// if (options.DefaultSequentialGuidType == null)
|
|||
// {
|
|||
// options.DefaultSequentialGuidType = SequentialGuidType.SequentialAsBinary;
|
|||
// }
|
|||
// });
|
|||
// }
|
|||
// }
|
|||
// }
|
|||
|
|||
@ -1,15 +0,0 @@ |
|||
using Microsoft.EntityFrameworkCore.Infrastructure; |
|||
using Microsoft.EntityFrameworkCore.Internal; |
|||
|
|||
namespace Volo.Abp.EntityFrameworkCore |
|||
{ |
|||
public static class DatabaseFacadeExtensions |
|||
{ |
|||
public static bool IsRelational(this DatabaseFacade database) |
|||
{ |
|||
#pragma warning disable EF1001 // Internal EF Core API usage.
|
|||
return ((IDatabaseFacadeDependenciesAccessor)database).Dependencies is IRelationalDatabaseFacadeDependencies; |
|||
#pragma warning restore EF1001 // Internal EF Core API usage.
|
|||
} |
|||
} |
|||
} |
|||
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue