Created
March 30, 2011 14:53
-
-
Save hyrmn/894547 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HyrmnBlogApplication : TurbineApplication | |
{ | |
public override void Startup() | |
{ | |
ServiceLocatorManager.SetLocatorProvider(() => new StructureMapServiceLocator(ObjectFactory.Container)); | |
base.Startup(); | |
} | |
protected override void ShutdownContext() | |
{ | |
CurrentContext = null; | |
ServiceLocator = null; | |
} | |
protected void Application_EndRequest() | |
{ | |
ObjectFactory.ReleaseAndDisposeAllHttpScopedObjects(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StructureMap Exception Code: 202 | |
No Default Instance defined for PluginFamily Spark.ISparkSettings, Spark, Version=1.5.0.0, Culture=neutral, PublicKeyToken=7f8549eed921a12c | |
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. | |
Exception Details: StructureMap.StructureMapException: StructureMap Exception Code: 202 | |
No Default Instance defined for PluginFamily Spark.ISparkSettings, Spark, Version=1.5.0.0, Culture=neutral, PublicKeyToken=7f8549eed921a12c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SparkBlade : Blade | |
{ | |
public override void Spin(IRotorContext context) | |
{ | |
ViewEngines.Engines.Clear(); | |
var sparkServiceContainer = SparkEngineStarter.CreateContainer(); | |
sparkServiceContainer.AddFilter(new SparkAreasDescriptorFilter()); | |
SparkEngineStarter.RegisterViewEngine(sparkServiceContainer); | |
var settings = ConfigurationManager.GetSection("spark") as ISparkSettings; | |
context.ServiceLocator.Register(settings); | |
} | |
} |
The Windsor one is not working, at least with the nuget package. I emailed Javier about that last night, I'm almost positive that one is a versioning issue.
I did just try wiring up Ninject in the static constructor with the same issue.
public class MvcApplication : TurbineApplication
{
static MvcApplication()
{
// Register the IoC that you want Mvc Turbine to use!
// Everything else is wired automatically
ServiceLocatorManager.SetLocatorProvider(() => new NinjectServiceLocator());
}
}
You might hate me for this, but I ran your app locally, and....
It worked for me. I see a green site, with talk of you not being a ninja.
I did have to reinstall all of the nuget packages, because the references were broken. Plus, I'm running it under Cassini. I'll switch to IIS Express when I get home.
Well, thanks for looking at it!
I'm not sure why the references would be broken. I peeked in the proj
file and they seemed to be relative paths up to the packages directory
and that's committed to github.
…On 3/30/2011 6:35 PM, darrencauthon wrote:
You might hate me for this, but I ran your app locally, and....
It worked for me. I see a green site, with talk of you not being a ninja.
I did have to reinstall all of the nuget packages, because the references were broken. Plus, I'm running it under Cassini. I'll switch to IIS Express when I get home.
Nope, no dice on Cassini either. I mean, eventually if I just keep
hitting continue on the errors, the site comes up.... but that's just
odd all around.
…On 3/30/2011 6:35 PM, darrencauthon wrote:
You might hate me for this, but I ran your app locally, and....
It worked for me. I see a green site, with talk of you not being a ninja.
I did have to reinstall all of the nuget packages, because the references were broken. Plus, I'm running it under Cassini. I'll switch to IIS Express when I get home.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I tested the Ninject stuff, as well as Windsor, StructureMap, and Unity. Enough code to make sure that the metadata stuff worked in each (multiple page hits, posting forms, etc). I even just demoed the StructureMap locator in a presentation less than an hour ago.
The only difference between what you wrote and every MVC Turbine application that I've ever written is that I always set the service locator in the constructor of the TurbineApplication. But I think Startup happens right about then, so I'm not sure yet.
I wish I could help more now, but it will have to be after hours.