Hi, I am trying to register the ReliableStateManager in the container. The constructor requires StatefulServiceContext and a ReliableStateManagerConfiguration object. No matter how I try registering it I end up with the following exception:
None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Microsoft.ServiceFabric.Data.ReliableStateManager' can be invoked with the available services and parameters:
Cannot resolve parameter 'System.Fabric.StatefulServiceContext serviceContext' of constructor 'Void .ctor(System.Fabric.StatefulServiceContext, Microsoft.ServiceFabric.Data.ReliableStateManagerConfiguration)'.
I have tried registering the state manager like this:
builder.Register(c => new ReliableStateManager(c.Resolve<StatefulServiceContext>(), null)).As<IReliableStateManager>().SingleInstance();
Before using the Autofac.ServiceFabric 2.2.0 package, we wired everything up manually, meaning registering the context and state manager in the container and it was working as expected.
I see that the StatefulServiceContext is registered just before the service is resolved. It this a timing issue maybe?
Hi, I am trying to register the ReliableStateManager in the container. The constructor requires StatefulServiceContext and a ReliableStateManagerConfiguration object. No matter how I try registering it I end up with the following exception:
None of the constructors found with 'Autofac.Core.Activators.Reflection.DefaultConstructorFinder' on type 'Microsoft.ServiceFabric.Data.ReliableStateManager' can be invoked with the available services and parameters: Cannot resolve parameter 'System.Fabric.StatefulServiceContext serviceContext' of constructor 'Void .ctor(System.Fabric.StatefulServiceContext, Microsoft.ServiceFabric.Data.ReliableStateManagerConfiguration)'.
I have tried registering the state manager like this:
builder.Register(c => new ReliableStateManager(c.Resolve<StatefulServiceContext>(), null)).As<IReliableStateManager>().SingleInstance();
and
builder.RegisterType<ReliableStateManager>().As<IReliableStateManager>().WithParameter("configuration", null).SingleInstance();
before calling
builder.RegisterStatefulService<TService>(serviceType);
Before using the Autofac.ServiceFabric 2.2.0 package, we wired everything up manually, meaning registering the context and state manager in the container and it was working as expected.
I see that the StatefulServiceContext is registered just before the service is resolved. It this a timing issue maybe?