Nuke the old MvcSample self host sample
This commit is contained in:
parent
ed1b2ddcc3
commit
a8cc6828dd
47
WebFx.sln
47
WebFx.sln
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.21005.1
|
||||
VisualStudioVersion = 12.0.30313.0
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{DAAE4C74-D06F-4874-A166-33305D2643CE}"
|
||||
EndProject
|
||||
|
|
@ -11,10 +11,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.Mvc.Razor.
|
|||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.Mvc.Razor.k10", "src\Microsoft.AspNet.Mvc.Razor\Microsoft.AspNet.Mvc.Razor.k10.csproj", "{0D2C8C3D-AFC3-4E1F-A6D8-9F690EE5E063}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MvcSample.net45", "samples\MvcSample\MvcSample.net45.csproj", "{501817DD-8143-4A50-888D-99896A82CD12}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MvcSample.k10", "samples\MvcSample\MvcSample.k10.csproj", "{A7D7CD66-A407-4144-8AB7-07F895F87137}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.Mvc.Razor.Host.net45", "src\Microsoft.AspNet.Mvc.Razor.Host\Microsoft.AspNet.Mvc.Razor.Host.net45.csproj", "{A25566C9-97C7-4770-BBC1-9B815D3B1380}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.Mvc.Razor.Host.k10", "src\Microsoft.AspNet.Mvc.Razor.Host\Microsoft.AspNet.Mvc.Razor.Host.k10.csproj", "{613579ED-7B96-4F5C-8DBF-D2C580257BE2}"
|
||||
|
|
@ -33,8 +29,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "net45", "net45", "{6C2EDE5B
|
|||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "net45", "net45", "{222CA408-93EE-473A-9325-D04989EC9FEF}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "k10", "k10", "{CE037E26-9EB5-48E2-B73B-06C6FF6CC9F5}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNet.Mvc.ModelBinding.Test.net45", "test\Microsoft.AspNet.Mvc.ModelBinding.Test\Microsoft.AspNet.Mvc.ModelBinding.Test.net45.csproj", "{42195A56-42C0-4CFF-A982-B6E24EFC6356}"
|
||||
|
|
@ -75,14 +69,6 @@ Global
|
|||
{0D2C8C3D-AFC3-4E1F-A6D8-9F690EE5E063}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0D2C8C3D-AFC3-4E1F-A6D8-9F690EE5E063}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0D2C8C3D-AFC3-4E1F-A6D8-9F690EE5E063}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{501817DD-8143-4A50-888D-99896A82CD12}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{501817DD-8143-4A50-888D-99896A82CD12}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{501817DD-8143-4A50-888D-99896A82CD12}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{501817DD-8143-4A50-888D-99896A82CD12}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A7D7CD66-A407-4144-8AB7-07F895F87137}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A7D7CD66-A407-4144-8AB7-07F895F87137}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A7D7CD66-A407-4144-8AB7-07F895F87137}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A7D7CD66-A407-4144-8AB7-07F895F87137}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A25566C9-97C7-4770-BBC1-9B815D3B1380}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A25566C9-97C7-4770-BBC1-9B815D3B1380}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A25566C9-97C7-4770-BBC1-9B815D3B1380}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
|
@ -160,29 +146,26 @@ Global
|
|||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{222CA408-93EE-473A-9325-D04989EC9FEF} = {DAAE4C74-D06F-4874-A166-33305D2643CE}
|
||||
{CE037E26-9EB5-48E2-B73B-06C6FF6CC9F5} = {DAAE4C74-D06F-4874-A166-33305D2643CE}
|
||||
{6C2EDE5B-CA31-42DD-A352-84B10CC70C98} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E}
|
||||
{4EB70D0E-E27E-4C42-AB58-BC8B325EDFB3} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E}
|
||||
{A25566C9-97C7-4770-BBC1-9B815D3B1380} = {6C2EDE5B-CA31-42DD-A352-84B10CC70C98}
|
||||
{28AA31B2-6504-432D-8599-1501FE0B100A} = {6C2EDE5B-CA31-42DD-A352-84B10CC70C98}
|
||||
{236CDB04-8FDA-4152-9A5B-7F98C19C663A} = {6C2EDE5B-CA31-42DD-A352-84B10CC70C98}
|
||||
{365CA5C6-037D-4E6E-AF05-F5FA42E024EB} = {6C2EDE5B-CA31-42DD-A352-84B10CC70C98}
|
||||
{792E181C-7645-4268-A04F-DB134411AD74} = {6C2EDE5B-CA31-42DD-A352-84B10CC70C98}
|
||||
{64BD92BA-F313-496C-ACE6-B9C4C10C420E} = {6C2EDE5B-CA31-42DD-A352-84B10CC70C98}
|
||||
{10142178-F784-4E17-A583-E9A37A80EFAA} = {6C2EDE5B-CA31-42DD-A352-84B10CC70C98}
|
||||
{0D2C8C3D-AFC3-4E1F-A6D8-9F690EE5E063} = {4EB70D0E-E27E-4C42-AB58-BC8B325EDFB3}
|
||||
{A25566C9-97C7-4770-BBC1-9B815D3B1380} = {6C2EDE5B-CA31-42DD-A352-84B10CC70C98}
|
||||
{613579ED-7B96-4F5C-8DBF-D2C580257BE2} = {4EB70D0E-E27E-4C42-AB58-BC8B325EDFB3}
|
||||
{24947215-86AB-4DD0-B94E-88B1EC4DC877} = {4EB70D0E-E27E-4C42-AB58-BC8B325EDFB3}
|
||||
{28AA31B2-6504-432D-8599-1501FE0B100A} = {6C2EDE5B-CA31-42DD-A352-84B10CC70C98}
|
||||
{DA65D56F-1C40-4D38-B1E0-BF9641A98C52} = {4EB70D0E-E27E-4C42-AB58-BC8B325EDFB3}
|
||||
{0D2C8C3D-AFC3-4E1F-A6D8-9F690EE5E063} = {4EB70D0E-E27E-4C42-AB58-BC8B325EDFB3}
|
||||
{5E701B23-73E4-45D2-8521-1D7A94E152F1} = {4EB70D0E-E27E-4C42-AB58-BC8B325EDFB3}
|
||||
{BA88E212-5889-48DC-823F-A3A67DDEF123} = {4EB70D0E-E27E-4C42-AB58-BC8B325EDFB3}
|
||||
{D4576205-A5B5-4382-BB34-19DE9855FE94} = {4EB70D0E-E27E-4C42-AB58-BC8B325EDFB3}
|
||||
{501817DD-8143-4A50-888D-99896A82CD12} = {222CA408-93EE-473A-9325-D04989EC9FEF}
|
||||
{688ABC8B-BFA9-4CFF-9458-A466FEBB0448} = {222CA408-93EE-473A-9325-D04989EC9FEF}
|
||||
{A7D7CD66-A407-4144-8AB7-07F895F87137} = {CE037E26-9EB5-48E2-B73B-06C6FF6CC9F5}
|
||||
{236CDB04-8FDA-4152-9A5B-7F98C19C663A} = {6C2EDE5B-CA31-42DD-A352-84B10CC70C98}
|
||||
{4EB70D0E-E27E-4C42-AB58-BC8B325EDFB3} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E}
|
||||
{6C2EDE5B-CA31-42DD-A352-84B10CC70C98} = {32285FA4-6B46-4D6B-A840-2B13E4C8B58E}
|
||||
{222CA408-93EE-473A-9325-D04989EC9FEF} = {DAAE4C74-D06F-4874-A166-33305D2643CE}
|
||||
{42195A56-42C0-4CFF-A982-B6E24EFC6356} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
|
||||
{537CC0EE-4B62-4789-9AE9-94BE28E0D25A} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
|
||||
{688ABC8B-BFA9-4CFF-9458-A466FEBB0448} = {222CA408-93EE-473A-9325-D04989EC9FEF}
|
||||
{5E701B23-73E4-45D2-8521-1D7A94E152F1} = {4EB70D0E-E27E-4C42-AB58-BC8B325EDFB3}
|
||||
{792E181C-7645-4268-A04F-DB134411AD74} = {6C2EDE5B-CA31-42DD-A352-84B10CC70C98}
|
||||
{BA88E212-5889-48DC-823F-A3A67DDEF123} = {4EB70D0E-E27E-4C42-AB58-BC8B325EDFB3}
|
||||
{64BD92BA-F313-496C-ACE6-B9C4C10C420E} = {6C2EDE5B-CA31-42DD-A352-84B10CC70C98}
|
||||
{10142178-F784-4E17-A583-E9A37A80EFAA} = {6C2EDE5B-CA31-42DD-A352-84B10CC70C98}
|
||||
{D4576205-A5B5-4382-BB34-19DE9855FE94} = {4EB70D0E-E27E-4C42-AB58-BC8B325EDFB3}
|
||||
{3EB2CFF9-6E67-4C03-9AC4-2DD169024938} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
|
||||
{75A07B53-C5EE-4995-A55B-27562C23BCCD} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
|
||||
{68FC3791-A9E4-4EDE-93A5-C7AC7DC0ED6E} = {3BA657BF-28B1-42DA-B5B0-1C4601FCF7B1}
|
||||
|
|
|
|||
|
|
@ -1,35 +0,0 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
|
||||
namespace MvcSample.Filters
|
||||
{
|
||||
public class AgeEnhancerAttribute : ActionFilterAttribute
|
||||
{
|
||||
public async override Task Invoke(ActionFilterContext context, Func<Task> next)
|
||||
{
|
||||
object age = null;
|
||||
|
||||
if (context.ActionParameters.TryGetValue("age", out age))
|
||||
{
|
||||
if (age is int)
|
||||
{
|
||||
var intAge = (int) age;
|
||||
|
||||
if (intAge < 21)
|
||||
{
|
||||
intAge += 5;
|
||||
}
|
||||
else if (intAge > 30)
|
||||
{
|
||||
intAge = 29;
|
||||
}
|
||||
|
||||
context.ActionParameters["age"] = intAge;
|
||||
}
|
||||
}
|
||||
|
||||
await next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using MvcSample.Models;
|
||||
|
||||
namespace MvcSample.Filters
|
||||
{
|
||||
public class InspectResultPageAttribute : ActionResultFilterAttribute
|
||||
{
|
||||
public async override Task Invoke(ActionResultFilterContext context, Func<Task> next)
|
||||
{
|
||||
ViewResult viewResult = context.Result as ViewResult;
|
||||
|
||||
if (viewResult != null)
|
||||
{
|
||||
User user = viewResult.ViewData.Model as User;
|
||||
|
||||
if (user != null)
|
||||
{
|
||||
user.Name += "**" + user.Name + "**";
|
||||
}
|
||||
}
|
||||
|
||||
await next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
|
||||
namespace MvcSample
|
||||
{
|
||||
public class PassThroughAttribute : AuthorizationFilterAttribute
|
||||
{
|
||||
public async override Task Invoke(AuthorizationFilterContext context, Func<Task> next)
|
||||
{
|
||||
await next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
|
||||
namespace MvcSample.Filters
|
||||
{
|
||||
public class UserNameProvider : ActionFilterAttribute
|
||||
{
|
||||
private static readonly string[] _userNames = new[] { "Jon", "David", "Goliath" };
|
||||
private static int _index;
|
||||
|
||||
public override async Task Invoke(ActionFilterContext context, Func<Task> next)
|
||||
{
|
||||
object originalUserName = null;
|
||||
|
||||
context.ActionParameters.TryGetValue("userName", out originalUserName);
|
||||
|
||||
var userName = originalUserName as string;
|
||||
|
||||
if (string.IsNullOrWhiteSpace(userName))
|
||||
{
|
||||
context.ActionParameters["userName"] = _userNames[(_index++)%3];
|
||||
}
|
||||
|
||||
await next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
using Microsoft.AspNet.Mvc;
|
||||
using MvcSample.Filters;
|
||||
using MvcSample.Models;
|
||||
|
||||
namespace MvcSample
|
||||
{
|
||||
[ServiceFilter(typeof(PassThroughAttribute), Order = 1)]
|
||||
[ServiceFilter(typeof(PassThroughAttribute))]
|
||||
[PassThrough(Order = 0)]
|
||||
[PassThrough(Order = 2)]
|
||||
[InspectResultPage]
|
||||
[UserNameProvider(Order = -1)]
|
||||
public class FiltersController : Controller
|
||||
{
|
||||
private readonly User _user = new User() { Name = "User Name", Address = "Home Address" };
|
||||
|
||||
// TODO: Add a real filter here
|
||||
[ServiceFilter(typeof(PassThroughAttribute))]
|
||||
[AgeEnhancer]
|
||||
public IActionResult Index(int age, string userName)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(userName))
|
||||
{
|
||||
_user.Name = userName;
|
||||
}
|
||||
|
||||
_user.Age = age;
|
||||
|
||||
return View("MyView", _user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
using Microsoft.AspNet.Abstractions;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using MvcSample.Models;
|
||||
|
||||
namespace MvcSample.RandomNameSpace
|
||||
{
|
||||
public class Home2Controller
|
||||
{
|
||||
private User _user = new User() { Name = "User Name", Address = "Home Address" };
|
||||
|
||||
public Home2Controller(IActionResultHelper actionResultHelper)
|
||||
{
|
||||
Result = actionResultHelper;
|
||||
}
|
||||
|
||||
public IActionResultHelper Result { get; private set; }
|
||||
|
||||
public HttpContext Context { get; set; }
|
||||
|
||||
public string Index()
|
||||
{
|
||||
return "Hello World: my namespace is " + this.GetType().Namespace;
|
||||
}
|
||||
|
||||
public IActionResult Something()
|
||||
{
|
||||
return new ContentResult
|
||||
{
|
||||
Content = "Hello World From Content"
|
||||
};
|
||||
}
|
||||
|
||||
public IActionResult Hello()
|
||||
{
|
||||
return Result.Content("Hello World");
|
||||
}
|
||||
|
||||
public void Raw()
|
||||
{
|
||||
Context.Response.WriteAsync("Hello World raw");
|
||||
}
|
||||
|
||||
public IActionResult UserJson()
|
||||
{
|
||||
var jsonResult = Result.Json(_user);
|
||||
jsonResult.Indent = false;
|
||||
|
||||
return jsonResult;
|
||||
}
|
||||
|
||||
public User User()
|
||||
{
|
||||
return _user;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
using Microsoft.AspNet.Mvc;
|
||||
using MvcSample.Models;
|
||||
|
||||
namespace MvcSample
|
||||
{
|
||||
public class HomeController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
{
|
||||
return View("MyView", User());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Action that exercises query\form based model binding.
|
||||
/// </summary>
|
||||
public IActionResult SaveUser(User user)
|
||||
{
|
||||
return View("MyView", user);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Action that exercises input formatter
|
||||
/// </summary>
|
||||
public IActionResult Post([FromBody]User user)
|
||||
{
|
||||
return View("MyView", user);
|
||||
}
|
||||
|
||||
public IActionResult Something()
|
||||
{
|
||||
return new ContentResult
|
||||
{
|
||||
Content = "Hello World From Content"
|
||||
};
|
||||
}
|
||||
|
||||
public IActionResult Hello()
|
||||
{
|
||||
return Result.Content("Hello World");
|
||||
}
|
||||
|
||||
public void Raw()
|
||||
{
|
||||
Context.Response.WriteAsync("Hello World raw");
|
||||
}
|
||||
|
||||
public User User()
|
||||
{
|
||||
User user = new User()
|
||||
{
|
||||
Name = "My name",
|
||||
Address = "My address"
|
||||
};
|
||||
|
||||
return user;
|
||||
}
|
||||
|
||||
public IActionResult MyView()
|
||||
{
|
||||
return View(User());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
|
||||
using Microsoft.AspNet.Mvc;
|
||||
|
||||
namespace MvcSample
|
||||
{
|
||||
public class LinkController : Controller
|
||||
{
|
||||
public IActionResult Details()
|
||||
{
|
||||
return View();
|
||||
}
|
||||
|
||||
public string About()
|
||||
{
|
||||
return Url.Action(null);
|
||||
}
|
||||
|
||||
public string Get()
|
||||
{
|
||||
return Url.Route(new { controller = "Home", action = "Details" });
|
||||
}
|
||||
|
||||
public string Link1()
|
||||
{
|
||||
return Url.Action("Index", "Home");
|
||||
}
|
||||
|
||||
public string Link2()
|
||||
{
|
||||
return Url.Action("Link2");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace MvcSample.Models
|
||||
{
|
||||
public class User
|
||||
{
|
||||
[Required]
|
||||
[MinLength(4)]
|
||||
public string Name { get; set; }
|
||||
public string Address { get; set; }
|
||||
public int Age { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
|
||||
using Microsoft.AspNet.Mvc;
|
||||
|
||||
namespace MvcSample
|
||||
{
|
||||
public class OverloadController
|
||||
{
|
||||
private readonly IActionResultHelper _result;
|
||||
|
||||
public OverloadController(IActionResultHelper result)
|
||||
{
|
||||
_result = result;
|
||||
}
|
||||
|
||||
public IActionResult Get()
|
||||
{
|
||||
return _result.Content("Get()");
|
||||
}
|
||||
|
||||
public IActionResult Get(int id)
|
||||
{
|
||||
return _result.Content("Get(id)");
|
||||
}
|
||||
|
||||
public IActionResult Get(int id, string name)
|
||||
{
|
||||
return _result.Content("Get(id, name)");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.Net.Runtime;
|
||||
|
||||
#if NET45
|
||||
using Microsoft.Owin.Hosting;
|
||||
|
||||
#endif
|
||||
|
||||
namespace MvcSample
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
const string baseUrl = "http://localhost:9001/";
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
|
||||
public Program(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
}
|
||||
|
||||
public void Main()
|
||||
{
|
||||
#if NET45
|
||||
using (WebApp.Start(baseUrl, app => new Startup(_serviceProvider).Configuration(app)))
|
||||
{
|
||||
Console.WriteLine("Listening at {0}", baseUrl);
|
||||
Process.Start(baseUrl);
|
||||
Console.WriteLine("Press any key to exit");
|
||||
Console.ReadKey();
|
||||
}
|
||||
#else
|
||||
Console.WriteLine("Hello World");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
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")]
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
namespace MvcSample
|
||||
{
|
||||
public class SimplePocoController
|
||||
{
|
||||
public string Index()
|
||||
{
|
||||
return "Hello world";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
using Microsoft.AspNet.Mvc;
|
||||
|
||||
namespace MvcSample
|
||||
{
|
||||
public class SimpleRest : Controller
|
||||
{
|
||||
public string Get()
|
||||
{
|
||||
return "Get method";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,67 +0,0 @@
|
|||
|
||||
#if NET45
|
||||
using Autofac;
|
||||
using System;
|
||||
using Microsoft.AspNet.Abstractions;
|
||||
using Microsoft.AspNet.DependencyInjection;
|
||||
using Microsoft.AspNet.DependencyInjection.Autofac;
|
||||
using Microsoft.AspNet.DependencyInjection.NestedProviders;
|
||||
using Microsoft.AspNet.Mvc;
|
||||
using Microsoft.AspNet.Routing;
|
||||
using Owin;
|
||||
|
||||
namespace MvcSample
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
private IServiceProvider _serviceProvider;
|
||||
|
||||
public Startup(IServiceProvider serviceProvider)
|
||||
{
|
||||
_serviceProvider = serviceProvider;
|
||||
}
|
||||
|
||||
public void Configuration(IAppBuilder app)
|
||||
{
|
||||
app.UseErrorPage();
|
||||
|
||||
// Temporary bridge from katana to Owin
|
||||
app.UseBuilder(ConfigureMvc);
|
||||
}
|
||||
|
||||
private void ConfigureMvc(IBuilder builder)
|
||||
{
|
||||
var containerBuilder = new ContainerBuilder();
|
||||
var services = MvcServices.GetDefaultServices();
|
||||
|
||||
AutofacRegistration.Populate(containerBuilder, _serviceProvider, services);
|
||||
containerBuilder.RegisterInstance<PassThroughAttribute>(new PassThroughAttribute());
|
||||
|
||||
// This is only needed in the selfhost sample - there's no need to port this to the web sample, since
|
||||
// it's provided by default there.
|
||||
containerBuilder.RegisterType<TypeActivator>().As<ITypeActivator>();
|
||||
|
||||
// Temporary until we have support for open generics in our DI system.
|
||||
containerBuilder.RegisterGeneric(typeof(NestedProviderManager<>)).As(typeof(INestedProviderManager<>));
|
||||
containerBuilder.RegisterGeneric(typeof(NestedProviderManagerAsync<>)).As(typeof(INestedProviderManagerAsync<>));
|
||||
|
||||
var serviceProvider = containerBuilder.Build().Resolve<IServiceProvider>();
|
||||
|
||||
var routes = new RouteCollection()
|
||||
{
|
||||
DefaultHandler = new MvcApplication(serviceProvider),
|
||||
};
|
||||
|
||||
routes.MapRoute(
|
||||
"{controller}/{action}",
|
||||
new { controller = "Home", action = "Index" });
|
||||
|
||||
routes.MapRoute(
|
||||
"{controller}",
|
||||
new { controller = "Home" });
|
||||
|
||||
builder.UseRouter(routes);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
#if VIEWMETADATA
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class ViewMetadata
|
||||
{
|
||||
public static Dictionary<string, Type> Metadata
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Dictionary<string, Type>
|
||||
{
|
||||
{
|
||||
"~/Views/Home/MyView.cshtml",
|
||||
typeof(MvcSample.Views.MyView)
|
||||
},
|
||||
{
|
||||
"~/Views/Shared/_Layout.cshtml",
|
||||
typeof(MvcSample.Views.Layout)
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
|
||||
|
||||
@Url.Action("About")
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
@using MvcSample.Models
|
||||
@model User
|
||||
@{
|
||||
Layout = "/Views/Shared/_Layout.cshtml";
|
||||
ViewBag.Title = "Home Page";
|
||||
string nullValue = null;
|
||||
}
|
||||
|
||||
<div class="jumbotron">
|
||||
<h1>ASP.NET</h1>
|
||||
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
|
||||
<p><a href="http://asp.net" class="btn btn-primary btn-large">Learn more »</a></p>
|
||||
</div>
|
||||
<div class="row">
|
||||
<h3 title="@Model.Name" class="@nullValue">Hello @Model.Name! Happy @Model.Age birthday.</h3>
|
||||
|
||||
<div class="col-md-4">
|
||||
<h2>Getting started</h2>
|
||||
<p>
|
||||
ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
|
||||
enables a clean separation of concerns and gives you full control over markup
|
||||
for enjoyable, agile development.
|
||||
</p>
|
||||
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301865">Learn more »</a></p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<h2>Get more libraries</h2>
|
||||
<p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p>
|
||||
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301866">Learn more »</a></p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<h2>Web Hosting</h2>
|
||||
<p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p>
|
||||
<p><a class="btn btn-default" href="http://go.microsoft.com/fwlink/?LinkId=301867">Learn more »</a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>@ViewBag.Title - My ASP.NET Application</title>
|
||||
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div class="navbar navbar-inverse navbar-fixed-top">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="navbar-collapse collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li><a href="/">Home</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container body-content">
|
||||
@RenderBody()
|
||||
<hr />
|
||||
<address>
|
||||
@Model.Address
|
||||
</address>
|
||||
<footer>
|
||||
<p>© @DateTime.Now.Year - My ASP.NET Application</p>
|
||||
</footer>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
|
||||
|
||||
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
<!--
|
||||
In the example below, the "SetAttributes" transform will change the value of
|
||||
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
|
||||
finds an attribute "name" that has a value of "MyDB".
|
||||
|
||||
<connectionStrings>
|
||||
<add name="MyDB"
|
||||
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
|
||||
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
|
||||
</connectionStrings>
|
||||
-->
|
||||
<system.web>
|
||||
<!--
|
||||
In the example below, the "Replace" transform will replace the entire
|
||||
<customErrors> section of your web.config file.
|
||||
Note that because there is only one customErrors section under the
|
||||
<system.web> node, there is no need to use the "xdt:Locator" attribute.
|
||||
|
||||
<customErrors defaultRedirect="GenericError.htm"
|
||||
mode="RemoteOnly" xdt:Transform="Replace">
|
||||
<error statusCode="500" redirect="InternalError.htm"/>
|
||||
</customErrors>
|
||||
-->
|
||||
</system.web>
|
||||
</configuration>
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!-- For more information on using web.config transformation visit http://go.microsoft.com/fwlink/?LinkId=125889 -->
|
||||
|
||||
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
<!--
|
||||
In the example below, the "SetAttributes" transform will change the value of
|
||||
"connectionString" to use "ReleaseSQLServer" only when the "Match" locator
|
||||
finds an attribute "name" that has a value of "MyDB".
|
||||
|
||||
<connectionStrings>
|
||||
<add name="MyDB"
|
||||
connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
|
||||
xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>
|
||||
</connectionStrings>
|
||||
-->
|
||||
<system.web>
|
||||
<compilation xdt:Transform="RemoveAttributes(debug)" />
|
||||
<!--
|
||||
In the example below, the "Replace" transform will replace the entire
|
||||
<customErrors> section of your web.config file.
|
||||
Note that because there is only one customErrors section under the
|
||||
<system.web> node, there is no need to use the "xdt:Locator" attribute.
|
||||
|
||||
<customErrors defaultRedirect="GenericError.htm"
|
||||
mode="RemoteOnly" xdt:Transform="Replace">
|
||||
<error statusCode="500" redirect="InternalError.htm"/>
|
||||
</customErrors>
|
||||
-->
|
||||
</system.web>
|
||||
</configuration>
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.5" />
|
||||
<httpRuntime targetFramework="4.5" />
|
||||
</system.web>
|
||||
|
||||
</configuration>
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
{
|
||||
"version": "0.1-alpha-*",
|
||||
"dependencies": {
|
||||
"Microsoft.AspNet.Abstractions": "0.1-alpha-*",
|
||||
"Microsoft.AspNet.ConfigurationModel": "0.1-alpha-*",
|
||||
"Microsoft.AspNet.DependencyInjection": "0.1-alpha-*",
|
||||
"Microsoft.AspNet.Routing": "0.1-alpha-*",
|
||||
"Microsoft.AspNet.Mvc.ModelBinding": "",
|
||||
"Microsoft.AspNet.Mvc.Core": "",
|
||||
"Microsoft.AspNet.Mvc": "",
|
||||
"Microsoft.AspNet.Mvc.Razor": "",
|
||||
"Microsoft.AspNet.Mvc.Rendering": ""
|
||||
},
|
||||
"configurations": {
|
||||
"net45": {
|
||||
"dependencies": {
|
||||
"Autofac": "3.3.0",
|
||||
"Owin": "1.0",
|
||||
"Microsoft.AspNet.DependencyInjection.Autofac": "0.1-alpha-*",
|
||||
"Microsoft.Owin": "2.1.0",
|
||||
"Microsoft.Owin.Diagnostics": "2.1.0",
|
||||
"Microsoft.Owin.Hosting": "2.1.0",
|
||||
"Microsoft.Owin.Host.HttpListener": "2.1.0",
|
||||
"Microsoft.AspNet.AppBuilderSupport": "0.1-alpha-*",
|
||||
"System.ComponentModel.DataAnnotations": ""
|
||||
}
|
||||
},
|
||||
"k10": {
|
||||
"dependencies": {
|
||||
"System.ComponentModel": "4.0.0.0",
|
||||
"System.Console": "4.0.0.0",
|
||||
"System.Diagnostics.Debug": "4.0.10.0",
|
||||
"System.Diagnostics.Tools": "4.0.0.0",
|
||||
"System.Dynamic.Runtime": "4.0.0.0",
|
||||
"System.Runtime": "4.0.20.0",
|
||||
"System.Runtime.InteropServices": "4.0.10.0",
|
||||
"System.Threading.Tasks": "4.0.0.0",
|
||||
"Microsoft.ComponentModel.DataAnnotations": "0.1-alpha-*"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
|
||||
<system.web>
|
||||
<compilation debug="true" targetFramework="4.5" />
|
||||
<httpRuntime targetFramework="4.5" />
|
||||
</system.web>
|
||||
|
||||
</configuration>
|
||||
Loading…
Reference in New Issue