Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 94 additions & 50 deletions Masa.Contrib.sln
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,23 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.SearchEngine.A
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.BuildingBlocks.Isolation", "src\BuildingBlocks\MASA.BuildingBlocks\src\Isolation\Masa.BuildingBlocks.Isolation\Masa.BuildingBlocks.Isolation.csproj", "{B689E82B-B3E8-4C83-B56C-D4C27206AAC6}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Isolation.UoW.EF", "src\Isolation\Masa.Contrib.Isolation.UoW.EF\Masa.Contrib.Isolation.UoW.EF.csproj", "{0C25062D-60A5-4690-974A-CDA9619866B4}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Isolation", "src\Isolation\Masa.Contrib.Isolation\Masa.Contrib.Isolation.csproj", "{F52E5BA6-C2D4-4797-AF71-6389FEC246B5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Isolation.MultiTenant", "src\Isolation\Masa.Contrib.Isolation.MultiTenant\Masa.Contrib.Isolation.MultiTenant.csproj", "{6D9A3F62-8AB6-40AD-B32F-2A435A9D3341}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Isolation.MultiEnvironment", "src\Isolation\Masa.Contrib.Isolation.MultiEnvironment\Masa.Contrib.Isolation.MultiEnvironment.csproj", "{823D2A6E-20AB-45FF-AD07-5E7933FA6DE7}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Isolation.Environment", "src\Isolation\Masa.Contrib.Isolation.Environment\Masa.Contrib.Isolation.Environment.csproj", "{E9A3C62C-EA85-40C3-BB3B-7836D0337F63}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Isolation.MultiTenant", "src\Isolation\Masa.Contrib.Isolation.MultiTenant\Masa.Contrib.Isolation.MultiTenant.csproj", "{7C382E43-A515-4C67-9296-FB8A630C4A49}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Isolation.UoW.EF.Tests", "test\Masa.Contrib.Isolation.UoW.EF.Tests\Masa.Contrib.Isolation.UoW.EF.Tests.csproj", "{50551732-AAE0-4F77-B401-9DD02E226CDB}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Isolation.UoW.EF", "src\Isolation\Masa.Contrib.Isolation.UoW.EF\Masa.Contrib.Isolation.UoW.EF.csproj", "{95AF448B-F34C-4DF8-9E9B-DF499FABA099}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Contrib.Isolation.UoW.EF.Web.Tests", "test\Masa.Contrib.Isolation.UoW.EF.Web.Tests\Masa.Contrib.Isolation.UoW.EF.Web.Tests.csproj", "{7CF33D08-9468-464D-B52E-955A5667EE42}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Isolation.MultiEnvironment.Tests", "test\Masa.Contrib.Isolation.MultiEnvironment.Tests\Masa.Contrib.Isolation.MultiEnvironment.Tests.csproj", "{4C3307D4-2A6B-41E3-BE9E-2FD083578450}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Isolation.MultiTenant.Tests", "test\Masa.Contrib.Isolation.MultiTenant.Tests\Masa.Contrib.Isolation.MultiTenant.Tests.csproj", "{AA1993F7-5BAE-45F8-A8F5-31E88A25ED83}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Isolation.Tests", "test\Masa.Contrib.Isolation.Tests\Masa.Contrib.Isolation.Tests.csproj", "{F1826D84-1A16-41A4-A57B-F0DBB5A18745}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Isolation.UoW.EF.Tests", "test\Masa.Contrib.Isolation.UoW.EF.Tests\Masa.Contrib.Isolation.UoW.EF.Tests.csproj", "{2E1EEC9C-37C9-4C03-A4BC-58306F8B1C38}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Masa.Contrib.Isolation.UoW.EF.Web.Tests", "test\Masa.Contrib.Isolation.UoW.EF.Web.Tests\Masa.Contrib.Isolation.UoW.EF.Web.Tests.csproj", "{F4B8D71B-DAE4-4948-A1DC-42B42DE31D4F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -524,46 +532,78 @@ Global
{B689E82B-B3E8-4C83-B56C-D4C27206AAC6}.Release|Any CPU.Build.0 = Release|Any CPU
{B689E82B-B3E8-4C83-B56C-D4C27206AAC6}.Release|x64.ActiveCfg = Release|Any CPU
{B689E82B-B3E8-4C83-B56C-D4C27206AAC6}.Release|x64.Build.0 = Release|Any CPU
{0C25062D-60A5-4690-974A-CDA9619866B4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0C25062D-60A5-4690-974A-CDA9619866B4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0C25062D-60A5-4690-974A-CDA9619866B4}.Debug|x64.ActiveCfg = Debug|Any CPU
{0C25062D-60A5-4690-974A-CDA9619866B4}.Debug|x64.Build.0 = Debug|Any CPU
{0C25062D-60A5-4690-974A-CDA9619866B4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0C25062D-60A5-4690-974A-CDA9619866B4}.Release|Any CPU.Build.0 = Release|Any CPU
{0C25062D-60A5-4690-974A-CDA9619866B4}.Release|x64.ActiveCfg = Release|Any CPU
{0C25062D-60A5-4690-974A-CDA9619866B4}.Release|x64.Build.0 = Release|Any CPU
{6D9A3F62-8AB6-40AD-B32F-2A435A9D3341}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D9A3F62-8AB6-40AD-B32F-2A435A9D3341}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D9A3F62-8AB6-40AD-B32F-2A435A9D3341}.Debug|x64.ActiveCfg = Debug|Any CPU
{6D9A3F62-8AB6-40AD-B32F-2A435A9D3341}.Debug|x64.Build.0 = Debug|Any CPU
{6D9A3F62-8AB6-40AD-B32F-2A435A9D3341}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D9A3F62-8AB6-40AD-B32F-2A435A9D3341}.Release|Any CPU.Build.0 = Release|Any CPU
{6D9A3F62-8AB6-40AD-B32F-2A435A9D3341}.Release|x64.ActiveCfg = Release|Any CPU
{6D9A3F62-8AB6-40AD-B32F-2A435A9D3341}.Release|x64.Build.0 = Release|Any CPU
{E9A3C62C-EA85-40C3-BB3B-7836D0337F63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E9A3C62C-EA85-40C3-BB3B-7836D0337F63}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E9A3C62C-EA85-40C3-BB3B-7836D0337F63}.Debug|x64.ActiveCfg = Debug|Any CPU
{E9A3C62C-EA85-40C3-BB3B-7836D0337F63}.Debug|x64.Build.0 = Debug|Any CPU
{E9A3C62C-EA85-40C3-BB3B-7836D0337F63}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E9A3C62C-EA85-40C3-BB3B-7836D0337F63}.Release|Any CPU.Build.0 = Release|Any CPU
{E9A3C62C-EA85-40C3-BB3B-7836D0337F63}.Release|x64.ActiveCfg = Release|Any CPU
{E9A3C62C-EA85-40C3-BB3B-7836D0337F63}.Release|x64.Build.0 = Release|Any CPU
{50551732-AAE0-4F77-B401-9DD02E226CDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{50551732-AAE0-4F77-B401-9DD02E226CDB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{50551732-AAE0-4F77-B401-9DD02E226CDB}.Debug|x64.ActiveCfg = Debug|Any CPU
{50551732-AAE0-4F77-B401-9DD02E226CDB}.Debug|x64.Build.0 = Debug|Any CPU
{50551732-AAE0-4F77-B401-9DD02E226CDB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{50551732-AAE0-4F77-B401-9DD02E226CDB}.Release|Any CPU.Build.0 = Release|Any CPU
{50551732-AAE0-4F77-B401-9DD02E226CDB}.Release|x64.ActiveCfg = Release|Any CPU
{50551732-AAE0-4F77-B401-9DD02E226CDB}.Release|x64.Build.0 = Release|Any CPU
{7CF33D08-9468-464D-B52E-955A5667EE42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7CF33D08-9468-464D-B52E-955A5667EE42}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7CF33D08-9468-464D-B52E-955A5667EE42}.Debug|x64.ActiveCfg = Debug|Any CPU
{7CF33D08-9468-464D-B52E-955A5667EE42}.Debug|x64.Build.0 = Debug|Any CPU
{7CF33D08-9468-464D-B52E-955A5667EE42}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7CF33D08-9468-464D-B52E-955A5667EE42}.Release|Any CPU.Build.0 = Release|Any CPU
{7CF33D08-9468-464D-B52E-955A5667EE42}.Release|x64.ActiveCfg = Release|Any CPU
{7CF33D08-9468-464D-B52E-955A5667EE42}.Release|x64.Build.0 = Release|Any CPU
{F52E5BA6-C2D4-4797-AF71-6389FEC246B5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F52E5BA6-C2D4-4797-AF71-6389FEC246B5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F52E5BA6-C2D4-4797-AF71-6389FEC246B5}.Debug|x64.ActiveCfg = Debug|Any CPU
{F52E5BA6-C2D4-4797-AF71-6389FEC246B5}.Debug|x64.Build.0 = Debug|Any CPU
{F52E5BA6-C2D4-4797-AF71-6389FEC246B5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F52E5BA6-C2D4-4797-AF71-6389FEC246B5}.Release|Any CPU.Build.0 = Release|Any CPU
{F52E5BA6-C2D4-4797-AF71-6389FEC246B5}.Release|x64.ActiveCfg = Release|Any CPU
{F52E5BA6-C2D4-4797-AF71-6389FEC246B5}.Release|x64.Build.0 = Release|Any CPU
{823D2A6E-20AB-45FF-AD07-5E7933FA6DE7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{823D2A6E-20AB-45FF-AD07-5E7933FA6DE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{823D2A6E-20AB-45FF-AD07-5E7933FA6DE7}.Debug|x64.ActiveCfg = Debug|Any CPU
{823D2A6E-20AB-45FF-AD07-5E7933FA6DE7}.Debug|x64.Build.0 = Debug|Any CPU
{823D2A6E-20AB-45FF-AD07-5E7933FA6DE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{823D2A6E-20AB-45FF-AD07-5E7933FA6DE7}.Release|Any CPU.Build.0 = Release|Any CPU
{823D2A6E-20AB-45FF-AD07-5E7933FA6DE7}.Release|x64.ActiveCfg = Release|Any CPU
{823D2A6E-20AB-45FF-AD07-5E7933FA6DE7}.Release|x64.Build.0 = Release|Any CPU
{7C382E43-A515-4C67-9296-FB8A630C4A49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7C382E43-A515-4C67-9296-FB8A630C4A49}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7C382E43-A515-4C67-9296-FB8A630C4A49}.Debug|x64.ActiveCfg = Debug|Any CPU
{7C382E43-A515-4C67-9296-FB8A630C4A49}.Debug|x64.Build.0 = Debug|Any CPU
{7C382E43-A515-4C67-9296-FB8A630C4A49}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7C382E43-A515-4C67-9296-FB8A630C4A49}.Release|Any CPU.Build.0 = Release|Any CPU
{7C382E43-A515-4C67-9296-FB8A630C4A49}.Release|x64.ActiveCfg = Release|Any CPU
{7C382E43-A515-4C67-9296-FB8A630C4A49}.Release|x64.Build.0 = Release|Any CPU
{95AF448B-F34C-4DF8-9E9B-DF499FABA099}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{95AF448B-F34C-4DF8-9E9B-DF499FABA099}.Debug|Any CPU.Build.0 = Debug|Any CPU
{95AF448B-F34C-4DF8-9E9B-DF499FABA099}.Debug|x64.ActiveCfg = Debug|Any CPU
{95AF448B-F34C-4DF8-9E9B-DF499FABA099}.Debug|x64.Build.0 = Debug|Any CPU
{95AF448B-F34C-4DF8-9E9B-DF499FABA099}.Release|Any CPU.ActiveCfg = Release|Any CPU
{95AF448B-F34C-4DF8-9E9B-DF499FABA099}.Release|Any CPU.Build.0 = Release|Any CPU
{95AF448B-F34C-4DF8-9E9B-DF499FABA099}.Release|x64.ActiveCfg = Release|Any CPU
{95AF448B-F34C-4DF8-9E9B-DF499FABA099}.Release|x64.Build.0 = Release|Any CPU
{4C3307D4-2A6B-41E3-BE9E-2FD083578450}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4C3307D4-2A6B-41E3-BE9E-2FD083578450}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4C3307D4-2A6B-41E3-BE9E-2FD083578450}.Debug|x64.ActiveCfg = Debug|Any CPU
{4C3307D4-2A6B-41E3-BE9E-2FD083578450}.Debug|x64.Build.0 = Debug|Any CPU
{4C3307D4-2A6B-41E3-BE9E-2FD083578450}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4C3307D4-2A6B-41E3-BE9E-2FD083578450}.Release|Any CPU.Build.0 = Release|Any CPU
{4C3307D4-2A6B-41E3-BE9E-2FD083578450}.Release|x64.ActiveCfg = Release|Any CPU
{4C3307D4-2A6B-41E3-BE9E-2FD083578450}.Release|x64.Build.0 = Release|Any CPU
{AA1993F7-5BAE-45F8-A8F5-31E88A25ED83}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AA1993F7-5BAE-45F8-A8F5-31E88A25ED83}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AA1993F7-5BAE-45F8-A8F5-31E88A25ED83}.Debug|x64.ActiveCfg = Debug|Any CPU
{AA1993F7-5BAE-45F8-A8F5-31E88A25ED83}.Debug|x64.Build.0 = Debug|Any CPU
{AA1993F7-5BAE-45F8-A8F5-31E88A25ED83}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AA1993F7-5BAE-45F8-A8F5-31E88A25ED83}.Release|Any CPU.Build.0 = Release|Any CPU
{AA1993F7-5BAE-45F8-A8F5-31E88A25ED83}.Release|x64.ActiveCfg = Release|Any CPU
{AA1993F7-5BAE-45F8-A8F5-31E88A25ED83}.Release|x64.Build.0 = Release|Any CPU
{F1826D84-1A16-41A4-A57B-F0DBB5A18745}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F1826D84-1A16-41A4-A57B-F0DBB5A18745}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F1826D84-1A16-41A4-A57B-F0DBB5A18745}.Debug|x64.ActiveCfg = Debug|Any CPU
{F1826D84-1A16-41A4-A57B-F0DBB5A18745}.Debug|x64.Build.0 = Debug|Any CPU
{F1826D84-1A16-41A4-A57B-F0DBB5A18745}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F1826D84-1A16-41A4-A57B-F0DBB5A18745}.Release|Any CPU.Build.0 = Release|Any CPU
{F1826D84-1A16-41A4-A57B-F0DBB5A18745}.Release|x64.ActiveCfg = Release|Any CPU
{F1826D84-1A16-41A4-A57B-F0DBB5A18745}.Release|x64.Build.0 = Release|Any CPU
{2E1EEC9C-37C9-4C03-A4BC-58306F8B1C38}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2E1EEC9C-37C9-4C03-A4BC-58306F8B1C38}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E1EEC9C-37C9-4C03-A4BC-58306F8B1C38}.Debug|x64.ActiveCfg = Debug|Any CPU
{2E1EEC9C-37C9-4C03-A4BC-58306F8B1C38}.Debug|x64.Build.0 = Debug|Any CPU
{2E1EEC9C-37C9-4C03-A4BC-58306F8B1C38}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2E1EEC9C-37C9-4C03-A4BC-58306F8B1C38}.Release|Any CPU.Build.0 = Release|Any CPU
{2E1EEC9C-37C9-4C03-A4BC-58306F8B1C38}.Release|x64.ActiveCfg = Release|Any CPU
{2E1EEC9C-37C9-4C03-A4BC-58306F8B1C38}.Release|x64.Build.0 = Release|Any CPU
{F4B8D71B-DAE4-4948-A1DC-42B42DE31D4F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F4B8D71B-DAE4-4948-A1DC-42B42DE31D4F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F4B8D71B-DAE4-4948-A1DC-42B42DE31D4F}.Debug|x64.ActiveCfg = Debug|Any CPU
{F4B8D71B-DAE4-4948-A1DC-42B42DE31D4F}.Debug|x64.Build.0 = Debug|Any CPU
{F4B8D71B-DAE4-4948-A1DC-42B42DE31D4F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F4B8D71B-DAE4-4948-A1DC-42B42DE31D4F}.Release|Any CPU.Build.0 = Release|Any CPU
{F4B8D71B-DAE4-4948-A1DC-42B42DE31D4F}.Release|x64.ActiveCfg = Release|Any CPU
{F4B8D71B-DAE4-4948-A1DC-42B42DE31D4F}.Release|x64.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -632,11 +672,15 @@ Global
{3F8532EF-3DC9-45F8-9562-994ABE066585} = {8C39C640-0E8A-43A7-890C-9742B6B70AA4}
{31262D61-26A4-4302-968D-52B8DA4558CD} = {38E6C400-90C0-493E-9266-C1602E229F1B}
{B689E82B-B3E8-4C83-B56C-D4C27206AAC6} = {DC578D74-98F0-4F19-A230-CFA8DAEE0AF1}
{0C25062D-60A5-4690-974A-CDA9619866B4} = {022D6FF5-4B65-4213-9A97-C69E2B2F99E1}
{6D9A3F62-8AB6-40AD-B32F-2A435A9D3341} = {022D6FF5-4B65-4213-9A97-C69E2B2F99E1}
{E9A3C62C-EA85-40C3-BB3B-7836D0337F63} = {022D6FF5-4B65-4213-9A97-C69E2B2F99E1}
{50551732-AAE0-4F77-B401-9DD02E226CDB} = {38E6C400-90C0-493E-9266-C1602E229F1B}
{7CF33D08-9468-464D-B52E-955A5667EE42} = {38E6C400-90C0-493E-9266-C1602E229F1B}
{F52E5BA6-C2D4-4797-AF71-6389FEC246B5} = {022D6FF5-4B65-4213-9A97-C69E2B2F99E1}
{823D2A6E-20AB-45FF-AD07-5E7933FA6DE7} = {022D6FF5-4B65-4213-9A97-C69E2B2F99E1}
{7C382E43-A515-4C67-9296-FB8A630C4A49} = {022D6FF5-4B65-4213-9A97-C69E2B2F99E1}
{95AF448B-F34C-4DF8-9E9B-DF499FABA099} = {022D6FF5-4B65-4213-9A97-C69E2B2F99E1}
{4C3307D4-2A6B-41E3-BE9E-2FD083578450} = {38E6C400-90C0-493E-9266-C1602E229F1B}
{AA1993F7-5BAE-45F8-A8F5-31E88A25ED83} = {38E6C400-90C0-493E-9266-C1602E229F1B}
{F1826D84-1A16-41A4-A57B-F0DBB5A18745} = {38E6C400-90C0-493E-9266-C1602E229F1B}
{2E1EEC9C-37C9-4C03-A4BC-58306F8B1C38} = {38E6C400-90C0-493E-9266-C1602E229F1B}
{F4B8D71B-DAE4-4948-A1DC-42B42DE31D4F} = {38E6C400-90C0-493E-9266-C1602E229F1B}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {40383055-CC50-4600-AD9A-53C14F620D03}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Masa.Contrib.Isolation.Environment;
namespace Masa.Contrib.Isolation.MultiEnvironment;

public class EnvironmentContext : IEnvironmentContext, IEnvironmentSetter
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
namespace Masa.Contrib.Isolation.MultiEnvironment;

public static class IsolationBuilderExtensions
{
public const string DEFAULT_ENVIRONMENT_NAME = "ASPNETCORE_ENVIRONMENT";

public static IIsolationBuilder UseMultiEnvironment(this IIsolationBuilder isolationBuilder)
=> isolationBuilder.UseMultiEnvironment(DEFAULT_ENVIRONMENT_NAME);

public static IIsolationBuilder UseMultiEnvironment(this IIsolationBuilder isolationBuilder, List<IParserProvider>? parserProviders)
=> isolationBuilder.UseMultiEnvironment(DEFAULT_ENVIRONMENT_NAME, parserProviders);

public static IIsolationBuilder UseMultiEnvironment(this IIsolationBuilder isolationBuilder, string environmentName, List<IParserProvider>? parserProviders = null)
{
if (isolationBuilder.Services.Any(service => service.ImplementationType == typeof(EnvironmentProvider)))
return isolationBuilder;

isolationBuilder.Services.AddSingleton<EnvironmentProvider>();

isolationBuilder.Services.AddScoped<IIsolationMiddleware>(serviceProvider => new MultiEnvironmentMiddleware(serviceProvider, environmentName, parserProviders));
isolationBuilder.Services.TryAddScoped<EnvironmentContext>();
isolationBuilder.Services.TryAddScoped(typeof(IEnvironmentContext), serviceProvider => serviceProvider.GetRequiredService<EnvironmentContext>());
isolationBuilder.Services.TryAddScoped(typeof(IEnvironmentSetter), serviceProvider => serviceProvider.GetRequiredService<EnvironmentContext>());
return isolationBuilder;
}

private class EnvironmentProvider
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,4 @@
<ProjectReference Include="..\..\BuildingBlocks\MASA.BuildingBlocks\src\Isolation\Masa.BuildingBlocks.Isolation\Masa.BuildingBlocks.Isolation.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Masa.Utils.Data.EntityFrameworkCore" Version="0.4.0-preview.2" />
</ItemGroup>

</Project>
Loading