Announcing support for ASP.NET WebAPI and KendoUI

We are delighted to announce that we’ve added support for ASP.NET WebAPI and Kendo UI to the PLINQO for Entity Framework templates! In the article below we will talk about the templates and show off the new features. Please note that while we are still working on these features, we would love for you to download the templates and give us your feedback.

Also note that you will need to download and install MVC4 and NuGet before continuing.

Getting Started

Please note that the templates require CodeSmith Generator 6.5.1.

You can get started with the templates by downloading the latest nightly build and running the Quick Start. We have also placed the PLINQO for Entity Framework Templates on NuGet and will release more information when stable WebAPI and Kendo UI templates are available via NuGet.

  1. Download the latest nightly PLINQO for Entity Framework build.
  2. Extract the downloaded templates using Windows Explorer or your favorite file utility like 7-Zip.
    1. Please make sure you unblock the zip file by right clicking on the file. Then select properties and then press the unblock button in the shown properties dialog.
  3. Double click the QuickStart.cst template.
  4. Select a database by clicking on the SourceDatabase property and click the ellipse to choose your database.
  5. Next click on the select database once your database is shown in the drop down. If no database appears, click on the ellipse button again to add your database to the list.
  6. Next, change the Project Type property to WebAPI from the dropdown menu.
  7. Finally, click the generate button.
  8. Once Visual Studio is open.
    1. Open the NuGet Package Manager Console and click the restore button at the top of the console.
    2. Then build the project to generate the code.
  9. Select the web project as the startup project and start debugging by pressing f5.
  10. Navigate to /admin/ to see the generated kendo UI.

Features

The generated admin sample site shown below is very useful for interacting with your data.

Paging

One of the main features that we support out of the box is Paging. Paging allows you to see limited amounts of data, making the generated website blazing fast without killing your server. It’s worth noting that WebAPI 1.0 will ship without paging support.

Filtering and Sorting

We also support server side sorting and filtering out of the box!

Update and delete relational data.

You can use the sample website to update existing content just as you would with Dynamic Data.

Clean API Controllers

One of the best features of WebAPI is that it is Extensible. We’ve integrated into the WebAPI pipeline and offered all of the above features without adding one line of code to the generated controllers.

       public PetShop.Data.Category GetByKey(System.String identification)
        {
            var category = _context.Category.GetByKey(identification);
            if (category == null)
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound));

            return category;
        }

        public IQueryable<PetShop.Data.Category> GetAll()
        {
            return _context.Category.AsQueryable();
        }

        public IQueryable<PetShop.Data.Category> GetByName(System.String name)
        {
            return _context.Category.ByName(name).AsQueryable();
        }

Future Directions

We still have some work to do on the templates and would love your feedback. We are tentatively planning on bringing WebAPI and Kendo UI support to the CSLA and other PLINQO Frameworks templates in the future!