Example #1
0
 public SessionStorageManagerBase(IStateManager stateManager, SurrogateManager surrogateManager)
 {
     _stateManager            = stateManager;
     _surrogateManager        = surrogateManager;
     _serializer              = new StorageSerializerUsingJsonnet();
     _surrogatesToBePersisted = new Hashtable();
 }
Example #2
0
 public void Dispose()
 {
     this._serializer              = null;
     this._stateManager            = null;
     this._surrogateManager        = null;
     this._surrogatesToBePersisted = null;
     if (storageCache != null)
     {
         this.storageCache.Dispose();
         this.storageCache = null;
     }
 }
Example #3
0
 /// <summary>
 /// The lifecycle of the cache is expected to be of a single request, so there's no need to track changes made in the storage.
 /// </summary>
 public SessionStorageManagerInproc(IStateManager stateManager, SurrogateManager surrogateManager)
     : base(stateManager, surrogateManager)
 {
     if (HttpContext.Current.Session != null)
     {
         InitSessionCollectionItems();
     }
     else
     {
         TraceUtil.TraceError("There is no current session. No persistence will be performed");
         _sessionCollectionItems = new Dictionary <string, object>(StringComparer.Ordinal);
     }
 }
        /// <summary>
        ///
        /// Registers all types.
        /// This process is very important.
        /// For example if you have a multi node setup. All nodes must have the same assemblies
        /// Having an inconsistent assembly list can produce inconsistent types tables
        /// </summary>
        /// <param name="container">Container.</param>
        public static void RegisterAllTypes(IocContainerImplWithUnity container, Assembly mainAssembly = null)
        {
            IEnumerable <Type> typesToRegister;
            var coreAssemblyName = typeof(IStateObject).Assembly.GetName();

            _assembliesToExtractTypesForRegistration = _assembliesToExtractTypesForRegistration ??
                                                       new List <Assembly>(
                System.Web.Compilation.BuildManager.GetReferencedAssemblies()
                .Cast <Assembly>()
                .Where(x => x.GetReferencedAssemblies().Any(y => y.Name == coreAssemblyName.Name) && !x.IsDynamic));
            if (mainAssembly != null)
            {
                _assembliesToExtractTypesForRegistration.Add(mainAssembly);
            }



            typesToRegister = from assemblyFile in _assembliesToExtractTypesForRegistration
                              from t in GetAssemblyTypes(assemblyFile)

                              select t;
            var sw = new Stopwatch();

            sw.Start();

            TraceUtil.TraceInformation("Start Registering all surrogates");
            SurrogateManager.RegisterSurrogates(typesToRegister);
            RegisterAppStateConverters(typesToRegister);
            TraceUtil.TraceInformation("Start Registering Types for interception");
            container.RegisterTypes(typesToRegister);


            //We will force loding the tables with information about autowire metadata. That is registing events for methods
            //with the [Handler] attribute
            //    TypeCacheUtils.NeedsAutoWire(typesToRegister);

            RegisterDeltaTrackerConverters();
            StateManager.AddConverters();
            sw.Stop();
            TraceUtil.TraceInformation(string.Format("End Registering Types. Elapsed Time {0} ms", sw.ElapsedMilliseconds));
        }
Example #5
0
 /// <summary>
 /// The lifecycle of the cache is expected to be of a single request, so there's no need to track changes made in the storage.
 /// </summary>
 public SessionStorageManager(IStateManager stateManager, SurrogateManager surrogateManager)
     : base(stateManager, surrogateManager)
 {
     _session = HttpContext.Current.Session;
 }