feat: add modular monolith source

This commit is contained in:
Meysam Hadeli 2025-04-06 17:56:12 +03:30
parent 27d25aa47d
commit d278e36fd2
5 changed files with 11 additions and 11 deletions

View File

@ -67,12 +67,12 @@ public static class SharedInfrastructureExtensions
partitionKey: httpContext.User.Identity?.Name ?? partitionKey: httpContext.User.Identity?.Name ??
httpContext.Request.Headers.Host.ToString(), httpContext.Request.Headers.Host.ToString(),
factory: partition => new FixedWindowRateLimiterOptions factory: partition => new FixedWindowRateLimiterOptions
{ {
AutoReplenishment = true, AutoReplenishment = true,
PermitLimit = 10, PermitLimit = 10,
QueueLimit = 0, QueueLimit = 0,
Window = TimeSpan.FromMinutes(1) Window = TimeSpan.FromMinutes(1)
})); }));
}); });
builder.AddCustomObservability(); builder.AddCustomObservability();

View File

@ -70,7 +70,7 @@ where TResponse : notnull
using var scope = new TransactionScope( using var scope = new TransactionScope(
TransactionScopeOption.Required, TransactionScopeOption.Required,
new TransactionOptions {IsolationLevel = IsolationLevel.ReadCommitted}, new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted },
TransactionScopeAsyncFlowOption.Enabled); TransactionScopeAsyncFlowOption.Enabled);
await _eventDispatcher.SendAsync( await _eventDispatcher.SendAsync(

View File

@ -49,12 +49,12 @@ public class IdentityDataSeeder : IDataSeeder
{ {
if (await _roleManager.RoleExistsAsync(Constants.Role.Admin) == false) if (await _roleManager.RoleExistsAsync(Constants.Role.Admin) == false)
{ {
await _roleManager.CreateAsync(new Role {Name = Constants.Role.Admin}); await _roleManager.CreateAsync(new Role { Name = Constants.Role.Admin });
} }
if (await _roleManager.RoleExistsAsync(Constants.Role.User) == false) if (await _roleManager.RoleExistsAsync(Constants.Role.User) == false)
{ {
await _roleManager.CreateAsync(new Role {Name = Constants.Role.User}); await _roleManager.CreateAsync(new Role { Name = Constants.Role.User });
} }
} }
} }

View File

@ -70,7 +70,7 @@ where TResponse : notnull
using var scope = new TransactionScope( using var scope = new TransactionScope(
TransactionScopeOption.Required, TransactionScopeOption.Required,
new TransactionOptions {IsolationLevel = IsolationLevel.ReadCommitted}, new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted },
TransactionScopeAsyncFlowOption.Enabled); TransactionScopeAsyncFlowOption.Enabled);
await _eventDispatcher.SendAsync( await _eventDispatcher.SendAsync(

View File

@ -9,7 +9,7 @@ namespace BuildingBlocks.Mongo
public static class Extensions public static class Extensions
{ {
public static IServiceCollection AddMongoDbContext<TContext>( public static IServiceCollection AddMongoDbContext<TContext>(
this WebApplicationBuilder builder, Action<MongoOptions>? configurator = null) this WebApplicationBuilder builder, Action<MongoOptions>? configurator = null)
where TContext : MongoDbContext where TContext : MongoDbContext
{ {
return builder.Services.AddMongoDbContext<TContext, TContext>(builder.Configuration, configurator); return builder.Services.AddMongoDbContext<TContext, TContext>(builder.Configuration, configurator);