35 lines
709 B
C#
35 lines
709 B
C#
using EnVisage.Models.Cache;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
|
|
namespace EnVisage.Code.Cache
|
|
{
|
|
public class SecurityAreasCache : Cache<UserAreaAccess>
|
|
{
|
|
protected override string CACHE_KEY
|
|
{
|
|
get
|
|
{
|
|
return "Areas";
|
|
}
|
|
}
|
|
|
|
protected override void SetValuesToCache()
|
|
{
|
|
using (EnVisageEntities context = new EnVisageEntities())
|
|
{
|
|
var value = context.Securities.AsNoTracking().
|
|
Select(p => new UserAreaAccess
|
|
{
|
|
PrincipalId = p.PrincipalId,
|
|
SecurityObject = p.SecurityObject,
|
|
Read = p.Read,
|
|
Write = p.Write
|
|
}).ToList();
|
|
CacheManager.Instance.AddToCache(CACHE_KEY, value);
|
|
}
|
|
}
|
|
}
|
|
} |