public CancellationScope Push() { Parent = Current; Parent.AddChild(this); CallContext.LogicalSetData("CancellationScope", this); return(Parent); }
private static Database GetDatabase() { // We will store the database object in the call context to save // the construction time. const string KEY = "winstar_database"; // See in the current call context var database = CallContext.GetData(KEY) as Database; if (null == database) { // Create the database database = CreateDatabase( Core.AppContext.Current.Config.Database.MainConnectionString); // Store in the call context CallContext.SetData(KEY, database); } return(database); }