public void ReadModel(string srcConString)
        {
            var decFilePath = GetDacFileName(srcConString) + ".bacpac";

            using (TSqlModel model = new TSqlModel(decFilePath))
            {
                // This will get all tables. Note the use of Table.TypeClass!
                var tables = model.GetObjects(DacQueryScopes.Default, Table.TypeClass).ToList();

                // Look up a specific table by ID. Note that if no schema is defined when creating
                // an element the default "dbo" schema is used
                var t1 = model.GetObjects(Table.TypeClass, new ObjectIdentifier("dbo", "t1"), DacQueryScopes.Default).FirstOrDefault();

                // Get a the column referenced by this table, and query its length
                TSqlObject column       = t1.GetReferenced(Table.Columns).First(col => col.Name.Parts[2].Equals("c1"));
                int        columnLength = column.GetProperty <int>(Column.Length);
                Console.WriteLine("Column c1 has length {0}", columnLength);

                // Verify the ColumnType of this column. This can help indicate which
                // properties will return meaningful values.
                // For instance since Column.Collation is only available on a simple column,
                // and Column.Persisted is only on computed columns
                ColumnType columnType = column.GetMetadata <ColumnType>(Column.ColumnType);
                Console.WriteLine("Column c1 is of type '{0}'", columnType);
            }
        }
        private void AddPropertiesForColumn(Panel panel, TSqlObject column)
        {
            var type = column.GetMetadata <ColumnType>(Column.ColumnType);

            panel.Children.Add(GetPropertyLabel("Column MetaType: ", type == ColumnType.Column ? "Standard Column" : type.ToString()));

            foreach (TSqlObject referenced in column.GetReferenced())
            {
                panel.Children.Add(GetPropertyLabel("Type: ", referenced.Name.ToString()));
            }
        }
 private static bool IsInlineTableValuedFunction(TSqlObject modelElement)
 {
     return(TableValuedFunction.TypeClass.Equals(modelElement.ObjectType) &&
            FunctionType.InlineTableValuedFunction == modelElement.GetMetadata <FunctionType>(TableValuedFunction.FunctionType));
 }
        private void AddPropertiesForColumn(Panel panel, TSqlObject column)
        {
            var type = column.GetMetadata<ColumnType>(Column.ColumnType);

            panel.Children.Add(GetPropertyLabel("Column MetaType: ", type == ColumnType.Column ? "Standard Column" : type.ToString()));

            foreach (TSqlObject referenced in column.GetReferenced())
            {
                panel.Children.Add(GetPropertyLabel("Type: ", referenced.Name.ToString()));
            }

        }
 private static bool IsInlineTableValuedFunction(TSqlObject modelElement)
 {
     return TableValuedFunction.TypeClass.Equals(modelElement.ObjectType)
            && FunctionType.InlineTableValuedFunction == modelElement.GetMetadata<FunctionType>(TableValuedFunction.FunctionType);
 }