/// <summary> /// Creates a new instance of a context. /// </summary> /// <remarks> /// Reserved for internal use only - consumers should use the static <see cref="Run"/> method. /// </remarks> internal DataLoaderContext() { Factory = new DataLoaderFactory(this); SyncContext = new DataLoaderSynchronizationContext(this); TaskScheduler = new DataLoaderTaskScheduler(this); }
/// <remarks> /// Use the public static <see cref="o:DataLoaderContext.Run"/> methods - they ensure a context's lifecycle is appropriately managed. /// </remarks> private DataLoaderContext() { SyncContext = new DataLoaderSynchronizationContext(this); TaskScheduler = new DataLoaderTaskScheduler(this); _taskFactory = new TaskFactory(CancellationToken.None, TaskCreationOptions.None, TaskContinuationOptions.None, TaskScheduler); }