New To StructureMap - Getting No Default Instance Error 202
- by Code Sherpa
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.