-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from marcwittke/hotfix/2.0.4
Removed TenantId state from Repository, allowing changing the current…
- Loading branch information
Showing
26 changed files
with
223 additions
and
165 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
namespace Backend.Fx.Bootstrapping | ||
{ | ||
using System; | ||
using System.Linq; | ||
using System.Reflection; | ||
using BuildingBlocks; | ||
using Logging; | ||
using Microsoft.Extensions.Configuration; | ||
using Microsoft.Extensions.Options; | ||
using SimpleInjector; | ||
|
||
public static class SimpleInjectorContainerEx | ||
{ | ||
private static readonly ILogger Logger = LogManager.Create(typeof(SimpleInjectorContainerEx)); | ||
|
||
/// <summary> | ||
/// Auto registering all implementors of <see cref="IApplicationService" /> and <see cref="IDomainService" /> with | ||
/// their implementations as scoped instances | ||
/// </summary> | ||
public static void RegisterDomainAndApplicationServices(this Container container, Assembly[] assemblies) | ||
{ | ||
|
||
var serviceRegistrations = container | ||
.GetTypesToRegister(typeof(IDomainService), assemblies) | ||
.Concat(container.GetTypesToRegister(typeof(IApplicationService), assemblies)) | ||
.SelectMany(type => | ||
type.GetTypeInfo() | ||
.ImplementedInterfaces | ||
.Where(i => typeof(IDomainService) != i && typeof(IApplicationService) != i && (i.Namespace.StartsWith("Backend") || assemblies.Contains(i.GetTypeInfo().Assembly))) | ||
.Select(service => new | ||
{ | ||
Service = service, | ||
Implementation = type | ||
}) | ||
); | ||
foreach (var reg in serviceRegistrations) | ||
{ | ||
Logger.Debug($"Registering scoped service {reg.Service.Name} with implementation {reg.Implementation.Name}"); | ||
container.Register(reg.Service, reg.Implementation); | ||
} | ||
} | ||
|
||
public static void Configure<TOptions>(this Container container, Action<TOptions> configure) where TOptions : class | ||
{ | ||
container.RegisterSingleton<IConfigureOptions<TOptions>>(new ConfigureOptions<TOptions>(configure)); | ||
} | ||
|
||
public static void Configure<TOptions>(this Container container, IConfiguration configuration) where TOptions : class | ||
{ | ||
container.RegisterSingleton<IOptionsChangeTokenSource<TOptions>>(new ConfigurationChangeTokenSource<TOptions>(Options.DefaultName, configuration)); | ||
container.RegisterSingleton<IConfigureOptions<TOptions>>(new NamedConfigureFromConfigurationOptions<TOptions>(Options.DefaultName, configuration)); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
src/Backend.Fx.Testing/InMemoryPersistence/InMemoryApplicationModule.cs
This file was deleted.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
src/Backend.Fx.Testing/InMemoryPersistence/InMemoryDomainModule.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace Backend.Fx.Testing.InMemoryPersistence | ||
{ | ||
using System.Reflection; | ||
using Bootstrapping.Modules; | ||
|
||
public class InMemoryDomainModule : DomainModule | ||
{ | ||
public InMemoryDomainModule(params Assembly[] domainAssemblies) : base(domainAssemblies) | ||
{ } | ||
} | ||
} |
Oops, something went wrong.