You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Ombi/src/Ombi/DatabaseExtensions.cs

26 lines
773 B

using System.IO;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using Ombi.Helpers;
using Ombi.Store.Context;
namespace Ombi
{
public static class DatabaseExtensions
{
public static void ConfigureDatabases(this IServiceCollection services)
{
services.AddDbContext<OmbiContext, OmbiSqliteContext>(ConfigureSqlite);
}
private static void ConfigureSqlite(DbContextOptionsBuilder options)
{
var i = StoragePathSingleton.Instance;
if (string.IsNullOrEmpty(i.StoragePath))
{
i.StoragePath = string.Empty;
}
options.UseSqlite($"Data Source={Path.Combine(i.StoragePath, "Ombi.db")}");
}
}
}