Saturday, April 17, 2010

What's New in .NET Framework 3.5 SP 1

.NET Compact Framework

The .NET Compact Framework version 3.5 expands support for distributed mobile applications by including the Windows Communication Foundation (WCF) technology. It also adds new language features such as LINQ, new APIs based on community feedback, and improves debugging with updated diagnostic tools and features.

For details about these new features and enhancements, see What's New in the .NET Compact Framework Version 3.5.
ASP.NET

The .NET Framework 3.5 includes enhancements in targeted areas of ASP.NET and Visual Web Developer. The most significant advance is improved support for the development of AJAX-enabled Web sites. ASP.NET supports server-centric AJAX development with a set of new server controls and APIs. You can enable an existing ASP.NET 2.0 page for AJAX by adding a ScriptManager control and an UpdatePanel control so that the page can update without requiring a full page refresh.

ASP.NET also supports client-centric AJAX development with a new client library called the Microsoft AJAX Library. The Microsoft AJAX Library supports client-centric, object-oriented development, which is browser-independent. By using the library classes in your ECMAScript (JavaScript) you can enable rich UI behaviors without roundtrips to the server. You can mix the degree of server-centric and client-centric development to meet the needs of your application. Furthermore, Visual Web Developer includes improved IntelliSense support for JavaScript and support for the Microsoft AJAX Library.

ASP.NET and Visual Web Developer now support the creation of both ASMX and WCF-based Web services and the seamless use of either implementation from Web pages using Microsoft AJAX Library. Furthermore, server-side application services including forms authentication, roles management, and profiles are now exposed as Web services that can be consumed in WCF-compatible applications, including client script and Window Forms clients. ASP.NET enables all Web-based applications to share these common application services.

Other improvements in ASP.NET include a new data control, ListView, for displaying data; a new data source control, LinqDataSource, that exposes Language Integrated Query (LINQ) to Web developers through the ASP.NET data source control architectures; a new tool, ASP.NET Merge Tool (Aspnet_merge.exe), for merging precompiled assemblies; and tight integration with IIS 7.0. ListView is a highly customizable control (using templates and styles) that also supports edit, insert, and delete operations, as well as sorting and paging functionality. The paging functionality for ListView is provided by a new control called DataPager. You can use the merge tool to combine assemblies to support a range of deployment and release management scenarios. The integration of ASP.NET and IIS 7.0 includes the ability to use ASP.NET services, such as authentication and caching, for any content type. It also includes the ability to develop server pipeline modules in ASP.NET managed code and supports unified configuration of modules and handlers.

Other improvements in Visual Web Developer include multitargeting support, inclusion of Web Application Projects, a new Design view, new Cascading Style Sheets (CSS) design tools, and support for LINQ for SQL databases. Multitargeting enables you to use Visual Web Developer to target development of Web applications to specific versions of the .NET Framework, including versions 2.0, 3.0, and 3.5.

Add-Ins and Extensibility

The System.AddIn.dll assembly in the .NET Framework 3.5 provides powerful and flexible support to developers of extensible applications. It introduces a new architecture and model that helps developers with the initial work to add extensibility to an application and by ensuring that their extensions continue working as the host application changes. The model provides the following features:

*Discovery

You can easily find and manage sets of add-ins in multiple locations on a computer with the AddInStore class. You can use this class to search for and obtain information about add-ins by their base types without having to load them.

*Activation

After an application chooses an add-in, the AddInToken class makes it easy to activate. Simply choose the isolation and sandboxing level and the system takes care of the rest.

*Isolation

There is built-in support for application domains and process isolation of add-ins. The isolation level for each add-in is in the control of the host. The system handles loading application domains and processes and shutting them down after their add-ins have stopped running.

*Sandboxing

You can easily configure add-ins with either a default or customized trust level. Support includes Internet, Intranet, Full Trust, and “same-as-host” permission sets, as well as overloads that let the host specify a custom permission set.

*UI Composition

The add-in model supports direct composition of Windows Presentation Foundation (WPF) controls that span application domain boundaries. You can easily allow add-ins to contribute directly to the UI of the host while still retaining the benefits of isolation, ability to unload, sandboxing, and versioning.

*Versioning

The add-in architecture makes it possible for hosts to introduce new versions of their object model without breaking existing add-ins or impacting the developer experience for new ones.

Common Language Runtime
Collections

HashSet(Of T) provides high performance set operations to the .NET Framework. A set is a collection that contains no duplicate elements, and whose elements are in no particular order. For more information, see HashSet Collection Type.
Diagnostics

The EventSchemaTraceListener class provides tracing of end-to-end, schema-compliant events. You can use end-to-end tracing for a system that has heterogeneous components that cross thread, AppDomain, process, and computer boundaries. A standardized event schema (see Event Representation for Event Consumers) has been defined to enable tracing across these boundaries. This schema is shared by various tracing technologies, including Windows Vista diagnostics tools such as Event Viewer. The schema also enables the addition of custom, schema-compliant elements.

The EventSchemaTraceListener class is tuned for logging performance with implicit support for lock-free tracing.
I/O and Pipes

Pipes provide interprocess communication between any processes running on the same computer, or on any other Windows computer within a network. The .NET Framework provides access to two types of pipes: anonymous pipes and named pipes. For more information about pipes, see Pipes.
Garbage Collection

The GCSettings class has a new LatencyMode property that you can use to adjust the time that the garbage collector intrudes in your application. You set this property to one of the values of the new GCLatencyMode enumeration.

The GC class has a new Collect(Int32, GCCollectionMode) method overload that you can use to adjust the behavior for a forced garbage collection. For example, you can use this overload to specify that the garbage collector should determine whether the current time is optimal to reclaim objects. This overload takes a value from the new GCCollectionMode enumeration.
Reflection and Reflection Emit in Partial Trust

Assemblies that run with partial trust can now emit code and execute it. Emitted code that calls only public types and methods needs no permissions beyond the permissions demanded by the types and methods that are accessed. The new
DynamicMethod(String, Type, Type())
constructor makes it easy to emit such code.

When emitted code needs to access private data, the new
DynamicMethod(String, Type, Type(), Boolean)
constructor allows restricted access. The host must grant ReflectionPermission with the new RestrictedMemberAccess flag to enable this feature, which gives emitted code the ability to access private data only for types and methods in assemblies with equal or lesser trust levels. See Walkthrough: Emitting Code in Partial Trust Scenarios.

For reflection, a host grant of RestrictedMemberAccess similarly allows restricted use of methods that access private properties, call private methods, and so on, but only for target assemblies with equal or lesser trust levels.
Threading
Better Reader/Writer Lock

The new ReaderWriterLockSlim class provides performance that is significantly better than ReaderWriterLock, and comparable with the lock statement (SyncLock in Visual Basic). Transitions between lock states have been simplified to make programming easier and to reduce the chances of deadlocks. The new class supports recursion to simplify migration from lock and from ReaderWriterLock.
ThreadPool Performance Enhancements

Throughput for the dispatch of work items and I/O tasks in the managed thread pool is significantly improved. Dispatch is now handled in managed code, without transitions to unmanaged code and with fewer locks. The use of ThreadPool is recommended over application-specific thread pool implementations.
Time Zone Improvements

Two new types, DateTimeOffset and TimeZoneInfo, improve support for time zones and make it easier to develop applications that work with dates and times in different time zones. For a discussion of which type to use in particular situations, see Choosing Between DateTime, DateTimeOffset, and TimeZoneInfo.
TimeZoneInfo

The new TimeZoneInfo class largely supplants the existing TimeZone class. You can use TimeZoneInfo to retrieve any time zone defined in the registry, rather than just the local time zone and Coordinated Universal Time (UTC). You can also use this class to define custom time zones, to serialize and deserialize custom time zone data, and to convert times between time zones. For more information about developing applications that use the TimeZoneInfo class, see Times and Time Zones.
DateTimeOffset

The new DateTimeOffset structure extends the DateTime structure to make working with times across time zones easier. The DateTimeOffset structure stores date and time information as a UTC date and time together with an offset value that indicates how much the time differs from UTC.

Networking

Peer-to-Peer Networking

Peer-to-peer networking is a serverless networking technology that allows several network devices to share resources and communicate directly with each other. The System.Net.PeerToPeer namespace provides a set of classes that support the Peer Name Resolution Protocol (PNRP) that allows the discovery of other peer nodes through PeerName objects registered within a peer-to-peer cloud. PNRP can resolve peer names to IPv6 or IPv4 IP addresses.

Windows Communication Foundation
WCF and WF Integration—Workflow Services

The .NET Framework 3.5 unifies the Windows Workflow Foundation (WF) and Windows Communication Foundation (WCF) frameworks so that you can use WF as a way to author WCF services or expose your existing WF workflow as a service. This enables you to create services that can be persisted, can easily transfer data in and out of a workflow, and can enforce application-level protocols. For code samples, see Workflow Services Samples.
Durable Services

The .NET Framework 3.5 also introduces support for WCF services that use the WF persistence model to persist the state information of the service. These durable services persist their state information on the application layer, so that if a session is torn down and re-created later, the state information for that service can be reloaded from the persistence store.
WCF Web Programming Model

The WCF Web Programming Model enables developers to build Web-style services with WCF. The Web Programming Model includes rich URI processing capability, support for all HTTP verbs including GET, and a simple programming model for working with a wide variety of message formats (including XML, JSON, and opaque binary streams). For more information, see WCF Web Programming Model Overview.
WCF Syndication

WCF now includes a strongly typed object model for processing syndication feeds, including both the Atom 1.0 and RSS 2.0 formats. For more information, see WCF Syndication. For code samples, see Syndication Samples.
WCF and Partial Trust

In .NET Framework 3.5, applications running with reduced permissions can use a limited subset of WCF features. Server applications running with ASP.NET Medium Trust permissions can use the WCF Service Model to create basic HTTP services. Client applications running with Internet Zone permissions (such as XAML Browser Applications or unsigned applications deployed with ClickOnce) can use the WCF proxies to consume HTTP services. In addition, the WCF Web Programming Model features (including AJAX and Syndication) are available for use by partially trusted applications. For more information.

Windows Presentation Foundation


In the .NET Framework 3.5, Windows Presentation Foundation contains changes and improvements in numerous areas, including versioning, the application model, data binding, controls, documents, annotations, and 3-D UI elements.


Windows Workflow Foundation
WCF and WF Integration—Workflow Services

The .NET Framework 3.5 unifies the Windows Workflow Foundation (WF) and Windows Communication Foundation (WF) frameworks so that you can use WF as a way to author WCF services or expose your existing WF workflow as a service. This enables you to create services that can be persisted, can easily transfer data in and out of a workflow, and can enforce application-level protocols.

LINQ

Language-Integrated Query (LINQ) is a new feature in Visual Studio 2008 and the .NET Framework 3.5. LINQ extends powerful query capabilities to the language syntax of C# and Visual Basic in the form of standard, easily-learned query patterns. This technology can be extended to support potentially any kind of data store. The .NET Framework 3.5 includes LINQ provider assemblies that enable the use of LINQ for querying .NET Framework collections, SQL Server databases, ADO.NET Datasets, and XML documents.


Expression Trees


Expression trees are new in the .NET Framework 3.5, and provide a way to represent language-level code in the form of data. The System.Linq.Expressions namespace contains the types that are the building blocks of expression trees. These types can be used to represent different types of code expressions, for example a method call or an equality comparison.