Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
suxrobGM committed Jan 18, 2024
1 parent 5855f1f commit 8609ae1
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/Core/Logistics.Infrastructure.EF/Data/TenantDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ public class TenantDbContext : DbContext
private readonly string _connectionString;

public TenantDbContext(
TenantDbContextOptions tenantDbContextOptions,
ITenantService? tenantService,
DispatchDomainEventsInterceptor? dispatchDomainEventsInterceptor)
TenantDbContextOptions? tenantDbContextOptions = null,
ITenantService? tenantService = null,
DispatchDomainEventsInterceptor? dispatchDomainEventsInterceptor = null)
{
_dispatchDomainEventsInterceptor = dispatchDomainEventsInterceptor;
_connectionString = tenantDbContextOptions.ConnectionString ?? ConnectionStrings.LocalDefaultTenant;
_connectionString = tenantDbContextOptions?.ConnectionString ?? ConnectionStrings.LocalDefaultTenant;
TenantService = tenantService;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ public class TenantDbContextFactory : IDesignTimeDbContextFactory<TenantDbContex
{
public TenantDbContext CreateDbContext(string[] args)
{
return new TenantDbContext(new TenantDbContextOptions(), null, null);
return new TenantDbContext();
}
}
2 changes: 1 addition & 1 deletion src/Core/Logistics.Infrastructure.EF/Registrar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public static class Registrar
services.AddSingleton(tenantsSettings);
}

if (string.IsNullOrEmpty(connectionString))
if (!string.IsNullOrEmpty(connectionString))
{
var options = new TenantDbContextOptions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ namespace Logistics.Infrastructure.EF.Services;

internal class TenantService : ITenantService
{
private readonly TenantDbContextOptions _dbContextOptions;
private readonly TenantDbContextOptions? _dbContextOptions;
private readonly MasterDbContext _masterDbContext;
private readonly HttpContext? _httpContext;
private Tenant? _currentTenant;

public TenantService(
TenantDbContextOptions dbContextContextOptions,
MasterDbContext masterDbContext,
TenantDbContextOptions? dbContextContextOptions = null,
IHttpContextAccessor? contextAccessor = null)
{
_dbContextOptions = dbContextContextOptions;
Expand All @@ -36,7 +36,7 @@ public Tenant GetTenant()
var defaultTenant = new Tenant
{
Name = "default",
ConnectionString = _dbContextOptions.ConnectionString,
ConnectionString = _dbContextOptions?.ConnectionString ?? ConnectionStrings.LocalDefaultTenant,
};

_currentTenant = defaultTenant;
Expand Down
3 changes: 2 additions & 1 deletion src/Server/Logistics.API/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
]
},
"ConnectionStrings": {
"MasterDatabase": "Server=.\\SQLEXPRESS; Database=master_logistics; Uid=LogisticsUser; Pwd=Test12345; TrustServerCertificate=true"
"MasterDatabase": "Server=.\\SQLEXPRESS; Database=master_logistics; Uid=LogisticsUser; Pwd=Test12345; TrustServerCertificate=true",
"DefaultTenantDatabase": "Server=.\\SQLEXPRESS; Database=default_logistics; Uid=LogisticsUser; Pwd=Test12345#;"
},
"IdentityServer": {
"Authority": "https://localhost:7001",
Expand Down
2 changes: 1 addition & 1 deletion src/Shared/Logistics.Shared.Core/PagedQuery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class PagedQuery
int page = 1,
int pageSize = 10)
{
OrderBy = orderBy ?? string.Empty;
OrderBy = orderBy;
Page = page;
PageSize = pageSize;
}
Expand Down

0 comments on commit 8609ae1

Please sign in to comment.