I have a SysMsgManager class defined in a CoreService project as follows:
public class SysMsgManager
{
private ISysMsgRepository _SysMsgRepository;
public SysMsgManager()
{
_SysMsgRepository = ObjectFactory.GetInstance<ISysMsgRepository>();
}
....
}
In my DataAccess project, I have the ISysMsgRepository interface and two specific implementations defined as follows:
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 the 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 application, I received the following error:
StructureMap exception code: 202 \ nNo The default instance defined for PluginFamily DataAccess.Repository.ISysMsgRepository, DataAccess, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = null
Can someone help me solve this problem? Thank!
source
share