Example #1
0
 /// <summary>
 /// Clears the cache for the given page & region.
 /// </summary>
 /// <param name="page">The page</param>
 /// <param name="reg">The region</param>
 public void ClearCache(Paladino.Models.IPage page, Paladino.Models.Region reg)
 {
     ClearCache(CacheName(page, reg));
 }
Example #2
0
 /// <summary>
 /// Attaches the entity to the given context.
 /// </summary>
 /// <param name="db">The db context</param>
 public void Attach(Paladino.DataContext db)
 {
     if (this.Id == Guid.Empty || db.Set<Comment>().Count(t => t.Id == this.Id) == 0)
         db.Entry(this).State = EntityState.Added;
     else db.Entry(this).State = EntityState.Modified;
 }
Example #3
0
 /// <summary>
 /// Generates the cache name for the current region on the current page.
 /// </summary>
 /// <param name="page">The page</param>
 /// <param name="reg">The region</param>
 /// <returns>The cache name</returns>
 public static string CacheName(Paladino.Models.IPage page, Paladino.Models.Region reg)
 {
     return "CACHE_" + page.Permalink.ToUpper() + "_" + reg.Type.ToUpper().Replace(".", "_") + "_" + reg.InternalId.ToUpper();
 }