This repository was archived by the owner on Oct 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Trevor Pilley edited this page Feb 16, 2017
·
21 revisions
In order to use the MVC 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.Mvc
Register the action filters for the behaviour you want in your FilterConfig in the App_Start folder of your project:
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
// this is part of ASP.NET and usually already added
filters.Add(new ErrorHandlerAttribute());
// Add the MicroLite filters you want to use in the following order:
filters.Add(new ValidateModelNotNullAttribute());
filters.Add(new ValidateModelStateAttribute());
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.
Also, check out the MVC tag on the MicroLite Blog.