diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 7edc203af9..86df2d8748 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -59,7 +59,6 @@ jobs: - uses: actions/setup-dotnet@master with: dotnet-version: 10.0.x - - name: Build All run: ./build-all.ps1 working-directory: ./build diff --git a/Directory.Packages.props b/Directory.Packages.props index 0cc314d11b..df44503ee8 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -182,6 +182,10 @@ + + + + diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json index 4f19fd9299..7a9687e6d0 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json @@ -776,6 +776,13 @@ "Menu:Studio": "Studio", "Menu:Solutions": "Solutions", "Menu:Users": "Users", - "Menu:UserReports": "Users" + "Menu:UserReports": "Users", + "Enum:TokenType:1": "Free", + "Enum:TokenType:2": "Paid", + "Enum:SourceChannel:1": "Studio", + "Enum:SourceChannel:2": "Support Site", + "Enum:SourceChannel:3": "Suite", + "Menu:OrganizationTokenUsage": "Organization Token Usage", + "Permission:OrganizationTokenUsage": "Organization Token Usage" } } diff --git a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json index e3d8c34c72..18730b51d6 100644 --- a/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json +++ b/abp_io/AbpIoLocalization/AbpIoLocalization/Www/Localization/Resources/en.json @@ -616,6 +616,7 @@ "QuestionItemErrorMessage": "Could not get the latest question details from Stackoverflow.", "Oops": "Oops!", "CreatePostSuccessMessage": "The Post has been successfully submitted. It will be published after a review from the site admin.", + "PostCreationFailed": "An error occurred while creating the post. Please try again later.", "Browse": "Browse", "CoverImage": "Cover Image", "ShareYourExperiencesWithTheABPFramework": "ABP Community Articles | Read or Submit Articles", diff --git a/common.props b/common.props index 240f80e39a..82d1e8abbf 100644 --- a/common.props +++ b/common.props @@ -1,8 +1,8 @@ latest - 10.0.0-rc.1 - 5.0.0-rc.1 + 10.1.0-preview + 5.1.0-preview $(NoWarn);CS1591;CS0436 https://abp.io/assets/abp_nupkg.png https://abp.io/ diff --git a/docs/en/Community-Articles/2025-09-30-Where-and-How-to-Store-Your-BLOB-Objects-in-dotnet/POST.md b/docs/en/Community-Articles/2025-09-30-Where-and-How-to-Store-Your-BLOB-Objects-in-dotnet/POST.md new file mode 100644 index 0000000000..2d39bac91a --- /dev/null +++ b/docs/en/Community-Articles/2025-09-30-Where-and-How-to-Store-Your-BLOB-Objects-in-dotnet/POST.md @@ -0,0 +1,302 @@ +# Where and How to Store Your BLOB Objects in .NET? + +When building modern web applications, managing [BLOBs (Binary Large Objects)](https://cloud.google.com/discover/what-is-binary-large-object-storage) such as images, videos, documents, or any other file types is a common requirement. Whether you're developing a CMS, an e-commerce platform, or almost any other kind of application, you'll eventually ask yourself: **"Where should I store these files?"** + +In this article, we'll explore different approaches to storing BLOBs in .NET applications and demonstrate how the ABP Framework simplifies this process with its flexible [BLOB Storing infrastructure](https://abp.io/docs/latest/framework/infrastructure/blob-storing). + +ABP Provides [multiple storage providers](https://abp.io/docs/latest/framework/infrastructure/blob-storing#blob-storage-providers) such as Azure, AWS, Google, Minio, Bunny etc. But for the simplicity of this article, we will only focus on the **Database Provider**, showing you how to store BLOBs in database tables step-by-step. + +## Understanding BLOB Storage Options + +Before diving into implementation details, let's understand the common approaches for storing BLOBs in .NET applications. Mainly, there are three main approaches: + +1. Database Storage +2. File System Storage +3. Cloud Storage + +### 1. Database Storage + +The first approach is to store BLOBs directly in the database alongside your relational data (_you can also store them separately_). This approach uses columns with types like `VARBINARY(MAX)` in SQL Server or `BYTEA` in PostgreSQL. + +**Pros:** +- ✅ Transactional consistency between files and related data +- ✅ Simplified backup and restore operations (everything in one place) +- ✅ No additional file system permissions or management needed + +**Cons:** +- ❌ Database size can grow significantly with large files +- ❌ Potential performance impact on database operations +- ❌ May require additional database tuning and optimization +- ❌ Increased backup size and duration + +### 2. File System Storage + +The second obvious approach is to store BLOBs as physical files in the server's file system. This approach is simple and easy to implement. Also, it's possible to use these two approaches together and keep the metadata and file references in the database. + +**Pros:** +- ✅ Better performance for large files +- ✅ Reduced database size and improved database performance +- ✅ Easier to leverage CDNs and file servers +- ✅ Simple to implement file system-level operations (compression, deduplication) + +**Cons:** +- ❌ Requires separate backup strategy for files +- ❌ Need to manage file system permissions +- ❌ Potential synchronization issues in distributed environments +- ❌ More complex cleanup operations for orphaned files + +### 3. Cloud Storage (Azure, AWS S3, etc.) + +The third approach can be using cloud storage services for scalability and global distribution. This approach is powerful and scalable. But it's also more complex to implement and manage. + +**Best for:** +- Large-scale applications +- Multi-region deployments +- Content delivery requirements + +## ABP Framework's BLOB Storage Infrastructure + +The ABP Framework provides an abstraction layer over different storage providers, allowing you to switch between them with minimal code changes. This is achieved through the **IBlobContainer** (and `IBlobContainer`) service and various provider implementations. + +> ABP provides several built-in providers, which you can see the full list [here](https://abp.io/docs/latest/framework/infrastructure/blob-storing#blob-storage-providers). + +Let's see how to use the Database provider in your application step by step. + +### Demo: Storing BLOBs in Database in an ABP-Based Application + +In this demo, we'll walk through a practical example of storing BLOBs in a database using ABP's BLOB Storing infrastructure. We'll focus on the backend implementation using the `IBlobContainer` service and examine the database structure that ABP creates automatically. The UI framework choice doesn't matter for this demonstration, as we're concentrating on the core BLOB storage functionality. + +If you don't have an ABP application yet, create one using the ABP CLI: + +```bash +abp new BlobStoringDemo +``` + +This command generates a new ABP layered application named `BlobStoringDemo` with **MVC** as the default UI and **SQL Server** as the default database provider. + +#### Understanding the Database Provider Setup + +When you create a layered ABP application, it automatically includes the BLOB Storing infrastructure with the Database Provider pre-configured. You can verify this by examining the module dependencies in your `*Domain`, `*DomainShared`, and `*EntityFrameworkCore` modules: + +```csharp +[DependsOn( + //... + typeof(BlobStoringDatabaseDomainModule) // <-- This is the Database Provider + )] +public class BlobStoringDemoDomainModule : AbpModule +{ + //... +} +``` + +Since the Database Provider is already included through module dependencies, no additional configuration is required to start using it. The provider is ready to use out of the box. + +However, if you're working with multiple BLOB storage providers or want to explicitly configure the Database Provider, you can add the following configuration to your `*EntityFrameworkCore` module's `ConfigureServices` method: + +```csharp +Configure(options => +{ + options.Containers.ConfigureDefault(container => + { + container.UseDatabase(); + }); +}); +``` + +> **Note:** This explicit configuration is optional when using only one BLOB provider (Database Provider in this case), but becomes necessary when managing multiple providers or custom container configurations. + +#### Running Database Migrations + +Now, let's apply the database migrations to create the necessary BLOB storage tables. Run the `DbMigrator` project: + +```bash +cd src/BlobStoringDemo.DbMigrator +dotnet run +``` + +Once the migration completes successfully, open your database management tool and you'll see two new tables: + +![](blob-tables.png) + +**Understanding the BLOB Storage Tables:** + +- **`AbpBlobContainers`**: Stores metadata about BLOB containers, including container names, tenant information, and any custom properties. + +- **`AbpBlobs`**: Stores the actual BLOB content (the binary data) along with references to their parent containers. Each BLOB is associated with a container through a foreign key relationship. + +When you save a BLOB, ABP automatically handles the database operations: the binary content goes into `AbpBlobs`, while the container configuration and metadata are managed in `AbpBlobContainers`. + +#### Creating a File Management Service + +Let's implement a practical application service that demonstrates common BLOB operations. Create a new application service class: + +```csharp +using System.Threading.Tasks; +using Volo.Abp.Application.Services; +using Volo.Abp.BlobStoring; + +namespace BlobStoringDemo +{ + public class FileAppService : ApplicationService, IFileAppService + { + private readonly IBlobContainer _blobContainer; + + public FileAppService(IBlobContainer blobContainer) + { + _blobContainer = blobContainer; + } + + public async Task SaveFileAsync(string fileName, byte[] fileContent) + { + // Save the file + await _blobContainer.SaveAsync(fileName, fileContent); + } + + public async Task GetFileAsync(string fileName) + { + // Get the file + return await _blobContainer.GetAllBytesAsync(fileName); + } + + public async Task FileExistsAsync(string fileName) + { + // Check if file exists + return await _blobContainer.ExistsAsync(fileName); + } + + public async Task DeleteFileAsync(string fileName) + { + // Delete the file + await _blobContainer.DeleteAsync(fileName); + } + } +} +``` + +Here, we are doing the followings: + +- Injecting the `IBlobContainer` service. +- Saving the BLOB data to the database with the `SaveAsync` method. (_it allows you to use byte arrays or streams_) +- Retrieving the BLOB data from the database with the `GetAllBytesAsync` method. +- Checking if the BLOB exists with the `ExistsAsync` method. +- Deleting the BLOB data from the database with the `DeleteAsync` method. + +With this service in place, you can now manage BLOBs throughout your application without worrying about the underlying storage implementation. Simply inject `IFileAppService` wherever you need file operations, and ABP handles all the provider-specific details behind the scenes. + +> Also, it's good to highlight that, the beauty of this approach is **provider independence**: you can start with database storage and later switch to Azure Blob Storage, AWS S3, or any other provider without modifying a single line of your application code. We'll explore this powerful feature in the next section. + +### Switching Between Providers + +One of the biggest advantages of using ABP's BLOB Storage system is the ability to switch providers without changing your application code. + +For example, you might start with the [File System provider](https://abp.io/docs/latest/framework/infrastructure/blob-storing/file-system) during development and switch to [Azure Blob Storage](https://abp.io/docs/latest/framework/infrastructure/blob-storing/azure) for production: + +**Development:** +```csharp +Configure(options => +{ + options.Containers.ConfigureDefault(container => + { + container.UseFileSystem(fileSystem => + { + fileSystem.BasePath = Path.Combine( + hostingEnvironment.ContentRootPath, + "Documents" + ); + }); + }); +}); +``` + +**Production:** +```csharp +Configure(options => +{ + options.Containers.ConfigureDefault(container => + { + container.UseAzure(azure => + { + azure.ConnectionString = "your azure connection string"; + azure.ContainerName = "your azure container name"; + azure.CreateContainerIfNotExists = true; + }); + }); +}); +``` + +**Your application code remains unchanged!** You just need to install the appropriate package and update the configuration. You can even use pragmas (for example: `#if !DEBUG`) to switch the provider at runtime (or use similar techniques). + +### Using Named BLOB Containers + +ABP allows you to define multiple BLOB containers with different configurations. This is useful when you need to store different types of files using different providers. Here are the steps to implement it: + +#### Step 1: Define a BLOB Container + +```csharp +[BlobContainerName("profile-pictures")] +public class ProfilePictureContainer +{ +} + +[BlobContainerName("documents")] +public class DocumentContainer +{ +} +``` + +#### Step 2: Configure Different Providers for Each Container + +```csharp +Configure(options => +{ + // Profile pictures stored in database + options.Containers.Configure(container => + { + container.UseDatabase(); + }); + + // Documents stored in file system + options.Containers.Configure(container => + { + container.UseFileSystem(fileSystem => + { + fileSystem.BasePath = Path.Combine( + hostingEnvironment.ContentRootPath, + "Documents" + ); + }); + }); +}); +``` + +#### Step 3: Use the Named Containers + +Once you have defined the BLOB Containers, you can use the `IBlobContainer` service to access the BLOB containers: + +```csharp +public class ProfileService : ApplicationService +{ + private readonly IBlobContainer _profilePictureContainer; + + public ProfileService(IBlobContainer profilePictureContainer) + { + _profilePictureContainer = profilePictureContainer; + } + + public async Task UpdateProfilePictureAsync(Guid userId, byte[] picture) + { + var blobName = $"{userId}.jpg"; + await _profilePictureContainer.SaveAsync(blobName, picture); + } +} +``` + +With this approach, your documents and profile pictures are stored in different containers and different providers. This is useful when you need to store different types of files using different providers and need scalability and performance. + +## Conclusion + +Managing BLOBs effectively is crucial for modern applications, and choosing the right storage approach depends on your specific needs. + +ABP's BLOB Storing infrastructure provides a powerful abstraction that lets you start with one provider and switch to another as your requirements evolve, all without changing your application code. + +Whether you're storing files in a database, file system, or cloud storage, ABP's BLOB Storing system provides a flexible and powerful way to manage your files. \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-09-30-Where-and-How-to-Store-Your-BLOB-Objects-in-dotnet/blob-tables.png b/docs/en/Community-Articles/2025-09-30-Where-and-How-to-Store-Your-BLOB-Objects-in-dotnet/blob-tables.png new file mode 100644 index 0000000000..01ec3cfa08 Binary files /dev/null and b/docs/en/Community-Articles/2025-09-30-Where-and-How-to-Store-Your-BLOB-Objects-in-dotnet/blob-tables.png differ diff --git a/docs/en/Community-Articles/2025-09-30-Where-and-How-to-Store-Your-BLOB-Objects-in-dotnet/cover-image.png b/docs/en/Community-Articles/2025-09-30-Where-and-How-to-Store-Your-BLOB-Objects-in-dotnet/cover-image.png new file mode 100644 index 0000000000..b79b298b25 Binary files /dev/null and b/docs/en/Community-Articles/2025-09-30-Where-and-How-to-Store-Your-BLOB-Objects-in-dotnet/cover-image.png differ diff --git a/docs/en/Community-Articles/2025-09-30-Why-Do-You-Need-Distributed-Locking-In-Net-Core/article.md b/docs/en/Community-Articles/2025-09-30-Why-Do-You-Need-Distributed-Locking-In-Net-Core/article.md new file mode 100644 index 0000000000..57660aa038 --- /dev/null +++ b/docs/en/Community-Articles/2025-09-30-Why-Do-You-Need-Distributed-Locking-In-Net-Core/article.md @@ -0,0 +1,371 @@ +# Why Do You Need Distributed Locking in ASP.NET Core + +## Introduction + +In modern distributed systems, synchronizing access to common resources among numerous instances is a critical problem. Whenever lots of servers or processes concurrently attempt to update the same resource simultaneously, race conditions can lead to data corruption, redundant work, and inconsistent state. Throughout the implementation of the ABP framework, we encountered and overcame this exact same problem with assistance from a stable distributed locking mechanism. In this post, we will present our experience and learnings when implementing this solution, so you can understand when and why you would need distributed locking in your ASP.NET Core applications. + +## Problem + +Suppose you are running an e-commerce application deployed on multiple servers for high availability. A customer places an order, which kicks off a background job that reserves inventory and charges payment. If not properly synchronized, the following is what can happen: + +### Race Conditions in Multi-Instance Deployments + +When your ASP.NET Core application is scaled horizontally with multiple instances, each instance works independently. If two instances simultaneously perform the same operation—like deducting inventory, generating invoice numbers, or processing a refund—you can end up with: + +- **Duplicate operations**: The same payment processed twice +- **Data inconsistency**: Inventory count becomes negative or incorrect +- **Lost updates**: One instance's changes overwrite another's +- **Sequential ID conflicts**: Two instances generate the same invoice number + +### Background Job Processing + +Background work libraries like Quartz.NET or Hangfire usually run on multiple workers. Without distributed locking: + +- Multiple workers can choose the same task +- Long-running processes can be executed parallel when they should be executed in a sequence +- Jobs that depend on exclusive resource access can corrupt shared data + +### Cache Invalidation and Refresh + +When distributed caching is employed, there can be multiple instances that simultaneously identify a cache miss and attempt to rebuild the cache, leading to: + +- High database load owing to concurrent rebuild cache requests +- Race conditions under which older data overrides newer data +- wasted computational resources + +### Rate Limiting and Throttling + +Enforcing rate limits across multiple instances of the application requires coordination. If there is no distributed locking, each instance has its own limits, and global rate limits cannot be enforced properly. + +The root issue is simple: **the default C# locking APIs (lock, SemaphoreSlim, Monitor) work within a process in isolation**. They will not assist with distributed cases where coordination must take place across servers, containers, or cloud instances. + +## Solutions + +Several approaches exist for implementing distributed locking in ASP.NET Core applications. Let's explore the most common solutions, their trade-offs, and why we chose our approach for ABP. + +### 1. Database-Based Locking + +Using your existing database to place locks by inserting or updating rows with distinctive values. + +**Pros:** +- No additional infrastructure required +- Works with any relational database +- Transactions provide ACID guarantees + +**Cons:** +- Database round-trip performance overhead +- Can lead to database contention under high load +- Must be controlled to prevent orphaned locks +- Not suited for high-frequency locking scenarios + +**When to use:** Small-scale applications where you do not wish to add additional infrastructure, and lock operations are low frequency. + +### 2. Redis-Based Locking + +Redis has atomic operations that make it excellent at distributed locking, using commands such as `SET NX` (set if not exists) with expiration. +**Pros:** + +- Low latency and high performance +- Expiration prevents lost locks built-in +- Well-established with tested patterns (Redlock algorithm) +- Works well for high-throughput use cases +**Cons:** + +- Requires Redis infrastructure +- Network partitions might be an issue +- One Redis instance is a single point of failure (although Redis Cluster reduces it) +**Resources:** + +- [Redis Distributed Locks Documentation](https://redis.io/docs/manual/patterns/distributed-locks/) +- [Redlock Algorithm](https://redis.io/topics/distlock) +**When to use:** Production applications with multiple instances where performance is critical, especially if you are already using Redis as a caching layer. + +### 3. Azure Blob Storage Leases + +Azure Blob Storage offers lease functionality which can be utilized for distributed locks. + +**Pros:** +- Part of Azure, no extra infrastructure +- Lease expiration automatically +- Low-frequency locks are economically viable + +**Cons:** +- Azure-specific, not portable +- Latency greater than Redis +- Azure cloud-only projects + +**When to use:** Azure-native applications with low-locking frequency where you need to minimize moving parts. + +### 4. etcd or ZooKeeper + +Distributed coordination services designed from scratch to accommodate consensus and locking. + +**Pros:** +- Designed for distributed coordination +- Strong consistency guaranteed +- Robust against network partitions + +**Cons:** +- Difficulty in setting up the infrastructure +- Excess baggage for most applications +- Steep learning curve + +**Use when:** Large distributed systems with complex coordination require more than basic locking. + + +### Our Choice: Abstraction with Multiple Implementations + +For ABP, we chose to use an **abstraction layer** with support for multibackend. This provides flexibility to the developers so that they can choose the best implementation depending on their infrastructure. Our default implementations include support for: + +- **Redis** (recommended for most scenarios) +- **Database-based locking** (for less complicated configurations) +- In-memory single-instance and development locks + +We started with Redis because it offers the best tradeoff between ease of operation, reliability, and performance for distributed cases. But abstraction prevents applications from becoming technology-dependent, and it's easier to start simple and expand as needed. + +## Implementation + +Let's implement a simplified distributed locking mechanism using Redis and StackExchange.Redis. This example shows the core concepts without ABP's framework complexity. + +First, install the required package: + +```bash +dotnet add package StackExchange.Redis +``` + +Here's a basic distributed lock implementation: + +```csharp +public interface IDistributedLock +{ + Task TryAcquireAsync( + string resource, + TimeSpan expirationTime, + CancellationToken cancellationToken = default); +} + +public class RedisDistributedLock : IDistributedLock +{ + private readonly IConnectionMultiplexer _redis; + private readonly ILogger _logger; + + public RedisDistributedLock( + IConnectionMultiplexer redis, + ILogger logger) + { + _redis = redis; + _logger = logger; + } + + public async Task TryAcquireAsync( + string resource, + TimeSpan expirationTime, + CancellationToken cancellationToken = default) + { + var db = _redis.GetDatabase(); + var lockKey = $"lock:{resource}"; + var lockValue = Guid.NewGuid().ToString(); + + // Try to acquire the lock using SET NX with expiration + var acquired = await db.StringSetAsync( + lockKey, + lockValue, + expirationTime, + When.NotExists); + + if (!acquired) + { + _logger.LogDebug( + "Failed to acquire lock for resource: {Resource}", + resource); + return null; + } + + _logger.LogDebug( + "Lock acquired for resource: {Resource}", + resource); + + return new RedisLockHandle(db, lockKey, lockValue, _logger); + } + + private class RedisLockHandle : IDisposable + { + private readonly IDatabase _db; + private readonly string _lockKey; + private readonly string _lockValue; + private readonly ILogger _logger; + private bool _disposed; + + public RedisLockHandle( + IDatabase db, + string lockKey, + string lockValue, + ILogger logger) + { + _db = db; + _lockKey = lockKey; + _lockValue = lockValue; + _logger = logger; + } + + public void Dispose() + { + if (_disposed) return; + + try + { + // Only delete if we still own the lock + var script = @" + if redis.call('get', KEYS[1]) == ARGV[1] then + return redis.call('del', KEYS[1]) + else + return 0 + end"; + + _db.ScriptEvaluate( + script, + new RedisKey[] { _lockKey }, + new RedisValue[] { _lockValue }); + + _logger.LogDebug("Lock released for key: {LockKey}", _lockKey); + } + catch (Exception ex) + { + _logger.LogError( + ex, + "Error releasing lock for key: {LockKey}", + _lockKey); + } + finally + { + _disposed = true; + } + } + } +} +``` + +Register the service in your `Program.cs`: + +```csharp +builder.Services.AddSingleton(sp => +{ + var configuration = ConfigurationOptions.Parse("localhost:6379"); + return ConnectionMultiplexer.Connect(configuration); +}); + +builder.Services.AddSingleton(); +``` + +Now you can use distributed locking in your services: + +```csharp +public class OrderService +{ + private readonly IDistributedLock _distributedLock; + private readonly ILogger _logger; + + public OrderService( + IDistributedLock distributedLock, + ILogger logger) + { + _distributedLock = distributedLock; + _logger = logger; + } + + public async Task ProcessOrderAsync(string orderId) + { + var lockResource = $"order:{orderId}"; + + // Try to acquire the lock with 30-second expiration + await using var lockHandle = await _distributedLock.TryAcquireAsync( + lockResource, + TimeSpan.FromSeconds(30)); + + if (lockHandle == null) + { + _logger.LogWarning( + "Could not acquire lock for order {OrderId}. " + + "Another process might be processing it.", + orderId); + return; + } + + // Critical section - only one instance will execute this + _logger.LogInformation("Processing order {OrderId}", orderId); + + // Your order processing logic here + await Task.Delay(1000); // Simulating work + + _logger.LogInformation( + "Order {OrderId} processed successfully", + orderId); + + // Lock is automatically released when lockHandle is disposed + } +} +``` + +### Key Implementation Details + +**Lock Key Uniqueness**: Use hierarchical, descriptive keys (`order:12345`, `inventory:product-456`) to avoid collisions. + +**Lock Value**: We use a single distinct GUID as the lock value. This ensures only the lock owner can release it, excluding unintentional deletion by expired locks or other operations. + +**Automatic Expiration**: Always provide an expiration time to prevent deadlocks when a process halts with an outstanding lock. + +**Lua Script for Release**: Releasing uses a Lua script to atomically check ownership and delete the key. This prevents releasing a lock that has already timed out and is reacquired by another process. + +**Disposal Pattern**: With `IDisposable` and `await using`, one ensures that the lock is released regardless of the exception that occurs. + +### Handling Lock Acquisition Failures + +Depending on your use case, you have several options when lock acquisition fails: + +```csharp +// Option 1: Return early (shown above) +if (lockHandle == null) +{ + return; +} + +// Option 2: Retry with timeout +var retryCount = 0; +var maxRetries = 3; +IDisposable? lockHandle = null; + +while (lockHandle == null && retryCount < maxRetries) +{ + lockHandle = await _distributedLock.TryAcquireAsync( + lockResource, + TimeSpan.FromSeconds(30)); + + if (lockHandle == null) + { + retryCount++; + await Task.Delay(TimeSpan.FromMilliseconds(100 * retryCount)); + } +} + +if (lockHandle == null) +{ + throw new InvalidOperationException("Could not acquire lock after retries"); +} + +// Option 3: Queue for later processing +if (lockHandle == null) +{ + await _queueService.EnqueueForLaterAsync(orderId); + return; +} +``` + +This is a good foundation for distributed locking in ASP.NET Core applications. It addresses the most common scenarios and edge cases, but production can call for more sophisticated features like lock re-renewal for long-running operations or more sophisticated retry logic. + +## Conclusion + +Distributed locking is a necessity for data consistency and prevention of race conditions in new, scalable ASP.NET Core applications. As we've discussed, the problem becomes unavoidable as soon as you move beyond single-instance deployments to horizontally scaled multi-server, container, or background job worker deployments. + +We examined several of them, from database-level locks to Redis, Azure Blob Storage leases, and coordination services. Each has its place, but Redis-based locking offers the best balance of performance, reliability, and ease in most situations. The example implementation we provided shows how to implement a well-crafted distributed locking mechanism with minimal dependence on other libraries. + +Whether you implement your own solution or utilize a framework like ABP, familiarity with the concepts of distributed locking will help you build more stable and scalable applications. We hope by sharing our experience, we can keep you from falling into typical pitfalls and have distributed locking properly implemented on your own projects. \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-09-30-Why-Do-You-Need-Distributed-Locking-In-Net-Core/cover.png b/docs/en/Community-Articles/2025-09-30-Why-Do-You-Need-Distributed-Locking-In-Net-Core/cover.png new file mode 100644 index 0000000000..a8bb941717 Binary files /dev/null and b/docs/en/Community-Articles/2025-09-30-Why-Do-You-Need-Distributed-Locking-In-Net-Core/cover.png differ diff --git a/docs/en/Community-Articles/2025-10-03-Generating-Sequential-GUIDs/Post.md b/docs/en/Community-Articles/2025-10-03-Generating-Sequential-GUIDs/Post.md new file mode 100644 index 0000000000..678adc1ba5 --- /dev/null +++ b/docs/en/Community-Articles/2025-10-03-Generating-Sequential-GUIDs/Post.md @@ -0,0 +1,108 @@ +# You May Have Trouble with GUIDs: Generating Sequential GUIDs in .NET + + +If you’ve ever shoved a bunch of `Guid.NewGuid()` values into a SQL Server table with a clustered index on the PK, you’ve probably felt the pain: **Index fragmentation so bad you could use it as modern art.** Inserts slow down, page splits go wild, and your DBA starts sending you passive-aggressive Slack messages. + +And yet… we keep doing it. Why? Because GUIDs are _easy_. They’re globally unique, they don’t need a round trip to the DB, and they make distributed systems happy. But here’s the catch: **random GUIDs are absolute chaos for ordered indexes**. + +## The Problem with Vanilla GUIDs + +* **Randomness kills order** — clustered indexes thrive on sequential inserts; random GUIDs force constant reordering. + +* **Performance hit** — every insert can trigger page splits and index reshuffling. + +* **Storage bloat** — fragmentation means wasted space and slower reads. + +Sure, you could switch to int or long identity columns, but then you lose the distributed generation magic and security benefits (predictable IDs are guessable). + +## Sequential GUIDs to the Rescue + +Sequential GUIDs keep the uniqueness but add a predictable ordering component, usually by embedding a timestamp in part of the GUID. This means: + +* Inserts happen at the “end” of the index, not all over the place. + +* Fragmentation drops dramatically. + +* You still get globally unique IDs without DB trips. + +Think of it as **GUIDs with manners**. + +## ABP Framework’s Secret Sauce + + +Here’s where ABP Framework flexes: it **uses sequential GUIDs by default** for entity IDs. No ceremony, no “remember to call this helper method”, it’s baked in. + +Under the hood: + +* ABP ships with IGuidGenerator (default: SequentialGuidGenerator). + +* It picks the right sequential strategy for your DB provider: + + * **SequentialAtEnd** → SQL Server + + * **SequentialAsString** → MySQL/PostgreSQL + + * **SequentialAsBinary** → Oracle + +* EF Core integration packages auto-configure this, so you rarely need to touch it. + +Example in ABP: + +```csharp +public class MyProductService : ITransientDependency +{ + private readonly IRepository _productRepository; + private readonly IGuidGenerator _guidGenerator; + + + public MyProductService( + IRepository productRepository, + IGuidGenerator guidGenerator) + { + _productRepository = productRepository; + _guidGenerator = guidGenerator; + } + + + public async Task CreateAsync(string productName) + { + var product = new Product(_guidGenerator.Create(), productName); + await _productRepository.InsertAsync(product); + } +} +``` + +No `Guid.NewGuid()` here, `_guidGenerator.Create()` gives you a sequential GUID every time. + +## Benefits of Sequential GUIDs + +Let’s say you’re inserting 1M rows into a table with a clustered primary key: + +* **Random GUIDs** → fragmentation ~99%, insert throughput tanks. + +* **Sequential GUIDs** → fragmentation stays low, inserts fly. + +In high-volume systems, this difference is **not** academic, it’s the difference between smooth scaling and spending weekends rebuilding indexes. + +## When to Use Sequential GUIDs + +* **Distributed systems** that still want DB-friendly inserts. + +* **High-write workloads** with clustered indexes on GUID PKs. + +* **Multi-tenant apps** where IDs need to be unique across tenants. + +## When Random GUIDs Still Make Sense + +* Security through obscurity, if you don’t want IDs to hint at creation order. + +* Non-indexed identifiers, fragmentation isn’t a concern. + +## The Final Take + +ABP’s default sequential GUID generation is one of those “**small but huge**” features. It’s the kind of thing you don’t notice until you benchmark, and then you wonder why you ever lived without it. + +## Links +You may want to check the following references to learn more about sequential GUIDs: + +- [ABP Framework Documentation: Sequential GUIDs](https://docs.abp.io/en/abp/latest/Guid-Generation) \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-10-03-Generating-Sequential-GUIDs/cover-image.png b/docs/en/Community-Articles/2025-10-03-Generating-Sequential-GUIDs/cover-image.png new file mode 100644 index 0000000000..e2a1fdc9bb Binary files /dev/null and b/docs/en/Community-Articles/2025-10-03-Generating-Sequential-GUIDs/cover-image.png differ diff --git a/docs/en/Community-Articles/2025-10-03-Native-AOT/Cover.png b/docs/en/Community-Articles/2025-10-03-Native-AOT/Cover.png new file mode 100644 index 0000000000..ed5653d015 Binary files /dev/null and b/docs/en/Community-Articles/2025-10-03-Native-AOT/Cover.png differ diff --git a/docs/en/Community-Articles/2025-10-03-Native-AOT/Post.md b/docs/en/Community-Articles/2025-10-03-Native-AOT/Post.md new file mode 100644 index 0000000000..84d5a7435e --- /dev/null +++ b/docs/en/Community-Articles/2025-10-03-Native-AOT/Post.md @@ -0,0 +1,72 @@ +# Native AOT: How to Fasten Startup Time and Memory Footprint + +So since .NET 8 there's been one feature that’s quietly a game-changer for performance nerds is **Native AOT** (Ahead-of-Time compilation). If you’ve ever fought with sluggish cold starts (especially in containerized or serverless environments), or dealt with memory pressure from bloated apps, Native AOT might just be your new best friend. + +------ + +## What is Native AOT? + +Normally, .NET apps ship as IL (*Intermediate Language*) and JIT-compile at runtime. That’s flexible, but it takes longer startup time and memory. +Native AOT flips the script: your app gets compiled straight into a platform-specific binary *before it ever runs*. + +As a result; + +- No JIT overhead at startup. +- Smaller memory footprint (no JIT engine or IL sitting around). +- Faster startup (especially noticeable in microservices, functions, or CLI tools). + +------ + +## Advantages of AOT + +- **Broader support** → More workloads and libraries now play nice witt.h AOT. +- **Smaller output sizes** → Trimmed down runtime dependencies. +- **Better diagnostics** → Easier to figure out why your build blew up (because yes, AOT can be picky). +- **ASP.NET Core AOT** → Minimal APIs and gRPC services actually *benefit massively* here. Cold starts are crazy fast. + +------ + +## Why you should care + +If you’re building: + +- **Serverless apps (AWS Lambda, Azure Functions, GCP Cloud Run)** → Startup time matters a LOT. +- **Microservices** → Lightweight services scale better when they use less memory per pod. +- **CLI tools** → No one likes waiting half a second for a tool to boot. AOT makes them feel “native” (because they literally are). + +And yeah, you *can* get Go-like startup performance in .NET now. + +------ + +## The trade-offs (because nothing’s free) + +Native AOT isn’t a silver bullet: + +- Build times are longer (the compiler does all the heavy lifting upfront). +- Less runtime flexibility (no reflection-based magic, dynamic codegen, or IL rewriting). +- Debugging can be trickier. + +Basically: if you rely heavily on reflection-heavy libs or dynamic runtime stuff, expect pain. + +------ + +## Quick demo (conceptual) + +```bash +# Regular publish +dotnet publish -c Release + +# Native AOT publish +dotnet publish -c Release -r win-x64 -p:PublishAot=true +``` + +Boom. You get a native executable. On Linux, drop it into a container and watch that startup time drop like a rock. + +------ + +### Conclusion + +- Native AOT in .NET 8 = faster cold starts + lower memory usage. +- Perfect for microservices, serverless, and CLI apps. +- Comes with trade-offs (longer builds, less dynamic flexibility). +- If performance is critical, it’s absolutely worth testing. \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-10-06-Building-Dynamic-Forms-in-Angular-for-Enterprise-Applications/form.png b/docs/en/Community-Articles/2025-10-06-Building-Dynamic-Forms-in-Angular-for-Enterprise-Applications/form.png new file mode 100644 index 0000000000..e84188c60d Binary files /dev/null and b/docs/en/Community-Articles/2025-10-06-Building-Dynamic-Forms-in-Angular-for-Enterprise-Applications/form.png differ diff --git a/docs/en/Community-Articles/2025-10-06-Building-Dynamic-Forms-in-Angular-for-Enterprise-Applications/post.md b/docs/en/Community-Articles/2025-10-06-Building-Dynamic-Forms-in-Angular-for-Enterprise-Applications/post.md new file mode 100644 index 0000000000..5674ab422a --- /dev/null +++ b/docs/en/Community-Articles/2025-10-06-Building-Dynamic-Forms-in-Angular-for-Enterprise-Applications/post.md @@ -0,0 +1,561 @@ +# Building Dynamic Forms in Angular for Enterprise Applications + +## Introduction + +Dynamic forms are useful for enterprise applications where form structures need to be flexible, configurable, and generated at runtime based on business requirements. This approach allows developers to create forms from configuration objects rather than hardcoding them, enabling greater flexibility and maintainability. + +## Benefits + +1. **Flexibility**: Forms can be easily modified without changing the code. +2. **Reusability**: Form components can be shared across components. +3. **Maintainability**: Changes to form structures can be managed through configuration files or databases. +4. **Scalability**: New form fields and types can be added without significant code changes. +4. **User Experience**: Dynamic forms can adapt to user roles and permissions, providing a tailored experience. + +## Architecture + +### 1. Defining Form Configuration Models + +We will define form configuration model as a first step. This models stores field types, labels, validation rules, and other metadata. + +#### 1.1. Form Field Configuration +Form field configuration interface represents individual form fields and contains properties like type, label, validation rules and conditional logic. +```typescript +export interface FormFieldConfig { + key: string; + value?: any; + type: 'text' | 'email' | 'number' | 'select' | 'checkbox' | 'date' | 'textarea'; + label: string; + placeholder?: string; + required?: boolean; + disabled?: boolean; + options?: { key: string; value: any }[]; + validators?: ValidatorConfig[]; // Custom validators + conditionalLogic?: ConditionalRule[]; // For showing/hiding fields based on other field values + order?: number; // For ordering fields in the form + gridSize?: number; // For layout purposes, e.g., Bootstrap grid size (1-12) +} +``` +#### 1.2. Validator Configuration + +Validator configuration interface defines validation rules for form fields. +```typescript +export interface ValidatorConfig { + type: 'required' | 'email' | 'minLength' | 'maxLength' | 'pattern' | 'custom'; + value?: any; + message: string; +} +``` + +#### 1.3. Conditional Logic + +Conditional logic interface defines rules for showing/hiding or enabling/disabling fields based on other field values. +```typescript +export interface ConditionalRule { + dependsOn: string; + condition: 'equals' | 'notEquals' | 'contains' | 'greaterThan' | 'lessThan'; + value: any; + action: 'show' | 'hide' | 'enable' | 'disable'; +} +``` + +### 2. Dynamic Form Service + +We will create dynamic form service to handle form creation and validation processes. + +```typescript +@Injectable({ + providedIn: 'root' +}) +export class DynamicFormService { + + // Create form group based on fields + createFormGroup(fields: FormFieldConfig[]): FormGroup { + const group: any = {}; + + fields.forEach(field => { + const validators = this.buildValidators(field.validators || []); + const initialValue = this.getInitialValue(field); + + group[field.key] = new FormControl({ + value: initialValue, + disabled: field.disabled || false + }, validators); + }); + + return new FormGroup(group); + } + + // Returns an array of form field validators based on the validator configurations + private buildValidators(validatorConfigs: ValidatorConfig[]): ValidatorFn[] { + return validatorConfigs.map(config => { + switch (config.type) { + case 'required': + return Validators.required; + case 'email': + return Validators.email; + case 'minLength': + return Validators.minLength(config.value); + case 'maxLength': + return Validators.maxLength(config.value); + case 'pattern': + return Validators.pattern(config.value); + default: + return Validators.nullValidator; + } + }); + } + + private getInitialValue(field: FormFieldConfig): any { + switch (field.type) { + case 'checkbox': + return false; + case 'number': + return 0; + default: + return ''; + } + } +} + +``` + +### 3. Dynamic Form Component + +The main component that renders the form based on the configuration it receives as input. +```typescript +@Component({ + selector: 'app-dynamic-form', + template: ` +
+ @for (field of sortedFields; track field.key) { +
+
+ + +
+
+ } +
+ + +
+
+ `, + styles: [` + .dynamic-form { + display: flex; + gap: 0.5rem; + flex-direction: column; + } + .form-actions { + display: flex; + justify-content: flex-end; + gap: 0.5rem; + } + `], + imports: [ReactiveFormsModule, CommonModule, DynamicFormFieldComponent], +}) +export class DynamicFormComponent implements OnInit { + fields = input([]); + submitButtonText = input('Submit'); + formSubmit = output(); + formCancel = output(); + private dynamicFormService = inject(DynamicFormService); + + dynamicForm!: FormGroup; + isSubmitting = false; + fieldVisibility: { [key: string]: boolean } = {}; + + ngOnInit() { + this.dynamicForm = this.dynamicFormService.createFormGroup(this.fields()); + this.initializeFieldVisibility(); + this.setupConditionalLogic(); + } + + get sortedFields(): FormFieldConfig[] { + return this.fields().sort((a, b) => (a.order || 0) - (b.order || 0)); + } + + onSubmit() { + if (this.dynamicForm.valid) { + this.isSubmitting = true; + this.formSubmit.emit(this.dynamicForm.value); + } else { + this.markAllFieldsAsTouched(); + } + } + + onCancel() { + this.formCancel.emit(); + } + + onFieldChange(event: { fieldKey: string; value: any }) { + this.evaluateConditionalLogic(event.fieldKey); + } + + isFieldVisible(field: FormFieldConfig): boolean { + return this.fieldVisibility[field.key] !== false; + } + + private initializeFieldVisibility() { + this.fields().forEach(field => { + this.fieldVisibility[field.key] = !field.conditionalLogic?.length; + }); + } + + private setupConditionalLogic() { + this.fields().forEach(field => { + if (field.conditionalLogic) { + field.conditionalLogic.forEach(rule => { + const dependentControl = this.dynamicForm.get(rule.dependsOn); + if (dependentControl) { + dependentControl.valueChanges.subscribe(() => { + this.evaluateConditionalLogic(field.key); + }); + } + }); + } + }); + } + + private evaluateConditionalLogic(fieldKey: string) { + const field = this.fields().find(f => f.key === fieldKey); + if (!field?.conditionalLogic) return; + + field.conditionalLogic.forEach(rule => { + const dependentValue = this.dynamicForm.get(rule.dependsOn)?.value; + const conditionMet = this.evaluateCondition(dependentValue, rule.condition, rule.value); + + this.applyConditionalAction(fieldKey, rule.action, conditionMet); + }); + } + + private evaluateCondition(fieldValue: any, condition: string, ruleValue: any): boolean { + switch (condition) { + case 'equals': + return fieldValue === ruleValue; + case 'notEquals': + return fieldValue !== ruleValue; + case 'contains': + return fieldValue && fieldValue.includes && fieldValue.includes(ruleValue); + case 'greaterThan': + return Number(fieldValue) > Number(ruleValue); + case 'lessThan': + return Number(fieldValue) < Number(ruleValue); + default: + return false; + } + } + + private applyConditionalAction(fieldKey: string, action: string, shouldApply: boolean) { + const control = this.dynamicForm.get(fieldKey); + + switch (action) { + case 'show': + this.fieldVisibility[fieldKey] = shouldApply; + break; + case 'hide': + this.fieldVisibility[fieldKey] = !shouldApply; + break; + case 'enable': + if (control) { + shouldApply ? control.enable() : control.disable(); + } + break; + case 'disable': + if (control) { + shouldApply ? control.disable() : control.enable(); + } + break; + } + } + + private markAllFieldsAsTouched() { + Object.keys(this.dynamicForm.controls).forEach(key => { + this.dynamicForm.get(key)?.markAsTouched(); + }); + } +} +``` + +### 4. Dynamic Form Field Component + +This component renders individual form fields, handling different types and validation messages based on the configuration. +```typescript +@Component({ + selector: 'app-dynamic-form-field', + template: ` + @if (isVisible) { +
+ + @if (field.type === 'text') { + +
+ + + @if (isFieldInvalid()) { +
+ {{ getErrorMessage() }} +
+ } +
+ } @else if (field.type === 'select') { + +
+ + + @if (isFieldInvalid()) { +
+ {{ getErrorMessage() }} +
+ } +
+ } @else if (field.type === 'checkbox') { + +
+ + + @if (isFieldInvalid()) { +
+ {{ getErrorMessage() }} +
+ } +
+ } @else if (field.type === 'email') { + +
+ + + @if (isFieldInvalid()) { +
+ {{ getErrorMessage() }} +
+ } +
+ } @else if (field.type === 'textarea') { + +
+ + + @if (isFieldInvalid()) { +
+ {{ getErrorMessage() }} +
+ } +
+ } +
+ + } + `, + imports: [ReactiveFormsModule], +}) +export class DynamicFormFieldComponent implements OnInit { + @Input() field!: FormFieldConfig; + @Input() form!: FormGroup; + @Input() isVisible: boolean = true; + @Output() fieldChange = new EventEmitter<{ fieldKey: string; value: any }>(); + + ngOnInit() { + const control = this.form.get(this.field.key); + if (control) { + control.valueChanges.subscribe(value => { + this.fieldChange.emit({ fieldKey: this.field.key, value }); + }); + } + } + + isFieldInvalid(): boolean { + const control = this.form.get(this.field.key); + return !!(control && control.invalid && (control.dirty || control.touched)); + } + + getErrorMessage(): string { + const control = this.form.get(this.field.key); + if (!control || !control.errors) return ''; + + const validators = this.field.validators || []; + + for (const validator of validators) { + if (control.errors[validator.type]) { + return validator.message; + } + } + + // Fallback error messages + if (control.errors['required']) return `${this.field.label} is required`; + if (control.errors['email']) return 'Please enter a valid email address'; + if (control.errors['minlength']) return `Minimum length is ${control.errors['minlength'].requiredLength}`; + if (control.errors['maxlength']) return `Maximum length is ${control.errors['maxlength'].requiredLength}`; + + return 'Invalid input'; + } +} + +``` + +### 5. Usage Example + +```typescript + +@Component({ + selector: 'app-home', + template: ` +
+
+ + +
+
+ `, + imports: [DynamicFormComponent] +}) +export class HomeComponent { + @Input() title: string = 'Home Component'; + formFields: FormFieldConfig[] = [ + { + key: 'firstName', + type: 'text', + label: 'First Name', + placeholder: 'Enter first name', + required: true, + validators: [ + { type: 'required', message: 'First name is required' }, + { type: 'minLength', value: 2, message: 'Minimum 2 characters required' } + ], + gridSize: 12, + order: 1 + }, + { + key: 'lastName', + type: 'text', + label: 'Last Name', + placeholder: 'Enter last name', + required: true, + validators: [ + { type: 'required', message: 'Last name is required' } + ], + gridSize: 12, + order: 2 + }, + { + key: 'email', + type: 'email', + label: 'Email Address', + placeholder: 'Enter email', + required: true, + validators: [ + { type: 'required', message: 'Email is required' }, + { type: 'email', message: 'Please enter a valid email' } + ], + order: 3 + }, + { + key: 'userType', + type: 'select', + label: 'User Type', + required: true, + options: [ + { key: 'admin', value: 'Administrator' }, + { key: 'user', value: 'Regular User' }, + { key: 'guest', value: 'Guest User' } + ], + validators: [ + { type: 'required', message: 'Please select user type' } + ], + order: 4 + }, + { + key: 'adminNotes', + type: 'textarea', + label: 'Admin Notes', + placeholder: 'Enter admin-specific notes', + conditionalLogic: [ + { + dependsOn: 'userType', + condition: 'equals', + value: 'admin', + action: 'show' + } + ], + order: 5 + } + ]; + + onSubmit(formData: any) { + console.log('Form submitted:', formData); + // Handle form submission + } + + onCancel() { + console.log('Form cancelled'); + // Handle form cancellation + } +} + + +``` + +## Result + +![example_form](./form.png) + +## Conclusion + +These kinds of components are essential for large applications because they allow for rapid development and easy maintenance. By defining forms through configuration, developers can quickly adapt to changing requirements without extensive code changes. This approach also promotes consistency across the application, as the same form components can be reused in different contexts. \ No newline at end of file diff --git a/docs/en/Community-Articles/2025-10-07-Building-Scalable-Angular-Apps-with-Reusable-UI-Components/post.md b/docs/en/Community-Articles/2025-10-07-Building-Scalable-Angular-Apps-with-Reusable-UI-Components/post.md new file mode 100644 index 0000000000..870703d12b --- /dev/null +++ b/docs/en/Community-Articles/2025-10-07-Building-Scalable-Angular-Apps-with-Reusable-UI-Components/post.md @@ -0,0 +1,660 @@ +# Building Scalable Angular Apps with Reusable UI Components + +Frontend development keeps evolving at an incredible pace, and with every new update, our implementation standards improve as well. But even as tools and frameworks change, the core principles stay the same, and one of the most important is reusability. + +Reusability means building components and utilities that can be used in multiple places instead of using the same logic repeatedly. This approach not only saves time but also keeps your code clean, consistent, and easier to maintain as your project grows. + +Angular fully embraces this idea by offering modern features like **standalone components**, **signals**, **hybrid rendering**, and **component-level lazy loading**. + +In this article, we will explore how these features make it easier to build reusable UI components. We will also look at how to style them and organize them into shared libraries for scalable, long-term development. + +--- + +## 🧩 Breaking Down Components for True Reusability + +The first approach to make an Angular component reusable is to use standalone components. As this feature has been supported for a long time, it is now the default behavior for the latest Angular versions. Keeping that in mind, we can ensure reusability by separating a big component into smaller ones to make the small pieces usable across the application. + +Here is a quick example: + +Imagine you start with a single `UserProfileComponent` that does everything including displaying user info, recent posts, a list of friends, and even handling profile editing. + +```ts +// 📖 Compact user profile component +import { Component } from "@angular/core"; + +@Component({ + selector: "app-user-profile", + template: ` +
+
+ User avatar +

{{ user.name }}

+ +
+ +
+

Recent Posts

+
    + @for (post of user.posts; track post) { +
  • {{ post }}
  • + } +
+
+ +
+

Friends

+
    + @for (friend of user.friends; track friend) { +
  • {{ friend }}
  • + } +
+
+
+ `, +}) +export class UserProfileComponent { + user = { + name: "Jane Doe", + avatar: "/assets/avatar.png", + posts: ["Angular Tips", "Reusable Components FTW!"], + friends: ["John", "Mary", "Steve"], + }; + + editProfile() { + console.log("Editing profile..."); + } +} +``` + +Instead of this, you can create small components like these: + +- `user-avatar.component.ts` +- `user-posts.component.ts` +- `user-friends.component.ts` + +```ts +// 🧩 user-avatar.component.ts +import { Component, input } from "@angular/core"; + +@Component({ + selector: "app-user-avatar", + template: ` +
+ User avatar +

{{ name() }}

+
+ `, +}) +export class UserAvatarComponent { + name = input.required(); + avatar = input.required(); +} +``` + +```ts +// 🧩 user-posts.component.ts +import { Component, input } from "@angular/core"; + +@Component({ + selector: "app-user-posts", + template: ` +
+

Recent Posts

+
    + @for (post of posts(); track post) { +
  • {{ post }}
  • + } +
+
+ `, +}) +export class UserPostsComponent { + posts = input([]); +} +``` + +```ts +// 🧩 user-friends.component.ts +import { Component, input, output } from "@angular/core"; + +@Component({ + selector: "app-user-friends", + template: ` +
+

Friends

+
    + @for (friend of friends(); track friend) { +
  • {{ friend }}
  • + } +
+
+ `, +}) +export class UserFriendsComponent { + friends = input([]); + friendSelected = output(); + + selectFriend(friend: string) { + this.friendSelected.emit(friend); + } +} +``` + +Then, you can use them in a container component like this + +```ts +// 🧩 new user profile components that uses other user components +import { Component } from "@angular/core"; +import { signal } from "@angular/core"; +import { UserAvatarComponent } from "./user-avatar.component"; +import { UserPostsComponent } from "./user-posts.component"; +import { UserFriendsComponent } from "./user-friends.component"; + +@Component({ + selector: "app-user-profile", + imports: [UserAvatarComponent, UserPostsComponent, UserFriendsComponent], + template: ` +
+ + + +
+ `, +}) +export class UserProfileComponent { + user = signal({ + name: "Jane Doe", + avatar: "/assets/avatar.png", + posts: ["Angular Tips", "Reusable Components FTW!"], + friends: ["John", "Mary", "Steve"], + }); + + onFriendSelected(friend: string) { + console.log(`Selected friend: ${friend}`); + } +} +``` + +The most common problem of creating such components is over-creating new elements when you actually do not need them. So, it is a design decision that needs to be carefully taken while building the application. If misused, it can lead to: + +- a management nightmare +- unnecessary lifecycle hook complexity +- extra indirect data flow (makes debugging harder) + +Nevertheless, this makes the app more scalable and maintainable if correctly used. Such structure will provide: + +- a clear separation of concerns as each component will maintain decided tasks +- faster feature development +- shared libraries or elements across the application + +--- + +## 🚀 Why Standalone Components Matter + +As Angular has announced standalone components starting from version 17, they have been gradually developing features that support reusability. This important feature brings a great migration for components, directives, and pipes. + +Since it allows these elements to be used directly inside an `imports` array rather than through a module structure, it reinforces reusability patterns and simplifies management. + +Back in the module-based structure, we used to create these components and declare them in modules. This still offers some reusability, as we can import the modules where needed. However, standalone components can be consumed both by other standalone components and modules. For this reason, migrating from the module-based structure to a fully standalone architecture brings many benefits for this concern. + +--- + +## 🧠 Designing Components That Scale and Reuse Well + +The first point you need to consider here is to encapsulate and isolate logic. + +For example: + +1. This counter component isolates the concept of incrementing/decrementing so the parent component will not take care of this logic except showing the result. + + ```ts + import { Component, signal } from "@angular/core"; + + @Component({ + selector: "app-counter", + template: ` + + {{ count() }} + + `, + }) + export class CounterComponent { + private count = signal(0); // internal state + + increment() { + this.count.update((v) => v + 1); + } + decrement() { + this.count.update((v) => v - 1); + } + } + ``` + +2. This component isolates the styles and makes the badge reusable. Styles in this component will not leak out to others, and global styles will not affect it. + + ```ts + import { Component, ViewEncapsulation } from "@angular/core"; + + @Component({ + selector: "app-badge", + template: `{{ label }}`, + styles: [ + ` + .badge { + background: #007bff; + color: white; + padding: 4px 8px; + border-radius: 4px; + } + `, + ], + encapsulation: ViewEncapsulation.Emulated, // default; isolates CSS + }) + export class BadgeComponent { + label = "New"; + } + ``` + +3. The search component below is a very common example since it handles a business logic exposing simple inputs/outputs + + ```ts + import { Component, input, output } from "@angular/core"; + + @Component({ + selector: "app-search-box", + template: ` + + `, + }) + export class SearchBoxComponent { + query = input(""); + changed = output(); + + onChange(event: Event) { + const value = (event.target as HTMLInputElement).value; + this.changed.emit(value); + } + } + ``` + +Encapsulation ensures that each component manages its own logic without leaking details to the outside. By keeping behavior self-contained, components become easier to understand, test, and reuse. This isolation prevents unexpected side effects, keeps your UI predictable, and allows each component to evolve independently as your application grows. + +At this point, we can also briefly mention smart and dumb components. Smart components handle business logic, while dumb components take care of displaying data and emitting user actions. + +This separation keeps your UI structure scalable. Smart components can change how data is loaded or handled without affecting presentation components, and dumb components can be reused anywhere since they just rely on inputs and outputs. + +```ts +// smart component (container) +@Component({ + selector: "app-user-profile", + imports: [UserCardComponent], + template: ``, +}) +export class UserProfileComponent { + user = signal({ name: "Jane", role: "Admin" }); + + onSelect(user: any) { + console.log("Selected user:", user); + } +} + +// dumb component (presentation) +@Component({ + selector: "app-user-card", + standalone: true, + template: ` +
+

{{ user().name }}

+

{{ user().role }}

+
+ `, +}) +export class UserCardComponent { + user = input.required<{ name: string; role: string }>(); + select = output<{ name: string; role: string }>(); +} +``` + +--- + +## 🔁 Reusing Components Across the Application + +As there are many ways of reusing a component in the project, we will go over a real-life example. + +Here are two very common ABP components that can be reused anywhere in the app: + +```ts +//... +import { ABP } from "@abp/ng.core"; + +@Component({ + selector: "abp-button", + template: ` + + `, + imports: [NgClass], +}) +export class ButtonComponent implements OnInit { + private renderer = inject(Renderer2); + + @Input() + buttonId = ""; + + @Input() + buttonClass = "btn btn-primary"; + + @Input() + buttonType = "button"; + + @Input() + formName?: string = undefined; + + @Input() + iconClass?: string; + + @Input() + loading = false; + + @Input() + disabled: boolean | undefined = false; + + @Input() + attributes?: ABP.Dictionary; + + @Output() readonly click = new EventEmitter(); + + @Output() readonly focus = new EventEmitter(); + + @Output() readonly blur = new EventEmitter(); + + @Output() readonly abpClick = new EventEmitter(); + + @Output() readonly abpFocus = new EventEmitter(); + + @Output() readonly abpBlur = new EventEmitter(); + + @ViewChild("button", { static: true }) + buttonRef!: ElementRef; + + get icon(): string { + return `${ + this.loading ? "fa fa-spinner fa-spin" : this.iconClass || "d-none" + }`; + } + + ngOnInit() { + if (this.attributes) { + Object.keys(this.attributes).forEach((key) => { + if (this.attributes?.[key]) { + this.renderer.setAttribute( + this.buttonRef.nativeElement, + key, + this.attributes[key] + ); + } + }); + } + } +} +``` + +This button component can be used by simply importing the `ButtonComponent` and using the `` tag. + +You can reach the source code [here](https://github.com/abpframework/abp/blob/dev/npm/ng-packs/packages/theme-shared/src/lib/components/button/button.component.ts). + +This modal component is also commonly used. The source code is [here](https://github.com/abpframework/abp/blob/dev/npm/ng-packs/packages/theme-shared/src/lib/components/modal/modal.component.ts). + +```ts +//... +export type ModalSize = "sm" | "md" | "lg" | "xl"; + +@Component({ + selector: "abp-modal", + templateUrl: "./modal.component.html", + styleUrls: ["./modal.component.scss"], + providers: [SubscriptionService], + imports: [NgTemplateOutlet], +}) +export class ModalComponent implements OnInit, OnDestroy, DismissableModal { + protected readonly confirmationService = inject(ConfirmationService); + protected readonly modal = inject(NgbModal); + protected readonly modalRefService = inject(ModalRefService); + protected readonly suppressUnsavedChangesWarningToken = inject( + SUPPRESS_UNSAVED_CHANGES_WARNING, + { + optional: true, + } + ); + protected readonly destroyRef = inject(DestroyRef); + private document = inject(DOCUMENT); + + visible = model(false); + + busy = input(false, { + transform: (value: boolean) => { + if (this.abpSubmit() && this.abpSubmit() instanceof ButtonComponent) { + this.abpSubmit().loading = value; + } + return value; + }, + }); + + options = input({ keyboard: true }); + + suppressUnsavedChangesWarning = input( + this.suppressUnsavedChangesWarningToken + ); + + modalContent = viewChild>("modalContent"); + + abpHeader = contentChild>("abpHeader"); + + abpBody = contentChild>("abpBody"); + + abpFooter = contentChild>("abpFooter"); + + abpSubmit = contentChild(ButtonComponent, { read: ButtonComponent }); + + readonly init = output(); + + readonly appear = output(); + + readonly disappear = output(); + + modalRef!: NgbModalRef; + + isConfirmationOpen = false; + + modalIdentifier = `modal-${uuid()}`; + + get modalWindowRef() { + return this.document.querySelector( + `ngb-modal-window.${this.modalIdentifier}` + ); + } + + get isFormDirty(): boolean { + return Boolean(this.modalWindowRef?.querySelector(".ng-dirty")); + } + + constructor() { + effect(() => { + this.toggle(this.visible()); + }); + } + + ngOnInit(): void { + this.modalRefService.register(this); + } + + dismiss(mode: ModalDismissMode) { + switch (mode) { + case "hard": + this.visible.set(false); + break; + case "soft": + this.close(); + break; + default: + break; + } + } + + protected toggle(value: boolean) { + this.visible.set(value); + + if (!value) { + this.modalRef?.dismiss(); + this.disappear.emit(); + return; + } + + setTimeout(() => this.listen(), 0); + this.modalRef = this.modal.open(this.modalContent(), { + size: "md", + centered: false, + keyboard: false, + scrollable: true, + beforeDismiss: () => { + if (!this.visible()) return true; + + this.close(); + return !this.visible(); + }, + ...this.options(), + windowClass: `${this.options().windowClass || ""} ${ + this.modalIdentifier + }`, + }); + + this.appear.emit(); + } + + ngOnDestroy(): void { + this.modalRefService.unregister(this); + this.toggle(false); + } + + close() { + if (this.busy()) return; + + if (this.isFormDirty && !this.suppressUnsavedChangesWarning()) { + if (this.isConfirmationOpen) return; + + this.isConfirmationOpen = true; + this.confirmationService + .warn( + "AbpUi::AreYouSureYouWantToCancelEditingWarningMessage", + "AbpUi::AreYouSure", + { + dismissible: false, + } + ) + .subscribe((status: Confirmation.Status) => { + this.isConfirmationOpen = false; + if (status === Confirmation.Status.confirm) { + this.visible.set(false); + } + }); + } else { + this.visible.set(false); + } + } + + listen() { + if (this.modalWindowRef) { + fromEvent(this.modalWindowRef, "keyup") + .pipe( + takeUntilDestroyed(this.destroyRef), + debounceTime(150), + filter( + (key: KeyboardEvent) => + key && key.key === "Escape" && this.options().keyboard + ) + ) + .subscribe(() => this.close()); + } + + fromEvent(window, "beforeunload") + .pipe(takeUntilDestroyed(this.destroyRef)) + .subscribe((event) => { + if (this.isFormDirty && !this.suppressUnsavedChangesWarning()) { + event.preventDefault(); + } + }); + + this.init.emit(); + } +} +``` + +This concept differs slightly from the others mentioned above since these components are introduced within a library called `theme-shared`, which you can explore [here](https://github.com/abpframework/abp/tree/dev/npm/ng-packs/packages/theme-shared). + +Using **shared libraries** for such common components is one of the most effective ways to make your app modular and maintainable. By grouping frequently used elements into a dedicated library, you create a single source of truth for your UI and logic. + +However, over-creating or prematurely abstracting small pieces of logic into separate libraries can lead to unnecessary complexity and dependency management overhead. When every feature has its own “mini-library,” updates and debugging become scattered and difficult to coordinate. + +The key is to extract shared functionality only when it is proven to be reused across multiple contexts. Start small, let patterns emerge naturally, and then move them into a shared library when the benefits of reusability outweigh the maintenance cost. + +--- + +## ⚙️ Best Practices and Common Pitfalls + +### ✅ Best Practices + +1. **Start with real reuse:** Extract components only after the pattern appears in multiple places. +2. **Keep them focused:** One clear responsibility per component—avoid “do-it-all” designs. +3. **Use standalone components:** Simplify imports and improve independence. +4. **Promote through libraries:** Move proven, stable components into shared libraries for wider use. + +### ⚠️ Common Mistakes + +1. **Premature abstraction:** Don't create components before actual reuse. +2. **Too many input/output bindings:** Overly generic components are hard to configure and maintain. +3. **Neglecting performance:** Too many micro-components can hurt performance. +4. **Ignoring accessibility and semantics:** Reusable does not mean usable—always consider ARIA roles and HTML structure. + +--- + +## 📚 Further Reading and References + +As this article has mentioned some concepts and best practices, you can explore these resources for more details: + +- [Angular Components Guide](https://angular.dev/guide/components) +- [Standalone Migration Guides](https://angular.dev/reference/migrations/standalone), [ABP Angular Standalone Applications](https://abp.io/community/articles/abp-now-supports-angular-standalone-applications-zzi2rr2z#gsc.tab=0) +- [Smart vs. Dumb Components](https://blog.angular-university.io/angular-2-smart-components-vs-presentation-components-whats-the-difference-when-to-use-each-and-why/) +- [Angular Libraries Overview](https://angular.dev/tools/libraries) + +You can also check these open-source libraries for a better understanding of reusability and modularity: + +- [Angular Components on GitHub](https://github.com/angular/components) +- [ABP NPM Libraries](https://github.com/abpframework/abp/tree/dev/npm/ng-packs/packages) + +--- + +## 🏁 Conclusion + +Reusability is one of the strongest architectural foundations for scalable Angular applications. By combining **standalone components**, **signals**, **encapsulated logic**, and **shared libraries**, you can create a modular system that grows gracefully over time. + +The goal is not just to make components reusable. It is to make them meaningful, maintainable, and consistent across your app. Build only what truly adds value, reuse intentionally, and let Angular's evolving ecosystem handle the rest. diff --git a/docs/en/Community-Articles/2025-10-09-how-to-change-logo-in-angular-abp-apps/article.md b/docs/en/Community-Articles/2025-10-09-how-to-change-logo-in-angular-abp-apps/article.md new file mode 100644 index 0000000000..59939beab1 --- /dev/null +++ b/docs/en/Community-Articles/2025-10-09-how-to-change-logo-in-angular-abp-apps/article.md @@ -0,0 +1,289 @@ +# How to Change Logo in Angular ABP Applications + +## Introduction + +Logo application customization is one of the most common branding requirements in web applications. In ABP Framework's Angular applications, we found that developers were facing problems while they were trying to implement their application logos, especially on theme dependencies and flexibility. To overcome this, we moved the logo provider from `@volo/ngx-lepton-x.core` to `@abp/ng.theme.shared`, where it is more theme-independent and accessible. Here, we will describe our experience using this improvement and guide you on the new approach for logo configuration in ABP Angular applications. + +## Problem + +Previously, the logo configuration process in ABP Angular applications had several disadvantages: + +1. **Theme Dependency**: The `provideLogo` function was a part of the `@volo/ngx-lepton-x.core` package, so the developers had to depend on LeptonX theme packages even when they were using a different theme or wanted to extend the logo behavior. + +2. **Inflexibility**: The fact that the logo provider had to adhere to a specific theme package brought about an undesirable tight coupling of logo configuration and theme implementation. + +3. **Discoverability Issues**: Developers looking for logo configuration features would likely look in core ABP packages, but the provider was hidden in a theme-specific package, which made it harder to discover. + +4. **Migration Issues**: During theme changes or theme package updates, logo setting could get corrupted or require additional tuning. + +These made a basic operation like altering the application logo more challenging than it should be, especially for teams using custom themes or wanting to maintain theme independence. + +## Solution + +We moved the `provideLogo` function from `@volo/ngx-lepton-x.core` to `@abp/ng.theme.shared` package. This solution offers: + +- **Theme Independence**: Works with any ABP-compatible theme +- **Single Source of Truth**: Logo configuration is centralized in the environment file +- **Standard Approach**: Follows ABP's provider-based configuration pattern +- **Easy Migration**: Simple import path change for existing applications +- **Better Discoverability**: Located in a core ABP package where developers expect it + +This approach maintains ABP's philosophy of providing flexible, reusable solutions while reducing unnecessary dependencies. + +## Implementation + +Let's walk through how logo configuration works with the new approach. + +### Step 1: Configure Logo URL in Environment + +First, define your logo URL in the `environment.ts` file: + +```typescript +export const environment = { + production: false, + application: { + baseUrl: 'http://localhost:4200', + name: 'MyApplication', + logoUrl: 'https://your-domain.com/assets/logo.png', + }, + // ... other configurations +}; +``` + +The `logoUrl` property accepts any valid URL, allowing you to use: +- Absolute URLs (external images) +- Relative paths to assets folder (`/assets/logo.png`) +- Data URLs for embedded images +- CDN-hosted images + +### Step 2: Provide Logo Configuration + +In your `app.config.ts` (or `app.module.ts` for module-based apps), import and use the logo provider: + +```typescript +import { provideLogo, withEnvironmentOptions } from '@abp/ng.theme.shared'; +import { environment } from './environments/environment'; + +export const appConfig: ApplicationConfig = { + providers: [ + // ... other providers + provideLogo(withEnvironmentOptions(environment)), + ], +}; +``` + +**Important Note**: If you're migrating from an older version where the logo provider was in `@volo/ngx-lepton-x.core`, simply update the import statement: + +```typescript +// Old (before migration) +import { provideLogo, withEnvironmentOptions } from '@volo/ngx-lepton-x.core'; + +// New (current approach) +import { provideLogo, withEnvironmentOptions } from '@abp/ng.theme.shared'; +``` + +### How It Works Under the Hood + +The `provideLogo` function registers a logo configuration service that: +1. Reads the `logoUrl` from environment configuration +2. Provides it to theme components through Angular's dependency injection +3. Allows themes to access and render the logo consistently + +The `withEnvironmentOptions` helper extracts the relevant configuration from your environment object, ensuring type safety and proper configuration structure. + +### Example: Complete Configuration + +Here's a complete example showing both environment and provider configuration: + +**environment.ts:** +```typescript +export const environment = { + production: false, + application: { + baseUrl: 'http://localhost:4200', + name: 'E-Commerce Platform', + logoUrl: 'https://cdn.example.com/brand/logo-primary.svg', + }, + oAuthConfig: { + issuer: 'https://localhost:44305', + clientId: 'MyApp_App', + // ... other OAuth settings + }, + // ... other settings +}; +``` + +**app.config.ts:** +```typescript +import { ApplicationConfig } from '@angular/core'; +import { provideRouter } from '@angular/router'; +import { provideLogo, withEnvironmentOptions } from '@abp/ng.theme.shared'; +import { environment } from './environments/environment'; +import { routes } from './app.routes'; + +export const appConfig: ApplicationConfig = { + providers: [ + provideRouter(routes), + provideLogo(withEnvironmentOptions(environment)), + // ... other providers + ], +}; +``` + +## Advanced: Logo Component Replacement + +For more advanced customization scenarios where you need complete control over the logo component's structure, styling, or behavior, ABP provides a component replacement mechanism. This approach allows you to replace the entire logo component with your custom implementation. + +### When to Use Component Replacement + +Consider using component replacement when: +- You need custom HTML structure around the logo +- You want to add interactive elements (e.g., dropdown menu, animations) +- You need to implement complex responsive behavior +- The simple `logoUrl` configuration doesn't meet your requirements + +### How to Replace the Logo Component + +#### Step 1: Generate a New Logo Component + +Run the following command in your Angular folder to create a new component: + +```bash +ng generate component custom-logo --inline-template --inline-style +``` + +#### Step 2: Implement Your Custom Logo + +Open the generated `custom-logo.component.ts` and implement your custom logo: + +```typescript +import { Component } from '@angular/core'; +import { RouterModule } from '@angular/router'; + +@Component({ + selector: 'app-custom-logo', + standalone: true, + imports: [RouterModule], + template: ` + + My Application Logo + + `, + styles: [` + .navbar-brand { + padding: 0.5rem 1rem; + } + + .navbar-brand img { + transition: opacity 0.3s ease; + } + + .navbar-brand:hover img { + opacity: 0.8; + } + `] +}) +export class CustomLogoComponent {} +``` + +#### Step 3: Register the Component Replacement + +Open your `app.config.ts` and register the component replacement: + +```typescript +import { ApplicationConfig } from '@angular/core'; +import { provideRouter } from '@angular/router'; +import { ReplaceableComponentsService } from '@abp/ng.core'; +import { eThemeBasicComponents } from '@abp/ng.theme.basic'; +import { CustomLogoComponent } from './custom-logo/custom-logo.component'; +import { environment } from './environments/environment'; +import { routes } from './app.routes'; + +export const appConfig: ApplicationConfig = { + providers: [ + provideRouter(routes), + // ... other providers + { + provide: 'APP_INITIALIZER', + useFactory: (replaceableComponents: ReplaceableComponentsService) => { + return () => { + replaceableComponents.add({ + component: CustomLogoComponent, + key: eThemeBasicComponents.Logo, + }); + }; + }, + deps: [ReplaceableComponentsService], + multi: true, + }, + ], +}; +``` + +Alternatively, if you're using a module-based application, you can register it in `app.component.ts`: + +```typescript +import { Component, OnInit } from '@angular/core'; +import { ReplaceableComponentsService } from '@abp/ng.core'; +import { eThemeBasicComponents } from '@abp/ng.theme.basic'; +import { CustomLogoComponent } from './custom-logo/custom-logo.component'; + +@Component({ + selector: 'app-root', + template: '', +}) +export class AppComponent implements OnInit { + constructor(private replaceableComponents: ReplaceableComponentsService) {} + + ngOnInit() { + this.replaceableComponents.add({ + component: CustomLogoComponent, + key: eThemeBasicComponents.Logo, + }); + } +} +``` + +### Component Replacement vs Logo URL Configuration + +Here's a comparison to help you choose the right approach: + +| Feature | Logo URL Configuration | Component Replacement | +|---------|------------------------|----------------------| +| **Simplicity** | Very simple, one-line configuration | Requires creating a new component | +| **Flexibility** | Limited to image URL | Full control over HTML/CSS/behavior | +| **Use Case** | Standard logo display | Complex customizations | +| **Maintenance** | Minimal | Requires component maintenance | +| **Migration** | Easy to change | Requires code changes | +| **Recommended For** | Most applications | Advanced customization needs | + +For most applications, the simple `logoUrl` configuration in the environment file is sufficient and recommended. Use component replacement only when you need advanced customization that goes beyond a simple image. + +### Benefits of This Approach + +1. **Separation of Concerns**: Logo configuration is separate from theme implementation +2. **Environment-Based**: Different logos for development, staging, and production +3. **Type Safety**: TypeScript ensures correct configuration structure +4. **Testing**: Easy to mock and test logo configuration +5. **Consistency**: Same logo appears across all theme components automatically +6. **Flexibility**: Choose between simple configuration or full component replacement based on your needs + +## Conclusion + +In this article, we explored how ABP Framework simplified logo configuration in Angular applications by moving the logo provider from `@volo/ngx-lepton-x.core` to `@abp/ng.theme.shared`. This change eliminates unnecessary theme dependencies and makes logo customization more straightforward and theme-agnostic. + +The solution we implemented allows developers to configure their application logo simply by setting a URL in the environment file and providing the logo configuration in their application setup. For advanced scenarios requiring complete control over the logo component, ABP's component replacement mechanism provides a powerful alternative. This approach maintains flexibility while reducing complexity and improving discoverability. + +We developed this improvement while working on ABP Framework to enhance developer experience and reduce common friction points. By sharing this solution, we hope to help teams implement consistent branding across their ABP Angular applications more easily, regardless of which theme they choose to use. + +If you're using an older version of ABP with logo configuration in LeptonX packages, migrating to this new approach requires only a simple import path change, making it a smooth upgrade path for existing applications. + +## See Also + +- [Component Replacement Documentation](https://abp.io/docs/latest/framework/ui/angular/component-replacement) +- [ABP Angular UI Customization Guide](https://abp.io/docs/latest/framework/ui/angular/customization) diff --git a/docs/en/Community-Articles/2025-10-10-Using-Transfer-State-with-Angular-SSR/cover.png b/docs/en/Community-Articles/2025-10-10-Using-Transfer-State-with-Angular-SSR/cover.png new file mode 100644 index 0000000000..2a0bcf52e9 Binary files /dev/null and b/docs/en/Community-Articles/2025-10-10-Using-Transfer-State-with-Angular-SSR/cover.png differ diff --git a/docs/en/Community-Articles/2025-10-10-Using-Transfer-State-with-Angular-SSR/post.md b/docs/en/Community-Articles/2025-10-10-Using-Transfer-State-with-Angular-SSR/post.md new file mode 100644 index 0000000000..3110a8e1be --- /dev/null +++ b/docs/en/Community-Articles/2025-10-10-Using-Transfer-State-with-Angular-SSR/post.md @@ -0,0 +1,267 @@ +# From Server to Browser — the Elegant Way: Angular TransferState Explained + +## Introduction + +When building Angular applications with Server‑Side Rendering (SSR), a common performance pitfall is duplicated data fetching: the server loads data to render HTML, then the browser bootstraps Angular and fetches the same data again. That’s wasteful, increases Time‑to‑Interactive, and can hammer your APIs. + +Angular’s built‑in **TransferState** lets you transfer the data fetched on the server to the browser during hydration so the client can reuse it instead of calling the API again. It’s simple, safe for serializable data, and makes SSR feel instant for users. + +This article explains what TransferState is, and how to implement it in your Angular SSR app. + +--- + +## What Is TransferState? + +TransferState is a key–value store that exists for a single SSR render. On the server, you put serializable data into the store. Angular serializes it into the HTML as a small script tag. When the browser hydrates, Angular reads that payload back and makes it available to your app. You can then consume it and skip duplicate HTTP calls. + +Key points: + +- Works only across the SSR → browser hydration boundary (not a general cache). +- Data is cleaned up after bootstrapping (no stale data). +- Stores JSON‑serializable data only (if you need to use Date/Functions/Map; serialize it). +- Data is set on the server and read on the client. + +--- + +## When Should You Use It? + +- Data fetched during SSR that is also be needed on the client. +- Data that doesn’t change between server render and immediate client hydration. +- Expensive or slow API endpoints where a second request is visibly costly. + +Avoid using it for: + +- Highly dynamic data that changes frequently. +- Sensitive data (never put secrets/tokens in TransferState). +- Large payloads (keep the serialized state small to avoid bloating HTML). + +--- + +## Prerequisites + +- An Angular app with SSR enabled (Angular ≥16: `ng add @angular/ssr`). +- `HttpClient` configured. The examples below show both manual TransferState use and the build in solutions. + +--- + +## Option A — Using TransferState Manually + +This approach gives you full control over what to cache and when. It's straightforward and works in both module‑based and standalone‑based apps. + +Service example that fetches books and uses TransferState: + +```ts +// books.service.ts +import { + Injectable, + PLATFORM_ID, + makeStateKey, + TransferState, + inject, +} from '@angular/core'; +import { isPlatformServer } from '@angular/common'; +import { HttpClient } from '@angular/common/http'; +import { Observable, of } from 'rxjs'; +import { tap } from 'rxjs/operators'; + +export interface Book { + id: number; + name: string; + price: number; +} + +@Injectable({ providedIn: 'root' }) +export class BooksService { + BOOKS_KEY = makeStateKey('books:list'); + readonly httpClient = inject(HttpClient); + readonly transferState = inject(TransferState); + readonly platformId = inject(PLATFORM_ID); + + getBooks(): Observable { + // If browser and we have the data that already fetched on the server, use it and remove from TransferState + if (this.transferState.hasKey(this.BOOKS_KEY)) { + const cached = this.transferState.get(this.BOOKS_KEY, []); + this.transferState.remove(this.BOOKS_KEY); // remove to avoid stale reads + return of(cached); + } + + // Otherwise fetch data. If running on the server, write into TransferState + return this.httpClient.get('/api/books').pipe( + tap(list => { + if (isPlatformServer(this.platformId)) { + this.transferState.set(this.BOOKS_KEY, list); + } + }) + ); + } +} + +``` + +Use it in a component: + +```ts +// books.component.ts +import { Component, inject, OnInit } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { BooksService, Book } from './books.service'; + +@Component({ + selector: 'app-books', + imports: [CommonModule], + template: ` +

Books

+
    + @for (book of books; track book.id) { +
  • {{ book.name }} — {{ book.price | currency }}
  • + } +
+ `, +}) +export class BooksComponent implements OnInit { + private booksService = inject(BooksService); + books: Book[] = []; + + ngOnInit() { + this.booksService.getBooks().subscribe(data => (this.books = data)); + } +} + +``` + +Route resolver variant (keeps templates simple and aligns with SSR prefetching): + +```ts +// src/app/routes.ts + +export const routes: Routes = [ + { + path: 'books', + component: BooksComponent, + resolve: { + books: () => inject(BooksService).getBooks(), + }, + }, +]; +``` + +Then read `books` from the `ActivatedRoute` data in your component. + +--- + +## Option B — Using HttpInterceptor to Automate TransferState + +Like Option A, but less boilerplate. This approach uses an **HttpInterceptor** to automatically cache HTTP GET (also POST/PUT request but not recommended) responses in TransferState. You can determine which requests to cache based on URL patterns. + +Example interceptor that caches GET requests: + +```ts +import { inject, makeStateKey, PLATFORM_ID, TransferState } from '@angular/core'; +import { + HttpEvent, + HttpHandlerFn, + HttpInterceptorFn, + HttpRequest, + HttpResponse, +} from '@angular/common/http'; +import { Observable, of } from 'rxjs'; +import { isPlatformBrowser, isPlatformServer } from '@angular/common'; +import { tap } from 'rxjs/operators'; + +export const transferStateInterceptor: HttpInterceptorFn = ( + req: HttpRequest, + next: HttpHandlerFn, +): Observable> => { + const transferState = inject(TransferState); + const platformId = inject(PLATFORM_ID); + + // Only cache GET requests. You can customize this to match specific URLs if needed. + if (req.method !== 'GET') { + return next(req); + } + + // Create a unique key for this request + const stateKey = makeStateKey>(req.urlWithParams); + + // If browser, check if we have the response in TransferState + if (isPlatformBrowser(platformId)) { + const storedResponse = transferState.get>(stateKey, null); + if (storedResponse) { + transferState.remove(stateKey); // remove to avoid stale reads + return of(new HttpResponse({ body: storedResponse, status: 200 })); + } + } + + return next(req).pipe( + tap(event => { + // If server, store the response in TransferState + if (isPlatformServer(platformId) && event instanceof HttpResponse) { + transferState.set(stateKey, event.body); + } + }), + ); +}; + +``` + +Add the interceptor to your app module or bootstrap function: + +````ts + provideHttpClient(withFetch(), withInterceptors([transferStateInterceptor])) +```` + + +--- + +## Option C — Using Angular's Built-in HTTP Transfer Cache + +This is the simplest option if you want to HTTP requests that without custom logic. + +Angular docs: https://angular.dev/api/platform-browser/withHttpTransferCacheOptions + + +Usage examples: + +```ts + // Only cache GET requests that have no headers + provideClientHydration(withHttpTransferCacheOptions({})) + + // Also cache POST requests (not recommended for most cases) + provideClientHydration(withHttpTransferCacheOptions({ + includePostRequests: true + })) + + // Cache requests that have auth headers (e.g., JWT tokens) + provideClientHydration(withHttpTransferCacheOptions({ + includeRequestsWithAuthHeaders: true + })) +``` + +To see all options, check the Angular docs: https://angular.dev/api/common/http/HttpTransferCacheOptions + +## Best Practices and Pitfalls + +- Keep payloads small: only put what’s needed for initial paint. +- Serialize explicitly if needed: for Dates or complex types, convert to strings and reconstruct on the client. +- Don’t transfer secrets: never place tokens or sensitive user data in TransferState. +- Per‑request isolation: state is scoped to a single SSR request; it is not a global cache. + +--- + +## Debugging Tips + +- Log on server vs browser: use `isPlatformServer` and `isPlatformBrowser` checks to confirm where code runs. +- DevTools inspection: view the page source after SSR; you’ll see a small script tag that embeds the transfer state. +- Count requests: put a console log in your service to verify the second HTTP call is gone on the client. + +--- + +## Measurable Impact + +On content‑heavy pages, TransferState typically removes 1–3 duplicate API calls during hydration, shaving 100–500 ms from the critical path on average networks. It’s a low‑effort, high‑impact win for SSR apps. + +--- + +## Conclusion + +If you already have SSR, enabling TransferState is one of the easiest ways to make hydration feel instant. You can use it built‑in HTTP caching or manually control what to cache. Either way, it eliminates redundant data fetching, speeds up Time‑to‑Interactive, and improves user experience with minimal effort. diff --git a/docs/en/Community-Articles/2025-10-15-angular-library-linking-made-easy-paths-workspaces-and-symlinks/POST.md b/docs/en/Community-Articles/2025-10-15-angular-library-linking-made-easy-paths-workspaces-and-symlinks/POST.md new file mode 100644 index 0000000000..52601e8624 --- /dev/null +++ b/docs/en/Community-Articles/2025-10-15-angular-library-linking-made-easy-paths-workspaces-and-symlinks/POST.md @@ -0,0 +1,244 @@ +# Angular Library Linking Made Easy: Paths, Workspaces, and Symlinks + +Managing local libraries and path references in Angular projects has evolved significantly with the introduction of the new Angular application builder. What once required manual path mappings, fragile symlinks, and `node_modules` references is now more structured, predictable, and aligned with modern TypeScript and workspace practices. This guide walks through how path mapping works, how it has changed, and the best ways to link and manage your local libraries in brand new Angular ecosystem. + +### Understanding TypeScript Path Mapping + +Path aliases is a powerful feature in TypeScript that helps developers simplify and organize their import statements. Instead of dealing with long and error-prone relative paths like `../../../components/button`, you can define a clear and descriptive alias that points directly to a specific directory or module. + +This configuration is managed through the `paths` property in the TypeScript configuration file (`tsconfig.json`), allowing you to map custom names to local folders or compiled outputs. For example: + +```json +// tsconfig.json +{ + "compilerOptions": { + "paths": { + "@my-package": ["./dist/my-package"], + "@my-second-package": ["./projects/my-second-package/src/public-api.ts"] + } + } +} +``` + +In this setup, `@my-package` serves as a shorthand reference to your locally built library. Once configured, you can import modules using `@my-package` instead of long relative paths, which greatly improves readability and maintainability across large projects. + +When working with multiple subdirectories or a more complex folder structure, you can also use wildcards to create flexible and dynamic mappings. This pattern is especially useful for modular libraries or mono-repos that contain multiple sub-packages: + +```json +// tsconfig.json +{ + "compilerOptions": { + "paths": { + "@my-package/*": ["./dist/my-package/*"] + } + } +} +``` + +With this approach, imports like `@my-package/utils` or `@my-package/components/button` will automatically resolve to the corresponding directories in your build output. This makes your codebase more maintainable, portable, and consistent. This is useful especially when collaborating across teams or working with multiple libraries in the same workspace. + +--- + +### Step-by-Step Examples of Path Configuration + +As this example provides a glimpse for the path mapping, this is not the only way for the aliases. Here are the other ways to utilize this feature. + +1. **Using `package.json` Exports for Library Mapping** + + When developing internal libraries within a mono-repo, another option is to use the `exports` field in each library’s `package.json` + + This allows Node and modern bundlers to resolve imports cleanly when consuming the library, without depending solely on TypeScript configuration. + + ```json + // dist/my-lib/package.json + { + "name": "@my-org/my-lib", + "version": "1.0.0", + "exports": { + ".": "./index.js", + "./utils": "./utils/index.ts" + } + } + ``` + + ```tsx + import { formatDate } from "@my-org/my-lib/utils"; + ``` + + This approach becomes especially powerful when publishing your libraries or integrating them into larger Angular mono-repos. Because, it aligns both runtime (Node) and compile-time (TypeScript) resolution. + +2. **Linking Local Libraries via Symlinks** + + If you want to use a local library that is not yet published to npm, you can create a symbolic link between your library’s `dist` output and your consuming app. + + This is useful when testing or developing multiple packages in parallel. + + You can create a symlink using npm or yarn: + + ```bash + # Inside your library folder + npm link + + # Inside your consuming app + npm link @my-org/my-lib + ``` + + This effectively tells Node to resolve `@my-org/my-lib` from your local file system instead of the npm registry. + + However, note that symlinks can sometimes lead to path resolution issues with certain Angular build configurations, especially before the new application builder. With the latest builder improvements, this approach is becoming more stable and predictable. + +3. **Combining Path Mapping with Workspace Configuration** + + In a structured Angular workspace, especially one created with **Nx** or **Angular CLI** using multiple projects, you can combine the approaches above. + + For instance, your `tsconfig.base.json` can define local references for in-repo libraries, while each library’s `package.json` provides external mappings for reuse outside the workspace. + + This hybrid setup ensures that: + + - The workspace remains easy to navigate and refactor locally. + - External consumers (or CI builds) can still resolve imports correctly once libraries are built. + + For larger Angular projects or mono-repos, **Workspaces** (supported by both **Yarn** and **npm**) offer a clean way to manage multiple local packages within the same repository. Workspaces automatically link internal libraries together, so you can reference them by name instead of using manual `file:` paths or complex TypeScript aliases. This approach keeps dependencies consistent, simplifies cross-project development, and scales well for enterprise or multi-package setups. + +Each of these methods has its strengths: + +- **TypeScript paths:** This is great for local development and quick imports. +- **`package.json` exports:** This is ideal for libraries meant to be distributed. +- **Symlinks:** These are convenient for local testing between projects. + +Choosing the right one, or even combining them depends on the scale of your project and whether you are building internal libraries, or a full mono-repo setup. + +--- + +### How Path References Worked Before the New Angular Application Builder + +Angular used to support path aliases to the locally installed packages by referencing to the `node_modules` folder like this: + +```json +// tsconfig.json +{ + "compilerOptions": { + "paths": { + "@angular/*": ["./node_modules/@angular/*"] + } + } +} +``` + +However, this approach is not recommended, hence not supported, by the TypeScript. You can find detailed guidance on this topic in the TypeScript documentation, which notes that paths should not reference mono-repo packages or those inside **node_modules**: [Paths should not point to monorepo packages or node_modules packages](https://www.typescriptlang.org/docs/handbook/modules/reference.html#paths-should-not-point-to-monorepo-packages-or-node_modules-packages). + +Giving a real life example would explain the situation better. Suppose that you have such structure: + +- Amain angular app that consumes several npm dependencies and holds registered local paths that reference to another library locally like this: + + ```json + // angular/tsconfig.json + { + "compileOnSave": false, + "compilerOptions": { + "paths": { + "@abp/ng.identity": [ + "../modules/Volo.Abp.Identity/angular/projects/identity/src/public-api.ts" + ], + "@abp/ng.identity/config": [ + "../modules/Volo.Abp.Identity/angular/projects/identity/config/src/public-api.ts" + ], + "@abp/ng.identity/proxy": [ + "../modules/Volo.Abp.Identity/angular/projects/identity/proxy/src/public-api.ts" + ] + } + } + } + ``` + + This simply references to this package physically https://github.com/abpframework/abp/tree/dev/npm/ng-packs/packages/identity + +- This library is also using these dependencies + + ```json + // npm/ng-packs/packages/identity/package.json + { + "name": "@abp/ng.identity", + "version": "10.0.0-rc.1", + "homepage": "https://abp.io", + "repository": { + "type": "git", + "url": "https://github.com/abpframework/abp.git" + }, + "dependencies": { + "@abp/ng.components": "~10.0.0-rc.1", + "@abp/ng.permission-management": "~10.0.0-rc.1", + "@abp/ng.theme.shared": "~10.0.0-rc.1", + "tslib": "^2.0.0" + }, + "publishConfig": { + "access": "public" + } + } + ``` + + As these libraries also have their own dependencies, the identity package needs to consume them in itself. Before the [application builder migration](https://angular.dev/tools/cli/build-system-migration), you could register the path configuration like this + + ```json + // angular/tsconfig.json + { + "compileOnSave": false, + "compilerOptions": { + "paths": { + "@angular/*": ["node_modules/@angular/*"], + "@abp/*": ["node_modules/@abp/*"], + "@swimlane/*": ["node_modules/@swimlane/*"], + "@ngx-validate/core": ["node_modules/@ngx-validate/core"], + "@ng-bootstrap/ng-bootstrap": [ + "node_modules/@ng-bootstrap/ng-bootstrap" + ], + "@abp/ng.identity": [ + "../modules/Volo.Abp.Identity/angular/projects/identity/src/public-api.ts" + ], + "@abp/ng.identity/config": [ + "../modules/Volo.Abp.Identity/angular/projects/identity/config/src/public-api.ts" + ], + "@abp/ng.identity/proxy": [ + "../modules/Volo.Abp.Identity/angular/projects/identity/proxy/src/public-api.ts" + ] + } + } + } + ``` + + However, the latest builder forces more strict rules. So, it does not resolve the paths that reference to the `node_modules` causing a common DI error as mentioned here: + + - https://github.com/angular/angular-cli/issues/31395 + - https://github.com/angular/angular-cli/issues/26901 + - https://github.com/angular/angular-cli/issues/27176 + +In this case, we recommend using a symlink script. You can reach them through this example application: [🔗 Angular Sample Path Reference](https://github.com/sumeyyeKurtulus/AbpPathReferenceExamples) + +These scripts help you share dependencies from the main Angular app to local library projects via symlinks: + +- `symlink-config.ps1` centralizes which library directories to touch (e.g., ../../modules/Volo.Abp.Identity/angular/projects/identity) and which packages to link (e.g., @angular, @abp, rxjs) +- `setup-symlinks.ps1` reads that config and, for each library, creates a `node_modules` folder if needed and symlinks only the listed packages from the `node_modules` of the app to avoid duplicate installs +- `remove-symlinks.ps1` cleans up by deleting those library `node_modules` directories so they can use their own local deps again +- In `angular/package.json`, the `symlinks:setup` and `symlinks:remove` npm scripts simply run those two PowerShell scripts so you can execute them conveniently with your package manager. + +--- + +### Best Practices and Recommendations + +As we have explained each way of path mapping, this part of the article aims to summarize the best practices. Here are the points you need to consider: + +- Prefer **workspace references** for large projects and mono-repos. +- Use **TypeScript path aliases** only for local development convenience. +- Strictly avoid referencing `node_modules` directly; let the Angular builder manage package resolution. +- Maintain **consistent library structures** with clear `package.json` exports for reusable libraries. +- Automate **symlink creation/removal** if needed to reduce manual errors. + +Here is the list of common pitfalls and how you could troubleshoot them: + +- **DI errors after path configurations for typescript config**: Ensure that only one copy of each library is resolved. Avoid duplicate modules by checking `node_modules` and symlinks. +- **IDE not recognizing aliases**: Confirm that `tsconfig.json` or `tsconfig.base.json` includes the correct `paths` configuration and that your IDE is using the correct tsconfig. +- **Build errors with old paths**: Migrate paths pointing to `node_modules` to either workspace references or local library paths. +- **Symlink issues in CI/CD**: Use automated scripts to create/remove symlinks consistently; do not rely on manual linking. +- **Module resolution conflicts**: Check library dependencies for mismatched versions and align them using a package manager workspace strategy. + +As Angular’s build system continues to mature, developers are encouraged to move away from outdated path configurations and manual symlink setups. By embracing workspace references, consistent library exports, and TypeScript path mapping, teams can build scalable, maintainable applications without wrestling with complex import paths or dependency conflicts. With the right configuration, local development becomes faster, cleaner, and far more reliable. diff --git a/docs/en/Community-Articles/2025-10-17-Top-10-Exception-Handling-Mistakes-in-DotNET/post.md b/docs/en/Community-Articles/2025-10-17-Top-10-Exception-Handling-Mistakes-in-DotNET/post.md new file mode 100644 index 0000000000..3360fd0e20 --- /dev/null +++ b/docs/en/Community-Articles/2025-10-17-Top-10-Exception-Handling-Mistakes-in-DotNET/post.md @@ -0,0 +1,356 @@ +# 💥 Top 10 Exception Handling Mistakes in .NET (and How to Actually Fix Them) + +Every .NET developer has been there it's 3 AM, production just went down, and the logs are flooding in. +You open the error trace, only to find… nothing useful. The stack trace starts halfway through a catch block, or worse it's empty. Somewhere, an innocent-looking `throw ex;` or a swallowed background exception has just cost hours of sleep. + +Exception handling is one of those things that seems simple on the surface but can quietly undermine an entire system if done wrong. Tiny mistakes like catching `Exception`, forgetting an `await`, or rethrowing incorrectly don't just break code; they break observability. They hide root causes, produce misleading logs, and make even well-architected applications feel unpredictable. + +In this article, we'll go through the most common exception handling mistakes developers make in .NET and more importantly, how to fix them. Along the way, you'll see how small choices in your code can mean the difference between a five-minute fix and a full-blown production nightmare. + +---------- + +## 🧨 1. Catching `Exception` (and Everything Else) + +**The mistake:** + +```csharp +try +{ + // Some operation +} +catch (Exception ex) +{ + // Just to be safe +} + +``` + +**Why it's a problem:** +Catching the base `Exception` type hides all context including `OutOfMemoryException`, `StackOverflowException`, and other runtime-level issues that you should never handle manually. It also makes debugging painful since you lose the ability to treat specific failures differently. + +**The right way:** +Catch only what you can handle: + +```csharp +catch (SqlException ex) +{ + // Handle DB issues +} +catch (IOException ex) +{ + // Handle file issues +} + +``` + +If you really must catch all exceptions (e.g., at a system boundary), **log and rethrow**: + +```csharp +catch (Exception ex) +{ + _logger.LogError(ex, "Unexpected error occurred"); + throw; +} + +``` + +> 💡 **ABP Tip:** In ABP-based applications, you rarely need to catch every exception at the controller or service level. +> The framework's built-in `AbpExceptionFilter` already handles unexpected exceptions, logs them, and returns standardized JSON responses automatically keeping your controllers clean and consistent. + +---------- + +## 🕳️ 2. Swallowing Exceptions Silently + +**The mistake:** + +```csharp +try +{ + DoSomething(); +} +catch +{ + // ignore +} + +``` + +**Why it's a problem:** +Silent failures make debugging nearly impossible. You lose stack traces, error context, and sometimes even awareness that something failed at all. + +**The right way:** +Always log or rethrow, unless you have a very specific reason not to: + +```csharp +try +{ + _cache.Remove(key); +} +catch (Exception ex) +{ + _logger.LogWarning(ex, "Failed to clear cache key {Key}", key); +} + +``` + +> 💡 **ABP Tip:** Since ABP automatically logs all unhandled exceptions, it's often better to let the framework handle them. Only catch exceptions when you want to enrich logs or add custom business logic before rethrowing. + +---------- + +## 🌀 3. Using `throw ex;` Instead of `throw;` + +**The mistake:** + +```csharp +catch (Exception ex) +{ + Log(ex); + throw ex; +} + +``` + +**Why it's a problem:** +Using `throw ex;` resets the stack trace you lose where the exception actually occurred. This is one of the biggest causes of misleading production logs. + +**The right way:** + +```csharp +catch (Exception ex) +{ + Log(ex); + throw; // preserves stack trace +} + +``` + +---------- + +## ⚙️ 4. Wrapping Everything in Try/Catch + +**The mistake:** +Developers sometimes wrap _every function_ in try/catch “just to be safe.” + +**Why it's a problem:** +This clutters your code and hides the real source of problems. Exception handling should happen at **system boundaries**, not in every method. + +**The right way:** +Handle exceptions at higher levels (e.g., middleware, controllers, background jobs). Let lower layers throw naturally. + +> 💡 **ABP Tip:** The ABP Framework provides a top-level exception pipeline via filters and middleware. You can focus purely on your business logic ABP automatically translates unhandled exceptions into standardized API responses. + +---------- + +## 📉 5. Using Exceptions for Control Flow + +**The mistake:** + +```csharp +try +{ + var user = GetUserById(id); +} +catch (UserNotFoundException) +{ + user = CreateNewUser(); +} + +``` + +**Why it's a problem:** +Exceptions are expensive and should represent _unexpected_ states, not normal control flow. + +**The right way:** + +```csharp +var user = GetUserByIdOrDefault(id) ?? CreateNewUser(); + +``` + +---------- + +## 🪓 6. Forgetting to Await Async Calls + +**The mistake:** + +```csharp +try +{ + DoSomethingAsync(); // missing await! +} +catch (Exception ex) +{ + ... +} + +``` + +**Why it's a problem:** +Without `await`, the exception happens on another thread, outside your `try/catch`. It never gets caught. + +**The right way:** + +```csharp +try +{ + await DoSomethingAsync(); +} +catch (Exception ex) +{ + _logger.LogError(ex, "Error during async operation"); +} + +``` + +---------- + +## 🧵 7. Ignoring Background Task Exceptions + +**The mistake:** + +```csharp +Task.Run(() => SomeWork()); + +``` + +**Why it's a problem:** +Unobserved task exceptions can crash your process or vanish silently, depending on configuration. + +**The right way:** + +```csharp +_ = Task.Run(async () => +{ + try + { + await SomeWork(); + } + catch (Exception ex) + { + _logger.LogError(ex, "Background task failed"); + } +}); + +``` + +---------- + +## 📦 8. Throwing Generic Exceptions + +**The mistake:** + +```csharp +throw new Exception("Something went wrong"); + +``` + +**Why it's a problem:** +Generic exceptions carry no semantic meaning. You can't catch or interpret them specifically later. + +**The right way:** +Use more descriptive types: + +```csharp +throw new InvalidOperationException("Order is already processed"); + +``` + +> 💡 **ABP Tip:** In ABP applications, you can throw a `BusinessException` or `UserFriendlyException` instead. +> These support structured data, error codes, localization, and automatic HTTP status mapping: +> +> ```csharp +> throw new BusinessException("App:010046") +> .WithData("UserName", "john"); +> +> ``` +> +> This integrates with ABP's localization system, letting your error messages be translated automatically based on the error code. + +---------- + +## 🪞 9. Losing Inner Exceptions + +**The mistake:** + +```csharp +catch (Exception ex) +{ + throw new CustomException("Failed to process order"); +} + +``` + +**Why it's a problem:** +You lose the inner exception and its stack trace the real reason behind the failure. + +**The right way:** + +```csharp +catch (Exception ex) +{ + throw new CustomException("Failed to process order", ex); +} + +``` + +> 💡 **ABP Tip:** ABP automatically preserves and logs inner exceptions (for example, inside `BusinessException` chains). You don't need to add boilerplate to capture nested errors just throw them properly. + +---------- + +## 🧭 10. Missing Global Exception Handling + +**The mistake:** +Catching exceptions manually in every controller. + +**Why it's a problem:** +It creates duplicated logic, inconsistent responses, and gaps in logging. + +**The right way:** +Use middleware or a global exception filter: + +```csharp +app.UseExceptionHandler("/error"); + +``` + +> 💡 **ABP Tip:** ABP already includes a complete global exception system that: +> +> - Logs exceptions automatically +> +> - Returns a standard `RemoteServiceErrorResponse` JSON object +> +> - Maps exceptions to correct HTTP status codes (e.g., 403 for business rules, 404 for entity not found, 400 for validation) +> +> - Allows customization through `AbpExceptionHttpStatusCodeOptions` +> You can even implement an `ExceptionSubscriber` to react to certain exceptions (e.g., send notifications or trigger audits). +> + +---------- + +## 🧩 Bonus: Validation Is Not an Exception + +**The mistake:** +Throwing exceptions for predictable user input errors. + +**The right way:** +Use proper validation instead: + +```csharp +[Required] +public string UserName { get; set; } + +``` + +> 💡 **ABP Tip:** ABP automatically throws an `AbpValidationException` when DTO validation fails. +> You don't need to handle this manually ABP formats it into a structured JSON response with `validationErrors`. + +---------- + +## 🧠 Final Thoughts + +Exception handling isn't just about preventing crashes it's about making your failures **observable, meaningful, and recoverable**. +When done right, your logs tell a story: _what happened, where, and why_. +When done wrong, you're left staring at a 3 AM mystery. + +By avoiding these common pitfalls and taking advantage of frameworks like ABP that handle the heavy lifting you'll spend less time chasing ghosts and more time building stable, predictable systems. + diff --git a/docs/en/cli/new-command-samples.md b/docs/en/cli/new-command-samples.md index 5aa65f4d18..2841f12575 100644 --- a/docs/en/cli/new-command-samples.md +++ b/docs/en/cli/new-command-samples.md @@ -164,7 +164,7 @@ It's a template of a basic .NET console application with ABP module architecture * This project consists of the following files: `Acme.BookStore.csproj`, `appsettings.json`, `BookStoreHostedService.cs`, `BookStoreModule.cs`, `HelloWorldService.cs` and `Program.cs`. ```bash - abp new Acme.BookStore -t console -csf + abp new Acme.BookStore -t console -csf --old ``` ## Module diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json index 6b53375d61..a18406dd44 100644 --- a/docs/en/docs-nav.json +++ b/docs/en/docs-nav.json @@ -571,6 +571,10 @@ { "text": "Quartz Integration", "path": "framework/infrastructure/background-jobs/quartz.md" + }, + { + "text": "TickerQ Integration", + "path": "framework/infrastructure/background-jobs/tickerq.md" } ] }, @@ -589,6 +593,10 @@ { "text": "Hangfire Integration", "path": "framework/infrastructure/background-workers/hangfire.md" + }, + { + "text": "TickerQ Integration", + "path": "framework/infrastructure/background-workers/tickerq.md" } ] }, diff --git a/docs/en/framework/infrastructure/background-jobs/index.md b/docs/en/framework/infrastructure/background-jobs/index.md index af0c33de21..3b5628d39f 100644 --- a/docs/en/framework/infrastructure/background-jobs/index.md +++ b/docs/en/framework/infrastructure/background-jobs/index.md @@ -348,6 +348,7 @@ See pre-built job manager alternatives: * [Hangfire Background Job Manager](./hangfire.md) * [RabbitMQ Background Job Manager](./rabbitmq.md) * [Quartz Background Job Manager](./quartz.md) +* [TickerQ Background Job Manager](./tickerq.md) ## See Also * [Background Workers](../background-workers) \ No newline at end of file diff --git a/docs/en/framework/infrastructure/background-jobs/tickerq.md b/docs/en/framework/infrastructure/background-jobs/tickerq.md new file mode 100644 index 0000000000..013a8fde74 --- /dev/null +++ b/docs/en/framework/infrastructure/background-jobs/tickerq.md @@ -0,0 +1,125 @@ +# TickerQ Background Job Manager + +[TickerQ](https://tickerq.net/) is a fast, reflection-free background task scheduler for .NET — built with source generators, EF Core integration, cron + time-based execution, and a real-time dashboard. You can integrate TickerQ with the ABP to use it instead of the [default background job manager](../background-jobs). In this way, you can use the same background job API for TickerQ and your code will be independent of TickerQ. If you like, you can directly use TickerQ's API, too. + +> See the [background jobs document](../background-jobs) to learn how to use the background job system. This document only shows how to install and configure the TickerQ integration. + +## Installation + +It is suggested to use the [ABP CLI](../../../cli) to install this package. + +### Using the ABP CLI + +Open a command line window in the folder of the project (.csproj file) and type the following command: + +````bash +abp add-package Volo.Abp.BackgroundJobs.TickerQ +```` + +> If you haven't done it yet, you first need to install the [ABP CLI](../../../cli). For other installation options, see [the package description page](https://abp.io/package-detail/Volo.Abp.BackgroundJobs.TickerQ). + +## Configuration + +### AddTickerQ + +You can call the `AddTickerQ` extension method in the `ConfigureServices` method of your module to configure TickerQ services: + +> This is optional. ABP will automatically register TickerQ services. + +```csharp +public override void ConfigureServices(ServiceConfigurationContext context) +{ + context.Services.AddTickerQ(x => + { + // Configure TickerQ options here + }); +} +``` + +### UseAbpTickerQ + +You need to call the `UseAbpTickerQ` extension method instead of `AddTickerQ` in the `OnApplicationInitialization` method of your module: + +```csharp +// (default: TickerQStartMode.Immediate) +app.UseAbpTickerQ(startMode: ...); +``` + +### AbpBackgroundJobsTickerQOptions + +You can configure the `TimeTicker` properties for specific jobs. For example, you can change `Priority`, `Retries` and `RetryIntervals` properties as shown below: + +```csharp +Configure(options => +{ + options.AddJobConfiguration(new AbpBackgroundJobsTimeTickerConfiguration() + { + Retries = 3, + RetryIntervals = new[] {30, 60, 120}, // Retry after 30s, 60s, then 2min + Priority = TickerTaskPriority.High + + // Optional batching + //BatchParent = Guid.Parse("...."), + //BatchRunCondition = BatchRunCondition.OnSuccess + }); + + options.AddJobConfiguration(new AbpBackgroundJobsTimeTickerConfiguration() + { + Retries = 5, + RetryIntervals = new[] {30, 60, 120}, // Retry after 30s, 60s, then 2min + Priority = TickerTaskPriority.Normal + }); +}); +``` + +### Add your own TickerQ Background Jobs Definitions + +ABP will handle the TickerQ job definitions by `AbpTickerQFunctionProvider` service. You shouldn't use `TickerFunction` to add your own job definitions. You can inject and use the `AbpTickerQFunctionProvider` to add your own definitions and use `ITimeTickerManager` or `ICronTickerManager` to manage the jobs. + +For example, you can add a `CleanupJobs` job definition in the `OnPreApplicationInitializationAsync` method of your module: + +```csharp +public class CleanupJobs +{ + public async Task CleanupLogsAsync(TickerFunctionContext tickerContext, CancellationToken cancellationToken) + { + var logFileName = tickerContext.Request; + Console.WriteLine($"Cleaning up log file: {logFileName} at {DateTime.Now}"); + } +} +``` + +```csharp +public override Task OnPreApplicationInitializationAsync(ApplicationInitializationContext context) +{ + var abpTickerQFunctionProvider = context.ServiceProvider.GetRequiredService(); + abpTickerQFunctionProvider.Functions.TryAdd(nameof(CleanupJobs), (string.Empty, TickerTaskPriority.Normal, new TickerFunctionDelegate(async (cancellationToken, serviceProvider, tickerFunctionContext) => + { + var service = new CleanupJobs(); // Or get it from the serviceProvider + var request = await TickerRequestProvider.GetRequestAsync(serviceProvider, tickerFunctionContext.Id, tickerFunctionContext.Type); + var genericContext = new TickerFunctionContext(tickerFunctionContext, request); + await service.CleanupLogsAsync(genericContext, cancellationToken); + }))); + abpTickerQFunctionProvider.RequestTypes.TryAdd(nameof(CleanupJobs), (typeof(string).FullName, typeof(string))); + return Task.CompletedTask; +} +``` + +And then you can add a job by using the `ITimeTickerManager`: + +```csharp +var timeTickerManager = context.ServiceProvider.GetRequiredService>(); +await timeTickerManager.AddAsync(new TimeTicker +{ + Function = nameof(CleanupJobs), + ExecutionTime = DateTime.UtcNow.AddSeconds(5), + Request = TickerHelper.CreateTickerRequest("cleanup_example_file.txt"), + Retries = 3, + RetryIntervals = new[] { 30, 60, 120 }, // Retry after 30s, 60s, then 2min +}); +``` + +### TickerQ Dashboard and EF Core Integration + +You can install the [TickerQ dashboard](https://tickerq.net/setup/dashboard.html) and [Entity Framework Core](https://tickerq.net/setup/tickerq-ef-core.html) integration by its documentation. There is no specific configuration needed for the ABP integration. + diff --git a/docs/en/framework/infrastructure/background-workers/index.md b/docs/en/framework/infrastructure/background-workers/index.md index 6ab88a9e53..498a52ed9b 100644 --- a/docs/en/framework/infrastructure/background-workers/index.md +++ b/docs/en/framework/infrastructure/background-workers/index.md @@ -41,7 +41,7 @@ Start your worker in the `StartAsync` (which is called when the application begi Assume that we want to make a user passive, if the user has not logged in to the application in last 30 days. `AsyncPeriodicBackgroundWorkerBase` class simplifies to create periodic workers, so we will use it for the example below: -> You can use `CronExpression` property to set the cron expression for the background worker if you will use the [Hangfire Background Worker Manager](./hangfire.md) or [Quartz Background Worker Manager](./quartz.md). +> You can use `CronExpression` property to set the cron expression for the background worker if you will use the [Hangfire Background Worker Manager](./hangfire.md), [Quartz Background Worker Manager](./quartz.md), or [TickerQ Background Worker Manager](./tickerq.md). ````csharp public class PassiveUserCheckerWorker : AsyncPeriodicBackgroundWorkerBase @@ -216,7 +216,8 @@ Background worker system is extensible and you can change the default background See pre-built worker manager alternatives: * [Quartz Background Worker Manager](./quartz.md) -* [Hangfire Background Worker Manager](./hangfire.md) +* [Hangfire Background Worker Manager](./hangfire.md) +* [TickerQ Background Worker Manager](./tickerq.md) ## See Also diff --git a/docs/en/framework/infrastructure/background-workers/tickerq.md b/docs/en/framework/infrastructure/background-workers/tickerq.md new file mode 100644 index 0000000000..840b5137cb --- /dev/null +++ b/docs/en/framework/infrastructure/background-workers/tickerq.md @@ -0,0 +1,119 @@ +# TickerQ Background Worker Manager + +[TickerQ](https://tickerq.net/) is a fast, reflection-free background task scheduler for .NET — built with source generators, EF Core integration, cron + time-based execution, and a real-time dashboard. You can integrate TickerQ with the ABP to use it instead of the [default background worker manager](../background-workers). + +## Installation + +It is suggested to use the [ABP CLI](../../../cli) to install this package. + +### Using the ABP CLI + +Open a command line window in the folder of the project (.csproj file) and type the following command: + +````bash +abp add-package Volo.Abp.BackgroundWorkers.TickerQ +```` + +> If you haven't done it yet, you first need to install the [ABP CLI](../../../cli). For other installation options, see [the package description page](https://abp.io/package-detail/Volo.Abp.BackgroundWorkers.TickerQ). + +## Configuration + +### AddTickerQ + +You can call the `AddTickerQ` extension method in the `ConfigureServices` method of your module to configure TickerQ services: + +> This is optional. ABP will automatically register TickerQ services. + +```csharp +public override void ConfigureServices(ServiceConfigurationContext context) +{ + context.Services.AddTickerQ(x => + { + // Configure TickerQ options here + }); +} +``` + +### UseAbpTickerQ + +You need to call the `UseAbpTickerQ` extension method instead of `AddTickerQ` in the `OnApplicationInitialization` method of your module: + +```csharp +// (default: TickerQStartMode.Immediate) +app.UseAbpTickerQ(startMode: ...); +``` + +### AbpBackgroundWorkersTickerQOptions + +You can configure the `CronTicker` properties for specific jobs. For example, Change `Priority`, `Retries` and `RetryIntervals` properties: + +```csharp +Configure(options => +{ + options.AddConfiguration(new AbpBackgroundWorkersCronTickerConfiguration() + { + Retries = 3, + RetryIntervals = new[] {30, 60, 120}, // Retry after 30s, 60s, then 2min, + Priority = TickerTaskPriority.High + }); +}); +``` + +### Add your own TickerQ Background Worker Definitions + +ABP will handle the TickerQ job definitions by `AbpTickerQFunctionProvider` service. You shouldn't use `TickerFunction` to add your own job definitions. You can inject and use the `AbpTickerQFunctionProvider` to add your own definitions and use `ITimeTickerManager` or `ICronTickerManager` to manage the jobs. + +For example, you can add a `CleanupJobs` job definition in the `OnPreApplicationInitializationAsync` method of your module: + +```csharp +public class CleanupJobs +{ + public async Task CleanupLogsAsync(TickerFunctionContext tickerContext, CancellationToken cancellationToken) + { + var logFileName = tickerContext.Request; + Console.WriteLine($"Cleaning up log file: {logFileName} at {DateTime.Now}"); + } +} +``` + +```csharp +public override Task OnPreApplicationInitializationAsync(ApplicationInitializationContext context) +{ + var abpTickerQFunctionProvider = context.ServiceProvider.GetRequiredService(); + abpTickerQFunctionProvider.Functions.TryAdd(nameof(CleanupJobs), (string.Empty, TickerTaskPriority.Normal, new TickerFunctionDelegate(async (cancellationToken, serviceProvider, tickerFunctionContext) => + { + var service = new CleanupJobs(); // Or get it from the serviceProvider + var request = await TickerRequestProvider.GetRequestAsync(serviceProvider, tickerFunctionContext.Id, tickerFunctionContext.Type); + var genericContext = new TickerFunctionContext(tickerFunctionContext, request); + await service.CleanupLogsAsync(genericContext, cancellationToken); + }))); + abpTickerQFunctionProvider.RequestTypes.TryAdd(nameof(CleanupJobs), (typeof(string).FullName, typeof(string))); + return Task.CompletedTask; +} +``` + +And then you can add a job by using the `ICronTickerManager`: + +```csharp +var cronTickerManager = context.ServiceProvider.GetRequiredService>(); +await cronTickerManager.AddAsync(new CronTicker +{ + Function = nameof(CleanupJobs), + Expression = "0 */6 * * *", // Every 6 hours + Request = TickerHelper.CreateTickerRequest("cleanup_example_file.txt"), + Retries = 2, + RetryIntervals = new[] { 60, 300 } +}); +``` + +You can specify a cron expression instead of use `ICronTickerManager` to add a worker: + +```csharp +abpTickerQFunctionProvider.Functions.TryAdd(nameof(CleanupJobs), (string.Empty, TickerTaskPriority.Normal, new TickerFunctionDelegate(async (cancellationToken, serviceProvider, tickerFunctionContext) => +{ + var service = new CleanupJobs(); + var request = await TickerRequestProvider.GetRequestAsync(serviceProvider, tickerFunctionContext.Id, tickerFunctionContext.Type); + var genericContext = new TickerFunctionContext(tickerFunctionContext, request); + await service.CleanupLogsAsync(genericContext, cancellationToken); +}))); +``` diff --git a/docs/en/framework/infrastructure/blob-storing/minio.md b/docs/en/framework/infrastructure/blob-storing/minio.md index 771b699278..39ef2f959c 100644 --- a/docs/en/framework/infrastructure/blob-storing/minio.md +++ b/docs/en/framework/infrastructure/blob-storing/minio.md @@ -31,6 +31,7 @@ Configure(options => minio.AccessKey = "your minio accessKey"; minio.SecretKey = "your minio secretKey"; minio.BucketName = "your minio bucketName"; + minio.PresignedGetExpirySeconds = 3600; }); }); }); @@ -53,6 +54,7 @@ Configure(options => * Buckets used with Amazon S3 Transfer Acceleration can't have dots (.) in their names. For more information about transfer acceleration, see Amazon S3 Transfer Acceleration. * **WithSSL** (bool): Default value is `false`,Chain to MinIO Client object to use https instead of http. * **CreateContainerIfNotExists** (bool): Default value is `false`, If a bucket does not exist in minio, `MinioBlobProvider` will try to create it. +* **PresignedGetExpirySeconds** (int): Default value is `7 * 24 * 3600`, The expiration time of the pre-specified get url. The is valid within the range of 1 to 604800(corresponding to 7 days). ## Minio Blob Name Calculator diff --git a/docs/en/framework/ui/react-native/setting-up-android-emulator.md b/docs/en/framework/ui/react-native/setting-up-android-emulator.md index 8ead542a76..1a35a2ecbb 100644 --- a/docs/en/framework/ui/react-native/setting-up-android-emulator.md +++ b/docs/en/framework/ui/react-native/setting-up-android-emulator.md @@ -111,6 +111,34 @@ adb install myApp.apk --- +## How to Enable Fast Refresh in React Native + +React Native uses a hot reload system called **Fast Refresh**. +It is enabled by default in development mode, but you can manually enable or disable it via the Developer Menu. + +### To open the Developer Menu on Android emulator: + +```bash +adb shell input keyevent 82 +``` + +This command simulates the hardware menu button and opens the Developer Menu inside the emulator. + +### From the Developer Menu: + +- Look for the option: **Enable Fast Refresh** +- If it's unchecked, tap to enable it +- If it's already checked, Fast Refresh is already active + +### Alternative (if adb doesn't work): + +Focus the emulator window and press: + +- **Ctrl + M** (Windows/Linux) +- **Cmd + M** (Mac) + +--- + ## Troubleshooting | Problem | Explanation | diff --git a/framework/Volo.Abp.slnx b/framework/Volo.Abp.slnx index 1289991520..5e53bec002 100644 --- a/framework/Volo.Abp.slnx +++ b/framework/Volo.Abp.slnx @@ -166,6 +166,11 @@ + + + + + @@ -253,4 +258,4 @@ - + \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundJobs.TickerQ/FodyWeavers.xml b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/FodyWeavers.xml new file mode 100644 index 0000000000..1715698ccd --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundJobs.TickerQ/FodyWeavers.xsd b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/FodyWeavers.xsd new file mode 100644 index 0000000000..ffa6fc4b78 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo.Abp.BackgroundJobs.TickerQ.csproj b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo.Abp.BackgroundJobs.TickerQ.csproj new file mode 100644 index 0000000000..df450f5ff6 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo.Abp.BackgroundJobs.TickerQ.csproj @@ -0,0 +1,24 @@ + + + + + + + netstandard2.1;net8.0;net9.0;net10.0 + enable + Nullable + Volo.Abp.BackgroundJobs.TickerQ + Volo.Abp.BackgroundJobs.TickerQ + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + false + false + false + + + + + + + + + diff --git a/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTickerQModule.cs b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTickerQModule.cs new file mode 100644 index 0000000000..b5ed598932 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTickerQModule.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Reflection; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using TickerQ.Utilities; +using TickerQ.Utilities.Enums; +using Volo.Abp.Modularity; +using Volo.Abp.TickerQ; + +namespace Volo.Abp.BackgroundJobs.TickerQ; + +[DependsOn( + typeof(AbpBackgroundJobsAbstractionsModule), + typeof(AbpTickerQModule) +)] +public class AbpBackgroundJobsTickerQModule : AbpModule +{ + private static readonly MethodInfo GetTickerFunctionDelegateMethod = + typeof(AbpBackgroundJobsTickerQModule).GetMethod(nameof(GetTickerFunctionDelegate), BindingFlags.NonPublic | BindingFlags.Static)!; + + public override void OnApplicationInitialization(ApplicationInitializationContext context) + { + var abpBackgroundJobOptions = context.ServiceProvider.GetRequiredService>(); + var abpBackgroundJobsTickerQOptions = context.ServiceProvider.GetRequiredService>(); + var tickerFunctionDelegates = new Dictionary(); + var requestTypes = new Dictionary(); + foreach (var jobConfiguration in abpBackgroundJobOptions.Value.GetJobs()) + { + var genericMethod = GetTickerFunctionDelegateMethod.MakeGenericMethod(jobConfiguration.ArgsType); + var tickerFunctionDelegate = (TickerFunctionDelegate)genericMethod.Invoke(null, [jobConfiguration.ArgsType])!; + var config = abpBackgroundJobsTickerQOptions.Value.GetConfigurationOrNull(jobConfiguration.JobType); + tickerFunctionDelegates.TryAdd(jobConfiguration.JobName, (string.Empty, config?.Priority ?? TickerTaskPriority.Normal, tickerFunctionDelegate)); + requestTypes.TryAdd(jobConfiguration.JobName, (jobConfiguration.ArgsType.FullName, jobConfiguration.ArgsType)!); + } + + var abpTickerQFunctionProvider = context.ServiceProvider.GetRequiredService(); + foreach (var functionDelegate in tickerFunctionDelegates) + { + abpTickerQFunctionProvider.Functions.TryAdd(functionDelegate.Key, functionDelegate.Value); + } + + foreach (var requestType in requestTypes) + { + abpTickerQFunctionProvider.RequestTypes.TryAdd(requestType.Key, requestType.Value); + } + } + + private static TickerFunctionDelegate GetTickerFunctionDelegate(Type argsType) + { + return async (cancellationToken, serviceProvider, context) => + { + var options = serviceProvider.GetRequiredService>().Value; + if (!options.IsJobExecutionEnabled) + { + throw new AbpException( + "Background job execution is disabled. " + + "This method should not be called! " + + "If you want to enable the background job execution, " + + $"set {nameof(AbpBackgroundJobOptions)}.{nameof(AbpBackgroundJobOptions.IsJobExecutionEnabled)} to true! " + + "If you've intentionally disabled job execution and this seems a bug, please report it." + ); + } + + using (var scope = serviceProvider.CreateScope()) + { + var jobExecuter = serviceProvider.GetRequiredService(); + var args = await TickerRequestProvider.GetRequestAsync(serviceProvider, context.Id, context.Type); + var jobType = options.GetJob(typeof(TArgs)).JobType; + var jobExecutionContext = new JobExecutionContext(scope.ServiceProvider, jobType, args!, cancellationToken: cancellationToken); + await jobExecuter.ExecuteAsync(jobExecutionContext); + } + }; + } +} diff --git a/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTickerQOptions.cs b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTickerQOptions.cs new file mode 100644 index 0000000000..f85b3e5fef --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTickerQOptions.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; + +namespace Volo.Abp.BackgroundJobs.TickerQ; + +public class AbpBackgroundJobsTickerQOptions +{ + private readonly Dictionary _configurations; + + public AbpBackgroundJobsTickerQOptions() + { + _configurations = new Dictionary(); + } + + public void AddConfiguration(AbpBackgroundJobsTimeTickerConfiguration configuration) + { + AddConfiguration(typeof(TJob), configuration); + } + + public void AddConfiguration(Type jobType, AbpBackgroundJobsTimeTickerConfiguration configuration) + { + _configurations[jobType] = configuration; + } + + public AbpBackgroundJobsTimeTickerConfiguration? GetConfigurationOrNull() + { + return GetConfigurationOrNull(typeof(TJob)); + } + + public AbpBackgroundJobsTimeTickerConfiguration? GetConfigurationOrNull(Type jobType) + { + return _configurations.GetValueOrDefault(jobType); + } +} diff --git a/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTimeTickerConfiguration.cs b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTimeTickerConfiguration.cs new file mode 100644 index 0000000000..65b150ea48 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpBackgroundJobsTimeTickerConfiguration.cs @@ -0,0 +1,17 @@ +using System; +using TickerQ.Utilities.Enums; + +namespace Volo.Abp.BackgroundJobs.TickerQ; + +public class AbpBackgroundJobsTimeTickerConfiguration +{ + public int? Retries { get; set; } + + public int[]? RetryIntervals { get; set; } + + public TickerTaskPriority? Priority { get; set; } + + public Guid? BatchParent { get; set; } + + public BatchRunCondition? BatchRunCondition { get; set; } +} diff --git a/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpTickerQBackgroundJobManager.cs b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpTickerQBackgroundJobManager.cs new file mode 100644 index 0000000000..b1a2dbe36d --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundJobs.TickerQ/Volo/Abp/BackgroundJobs/TickerQ/AbpTickerQBackgroundJobManager.cs @@ -0,0 +1,51 @@ +using System; +using System.Threading.Tasks; +using Microsoft.Extensions.Options; +using TickerQ.Utilities; +using TickerQ.Utilities.Interfaces.Managers; +using TickerQ.Utilities.Models.Ticker; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.BackgroundJobs.TickerQ; + +[Dependency(ReplaceServices = true)] +public class AbpTickerQBackgroundJobManager : IBackgroundJobManager, ITransientDependency +{ + protected ITimeTickerManager TimeTickerManager { get; } + protected AbpBackgroundJobOptions Options { get; } + protected AbpBackgroundJobsTickerQOptions TickerQOptions { get; } + + public AbpTickerQBackgroundJobManager( + ITimeTickerManager timeTickerManager, + IOptions options, + IOptions tickerQOptions) + { + TimeTickerManager = timeTickerManager; + Options = options.Value; + TickerQOptions = tickerQOptions.Value; + } + + public virtual async Task EnqueueAsync(TArgs args, BackgroundJobPriority priority = BackgroundJobPriority.Normal, TimeSpan? delay = null) + { + var job = Options.GetJob(typeof(TArgs)); + var timeTicker = new TimeTicker + { + Id = Guid.NewGuid(), + Function = job.JobName, + ExecutionTime = delay == null ? DateTime.UtcNow : DateTime.UtcNow.Add(delay.Value), + Request = TickerHelper.CreateTickerRequest(args), + }; + + var config = TickerQOptions.GetConfigurationOrNull(job.JobType); + if (config != null) + { + timeTicker.Retries = config.Retries ?? timeTicker.Retries; + timeTicker.RetryIntervals = config.RetryIntervals ?? timeTicker.RetryIntervals; + timeTicker.BatchParent = config.BatchParent ?? timeTicker.BatchParent; + timeTicker.BatchRunCondition = config.BatchRunCondition ?? timeTicker.BatchRunCondition; + } + + var result = await TimeTickerManager.AddAsync(timeTicker); + return !result.IsSucceded ? timeTicker.Id.ToString() : result.Result.Id.ToString(); + } +} diff --git a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/FodyWeavers.xml b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/FodyWeavers.xml new file mode 100644 index 0000000000..1715698ccd --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/FodyWeavers.xsd b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/FodyWeavers.xsd new file mode 100644 index 0000000000..ffa6fc4b78 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo.Abp.BackgroundWorkers.TickerQ.csproj b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo.Abp.BackgroundWorkers.TickerQ.csproj new file mode 100644 index 0000000000..2c4ab29c97 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo.Abp.BackgroundWorkers.TickerQ.csproj @@ -0,0 +1,24 @@ + + + + + + + netstandard2.1;net8.0;net9.0;net10.0 + enable + Nullable + Volo.Abp.BackgroundWorkers.TickerQ + Volo.Abp.BackgroundWorkers.TickerQ + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + false + false + false + + + + + + + + + diff --git a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpBackgroundWorkersCronTickerConfiguration.cs b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpBackgroundWorkersCronTickerConfiguration.cs new file mode 100644 index 0000000000..0e8ed89a14 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpBackgroundWorkersCronTickerConfiguration.cs @@ -0,0 +1,12 @@ +using TickerQ.Utilities.Enums; + +namespace Volo.Abp.BackgroundWorkers.TickerQ; + +public class AbpBackgroundWorkersCronTickerConfiguration +{ + public int? Retries { get; set; } + + public int[]? RetryIntervals { get; set; } + + public TickerTaskPriority? Priority { get; set; } +} diff --git a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpBackgroundWorkersTickerQModule.cs b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpBackgroundWorkersTickerQModule.cs new file mode 100644 index 0000000000..3fb15a50b8 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpBackgroundWorkersTickerQModule.cs @@ -0,0 +1,37 @@ +using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Options; +using TickerQ.Utilities.Interfaces.Managers; +using TickerQ.Utilities.Models.Ticker; +using Volo.Abp.Modularity; +using Volo.Abp.TickerQ; + +namespace Volo.Abp.BackgroundWorkers.TickerQ; + +[DependsOn(typeof(AbpBackgroundWorkersModule), typeof(AbpTickerQModule))] +public class AbpBackgroundWorkersTickerQModule : AbpModule +{ + public override async Task OnPostApplicationInitializationAsync(ApplicationInitializationContext context) + { + var abpTickerQBackgroundWorkersProvider = context.ServiceProvider.GetRequiredService(); + var cronTickerManager = context.ServiceProvider.GetRequiredService>(); + var abpBackgroundWorkersTickerQOptions = context.ServiceProvider.GetRequiredService>().Value; + foreach (var backgroundWorker in abpTickerQBackgroundWorkersProvider.BackgroundWorkers) + { + var cronTicker = new CronTicker + { + Function = backgroundWorker.Value.Function, + Expression = backgroundWorker.Value.CronExpression + }; + + var config = abpBackgroundWorkersTickerQOptions.GetConfigurationOrNull(backgroundWorker.Value.WorkerType); + if (config != null) + { + cronTicker.Retries = config.Retries ?? cronTicker.Retries; + cronTicker.RetryIntervals = config.RetryIntervals ?? cronTicker.RetryIntervals; + } + + await cronTickerManager.AddAsync(cronTicker); + } + } +} diff --git a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpBackgroundWorkersTickerQOptions.cs b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpBackgroundWorkersTickerQOptions.cs new file mode 100644 index 0000000000..6d48a21262 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpBackgroundWorkersTickerQOptions.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; + +namespace Volo.Abp.BackgroundWorkers.TickerQ; + +public class AbpBackgroundWorkersTickerQOptions +{ + private readonly Dictionary _onfigurations; + + public AbpBackgroundWorkersTickerQOptions() + { + _onfigurations = new Dictionary(); + } + + public void AddConfiguration(AbpBackgroundWorkersCronTickerConfiguration configuration) + { + AddConfiguration(typeof(TWorker), configuration); + } + + public void AddConfiguration(Type workerType, AbpBackgroundWorkersCronTickerConfiguration configuration) + { + _onfigurations[workerType] = configuration; + } + + public AbpBackgroundWorkersCronTickerConfiguration? GetConfigurationOrNull() + { + return GetConfigurationOrNull(typeof(TJob)); + } + + public AbpBackgroundWorkersCronTickerConfiguration? GetConfigurationOrNull(Type workerType) + { + return _onfigurations.GetValueOrDefault(workerType); + } +} diff --git a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQBackgroundWorkerManager.cs b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQBackgroundWorkerManager.cs new file mode 100644 index 0000000000..922cad294d --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQBackgroundWorkerManager.cs @@ -0,0 +1,105 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.Extensions.Options; +using TickerQ.Utilities.Enums; +using Volo.Abp.DependencyInjection; +using Volo.Abp.DynamicProxy; +using Volo.Abp.TickerQ; + +namespace Volo.Abp.BackgroundWorkers.TickerQ; + +[Dependency(ReplaceServices = true)] +public class AbpTickerQBackgroundWorkerManager : BackgroundWorkerManager, ISingletonDependency +{ + protected AbpTickerQFunctionProvider AbpTickerQFunctionProvider { get; } + protected AbpTickerQBackgroundWorkersProvider AbpTickerQBackgroundWorkersProvider { get; } + protected AbpBackgroundWorkersTickerQOptions Options { get; } + + public AbpTickerQBackgroundWorkerManager( + AbpTickerQFunctionProvider abpTickerQFunctionProvider, + AbpTickerQBackgroundWorkersProvider abpTickerQBackgroundWorkersProvider, + IOptions options) + { + AbpTickerQFunctionProvider = abpTickerQFunctionProvider; + AbpTickerQBackgroundWorkersProvider = abpTickerQBackgroundWorkersProvider; + Options = options.Value; + } + + public override async Task AddAsync(IBackgroundWorker worker, CancellationToken cancellationToken = default) + { + if (worker is AsyncPeriodicBackgroundWorkerBase or PeriodicBackgroundWorkerBase) + { + int? period = null; + string? cronExpression = null; + + if (worker is AsyncPeriodicBackgroundWorkerBase asyncPeriodicBackgroundWorkerBase) + { + period = asyncPeriodicBackgroundWorkerBase.Period; + cronExpression = asyncPeriodicBackgroundWorkerBase.CronExpression; + } + else if (worker is PeriodicBackgroundWorkerBase periodicBackgroundWorkerBase) + { + period = periodicBackgroundWorkerBase.Period; + cronExpression = periodicBackgroundWorkerBase.CronExpression; + } + + if (period == null && cronExpression.IsNullOrWhiteSpace()) + { + throw new AbpException($"Both 'Period' and 'CronExpression' are not set for {worker.GetType().FullName}. You must set at least one of them."); + } + + cronExpression = cronExpression ?? GetCron(period!.Value); + var name = BackgroundWorkerNameAttribute.GetNameOrNull(worker.GetType()) ?? worker.GetType().FullName; + + var config = Options.GetConfigurationOrNull(ProxyHelper.GetUnProxiedType(worker)); + AbpTickerQFunctionProvider.Functions.TryAdd(name!, (string.Empty, config?.Priority ?? TickerTaskPriority.LongRunning, async (tickerQCancellationToken, serviceProvider, tickerFunctionContext) => + { + var workerInvoker = new AbpTickerQPeriodicBackgroundWorkerInvoker(worker, serviceProvider); + await workerInvoker.DoWorkAsync(tickerFunctionContext, tickerQCancellationToken); + })); + + AbpTickerQBackgroundWorkersProvider.BackgroundWorkers.Add(name!, new AbpTickerQCronBackgroundWorker + { + Function = name!, + CronExpression = cronExpression, + WorkerType = ProxyHelper.GetUnProxiedType(worker) + }); + } + + await base.AddAsync(worker, cancellationToken); + } + + protected virtual string GetCron(int period) + { + var time = TimeSpan.FromMilliseconds(period); + if (time.TotalMinutes < 1) + { + // Less than 1 minute — 5-field cron doesn't support seconds, so run every minute + return "* * * * *"; + } + + if (time.TotalMinutes < 60) + { + // Run every N minutes + var minutes = (int)Math.Round(time.TotalMinutes); + return $"*/{minutes} * * * *"; + } + + if (time.TotalHours < 24) + { + // Run every N hours + var hours = (int)Math.Round(time.TotalHours); + return $"0 */{hours} * * *"; + } + + if (time.TotalDays <= 31) + { + // Run every N days + var days = (int)Math.Round(time.TotalDays); + return $"0 0 */{days} * *"; + } + + throw new AbpException($"Cannot convert period: {period} to cron expression."); + } +} diff --git a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQBackgroundWorkersProvider.cs b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQBackgroundWorkersProvider.cs new file mode 100644 index 0000000000..3c0fe763ec --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQBackgroundWorkersProvider.cs @@ -0,0 +1,14 @@ +using System.Collections.Generic; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.BackgroundWorkers.TickerQ; + +public class AbpTickerQBackgroundWorkersProvider : ISingletonDependency +{ + public Dictionary BackgroundWorkers { get;} + + public AbpTickerQBackgroundWorkersProvider() + { + BackgroundWorkers = new Dictionary(); + } +} diff --git a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQCronBackgroundWorker.cs b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQCronBackgroundWorker.cs new file mode 100644 index 0000000000..55c97a00a6 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQCronBackgroundWorker.cs @@ -0,0 +1,12 @@ +using System; + +namespace Volo.Abp.BackgroundWorkers.TickerQ; + +public class AbpTickerQCronBackgroundWorker +{ + public string Function { get; set; } = null!; + + public string CronExpression { get; set; } = null!; + + public Type WorkerType { get; set; } = null!; +} diff --git a/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQPeriodicBackgroundWorkerInvoker.cs b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQPeriodicBackgroundWorkerInvoker.cs new file mode 100644 index 0000000000..17cf7cdc87 --- /dev/null +++ b/framework/src/Volo.Abp.BackgroundWorkers.TickerQ/Volo/Abp/BackgroundWorkers/TickerQ/AbpTickerQPeriodicBackgroundWorkerInvoker.cs @@ -0,0 +1,73 @@ +using System; +using System.Linq.Expressions; +using System.Reflection; +using System.Threading; +using System.Threading.Tasks; +using TickerQ.Utilities.Models; + +namespace Volo.Abp.BackgroundWorkers.TickerQ; + +public class AbpTickerQPeriodicBackgroundWorkerInvoker +{ + private readonly Func? _doWorkAsyncDelegate; + private readonly Action? _doWorkDelegate; + + protected IBackgroundWorker Worker { get; } + protected IServiceProvider ServiceProvider { get; } + + public AbpTickerQPeriodicBackgroundWorkerInvoker(IBackgroundWorker worker, IServiceProvider serviceProvider) + { + Worker = worker; + ServiceProvider = serviceProvider; + + switch (worker) + { + case AsyncPeriodicBackgroundWorkerBase: + { + var workerType = worker.GetType(); + var method = workerType.GetMethod("DoWorkAsync", BindingFlags.Instance | BindingFlags.NonPublic); + if (method == null) + { + throw new AbpException($"Could not find 'DoWorkAsync' method on type '{workerType.FullName}'."); + } + + var instanceParam = Expression.Parameter(typeof(AsyncPeriodicBackgroundWorkerBase), "worker"); + var contextParam = Expression.Parameter(typeof(PeriodicBackgroundWorkerContext), "context"); + var call = Expression.Call(Expression.Convert(instanceParam, workerType), method, contextParam); + var lambda = Expression.Lambda>(call, instanceParam, contextParam); + _doWorkAsyncDelegate = lambda.Compile(); + break; + } + case PeriodicBackgroundWorkerBase: + { + var workerType = worker.GetType(); + var method = workerType.GetMethod("DoWork", BindingFlags.Instance | BindingFlags.NonPublic); + if (method == null) + { + throw new AbpException($"Could not find 'DoWork' method on type '{workerType.FullName}'."); + } + + var instanceParam = Expression.Parameter(typeof(PeriodicBackgroundWorkerBase), "worker"); + var contextParam = Expression.Parameter(typeof(PeriodicBackgroundWorkerContext), "context"); + var call = Expression.Call(Expression.Convert(instanceParam, workerType), method, contextParam); + var lambda = Expression.Lambda>(call, instanceParam, contextParam); + _doWorkDelegate = lambda.Compile(); + break; + } + } + } + + public virtual async Task DoWorkAsync(TickerFunctionContext context, CancellationToken cancellationToken = default) + { + var workerContext = new PeriodicBackgroundWorkerContext(ServiceProvider); + switch (Worker) + { + case AsyncPeriodicBackgroundWorkerBase asyncPeriodicBackgroundWorker: + await _doWorkAsyncDelegate!(asyncPeriodicBackgroundWorker, workerContext); + break; + case PeriodicBackgroundWorkerBase periodicBackgroundWorker: + _doWorkDelegate!(periodicBackgroundWorker, workerContext); + break; + } + } +} diff --git a/framework/src/Volo.Abp.BlobStoring.Minio/Microsoft/Extensions/DependencyInjection/MinioHttpClientFactoryServiceCollectionExtensions.cs b/framework/src/Volo.Abp.BlobStoring.Minio/Microsoft/Extensions/DependencyInjection/MinioHttpClientFactoryServiceCollectionExtensions.cs new file mode 100644 index 0000000000..8838a1a7f1 --- /dev/null +++ b/framework/src/Volo.Abp.BlobStoring.Minio/Microsoft/Extensions/DependencyInjection/MinioHttpClientFactoryServiceCollectionExtensions.cs @@ -0,0 +1,18 @@ +using System.Net.Http; + +namespace Microsoft.Extensions.DependencyInjection; +internal static class MinioHttpClientFactoryServiceCollectionExtensions +{ + private const string HttpClientName = "__MinioApiClient"; + public static IServiceCollection AddMinioHttpClient(this IServiceCollection services) + { + services.AddHttpClient(HttpClientName); + + return services; + } + + public static HttpClient CreateMinioHttpClient(this IHttpClientFactory httpClientFactory) + { + return httpClientFactory.CreateClient(HttpClientName); + } +} diff --git a/framework/src/Volo.Abp.BlobStoring.Minio/Volo.Abp.BlobStoring.Minio.csproj b/framework/src/Volo.Abp.BlobStoring.Minio/Volo.Abp.BlobStoring.Minio.csproj index 0b5f33e146..98d3481999 100644 --- a/framework/src/Volo.Abp.BlobStoring.Minio/Volo.Abp.BlobStoring.Minio.csproj +++ b/framework/src/Volo.Abp.BlobStoring.Minio/Volo.Abp.BlobStoring.Minio.csproj @@ -18,6 +18,7 @@ + diff --git a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/AbpBlobStoringMinioModule.cs b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/AbpBlobStoringMinioModule.cs index 31d023ecf2..b1746a0e34 100644 --- a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/AbpBlobStoringMinioModule.cs +++ b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/AbpBlobStoringMinioModule.cs @@ -1,9 +1,13 @@ -using Volo.Abp.Modularity; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.Modularity; namespace Volo.Abp.BlobStoring.Minio; [DependsOn(typeof(AbpBlobStoringModule))] public class AbpBlobStoringMinioModule : AbpModule { - + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddMinioHttpClient(); + } } diff --git a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs index 5fa1ceb0ce..82490c177a 100644 --- a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs +++ b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProvider.cs @@ -1,22 +1,27 @@ -using Minio; -using Minio.Exceptions; -using System; +using System; using System.IO; +using System.Net.Http; using System.Threading.Tasks; +using Microsoft.Extensions.DependencyInjection; +using Minio; using Minio.DataModel.Args; +using Minio.Exceptions; using Volo.Abp.DependencyInjection; namespace Volo.Abp.BlobStoring.Minio; public class MinioBlobProvider : BlobProviderBase, ITransientDependency { + protected IHttpClientFactory HttpClientFactory { get; } protected IMinioBlobNameCalculator MinioBlobNameCalculator { get; } protected IBlobNormalizeNamingService BlobNormalizeNamingService { get; } public MinioBlobProvider( + IHttpClientFactory httpClientFactory, IMinioBlobNameCalculator minioBlobNameCalculator, IBlobNormalizeNamingService blobNormalizeNamingService) { + HttpClientFactory = httpClientFactory; MinioBlobNameCalculator = minioBlobNameCalculator; BlobNormalizeNamingService = blobNormalizeNamingService; } @@ -81,21 +86,16 @@ public class MinioBlobProvider : BlobProviderBase, ITransientDependency return null; } - var memoryStream = new MemoryStream(); - await client.GetObjectAsync(new GetObjectArgs().WithBucket(containerName).WithObject(blobName).WithCallbackStream(stream => - { - if (stream != null) - { - stream.CopyTo(memoryStream); - memoryStream.Seek(0, SeekOrigin.Begin); - } - else - { - memoryStream = null; - } - })); + var configuration = args.Configuration.GetMinioConfiguration(); + var downloadUrl = await client.PresignedGetObjectAsync( + new PresignedGetObjectArgs() + .WithBucket(containerName) + .WithObject(blobName) + .WithExpiry(configuration.PresignedGetExpirySeconds)); + + var httpClient = HttpClientFactory.CreateMinioHttpClient(); - return memoryStream; + return await httpClient.GetStreamAsync(downloadUrl, args.CancellationToken); } protected virtual IMinioClient GetMinioClient(BlobProviderArgs args) diff --git a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProviderConfiguration.cs b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProviderConfiguration.cs index e626a6837e..740a24f04f 100644 --- a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProviderConfiguration.cs +++ b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProviderConfiguration.cs @@ -47,6 +47,16 @@ public class MinioBlobProviderConfiguration set => _containerConfiguration.SetConfiguration(MinioBlobProviderConfigurationNames.CreateBucketIfNotExists, value); } + /// + /// Default value: 7 * 24 * 3600. + /// + public int PresignedGetExpirySeconds { + get => _containerConfiguration.GetConfigurationOrDefault(MinioBlobProviderConfigurationNames.PresignedGetExpirySeconds, _defaultExpirySeconds); + set => _containerConfiguration.SetConfiguration(MinioBlobProviderConfigurationNames.PresignedGetExpirySeconds, value); + } + + private int _defaultExpirySeconds = 7 * 24 * 3600; + private readonly BlobContainerConfiguration _containerConfiguration; public MinioBlobProviderConfiguration(BlobContainerConfiguration containerConfiguration) diff --git a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProviderConfigurationNames.cs b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProviderConfigurationNames.cs index 8a8a121ef7..1c32bd8aa0 100644 --- a/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProviderConfigurationNames.cs +++ b/framework/src/Volo.Abp.BlobStoring.Minio/Volo/Abp/BlobStoring/Minio/MinioBlobProviderConfigurationNames.cs @@ -8,4 +8,5 @@ public static class MinioBlobProviderConfigurationNames public const string SecretKey = "Minio.SecretKey"; public const string WithSSL = "Minio.WithSSL"; public const string CreateBucketIfNotExists = "Minio.CreateBucketIfNotExists"; + public const string PresignedGetExpirySeconds = "Minio.PresignedGetExpirySeconds"; } diff --git a/framework/src/Volo.Abp.TickerQ/FodyWeavers.xml b/framework/src/Volo.Abp.TickerQ/FodyWeavers.xml new file mode 100644 index 0000000000..1715698ccd --- /dev/null +++ b/framework/src/Volo.Abp.TickerQ/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.TickerQ/FodyWeavers.xsd b/framework/src/Volo.Abp.TickerQ/FodyWeavers.xsd new file mode 100644 index 0000000000..ffa6fc4b78 --- /dev/null +++ b/framework/src/Volo.Abp.TickerQ/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/framework/src/Volo.Abp.TickerQ/Microsoft/AspNetCore/Builder/AbpTickerQApplicationBuilderExtensions.cs b/framework/src/Volo.Abp.TickerQ/Microsoft/AspNetCore/Builder/AbpTickerQApplicationBuilderExtensions.cs new file mode 100644 index 0000000000..4e81565e99 --- /dev/null +++ b/framework/src/Volo.Abp.TickerQ/Microsoft/AspNetCore/Builder/AbpTickerQApplicationBuilderExtensions.cs @@ -0,0 +1,20 @@ +using Microsoft.Extensions.DependencyInjection; +using TickerQ.DependencyInjection; +using TickerQ.Utilities; +using TickerQ.Utilities.Enums; +using Volo.Abp.TickerQ; + +namespace Microsoft.AspNetCore.Builder; + +public static class AbpTickerQApplicationBuilderExtensions +{ + public static IApplicationBuilder UseAbpTickerQ(this IApplicationBuilder app, TickerQStartMode qStartMode = TickerQStartMode.Immediate) + { + var abpTickerQFunctionProvider = app.ApplicationServices.GetRequiredService(); + TickerFunctionProvider.RegisterFunctions(abpTickerQFunctionProvider.Functions); + TickerFunctionProvider.RegisterRequestType(abpTickerQFunctionProvider.RequestTypes); + + app.UseTickerQ(qStartMode); + return app; + } +} diff --git a/framework/src/Volo.Abp.TickerQ/Volo.Abp.TickerQ.csproj b/framework/src/Volo.Abp.TickerQ/Volo.Abp.TickerQ.csproj new file mode 100644 index 0000000000..89a037bab7 --- /dev/null +++ b/framework/src/Volo.Abp.TickerQ/Volo.Abp.TickerQ.csproj @@ -0,0 +1,27 @@ + + + + + + + netstandard2.1;net8.0;net9.0;net10.0 + enable + Nullable + Volo.Abp.TickerQ + Volo.Abp.TickerQ + $(AssetTargetFallback);portable-net45+win8+wp8+wpa81; + false + false + false + + + + + + + + + + + + diff --git a/framework/src/Volo.Abp.TickerQ/Volo/Abp/TickerQ/AbpTickerQFunctionProvider.cs b/framework/src/Volo.Abp.TickerQ/Volo/Abp/TickerQ/AbpTickerQFunctionProvider.cs new file mode 100644 index 0000000000..b92888e533 --- /dev/null +++ b/framework/src/Volo.Abp.TickerQ/Volo/Abp/TickerQ/AbpTickerQFunctionProvider.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using TickerQ.Utilities; +using TickerQ.Utilities.Enums; +using Volo.Abp.DependencyInjection; + +namespace Volo.Abp.TickerQ; + +public class AbpTickerQFunctionProvider : ISingletonDependency +{ + public Dictionary Functions { get;} + + public Dictionary RequestTypes { get; } + + public AbpTickerQFunctionProvider() + { + Functions = new Dictionary(); + RequestTypes = new Dictionary(); + } +} diff --git a/framework/src/Volo.Abp.TickerQ/Volo/Abp/TickerQ/AbpTickerQModule.cs b/framework/src/Volo.Abp.TickerQ/Volo/Abp/TickerQ/AbpTickerQModule.cs new file mode 100644 index 0000000000..b6c140e962 --- /dev/null +++ b/framework/src/Volo.Abp.TickerQ/Volo/Abp/TickerQ/AbpTickerQModule.cs @@ -0,0 +1,16 @@ +using Microsoft.Extensions.DependencyInjection; +using TickerQ.DependencyInjection; +using Volo.Abp.Modularity; + +namespace Volo.Abp.TickerQ; + +public class AbpTickerQModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddTickerQ(options => + { + options.SetInstanceIdentifier(context.Services.GetApplicationName()); + }); + } +} diff --git a/framework/test/Volo.Abp.BlobStoring.Minio.Tests/Volo/Abp/BlobStoring/Minio/AbpBlobStoringMinioTestModule.cs b/framework/test/Volo.Abp.BlobStoring.Minio.Tests/Volo/Abp/BlobStoring/Minio/AbpBlobStoringMinioTestModule.cs index ce24894b5c..fc6b8e5841 100644 --- a/framework/test/Volo.Abp.BlobStoring.Minio.Tests/Volo/Abp/BlobStoring/Minio/AbpBlobStoringMinioTestModule.cs +++ b/framework/test/Volo.Abp.BlobStoring.Minio.Tests/Volo/Abp/BlobStoring/Minio/AbpBlobStoringMinioTestModule.cs @@ -57,6 +57,7 @@ public class AbpBlobStoringMinioTestModule : AbpModule minio.WithSSL = false; minio.BucketName = _randomContainerName; minio.CreateBucketIfNotExists = true; + minio.PresignedGetExpirySeconds = 3600; }); }); }); diff --git a/latest-versions.json b/latest-versions.json index 7b3e4c5e79..ba878e1dad 100644 --- a/latest-versions.json +++ b/latest-versions.json @@ -1,4 +1,13 @@ [ + { + "version": "9.3.5", + "releaseDate": "", + "type": "stable", + "message": "", + "leptonx": { + "version": "4.3.5" + } + }, { "version": "9.3.4", "releaseDate": "", diff --git a/modules/background-jobs/Volo.Abp.BackgroundJobs.slnx b/modules/background-jobs/Volo.Abp.BackgroundJobs.slnx index d8a41ccb9d..9863504e7c 100644 --- a/modules/background-jobs/Volo.Abp.BackgroundJobs.slnx +++ b/modules/background-jobs/Volo.Abp.BackgroundJobs.slnx @@ -5,6 +5,7 @@ + @@ -19,4 +20,4 @@ - + \ No newline at end of file diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/DemoAppSharedModule.cs b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/DemoAppSharedModule.cs index ad002a5e18..7e67dd48a9 100644 --- a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/DemoAppSharedModule.cs +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.Shared/DemoAppSharedModule.cs @@ -4,9 +4,6 @@ using Volo.Abp.Modularity; namespace Volo.Abp.BackgroundJobs.DemoApp.Shared { - [DependsOn( - typeof(AbpBackgroundJobsModule) - )] public class DemoAppSharedModule : AbpModule { public override void OnPostApplicationInitialization(ApplicationInitializationContext context) diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/CleanupJobs.cs b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/CleanupJobs.cs new file mode 100644 index 0000000000..6eca55e09f --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/CleanupJobs.cs @@ -0,0 +1,15 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using TickerQ.Utilities.Models; + +namespace Volo.Abp.BackgroundJobs.DemoApp.TickerQ; + +public class CleanupJobs +{ + public async Task CleanupLogsAsync(TickerFunctionContext tickerContext, CancellationToken cancellationToken) + { + var logFileName = tickerContext.Request; + Console.WriteLine($"Cleaning up log file: {logFileName} at {DateTime.Now}"); + } +} diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/DemoAppTickerQModule.cs b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/DemoAppTickerQModule.cs new file mode 100644 index 0000000000..c9a3b957de --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/DemoAppTickerQModule.cs @@ -0,0 +1,140 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using TickerQ.Dashboard.DependencyInjection; +using TickerQ.DependencyInjection; +using TickerQ.Utilities; +using TickerQ.Utilities.Enums; +using TickerQ.Utilities.Interfaces.Managers; +using TickerQ.Utilities.Models; +using TickerQ.Utilities.Models.Ticker; +using Volo.Abp.AspNetCore; +using Volo.Abp.Autofac; +using Volo.Abp.BackgroundJobs.DemoApp.Shared; +using Volo.Abp.BackgroundJobs.DemoApp.Shared.Jobs; +using Volo.Abp.BackgroundJobs.TickerQ; +using Volo.Abp.BackgroundWorkers; +using Volo.Abp.BackgroundWorkers.TickerQ; +using Volo.Abp.Modularity; +using Volo.Abp.TickerQ; + +namespace Volo.Abp.BackgroundJobs.DemoApp.TickerQ; + +[DependsOn( + typeof(AbpBackgroundJobsTickerQModule), + typeof(AbpBackgroundWorkersTickerQModule), + typeof(DemoAppSharedModule), + typeof(AbpAutofacModule), + typeof(AbpAspNetCoreModule) +)] +public class DemoAppTickerQModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + context.Services.AddTickerQ(options => + { + options.UpdateMissedJobCheckDelay(TimeSpan.FromSeconds(30)); + + options.AddDashboard(x => + { + x.BasePath = "/tickerq-dashboard"; + + x.UseHostAuthentication = true; + }); + }); + + Configure(options => + { + options.AddConfiguration(new AbpBackgroundJobsTimeTickerConfiguration() + { + Retries = 3, + RetryIntervals = new[] {30, 60, 120}, // Retry after 30s, 60s, then 2min, + Priority = TickerTaskPriority.High + }); + + options.AddConfiguration(new AbpBackgroundJobsTimeTickerConfiguration() + { + Retries = 5, + RetryIntervals = new[] {30, 60, 120}, // Retry after 30s, 60s, then 2min + }); + }); + + Configure(options => + { + options.AddConfiguration(new AbpBackgroundWorkersCronTickerConfiguration() + { + Retries = 3, + RetryIntervals = new[] {30, 60, 120}, // Retry after 30s, 60s, then 2min, + Priority = TickerTaskPriority.High + }); + }); + } + + public override Task OnPreApplicationInitializationAsync(ApplicationInitializationContext context) + { + var abpTickerQFunctionProvider = context.ServiceProvider.GetRequiredService(); + abpTickerQFunctionProvider.Functions.TryAdd(nameof(CleanupJobs), (string.Empty, TickerTaskPriority.Normal, new TickerFunctionDelegate(async (cancellationToken, serviceProvider, tickerFunctionContext) => + { + var service = new CleanupJobs(); + var request = await TickerRequestProvider.GetRequestAsync(serviceProvider, tickerFunctionContext.Id, tickerFunctionContext.Type); + var genericContext = new TickerFunctionContext(tickerFunctionContext, request); + await service.CleanupLogsAsync(genericContext, cancellationToken); + }))); + abpTickerQFunctionProvider.RequestTypes.TryAdd(nameof(CleanupJobs), (typeof(string).FullName, typeof(string))); + return Task.CompletedTask; + } + + public override async Task OnApplicationInitializationAsync(ApplicationInitializationContext context) + { + var backgroundWorkerManager = context.ServiceProvider.GetRequiredService(); + await backgroundWorkerManager.AddAsync(context.ServiceProvider.GetRequiredService()); + + var app = context.GetApplicationBuilder(); + app.UseAbpTickerQ(); + + var timeTickerManager = context.ServiceProvider.GetRequiredService>(); + await timeTickerManager.AddAsync(new TimeTicker + { + Function = nameof(CleanupJobs), + ExecutionTime = DateTime.UtcNow.AddSeconds(5), + Request = TickerHelper.CreateTickerRequest("cleanup_example_file.txt"), + Retries = 3, + RetryIntervals = new[] { 30, 60, 120 }, // Retry after 30s, 60s, then 2min + }); + + var cronTickerManager = context.ServiceProvider.GetRequiredService>(); + await cronTickerManager.AddAsync(new CronTicker + { + Function = nameof(CleanupJobs), + Expression = "* * * * *", // Every minute + Request = TickerHelper.CreateTickerRequest("cleanup_example_file.txt"), + Retries = 2, + RetryIntervals = new[] { 60, 300 } + }); + + app.UseRouting(); + app.UseEndpoints(endpoints => + { + endpoints.MapGet("/", async httpContext => + { + httpContext.Response.Redirect("/tickerq-dashboard", true); + }); + }); + + await CancelableBackgroundJobAsync(context.ServiceProvider); + } + + private async Task CancelableBackgroundJobAsync(IServiceProvider serviceProvider) + { + var backgroundJobManager = serviceProvider.GetRequiredService(); + var jobId = await backgroundJobManager.EnqueueAsync(new LongRunningJobArgs { Value = "test-cancel-job" }); + await backgroundJobManager.EnqueueAsync(new LongRunningJobArgs { Value = "test-3" }); + + await Task.Delay(1000); + + var timeTickerManager = serviceProvider.GetRequiredService>(); + var result = await timeTickerManager.DeleteAsync(Guid.Parse(jobId)); + } +} diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/MyBackgroundWorker.cs b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/MyBackgroundWorker.cs new file mode 100644 index 0000000000..cd35b42bb4 --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/MyBackgroundWorker.cs @@ -0,0 +1,22 @@ +using System; +using System.Threading.Tasks; +using JetBrains.Annotations; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.BackgroundWorkers; +using Volo.Abp.Threading; + +namespace Volo.Abp.BackgroundJobs.DemoApp.TickerQ; + +public class MyBackgroundWorker : AsyncPeriodicBackgroundWorkerBase +{ + public MyBackgroundWorker([NotNull] AbpAsyncTimer timer, [NotNull] IServiceScopeFactory serviceScopeFactory) : base(timer, serviceScopeFactory) + { + timer.Period = 60 * 1000; // 60 seconds + CronExpression = "* * * * *"; // every minute + } + + protected override async Task DoWorkAsync(PeriodicBackgroundWorkerContext workerContext) + { + Console.WriteLine($"MyBackgroundWorker executed at {DateTime.Now}"); + } +} diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/Program.cs b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/Program.cs new file mode 100644 index 0000000000..72e7f9090c --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/Program.cs @@ -0,0 +1,19 @@ +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + +namespace Volo.Abp.BackgroundJobs.DemoApp.TickerQ; + +public class Program +{ + public static async Task Main(string[] args) + { + var builder = WebApplication.CreateBuilder(args); + builder.Host.UseAutofac(); + await builder.AddApplicationAsync(); + var app = builder.Build(); + await app.InitializeApplicationAsync(); + await app.RunAsync(); + } +} diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/Properties/launchSettings.json b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/Properties/launchSettings.json new file mode 100644 index 0000000000..1b8cdbbc25 --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/Properties/launchSettings.json @@ -0,0 +1,13 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "profiles": { + "Volo.Abp.BackgroundJobs.DemoApp.TickerQ": { + "commandName": "Project", + "launchBrowser": true, + "applicationUrl": "https://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/Volo.Abp.BackgroundJobs.DemoApp.TickerQ.csproj b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/Volo.Abp.BackgroundJobs.DemoApp.TickerQ.csproj new file mode 100644 index 0000000000..f30eba83dd --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/Volo.Abp.BackgroundJobs.DemoApp.TickerQ.csproj @@ -0,0 +1,26 @@ + + + + Exe + net10.0 + + + + + + + + + + + + + + Always + + + Always + + + + diff --git a/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/appsettings.json b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/appsettings.json new file mode 100644 index 0000000000..1b2d3bafd8 --- /dev/null +++ b/modules/background-jobs/app/Volo.Abp.BackgroundJobs.DemoApp.TickerQ/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Documents/Rendering/ScribanDocumentSectionRenderer.cs b/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Documents/Rendering/ScribanDocumentSectionRenderer.cs index 53a8aea6fc..b52e0d2b46 100644 --- a/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Documents/Rendering/ScribanDocumentSectionRenderer.cs +++ b/modules/docs/src/Volo.Docs.Domain.Shared/Volo/Docs/Documents/Rendering/ScribanDocumentSectionRenderer.cs @@ -22,6 +22,7 @@ public class ScribanDocumentSectionRenderer : IDocumentSectionRenderer protected const string DocsParam = "//[doc-params]"; protected const string DocsTemplates = "//[doc-template]"; protected const string DocsNav = "//[doc-nav]"; + protected const string DocsSeo = "//[doc-seo]"; public ILogger Logger { get; set; } @@ -49,7 +50,7 @@ public class ScribanDocumentSectionRenderer : IDocumentSectionRenderer var result = await scribanTemplate.RenderAsync(parameters); - return RemoveOptionsJson(result, DocsParam, DocsNav); + return RemoveOptionsJson(result, DocsParam, DocsNav, DocsSeo); } public Task>> GetAvailableParametersAsync(string document) diff --git a/modules/docs/src/Volo.Docs.Web/HtmlConverting/DocumentSeoDto.cs b/modules/docs/src/Volo.Docs.Web/HtmlConverting/DocumentSeoDto.cs new file mode 100644 index 0000000000..e1848c1cfc --- /dev/null +++ b/modules/docs/src/Volo.Docs.Web/HtmlConverting/DocumentSeoDto.cs @@ -0,0 +1,6 @@ +namespace Volo.Docs.HtmlConverting; + +public class DocumentSeoDto +{ + public string Description { get; set; } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Web/HtmlConverting/IWebDocumentSectionRenderer.cs b/modules/docs/src/Volo.Docs.Web/HtmlConverting/IWebDocumentSectionRenderer.cs index b485c7b132..acc2974c9d 100644 --- a/modules/docs/src/Volo.Docs.Web/HtmlConverting/IWebDocumentSectionRenderer.cs +++ b/modules/docs/src/Volo.Docs.Web/HtmlConverting/IWebDocumentSectionRenderer.cs @@ -10,5 +10,7 @@ namespace Volo.Docs.HtmlConverting Task> GetPartialTemplatesInDocumentAsync(string documentContent); Task GetDocumentNavigationsAsync(string documentContent); + + Task GetDocumentSeoAsync(string documentContent); } } diff --git a/modules/docs/src/Volo.Docs.Web/HtmlConverting/ScribanWebDocumentSectionRenderer.cs b/modules/docs/src/Volo.Docs.Web/HtmlConverting/ScribanWebDocumentSectionRenderer.cs index 48379765ec..ae76924d2a 100644 --- a/modules/docs/src/Volo.Docs.Web/HtmlConverting/ScribanWebDocumentSectionRenderer.cs +++ b/modules/docs/src/Volo.Docs.Web/HtmlConverting/ScribanWebDocumentSectionRenderer.cs @@ -11,6 +11,11 @@ namespace Volo.Docs.HtmlConverting return GetSectionAsync(documentContent, DocsNav); } + public Task GetDocumentSeoAsync(string documentContent) + { + return GetSectionAsync(documentContent, DocsSeo); + } + public async Task> GetPartialTemplatesInDocumentAsync( string documentContent) { diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs index 319d5f1b63..35e3c05f15 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs @@ -99,6 +99,8 @@ namespace Volo.Docs.Pages.Documents.Project public bool HasDownloadPdf { get; set; } public DocumentNavigationsDto DocumentNavigationsDto { get; private set; } + + public DocumentSeoDto DocumentSeoDto { get; private set; } private const int MaxDescriptionMetaTagLength = 200; private const int TocLevelCount = 2; @@ -542,7 +544,7 @@ namespace Volo.Docs.Pages.Documents.Project DocumentNameWithExtension = Document.Name; SetDocumentPageTitle(); - await ConvertDocumentContentToHtmlAsync(); + await ConvertDocumentContentToHtmlAsync(); return true; } @@ -587,6 +589,7 @@ namespace Volo.Docs.Pages.Documents.Project var partialTemplates = await GetDocumentPartialTemplatesAsync(); DocumentNavigationsDto = await _webDocumentSectionRenderer.GetDocumentNavigationsAsync(Document.Content); + DocumentSeoDto = await _webDocumentSectionRenderer.GetDocumentSeoAsync(Document.Content); try { @@ -600,11 +603,12 @@ namespace Volo.Docs.Pages.Documents.Project else { DocumentNavigationsDto = new DocumentNavigationsDto(); - } - - if (Document != null && !Document.Content.IsNullOrEmpty()) - { - TocItems = _tocGeneratorService.GenerateTocItems(Document.Content, TocLevelCount); + DocumentSeoDto = new DocumentSeoDto(); + } + + if (Document != null && !Document.Content.IsNullOrEmpty()) + { + TocItems = _tocGeneratorService.GenerateTocItems(Document.Content, TocLevelCount); } var converter = _documentToHtmlConverterFactory.Create(Document.Format ?? Project.Format); @@ -888,6 +892,11 @@ namespace Volo.Docs.Pages.Documents.Project return null; } + if (DocumentSeoDto?.Description.IsNullOrWhiteSpace() == false) + { + return DocumentSeoDto.Description; + } + var firstParagraph = new Regex(@"

(.*?)

", RegexOptions.IgnoreCase); var match = firstParagraph.Match(Document.Content); if (!match.Success) diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/Scripts/vs.js b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/Scripts/vs.js index 0bddcf844c..eaa57a31d8 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/Scripts/vs.js +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Shared/Scripts/vs.js @@ -63,10 +63,13 @@ var $myNav = $('#docs-sticky-index'); - $('body').scrollspy({ - target: $myNav, - offset:100 - }); + try { + $('body').scrollspy({ + target: $myNav, + offset:100 + }); + } catch { + } $('#docs-sticky-index a').on('click', function (event) { if (this.hash !== '') { diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserPasswordHistoriesConsts.cs b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserPasswordHistoriesConsts.cs new file mode 100644 index 0000000000..7d9dede55d --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityUserPasswordHistoriesConsts.cs @@ -0,0 +1,9 @@ +namespace Volo.Abp.Identity; + +public class IdentityUserPasswordHistoriesConsts +{ + /// + /// Default value: 256 + /// + public static int MaxPasswordLength { get; set; } = 256; +} diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/ar.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/ar.json index 834c3d007b..49b22071cd 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/ar.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/ar.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "يجب أن تحتوي كلمات المرور على حرف كبير واحد على الأقل ('A' - 'Z').", "Volo.Abp.Identity:PasswordTooShort": "يجب أن تتكون كلمات المرور من {0} حرف على الأقل.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "يجب أن تحتوي كلمات المرور على {0} حرف فريد على الأقل.", + "Volo.Abp.Identity:PasswordInHistory": "يجب ألا تتطابق كلمات المرور مع آخر {0} كلمات مرور.", "Volo.Abp.Identity:RoleNotFound": "الدور {0} غير موجود.", "Volo.Abp.Identity:UserAlreadyHasPassword": "لدى المستخدم بالفعل مجموعة كلمات مرور.", "Volo.Abp.Identity:UserAlreadyInRole": "المستخدم بالفعل في الدور '{0}'.", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "الرقم المطلوب", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "إجبار المستخدمين على تغيير كلمة المرور بشكل دوري", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "تغيير كلمة المرور بشكل دوري", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "تمكين منع إعادة استخدام كلمة المرور", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "عدد مرات منع إعادة استخدام كلمة المرور", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "ممكّن للمستخدمين الجدد", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "مدة التأمين (بالثواني)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "محاولات الوصول الفاشلة", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "إذا كانت كلمات المرور يجب أن تحتوي على رقم.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "إذا كان يجب أن يتغير كلمة المرور بشكل دوري.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "عدد الأيام التي يجب أن تتراوح بين تغيير كلمة المرور.", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "ما إذا كان يجب منع المستخدمين من إعادة استخدام كلمات المرور السابقة.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "عدد كلمات المرور السابقة التي لا يمكن إعادة استخدامها.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "ما إذا كان يمكن قفل مستخدم جديد.", "Description:Abp.Identity.Lockout.LockoutDuration": "المدة التي يتم فيها حظر المستخدم عند حدوث قفل.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "عدد محاولات الوصول الفاشلة المسموح بها قبل قفل المستخدم ، بافتراض تمكين التأمين.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/cs.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/cs.json index deea27dd17..8f0456c601 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/cs.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/cs.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "Hesla musí obsahovat alespoň jedno velké písmeno ('A'-'Z').", "Volo.Abp.Identity:PasswordTooShort": "Hesla musí být dlouhá alespoň {0} znaků.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "Hesla nesmí obsahovat více než {0} opakujících se znaků.", + "Volo.Abp.Identity:PasswordInHistory": "Hesla se nesmí shodovat s posledními {0} hesly.", "Volo.Abp.Identity:RoleNotFound": "Role {0} neexistuje.", "Volo.Abp.Identity:UserAlreadyHasPassword": "Uživatel již má nastavené heslo.", "Volo.Abp.Identity:UserAlreadyInRole": "Uživatel již je v roli '{0}'.", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "Požadováno číslo", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Vynutit uživatelům pravidelnou změnu hesla", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "Délka platnosti hesla (dny)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "Povolit zabránění opětovnému použití hesla", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "Počet zabránění opětovnému použití hesla", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Povoleno pro nové uživatele", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Délka blokování (sekundy)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Maximální počet neúspěšných pokusů o přístup", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "Pokud hesla musí obsahovat číslici.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Zda musí uživatelé pravidelně měnit heslo.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "Počet dní, po které je heslo uživatele platné.", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "Zda zabránit uživatelům v opětovném použití jejich předchozích hesel.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "Počet předchozích hesel, která nelze znovu použít.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Zda může být uzamčen nový uživatel.", "Description:Abp.Identity.Lockout.LockoutDuration": "Doba, po kterou je uživatel zablokován, když dojde k zablokování.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Počet neúspěšných pokusů o přístup než je uživatel uzamčen, za předpokladu, že je uzamčení povoleno.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/de.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/de.json index 5987f215d7..19daf4d440 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/de.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/de.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "Passwörter müssen mindestens einen Großbuchstaben ('A' - 'Z') enthalten.", "Volo.Abp.Identity:PasswordTooShort": "Passwörter müssen mindestens {0} Zeichen lang sein.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "Passwörter dürfen nicht mehr als {0} aufeinanderfolgende identische Zeichen enthalten.", + "Volo.Abp.Identity:PasswordInHistory": "Passwörter dürfen nicht mit Ihren letzten {0} Passwörtern übereinstimmen.", "Volo.Abp.Identity:RoleNotFound": "Rolle {0} existiert nicht.", "Volo.Abp.Identity:UserAlreadyHasPassword": "Der Benutzer hat bereits ein Passwort festgelegt.", "Volo.Abp.Identity:UserAlreadyInRole": "Benutzer bereits in Rolle '{0}'.", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "Erforderliche Ziffer", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Benutzer müssen das Passwort regelmäßig ändern", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "Passwortänderungszeitraum (Tage)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "Wiederverwendung von Passwörtern verhindern aktivieren", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "Anzahl der zu verhindernden Passwortwiederverwendungen", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Für neue Benutzer aktiviert", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Sperrdauer (Sekunden)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Max. Fehlgeschlagene Zugriffsversuche", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "Wenn Passwörter eine Ziffer enthalten müssen.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Gibt an, ob Benutzer das Passwort regelmäßig ändern müssen.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "Die Anzahl der Tage, nach denen ein Benutzer das Passwort ändern muss.", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "Ob verhindert werden soll, dass Benutzer ihre vorherigen Passwörter wiederverwenden.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "Die Anzahl der vorherigen Passwörter, die nicht wiederverwendet werden können.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Gibt an, ob ein neuer Benutzer gesperrt werden kann.", "Description:Abp.Identity.Lockout.LockoutDuration": "Die Dauer, für die ein Benutzer gesperrt ist, wenn eine Sperre auftritt.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Die Anzahl der fehlgeschlagenen Zugriffsversuche, die zulässig sind, bevor ein Benutzer gesperrt wird, sofern die Sperre aktiviert ist.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/el.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/el.json index b3b040cb91..1e2c8a23ce 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/el.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/el.json @@ -41,7 +41,7 @@ "Volo.Abp.Identity:ConcurrencyFailure": "Ο έλεγχος συγχρονισμού απέτυχε. Η οντότητα στην οποία εργάζεστε έχει τροποποιηθεί από άλλο χρήστη. Απορρίψτε τις αλλαγές σας και δοκιμάστε ξανά.", "Volo.Abp.Identity:DuplicateEmail": "Το email '{0}' υπάρχει ήδη.", "Volo.Abp.Identity:DuplicateRoleName": "Το όνομα ρόλου '{0}' υπάρχει ήδη.", - "Volo.Abp.Identity:DuplicateUserName":"Το Όνομα χρήστη'{0}'υπάρχει ήδη.", + "Volo.Abp.Identity:DuplicateUserName": "Το Όνομα χρήστη'{0}'υπάρχει ήδη.", "Volo.Abp.Identity:InvalidEmail": "Το email '{0}' δεν είναι έγκυρο.", "Volo.Abp.Identity:InvalidPasswordHasherCompatibilityMode": "Η παρεχόμενη λειτουργία PasswordHasherCompatibilityMode δεν είναι έγκυρη.", "Volo.Abp.Identity:InvalidPasswordHasherIterationCount": "Το πλήθος των επαναλήψεων πρέπει να είναι θετικός ακέραιος.", @@ -56,6 +56,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "Οι κωδικοί πρόσβασης πρέπει να έχουν τουλάχιστον ένα κεφαλαίο ('A'-'Z').", "Volo.Abp.Identity:PasswordTooShort": "Οι κωδικοί πρόσβασης πρέπει να είναι τουλάχιστον {0} χαρακτήρες.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "Οι κωδικοί πρόσβασης πρέπει να έχουν τουλάχιστον {0} μοναδικούς χαρακτήρες.", + "Volo.Abp.Identity:PasswordInHistory": "Οι κωδικοί πρόσβασης δεν πρέπει να ταιριάζουν με τους τελευταίους {0} κωδικούς πρόσβασής σας.", "Volo.Abp.Identity:RoleNotFound": "Ο ρόλος {0} δεν υπάρχει", "Volo.Abp.Identity:UserAlreadyHasPassword": "Ο χρήστης έχει ήδη ορίσει κωδικό πρόσβασης.", "Volo.Abp.Identity:UserAlreadyInRole": "Χρήστης ήδη στο ρόλο '{0}'.", @@ -97,6 +98,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "Απαιτούμενο ψηφίο", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Επιβάλλεται η αλλαγή του κωδικού πρόσβασης", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "Διάρκεια κωδικού πρόσβασης (ημέρες)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "Ενεργοποίηση αποτροπής επαναχρησιμοποίησης κωδικού πρόσβασης", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "Αριθμός αποτροπής επαναχρησιμοποίησης κωδικού πρόσβασης", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Ενεργοποιήθηκε για νέους χρήστες", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Διάρκεια κλειδώματος (δευτερόλεπτα)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Μέγιστες αποτυχημένες προσπάθειες πρόσβασης", @@ -113,6 +116,8 @@ "Description:Abp.Identity.Password.RequireDigit": "Εάν οι κωδικοί πρόσβασης πρέπει να περιέχουν ένα ψηφίο.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Εάν οι χρήστες πρέπει να αλλάζουν τον κωδικό πρόσβασης τους με συχνότητα που ορίζεται από το PasswordChangePeriodDays.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "Η διάρκεια της περιόδου σε ημέρες μετά την οποία οι χρήστες πρέπει να αλλάζουν τον κωδικό πρόσβασης τους.", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "Εάν πρέπει να αποτραπεί η επαναχρησιμοποίηση προηγούμενων κωδικών πρόσβασης από τους χρήστες.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "Ο αριθμός των προηγούμενων κωδικών πρόσβασης που δεν μπορούν να επαναχρησιμοποιηθούν.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Εάν ένας νέος χρήστης μπορεί να κλειδωθεί.", "Description:Abp.Identity.Lockout.LockoutDuration": "Η διάρκεια για την οποία ένας χρήστης είναι κλειδωμένος όταν εμφανίζεται ένα κλείδωμα.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Ο αριθμός των αποτυχημένων προσπαθειών πρόσβασης που επιτρέπονται πριν από το κλείδωμα ενός χρήστη, με την προϋπόθεση ότι το κλείδωμα είναι ενεργοποιημένο.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en-GB.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en-GB.json index b7d30bb30a..45f25bc864 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en-GB.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en-GB.json @@ -56,6 +56,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "Passwords must have at least one uppercase ('A'-'Z').", "Volo.Abp.Identity:PasswordTooShort": "Passwords must be at least {0} characters.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "Passwords must use at least {0} different characters.", + "Volo.Abp.Identity:PasswordInHistory": "Passwords must not match your last {0} passwords.", "Volo.Abp.Identity:RoleNotFound": "Role {0} does not exist.", "Volo.Abp.Identity:UserAlreadyHasPassword": "User already has a password set.", "Volo.Abp.Identity:UserAlreadyInRole": "User is already in role '{0}'.", @@ -102,6 +103,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "Required digit", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Force users to periodically change password", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "Password change period(days)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "Enable prevent password reuse", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "Prevent password reuse count", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Enabled for new users", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Lockout duration(in seconds)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Max failed access attempts", @@ -118,6 +121,8 @@ "Description:Abp.Identity.Password.RequireDigit": "If passwords must contain a digit.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Whether users are required to periodically change their password.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "The number of days a user's password is valid for.", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "Whether to prevent users from reusing their previous passwords.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "The number of previous passwords that cannot be reused.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Whether a new user can be locked out.", "Description:Abp.Identity.Lockout.LockoutDuration": "The duration a user is locked out for when a lockout occurs.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "The number of failed access attempts allowed before a user is locked out, assuming lock out is enabled.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en.json index 266ce50b5a..f2cc74cef0 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/en.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "Passwords must have at least one uppercase ('A'-'Z').", "Volo.Abp.Identity:PasswordTooShort": "Passwords must be at least {0} characters.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "Passwords must use at least {0} different characters.", + "Volo.Abp.Identity:PasswordInHistory": "Passwords must not match your last {0} passwords.", "Volo.Abp.Identity:RoleNotFound": "Role {0} does not exist.", "Volo.Abp.Identity:UserAlreadyHasPassword": "User already has a password set.", "Volo.Abp.Identity:UserAlreadyInRole": "User already in role '{0}'.", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "Required digit", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Force users to periodically change password", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "Password change period(days)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "Enable prevent password reuse", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "Prevent password reuse count", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Enabled for new users", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Lockout duration(seconds)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Max failed access attempts", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "If passwords must contain a digit.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Whether users are forced to periodically change their password.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "The number of days a user's password is valid for.", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "Whether to prevent users from reusing their previous passwords.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "The number of previous passwords that cannot be reused.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Whether a new user can be locked out.", "Description:Abp.Identity.Lockout.LockoutDuration": "The duration a user is locked out for when a lockout occurs.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "The number of failed access attempts allowed before a user is locked out, assuming lock out is enabled.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/es.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/es.json index 861ffe10b0..ff4d4302f8 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/es.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/es.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "Contraseñas deben tener al menos un carácter en mayúsculas ('A'-'Z').", "Volo.Abp.Identity:PasswordTooShort": "Contraseñas deben tener al menos {0} caracteres", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "Contraseñas deben usar al menos {0} caracteres diferentes.", + "Volo.Abp.Identity:PasswordInHistory": "Las contraseñas no deben coincidir con sus últimas {0} contraseñas.", "Volo.Abp.Identity:RoleNotFound": "El rol {0} no existe.", "Volo.Abp.Identity:UserAlreadyHasPassword": "El usuario tiene la contraseña establecida", "Volo.Abp.Identity:UserAlreadyInRole": "El usuario ya tiene asignado el rol '{0}'´.", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "Dígito requerido", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Forzar a los usuarios a cambiar su contraseña periódicamente", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "Período de cambio de contraseña (días)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "Habilitar prevención de reutilización de contraseña", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "Número de reutilizaciones de contraseña a prevenir", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Habilitado para nuevos usuarios", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Duración del bloqueo (segundos)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Número máximo de accesos fallidos", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "Si las contraseñas deben contener un dígito", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Si los usuarios deben cambiar su contraseña periódicamente.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "El número de días que un usuario debe esperar antes de cambiar su contraseña.", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "Si se debe evitar que los usuarios reutilicen sus contraseñas anteriores.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "El número de contraseñas anteriores que no se pueden reutilizar.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Si un nuevo usuario puede ser bloqueado.", "Description:Abp.Identity.Lockout.LockoutDuration": "La duración del bloqueo de un usuario cuando el bloqueo ocurre.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "El número de accessos fallidos permitidos antes de que un usuario sea bloqueado, el bloqueo de usuario debe estar habilitado.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/fa.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/fa.json index b733dbd4eb..024b443fec 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/fa.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/fa.json @@ -5,7 +5,7 @@ "Users": "کاربران", "NewUser": "کاربر جدید", "UserName": "نام کاربر", - "Surname":"نام خانوادگی", + "Surname": "نام خانوادگی", "EmailAddress": "آدرس ایمیل", "PhoneNumber": "شماره تلفن", "UserInformations": "اطلاعات کاربر", @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "رمزهای عبور باید حداقل دارای یک حروف بزرگ ('A'-'Z') باشند.", "Volo.Abp.Identity:PasswordTooShort": "گذرواژه ها باید حداقل {0} نویسه داشته باشند.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "گذرواژه ها نباید بیش از {0} کاراکتر تکراری داشته باشند.", + "Volo.Abp.Identity:PasswordInHistory": "گذرواژه ها نباید با {0} گذرواژه آخر شما مطابقت داشته باشند.", "Volo.Abp.Identity:RoleNotFound": "نقش/وظیفه {0} یافت نشد.", "Volo.Abp.Identity:UserAlreadyHasPassword": "کاربر قبلاً گذرواژه تنظیم کرده است.", "Volo.Abp.Identity:UserAlreadyInRole": "کاربر قبلاً در این نقش/وظیفه {0} عضو میباشد.", @@ -98,11 +99,13 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "رقم مورد نیاز است", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "اجبار کاربران به تغییر گذرواژه", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "مدت زمان تغییر گذرواژه (روز)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "فعال کردن جلوگیری از استفاده مجدد از گذرواژه", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "تعداد جلوگیری از استفاده مجدد از گذرواژه", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "برای کاربران جدید فعال گردیده است", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "مدت زمان قفل شدن (ثانیه)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "حداکثر تلاشهای ناموفق برای دسترسی", "DisplayName:Abp.Identity.SignIn.RequireConfittedEmail": "ایمیل معتبر مورد نیاز می باشد", - "DisplayName:Abp.Identity.SignIn.EnablePhoneNumberConfirmation": "فعال کردن تایید حساب با شماره تلفن", + "DisplayName:Abp.Identity.SignIn.EnablePhoneNumberConfirmation": "به کاربران اجازه تایید شماره تلفن خود را بدهید", "DisplayName:Abp.Identity.SignIn.RequireConfippedPhoneNumber": "شماره تلفن معتبر مورد نیاز میباشد", "DisplayName:Abp.Identity.User.IsUserNameUpdateEnabled": "آیا امکان بروزرسانی نام کاربری فعال میباشد", "DisplayName:Abp.Identity.User.IsEmailUpdateEnabled": "آیا امکان بروزرسانی آدرس ایمیل فعال میباشد", @@ -114,11 +117,13 @@ "Description:Abp.Identity.Password.RequireDigit": "گذرواژه ها باید دارای عدد باشند.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "اجبار کاربران به تغییر گذرواژه بعد از یک مدت زمان مشخص.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "مدت زمانی که کاربر باید بعد از آن گذرواژه خود را تغییر دهد.", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "آیا از استفاده مجدد گذرواژه‌های قبلی توسط کاربران جلوگیری شود.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "تعداد گذرواژه‌های قبلی که نمی‌توان دوباره استفاده کرد.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "آیا کاربر جدید را می توان قفل کرد.", "Description:Abp.Identity.Lockout.LockoutDuration": "مدت زمانی که کاربر هنگام قفل شدن، در حالت قفل باقی می ماند.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "تعداد تلاشهای دسترسی ناموفق قبل از قفل شدن کاربر، با فرض فعال بودن امکان قفل کردن.", "Description:Abp.Identity.SignIn.RequireConfirmEmail": "آیا برای ورود به سیستم آدرس ایمیل تأیید شده لازم است یا خیر.", - "Description:Abp.Identity.SignIn.EnablePhoneNumberConfirmation": "آیا شماره تلفن توسط کاربر قابل تایید باشد یا خیر.", + "Description:Abp.Identity.SignIn.EnablePhoneNumberConfirmation": "کاربران می‌توانند شماره تلفن خود را تایید کنند. نیاز به یکپارچه‌سازی پیامک دارد.", "Description:Abp.Identity.SignIn.RequireConfippedPhoneNumber": "آیا برای ورود به سیستم شماره تلفن تأیید شده لازم است یا خیر", "Description:Abp.Identity.User.IsUserNameUpdateEnabled": "آیا کاربر می تواند نام کاربری را به روز کند یا خیر.", "Description:Abp.Identity.User.IsEmailUpdateEnabled": "آیا کاربر می تواند آدرس ایمیل خود را به روز کند با خیر.", @@ -130,10 +135,8 @@ "LockoutEndTime": "زمان اتمام قفل", "FailedAccessCount": "تعداد دسترسی ناموفق", "DisplayName:Abp.Identity.SignIn.RequireConfirmedEmail": "اجباری کردن تایید ایمیل برای ورود", - "DisplayName:Abp.Identity.SignIn.EnablePhoneNumberConfirmation": "به کاربران اجازه تایید شماره تلفن خود را بدهید", "DisplayName:Abp.Identity.SignIn.RequireConfirmedPhoneNumber": "اجباری کردن تایید شماره تلفن برای ورود", "Description:Abp.Identity.SignIn.RequireConfirmedEmail": "کاربران می‌توانند حساب ایجاد کنند اما تا زمانی که آدرس ایمیل خود را تایید نکنند نمی‌توانند وارد شوند.", - "Description:Abp.Identity.SignIn.EnablePhoneNumberConfirmation": "کاربران می‌توانند شماره تلفن خود را تایید کنند. نیاز به یکپارچه‌سازی پیامک دارد.", "Description:Abp.Identity.SignIn.RequireConfirmedPhoneNumber": "کاربران می‌توانند حساب ایجاد کنند اما تا زمانی که شماره تلفن خود را تایید نکنند نمی‌توانند وارد شوند.", "DisplayName:Abp.Identity.SignIn.RequireEmailVerificationToRegister": "اجباری کردن تایید ایمیل برای ثبت‌نام", "Description:Abp.Identity.SignIn.RequireEmailVerificationToRegister": "حساب‌های کاربری ایجاد نخواهند شد مگر اینکه آدرس ایمیل خود را تایید کنند." diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/fi.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/fi.json index 1ad2950b8e..71cfe15712 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/fi.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/fi.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "Salasanoissa on oltava vähintään yksi isot kirjaimet ('A'-'Z').", "Volo.Abp.Identity:PasswordTooShort": "Salasanojen on oltava vähintään {0} merkkiä.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "Salasanojen on käytettävä vähintään {0} erilaista merkkiä.", + "Volo.Abp.Identity:PasswordInHistory": "Salasanojen ei saa täsmätä viimeisten {0} salasanasi kanssa.", "Volo.Abp.Identity:RoleNotFound": "Roolia {0} ei ole olemassa.", "Volo.Abp.Identity:UserAlreadyHasPassword": "Käyttäjällä on jo asetettu salasana.", "Volo.Abp.Identity:UserAlreadyInRole": "Käyttäjä on jo roolissa {0}.", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "Vaadittu numero", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Pakota käyttäjät vaihtamaan salasanaa säännöllisesti", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "Salasanan vaihtamisen aikaväli (päivää)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "Ota käyttöön salasanan uudelleenkäytön esto", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "Salasanan uudelleenkäytön eston määrä", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Käytössä uusille käyttäjille", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Lukituksen kesto (sekuntia)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Max epäonnistui pääsyyrityksiä", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "Jos salasanojen on sisällettävä numero.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Pakottaa käyttäjät vaihtamaan salasanaa säännöllisesti.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "Salasanan vaihtamisen aikaväli (päivää).", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "Estetäänkö käyttäjiä käyttämästä aiempia salasanojaan uudelleen.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "Aiempien salasanojen määrä, joita ei voi käyttää uudelleen.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Voiko uusi käyttäjä lukita.", "Description:Abp.Identity.Lockout.LockoutDuration": "Kesto, jonka käyttäjä lukitaan, kun lukitus tapahtuu.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Ennen käyttäjän lukitsemista sallittujen epäonnistuneiden pääsyyritysten lukumäärä, olettaen, että lukitus on käytössä.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/fr.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/fr.json index 39c5a3a71d..61bc1dea98 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/fr.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/fr.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "Les mots de passe doivent avoir au moins une majuscule ('A'-'Z').", "Volo.Abp.Identity:PasswordTooShort": "Les mots de passe doivent être au moins {0} caractères.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "Les mots de passe doivent utiliser au moins {0} caractères différents.", + "Volo.Abp.Identity:PasswordInHistory": "Les mots de passe ne doivent pas correspondre à vos {0} derniers mots de passe.", "Volo.Abp.Identity:RoleNotFound": "La {0} de rôle n’existe pas.", "Volo.Abp.Identity:UserAlreadyHasPassword": "L’utilisateur dispose déjà d’un jeu de mots de passe.", "Volo.Abp.Identity:UserAlreadyInRole": "Utilisateur déjà dans le rôle '{0}'.", @@ -76,7 +77,7 @@ "Volo.Abp.Identity:010007": "Vous ne pouvez pas modifier votre paramètre à deux facteurs.", "Volo.Abp.Identity:010008": "Il n’est pas permis de changer deux facteurs de réglage.", "Volo.Abp.Identity:010009": "Vous ne pouvez pas vous déléguer vous-même.", - "Volo.Abp.Identity:010021" : "Le nom '{0}' existe déjà.", + "Volo.Abp.Identity:010021": "Le nom '{0}' existe déjà.", "Volo.Abp.Identity:010022": "Vous ne pouvez pas modifier un type de revendication statique.", "Volo.Abp.Identity:010023": "Vous ne pouvez pas supprimer un type de revendication statique.", "Identity.OrganizationUnit.MaxUserMembershipCount": "Nombre maximal d’adhésions autorisées à l’unité d’organisation pour un utilisateur", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "Chiffre requis", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Forcer les utilisateurs à changer leur mot de passe périodiquement", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "Période de changement de mot de passe (jours)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "Activer la prévention de la réutilisation du mot de passe", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "Nombre de réutilisations de mot de passe à empêcher", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Activé pour les nouveaux utilisateurs", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Durée(secondes) du lock-out", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Max a échoué tentatives d’accès", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "Si les mots de passe doivent contenir un chiffre.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Si les utilisateurs doivent changer leur mot de passe périodiquement.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "Période de changement de mot de passe (jours).", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "S'il faut empêcher les utilisateurs de réutiliser leurs mots de passe précédents.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "Le nombre de mots de passe précédents qui ne peuvent pas être réutilisés.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Si un nouvel utilisateur peut être verrouillé.", "Description:Abp.Identity.Lockout.LockoutDuration": "Durée pendant laquelle un utilisateur est verrouillé lorsqu’un lock-out se produit.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Nombre de tentatives d’accès échouées avant qu’un utilisateur ne soit verrouillé, en supposant que le verrouillage est activé.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/hi.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/hi.json index 760ae275de..464426cf34 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/hi.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/hi.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "पासवर्ड में कम से कम एक अपरकेस ('ए' - 'जेड') होना चाहिए।", "Volo.Abp.Identity:PasswordTooShort": "पासवर्ड कम से कम {0} वर्ण का होना चाहिए।", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "पासवर्ड में कम से कम {0} अद्वितीय वर्ण होना चाहिए।", + "Volo.Abp.Identity:PasswordInHistory": "पासवर्ड आपके अंतिम {0} पासवर्ड से मेल नहीं खाना चाहिए।", "Volo.Abp.Identity:RoleNotFound": "भूमिका {0} मौजूद नहीं है।", "Volo.Abp.Identity:UserAlreadyHasPassword": "उपयोगकर्ता के पास पहले से ही एक पासवर्ड सेट है।", "Volo.Abp.Identity:UserAlreadyInRole": "उपयोगकर्ता पहले से ही '{0}' की भूमिका में है।", @@ -76,7 +77,7 @@ "Volo.Abp.Identity:010007": "आप अपनी दो कारक सेटिंग नहीं बदल सकते।", "Volo.Abp.Identity:010008": "इसे दो कारक सेटिंग बदलने की अनुमति नहीं है।", "Volo.Abp.Identity:010009": "आप अपने आप को अधिकृत नहीं कर सकते हैं!", - "Volo.Abp.Identity:010021" : "नाम '{0}' पहले से ही लिया गया है।", + "Volo.Abp.Identity:010021": "नाम '{0}' पहले से ही लिया गया है।", "Volo.Abp.Identity:010022": "स्थैतिक भूमिकाओं का नाम नहीं बदला जा सकता है।", "Volo.Abp.Identity:010023": "स्थैतिक भूमिकाओं को हटाया नहीं जा सकता।", "Identity.OrganizationUnit.MaxUserMembershipCount": "उपयोगकर्ता के लिए अधिकतम अनुमत संगठन इकाई सदस्यता गणना", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "आवश्यक अंक", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "उपयोगकर्ताओं को अपने पासवर्ड को अक्षम करने के लिए बाधित करने की आवश्यकता है", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "पासवर्ड बदलने की अवधि (दिन)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "पासवर्ड पुनः उपयोग रोकथाम सक्षम करें", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "पासवर्ड पुनः उपयोग रोकथाम गणना", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "नए उपयोगकर्ताओं के लिए सक्षम है", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "तालाबंदी अवधि (सेकंड)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "अधिकतम पहुँच प्रयास विफल", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "यदि पासवर्ड में एक अंक होना चाहिए।", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "यदि उपयोगकर्ताओं को अपने पासवर्ड को अक्षम करने के लिए बाधित करने की आवश्यकता है।", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "उपयोगकर्ता के पासवर्ड को बदलने की अनुमति देने के लिए अवधि (दिन)।", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "क्या उपयोगकर्ताओं को उनके पिछले पासवर्ड का पुनः उपयोग करने से रोकना है।", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "पिछले पासवर्ड की संख्या जिन्हें पुनः उपयोग नहीं किया जा सकता।", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "क्या कोई नया उपयोगकर्ता लॉक किया जा सकता है।", "Description:Abp.Identity.Lockout.LockoutDuration": "जब लॉकआउट होता है, तो उपयोगकर्ता की अवधि लॉक हो जाती है।", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "उपयोगकर्ता द्वारा लॉक किए जाने से पहले अनुमति प्राप्त विफल प्रयासों की संख्या, यह मानकर कि लॉक आउट सक्षम है।", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/hr.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/hr.json index 5af46488f3..e8af421629 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/hr.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/hr.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "Lozinke moraju imati barem jedno veliko slovo ('A'-'Z').", "Volo.Abp.Identity:PasswordTooShort": "Zaporke moraju imati najmanje {0} znakova.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "Lozinke ne smiju sadržavati više od {0} uzastopnih jednakih znakova.", + "Volo.Abp.Identity:PasswordInHistory": "Lozinke se ne smiju podudarati s vašim zadnjih {0} lozinki.", "Volo.Abp.Identity:RoleNotFound": "Uloga {0} ne postoji.", "Volo.Abp.Identity:UserAlreadyHasPassword": "Korisnik već ima postavljenu lozinku.", "Volo.Abp.Identity:UserAlreadyInRole": "Korisnik je već u ulozi '{0}'.", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "Obavezna znamenka", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Prisilite korisnike da periodično mijenjaju lozinku", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "Period promjene lozinke (dana)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "Omogući sprječavanje ponovne uporabe lozinke", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "Broj sprječavanja ponovne uporabe lozinke", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Omogućeno za nove korisnike", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Trajanje zaključavanja (sekunde)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Maksimalan broj neuspjelih pokušaja pristupa", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "Ako lozinke moraju sadržavati znamenku.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Ako se korisnici moraju periodično mijenjati lozinku.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "Period u danima nakon kojeg se korisnici moraju promijeniti lozinku.", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "Treba li spriječiti korisnike da ponovno koriste svoje prethodne lozinke.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "Broj prethodnih lozinki koje se ne mogu ponovno koristiti.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Može li se novi korisnik zaključati.", "Description:Abp.Identity.Lockout.LockoutDuration": "Trajanje koliko je korisnik zaključan kada dođe do zaključavanja.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Broj dopuštenih neuspjelih pokušaja pristupa prije nego što se korisnik zaključa, pod pretpostavkom da je zaključavanje omogućeno.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/hu.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/hu.json index 4c9ee448eb..935a59e2f5 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/hu.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/hu.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "A jelszavaknak legalább egy nagybetűvel kell rendelkezniük ('A'-'Z').", "Volo.Abp.Identity:PasswordTooShort": "A jelszónak minimum {0} karaktert kell tartalmaznia.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "A jelszavaknak legalább {0} egyedi karakterrel kell rendelkezniük.", + "Volo.Abp.Identity:PasswordInHistory": "A jelszavak nem egyezhetnek az utolsó {0} jelszavával.", "Volo.Abp.Identity:RoleNotFound": "{0} szerepkür nem létezik.", "Volo.Abp.Identity:UserAlreadyHasPassword": "A felhasználónak már van jelszava.", "Volo.Abp.Identity:UserAlreadyInRole": "A felhasználó már rendelkezik a '{0}' szerepkörrel.", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "Szükséges számjegy", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "A felhasználók szükségesnek tartják a jelszavukat rendszeresen megváltoztatni", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "Jelszóváltoztatási időszak napokban", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "Jelszó újrafelhasználás megakadályozásának engedélyezése", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "Jelszó újrafelhasználás megakadályozásának száma", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Engedélyezve az új felhasználók számára", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "A zárolás időtartama (másodpercben)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Max sikertelen hozzáférési kísérlet", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "Ha a jelszavaknak tartalmazniuk kell egy számjegyet.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Ha a felhasználók szükségesnek tartják a jelszavukat rendszeresen megváltoztatni.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "A jelszóváltoztatási időszak napokban.", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "Megakadályozzuk-e a felhasználókat abban, hogy újra felhasználják korábbi jelszavaikat.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "A korábbi jelszavak száma, amelyek nem használhatók fel újra.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Egy új felhasználó zárolható-e.", "Description:Abp.Identity.Lockout.LockoutDuration": "Az az időtartam, amelyre a felhasználó zárolva van, amikor zárolás történik.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "A felhasználó zárolása előtt megengedett sikertelen hozzáférési kísérletek száma, feltéve, hogy a zárolás engedélyezve van.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/is.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/is.json index 013bce103e..ebf43ceab3 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/is.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/is.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "Lykilorð verða að hafa að minnsta kosti eina hástafi ('A'-'Z').", "Volo.Abp.Identity:PasswordTooShort": "Lykilorð verða að vera að minnsta kosti {0} stafir.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "Lykilorð verða að innihalda að minnsta kosti {0} einstaka stafi.", + "Volo.Abp.Identity:PasswordInHistory": "Lykilorð mega ekki passa við síðustu {0} lykilorðin þín.", "Volo.Abp.Identity:RoleNotFound": "Hlutverk {0} er ekki til.", "Volo.Abp.Identity:UserAlreadyHasPassword": "Notandi hefur þegar stillt lykilorð.", "Volo.Abp.Identity:UserAlreadyInRole": "Notandi þegar í hlutverkinu '{0}'.", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "Nauðsynlegt að hafa tölustaf", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Þvinga notendur til að breyta lykilorði á ákveðnum tímabilum", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "Tímabil á milli lykilorðabreytinga (dagar)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "Virkja að koma í veg fyrir endurnotkun lykilorðs", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "Fjöldi sem kemur í veg fyrir endurnotkun lykilorðs", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Virkt fyrir nýja notendur", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Lengd lokunar (sekúndur)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Hámarks misheppnaðra aðgangsstilrauna", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "Ef lykilorð verða að innihalda tölustaf.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Hvort notendur verði að breyta lykilorði á ákveðnum tímabilum.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "Tímabil á milli lykilorðabreytinga (dagar).", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "Hvort á að koma í veg fyrir að notendur endurnoti fyrri lykilorð sín.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "Fjöldi fyrri lykilorða sem ekki er hægt að endurnota.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Hvort hægt sé að læsa nýjum notanda.", "Description:Abp.Identity.Lockout.LockoutDuration": "Tímalengd þess að notandi er læstur úti þegar lokun á sér stað.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Fjöldi misheppnaðra aðgangstilrauna sem leyfður er áður en notandi er læstur út, að því gefnu að útilokun sé virk.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/it.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/it.json index 00d5c139b9..1d1d9771fd 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/it.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/it.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "La password deve contenere almeno una lettera maiuscola ('A'-'Z').", "Volo.Abp.Identity:PasswordTooShort": "La password deve essere composta da almeno {0} caratteri.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "La password deve contenere almeno {0} caratteri univoci.", + "Volo.Abp.Identity:PasswordInHistory": "Le password non devono corrispondere alle ultime {0} password.", "Volo.Abp.Identity:RoleNotFound": "Il ruolo {0} non esiste.", "Volo.Abp.Identity:UserAlreadyHasPassword": "L'utente ha già una password impostata.", "Volo.Abp.Identity:UserAlreadyInRole": "Utente già nel ruolo '{0}'.", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "Cifra richiesta", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Forza gli utenti a cambiare la password periodicamente", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "Periodo di cambio password (giorni)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "Abilita prevenzione riutilizzo password", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "Numero di riutilizzi password da prevenire", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Abilitato per i nuovi utenti", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Durata blocco (secondi)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Numero massimo di tentativi di accesso non riusciti", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "Se la password devono contenere una cifra.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Se gli utenti devono cambiare la password periodicamente.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "Il numero di giorni dopo i quali gli utenti devono cambiare la password.", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "Se impedire agli utenti di riutilizzare le password precedenti.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "Il numero di password precedenti che non possono essere riutilizzate.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Se un nuovo utente può essere bloccato.", "Description:Abp.Identity.Lockout.LockoutDuration": "La durata per cui un utente viene bloccato quando si verifica un blocco.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Il numero di tentativi di accesso non riusciti consentiti prima che un utente venga bloccato, a condizione che il blocco sia abilitato.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/nl.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/nl.json index f7fab35933..2b405697ae 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/nl.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/nl.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "Wachtwoorden moeten ten minste één hoofdletter bevatten ('A' - 'Z').", "Volo.Abp.Identity:PasswordTooShort": "Wachtwoorden moeten uit minimaal {0} tekens bestaan.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "Wachtwoorden moeten minimaal {0} unieke tekens bevatten.", + "Volo.Abp.Identity:PasswordInHistory": "Wachtwoorden mogen niet overeenkomen met uw laatste {0} wachtwoorden.", "Volo.Abp.Identity:RoleNotFound": "Rol {0} bestaat niet.", "Volo.Abp.Identity:UserAlreadyHasPassword": "Gebruiker heeft al een wachtwoord ingesteld.", "Volo.Abp.Identity:UserAlreadyInRole": "Gebruiker al in rol '{0}'.", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "Vereist cijfer", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Forceer gebruikers om periodiek hun wachtwoord te wijzigen", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "Wachtwoord wijzigen periode (dagen)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "Voorkoming van wachtwoordhergebruik inschakelen", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "Aantal te voorkomen wachtwoordhergebruiken", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Ingeschakeld voor nieuwe gebruikers", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Blokkeringsduur (seconden)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Max mislukte toegangspogingen", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "Als wachtwoorden een cijfer moeten bevatten.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Of gebruikers verplicht zijn om hun wachtwoord periodiek te wijzigen.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "Het aantal dagen dat een gebruiker zijn wachtwoord moet wijzigen nadat het is ingesteld.", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "Of gebruikers moeten worden verhinderd om hun eerdere wachtwoorden opnieuw te gebruiken.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "Het aantal eerdere wachtwoorden dat niet opnieuw kan worden gebruikt.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Of een nieuwe gebruiker kan worden geblokkeerd.", "Description:Abp.Identity.Lockout.LockoutDuration": "De duur dat een gebruiker wordt geblokkeerd wanneer een blokkering optreedt.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Het aantal mislukte toegangspogingen dat is toegestaan voordat een gebruiker wordt geblokkeerd, ervan uitgaande dat blokkering is ingeschakeld.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/pl-PL.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/pl-PL.json index 8d794777ee..c3c8053556 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/pl-PL.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/pl-PL.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "Hasło musi zawierać przynajmniej jedną wielką literę ('A'-'Z').", "Volo.Abp.Identity:PasswordTooShort": "Hasło musi zawierać przynajmnie {0} znaków.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "Hasło musi zawierać przynajmniej {0} unikalnych znaków.", + "Volo.Abp.Identity:PasswordInHistory": "Hasło nie może być takie samo jak ostatnie {0} haseł.", "Volo.Abp.Identity:RoleNotFound": "Rola {0} nie istnieje.", "Volo.Abp.Identity:UserAlreadyHasPassword": "Użytkownik ma już ustawione hasło.", "Volo.Abp.Identity:UserAlreadyInRole": "Użytkownik jest już przypisany do roli '{0}'.", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "Wymagana cyfra", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Wymuś użytkownikom okresowe zmiany hasła", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "Okres zmiany hasła (dni)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "Włącz zapobieganie ponownemu użyciu hasła", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "Liczba zapobiegania ponownemu użyciu hasła", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Włączone dla nowych użytkowników", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Czas trwania blokady (sekundy)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Maksymalna liczba nieudanych prób dostępu", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "Jeśli hasła muszą zawierać cyfrę.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Czy użytkownicy muszą okresowo zmieniać hasło.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "Okres zmiany hasła (dni).", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "Czy zapobiegać użytkownikom ponownego użycia ich poprzednich haseł.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "Liczba poprzednich haseł, których nie można użyć ponownie.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Czy można zablokować nowego użytkownika.", "Description:Abp.Identity.Lockout.LockoutDuration": "Czas, na jaki użytkownik jest zablokowany, gdy nastąpi blokada.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Liczba nieudanych prób dostępu dopuszczonych przed zablokowaniem użytkownika, przy założeniu, że blokada jest włączona.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/pt-BR.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/pt-BR.json index b8c4a0fdb7..40ef80556f 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/pt-BR.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/pt-BR.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "Senhas devem possuir pelo menos uma letra maiúscula ('A'-'Z').", "Volo.Abp.Identity:PasswordTooShort": "Senhas devem possuir pelo menos {0} caracteres.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "Senhas devem possuir pelo menos {0} caracteres únicos.", + "Volo.Abp.Identity:PasswordInHistory": "As senhas não devem coincidir com suas últimas {0} senhas.", "Volo.Abp.Identity:RoleNotFound": "Perfil {0} não existe.", "Volo.Abp.Identity:UserAlreadyHasPassword": "O usuário já possui uma senha.", "Volo.Abp.Identity:UserAlreadyInRole": "Usuário já possui o perfil '{0}'.", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "Dígito requerido", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Forçar usuários a alterar a senha periodicamente", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "Período de alteração de senha (dias)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "Habilitar prevenção de reutilização de senha", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "Número de reutilizações de senha a prevenir", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Habilitado para novos usuários", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Duração do bloqueio (segundos)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Máximo de tentativas de acesso malsucedidas", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "Se as senhas devem conter um dígito.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Se os usuários devem alterar sua senha periodicamente.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "O período de dias que um usuário deve esperar antes de alterar sua senha novamente.", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "Se deve impedir que os usuários reutilizem suas senhas anteriores.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "O número de senhas anteriores que não podem ser reutilizadas.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Se um novo usuário pode ser bloqueado.", "Description:Abp.Identity.Lockout.LockoutDuration": "A duração que um usuário fica bloqueado quando ocorre um bloqueio.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "O número de tentativas de acesso malsucedidas permitidas antes que um usuário seja bloqueado, assumindo que o bloqueio esteja habilitado.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/ro-RO.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/ro-RO.json index 2cde7af570..efe0c53541 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/ro-RO.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/ro-RO.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "Parolele trebuie să conţină cel puţin o majusculă ('A'-'Z').", "Volo.Abp.Identity:PasswordTooShort": "Parolele trebuie să aibă cel puţin {0} caractere.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "Parolele trebuie să conţină cel puţin {0} caractere diferite.", + "Volo.Abp.Identity:PasswordInHistory": "Parolele nu trebuie să se potrivească cu ultimele {0} parole ale dvs.", "Volo.Abp.Identity:RoleNotFound": "Rolul {0} nu există does not exist.", "Volo.Abp.Identity:UserAlreadyHasPassword": "Utilizatorul şi-a setat deja o parolă.", "Volo.Abp.Identity:UserAlreadyInRole": "Utilizatorul are deja rolul '{0}'.", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "Numărul de cifre", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Forţează utilizatorii să schimbe parola periodic", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "Perioada de schimbare a parolei (zile)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "Activează prevenirea reutilizării parolei", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "Număr de prevenire a reutilizării parolei", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Activat pentru noi utilizatori", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Durata blocării (secunde)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Numărul maxim de încercări de acces eşuate", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "Dacă parolele trebuie să conţină o cifră.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Dacă utilizatorii trebuie să schimbe parola periodic.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "Perioada de schimbare a parolei (zile).", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "Dacă să împiedice utilizatorii să își reutilizeze parolele anterioare.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "Numărul de parole anterioare care nu pot fi reutilizate.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Dacă un utilizator nou poate fi blocat.", "Description:Abp.Identity.Lockout.LockoutDuration": "Durata blocării unui utilizator când intervine blocarea.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Numărul de accesări eşuate permise înainte de a bloca un utilizator, presupunând că blocarea este activată.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/ru.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/ru.json index 8345df27b8..6afaf14b1a 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/ru.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/ru.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "Пароль должен иметь хотя бы одну букву верхнего регистра.", "Volo.Abp.Identity:PasswordTooShort": "Пароль должен содержать не менее {0} символов.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "Пароль должен содержать по крайней мере {0} уникальных символов.", + "Volo.Abp.Identity:PasswordInHistory": "Пароль не должен совпадать с вашими последними {0} паролями.", "Volo.Abp.Identity:RoleNotFound": "Роль {0} не существует.", "Volo.Abp.Identity:UserAlreadyHasPassword": "У пользователя уже установлен пароль.", "Volo.Abp.Identity:UserAlreadyInRole": "Пользователь уже имеет роль '{0}'.", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "Требуемая цифра", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Требовать периодическое изменение пароля", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "Периодичность изменения пароля (дни)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "Включить предотвращение повторного использования пароля", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "Количество предотвращений повторного использования пароля", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Включено для новых пользователей", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Длительность блокировки (секунды)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Максимальное количество неудачных попыток доступа", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "Если пароли должны содержать цифру.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Если пользователи должны периодически изменять пароль.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "Периодичность изменения пароля (дни).", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "Следует ли запретить пользователям повторно использовать свои предыдущие пароли.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "Количество предыдущих паролей, которые не могут быть использованы повторно.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Может ли новый пользователь быть заблокирован.", "Description:Abp.Identity.Lockout.LockoutDuration": "Длительность блокировки пользователя.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Число неудачных попыток доступа, после которых пользователь будет заблокирован.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/sk.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/sk.json index d9fa8dbf61..e529910a5e 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/sk.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/sk.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "Heslá musia obsahovať aspoň jedno veľké písmeno ('A'-'Z').", "Volo.Abp.Identity:PasswordTooShort": "Heslá musia mať aspoň {0} znakov.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "Heslá nesmú obsahovať viac ako {0} opakujúcich sa znakov.", + "Volo.Abp.Identity:PasswordInHistory": "Heslá sa nesmú zhodovať s vašimi poslednými {0} heslami.", "Volo.Abp.Identity:RoleNotFound": "Rola {0} neexistuje.", "Volo.Abp.Identity:UserAlreadyHasPassword": "Používateľ už má nastavené heslo.", "Volo.Abp.Identity:UserAlreadyInRole": "Používateľ už má rolu '{0}'.", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "Požadovaná číslica", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Vynútiť používateľom pravidelne meniť heslo", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "Doba platnosti hesla (v dňoch)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "Povoliť zabránenie opätovnému použitiu hesla", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "Počet zabránenia opätovnému použitiu hesla", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Povolené pre nových používateľov", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Trvanie uzamknutia (v sekundách)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Maximálny počet neúspešných pokusov o prístup", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "Či heslá musia obsahovať číslicu.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Či sa používateľom musí pravidelne meniť heslo.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "Doba platnosti hesla (v dňoch).", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "Či zabrániť používateľom v opätovnom použití ich predchádzajúcich hesiel.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "Počet predchádzajúcich hesiel, ktoré nemožno znova použiť.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Či môže byť nový používateľ uzamknutý.", "Description:Abp.Identity.Lockout.LockoutDuration": "Doba, počas ktorej je používateľ uzamknutý, keď dôjde k uzamknutiu.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Počet neúspešných pokusov o prístup pred tým, ako bol používateľ uzamknutý za predpokladu, že je uzamknutie povolené.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/sl.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/sl.json index b6d505c1c3..c02577c385 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/sl.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/sl.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "Gesla morajo imeti vsaj eno veliko črko ('A'-'Z').", "Volo.Abp.Identity:PasswordTooShort": "Gesla morajo biti dolga vsaj {0} znakov.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "Gesla ne smejo vsebovati več kot {0} zaporednih enakih znakov.", + "Volo.Abp.Identity:PasswordInHistory": "Gesla se ne smejo ujemati z vašimi zadnjimi {0} gesli.", "Volo.Abp.Identity:RoleNotFound": "Vloga {0} ne obstaja.", "Volo.Abp.Identity:UserAlreadyHasPassword": "Uporabnik že ima nastavljeno geslo.", "Volo.Abp.Identity:UserAlreadyInRole": "Uporabnik že ima dodeljeno vlogo '{0}'.", @@ -76,7 +77,7 @@ "Volo.Abp.Identity:010007": "Nastavitve dveh faktorjev ne morete spremeniti.", "Volo.Abp.Identity:010008": "Ni dovoljeno spreminjati nastavitve dveh faktorjev.", "Volo.Abp.Identity:010009": "Ne morete delegirati svojih pravic.", - "Volo.Abp.Identity:010021" : "Naziv '{0}' že obstaja.", + "Volo.Abp.Identity:010021": "Naziv '{0}' že obstaja.", "Volo.Abp.Identity:010022": "Ne morete spremeniti tipa statične deklaracije.", "Volo.Abp.Identity:010023": "Ne morete izbrisati tipa statične deklaracije.", "Identity.OrganizationUnit.MaxUserMembershipCount": "Največje dovoljeno število članov v organizacijski enoti za uporabnika", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "Zahtevana številka", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Vsakih X dni zahtevaj spremembo gesla", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "Število dni, ki jih uporabnik lahko uporablja isto geslo", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "Omogoči preprečevanje ponovne uporabe gesla", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "Število preprečevanja ponovne uporabe gesla", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Omogočeno za nove uporabnike", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Trajanje zaklepa(sekund)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Največje število neuspešnih poskusov dostopa", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "Ali morajo gesla vsebovati številko.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Ali morajo uporabniki spremeniti geslo vsakih X dni.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "Število dni, ki jih uporabnik lahko uporablja isto geslo.", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "Ali preprečiti uporabnikom ponovno uporabo svojih prejšnjih gesel.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "Število prejšnjih gesel, ki jih ni mogoče ponovno uporabiti.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Ali se nov uporabnik lahko zaklene.", "Description:Abp.Identity.Lockout.LockoutDuration": "Trajanje zaklepa uporabnika, ko pride do zaklepa.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Število neuspelih poskusov dostopa ki so dovoljeni, preden se uporabnik zaklene, ob predpostavki, da je zaklepanje omogočeno.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/sv.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/sv.json index e664adbbfe..166f32a10a 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/sv.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/sv.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "Lösenord måste innehålla minst en versal ('A'-'Z').", "Volo.Abp.Identity:PasswordTooShort": "Lösenord måste innehålla minst {0} tecken.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "Lösenord måste innehålla minst {0} olika tecken.", + "Volo.Abp.Identity:PasswordInHistory": "Lösenord får inte matcha dina senaste {0} lösenord.", "Volo.Abp.Identity:RoleNotFound": "Roll {0} finns inte.", "Volo.Abp.Identity:UserAlreadyHasPassword": "Användaren har redan ett lösenord inställt.", "Volo.Abp.Identity:UserAlreadyInRole": "Användaren har redan rollen '{0}'.", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "Nödvändig siffra", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Tvinga användare att regelbundet byta lösenord", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "Period för byte av lösenord (dagar)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "Aktivera förhindring av återanvändning av lösenord", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "Antal förhindring av återanvändning av lösenord", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Aktiverad för nya användare", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Varaktighet för låsning (sekunder)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Max misslyckade åtkomstförsök", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "Om lösenorden måste innehålla en siffra.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Om användare tvingas byta lösenord med jämna mellanrum.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "Antal dagar som en användares lösenord är giltigt.", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "Om användare ska förhindras från att återanvända sina tidigare lösenord.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "Antalet tidigare lösenord som inte kan återanvändas.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Om en ny användare kan låsas ute.", "Description:Abp.Identity.Lockout.LockoutDuration": "Den tid som en användare är utelåst när en utelåsning inträffar.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Det antal misslyckade åtkomstförsök som tillåts innan en användare låses ut, förutsatt att låsning är aktiverad.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/tr.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/tr.json index 72b232de4e..2da62b0355 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/tr.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/tr.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "Şifre en az bir büyük harf içermeli ('A'-'Z').", "Volo.Abp.Identity:PasswordTooShort": "Şifre en az {0} karakter uzunluğunda olmalı.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "Şifre en az {0} farklı karakter içermeli.", + "Volo.Abp.Identity:PasswordInHistory": "Şifre son {0} şifrenizle eşleşmemelidir.", "Volo.Abp.Identity:RoleNotFound": "{0} rolü bulunamadı.", "Volo.Abp.Identity:UserAlreadyHasPassword": "Kullanıcının zaten bir şifresi var.", "Volo.Abp.Identity:UserAlreadyInRole": "Kullanıcı zaten '{0}' rolünde.", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "Rakam gerekli", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Kullanıcıların periyodik olarak şifrelerini değiştirmelerini zorla", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "Şifre değiştirme periyodu (gün)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "Şifre yeniden kullanımını engellemeyi etkinleştir", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "Şifre yeniden kullanımını engelleme sayısı", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Yeni kullanıcılar için aktif", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Kilitli kalma süresi (saniye)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Maksimum başarısız giriş denemesi", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "Parolaların bir rakam içermesi gerekiyorsa.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Kullanıcıların periyodik olarak şifrelerini değiştirmelerini zorla.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "Kullanıcıların şifrelerini değiştirmeleri gereken gün sayısı.", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "Kullanıcıların önceki şifrelerini yeniden kullanmalarını engelleyip engellemeyeceği.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "Yeniden kullanılamayacak önceki şifrelerin sayısı.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Yeni kullanıcılar kilitlenebilir.", "Description:Abp.Identity.Lockout.LockoutDuration": "Kilitlenme olduğunda, ne kadar kilitli kalacağı.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Kilitleme etkin olduğunda, kullanıcıya kilitlenmeden önce izin verilen başarısız giriş sayısı.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/vi.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/vi.json index 39f9940090..a98baf6566 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/vi.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/vi.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "Mật khẩu phải có ít nhất một chữ hoa ('A'-'Z').", "Volo.Abp.Identity:PasswordTooShort": "Mật khẩu phải ít nhất {0} kí tự.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "Mật khẩu không được chứa {0} ký tự trùng lặp.", + "Volo.Abp.Identity:PasswordInHistory": "Mật khẩu không được trùng với {0} mật khẩu gần đây của bạn.", "Volo.Abp.Identity:RoleNotFound": "Vai trò {0} không tồn tại.", "Volo.Abp.Identity:UserAlreadyHasPassword": "Người dùng đã có một mật khẩu.", "Volo.Abp.Identity:UserAlreadyInRole": "Người dùng đã có vai trò '{0}'.", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "Chữ số bắt buộc", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Buộc người dùng thay đổi mật khẩu định kỳ", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "Thời gian thay đổi mật khẩu (ngày)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "Bật chức năng ngăn chặn tái sử dụng mật khẩu", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "Số lượng ngăn chặn tái sử dụng mật khẩu", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "Đã bật cho người dùng mới", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "Thời gian khóa (giây)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Số lần truy cập không thành công tối đa", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "Nếu mật khẩu phải chứa một chữ số.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "Nếu người dùng phải thay đổi mật khẩu của họ định kỳ.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "Số ngày mà người dùng phải thay đổi mật khẩu của họ.", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "Có ngăn người dùng tái sử dụng mật khẩu trước đó của họ hay không.", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "Số lượng mật khẩu trước đó không thể tái sử dụng.", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "Người dùng mới có thể bị khóa hay không.", "Description:Abp.Identity.Lockout.LockoutDuration": "Khoảng thời gian người dùng bị khóa khi xảy ra quá trình khóa.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "Số lần truy cập không thành công được phép trước khi người dùng bị khóa, giả sử tính năng khóa được bật.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hans.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hans.json index cfbe6bd279..0cfc117cf6 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hans.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hans.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "密码至少包含一位大写字母 ('A'-'Z')。", "Volo.Abp.Identity:PasswordTooShort": "密码至少为{0}个字符。", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "密码至少包含{0}个唯一字符。", + "Volo.Abp.Identity:PasswordInHistory": "密码不能与最近{0}次使用的密码相同。", "Volo.Abp.Identity:RoleNotFound": "角色 {0} 不存在。", "Volo.Abp.Identity:UserAlreadyHasPassword": "用户已设置密码。", "Volo.Abp.Identity:UserAlreadyInRole": "用户已具有角色 '{0}'。", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "要求数字", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "强制用户定期更改密码", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "密码更改周期(天)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "启用防止密码重用", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "防止密码重用数量", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "允许新用户", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "锁定时间(秒)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "最大失败访问尝试次数", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "密码是否必须包含数字。", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "是否强制用户定期更改密码。", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "用户必须更改密码的周期(天)。", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "是否防止用户重用以前的密码。", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "不能重用的以前密码的数量。", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "允许新用户被锁定。", "Description:Abp.Identity.Lockout.LockoutDuration": "当锁定发生时用户被的锁定的时间(秒)。", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "如果启用锁定, 当用户被锁定前失败的访问尝试次数。", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hant.json b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hant.json index b3899de248..39f6fe5267 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hant.json +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Localization/zh-Hant.json @@ -57,6 +57,7 @@ "Volo.Abp.Identity:PasswordRequiresUpper": "密碼至少包含一位大寫字母 ('A'-'Z').", "Volo.Abp.Identity:PasswordTooShort": "密碼至少為{0}個字元.", "Volo.Abp.Identity:PasswordRequiresUniqueChars": "密碼至少包含{0}個不同的字元.", + "Volo.Abp.Identity:PasswordInHistory": "密碼不能與最近{0}次使用的密碼相同.", "Volo.Abp.Identity:RoleNotFound": "角色 {0} 不存在.", "Volo.Abp.Identity:UserAlreadyHasPassword": "使用者已設置密碼.", "Volo.Abp.Identity:UserAlreadyInRole": "使用者已具有角色 '{0}'.", @@ -98,6 +99,8 @@ "DisplayName:Abp.Identity.Password.RequireDigit": "需要數字", "DisplayName:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "強制使用者定期更改密碼", "DisplayName:Abp.Identity.Password.PasswordChangePeriodDays": "密碼更改週期(天)", + "DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse": "啟用防止密碼重用", + "DisplayName:Abp.Identity.Password.PreventPasswordReuseCount": "防止密碼重用數量", "DisplayName:Abp.Identity.Lockout.AllowedForNewUsers": "允許新的使用者", "DisplayName:Abp.Identity.Lockout.LockoutDuration": "被鎖定期間(秒)", "DisplayName:Abp.Identity.Lockout.MaxFailedAccessAttempts": "最大登入次數嘗試", @@ -114,6 +117,8 @@ "Description:Abp.Identity.Password.RequireDigit": "密碼必須包含數字.", "Description:Abp.Identity.Password.ForceUsersToPeriodicallyChangePassword": "強制使用者定期更改密碼.", "Description:Abp.Identity.Password.PasswordChangePeriodDays": "密碼更改週期(天).", + "Description:Abp.Identity.Password.EnablePreventPasswordReuse": "是否防止使用者重用以前的密碼。", + "Description:Abp.Identity.Password.PreventPasswordReuseCount": "不能重用的以前密碼的數量。", "Description:Abp.Identity.Lockout.AllowedForNewUsers": "使用者是否會被鎖定.", "Description:Abp.Identity.Lockout.LockoutDuration": "使用者被鎖定後的時間.", "Description:Abp.Identity.Lockout.MaxFailedAccessAttempts": "當啟用鎖定功能,設定最大嘗試輸入次數,超過後就被鎖定.", diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Settings/IdentitySettingNames.cs b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Settings/IdentitySettingNames.cs index b36995aa3b..88ccae3761 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Settings/IdentitySettingNames.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/Settings/IdentitySettingNames.cs @@ -16,6 +16,8 @@ public static class IdentitySettingNames public const string RequireDigit = PasswordPrefix + ".RequireDigit"; public const string ForceUsersToPeriodicallyChangePassword = PasswordPrefix + ".ForceUsersToPeriodicallyChangePassword"; public const string PasswordChangePeriodDays = PasswordPrefix + ".PasswordChangePeriodDays"; + public const string EnablePreventPasswordReuse = PasswordPrefix + ".EnablePreventPasswordReuse"; + public const string PreventPasswordReuseCount = PasswordPrefix + ".PreventPasswordReuseCount"; } public static class Lockout diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Microsoft/AspNetCore/Identity/AbpIdentityResultExtensions.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Microsoft/AspNetCore/Identity/AbpIdentityResultExtensions.cs index eda4f950e5..e851cbc6cc 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Microsoft/AspNetCore/Identity/AbpIdentityResultExtensions.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Microsoft/AspNetCore/Identity/AbpIdentityResultExtensions.cs @@ -45,6 +45,8 @@ public static class AbpIdentityResultExtensions IdentityStrings["InvalidUserName"] = "Username '{0}' is invalid."; } + IdentityStrings["PasswordInHistory"] = "Passwords must not match your last {0} passwords."; + if (!IdentityStrings.Any()) { throw new AbpException("ResourceSet values of Identity is empty."); diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentitySettingDefinitionProvider.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentitySettingDefinitionProvider.cs index 7448593c77..fb1a674fb9 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentitySettingDefinitionProvider.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentitySettingDefinitionProvider.cs @@ -66,6 +66,20 @@ public class AbpIdentitySettingDefinitionProvider : SettingDefinitionProvider L("Description:Abp.Identity.Password.PasswordChangePeriodDays"), true), + new SettingDefinition( + IdentitySettingNames.Password.EnablePreventPasswordReuse, + false.ToString(), + L("DisplayName:Abp.Identity.Password.EnablePreventPasswordReuse"), + L("Description:Abp.Identity.Password.EnablePreventPasswordReuse"), + true), + + new SettingDefinition( + IdentitySettingNames.Password.PreventPasswordReuseCount, + 6.ToString(), + L("DisplayName:Abp.Identity.Password.PreventPasswordReuseCount"), + L("Description:Abp.Identity.Password.PreventPasswordReuseCount"), + true), + new SettingDefinition( IdentitySettingNames.Lockout.AllowedForNewUsers, true.ToString(), diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUser.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUser.cs index ec5db2fe90..be9ccfe8bb 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUser.cs +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUser.cs @@ -154,6 +154,11 @@ public class IdentityUser : FullAuditedAggregateRoot, IUser, IHasEntityVer /// public virtual ICollection OrganizationUnits { get; protected set; } + /// + /// Navigation property for this users password history. + /// + public virtual ICollection PasswordHistories { get; protected set; } + protected IdentityUser() { } @@ -182,6 +187,7 @@ public class IdentityUser : FullAuditedAggregateRoot, IUser, IHasEntityVer Logins = new Collection(); Tokens = new Collection(); OrganizationUnits = new Collection(); + PasswordHistories = new Collection(); } public virtual void AddRole(Guid roleId) @@ -345,6 +351,15 @@ public class IdentityUser : FullAuditedAggregateRoot, IUser, IHasEntityVer ); } + public virtual void AddPasswordHistory(string password) + { + PasswordHistories.Add(new IdentityUserPasswordHistory( + Id, + password, + TenantId) + ); + } + /// /// Use for regular email confirmation. /// Using this skips the confirmation process and directly sets the . diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserPasswordHistory.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserPasswordHistory.cs new file mode 100644 index 0000000000..cdfd94b35d --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUserPasswordHistory.cs @@ -0,0 +1,49 @@ +using System; +using System.Diagnostics.CodeAnalysis; +using Volo.Abp.Domain.Entities; +using Volo.Abp.MultiTenancy; + +namespace Volo.Abp.Identity; + +/// +/// Represents a password history entry for a user. +/// +public class IdentityUserPasswordHistory : Entity, IMultiTenant +{ + public virtual Guid? TenantId { get; protected set; } + + /// + /// Gets or sets the primary key of the user associated with this password history entry. + /// + public virtual Guid UserId { get; protected set; } + + /// + /// Gets or sets the password. + /// + public virtual string Password { get; protected set; } + + public virtual DateTimeOffset CreatedAt { get; protected set; } + + protected IdentityUserPasswordHistory() + { + + } + + protected internal IdentityUserPasswordHistory( + Guid userId, + [NotNull] string password, + Guid? tenantId) + { + Check.NotNull(password, nameof(password)); + + UserId = userId; + Password = password; + CreatedAt = DateTimeOffset.UtcNow; + TenantId = tenantId; + } + + public override object[] GetKeys() + { + return new object[] { UserId, Password }; + } +} diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs index f94f4690cc..1b396754a8 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityDbContextModelBuilderExtensions.cs @@ -46,6 +46,7 @@ public static class IdentityDbContextModelBuilderExtensions b.HasMany(u => u.Roles).WithOne().HasForeignKey(ur => ur.UserId).IsRequired(); b.HasMany(u => u.Tokens).WithOne().HasForeignKey(ur => ur.UserId).IsRequired(); b.HasMany(u => u.OrganizationUnits).WithOne().HasForeignKey(ur => ur.UserId).IsRequired(); + b.HasMany(u => u.PasswordHistories).WithOne().HasForeignKey(ur => ur.UserId).IsRequired(); b.HasIndex(u => u.NormalizedUserName); b.HasIndex(u => u.NormalizedEmail); @@ -224,6 +225,19 @@ public static class IdentityDbContextModelBuilderExtensions b.ApplyObjectExtensionMappings(); }); + builder.Entity(b => + { + b.ToTable(AbpIdentityDbProperties.DbTablePrefix + "UserPasswordHistories", AbpIdentityDbProperties.DbSchema); + + b.ConfigureByConvention(); + + b.HasKey(x => new { x.UserId, x.Password }); + + b.Property(x => x.Password).HasMaxLength(IdentityUserPasswordHistoriesConsts.MaxPasswordLength).IsRequired(); + + b.ApplyObjectExtensionMappings(); + }); + builder.Entity(b => { b.ToTable(AbpIdentityDbProperties.DbTablePrefix + "SecurityLogs", AbpIdentityDbProperties.DbSchema); diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityEfCoreQueryableExtensions.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityEfCoreQueryableExtensions.cs index 2f04fbbe62..0d51910e97 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityEfCoreQueryableExtensions.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/IdentityEfCoreQueryableExtensions.cs @@ -17,7 +17,8 @@ public static class IdentityEfCoreQueryableExtensions .Include(x => x.Logins) .Include(x => x.Claims) .Include(x => x.Tokens) - .Include(x => x.OrganizationUnits); + .Include(x => x.OrganizationUnits) + .Include(x => x.PasswordHistories); } public static IQueryable IncludeDetails(this IQueryable queryable, bool include = true) diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/EmailSettingGroup/EmailSettingGroupViewComponent.razor.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/EmailSettingGroup/EmailSettingGroupViewComponent.razor.cs index 885a556991..b4eb29c400 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/EmailSettingGroup/EmailSettingGroupViewComponent.razor.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/EmailSettingGroup/EmailSettingGroupViewComponent.razor.cs @@ -119,6 +119,8 @@ public partial class EmailSettingGroupViewComponent await EmailSettingsAppService.SendTestEmailAsync(ObjectMapper.Map(SendTestEmailInput)); await Notify.Success(L["SentSuccessfully"]); + + await CloseSendTestEmailModalAsync(); } catch (Exception ex) { diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Components/EmailSettingGroup/Default.js b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Components/EmailSettingGroup/Default.js index 6dd040ad5c..936ef46c88 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Components/EmailSettingGroup/Default.js +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/Components/EmailSettingGroup/Default.js @@ -41,6 +41,7 @@ _sendTestEmailModal.onResult(function () { abp.notify.success(l('SentSuccessfully')); + _sendTestEmailModal.close(); }); $("#SendTestEmailButton").click(function (e) { diff --git a/nupkg/common.ps1 b/nupkg/common.ps1 index 20b08ac2ac..6fbc34e80c 100644 --- a/nupkg/common.ps1 +++ b/nupkg/common.ps1 @@ -148,9 +148,11 @@ $projects = ( "framework/src/Volo.Abp.BackgroundJobs.HangFire", "framework/src/Volo.Abp.BackgroundJobs.RabbitMQ", "framework/src/Volo.Abp.BackgroundJobs.Quartz", + "framework/src/Volo.Abp.BackgroundJobs.TickerQ", "framework/src/Volo.Abp.BackgroundWorkers", "framework/src/Volo.Abp.BackgroundWorkers.Quartz", "framework/src/Volo.Abp.BackgroundWorkers.Hangfire", + "framework/src/Volo.Abp.BackgroundWorkers.TickerQ", "framework/src/Volo.Abp.BlazoriseUI", "framework/src/Volo.Abp.BlobStoring", "framework/src/Volo.Abp.BlobStoring.FileSystem", @@ -201,6 +203,7 @@ $projects = ( "framework/src/Volo.Abp.GlobalFeatures", "framework/src/Volo.Abp.Guids", "framework/src/Volo.Abp.HangFire", + "framework/src/Volo.Abp.TickerQ", "framework/src/Volo.Abp.Http.Abstractions", "framework/src/Volo.Abp.Http.Client", "framework/src/Volo.Abp.Http.Client.Dapr",