예제 #1
0
        private List <ObjectReference> GetObjectReferencesFor(System.Threading.CancellationToken token, string connectionString, ObjectMetadata meta)
        {
            var refs = new List <ObjectReference>();

            QueryManager.Run(connectionString, token, (queryManager) =>
            {
                var dt = new DataTable();
                queryManager.Fill(sql, dt, new Dictionary <string, string>()
                {
                    { "referencing_schema", meta.SchemaName },
                    { "referencing_entity", meta.ObjectName },
                });

                foreach (DataRow row in dt.Rows)
                {
                    var reference = new ObjectReference
                    {
                        EntityName       = row.Field <string>("referencing_entity"),
                        ReferencedObject = ObjectMetadata.FromParts(
                            row.Field <string>("referenced_database_name"),
                            row.Field <string>("referenced_schema_name"),
                            row.Field <string>("referenced_entity"))
                    };
                    refs.Add(reference);
                }
            });
            return(refs);
        }