I have a SqlWorkflowInstanceStore object that I want to use CastleWindsor to create for me.
A SqlWorkflowInstanceStore takes a constructor parameter of a connection string.
My connection string is in my app.config.
Without using CastleWindsor this works:
InstanceStore persistanceStoreX = new SqlWorkflowInstanceStore(ConfigManager.Instance.GetSQLConnectionString());
I’ve tried these snippets with CastleWindsor:
WindsorContainer.Register(Component.For<InstanceStore>().ImplementedBy<SqlWorkflowInstanceStore>().DependsOn(Property.ForKey("InstanceStore").Eq(ConfigManager.Instance.GetSQLConnectionString())));
and
var connString = ConfigManager.Instance.GetSQLConnectionString();
WindsorContainer.Register(Component.For<InstanceStore>().ImplementedBy<SqlWorkflowInstanceStore>().DependsOn(new { InstanceStore = connString }));
When resolved with this:
_persistanceStore = _iodManager.WindsorContainer.Resolve<InstanceStore>();
I get a valid container but it has a null ConnectionString field.
What is the correct way to initialize the SqlWorkflowInstanceStore ?
InstenceStore is the Abstract class base for SqlWorkflowInstanceStore
ConfigManager.Instance.GetSQLConnectionString() is a singleton instance
From looking at this page, it appears the ctor parameter for
SqlWorkflowInstanceStoretakes a parameter calledconnectionStringso I think your registration code should be: