Skip to content

Instantly share code, notes, and snippets.

@codehaks
Created October 1, 2018 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codehaks/7e19f5e4a545c4f987d244640868c334 to your computer and use it in GitHub Desktop.
Save codehaks/7e19f5e4a545c4f987d244640868c334 to your computer and use it in GitHub Desktop.
LiteDb Service for ASP.NET Core
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
namespace BugPages.Common
{
public static class LiteDbServiceExtention
{
public static void AddLiteDb(this IServiceCollection services,string databasePath)
{
services.AddTransient<LiteDbContext, LiteDbContext>();
services.Configure<LiteDbConfig>(options => options.DatabasePath = databasePath);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment