Skip to content

Commit 7f4329d

Browse files
(GH-601) Allowed ninject ioc extension to configure additional types
1 parent 4e6cfbe commit 7f4329d

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

src/DotNetToolkit.Repository.Extensions.Ninject/KernelExtensions.cs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,27 +68,17 @@ public static void BindRepositories([NotNull] this IKernel kernel, [NotNull] Act
6868

6969
var scanResults = AssemblyScanner.FindRepositoriesFromAssemblies(assembliesToScan);
7070

71+
// Binds scanned types
7172
scanResults.ForEach(scanResult =>
7273
{
7374
foreach (var implementationType in scanResult.ImplementationTypes)
7475
{
75-
if (scanResult.InterfaceType == typeof(IRepositoryInterceptor))
76-
{
77-
kernel.Bind(implementationType).ToSelf();
78-
kernel.Bind(scanResult.InterfaceType).To(implementationType);
79-
}
80-
else
81-
{
82-
kernel.Bind(scanResult.InterfaceType).To(implementationType);
83-
}
76+
kernel.Bind(implementationType).ToSelf();
77+
kernel.Bind(scanResult.InterfaceType).To(implementationType);
8478
}
8579
});
8680

87-
// Binds other services
88-
kernel.Bind<IRepositoryFactory>().ToMethod(c => new RepositoryFactory(c.Kernel.Get<IRepositoryOptions>()));
89-
kernel.Bind<IUnitOfWork>().ToMethod(c => new UnitOfWork(c.Kernel.Get<IRepositoryOptions>()));
90-
kernel.Bind<IUnitOfWorkFactory>().ToMethod(c => new UnitOfWorkFactory(c.Kernel.Get<IRepositoryOptions>()));
91-
kernel.Bind<IServiceFactory>().ToMethod(c => new ServiceFactory(c.Kernel.Get<IUnitOfWorkFactory>()));
81+
// Binds options services
9282
kernel.Bind<IRepositoryOptions>().ToMethod(c =>
9383
{
9484
var options = new RepositoryOptions(optionsBuilder.Options);

0 commit comments

Comments
 (0)