ASP.NET vNext Blog Post Series

ASP.NET vNext was announced at TechEd 2014, and I have been playing around with it a bit. ASP.NET vNext is an exciting and revolutionary change for the Microsoft.NET development platform. ASP.NET vNext is now open-source, and available on Github at this location: https://github.com/aspnet/Home. I want to start a blog post series on the ASP.NET vNext, and share my experience as I learn more about it.

Keeping it simple

Each blog post in the series will be short and simple so I can write them in a short amount of time, and keep it focused on one (at most two) topic(s) per post. My goal is to make it easy to absorb the information as there are a ton of great new stuff to cover.

Many other people in the community have blogged about the key new features of the ASP.NET vNext. I will link to those blog posts in my next blog post.

MVC 6 POCO Controller

Today, I want to start this blog post series with a teaser code snippet for those developers familiar with the ASP.NET MVC. Getting Started with ASP.NET MVC 6 article from ASP.NET website shows how to write a lightweight POCO (plain-old CLR object) MVC Controller class in the upcoming ASP.NET MVC 6.

However, it doesn't show us how to use the to render a View. This is how I wrote my POCO MVC Controller based on the  sample from Github.   Note that this may not be the best way to write it, but this is good enough for now.

using Microsoft.AspNet.Mvc; using Microsoft.AspNet.Mvc.ModelBinding; using MvcSample.Web.Models;

namespace MvcSample.Web { public class HomeController { IActionResultHelper html; IModelMetadataProvider mmp;

public HomeController(IActionResultHelper h, IModelMetadataProvider mmp) { this.html = h; this.mmp = mmp; }

public IActionResult Index { var viewData = new ViewDataDictionary(mmp) { Model = User }; return html.View("Index", viewData); }

public User User { return new User { Name = "My name", Address = "My address" }; } } }

Please feel free to give me feedback as this will greatly help me organize the blog posts in this series, and plan head.

Thanks for reading!

This article is part of the GWB Archives. Original Author: Soe Tun

New on Geeks with Blogs

  • We Won The One Award I Actually Care About

    Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

  • Your Customers Build the Features Now

    I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

  • Get the Size of a Directory in Linux the Easy Way

    du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

  • Vim Search and Replace: The Ultimate Guide

    One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.