New To StructureMap - Getting No Default Instance Error 202
Posted
by Code Sherpa
on Stack Overflow
See other posts from Stack Overflow
or by Code Sherpa
Published on 2010-05-20T14:46:19Z
Indexed on
2010/05/20
19:00 UTC
Read the original article
Hit count: 537
Hi. I am very new to StructureMap and am getting the following error:
StructureMap Exception Code: 202 No Default Instance defined for PluginFamily Company.ProjectCore.Core.IUserSession, Company.ProjectCore, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
It seems to be hitting the first interface instance on compile and then throws the above error:
private readonly IUserSession _userSession;
public SiteMaster()
{
_userSession = ObjectFactory.GetInstance<IUserSession>(); // ERROR THROWN HERE
...
}
For what it is worth, I have the PluginFamily reference above all of interfaces:
[PluginFamily("Default")]
public interface IUserSession
Below is my entire StructureMap.config
<StructureMap>
<Assembly Name="Company.ProjectWeb" />
<Assembly Name="Company.ProjectCore" />
<!--
Use DefaultKey="Default" for standard cache
or DefaultKey="MemCached" for memcached cache.
-->
<PluginFamily
Assembly="Company.ProjectCore"
Type="Company.ProjectCore.Core.ICache"
DefaultKey="MemCached" />
<!--
Use DefaultKey="Default" for sending the email
in real time through the configured mail server
or use DefaultKey="MailQueue" to send the mail
in batches through another process
-->
<PluginFamily
Assembly="Company.ProjectCore"
Type="Company.ProjectCore.Core.IEmailService"
DefaultKey="MailQueue" />
<!--
Use DefaultKey="Default" for standard cache
or DefaultKey="UserSession" for memcached cache.
-->
<PluginFamily
Assembly="Company.ProjectCore"
Type="Company.ProjectCore.Core.IUserSession"
DefaultKey="UserSession" />
<!--
Use DefaultKey="Default" for standard cache
or DefaultKey="Redirector" for memcached cache.
-->
<PluginFamily
Assembly="Company.ProjectCore"
Type="Company.ProjectCore.Core.IRedirector"
DefaultKey="Redirector" />
<!--
Use DefaultKey="Default" for standard cache
or DefaultKey="Navigation" for memcached cache.
-->
<PluginFamily
Assembly="Company.ProjectCore"
Type="Company.ProjectCore.Core.INavigation"
DefaultKey="Navigation" />
Any suggestions? Thanks.
© Stack Overflow or respective owner