With code like this:
这样的代码:
DataTable schema = conn.GetSchema();
DataTable tables = conn.GetSchema("Tables");
DataTable columns = conn.GetSchema("Columns");
Quite a lot of information can be fetched about the schema, but the metadata version (ie: GetSchema()) doesn't return anything about synonyms.
可以获取关于模式的很多信息,但是元数据版本(即:GetSchema())不返回关于同义词的任何信息。
We use Synonyms quite heavily in our environment. Can I get Schema information about them using GetSchema, or do I need another method?
我们在环境中大量使用同义词。我可以使用GetSchema获取关于它们的模式信息吗,还是需要其他方法?
1 个解决方案
#1
3
There is not a schema collection for Synonyms for SQL Server:
SQL Server的同义词没有模式集合:
SQL Server模式集合
There does appear to be a way to override the collections with .NET 3.5. I have never done this though so I don't know if it actually works. The basic idea is that you create an XML file to define how getschema
defines and queries for schema data. You then change your applications configuration to use this XML file to override the collections that are available.
确实有一种方法可以用。net 3.5覆盖集合。我从来没有这样做过,所以我不知道它是否真的有效。基本思想是创建一个XML文件来定义getschema如何定义和查询模式数据。然后更改应用程序配置,使用这个XML文件覆盖可用的集合。
GetSchema覆盖
There are examples in the provided link to add a Primary Keys collection to the schema. It looks promising if your determined to use getschema
. Otherwise you could create your own schema functions and just query sys.synonyms to get synonyms.
在提供的链接中,有一些示例向模式添加主键集合。如果您决定使用getschema,这看起来很有希望。否则,您可以创建自己的模式函数和查询sys。同义词,同义词。
#1
3
There is not a schema collection for Synonyms for SQL Server:
SQL Server的同义词没有模式集合:
SQL Server模式集合
There does appear to be a way to override the collections with .NET 3.5. I have never done this though so I don't know if it actually works. The basic idea is that you create an XML file to define how getschema
defines and queries for schema data. You then change your applications configuration to use this XML file to override the collections that are available.
确实有一种方法可以用。net 3.5覆盖集合。我从来没有这样做过,所以我不知道它是否真的有效。基本思想是创建一个XML文件来定义getschema如何定义和查询模式数据。然后更改应用程序配置,使用这个XML文件覆盖可用的集合。
GetSchema覆盖
There are examples in the provided link to add a Primary Keys collection to the schema. It looks promising if your determined to use getschema
. Otherwise you could create your own schema functions and just query sys.synonyms to get synonyms.
在提供的链接中,有一些示例向模式添加主键集合。如果您决定使用getschema,这看起来很有希望。否则,您可以创建自己的模式函数和查询sys。同义词,同义词。