I'm trying to make the following NServiceBus Pluralsight training code sample by Andreas Öhlund to work.
public class RavenBootstrapper : INeedInitialization
{
public void Init()
{
Configure.Instance.Configurer.ConfigureComponent<IDocumentStore>(
() =>
{
var store = new DocumentStore
{
Url = "http://localhost:8080"
};
store.Initialize();
store.JsonRequestFactory.DisableRequestCompression = true;
return store;
}
, DependencyLifecycle.SingleInstance);
Configure.Instance.Configurer.ConfigureComponent<IDocumentSession>(
() =>
{
return Configure.Instance.Builder.Build<IDocumentStore>()
.OpenSession();
},
DependencyLifecycle.InstancePerUnitOfWork);
Configure.Instance.Configurer.ConfigureComponent<RavenUnitOfWork>(DependencyLifecycle.InstancePerUnitOfWork);
}
}
There were multiple compile errors about obsolete code and I was able to correct most of them but got stock on Configure.Instance.Builder.Build... Here's what I have so far:
public class RavenBootstrapper : INeedInitialization
{
configuration.RegisterComponents(c => c.ConfigureComponent<IDocumentStore>(
() =>
{
var store = new DocumentStore
{
Url = "http://localhost:8080"
};
store.Initialize();
store.JsonRequestFactory.DisableRequestCompression = true;
return store;
}
, DependencyLifecycle.SingleInstance));
configuration.RegisterComponents(c =>
c.ConfigureComponent(builder => builder.Build<IDocumentStore>().OpenSession(),DependencyLifecycle.InstancePerUnitOfWork));
configuration.RegisterComponents(c => c.ConfigureComponent<RavenUnitOfWork>(DependencyLifecycle.InstancePerUnitOfWork));
}
- What is a new equivalent of Builder.Build?
- Does the rest look good?
- Would be nice to know where specifically I could find an answer to this in NserviceBus documentation.