diff --git a/src/CSharp/EasyMicroservices.Cores.AspCoreApi/Authorizations/AspCoreAuthorization.cs b/src/CSharp/EasyMicroservices.Cores.AspCoreApi/Authorizations/AspCoreAuthorization.cs
index 3759d2c..9e9db2e 100644
--- a/src/CSharp/EasyMicroservices.Cores.AspCoreApi/Authorizations/AspCoreAuthorization.cs
+++ b/src/CSharp/EasyMicroservices.Cores.AspCoreApi/Authorizations/AspCoreAuthorization.cs
@@ -1,5 +1,6 @@
using EasyMicroservices.Cores.AspCoreApi.Interfaces;
using EasyMicroservices.Cores.Database.Interfaces;
+using EasyMicroservices.Cores.Interfaces;
using EasyMicroservices.ServiceContracts;
using EasyMicroservices.Utilities.Collections.Generic;
using Microsoft.AspNetCore.Authorization;
@@ -23,9 +24,9 @@ public class AspCoreAuthorization : IAuthorization
///
///
///
- public AspCoreAuthorization(IUniqueIdentityManager uniqueIdentityManager)
+ public AspCoreAuthorization(IBaseUnitOfWork baseUnitOfWork)
{
- UniqueIdentityManager = uniqueIdentityManager;
+ UniqueIdentityManager = baseUnitOfWork.GetUniqueIdentityManager();
}
///
diff --git a/src/CSharp/EasyMicroservices.Cores.AspCoreApi/EasyMicroservices.Cores.AspCoreApi.csproj b/src/CSharp/EasyMicroservices.Cores.AspCoreApi/EasyMicroservices.Cores.AspCoreApi.csproj
index 1764eb3..2275d2d 100644
--- a/src/CSharp/EasyMicroservices.Cores.AspCoreApi/EasyMicroservices.Cores.AspCoreApi.csproj
+++ b/src/CSharp/EasyMicroservices.Cores.AspCoreApi/EasyMicroservices.Cores.AspCoreApi.csproj
@@ -5,7 +5,7 @@
AnyCPU;x64;x86
EasyMicroservices
true
- 0.0.0.44
+ 0.0.0.45
asp core servces.
EasyMicroservices@gmail.com
core,cores,base,database,services,asp,aspnet
diff --git a/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/EasyMicroservices.Cores.AspEntityFrameworkCoreApi.csproj b/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/EasyMicroservices.Cores.AspEntityFrameworkCoreApi.csproj
index 5d84e48..91b5637 100644
--- a/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/EasyMicroservices.Cores.AspEntityFrameworkCoreApi.csproj
+++ b/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/EasyMicroservices.Cores.AspEntityFrameworkCoreApi.csproj
@@ -5,7 +5,7 @@
AnyCPU;x64;x86
EasyMicroservices
true
- 0.0.0.44
+ 0.0.0.45
asp core servces.
EasyMicroservices@gmail.com
core,cores,base,database,services,asp,aspnet,aspcore,efcore
diff --git a/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/StartUpExtensions.cs b/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/StartUpExtensions.cs
index 051d3a0..80c2506 100644
--- a/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/StartUpExtensions.cs
+++ b/src/CSharp/EasyMicroservices.Cores.AspEntityFrameworkCoreApi/StartUpExtensions.cs
@@ -1,12 +1,10 @@
-using EasyMicroservices.Cores.AspEntityFrameworkCoreApi.Interfaces;
+using EasyMicroservices.Cores.AspCoreApi.Authorizations;
+using EasyMicroservices.Cores.AspEntityFrameworkCoreApi.Interfaces;
using EasyMicroservices.Cores.AspEntityFrameworkCoreApi.Middlewares;
+using EasyMicroservices.Cores.Interfaces;
using EasyMicroservices.Cores.Relational.EntityFrameworkCore;
using EasyMicroservices.Cores.Relational.EntityFrameworkCore.Builders;
-using EasyMicroservices.ServiceContracts;
-using EasyMicroservices.ServiceContracts.Exceptions;
using Microsoft.AspNetCore.Builder;
-using Microsoft.AspNetCore.Diagnostics;
-using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.OpenApi.Any;
@@ -14,10 +12,7 @@
using Swashbuckle.AspNetCore.SwaggerGen;
using System;
using System.Linq;
-using System.Net;
-using System.Net.Mime;
using System.Text;
-using System.Text.Json;
using System.Threading.Tasks;
namespace EasyMicroservices.Cores.AspEntityFrameworkCoreApi
@@ -62,6 +57,7 @@ public static IServiceCollection Builder(this IServiceCollection servi
services.AddHttpContextAccessor();
services.AddScoped(service => new UnitOfWork(service));
+ services.AddScoped();
services.AddScoped(service => new UnitOfWork(service).GetMapper());
services.AddTransient(serviceProvider => serviceProvider.GetService());
services.AddExceptionHandler((option) =>
@@ -97,19 +93,22 @@ public static async Task Build(this IApplicationBuilder app)
var dbbuilder = new DatabaseCreator();
using var context = scope.ServiceProvider.GetRequiredService();
dbbuilder.Initialize(context);
- if (WhiteLabelRoute.HasValue() || ConfigName.HasValue())
+ if (WhiteLabelRoute.HasValue() || WhiteLabelConfigName.HasValue())
{
using var uow = scope.ServiceProvider.GetRequiredService() as UnitOfWork;
- await uow.Initialize(MicroserviceName, config.GetValue(ConfigName), typeof(TContext)).ConfigureAwait(false);
+ await uow.Initialize(MicroserviceName, config.GetValue(WhiteLabelConfigName), typeof(TContext)).ConfigureAwait(false);
}
+ if (AuthenticationConfigName.HasValue())
+ AspCoreAuthorization.AuthenticationRouteAddress = config.GetValue(AuthenticationConfigName);
}
var build = app.Build();
app.Run(build);
}
private static string MicroserviceName = default;
- private static string ConfigName = default;
+ private static string WhiteLabelConfigName = default;
private static string WhiteLabelRoute = default;
+ private static string AuthenticationConfigName = default;
///
///
///
@@ -118,7 +117,16 @@ public static async Task Build(this IApplicationBuilder app)
public static void AddWhiteLabel(string microserviceName, string configName)
{
MicroserviceName = microserviceName;
- ConfigName = configName;
+ WhiteLabelConfigName = configName;
+ }
+
+ ///
+ ///
+ ///
+ ///
+ public static void AddAuthentication(string configName)
+ {
+ AuthenticationConfigName = configName;
}
///
@@ -170,11 +178,13 @@ public static async Task Build(this WebApplicationBuil
using var context = scope.ServiceProvider.GetRequiredService();
dbbuilder.Initialize(context);
using var uow = scope.ServiceProvider.GetRequiredService() as UnitOfWork;
- if (WhiteLabelRoute.HasValue() || ConfigName.HasValue())
+ if (WhiteLabelRoute.HasValue() || WhiteLabelConfigName.HasValue())
{
- var value = WhiteLabelRoute ?? config.GetValue(ConfigName);
- await uow.Initialize(MicroserviceName, WhiteLabelRoute ?? config.GetValue(ConfigName), typeof(TContext)).ConfigureAwait(false);
+ var value = WhiteLabelRoute ?? config.GetValue(WhiteLabelConfigName);
+ await uow.Initialize(MicroserviceName, WhiteLabelRoute ?? config.GetValue(WhiteLabelConfigName), typeof(TContext)).ConfigureAwait(false);
}
+ if (AuthenticationConfigName.HasValue())
+ AspCoreAuthorization.AuthenticationRouteAddress = config.GetValue(AuthenticationConfigName);
}
return build;
}
diff --git a/src/CSharp/EasyMicroservices.Cores.Contracts/EasyMicroservices.Cores.Contracts.csproj b/src/CSharp/EasyMicroservices.Cores.Contracts/EasyMicroservices.Cores.Contracts.csproj
index 511c03a..0d0782e 100644
--- a/src/CSharp/EasyMicroservices.Cores.Contracts/EasyMicroservices.Cores.Contracts.csproj
+++ b/src/CSharp/EasyMicroservices.Cores.Contracts/EasyMicroservices.Cores.Contracts.csproj
@@ -5,7 +5,7 @@
AnyCPU;x64;x86
EasyMicroservices
true
- 0.0.0.44
+ 0.0.0.45
core contracts.
EasyMicroservices@gmail.com
core,cores,base,contract,contracts,dto,dtos
diff --git a/src/CSharp/EasyMicroservices.Cores.Database/EasyMicroservices.Cores.Database.csproj b/src/CSharp/EasyMicroservices.Cores.Database/EasyMicroservices.Cores.Database.csproj
index cc54778..19db835 100644
--- a/src/CSharp/EasyMicroservices.Cores.Database/EasyMicroservices.Cores.Database.csproj
+++ b/src/CSharp/EasyMicroservices.Cores.Database/EasyMicroservices.Cores.Database.csproj
@@ -5,7 +5,7 @@
AnyCPU;x64;x86
EasyMicroservices
true
- 0.0.0.44
+ 0.0.0.45
core of database.
EasyMicroservices@gmail.com
core,cores,base,database
diff --git a/src/CSharp/EasyMicroservices.Cores.EntityFrameworkCore/EasyMicroservices.Cores.EntityFrameworkCore.csproj b/src/CSharp/EasyMicroservices.Cores.EntityFrameworkCore/EasyMicroservices.Cores.EntityFrameworkCore.csproj
index 280cc35..3ac7997 100644
--- a/src/CSharp/EasyMicroservices.Cores.EntityFrameworkCore/EasyMicroservices.Cores.EntityFrameworkCore.csproj
+++ b/src/CSharp/EasyMicroservices.Cores.EntityFrameworkCore/EasyMicroservices.Cores.EntityFrameworkCore.csproj
@@ -5,7 +5,7 @@
AnyCPU;x64;x86
EasyMicroservices
true
- 0.0.0.44
+ 0.0.0.45
ef core of database.
EasyMicroservices@gmail.com
core,cores,base,database,ef,efcore
diff --git a/src/CSharp/EasyMicroservices.Cores.Relational.EntityFrameworkCore/EasyMicroservices.Cores.Relational.EntityFrameworkCore.csproj b/src/CSharp/EasyMicroservices.Cores.Relational.EntityFrameworkCore/EasyMicroservices.Cores.Relational.EntityFrameworkCore.csproj
index e7cf1b6..f0e2783 100644
--- a/src/CSharp/EasyMicroservices.Cores.Relational.EntityFrameworkCore/EasyMicroservices.Cores.Relational.EntityFrameworkCore.csproj
+++ b/src/CSharp/EasyMicroservices.Cores.Relational.EntityFrameworkCore/EasyMicroservices.Cores.Relational.EntityFrameworkCore.csproj
@@ -5,7 +5,7 @@
AnyCPU;x64;x86
EasyMicroservices
true
- 0.0.0.44
+ 0.0.0.45
ef core of Relational database.
EasyMicroservices@gmail.com
core,cores,base,database,ef,efcore,Relational