diff --git a/build/runbuild.ps1 b/build/runbuild.ps1
index d9639820..cc6b5085 100644
--- a/build/runbuild.ps1
+++ b/build/runbuild.ps1
@@ -78,7 +78,7 @@ task NuGet -depends Compile -description "This tasks makes creates the NuGet pac
Create-MvcSiteMapProvider-Web-Package
- Create-DIContainer-Packages ("Autofac", "Ninject", "SimpleInjector", "StructureMap", "Unity", "Windsor")
+ Create-DIContainer-Packages ("Autofac", "Grace", "Ninject", "SimpleInjector", "StructureMap", "Unity", "Windsor")
}
task Finalize -depends NuGet -description "This tasks finalizes the build" {
@@ -262,17 +262,25 @@ function Create-DIContainer-Packages ([string[]] $di_containers) {
Write-Host $di_container -ForegroundColor Yellow
#exception: SimpleInjector version 2 doesn't support .NET 3.5
- if ($di_container -ne "SimpleInjector") {
+ if ($di_container -ne "SimpleInjector" -and $di_container -ne "Grace") {
Create-DIContainer-Package $di_container ("net35", "net40", "net45") -mvc_version "2"
Create-DIContainer-Modules-Package $di_container ("net35", "net40", "net45") -mvc_version "2"
}
- Create-DIContainer-Package $di_container ("net40", "net45") -mvc_version "3"
- Create-DIContainer-Modules-Package $di_container ("net40", "net45") -mvc_version "3"
+ if ($di_container -ne "Grace") {
+ Create-DIContainer-Package $di_container ("net40", "net45") -mvc_version "3"
+ Create-DIContainer-Modules-Package $di_container ("net40", "net45") -mvc_version "3"
+
+ Create-DIContainer-Package $di_container ("net40", "net45") -mvc_version "4"
+ Create-DIContainer-Modules-Package $di_container ("net40", "net45") -mvc_version "4"
+ } else {
+ Create-DIContainer-Package $di_container ("net45") -mvc_version "3"
+ Create-DIContainer-Modules-Package $di_container ("net45") -mvc_version "3"
+
+ Create-DIContainer-Package $di_container ("net45") -mvc_version "4"
+ Create-DIContainer-Modules-Package $di_container ("net45") -mvc_version "4"
+ }
- Create-DIContainer-Package $di_container ("net40", "net45") -mvc_version "4"
- Create-DIContainer-Modules-Package $di_container ("net40", "net45") -mvc_version "4"
-
Create-DIContainer-Package $di_container ("net45") -mvc_version "5"
Create-DIContainer-Modules-Package $di_container ("net45") -mvc_version "5"
}
diff --git a/nuget/mvcsitemapprovider.di.modules/MvcSiteMapProvider.DI.Grace.Modules.nutrans b/nuget/mvcsitemapprovider.di.modules/MvcSiteMapProvider.DI.Grace.Modules.nutrans
new file mode 100644
index 00000000..bf909005
--- /dev/null
+++ b/nuget/mvcsitemapprovider.di.modules/MvcSiteMapProvider.DI.Grace.Modules.nutrans
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/MvcSiteMapProvider/CodeAsConfiguration/Grace/App_Start/CompositionRoot.cs b/src/MvcSiteMapProvider/CodeAsConfiguration/Grace/App_Start/CompositionRoot.cs
new file mode 100644
index 00000000..a22400e3
--- /dev/null
+++ b/src/MvcSiteMapProvider/CodeAsConfiguration/Grace/App_Start/CompositionRoot.cs
@@ -0,0 +1,23 @@
+using System;
+using DI;
+using DI.Grace;
+using DI.Grace.Modules;
+
+internal class CompositionRoot
+{
+ public static IDependencyInjectionContainer Compose()
+ {
+ // Create new container
+ var container = new Grace.DependencyInjection.DependencyInjectionContainer();
+
+ // Install MVC sitemap provider
+ container.Configure(new MvcSiteMapProviderModule());
+
+ // Install Controllers
+ container.Configure(new MvcModule());
+
+ // Add your DI configuration here
+
+ return new GraceDependencyInjectionContainer(container.RootScope);
+ }
+}
diff --git a/src/MvcSiteMapProvider/CodeAsConfiguration/Grace/DI/Grace/GraceDependencyInjectionContainer.cs b/src/MvcSiteMapProvider/CodeAsConfiguration/Grace/DI/Grace/GraceDependencyInjectionContainer.cs
new file mode 100644
index 00000000..4426c5ce
--- /dev/null
+++ b/src/MvcSiteMapProvider/CodeAsConfiguration/Grace/DI/Grace/GraceDependencyInjectionContainer.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using Grace.DependencyInjection;
+
+namespace DI.Grace
+{
+ internal class GraceDependencyInjectionContainer
+ : IDependencyInjectionContainer
+ {
+ public GraceDependencyInjectionContainer(IExportLocator container)
+ {
+ if (container == null)
+ throw new ArgumentNullException("container");
+
+ this.container = container;
+ }
+ private readonly IExportLocator container;
+
+ public object GetInstance(Type type)
+ {
+ return container.Locate(type);
+ }
+
+ public object TryGetInstance(Type type)
+ {
+ try
+ {
+ return container.Locate(type);
+ }
+ catch
+ {
+ return null;
+ }
+ }
+
+ public IEnumerable