Skip to content

Commit

Permalink
Correctly register IDefaultValueProvider implementation (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-bertschi authored Nov 3, 2020
1 parent 34049bb commit 2d551b2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/BBT.StructureTools.Tests/Convert/ConverterIntTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,6 @@ private static void DoConvertRegistrationsForWholeStructure()
{
container.Bind(typeof(IGenericStrategyProvider<,>)).To(typeof(GenericStrategyProvider<,>));
container.Bind(typeof(ITemporalDataHandler<>)).To(typeof(TemporalDataHandler<>));
container.Bind<IDefaultValueProvider>().To<DefaultValueProvider>();
container.Bind<IConvertRegistrations<SourceRoot, TargetRoot, IForTest>>().To<RootToTargetRootConvertRegistrations>();
container.Bind<IConvertRegistrations<RootBase, TargetRoot, IForTest>>().To<RootBaseToTargetRootConvertRegistration>();
container.Bind<IConvertRegistrations<RootBase, RootBase, IForTest>>().To<RootBaseToRootBaseConvertRegistration>();
Expand Down
11 changes: 11 additions & 0 deletions src/BBT.StructureTools/Initialization/IoCHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using BBT.StructureTools.Copy.Operation;
using BBT.StructureTools.Copy.Strategy;
using BBT.StructureTools.Extension;
using BBT.StructureTools.Provider;
using BBT.StructureTools.Strategy;

/// <summary>
Expand Down Expand Up @@ -59,6 +60,7 @@ public void DoIocRegistrations(Action<Type, Type> singletonRegistrationAction, A
RegisterCompareTypes(singletonRegistrationAction);
RegisterCopyTypes(singletonRegistrationAction, transientRegistrationAction);
RegisterConvertTypes(singletonRegistrationAction, transientRegistrationAction);
RegisterProviderTypes(singletonRegistrationAction);
}

/// <summary>
Expand Down Expand Up @@ -148,5 +150,14 @@ private static void RegisterCopyTypes(Action<Type, Type> singletonRegistrationAc
transientRegistrationAction.Invoke(typeof(ICopyOperationCreateToManyWithGenericStrategyReverseRelationOnly<,,>), typeof(CopyOperationCreateToManyWithGenericStrategyReverseRelationOnly<,,>));
transientRegistrationAction.Invoke(typeof(ICopyOperationCreateToOneWithGenericStrategyWithReverseRelation<,,>), typeof(CopyOperationCreateToOneWithGenericStrategyWithReverseRelation<,,>));
}

/// <summary>
/// Registers types needed for providers.
/// </summary>
private static void RegisterProviderTypes(Action<Type, Type> singletonRegistrationAction)
{
// Tools
singletonRegistrationAction.Invoke(typeof(IDefaultValueProvider), typeof(DefaultValueProvider));
}
}
}

0 comments on commit 2d551b2

Please sign in to comment.