DevExtreme: New project template for WebAPI back-end and client (Coming soon in v16.1)

Don Wibier's Blog
01 June 2016

We already had a very nice project template in the previous versions of DevExtreme which allows you to create an OData service based on an existing database in minutes.

The OData protocol is a data access protocol specifically designed to use a uniform way to query and manipulate datasets. As a result, this service includes CRUD operations and execution of paged/sorted queries.

With another project template – The MultiChannel one – you could then create the base for your DevExtreme app including CRUD operations and views. The project template is able to query the meta-data of the OData service to fetch entities as well as fieldnames and types to create JavaScript models and HTML views. Yet another nice feature made possible by the OData protocol.

One of the more difficult aspects of OData are security and identity aspects. This is something easier done with a WebAPI.

Creating a WebAPI back-end in minutes

With the upcoming v16.1 release we have added another project template – DevExtreme WebAPI OData service – which combines the best of both worlds.

image

Once the wizard has finished, you will have a WebAPI project with controllers for all database entities selected in the wizard.

Using MS Identity to secure your WebAPI service

One of the options in the Wizard is whether you want to have Authentication or not. When you select Individual User Accounts, the project will be created including the configuration for MS Identity.

image

You can now start securing your Controllers and / or your action methods on the controllers.

namespace MyWebAPIService {
[Authorize]
public class InvoiceController : ODataController
{
private ChinookConnection db = new ChinookConnection();

// GET: odata/Invoice
[EnableQuery]
[OverrideAuthorization]
public IQueryable<Invoice> GetInvoice()
{
return db.Invoice;
}

// ... more code ...
}

Another thing we have configured with the WebAPI service is CORS and JSONP. This means that you can call the WebAPI endpoints from another domain without getting JavaScript errors.

What about the Client App?

Once you try to access the secured WebAPI back-end from within a DevExtreme Client App, you will need to authenticate before data is returned. (You would need a login-view and optionally a registration-view)

We have added additional functionality to our MultiChannel project template which will add the additional views and code for authenticating and registering. We also include a profile view.

image

 

If the app tries to access a secure end-point on the WebAPI back-end, you will be automatically taken to the login view to authenticate out of the box!

Windows Phone 10 Support

The last new feature I’d like to mention is that we have deprecated the “cordova-wp8” platform and upgraded to the “cordova-windows” platform.

This means that you are now able to deploy for Windows 8, 8.1 and 10. The result of the deployment wizard will in this case be an .appx package instead of the older .xap package.

7 comment(s)
Saif Khan
Saif Khan

IMHO - these little additions is worth the renewal - time is money.

2 June, 2016
jerome crevecoeur
jerome crevecoeur

Thanks for your works

Is the new Project Wizard generate V4 ODATA?

2 June, 2016
Don Wibier (DevExpress)
Don Wibier (DevExpress)

Jerome, the project template will generate OData v3 like Visual Studio 2015 default scaffolding tools does for now.

If there is a demand for v4, we will implement this in a future release.

3 June, 2016
Michel PERRON
Michel PERRON

Is the new Project Wizard generate V4 ODATA with XPO ?

22 June, 2016
Tom Mcd
Tom Mcd

Hi Don,

It would be great if you could create a project template that uses OData v4.

thanks

29 June, 2016
mike wiebel
mike wiebel

I would love this template if it were usable but IMO it's worthless.  When I invoke the template the first wizard that opens is the Entity Data Model Wizard.  I need to use "code first from database" and I can't because the EF version used in the template is 5.  It's absolutely insane that such an old version that doesn't support such a critical feature is still in this template (it was there in v15 as well).  v16 should be using an EF 6 framework to support code first from db.

29 June, 2016
lcp 580
lcp 580

run iis express 10 is ok

but iis7 with windows7 not run?

30 July, 2016

Please login or register to post comments.