-
Notifications
You must be signed in to change notification settings - Fork 1
Home
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
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:
Finally, configure your controllers so that the extension can optionally manage the transaction for you.
See the Controllers page for further details.
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.