Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SharedState"/> class.
        /// </summary>
        /// <param name="configuration">The configuration to initialize <see cref="SharedState"/> instance with.</param>
        /// <exception cref="ArgumentNullException">Thrown when any of the arguments is null.</exception>
        public SharedState(CortexConfiguration configuration)
        {
            this.Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
            if (globalState != null)
            {
                throw new InvalidOperationException(Resources.GlobalStateAlreadyInitialized);
            }

            CortexConfiguration.UseGlobalState = false;
            this.startThreadId = Thread.CurrentThread.ManagedThreadId;
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SharedState"/> class.
 /// </summary>
 /// <param name="configuration">The configuration to initialize <see cref="SharedState"/> instance with.</param>
 /// <exception cref="ArgumentNullException">Thrown when any of the arguments is null.</exception>
 public SharedState(CortexConfiguration configuration)
 {
     this.Configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
 }