mirror of
https://github.com/meysamhadeli/booking-microservices.git
synced 2026-05-01 10:40:41 +08:00
feat: add modular monolith source
This commit is contained in:
parent
27d25aa47d
commit
d278e36fd2
@ -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();
|
||||||
|
|||||||
@ -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(
|
||||||
|
|||||||
@ -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 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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(
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user