I have a SysMsgManager class defined in CoreService project as following:
public class SysMsgManager 
{
    private ISysMsgRepository _SysMsgRepository;
    public SysMsgManager()
    {
        _SysMsgRepository = ObjectFactory.GetInstance<ISysMsgRepository>();
    }
    ....
}
In my DataAccess project I have 'ISysMsgRepository' interface and two concrete implementations defined as following:
namespace DataAccess.Repository
{
   [Pluggable("Default")]
   public class SysMsgRepository : ISysMsgRepository
   {
      ...
   }
}
namespace DataAccess.Repository
{
    [Pluggable("Stub")]
    public class SysMsgRepository_Test : ISysMsgRepository
    {
        ...
    }
}
and this is what I have in my StructureMap.config file
<StructureMap>
<Assembly Name="CoreService" /> 
<Assembly Name="DataAccess" />
<PluginFamily
    Assembly="DataAccess"
    Type="DataAccess.Repository.ISysMsgRepository"
    DefaultKey="Default" />
</StructureMap>
When I try to run my app, I got the following error:
StructureMap Exception Code: 202\nNo Default Instance defined for PluginFamily DataAccess.Repository.ISysMsgRepository, DataAccess, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
Can anyone help me to solve this problem? Thanks!
Unfortunately I have little familiarity with configuring StructureMap via Xml. Let me show you how it is done using C#.
var container = new Container(config=>
{
  config.For<ISysMsgRepository>().Use<SysMsgRepository>();
});
It seems you are using the standard naming convention for your interfaces and classes (just tacking an I onto the front of the class name). If you do that for all your types you can just configure your container like this:
var container = new Container(config=>
{
    config.Scan(scan =>
    {
        scan.TheCallingAssembly();
        scan.WithDefaultConventions();
    });
});
I hope this helps. It is much easier to configure your container using code rather than Xml. Give it a try. You'll be a convert.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With