Esempio n. 1
0
        /// <summary>
        /// Gets all views.
        /// </summary>
        public IList <DatabaseView> AllViews()
        {
            DataTable           dt    = _sr.Views();
            List <DatabaseView> views = SchemaConverter.Views(dt);
            //get full datatables for all tables, to minimize database calls
            var columnLoader = new ViewColumnLoader(_sr);

            foreach (DatabaseView v in views)
            {
                v.Columns.AddRange(columnLoader.Load(v.Name));
            }
            DatabaseSchema.Views.Clear();
            DatabaseSchema.Views.AddRange(views);
            return(views);
        }
Esempio n. 2
0
        /// <summary>
        /// Gets all views.
        /// </summary>
        public IList <DatabaseView> AllViews(CancellationToken ct)
        {
            if (ct.IsCancellationRequested)
            {
                return(DatabaseSchema.Views);
            }
            RaiseReadingProgress(SchemaObjectType.Views);
            DataTable dt = _schemaReader.Views();

            if (ct.IsCancellationRequested)
            {
                return(DatabaseSchema.Views);
            }
            ReaderEventArgs.RaiseEvent(ReaderProgress, this, ProgressType.Processing, SchemaObjectType.Views);
            List <DatabaseView> views = SchemaConverter.Views(dt);
            var viewFilter            = Exclusions.ViewFilter;

            if (viewFilter != null)
            {
                views.RemoveAll(v => viewFilter.Exclude(v.Name));
            }

            //get full datatables for all tables, to minimize database calls
            if (ct.IsCancellationRequested)
            {
                return(views);
            }
            RaiseReadingProgress(SchemaObjectType.ViewColumns);

            var columnLoader = new ViewColumnLoader(_schemaReader);
            var count        = views.Count;

            for (var index = 0; index < count; index++)
            {
                if (ct.IsCancellationRequested)
                {
                    return(views);
                }
                DatabaseView v = views[index];
                ReaderEventArgs.RaiseEvent(ReaderProgress, this, ProgressType.Processing, SchemaObjectType.ViewColumns, v.Name, index, count);
                v.Columns.AddRange(columnLoader.Load(v.Name, v.SchemaOwner));
            }
            DatabaseSchema.Views.Clear();
            DatabaseSchema.Views.AddRange(views);
            return(views);
        }
Esempio n. 3
0
        /// <summary>
        /// Gets all views.
        /// </summary>
        public IList <DatabaseView> AllViews()
        {
            DataTable           dt    = _schemaReader.Views();
            List <DatabaseView> views = SchemaConverter.Views(dt);
            var viewFilter            = Exclusions.ViewFilter;

            if (viewFilter != null)
            {
                views.RemoveAll(v => viewFilter.Exclude(v.Name));
            }
            //get full datatables for all tables, to minimize database calls
            var columnLoader = new ViewColumnLoader(_schemaReader);

            foreach (DatabaseView v in views)
            {
                v.Columns.AddRange(columnLoader.Load(v.Name, v.SchemaOwner));
            }
            DatabaseSchema.Views.Clear();
            DatabaseSchema.Views.AddRange(views);
            return(views);
        }