Adding EF initialization
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data.Entity;
|
||||
using LeafWeb.Core.Models;
|
||||
|
||||
namespace LeafWeb.Core.DAL
|
||||
{
|
||||
public class DataService : IDisposable
|
||||
{
|
||||
public static void RegisterInitializer()
|
||||
{
|
||||
Database.SetInitializer(new LeafWebInitializer());
|
||||
new LeafWebContext().Database.Initialize(true);
|
||||
}
|
||||
|
||||
private readonly LeafWebContext _db = new LeafWebContext();
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_db.Dispose();
|
||||
}
|
||||
|
||||
#region Fluxnet Sites
|
||||
|
||||
public IEnumerable<FluxnetSite> GetFluxnetSites()
|
||||
{
|
||||
return _db.FluxnetSites;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user