Hello Everyone,
I just started digging into StructureMap and am running into some problems getting my config up-and-running. It seems that when I try to register Plugins in their respective PluginFamily they aren't being found by StructureMap. I've gone over many examples on the web but can't seem to see where I am going wrong.
Can another set of eyes see what my problem is?
Thank you so much for your time.
--Charly
<configuration>
<configSections>
<section name="StructureMap"
type="StructureMap.Configuration.StructureMapConfigurationSection, StructureMap"/>
</configSections >
<StructureMap>
<Assembly Name="Domain.Model" />
<!-- ICustomField -->
<PluginFamily Type="Domain.Model.CustomFields.ICustomField"
Assembly="Domain.Model"
DefaultKey="String">
<Plugin Type="Domain.Model.CustomFields.StringCustomField"
Assembly="Domain.Model"
ConcreteKey="String" />
<Plugin Type="Domain.Model.CustomFields.DateTimeCustomField"
Assembly="Domain.Model"
ConcreteKey="DateTime" />
<Plugin Type="Domain.Model.CustomFields.BooleanCustomField"
Assembly="Domain.Model"
ConcreteKey="Boolean" />
<Plugin Type="Domain.Model.CustomFields.IntegerCustomField"
Assembly="Domain.Model"
ConcreteKey="Integer" />
<Plugin Type="Domain.Model.CustomFields.DecimalCustomField"
Assembly="Domain.Model"
ConcreteKey="Decimal" />
</PluginFamily>
</StructureMap>
</configuration>
[TestFixture]
public class BooleanCustomFieldTest
{
[SetUp]
public void SetUp()
{
log4net.Config.XmlConfigurator.Configure();
ObjectFactory.Initialize(x =>
{
x.PullConfigurationFromAppConfig = true;
});
}
[Test]
public void StructureMapCanCreateAnInstanceOfBooleanCustomField()
{
ICustomField field =
ObjectFactory.GetNamedInstance<ICustomField>("Boolean");
Assert.IsNotNull(field);
Assert.IsInstanceOf<BooleanCustomField>(field);
}
}