commit 3dfd79a26d35f07498e8f50505d6f62409603caf Author: David Fowler Date: Thu Dec 12 08:47:22 2013 -0800 Initial commit. diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..bdaa5ba982 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,50 @@ +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain + +*.jpg binary +*.png binary +*.gif binary + +*.cs text=auto diff=csharp +*.vb text=auto +*.resx text=auto +*.c text=auto +*.cpp text=auto +*.cxx text=auto +*.h text=auto +*.hxx text=auto +*.py text=auto +*.rb text=auto +*.java text=auto +*.html text=auto +*.htm text=auto +*.css text=auto +*.scss text=auto +*.sass text=auto +*.less text=auto +*.js text=auto +*.lisp text=auto +*.clj text=auto +*.sql text=auto +*.php text=auto +*.lua text=auto +*.m text=auto +*.asm text=auto +*.erl text=auto +*.fs text=auto +*.fsx text=auto +*.hs text=auto + +*.csproj text=auto +*.vbproj text=auto +*.fsproj text=auto +*.dbproj text=auto +*.sln text=auto eol=crlf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..efef81553b --- /dev/null +++ b/.gitignore @@ -0,0 +1,26 @@ +[Oo]bj/ +[Bb]in/ +*.xap +*.user +/TestResults +*.vspscc +*.vssscc +*.suo +*.cache +*.docstates +_ReSharper.* +*.csproj.user +*[Rr]e[Ss]harper.user +_ReSharper.*/ +packages/* +artifacts/* +msbuild.log +PublishProfiles/ +*.psess +*.vsp +*.pidb +*.userprefs +*DS_Store +*.ncrunchsolution +*.log +*.vspx \ No newline at end of file diff --git a/Microsoft.AspNet.CoreServices/ActivatorUtilities.cs b/Microsoft.AspNet.CoreServices/ActivatorUtilities.cs new file mode 100644 index 0000000000..ac5dec543b --- /dev/null +++ b/Microsoft.AspNet.CoreServices/ActivatorUtilities.cs @@ -0,0 +1,86 @@ +using System; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Reflection; + +namespace Microsoft.AspNet.CoreServices +{ + /// + /// Helper code for the various activator services. + /// + public static class ActivatorUtilities + { + /// + /// Retrieve an instance of the given type from the service provider. If one is not found then instantiate it directly. + /// + /// + /// + /// + public static object GetServiceOrCreateInstance(IServiceProvider services, Type type) + { + return GetServiceNoExceptions(services, type) ?? CreateInstance(services, type); + } + + [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "IServiceProvider may throw unknown exceptions")] + private static object GetServiceNoExceptions(IServiceProvider services, Type type) + { + try + { + return services.GetService(type); + } + catch + { + return null; + } + } + + /// + /// Instantiate an object of the given type, using constructor service injection if possible. + /// + /// + /// + /// + public static object CreateInstance(IServiceProvider services, Type type) + { + return CreateFactory(type).Invoke(services); + } + + /// + /// Creates a factory to instantiate a type using constructor service injection if possible. + /// + /// + /// + public static Func CreateFactory(Type type) + { + if (type == null) + { + throw new ArgumentNullException("type"); + } + + ConstructorInfo[] constructors = type + .GetConstructors() + .Where(IsInjectable) + .ToArray(); + + if (constructors.Length == 1) + { + ParameterInfo[] parameters = constructors[0].GetParameters(); + return services => + { + var args = new object[parameters.Length]; + for (int index = 0; index != parameters.Length; ++index) + { + args[index] = services.GetService(parameters[index].ParameterType); + } + return Activator.CreateInstance(type, args); + }; + } + return _ => Activator.CreateInstance(type); + } + + private static bool IsInjectable(ConstructorInfo constructor) + { + return constructor.IsPublic && constructor.GetParameters().Length != 0; + } + } +} diff --git a/Microsoft.AspNet.CoreServices/Microsoft.AspNet.CoreServices.csproj b/Microsoft.AspNet.CoreServices/Microsoft.AspNet.CoreServices.csproj new file mode 100644 index 0000000000..9d819b6622 --- /dev/null +++ b/Microsoft.AspNet.CoreServices/Microsoft.AspNet.CoreServices.csproj @@ -0,0 +1,50 @@ + + + + + Debug + AnyCPU + {EC38534C-A2D1-413F-97D1-55EEF5D2FB71} + Library + Properties + Microsoft.AspNet.CoreServices + Microsoft.AspNet.CoreServices + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Microsoft.AspNet.CoreServices/Properties/AssemblyInfo.cs b/Microsoft.AspNet.CoreServices/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..b671463e0b --- /dev/null +++ b/Microsoft.AspNet.CoreServices/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Microsoft.AspNet.CoreServices")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Microsoft.AspNet.CoreServices")] +[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("96e86a39-7c32-4257-af76-d12e449dc25a")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Microsoft.AspNet.CoreServices/ServiceProvider.cs b/Microsoft.AspNet.CoreServices/ServiceProvider.cs new file mode 100644 index 0000000000..a775f6624f --- /dev/null +++ b/Microsoft.AspNet.CoreServices/ServiceProvider.cs @@ -0,0 +1,163 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Microsoft.AspNet.CoreServices +{ + /// + /// The default IServiceProvider. + /// + public class ServiceProvider : IServiceProvider + { + private readonly IDictionary> _services = new Dictionary>(); + private readonly IDictionary>> _priorServices = new Dictionary>>(); + + /// + /// + /// + public ServiceProvider() + { + _services[typeof(IServiceProvider)] = () => this; + } + + /// + /// Gets the service object of the specified type. + /// + /// + /// + public virtual object GetService(Type serviceType) + { + return GetSingleService(serviceType) ?? GetMultiService(serviceType); + } + + private object GetSingleService(Type serviceType) + { + Func serviceFactory; + return _services.TryGetValue(serviceType, out serviceFactory) + ? serviceFactory.Invoke() + : null; + } + + private object GetMultiService(Type collectionType) + { + if (collectionType.IsGenericType && + collectionType.GetGenericTypeDefinition() == typeof(IEnumerable<>)) + { + Type serviceType = collectionType.GetGenericArguments().Single(); + Type listType = typeof(List<>).MakeGenericType(serviceType); + var services = (IList)Activator.CreateInstance(listType); + + Func serviceFactory; + if (_services.TryGetValue(serviceType, out serviceFactory)) + { + services.Add(serviceFactory()); + + List> prior; + if (_priorServices.TryGetValue(serviceType, out prior)) + { + foreach (var factory in prior) + { + services.Add(factory()); + } + } + } + return services; + } + return null; + } + + /// + /// Remove all occurrences of the given type from the provider. + /// + /// + /// + public virtual ServiceProvider RemoveAll() + { + return RemoveAll(typeof(T)); + } + + /// + /// Remove all occurrences of the given type from the provider. + /// + /// + /// + public virtual ServiceProvider RemoveAll(Type type) + { + _services.Remove(type); + _priorServices.Remove(type); + return this; + } + + /// + /// Add an instance of type TService to the list of providers. + /// + /// + /// + /// + public virtual ServiceProvider AddInstance(object instance) + { + return AddInstance(typeof(TService), instance); + } + + /// + /// Add an instance of the given type to the list of providers. + /// + /// + /// + /// + public virtual ServiceProvider AddInstance(Type service, object instance) + { + return Add(service, () => instance); + } + + /// + /// Specify that services of the type TService should be fulfilled by the type TImplementation. + /// + /// + /// + /// + public virtual ServiceProvider Add() + { + return Add(typeof(TService), typeof(TImplementation)); + } + + /// + /// Specify that services of the type serviceType should be fulfilled by the type implementationType. + /// + /// + /// + /// + public virtual ServiceProvider Add(Type serviceType, Type implementationType) + { + Func factory = ActivatorUtilities.CreateFactory(implementationType); + return Add(serviceType, () => factory(this)); + } + + /// + /// Specify that services of the given type should be created with the given serviceFactory. + /// + /// + /// + /// + public virtual ServiceProvider Add(Type serviceType, Func serviceFactory) + { + Func existing; + if (_services.TryGetValue(serviceType, out existing)) + { + List> prior; + if (_priorServices.TryGetValue(serviceType, out prior)) + { + prior.Add(existing); + } + else + { + prior = new List> { existing }; + _priorServices.Add(serviceType, prior); + } + } + _services[serviceType] = serviceFactory; + return this; + } + } +} diff --git a/Microsoft.AspNet.CoreServices/ServiceProviderExtensions.cs b/Microsoft.AspNet.CoreServices/ServiceProviderExtensions.cs new file mode 100644 index 0000000000..4e9c1ce184 --- /dev/null +++ b/Microsoft.AspNet.CoreServices/ServiceProviderExtensions.cs @@ -0,0 +1,23 @@ +using System; + +namespace Microsoft.AspNet.CoreServices +{ + public static class ServiceProviderExtensions + { + /// + /// Retrieve a service of type T from the IServiceProvider. + /// + /// + /// + /// + public static T GetService(this IServiceProvider services) + { + if (services == null) + { + throw new ArgumentNullException("services"); + } + + return (T)services.GetService(typeof(T)); + } + } +} diff --git a/Microsoft.AspNet.Mvc.sln b/Microsoft.AspNet.Mvc.sln new file mode 100644 index 0000000000..abccee7ece --- /dev/null +++ b/Microsoft.AspNet.Mvc.sln @@ -0,0 +1,34 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.Mvc", "Microsoft.AspNet.Mvc\Microsoft.AspNet.Mvc.csproj", "{2A0C26F1-0240-4AE1-AE00-4691C291B122}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MvcSample", "MvcSample\MvcSample.csproj", "{069EA0A1-BB68-41D1-A973-3429EC09264C}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.CoreServices", "Microsoft.AspNet.CoreServices\Microsoft.AspNet.CoreServices.csproj", "{EC38534C-A2D1-413F-97D1-55EEF5D2FB71}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2A0C26F1-0240-4AE1-AE00-4691C291B122}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2A0C26F1-0240-4AE1-AE00-4691C291B122}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2A0C26F1-0240-4AE1-AE00-4691C291B122}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2A0C26F1-0240-4AE1-AE00-4691C291B122}.Release|Any CPU.Build.0 = Release|Any CPU + {069EA0A1-BB68-41D1-A973-3429EC09264C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {069EA0A1-BB68-41D1-A973-3429EC09264C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {069EA0A1-BB68-41D1-A973-3429EC09264C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {069EA0A1-BB68-41D1-A973-3429EC09264C}.Release|Any CPU.Build.0 = Release|Any CPU + {EC38534C-A2D1-413F-97D1-55EEF5D2FB71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EC38534C-A2D1-413F-97D1-55EEF5D2FB71}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EC38534C-A2D1-413F-97D1-55EEF5D2FB71}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EC38534C-A2D1-413F-97D1-55EEF5D2FB71}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Microsoft.AspNet.Mvc/Controller.cs b/Microsoft.AspNet.Mvc/Controller.cs new file mode 100644 index 0000000000..72b94ecc99 --- /dev/null +++ b/Microsoft.AspNet.Mvc/Controller.cs @@ -0,0 +1,15 @@ +using System.Threading.Tasks; +using Microsoft.Owin; + +namespace Microsoft.AspNet.Mvc +{ + public class Controller + { + public void Initialize(IOwinContext context) + { + Context = context; + } + + public IOwinContext Context { get; set; } + } +} diff --git a/Microsoft.AspNet.Mvc/ControllerActionInvoker.cs b/Microsoft.AspNet.Mvc/ControllerActionInvoker.cs new file mode 100644 index 0000000000..1b9e1f0ce4 --- /dev/null +++ b/Microsoft.AspNet.Mvc/ControllerActionInvoker.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Microsoft.AspNet.Mvc +{ + public class ControllerActionInvoker : IActionInvoker + { + private ControllerContext _context; + + public ControllerActionInvoker(ControllerContext context) + { + _context = context; + } + + public Task InvokeActionAsync(string actionName) + { + var method = _context.Controller.GetType().GetMethod(actionName); + + if (method == null) + { + throw new InvalidOperationException(String.Format("Could not find action method '{0}'", actionName)); + } + + method.Invoke(_context.Controller, null); + + return Task.FromResult(0); + } + } +} diff --git a/Microsoft.AspNet.Mvc/ControllerActionInvokerFactory.cs b/Microsoft.AspNet.Mvc/ControllerActionInvokerFactory.cs new file mode 100644 index 0000000000..44d12da40e --- /dev/null +++ b/Microsoft.AspNet.Mvc/ControllerActionInvokerFactory.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace Microsoft.AspNet.Mvc +{ + public class ControllerActionInvokerFactory : IActionInvokerFactory + { + public IActionInvoker CreateInvoker(ControllerContext context) + { + return new ControllerActionInvoker(context); + } + } +} diff --git a/Microsoft.AspNet.Mvc/ControllerContext.cs b/Microsoft.AspNet.Mvc/ControllerContext.cs new file mode 100644 index 0000000000..57c15e459e --- /dev/null +++ b/Microsoft.AspNet.Mvc/ControllerContext.cs @@ -0,0 +1,28 @@ +using System; +using Microsoft.Owin; + +namespace Microsoft.AspNet.Mvc +{ + public class ControllerContext + { + public ControllerContext(IOwinContext context, object controller) + { + if (context == null) + { + throw new ArgumentNullException("context"); + } + + if (controller == null) + { + throw new ArgumentNullException("controller"); + } + + HttpContext = context; + Controller = controller; + } + + public virtual object Controller { get; set; } + + public virtual IOwinContext HttpContext { get; set; } + } +} diff --git a/Microsoft.AspNet.Mvc/DefaultControllerFactory.cs b/Microsoft.AspNet.Mvc/DefaultControllerFactory.cs new file mode 100644 index 0000000000..fe4dfca643 --- /dev/null +++ b/Microsoft.AspNet.Mvc/DefaultControllerFactory.cs @@ -0,0 +1,40 @@ +using System; +using System.Linq; +using System.Reflection; +using Microsoft.AspNet.CoreServices; +using Microsoft.Owin; + +namespace Microsoft.AspNet.Mvc +{ + public class DefaultControllerFactory : IControllerFactory + { + private readonly IServiceProvider _serviceProvider; + + public DefaultControllerFactory(IServiceProvider serviceProvider) + { + _serviceProvider = serviceProvider; + } + + public object CreateController(IOwinContext context, string controllerName) + { + foreach (var a in AppDomain.CurrentDomain.GetAssemblies()) + { + var type = a.GetType(controllerName) ?? + a.GetType(a.GetName().Name + "." + controllerName) ?? + a.GetTypes().FirstOrDefault(t => t.Name.Equals(controllerName, StringComparison.OrdinalIgnoreCase)); + + if (type != null) + { + return ActivatorUtilities.CreateInstance(_serviceProvider, type); + } + } + + return null; + } + + public void ReleaseController(object controller) + { + + } + } +} diff --git a/Microsoft.AspNet.Mvc/IActionInvoker.cs b/Microsoft.AspNet.Mvc/IActionInvoker.cs new file mode 100644 index 0000000000..0ff839ad07 --- /dev/null +++ b/Microsoft.AspNet.Mvc/IActionInvoker.cs @@ -0,0 +1,9 @@ +using System.Threading.Tasks; + +namespace Microsoft.AspNet.Mvc +{ + public interface IActionInvoker + { + Task InvokeActionAsync(string actionName); + } +} diff --git a/Microsoft.AspNet.Mvc/IActionInvokerFactory.cs b/Microsoft.AspNet.Mvc/IActionInvokerFactory.cs new file mode 100644 index 0000000000..5cb5bde9d5 --- /dev/null +++ b/Microsoft.AspNet.Mvc/IActionInvokerFactory.cs @@ -0,0 +1,8 @@ + +namespace Microsoft.AspNet.Mvc +{ + public interface IActionInvokerFactory + { + IActionInvoker CreateInvoker(ControllerContext context); + } +} diff --git a/Microsoft.AspNet.Mvc/IController.cs b/Microsoft.AspNet.Mvc/IController.cs new file mode 100644 index 0000000000..69ceefd322 --- /dev/null +++ b/Microsoft.AspNet.Mvc/IController.cs @@ -0,0 +1,10 @@ +using System.Threading.Tasks; +using Microsoft.Owin; + +namespace Microsoft.AspNet.Mvc +{ + public interface IController + { + Task Execute(IOwinContext context); + } +} diff --git a/Microsoft.AspNet.Mvc/IControllerFactory.cs b/Microsoft.AspNet.Mvc/IControllerFactory.cs new file mode 100644 index 0000000000..e6c8caecc2 --- /dev/null +++ b/Microsoft.AspNet.Mvc/IControllerFactory.cs @@ -0,0 +1,11 @@ +using Microsoft.Owin; + +namespace Microsoft.AspNet.Mvc +{ + public interface IControllerFactory + { + object CreateController(IOwinContext context, string controllerName); + + void ReleaseController(object controller); + } +} diff --git a/Microsoft.AspNet.Mvc/Microsoft.AspNet.Mvc.csproj b/Microsoft.AspNet.Mvc/Microsoft.AspNet.Mvc.csproj new file mode 100644 index 0000000000..6aa3dbc0a7 --- /dev/null +++ b/Microsoft.AspNet.Mvc/Microsoft.AspNet.Mvc.csproj @@ -0,0 +1,73 @@ + + + + + Debug + AnyCPU + {2A0C26F1-0240-4AE1-AE00-4691C291B122} + Library + Properties + Microsoft.AspNet.Mvc + Microsoft.AspNet.Mvc + v4.5 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\Microsoft.Owin.2.0.2\lib\net45\Microsoft.Owin.dll + + + ..\packages\Owin.1.0\lib\net40\Owin.dll + + + + + + + + + + + + + + + + + + + + + + + + {ec38534c-a2d1-413f-97d1-55eef5d2fb71} + Microsoft.AspNet.CoreServices + + + + + \ No newline at end of file diff --git a/Microsoft.AspNet.Mvc/MvcHandler.cs b/Microsoft.AspNet.Mvc/MvcHandler.cs new file mode 100644 index 0000000000..77408ace6a --- /dev/null +++ b/Microsoft.AspNet.Mvc/MvcHandler.cs @@ -0,0 +1,59 @@ +using System; +using System.Threading.Tasks; +using Microsoft.AspNet.CoreServices; +using Microsoft.Owin; + +namespace Microsoft.AspNet.Mvc +{ + public class MvcHandler + { + private readonly IServiceProvider _serviceProvider; + + public MvcHandler() + : this(null) + { + } + + public MvcHandler(IServiceProvider serviceProvider) + { + _serviceProvider = serviceProvider ?? MvcServices.Create(); + } + + public Task ExecuteAsync(IOwinContext context) + { + string[] parts = (context.Request.PathBase + context.Request.Path).Value.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries); + + // {controller}/{action} + string controllerName = GetPartOrDefault(parts, 0, "HomeController"); + string actionName = GetPartOrDefault(parts, 1, "Index"); + + var factory = _serviceProvider.GetService(); + object controller = factory.CreateController(context, controllerName); + + if (controller == null) + { + throw new InvalidOperationException(String.Format("Couldn't find controller '{0}'.", controllerName)); + } + + var controllerBase = controller as Controller; + + if (controllerBase != null) + { + // TODO: Make this the controller context + controllerBase.Initialize(context); + } + + var controllerContext = new ControllerContext(context, controller); + + IActionInvokerFactory invokerFactory = _serviceProvider.GetService(); + var invoker = invokerFactory.CreateInvoker(controllerContext); + + return invoker.InvokeActionAsync(actionName); + } + + private static string GetPartOrDefault(string[] parts, int index, string defaultValue) + { + return index < parts.Length ? parts[index] : defaultValue; + } + } +} diff --git a/Microsoft.AspNet.Mvc/MvcServices.cs b/Microsoft.AspNet.Mvc/MvcServices.cs new file mode 100644 index 0000000000..c558b926ec --- /dev/null +++ b/Microsoft.AspNet.Mvc/MvcServices.cs @@ -0,0 +1,21 @@ +using System; +using Microsoft.AspNet.CoreServices; + +namespace Microsoft.AspNet.Mvc +{ + public static class MvcServices + { + public static IServiceProvider Create() + { + var services = new ServiceProvider(); + DoCallback((service, implementation) => services.Add(service, implementation)); + return services; + } + + private static void DoCallback(Action callback) + { + callback(typeof(IControllerFactory), typeof(DefaultControllerFactory)); + callback(typeof(IActionInvokerFactory), typeof(ControllerActionInvokerFactory)); + } + } +} diff --git a/Microsoft.AspNet.Mvc/Properties/AssemblyInfo.cs b/Microsoft.AspNet.Mvc/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..301a9d302b --- /dev/null +++ b/Microsoft.AspNet.Mvc/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Microsoft.AspNet.Mvc")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Microsoft.AspNet.Mvc")] +[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("8d29eb97-6f81-4304-86b1-adc94ffcff7d")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Microsoft.AspNet.Mvc/packages.config b/Microsoft.AspNet.Mvc/packages.config new file mode 100644 index 0000000000..57b34eaa5d --- /dev/null +++ b/Microsoft.AspNet.Mvc/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/MvcSample/HomeController.cs b/MvcSample/HomeController.cs new file mode 100644 index 0000000000..8d4fa21623 --- /dev/null +++ b/MvcSample/HomeController.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNet.Mvc; + +namespace MvcSample +{ + public class HomeController + { + public string Index() + { + return "Hello World"; + } + } +} \ No newline at end of file diff --git a/MvcSample/MvcSample.csproj b/MvcSample/MvcSample.csproj new file mode 100644 index 0000000000..1f173455d9 --- /dev/null +++ b/MvcSample/MvcSample.csproj @@ -0,0 +1,113 @@ + + + + + Debug + AnyCPU + + + 2.0 + {069EA0A1-BB68-41D1-A973-3429EC09264C} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + MvcSample + MvcSample + v4.5 + true + + + + + 12.0 + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + False + ..\packages\Microsoft.Owin.2.0.2\lib\net45\Microsoft.Owin.dll + + + ..\packages\Microsoft.Owin.Diagnostics.2.0.2\lib\net40\Microsoft.Owin.Diagnostics.dll + + + ..\packages\Owin.1.0\lib\net40\Owin.dll + + + + + + + + Web.config + + + Web.config + + + + + + + + + + + + + {2a0c26f1-0240-4ae1-ae00-4691c291b122} + Microsoft.AspNet.Mvc + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + + False + True + 48140 + / + http://localhost:48140/ + False + True + + + False + + + + + + + + + \ No newline at end of file diff --git a/MvcSample/Properties/AssemblyInfo.cs b/MvcSample/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..2740c73537 --- /dev/null +++ b/MvcSample/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("MvcSample")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("MvcSample")] +[assembly: AssemblyCopyright("Copyright © 2013")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("d5a71550-dac9-4925-ad7c-f0fd3ccf5dab")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/MvcSample/Startup.cs b/MvcSample/Startup.cs new file mode 100644 index 0000000000..42bff2320f --- /dev/null +++ b/MvcSample/Startup.cs @@ -0,0 +1,24 @@ +using System; +using System.Threading.Tasks; +using Microsoft.AspNet.Mvc; +using Microsoft.Owin; +using Owin; + +[assembly: OwinStartup(typeof(MvcSample.Startup))] + +namespace MvcSample +{ + public class Startup + { + public void Configuration(IAppBuilder app) + { + var handler = new MvcHandler(); + + // Pretending to be routing + app.Run(async context => + { + await handler.ExecuteAsync(context); + }); + } + } +} diff --git a/MvcSample/Web.Debug.config b/MvcSample/Web.Debug.config new file mode 100644 index 0000000000..2e302f9f95 --- /dev/null +++ b/MvcSample/Web.Debug.config @@ -0,0 +1,30 @@ + + + + + + + + + + \ No newline at end of file diff --git a/MvcSample/Web.Release.config b/MvcSample/Web.Release.config new file mode 100644 index 0000000000..c35844462b --- /dev/null +++ b/MvcSample/Web.Release.config @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/MvcSample/Web.config b/MvcSample/Web.config new file mode 100644 index 0000000000..bfb640da20 --- /dev/null +++ b/MvcSample/Web.config @@ -0,0 +1,11 @@ + + + + + + + + \ No newline at end of file diff --git a/MvcSample/packages.config b/MvcSample/packages.config new file mode 100644 index 0000000000..82e60bea94 --- /dev/null +++ b/MvcSample/packages.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file