Skip to content
This repository has been archived by the owner on Oct 27, 2020. It is now read-only.
Trevor Pilley edited this page Jul 19, 2017 · 13 revisions

Getting Started

In order to use the WebApi extension for the MicroLite ORM framework, you need to reference it in your solution. The easiest way to do this is install it via NuGet (if you are unfamiliar with NuGet, it's a package manager for Visual Studio - visit nuget.org for more information).

Install-Package MicroLite.Extensions.WebApi

Configuring the Extension

In the WebApiConfig class in the App_Start folder of your WebApi project, register the action filter(s) (only add the ones you want based upon the behaviour they introduce):

public static void Register(HttpConfiguration config)
{
    ...

    // Add the MicroLite filters in the following order (for the ones you choose to use)
    config.Filters.Add(new ValidateModelNotNullAttribute());
    config.Filters.Add(new ValidateModelStateAttribute());
    config.Filters.Add(new AutoManageTransactionAttribute());
}

See the following pages for further details about the attributes:

Configure your Controllers

Finally, configure your controllers so that the extension can optionally manage the transaction for you.

See the Controllers page for further details.

OData Support

The OData extension adds support for OData queries, see the OData extension for further details.

Also, check out the WebApi tag on the MicroLite Blog.