/// <summary> /// Removes a given entity from the cache. /// </summary> public virtual void Remove(IEntity entity) { entity.InvalidateCachedReferences(); SessionMemory.Remove(entity); if (!(entity is IApplicationEvent)) { foreach (var type in CacheDependentAttribute.GetDependentTypes(entity.GetType())) { Remove(type, invalidateCachedReferences: true); } } if (!CanCache(entity.GetType())) { return; } var entities = GetEntities(entity.GetType()); lock (entities) { var id = entity.GetId().ToString(); if (entities.ContainsKey(id)) { entities.Remove(id); } ExpireLists(entity.GetType()); } if (this != Current) { Current.Remove(entity); } }
protected virtual void InitiateApplication() { // The constructor is called more than once. if (AlreadyInitiated) { return; } else { AlreadyInitiated = true; } // initializations SessionMemory.Initialize(new SessionMemoryAccessor()); ApplicationEventManager.Initialize(new DefaultApplicationEventManager()); EmailService.Initialized(new EmailServiceConfigurator()); Services.Globalization.Translator.Initialize(new Services.Globalization.CookiePropertyHelper()); MSharpExtensions.ToFullMessageExtendedTypeChecking.Add(HttpUnhandledExceptionToFullMessageAction); MSharp.Framework.Context.Initialize(new DefaultServiceProvider()); WebTestManager.InitiateTempDatabase(enforceRestart: false, mustRenew: false); LookForInsecureFiles(); }
public BreadCrumbManager(IMemoryMain memory) { _memory = memory; _sessionMemory = _memory.SessionMemory; _breadCrumbStack = GetFromMemory(); }