Slide deck from session ".NET 4.5.1 In Action" by Suthep Sangvirotjanaphat (Microsoft MVP / ASP.NET) in "Microsoft TechDays Thailand 2013" event on November 26, 2013 Shangri-la hotel.
4. Not just the
code
Accepting
contributions
Source code
Only EF team has commit rights
Nightly builds
Same code review process as
internal changes
Issue tracking
Feature specs
Design meeting notes
Only affects
how we
develop, not
how we ship
Same license
Same support
Same quality
9. No “upfront decision”
on any ASP.NET
technology
Unified dialog
One Project: Web Forms, MVC,
Web API
Add any framework to any project
Scaffolding works across all
frameworks
Configurable authentication
Bootstrap used for
layout and styling
Templates based on
Bootstrap.js
Popular CSS layout framework
Many themes available
Completely new
scaffolding system
for One ASP.NET
Web application code
generation based on your data
model
Targets data-driven and CRUD
boilerplate code
14. Enable CORS
in web API
Per action
Per controller
[EnableCors(origins: "http://www.example.com",
headers: "*", methods: "*")]
public class ItemsController : ApiController
{
public HttpResponseMessage GetAll() { ... }
public HttpResponseMessage GetItem(int id) { ... }
public HttpResponseMessage Post() { ... }
[DisableCors]
public HttpResponseMessage PutItem(int id) { ... }
Globally
}
15. Incredibly simple realtime web for .NET
How can I use real-time
functionality in my app?
Simplicity
Anytime a user refreshes the page or you
use polling
Dashboards and monitoring
Collaborative anything
Gaming
Real-time forms and concurrency management
Reach
Performance
Entity Framework and Open SourceThe Entity Framework source code is released under an open source license (Apache 2.0), and the code repository is hosted on CodePlex to further increase development transparency. This enables everyone in the community to engage and provide feedback on code check-ins, bug fixes, and new feature development. They can build and test the product on a daily basis using the most up to date version of the source code and tests. Community contributions also are welcomed, so you can help shape and build Entity Framework into an even better product.Microsoft continues to ship official builds of Entity Framework as a fully supported Microsoft product, both standalone as well as part of Visual Studio (the same as today). It continues to be staffed by the same Microsoft developers, and is supported through the same Microsoft support mechanisms. The goal is to increase the development feedback loop even more, allowing us to deliver an even better product.
ToolingOur focus with the tooling has been on adding EF6 support and shipping out-of-band between releases of Visual Studio. The tooling itself does not include any new features, but most of the new runtime features can be used with models created in the EF Designer.Runtime (Available on NuGet)Async Query and Save adds support for the task-based asynchronous patterns that were introduced in .NET 4.5Custom Code First Conventions allow you to write your own conventions to help avoid repetitive configuration. We provide a simple API for lightweight conventions as well as some more complex building blocks to allow you to author more complicated conventions. Code First Mapping to Insert/Update/Delete Stored Procedures Connection Resiliency enables automatic recovery from transient connection failuresCode-Based Configuration gives you the option of performing configuration in code that was traditionally performed in a config file.Dependency Resolution introduces support for the Service Locator pattern and we factored out some pieces of functionality that can be replaced with custom implementations.Enums, Spatial and Better Performance on .NET 4.0 - By moving the core components that used to be in the .NET Framework into the EF NuGet package we are now able to offer enum support, spatial data types and the performance improvements from EF5 on .NET 4.0Configurable Migrations History Table allows you to customize the definition of the migrations history table. This is particularly useful for database providers that require the appropriate data types. etc.. to be specified for the Migrations History table to work correctly. DbContext can now be created with a DbConnection that is already opened which enables scenarios where it would be helpful if the connection could be open when creating the context (such as sharing a connection between components where you cannot guarantee the state of the connection).
See:Demo 5 – Entity Framework 6
All of ASP.NET is a single platform, including Web-Forms. It’s more than just MVC and Web API. There is ONE ASP.NET and all of our Web Frameworks work together with similar features.There is one dialog for creating Web Forms, MVC, Web API, and SPA applications.Differences: MVC approach is newer and more powerful, but Web-Forms is easier and what many customers use.Example: With Friendly URLs, people using Web-Forms can do Mobile as well.Authorization is configurable at project creation time and will be extended with more options later.We made a simple UI for creating projects that offer support for multiple ASP.NET frameworks (Web Forms, MVC, and Web API). New features are available for Web Forms that used to be offered only for MVC, such as automatic test project creation and an intranet site template.Different authentication configurations can be chosen, which works the same in all ASP.NET frameworks and in web-hosting software other than IIS.
One ASP.NET means…:Unified DialogScaffolding for everyoneMVC, Web Forms, Web API togetherNew extensible Identity SystemOWIN (Open Web Interface for .NET)No ASP.NET technology “upfront decision”Mix and match any ASP.NET technology (MVC, WebForms, WebAPI, etc.) within any VS web-projectBootstrap used for layout and stylingPopular CSS layout framework for simple and consistent page layoutBuilt-in responsive design for mobile, and glyphs for iconographyHighly themeable with many themes; both free and premium availableASP.NET Scaffolding is a code generation framework for ASP.NET Web applications. Visual Studio 2013 includes pre-installed code generators for MVC, Web Forms, and Web API projects. You add a scaffold to your project when you want to quickly add boilerplate code that interacts with data models. Using scaffolding can reduce the amount of time to develop standard data operations in your project.Code generation based on your data models; targets data-driven boilerplate codeSupports Web Forms, MVC, Web API, and moreDistribution via NuGet
Browser Link – SignalR channel between browser and Visual StudioBrowser Link is a new feature that uses a SignalR channel between browsers and Visual Studio 2013. It allows manually refreshing of all connected browsers by clicking the toolbar refresh button. You can connect multiple browsers to your development site, including mobile emulators, and click refresh to refresh all the browsers at the same time.Browser Link is just a channel between your Visual Studio IDE and any open browser. This will allow dynamic data exchange between your web application and Visual Studio. This feature is enabled by default in Visual Studio 2013 Preview. When Browser Link is enabled we register an HTTPModule with ASP.NET, which will then inject a <script> reference to every page request from the server. This JavaScript connects the browser to Visual Studio. For Preview,a feature called the “Refresh Linked Browsers” uses this channel between browsers and IDE.Because the browser-side code is all JavaScript, it should work on all browsers, without requiring any other browser plug-in. It also works on iPad/iPhone emulators. The connection between the browser and Visual Studio uses SignalR, an ASP.NET technology for bi-directional communication over HTTP. When Browser link is enabled, Visual Studio acts as a SignalR server, to which multiple clients (the browsers) can connect.New HTML editorIn VS2013 a new HTML editor is released for Razor files and web project HTML files. Web Form files and Windows Store JavaScript application HTML files still use the legacy editor. The new HTML editor provides a single unified HTML5-based schema. It has some improvement such as automatic brace completion, jQuery UI and AngularJS attribute IntelliSense, attribute IntelliSense Grouping. The tools\options\Text Editors settings are different for legacy and new HTML editors, they are named “HTML (Razor)” (For web projects HTML files and razor files) and “HTML” (Web Forms and pages in Windows 8 Modern JavaScript app).“Enable Edit and Continue” debugging option is now on by default for new web applications.
ToolingOur focus with the tooling has been on adding EF6 support and shipping out-of-band between releases of Visual Studio. The tooling itself does not include any new features, but most of the new runtime features can be used with models created in the EF Designer.Runtime (Available on NuGet)Async Query and Save adds support for the task-based asynchronous patterns that were introduced in .NET 4.5Custom Code First Conventions allow you to write your own conventions to help avoid repetitive configuration. We provide a simple API for lightweight conventions as well as some more complex building blocks to allow you to author more complicated conventions. Code First Mapping to Insert/Update/Delete Stored Procedures Connection Resiliency enables automatic recovery from transient connection failuresCode-Based Configuration gives you the option of performing configuration in code that was traditionally performed in a config file.Dependency Resolution introduces support for the Service Locator pattern and we factored out some pieces of functionality that can be replaced with custom implementations.Enums, Spatial and Better Performance on .NET 4.0 - By moving the core components that used to be in the .NET Framework into the EF NuGet package we are now able to offer enum support, spatial data types and the performance improvements from EF5 on .NET 4.0Configurable Migrations History Table allows you to customize the definition of the migrations history table. This is particularly useful for database providers that require the appropriate data types. etc.. to be specified for the Migrations History table to work correctly. DbContext can now be created with a DbConnection that is already opened which enables scenarios where it would be helpful if the connection could be open when creating the context (such as sharing a connection between components where you cannot guarantee the state of the connection).
ASP.NET Identity is the new membership system for building ASP.NET web applications. ASP.NET Identity allows you to add logon features to your application and makes it easy to customize data about the logged-on user.The ASP.NET Identity membership system is a complete rewrite of the old Membership feature. Membership was a built-in way to validate and store user credentials, to manage user authentication in websites using the provider model to make it extensible, but it had many limitations. The new Identity system still supports user management and adding login features to applications, but it's easier to customize the data you store about each user. The magic of customizing user information happens through the use of Entity Framework's Code First feature. You can extend the Plain Old C# Object (POCO) classes it uses to automatically update the data store for the custom data. Identity uses a database by default, but you can also store it in other locations, such as SharePoint, Azure Table Service, or NoSql databases by plugging in a different storage provider.Featuresof the ASP.NET Identity system include:One ASP.NET Identity systemASP.NET Identity can be used with all of the ASP.NET frameworks such as ASP.NET MVC, Web Forms, Webpages, Web API, and SignalRPlug in profile data about the userWhen you create new users in your application, it is now easy to add extra information about the user, for example,to add a birthdate option for users when they register an account in your application.ASP.NET Identity uses Entity Framework Code First and you can extend the POCO classes.Persistence controlBy default the ASP.NET Identity system will store all the user information in a database. ASP.NET Identity uses Entity Framework Code First to implement all of its persistence mechanism.If your application requiresthat this information be stored in SharePoint, Azure Table Service, NoSql databases, etc., it is now possible to plug in different storage providers.Unit testabilityASP.NET Identity lets you write Unit Tests for the parts of your application that use ASP.NET IdentitySimple Role providerA Simple Role provider lets you restrict access to parts of your application by Roles. You can easily create Roles such as “Admin” and add Users to Roles.Claims BasedASP.NET Identity supports claims-based authentication, where the user’s identity is represented as a set of claims. The benefit of claims-based authentication is that it abstracts the individual elements of identity and access control into two parts: a general notion of claims and the concept of a trusted issuer or authority. This is a new way of thinking about identity and authentication that can overcome the limitations of relying on usernames and passwords, and now it's built into ASP.NET.External Logons You can easily add external logons such as Microsoft Account, Facebook, Twitter, and Google to your application and store the user specific data in your application using this system.You can also add logon functionality using Windows Azure Active Directory and store the user specific data in your application using this system.
Visual Studio 2013 and ASP.NET 4.5.1 expand the security options for Single Page Applications (SPA) and Web API services to integrate with external authentication services, which include several OAuth/OpenID and social media authentication services: Microsoft Accounts, Twitter, Facebook, and Google.Using External Authentication ServicesThe abundance of external authentication services that are currently available to web developers help to reduce development time when creating new web applications. Web users typically have several existing accounts for popular web services and social media websites. When a web application usesauthentication services from an external web service or social media website, it saves development time that would have been spent creating an authentication implementation. Plus, using an external authentication service saves end users from having to create another account for your web application, and from having to remember another username and password.Visual Studio 2013 and ASP.NET 4.5.1 make integration with external authentication services easier for developers by providing built-in integration for the following authentication services:FacebookGoogleMicrosoft Accounts (Windows Live ID accounts)TwitterRouting is how Web API matches a URI to an action. Web API 2 supports a new type of routing, called attribute routing. Open Web Interface for .NET (OWIN) defines an abstraction between .NET web servers and web applications. OWIN decouples the web application from the server, which makes OWIN ideal for self-hosting a web application in your own process, outside of IIS, for example, inside an Azure worker role.ASP.NET Web API OData makes it really simple to expose your IQueryable backend to be queried using the OData query syntax.
CORS Support.Browser security prevents a webpage from making AJAX requests to another domain. This restriction is called the same-origin policy. However, sometimes you might want to let other sites call your web API. Cross Origin Resource Sharing (CORS) is a W3C standard that allows a server to relax the same-origin policy. Using CORS, a server can explicitly allow some cross-origin requests while rejecting others.You can enable CORS per action, per controller, or globally for all Web API controllers in your application. To enable CORS for a single action, set the [EnableCors] attribute on the action method If you set [EnableCors] on the controller class, it applies to all the actions on the controllerGlobally in Global.asax fileIf you apply the attribute at more than one scope, the order of precedence is:ActionControllerGlobalIf a browser supports CORS, it sets these headers automatically for cross-origin requests; you don’t need to do anything special in your JavaScript code.
ASP.NET SignalR is a library for ASP.NET developers that simplifies the process of adding real-time web functionality to applications. Real-time web functionality is the ability to have server code push content to connected clients instantly as it becomes available, rather than having the server wait for a client to request new data. SignalR uses Websockets when it is supported by the browser and the server, and gracefully falls back to other techniques and technologies when it is not. Either way, your application code stays the same. SignalR can be used to add any sort of "real-time" web functionality to your ASP.NET application. While chat is often used as an example, you can do a whole lot more. Anytime a user refreshes a web page to see new data, or the page implements long polling to retrieve new data, it is a candidate for using SignalR. Examples include dashboards and monitoring applications, collaborative applications (such as simultaneous editing of documents), job progress updates, and real-time forms.SignalR also enables completely new types of web applications that require high frequency updates from the server, for example, real-time gaming. Apart from Web support, the PCL lib provides support for WinRT, Silverlight, WPF, console application, and Windows Phone clients, for both .NET 4 and .NET 4.5.SignalR provides a simple API for creating server-to-client remote procedure calls (RPC) that call JavaScript functions in client browsers (and other client platforms) from server-side .NET code. SignalR also includes API for connection management (for instance, connect and disconnect events), and grouping connections.SignalR handles connection management automatically and lets you broadcast messages to all connected clients simultaneously, like a chat room. You can also send messages to specific clients. The connection between the client and server is persistent, unlike a classic HTTP connection which is re-established for each communication.SignalR supports "server push" functionality, in which server code can call out to client code in the browser using Remote Procedure Calls (RPC), rather than the request-response model common on the web today. Supported Platforms => http://www.asp.net/signalr/overview/getting-started/supported-platforms
Apart from Web support, the PCL lib provides support for WinRT, Silverlight, WPF, console application, and Windows Phone clients, for both .NET 4 and .NET 4.5.ASP.NET SignalR is a library for ASP.NET developers that simplifies the process of adding real-time web functionality to applications. Real-time web functionality is the ability to have server code push content to connected clients instantly as it becomes available, rather than having the server wait for a client to request new data. SignalR uses Websockets when it is supported by the browser and the server, and gracefully falls back to other techniques and technologies when it is not. Either way, your application code stays the same. SignalR can be used to add any sort of "real-time" web functionality to your ASP.NET application. While chat is often used as an example, you can do a whole lot more. Anytime a user refreshes a web page to see new data, or the page implements long polling to retrieve new data, it is a candidate for using SignalR. Examples include dashboards and monitoring applications, collaborative applications (such as simultaneous editing of documents), job progress updates, and real-time forms.SignalR also enables completely new types of web applications that require high frequency updates from the server, for example, real-time gaming. SignalR provides a simple API for creating server-to-client remote procedure calls (RPC) that call JavaScript functions in client browsers (and other client platforms) from server-side .NET code. SignalR also includes API for connection management (for instance, connect and disconnect events), and grouping connections.SignalR handles connection management automatically, and lets you broadcast messages to all connected clients simultaneously, like a chat room. You can also send messages to specific clients. The connection between the client and server is persistent, unlike a classic HTTP connection, which is re-established for each communication.SignalR supports "server push" functionality, in which server code can call out to client code in the browser using Remote Procedure Calls (RPC), rather than the request-response model common on the web today. SupportedPlatforms=> http://www.asp.net/signalr/overview/getting-started/supported-platforms
SeeDemo 3 – Visual Studio Web Tooling Demo 3.1– Browser link Demo 3.2 – IE11 Developer tools (optional)Demo 3.3 – Edit and continue“Edit and continue” demo could show in the “What´s New .NET 4.5.1” talk.