Several New Features in Dynamic Data Preview 4

06/20/2009

· Entity Templates

· Filters

· Support for inheritance in Entity Framework and Linq to SQL

· Support for many to many in Entity Framework

· Email and Url field templates

· Support for many new data annotation attributes

· Display

· Order – control order of fields

· AutoGenerateFilter - control if a field is used as a filter

· FilterUIHint – override default filter used for a field

· Ability to provide default values for fields at runtime

· Ability to use field templates and validation in Web pages hosted by any ASP.NET application.

· Requires no data model

· Requires no routing

· Datasource for accessing .NET RIA Domain Service and Dynamic Data support for .NET RIA Domain Service

 

DynamicDataSamples

This is the primary project sample that shows most of the new functionality that has been added to Dynamic Data since .NET 3.5 SP1. The default.aspx page highlights many of the new items that are being added in .NET 4, in particular:

· Filter Templates. Filters are now first class citizens in Dynamic Data. There is a new FilterTemplate directory that contains the default filter templates and supports user defined filter templates. Filters can be applied to columns using the new FilterUIHint attribute.

· Entity Templates – The Details, Edit and Insert page templates in version 1.0 forced a two column display style (field name, field value). Entity templates allow for the layout of an entity to be arbitrarily customized.

· Field Templates. The following new field templates have been created.

· Email Field Template. Data fields in the model that are marked with DataType(DataType.Email) will be displayed as mailto: hyperlinks that will launch the email client when clicked.

· Url Field Template. Fields in the model that are marked with DataType(DataType.Url) will be displayed as hyperlinks that will open a new window with the given URL.

· Many to Many Relationships in Tables. Entity Framework models support many to many relationships. Dynamic Data will display these as a list of values or in edit mode a list of checkboxes for the selectable columns.

· Enumeration on Model. If a column in the model is associated with an enumeration data type it will be displayed as a dropdown list of the values from the enumeration.

· Enumeration using Metadata. If a column in the model has an EnumDataType(typeof(enum)) attribute it associated with an enumeration data type it will be displayed as a dropdown list of the values from the enumeration.

· Inheritance. Both Entity Framework and Linq to SQL support inheritance relationships in their data models. Dynamic Data will now properly display this data.

This sample also shows some other advanced features in Dynamic Data such as

· Multiple Data Models

· Each data model uses a different data model technology.

· Each registers its own custom DynamicData directory.

Posted in: C# and .NET| Tags: NET CTP .NET 4.0 New Dynamic Data Control field data framework entity support filter order dynamic

Everyone talk at once: .NET 4.0 will include Parallel Extensions

06/16/2009

Parallelism in programming has largely been conducted in the laboratories. But with the next version of the .NET Framework, developers everywhere will be able to experiment with what could become a monumental change in languages.

In perhaps the most significant development in the brief history of the field of implicit parallelism in computing, one of Microsoft's development teams announced last Friday that the next .NET Framework 4.0 -- the first glimpses of which we'll see later this month from PDC in Los Angeles -- will include the so-called Parallel Extensions as a standard feature. This after the Extensions were first introduced in a Community Technology Preview last November.

The significance of these extensions is that they enable existing .NET languages (today, most predominantly, C#) to incorporate implicit parallelism directly in programs. In other words, rather than simply write ordinary procedural code and use compiler switches to determine whether code can be forked into parallel threads, a developer can use entirely new syntax to invoke methods that execute multiple threads concurrently.

In conjunction with the new Language Integrated Query (LINQ) that Microsoft already introduced formally earlier this year, the possibilities for parallel applications that run on multicore servers or data clusters is astounding. To explain: In the old procedural model of algorithmic programming, any function that affects a set of data in a table based on conditions, has to include instructions that explicitly examine each record in that table, test it for the current criteria, and invoke changes to all records that pass. With LINQ, a more SQL-like structure is utilized instead, where a single instruction can point automatically to all records that match criteria, and the change is stated once and once only.

Now, pair that with the Parallel Extensions: Using an up-and-coming syntax gleaned from calculus called lambda expressions, a C# developer can write an instruction where the criteria are expressed inline, similar to an anonymous delegate. It becomes a way of saying in a single expression, "For all x where x meets these criteria, make a change according to the following..."

One difference, as Microsoft developer and corporate VP Scott Guthrie explained in a recent blog post, has to do with explicit typing. Unlike the case with C#'s traditional anonymous delegates (a feature added with version 2.0), types in such inline functions do not need to be explicitly declared. "Unlike anonymous methods, which require parameter type declarations to be explicitly stated, Lambda expressions permit parameter types to be omitted and instead allow them to be inferred based on the usage," Guthrie wrote.

With a myriad of parallel threads operating on data concurrently -- most importantly, on the same data -- how will the compiler be able to keep track of which changes should be implemented when? For a database management system, that subject has already been explored and largely solved, using something called the transactional model.

Recently, a team of Microsoft researchers working with the Parallel Extensions have been investigating whether a similar transactional model can be applied at a much lower level.

"Transactional memory is not about 'removing locks' but is about abstracting away the requirement to specify a particular lock," wrote Microsoft researcher Dana Groff in a blog post last week. "Instead, you can structure your code in well defined sequential blocks of code, what in the database world we call 'units of work,' and then let the underlying runtime system, compiler, or hardware provide you the guarantees you desire. Further, you want this work to scale. To do that, the underlying system provides concurrency control optimistically. Instead of always locking a resource, the transactional memory system assumes that there is no contention. Instead, it detects when these assumptions are incorrect and rolls back changes that were made in the block. Depending on the implementation, the transactional memory system may then re-execute your block of code."

A transactional memory model would drastically reduce, if not completely eliminate, contention between multiple threads acting upon differing views of the same data in memory. The implementation of that model would most likely take place using extensions to programming languages made possible by Microsoft's Task Parallel Library, which will be one part of Parallel Extensions in .NET Framework 4.0.

Posted in: C# and .NET| Tags: NET Programming .NET 4.0 Parallel Extension Extension everyone experiment change framework version talk parallelism development

New enhance: .NET 4.0 Security

06/16/2009

The first beta of the v4.0 .NET Framework is now available, and with it comes a lot of changes to the CLR's security system.  We've updated both the policy and enforcement portions of the runtime in a lot of ways that I'm pretty excited to finally see available.  Since there are a lot of security changes, I'll spend the next month or so taking a deeper look at each of them.  At a high level, the major areas that are seeing updates with the v4 CLR are: 

  • Security policy
  • Security transparency
  • APTCA
  • Evidence
  • AppDomain Managers

Like I did when we shipped the v2.0 CLR, I'll come back and update this post with links to the details about each of the features we added as I write more detailed blog posts about each of them.

One of the first changes that you might see to security in the v4 CLR is that we’ve overhauled the security policy system.  In previous releases of the .NET Framework, CAS policy applied to all assemblies loaded into an application (except for in simple sandbox domains).

That lead to a lot of interesting problems.  For instance, one of the more common issues people ran into was that they would develop an application on their local machine that they wanted to share with other people on the network.   Once the application was working on their machine, they would share it out, but nobody could run it over the network because CAS policy provided a lower grant set to assemblies loaded from the intranet than it does to assemblies loaded from the local machine.   The usual result was unexpected and unhandled SecurityExceptions when trying to use the application.

Generally, the only solution to this problem was to either manually update the CAS policy on each machine that wanted to run the application, deploy the application some other way (for instance via ClickOnce), or use native code.

One of the worst things about this problem was that the additional pain of not being able to just share a managed app over the network wasn’t actually buying any security.  If an application wanted to attack your machine, it could bypass the sandbox that the CLR was setting up simply by being written in native code.

Effectively, running an executable is a trust decision – you’re saying that you trust the application that you’re running enough to execute with the privileges your Windows account has.

That leads to an interesting observation – the CLR isn’t the correct place to be setting permission restrictions for applications that are being launched directly (either from the command prompt, or from Windows explorer for instance).  Instead, that should be done through Windows itself using mechanisms like SRP, which apply equally to both managed and native applications.

In the v3.5 SP1 release, these observations (writing managed code to use on the network was harder than it needed to be, and it wasn’t even buying any extra security) led us to relax CAS policy for LocalIntranet applications slightly.   We enabled applications that were run directly from an intranet share (and any assemblies loaded from immediately next to that application) to be fully trusted by pretending that it had MyComputer zone evidence instead of LocalIntranet.

In the v4.0 release of the runtime, the CLR has taken that a step further.  By default, unhosted applications are not subject to managed security policy when run under v4.0.   Effectively, this means any managed application that you launch from the command prompt or by double clicking the .exe in Windows Explorer will run fully trusted, as will all of the assemblies that it loads (including assemblies that it loads from a location other than the the directory where the executable lives).

For applications run from the local machine, there really should be no observable change.  However, for applications that are shared out over a network, this means that everything should just work – just as if you had run the application from your computer while you were developing it.

Posted in: C# and .NET| Tags: NET Security .NET 4.0 CLR New Enhance AppDomain system framework beta lot

New things in ASP.NET 4.0

06/10/2009

AJAX Functionality in ASP.NET 4.0

The AJAX functionality in ASP.NET 4.0 enables new client data scenarios for page and component developers that allow JSON data from the server to be rendered as HTML in a highly manageable and efficient way. To enable these scenarios, ASP.NET 4.0 includes the following major features:

  • Client-side template rendering.
  • Declarative instantiation of client-side behaviors and controls.
  • Live data binding.
  • Use of the observer pattern with JavaScript types.
  • An AdoNetServiceProxy class for client-side interaction with ADO.NET Data Services.
  • A client-side DataView control for data-bound UI in the browser.
  • DataContext and AdoNetDataContext classes for interaction with Web services.
  • Refactored ASP.NET AJAX framework libraries.

Client Template Rendering

In client-based development, templates are the most manageable way of creating UI from data. ASP.NET 4.0 includes a new template engine for client development that meets the following requirements:

  • Performance — The engine must be able to render a typical number of items using a reasonably complex template before users perceive an interruption in their interaction with the application.
  • Simplicity — The template syntax must be very readable and must be optimized for the most common scenario, namely one-way/one-time binding.
  • Expression language — Templates must support an expression language to go beyond the simplest cases. The expression language should use familiar syntax, ideally JavaScript syntax.
  • Interspersed code and markup — It must be possible to perform conditional rendering or to loop over markup by using code that surrounds HTML.
  • XHTML compliance — The template should be able to render XHTML-compliant markup.
  • Components — When using the template syntax, the developer must be able to instantiate client-side controls and behaviors that attach to HTML elements in the page or within templates.

 

Application Server (Dublin)

Provide standard host for WF and WCF applications

- First CTP will be provided on PDC. The community feedback will influence the RTM.

- Application Server “Dublin” will first become available after the release of the .NET Framework 4.0 and Visual Studio “10”.

- Application Server “Dublin” will initially be made available for download and use by Windows Server customers; later, “Dublin” will be included in future releases of Windows Server.

- Application Server “Dublin” will extend Internet Information Services (IIS) to provide a standard host for applications that use workflow or communications.

- It will provide support for Oslo modeling platform.

- It will support existing .NET apps.

- It will support integration with BizTalk Server (in this context called "Integration Server").

Pre-built developer services

· Message-based correlation

· Message forwarding service

· Content-based message routing

· Compensation service for long-running transactions

Greater scalability and easier manageability

· Enable scale-out of stateful workflow applications

· Persisting and rehydrating state for high scalability

· Enhanced management and monitoring functions

· Tracking store for workflow events

Supports “Oslo” modeling platform

- More about this at PDC :)

Posted in: C# and .NET| Tags: NET .NET 4.0 Syntax asp.net ajax client rendering interaction asp html expression template

Democratizing Application Life-Cycle Management in .NET 4.0

06/09/2009

Today, much of application development remains siloed throughout the enterprise, leading to decreased productivity and lengthy product development cycles. With VSTS 2010, Microsoft is taking the next step forward in giving individuals and development organizations an advanced solution that enables them to integrate effectively and build and deliver high-quality applications.

This includes new capabilities that make it easier for all contributors on the software team to participate throughout the life cycle — from the core developers and testers to the wider team of project managers, designers and business analysts. Highlights include the following:

Modeling tools. With VSTS 2010 Architecture, Microsoft will enable both technical and nontechnical users to create and use models to collaborate and to define business and system functionality graphically. The new version supports both Unified Modeling Language and Domain Specific Language support, so development organizations will have the right tool for right job. The new modeling capabilities in VSTS 2010 are a core part of the larger Microsoft modeling platform, which will also include the “Oslo” repository, tools and language.

Improved efficiency throughout the test cycle. With VSTS 2010, Microsoft has made a significant investment in testing features and dramatically simplifying the tools required to integrate testing across the life cycle. New features include the ability to eliminate nonreproducible bugs, fast setup and deployment of tests to ensure the highest degree of completeness of test, focused test planning and progress tracking, and ensuring that all code changes are properly tested.

Substantial improvements in collaboration capabilities. Microsoft has made major investments in the capabilities and scalability of Team Foundation Server (TFS) including significant improvements that allow teams to configure and adopt any flavor of Agile development processes. Teams can track and trace work more easily with richer linking of work items enabling hierarchical work item relationships. In the source code management system, TFS now provides visualization tools for tracking changes across branches and into the production build. VSTS 2010 also introduces workflow-based builds that catch errors before they have a chance to affect the rest of the team or, worse, enter production. Finally, administrators will find dramatically simpler TFS deployment and management.

“The application life cycle is an integral part of today’s business. Regardless of core competencies, all organizations are driven by software that is created and customized to deliver a competitive advantage,” said Theresa Lanowitz, founder of voke, inc. “Enterprises that invest in an ALM solution can decrease their total cost of ownership of applications in their IT portfolio, and bring about a global approach that is an integrated and expansive system consisting of people, processes and technology. This global approach to ALM facilitates collaboration and takes the risk out of software development to produce predictable and reliable results for an optimized business outcome. Solutions such as VSTS are poised to take advantage of market opportunity by offering an application life-cycle platform to help enterprises realize this ROI benefit.”

 

The most important feature of .NET 4.0 is Windows Workflow 4.0.

Windows Workflow 3.5 gave you a tool for free that previously cost tens of thousands of dollars to get your foot in the door. It was a great opportunity. And there was almost no uptake. I think there were a few reasons - it was too darn hard to use and Microsoft didn't push it very hard. They probably didn't push it because it became evident that they screwed it up and it was way too hard to use.

Windows Workflow 4.0 is a complete rewrite of workflow. It's a brand new product. More than just rewriting, it represents a rethinking of the problem. It's not the old giant workflow behemoths pared down to fit into Visual Studio. It give normal developers what they need to incorporate workflow into their applications. If we look beyond forms over data and extend the reach of our applications into helping the organization accomplish its goals, we find workflow. Workflows are a fundamentally better way to think about business problems - and it can often be interleaved with existing applications. Assuming the release is stable as a 1.0 product, and I'm optimistic on that, it's going to be the thing in .NET 4.0 that lets you add real business value to your applications.

And real business value is what its all about.

Posted in: C# and .NET| Tags: Management .NET 4.0 Application Life-Cycle

What's New in Windows Communication Foundation 4.0

06/04/2009

Controlling Service Activation Based on Available Memory

Some WCF services may not run optimally when memory resources are constrained. The Window Communication Foundation allows the user to configure a setting that specifies a lower bound on the amount of free memory when the service is run under Full Trust. If there is less free memory available than the value of this setting, the service will not be activated and an exception will be thrown. minFreeMemoryToActivateService is a configuration file setting that allows the user to specify a percentage of free memory that is required to be free in order to activate a service, the default value is 5 per cent.

Support for WS-Discovery

The Service Discovery feature enables client applications to dynamically discover service addresses at runtime in an interoperable way using WS-Discovery. The WS-Discovery specification outlines the message-exchange patterns (MEPs) required for performing light-weight discovery of services, both by multicast (ad hoc) and unicast (utilizing a network resource).

Standard Endpoints

Standard endpoint are pre-defined endpoints that have one or more of their properties (address, binding, contract) fixed. For example all metadata exchange endpoints specify IMetadataExchange as their contract, so there is no need for a developer to have to specify the contract. The standard MEX endpoint therefore has a fixed IMetadataExchange contract.

Workflow Services

With the introduction of a set of messaging activities it is easier than ever to implment workflows that send and receive data. These messaging activites allow you to model complex message exchange patterns that go outside of the traditional send/receive or RPC-style method invocation.

Web Hosting a .NET Framework 3.5 WCF Service on a Machine Running .NET Framework 4.0

When hosting a WCF service written with .NET Framework 3.5 on a machine running .NET Framework 4.0, you may get a T:System.ServiceModel.ProtocolException with the following text:

Unhandled Exception: System.ServiceModel.ProtocolException: The content type tex t/html; charset=utf-8 of the response message does not match the content type of the binding (application/soap+xml; charset=utf-8). If using a custom encoder, b e sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: '<html> <head> <title>The application domain or application pool is currently running v ersion 4.0 or later of the .NET Framework. This can occur if IIS settings have b een set to 4.0 or later for this Web application, or if you are using version 4. 0 or later of the ASP.NET Web Development Server. The &lt;compilation&gt; elemen t in the Web.config file for this Web application does not contain the required 'targetFrameworkMoniker' attribute for this version of the .NET Framework (for e xample, '&lt;compilation targetFrameworkMoniker=&quot;.NETFramework,Version=v4.0 &quot;&gt;'). Update the Web.config file with this attribute, or configure the W eb application to use a different version of the .NET Framework.</title>...

Or if you try to browse to the service's .svc file you may see the an error page with the following text.

The application domain or application pool is currently running version 4.0 or later of the .NET Framework. This can occur if IIS settings have been set to 4.0 or later for this Web application, or if you are using version 4.0 or later of the ASP.NET Web Development Server. The <compilation> element in the Web.config file for this Web application does not contain the required 'targetFrameworkMoniker' attribute for this version of the .NET Framework (for example, '<compilation targetFrameworkMoniker=".NETFramework,Version=v4.0">'). Update the Web.config file with this attribute, or configure the Web application to use a different version of the .NET Framework.

These errors occur because the application domain IIS is running within is running .NET Framework 4.0 and the WCF service is expecting to run under .NET Framework 3.5. To fix this problem open the service's web.config file and find the <compilation> element. Add the targetFrameworkMoniker attribute as shown in the following XML example.

Posted in: C# and .NET| Tags: Communication NET .NET 4.0 New WCF Foundation service user framework contract ws-discovery memory

What's New in ADO.NET 4.0

06/04/2009

The following features are new in ADO.NET with the .NET Framework version 4.
ADO.NET Entity Framework

The Entity Framework is part of a multi-release strategy to decrease the amount of coding and maintenance required for developers by enabling them to program against data models defined in terms of entities and relationships. For more information, see Entity Framework Overview.

The following features are new to the Entity Framework in .NET Framework 4.
Persistence-Ignorant Objects

You can use your own custom data classes together with your data model without making any modifications to the data classes themselves. This means that you can use "plain old" CLR objects (POCO), such as existing domain objects, with your Entity Framework application. For more information, see Persistence Ignorant Objects (Entity Framework).
Deferred Loading of Related Objects

With deferred loading, also known as lazy loading, related objects are automatically loaded from the data source when you access a navigation property. For more information, see Shaping Query Results (Entity Framework).
Functions in LINQ to Entities Queries

The EntityFunctions and SqlFunctions classes provide access to canonical and database functions from LINQ to Entities queries. The EdmFunctionAttribute allows a CLR method to serve as a proxy for a function defined in the conceptual model or storage model. For more information, see Calling Functions in LINQ to Entities Queries.
Customized Object Layer Code Generation

You can configure the ADO.NET Entity Data Model Designer to use text templates to generate customized object layer code. For more information, see How to: Customize Object Layer Code Generation.
Model-First Support

The Create Database Wizard enables you to do conceptual modeling first, and then create a database that supports the model. For more information, see How to: Generate a Database from a Conceptual Model.
Complex Type Support

The ADO.NET Entity Data Model Designer now supports complex types. For more information, see the following topics:

    *      How to: Create and Modify Complex Types
    *      How to: Add a Complex Type to an Entity Type
    *      How to: Map a Function Import to a Complex Type
    *      How to: Map Complex Type Properties to Table Columns

Naming Service

The Entity Data Model Wizard and the Update Model Wizard provide the option of using singular or plural forms of Entity, EntitySet, and NavigationProperty names to make application code more readable. For more information, see Choose Your Database Objects Dialog Box (Entity Data Model Wizard) and Choose Your Database Objects Dialog Box (Update Model Wizard).
Improved Model Browser Functionality

The Model Browser window of the ADO.NET Entity Data Model Designer enables you to delete objects from the storage model and to search the conceptual and storage models for a specified string. For more information, see Model Browser Window and How to: Delete Objects from the Storage Model.

WPF and Silverlight Designer

In Visual Studio 2010, various designer improvements have been made to help create WPF or Silverlight applications.

    *      Improved Support for Silverlight

      In Visual Studio 2008, you could install the Silverlight Tools to create Silverlight applications in Visual Studio. However, the designer support for Silverlight projects was limited to a read-only Preview window. In Visual Studio 2010, the designer support for Silverlight and WPF projects are now the same. For example, in Silverlight projects you can now select and position items with the mouse on the design surface.
    *      Support for Multiple Platform Versions

      In Visual Studio 2008, control design times were able to target only the latest WPF platform version. In Visual Studio 2010, this support is extended across multiple platforms, including design-time support for WPF 3.5, WPF 4, Silverlight 2, Silverlight 3, and future platform releases. As the same extensibility API exists for all these platforms, control design-time authors can easily write one experience and share it across the control runtimes for each platform.
    *      Visual Databinding

      The new data binding builder enables visual construction and editing of bindings without typing XAML.
    *      Auto Layout

      Layout improvements include a more intuitive Grid designer and better support for automatically sizing user controls.
    *      Improved Property Editing

      The Properties window now enables visually creating and editing Brush resources.

Posted in: C# and .NET| Tags: NET Database .NET 4.0 New ADO.NET Information framework linq model entity objects loading ado

What is new in asp.net 4.0

06/04/2009

The following sections describe new features in ASP.NET core services, Web Forms, Dynamic Data, and Visual Web Developer.
ASP.NET Core Services

ASP.NET introduces several features that improve core ASP.NET services, Web Forms, Dynamic Data, and Visual Web Developer. For more information, see What’s New in ASP.NET and Web Development.
ASP.NET Web Forms

Web Forms has been a core feature in ASP.NET since the release of ASP.NET 1.0. Many enhancements have been made in this area for ASP.NET 4, including the following:

    *       The ability to set meta tags.
    *       More control over view state.
    *       Easier ways to work with browser capabilities.
    *       Support for using ASP.NET routing with Web Forms.
    *       More control over generated IDs.
    *       The ability to persist selected rows in data controls.
    *       More control over rendered HTML in the FormView and ListView controls.
    *       Filtering support for data source controls.

Dynamic Data

For ASP.NET 4, Dynamic Data has been enhanced to give developers even more power for quickly building data-driven Web sites. This includes the following:

    *       Automatic validation that is based on constraints defined in the data model.
    *       The ability to easily change the markup that is generated for fields in the GridView and DetailsView controls by using field templates that are part of your Dynamic Data project.

Visual Web Developer Enhancements

The Web page designer in Visual Studio 2010 has been enhanced for better CSS compatibility, includes additional support for HTML and ASP.NET markup code examples, and features a redesigned version of IntelliSense for JScript. In addition, two new deployment features called Web packaging and One-Click Publish make deploying Web applications easier.

Posted in: C# and .NET| Tags: .NET 4.0 New asp.net Dynamic Data MVC Visual Web Developer

Hot Posts

Latest posts

Tags

Others

Sponsors

asp.net interview questions