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.
 
 
 
 

46 lines
1.4 KiB

using Microsoft.AspNet.Identity.EntityFramework;
using System;
using System.Data.Entity;
using System.Web;
namespace Sevomin.Models
{
public class SevominDbContext : IdentityDbContext<User>
{
#region Singleton
private static object locker = new object();
public SevominDbContext() : base("SevominConnectionString") { }
public static SevominDbContext Current
{
get
{
lock (locker)
{
if (HttpContext.Current.Items["DataContexMember"] != null &&
HttpContext.Current.Items["DataContexMember"] is SevominDbContext)
return (SevominDbContext)HttpContext.Current.Items["DataContexMember"];
RenewMember();
return (SevominDbContext)HttpContext.Current.Items["DataContexMember"];
}
}
}
public static void RenewMember()
{
SevominDbContext pe =
new SevominDbContext();
HttpContext.Current.Items["DataContexMember"] = pe;
GC.Collect();
}
#endregion
public DbSet<Parameter> Parameters { get; set; }
public DbSet<ParameterValue> ParameterValues { get; set; }
public DbSet<Job> Jobs { get; set; }
public DbSet<DovominJob> DovominJobs { get; set; }
}
}