public override IList<DatabaseColumn> ViewColumns(string viewName)
 {
     var columnLoader = new ViewColumnLoader(_schemaReader);
     if (string.IsNullOrEmpty(viewName))
     {
         return columnLoader.Load();
     }
     return columnLoader.Load(viewName, Owner).ToList();
 }
Esempio n. 2
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;
 }
Esempio n. 3
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;
        }