Articles : Page 1 of 2

  • Passing multiple POST parameters to Web API Controller Methods

    Passing multiple POST parameters to Web API Controller Methods

    May 12
    09

    ASP.NET Web API introduces a new API for creating REST APIs and making AJAX callbacks to the server. This new API provides a host of new great functionality that unifies many of the features of many of the various AJAX/REST APIs that Microsoft created before it - ASP.NET AJAX, WCF REST specifically - and combines them into a whole more consistent API. Web API addresses many of the concerns that developers had with these older APIs, namely that it was very difficult to build consistent REST sty...


  • Entity Framework 4.3.1 Migrations and non English locale

    Entity Framework 4.3.1 Migrations and non English locale

    Apr 12
    30

    A few days ago I started migrating a web app I was working on from ASP.NET MVC 3 and EF4 to ASP.NET MVC 4 and EF 4.3.1. All went well, except for some problems with the automatic generation of the DB scheme using EF Code First: it was creating the database, but no tables and not even the __MigrationHistory table added in 4.3; and during the execution of the schema generation an error was raised with a weird datetime conversion error. I tried this both on SQL Express 2005 and SQL Compact and I ...


  • Dynamic JSON Parsing in .NET with JsonValue

    Dynamic JSON Parsing in .NET with JsonValue

    Mar 12
    19

    So System.Json has been around for a while in Silverlight, but it's relatively new for the desktop .NET framework and now moving into the lime-light with the pending release of ASP.NET Web API which is bringing a ton of attention to server side JSON usage. The JsonValue, JsonObject and JsonArray objects are going to be pretty useful for Web API applications as they allow you dynamically create and parse JSON values without explicit .NET types to serialize from or into. But even more so I think...


  • Using an alternate JSON Serializer in ASP.NET Web API

    Using an alternate JSON Serializer in ASP.NET Web API

    Mar 12
    09

    The new ASP.NET Web API that Microsoft released alongside MVC 4.0 Beta last week is a great framework for building REST and AJAX APIs. I've been working with it for quite a while now and I really like the way it works and the complete set of features it provides 'in the box'. It's about time that Microsoft gets a decent API for building generic HTTP endpoints into the framework. DataContractJsonSerializer sucks As nice as Web API's overall design is one thing still sucks: The built-in JSON S...


  • Using the HTML5 <input type="file" multiple="multiple"> Tag in ASP.NET

    Using the HTML5 <input type="file" multiple="multiple"> Tag in ASP.NET

    Mar 12
    06

    Per HTML5 spec the <input type="file" /> tag allows for multiple files to be picked from a single File upload button. This is actually a very subtle change that's very useful as it makes it much easier to send multiple files to the server without using complex uploader controls. Please understand though, that even though you can send multiple files using the <input type="file" /> tag, the process of how those files are sent hasn't really changed - there's still no progress information or oth...


  • Razor Donut Caching

    Razor Donut Caching

    Nov 11
    26

    Donut caching, the ability to cache an entire page except for a small region of the page (or set of regions) has been conspicuously absent from ASP.NET MVC since version 2. Mmmmm, donuts! – Photo by Pzado at sxc.hu This is something that’s on our Roadmap for ASP.NET MVC 4, but we have yet to flesh out the design. In the meanwhile, there’s a new NuGet package written by Paul Hiles that brings donut caching to ASP.NET MVC 3. I haven’t tried it myself yet, so be forewarned, but judging by th...


  • Using the West Wind Web Toolkit to set up AJAX and REST Services

    Using the West Wind Web Toolkit to set up AJAX and REST Services

    Nov 11
    03

    I frequently get questions about which option to use for creating AJAX and REST backends for ASP.NET applications. There are many solutions out there to do this actually, but when I have a choice - not surprisingly - I fall back to my own tools in the West Wind West Wind Web Toolkit. I've talked a bunch about the 'in-the-box' solutions in the past so for a change in this post I'll talk about the tools that I use in my own and customer applications to handle AJAX and REST based access to servic...


  • Studio for Wijmo MVC Review

    Studio for Wijmo MVC Review

    Aug 11
    22

    I was recently asked to review Studio for Wijmo MVC by Component One and, overall, I am impressed. There are 2 major components of this. The first is Wijmo Complete which is a collection of over 30 UI widgets (very similar to jQuery UI). The second is Wijmo Scaffolding for MVC which builds upon the scaffolding that was released as part of the MVC 3 Tools Update (note: is does *not* build on top of powershell-based MVC Scaffolding which Microsoft released earlier this year). Some of the Wijmo...


  • Massive and Complexity

    Massive and Complexity

    Aug 11
    09

    Got an email today from someone watching the MVC 3 series and they asked the question (paraphrasing): “I like what you’re doing with Massive - but can it handle complex queries?”. This, fortunately, is where Massive shines. In response I wrote this: “Absolutely. In fact it’s why I wrote it. Here’s a semi-complex query that is all too common in the business case: var results - DynamicModel.Open(connectionString).Query(@" SELECT Orders.OrderNumber, Categories.Name FROM Products INNER JOIN...


  • Custom Model Binder for binding drop downs into a DateTime in MVC

    Custom Model Binder for binding drop downs into a DateTime in MVC

    Jul 11
    06

    I have a Nullable DateTime Property in my Model I want to bind painlessly with three drop down select boxes I have for Day Month and Year respectively. First thing to do is to make a new shiny custom model binder. I have done mine by inheriting from DefaultModelBinder (which you will need to include System.Web.Mvc to access). using System; using System.ComponentModel; using System.Web.Mvc; namespace Infrastructure.OFP.ModelBinders { public class MyUserModelBinder : DefaultModelBinder { protect...