Más contenido relacionado Más de Ed Charbeneau (20) ASP.NET Core Changes Every Developer Should Know2. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.2
About Me
Ed Charbeneau
Developer Advocate for Progress, Telerik DevCraft
Developer.Telerik.com
Twitter @EdCharbeneau
3. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.3
.NET Core overview
4. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.4
Hello.NET Core 1.1.1
Cross platform
• Development,
Deployment
• Windows, Mac, Linux
Current App Models
• UWP
• Console Applications
• ASP.NET Core
5. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.5
Hello ASP.NET Core 1.1.1
vNext
ASP.NET 5
ASP.NET Core 1.1.1
6. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.6
Cross platform development
DOTNET CLI
Read more: http://developer.telerik.com/featured/net-cli-decoded/
7. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.7
Cross platform deployment
8. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.8
ASP.NET Core “MVC” overview
9. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.9
Just the FAQs
ASP.NET Core is a complete rewrite
MVC is a module for ASP.NET Core
MVC and Web API have merged into a single codebase
There is no longer an MVC 6, the module was reversioned to 1.0
There is no official plan for WebForms on .NET Core
10. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.10
Modularity
ASP.NET Core uses a request pipeline
Successor to HttpHandler
Read / Write directly to the HTTP Pipeline
using middleware
MVC is ASP.NET Core middleware
Raw access to the HTTP request/response
(A.k.a. the bare metal)
Built using Dependency Injection
Pipeline
HTTP Request
HTTP Response
middleware
MVC
middleware
11. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.11
No dependency on IIS
Remember, cross platform!
ASP.NET Core can be:
• Self-hosted
• Cloud hosted
• Mac, Windows, Linux
• Docker (integrated with VS2017)
12. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.12
cross-platform asynchronous I/O library
Should use Reverse Proxy Server
ASP.NET Core Module .UseIISIntegration()
Servers
Kestrel WebListener
Windows only
Direct connection to the Internet
13. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.13
File, New Project
14. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.14
What's (Mostly) the Same
MVC design pattern itself
• Models
• Views
• Controller
15. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.15
What's Missing
App_Start
App_Data
Global.ASAX
/Scripts
/Content
Web.Config*
* For IIS support only
16. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.16
ASP.NET Core 1.0 – 1.1 changes
/src
Project.json
• In ASP.NET Core 1.0, this replaced .csproj
• .csproj is back in 1.1
• 1.0 apps must to migrate to .csproj
Web.Config
• For IIS support only
17. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.17
What’s new
/wwwroot
Dependencies
/Data/Migrations
Appsettings.json
Startup.cs
Program.cs
_ViewImports.cshtml
19. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.19
Application Initialization
21. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.21
Application Initialization
ASP.NET Core
No dependency on IIS
Initialized via command line
Program.Main() builds web host &
invokes Startup
Startup.cs handles startup
.NET Framework 4.6, ASP.NET
IIS (InetMgr.exe) initialized application
HttpApplication.Application_Start()
Startup code handled by Global.asax
22. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.22
Application Startup
Replaces App_Start, and Global.ASAX
Startup is called by WebHostBuilder.UseStartup
Program.Main()
ConfigureServices()
Configure()
Startup
Startup()
23. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.23
New Configuration Options
Configuration options are resolved in the Startup constructor
Settings can be stored in .json, .xml or environment variables
24. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.24
Overloading Configuration Options
Overloading
Dev Ops Friendly
Multiple configs
• Development
• Staging
• Production
Last setting to be resolved wins
Example
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile(“foo.json”)
.AddJsonFile(“bar.json”);
Configuration.GetValue<string>(“myKey”); //=> Bar
25. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.25
Startup methods
ConfigureServices
Dependency Injection (DI) configured
IServiceCollection is the DI container
AddTransient<TService, TImplementation>();
services.AddMvc();
Configure
HTTP Middleware is added
IApplicationBuilder is the pipeline
app.UseMiddleware()
app.UseMvc(routes …)
27. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.27
TagHelpers
28. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.28
Overview
Augments HTML to include server-side code & values
29. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.29
Just the FAQs
TagHelpers Are
Use tags and attributes like HTML
Rendered Server-Side
Supported by intellisense
TagHelpers Are Not
Going to eliminate Razor @Html
Like WebForms
31. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.31
32. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.32
UI for ASP.NET Core
For ASP.NET Core
70+ ASP.NET MVC Components Powered by Kendo UI
Charts
Graphs
Grids
Schedulers
Responsive, works on any screen size
33. © 2016 Progress Software Corporation and/or its subsidiaries or affiliates. All rights reserved.33
Polished UI for All your Apps
http://telerik.com/devcraft
Notas del editor OmniSharp
Yeoman
Dotnet exe