Hello.
I wasn't able to find much help on StructureMap's website, so I'm hoping perhaps I can find some help here. I think I have just a small bug in my StructureMap code, but I'm not sure where....
I'm trying to install structuremap into my 1st website but I'm unable to successfully reference classes set within structuremap. I have 2 projects: a c# class library (MyCompany.MySite.Core) & my website (MyCompany.MySite.Web). My structuremap.config contains a reference to a class I created called "IRedirector". The config file looks like the following:
<br /><?xml version="1.0" encoding="utf-8" ?><br /><StructureMap><br /> <Assembly Name="MyCompany.MySite.Core" /><br /> <Assembly Name="MyCompany.MySite.Web" /><br /> <PluginFamily Assembly="MyCompany.MySite.Core" Type="MyCompany.MySite.Core.Impl.IRedirector" DefaultKey="Default"/><br /></StructureMap><br />
My IRedirector class looks like this:
<br />namespace MyCompany.MySite.Core.Impl<br />{<br /> [PluginFamily("Default")]<br /> public interface IRedirector<br /> {<br />
Now, as I understood it, I should be able to reference this class in my website by referencing MyCompany.MySite.Core, but I get an error. Instead, my website wants MyCompany.MySite.Core.Impl.
For example, the following is incorrect:
<br />using MyCompany.MySite.Core;<br /><br />namespace MyCompany.MySite.Web<br />{<br /> public class Global : System.Web.HttpApplication<br /> {<br /> protected void Application_Error(object sender, EventArgs e)<br /> {<br /> IRedirector redir = ObjectFactory.GetInstance<IRedirector>();<br /> redir.GoToErrorPage();<br /> }<br /> }<br />}<br />
In that example, the line beginning with "IRedirector" will throw an error, unless I add a reference to "using MyCompany.MySite.Core.Impl;"
I want to reference it using only "MyCompany.MySite.Core". Any idea what I'm doing wrong?
Thanks.