Exemplo n.º 1
0
        public CancellationScope Push()
        {
            Parent = Current;
            Parent.AddChild(this);

            CallContext.LogicalSetData("CancellationScope", this);

            return(Parent);
        }
Exemplo n.º 2
0
        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);
        }