public SessionManager(
            IServiceProvider globalServices,
            IEnumerable <DataLoaderDescriptor> dataLoaderDescriptors,
            IEnumerable <CustomContextDescriptor> customContextDescriptors)
        {
            if (dataLoaderDescriptors == null)
            {
                throw new ArgumentNullException(nameof(dataLoaderDescriptors));
            }

            if (customContextDescriptors == null)
            {
                throw new ArgumentNullException(nameof(customContextDescriptors));
            }

            _globalServices = globalServices
                              ?? throw new ArgumentNullException(nameof(globalServices));
            _dataLoaderDescriptors =
                new StateObjectDescriptorCollection <string>(
                    dataLoaderDescriptors);
            _customContextDescriptors =
                new StateObjectDescriptorCollection <Type>(
                    customContextDescriptors);
            _globalDataLoaders = new StateObjectCollection <string>(
                ExecutionScope.Global);
            _globalCustomContexts = new StateObjectCollection <Type>(
                ExecutionScope.Global);
        }
 public DataLoaderProvider(
     IServiceProvider globalServices,
     IServiceProvider requestServices,
     StateObjectDescriptorCollection <string> descriptors,
     StateObjectCollection <string> globalStates)
     : base(globalServices, requestServices, descriptors, globalStates)
 {
 }
Beispiel #3
0
 protected StateObjectContainer(
     IServiceProvider root,
     StateObjectDescriptorCollection <TKey> descriptors,
     ISet <ExecutionScope> scopes)
     : this(root, descriptors, scopes,
            Enumerable.Empty <StateObjectCollection <TKey> >())
 {
 }
 public CustomContextProvider(
     IServiceProvider globalServices,
     IServiceProvider requestServices,
     StateObjectDescriptorCollection <Type> descriptors,
     StateObjectCollection <Type> globalStates)
     : base(globalServices, requestServices, descriptors, globalStates)
 {
 }
Beispiel #5
0
 protected StateObjectContainer(
     IServiceProvider globalServices,
     IServiceProvider requestServices,
     StateObjectDescriptorCollection <TKey> descriptors,
     StateObjectCollection <TKey> globalStates)
 {
     _globalServices = globalServices
                       ?? throw new ArgumentNullException(nameof(globalServices));
     _descriptors = descriptors
                    ?? throw new ArgumentNullException(nameof(descriptors));
     _globalStates = globalStates
                     ?? throw new ArgumentNullException(nameof(globalStates));
     _requestServices = requestServices ?? globalServices;
     _requestStates   = new StateObjectCollection <TKey>(
         ExecutionScope.Request);
 }
Beispiel #6
0
        protected StateObjectContainer(
            IServiceProvider root,
            StateObjectDescriptorCollection <TKey> descriptors,
            ISet <ExecutionScope> scopes,
            IEnumerable <StateObjectCollection <TKey> > objectCollections)
        {
            if (scopes == null)
            {
                throw new ArgumentNullException(nameof(scopes));
            }

            if (objectCollections == null)
            {
                throw new ArgumentNullException(nameof(objectCollections));
            }

            _root = root
                    ?? throw new ArgumentNullException(nameof(root));
            _descriptors = descriptors
                           ?? throw new ArgumentNullException(nameof(descriptors));

            _scopes =
                new Dictionary <ExecutionScope, StateObjectCollection <TKey> >();

            foreach (StateObjectCollection <TKey> collection in
                     objectCollections)
            {
                _scopes[collection.Scope] = collection;
            }

            foreach (ExecutionScope scope in scopes)
            {
                if (!_scopes.ContainsKey(scope))
                {
                    _scopes[scope] = new StateObjectCollection <TKey>(scope);
                }
            }
        }