DevExtreme ASP.NET MVC Controls – Improvements & New Features in Data Sources (coming soon in v17.2)

ASP.NET Team Blog
13 October 2017

The DevExtreme ASP.NET MVC Controls provide a powerful data layer to help you read and write data with our controls. The data layer is invisible but serves an important role for your apps. In fact, we've got a great documentation data layer topic that I recommend reading:

In this blog post, I'll highlight the changes coming to the DevExtreme data layer in the upcoming v17.2 release. We're introducing a set of changes and improvements that are primarily driven by customer feedback.

New behavior of Url generation of .Mvc() and .WebApi() data sources

In the v17.1.5 release, I talked in detail about the change to our DataSource URL generation. Please take a look at this blog post that describes our motivation and the changes: DevExtreme ASP.NET MVC Controls: DataSource URL Improvements (17.1.5).

Since August 2017, many customers have shared projects and code with our support team and it's good to see that many have enabled the new mode and are happy with it.

Warning: In the v17.2 release, we're changing the default value of the flag controlling that behavior (UseLegacyRouting) to false. Meaning, we don't want to use legacy routing but the new and improved approach. However...

This could BREAK your existing projects. This potential breaking change can be avoided. However, I recommend that you test your existing projects as we've seen good feedback from many customers. You can test this change using the new flag now by downloading v17.1.5+ release, which is available now.

If you're not ready for the change when v17.2 is released then simply set the UseLegacyRouting to true:

For ASP.NET MVC 5 applications, in Global.asax.cs:

protected void Application_Start()
  DevExtreme.AspNet.Mvc.Compatibility.DataSource.UseLegacyRouting = true;
  // ... the rest of your code ...

For .NET Core apps, in Startup.cs:

public void Configure(IApplicationBuilder app, 
                      IHostingEnvironment env, 
                      ILoggerFactory loggerFactory) 
  DevExtreme.AspNet.Mvc.Compatibility.DataSource.UseLegacyRouting = true;
  // ... the rest of your code ...

In v17.2, all DevExtreme demos and project templates have been updated to use the new routing mode. This, you'll find, works more predictably and in accordance with the standard MVC @Url.Action and @Url.RouteUrl constructs.

Support for Areas

Areas are an ASP.NET MVC feature used to organize related functionality into a group as a separate namespace (for routing) and folder structure (for views). Using areas creates a hierarchy for the purpose of routing by ... Areas provide a way to partition a large ASP.NET Core MVC Web app into smaller functional groupings. - Microsoft Documentation

Also in v17.2, we've added support for 'areas'. So both the .Mvc() and .WebApi() data sources now provide the .Area() configuration option in addition to .Controller() and .Action(). This means that you can now reference API controllers in different areas.

RemoteController: consume API controllers from a different domain/host

If API controllers were located on another domain, it was problematic to use them. Customers had to use JavaScript instead of strongly-typed Razor syntax.

In 17.2 we improve this by introducing a new kind of data source: RemoteController. Basically it is the same as .Mvc() or .WebApi() but instead of specifying routing options (controller, action, etc), you specify direct Urls pointing to anywhere on the web.

Here's an example:

    .DataSource(ds => ds.RemoteController()

Updated DevExtreme.AspNet.Data library with new features

DevExtreme.AspNet.Data, the open-source library used by DevExtreme ASP.NET MVC Controls for data access has been updated to version 1.3 with a number of enhancements:

  • Support for server-side "select" operation (PR #125)
  • Published LoadResult and Group classes (PR #130)

What do you think about the DevExtreme ASP.NET MVC Controls? Drop me a line below.


Twitter: @mehulharry

Create highly responsive web apps for touch-enabled devices and traditional desktops.

From desktops to mobile devices, DevExtreme HTML5 Data Grid delivers the flexibility you’ll need to build apps that reach the widest audience and deliver touch-first user experiences to power your next great interactive website.

Download a free and fully-functional version of DevExtreme now: Download DevExtreme

Free DevExpress Products - Get Your Copy Today

The following free DevExpress product offers remain available. Should you have any questions about the free offers below, please submit a ticket via the DevExpress Support Center at your convenience. We'll be happy to follow-up.
No Comments

Please login or register to post comments.