迎接 asp.net 4.0 新世代新方向 奚江華 作家/微軟講師/技術顧問. 2 agenda 1....
Post on 22-Dec-2015
258 views
TRANSCRIPT
迎接 ASP.NET 4.0新世代新方向
奚江華作家/微軟講師/技術顧問
2
Agenda1.What's new in VS 20102. .NET Framework 4.03.ASP.NET 4.0
3
1. What's new in VS 2010
4
VS 2010 IDE
5
A New, Simplified SKU StructureVSTS Team Suite
w/ MSDN Premium
VSTS Development Ed.w/ MSDN Premium
VSTS Database Ed.w/ MSDN Premium
VSTS Test Ed.w/ MSDN Premium
VSTS Architecture Ed.w/ MSDN Premium
Visual Studio Professionalw/ MSDN Professional
Visual Studio Professionalw/ MSDN Premium
Visual Studio Professional
Visual Studio Standard
VS 2010 Ultimatew/ MSDN
VS 2010 Premiumw/ MSDN
VS 2010 Professionalw/ MSDN
VS 2010 Professional
6
VS 2010版本功能與目標
Audience
Feat
ure
Set
Minimal
Complete
Hobbyist Enterprise
Professional
Ultimate
Express
Premium
7
VS 2010高階功能概觀
Visual Studio 2010Professional
New WPF Editor
Generate FromUsage
Customizable IDE
Silverlight Tooling
Multi-CoreDevelopment
CloudDevelopment
WebDevelopment
WindowsDevelopment
OfficeDevelopment
SharePointDevelopment
8
VS 2010三大主軸訴求
Set your ideas free
SimplicityThrough
Integration
Quality CodeEnsured
9
Set your ideas freeCreate what you can imagine, build on the strengths of your team, and open up new possibilities.New prototyping, modeling, and visual design tools enable you to create innovative applications for Windows and the WebCreate a shared vision as a foundation for creativity with SketchFlow ,in Microsoft Expression® Studio , and Team Foundation ServerTake advantage of new opportunities & capabilities offered by multi-core programming and cloud development tools
10
Simplicity through integrationA single integrated development environment
that takes your skills further and adjusts to the way you work.Complete all your coding, modeling, testing, debugging, and deployment work without leaving the Visual Studio 2010 environmentUse existing standards and skills to target a growing number of application types including Microsoft SharePoint® and Windows® Azure™Work your way through multi-monitor support, partner extensions, and a new editor.
11
Quality tools help ensure quality resultsPowerful testing tools with proactive project management features help you build the right app the right way.Use the new IntelliTrace debugger to isolate the point of failure within a recorded application history.Stay ahead of the curve with proactive project management tools including new reports, dashboards, and planning worksheets.Know that you’ve built the right application the right way with manual and automated testing tools.
12
VS 2010 IDE
Demo
13
2 .NET Framework 4.0
14
.NET Framework 4.0
Base Class Libraries
The CLRJIT & NGEN
Garbage Collector
Security Model
Exception Handling
Loader & Binder
WPF Win Forms DLR ASP.NET WCF And
more!LINQ
15
.NET Framework與 CLR回顧
.NET 1.0 .NET 1.1 .NET 2.0
3.0
3.5
.NET 4
2002 2003 2008 CTP2005-08
CLR 1.0 CLR 1.1 CLR 2.0 CLR 4
SP1
16
CLR 2 - Existing Side-By-Side
Host Process (i.e. Outlook)
.NET 2.0
2.0 add-in
3.0
3.5
3.0 add-in
3.5 add-in
1.1 add-in
.NET 1.1
17
CLR 4 - In-Process Side-By-Side
.NET 2.0.NET 4.0
2.0 add-in
3.0
3.5
Host Process (i.e. Outlook)
3.0 add-in
3.5 add-in
4.0 add-in
18
Application Version 4.0Client Applications
WPF 4MEF
Web Applications
Web Forms 4AJAX 4
Client/Server
WCF 4
19
The Building BlocksParallel Computing
Task Parallel LibraryParallel LINQ
Data Access
Entity Framework 4Data Services 1.5
Runtime
DLR IntegrationType Equivalence
In-Process SxS
20
A lot of new for WF/WCF 4XAML-only workflows are the new default
Unified model between WF, WCF, and WPFExtended base activity librarySimplified WF programming modelSupport for arguments, variables, expressionsMajor improvements to WCF integrationRuntime and designer improvementsService discovery for WCFHosting & management via "Dublin“
21
ADO.NET Data Services 1.5
Server EnhancementsRow countServer-side pagingFriendly feedsBLOB streams
Client EnhancementsRow CountWPF/SL data binding
Dynamic Data
New Field TemplatesUrl, Email, Enumeration
Entity TemplatesEasily change look and feel for objects / tables Automatic templates for ListView and FormView
Many to Many Support
Inheritance Support
Model aware validation for all Web Forms controls
ADO.NET Entity Framework 4.0
Major improvements with VS10 and .NET 4
Improvements:Model First and POCOLazy LoadingPluralization/SingularizationExpanded LINQ supportForeign Keys Disconnected API’s to enable N-tier T4 Templates to customize code generation
24
Parallel Computing with .NET 4
1. Task Parallel Library (TPL)
2. Parallel LINQ (PLINQ)
3. Coordination Data Structures (CDS)
4. System.Threading Improvements
25
Parallel LINQ
Parallel LINQ (PLINQ) enables developers to easily leverage manycore with a minimal impact to existing LINQ programming model
var q = from p in people where p.Name == queryInfo.Name && p.State == queryInfo.State && p.Year >= yearStart && p.Year <= yearEnd orderby p.Year ascending select p;
.AsParallel()
.AsParallel()
26
3. ASP.NET 4.01.ASP.NET Chart Controls2.ASP.NET MVC 2.03.ASP.NET AJAX 4.04.Web Deployment with VS 20105.VS 2010 Web Designer Improvements6.ASP.NET Core Services7.ASP.NET Web Form
1. ASP.NET Chart Controls<asp:chart /> now built-into ASP.NET 4.0
<asp:QueryExtender/> controlEnables easier filtering of database resultsIdeal for custom search queries
QueryExtender Control
LINQ To SQLData Source
EntityData Source
1) Uses arbitrary language2) Difficult to extend
1) Uses Entity SQL2) Difficult to extend
QueryExtender
1) Uses Parameters2) Very easy to perform advanced queries
Filtering Data with the QueryExtender ControlQueryExtender filter options :
SearchExpressionRangeExpressionPropertyExpressionOrderByExpressionCustomExpression
2. ASP.NET MVC 2
Visual Studio 2010Included
Visual Studio 2008 (Service Pack 1)Download
Both versions built against .NET 3.5
What’s New in MVC 2?Better Separation of Concerns (Maintainability)
Html.RenderAction()Areas
Easier Validation (Maintainability/Productivity)Data AnnotationsClient Validation
Helper Improvements (Maintainability/Productivity)Strongly-Typed HelpersTemplated Helpers
3. ASP.NET AJAX 4.0
Rich client side appsClient Side TemplatesClient Side ControlsClient Side Data BindingRefactored Library (much smaller downloads)
AJAX Control ToolkitHuge library of AJAX Controls
ASP.NET AJAX 4 - Client Templates
Client-Side<ul class="sys-template">
<li>{{ LastName }}, {{ FirstName }}</li></ul>
Microsoft AJAX CDN
Free CDN hosting of AJAX library scriptsASP.NET AJAX 4jQuery and jQuery Validation
<script src=“http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.min.js” type="text/javascript“ />
Built-in support with <asp:scriptmanager>
35
4. Web Deployment with VS 2010
Web.config TransformationSQL DeploymentWeb PackagingOne-Click Publishing
36
Web.config transformationWeb.Config(開發電腦)
Web.Release.Config(正式伺服器)
37
SQL Database Deployment
38
Web packagingWeb Content (.aspx, .ascx, images, xml files, PDBs, Binaries etc)IIS Settings (Directory browsing, Error pages, Default Documents etc)Databases that the web project usesGAC Assemblies and COM components which the web project depends uponRegistry Settings that may be used within the web projectSecurity CertificatesApp Pools
39
One-Click Publishing
40
Web Deployment
Demo• Web.config Transformation• Database deployment• Web packaging from VS 2010• One-Click publishing
5. Web Designer Improvements
Improved CSS Compatibility( CSS 2.1)HTML and JScript SnippetsFaster JScript IntelliSense UpdatingXML Documentation Comments
IntelliSense Update Times for Popular Libraries
Time in Milliseconds on Core 2 Duo 2.0 GHz Machine
ExtJS
Yahoo! UI
Dojo
Prototype
jQuery
Microsoft AJAX
0 1000 2000 3000 4000 5000 6000
VS 2008VS 2010
11.7s
2x
5x
4x
3x
4x6x
XML Documentation Comments
44
Demo• ASP.NET Snippet• JavaScript IntelliSense
Updating
6. ASP.NET Core ServicesWeb.config File MinificationExtensible Output CachingAuto-Start Web ApplicationsPermanently Redirecting a PageThe Incredible Shrinking Session StateExpanding the Range of Allowable URLsExtensible Request ValidationObject Caching and Object Caching ExtensibilityExtensible HTML, URL, and HTTP Header EncodingPerformance Monitoring for Individual Applications in a Single Worker ProcessMulti-Targeting
Web.config File Minification
一堆組態設定已移入machine.config中
Extensible Output CachingWeb.Config
.aspx
Shrinking Session State
ASP.NET使用System.IO.Compression.GZipStream class對 Session State進行壓縮
7. ASP.NET Web FormPage.MetaKeywords and Page.MetaDescription PropertiesEnabling View State for Individual ControlsChanges to Browser CapabilitiesRouting in ASP.NET 4Setting Client IDsPersisting Row Selection in Data ControlsFiltering Data with the QueryExtender ControlHtml Encoded Code Expressions
ASP.NET Web Form( cont.)Project Template Changes
CSS ImprovementsHiding div Elements Around Hidden FieldsRendering an Outer Table for Templated ControlsListView Control EnhancementsCheckBoxList and RadioButtonList Control EnhancementsMenu Control ImprovementsWizard and CreateUserWizard Controls
MetaKeywords & MetaDescription
Page.MetaKeywordsPage.MetaDescription
Enabling View State for Individual Controls
Changes to Browser CapabilitiesHttpBrowserCapabilities object
blackberry.browserchrome.browserDefault.browserfirefox.browsergateway.browsergeneric.browserie.browseriemobile.browseriphone.browseropera.browsersafari.browser
Routing in ASP.NET 4.0
Request:Products/Bikes
ASP.NET Routing
Route:Product/{name} -> Product.aspx
WebForms Page
File Name:Product.aspx
Route Values:Name = “Bikes”
Response
Setting Client ID
1) Master Page (No ID)
2) User Control (“HeaderForm”)
ControlHierarchy
3) Drop Down List (“States”)
Resulting Client IDs:1) ctl002) ctl00_HeaderForm3) ctl00_HeaderForm_States
ClientIDMode property
AutoID Static PredictableInherit
57
Demo• MetaKeyword• ViewState• ClientID
Persisting Row Selection in Data Controls
ASP.NET 2.0 &3.5 RowIndex ASP.NET 4.0 Data Key
Html Encoded Code Expressions
Project Template Changes
Empty ASP.NET Web ApplicationWeb Site Project TemplatesWeb Application TemplatesOnline Templates
Online Templates
62
Demo• Persisting Row Selection• Html Encoded Code Expressions• Project Template
Rendering an Outer Table for Templated ControlsRenderOuterTable Property
FormViewLoginPasswordRecoveryChangePasswordWizard CreateUserWizard
ListView Control EnhancementsASP.NET 3.5
ASP.NET 4.0
CheckBoxList and RadioButtonList Control Enhancements
RepeatLayout – OrderedList 、 UnorderedList
Menu Control Improvements
IncludeStyleBlock Property
67
Demo• Rendering an Outer Table• CheckBoxList and RadioButtonList • Menu Control
68
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED
OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.