Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

re-applied 0f64ad0

  • Loading branch information...
commit 6bb9231987868e49fb102683ca242b00d9f9717c 1 parent a37050a
@mausch mausch authored
Showing with 8 additions and 9 deletions.
  1. +8 −9 Ninject.Integration.SolrNet/SolrNetModule.cs
View
17 Ninject.Integration.SolrNet/SolrNetModule.cs
@@ -32,8 +32,6 @@
using SolrNet.Mapping.Validation.Rules;
using SolrNet.Schema;
using SolrNet.Utils;
-using Ninject.Planning.Bindings;
-using Ninject.Activation;
namespace Ninject.Integration.SolrNet {
/// <summary>
@@ -43,6 +41,7 @@ public class SolrNetModule : NinjectModule {
private readonly string serverURL;
private readonly List<SolrCore> cores = new List<SolrCore>();
private const string CoreId = "CoreId";
+
/// <summary>
/// Optional override for document mapper
/// </summary>
@@ -129,7 +128,7 @@ private static Type GetCoreDocumentType(SolrServerElement server)
Bind(iSolrQueryExecuter).To(solrQueryExecuter)
.Named(coreConnectionId + solrQueryExecuter)
.WithMetadata(CoreId, coreConnectionId)
- .WithConstructorArgument("connection", Kernel.Get<ISolrConnection>(bindingMetaData => bindingMetaData.Has(CoreId) && bindingMetaData.Get<string>(CoreId).Equals(coreConnectionId)));
+ .WithConstructorArgument("connection", ctx => ctx.Kernel.Get<ISolrConnection>(bindingMetaData => bindingMetaData.Has(CoreId) && bindingMetaData.Get<string>(CoreId).Equals(coreConnectionId)));
var solrBasicOperations = typeof(ISolrBasicOperations<>).MakeGenericType(core.DocumentType);
var solrBasicReadOnlyOperations = typeof(ISolrBasicReadOnlyOperations<>).MakeGenericType(core.DocumentType);
@@ -138,14 +137,14 @@ private static Type GetCoreDocumentType(SolrServerElement server)
Bind(solrBasicOperations).To(solrBasicServer)
.Named(coreConnectionId + solrBasicServer)
.WithMetadata(CoreId, coreConnectionId)
- .WithConstructorArgument("connection", Kernel.Get<ISolrConnection>(bindingMetaData => bindingMetaData.Has(CoreId) && bindingMetaData.Get<string>(CoreId).Equals(coreConnectionId)))
- .WithConstructorArgument("queryExecuter", Kernel.Get(iSolrQueryExecuter, bindingMetaData => bindingMetaData.Has(CoreId) && bindingMetaData.Get<string>(CoreId).Equals(coreConnectionId)));
+ .WithConstructorArgument("connection", ctx => ctx.Kernel.Get<ISolrConnection>(bindingMetaData => bindingMetaData.Has(CoreId) && bindingMetaData.Get<string>(CoreId).Equals(coreConnectionId)))
+ .WithConstructorArgument("queryExecuter", ctx => ctx.Kernel.Get(iSolrQueryExecuter, bindingMetaData => bindingMetaData.Has(CoreId) && bindingMetaData.Get<string>(CoreId).Equals(coreConnectionId)));
Bind(solrBasicReadOnlyOperations).To(solrBasicServer)
.Named(coreConnectionId + solrBasicServer)
.WithMetadata(CoreId, coreConnectionId)
- .WithConstructorArgument("connection", Kernel.Get<ISolrConnection>(bindingMetaData => bindingMetaData.Has(CoreId) && bindingMetaData.Get<string>(CoreId).Equals(coreConnectionId)))
- .WithConstructorArgument("queryExecuter", Kernel.Get(iSolrQueryExecuter,bindingMetaData => bindingMetaData.Has(CoreId) && bindingMetaData.Get<string>(CoreId).Equals(coreConnectionId)));
+ .WithConstructorArgument("connection", ctx => ctx.Kernel.Get<ISolrConnection>(bindingMetaData => bindingMetaData.Has(CoreId) && bindingMetaData.Get<string>(CoreId).Equals(coreConnectionId)))
+ .WithConstructorArgument("queryExecuter", ctx => ctx.Kernel.Get(iSolrQueryExecuter, bindingMetaData => bindingMetaData.Has(CoreId) && bindingMetaData.Get<string>(CoreId).Equals(coreConnectionId)));
var solrOperations = typeof(ISolrOperations<>).MakeGenericType(core.DocumentType);
var solrServer = typeof(SolrServer<>).MakeGenericType(core.DocumentType);
@@ -154,11 +153,11 @@ private static Type GetCoreDocumentType(SolrServerElement server)
Bind(solrOperations).To(solrServer)
.Named(core.Id)
.WithMetadata(CoreId, coreConnectionId)
- .WithConstructorArgument("basicServer", Kernel.Get(solrBasicOperations, bindingMetaData => bindingMetaData.Has(CoreId) && bindingMetaData.Get<string>(CoreId).Equals(coreConnectionId)));
+ .WithConstructorArgument("basicServer", ctx => ctx.Kernel.Get(solrBasicOperations, bindingMetaData => bindingMetaData.Has(CoreId) && bindingMetaData.Get<string>(CoreId).Equals(coreConnectionId)));
Bind(solrReadOnlyOperations).To(solrServer)
.Named(core.Id)
.WithMetadata(CoreId, coreConnectionId)
- .WithConstructorArgument("basicServer", Kernel.Get(solrBasicReadOnlyOperations, bindingMetaData => bindingMetaData.Has(CoreId) && bindingMetaData.Get<string>(CoreId).Equals(coreConnectionId)));
+ .WithConstructorArgument("basicServer", ctx => ctx.Kernel.Get(solrBasicReadOnlyOperations, bindingMetaData => bindingMetaData.Has(CoreId) && bindingMetaData.Get<string>(CoreId).Equals(coreConnectionId)));
}
public override void Load() {
Please sign in to comment.
Something went wrong with that request. Please try again.