如何通过 DAC api 联系 DACPAC 项目参考资料? [英] How do I reach out to a DACPAC project references through DAC api?

查看:42
本文介绍了如何通过 DAC api 联系 DACPAC 项目参考资料?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 GetObject 方法从引用的项目中获取表示表的 TSqlObject 的实例:

I'm trying to use GetObject method to obtain an instance of a TSqlObject representing a table from a referenced project:

var id = new ObjectIdentifier(new[] {"ExternalDb"}, new[] {"Schema", "TableName"});

var table = Model.GetObject(ModelSchema.Table, id, DacQueryScopes.All);

不幸的是,这似乎不起作用.

Unfortunately that doesn't seem to work.

我在文档中读到 DacQueryScopes.All 将获取所有对象,除了非系统数据库中的对象.

I've read inside the doc that DacQueryScopes.All will get all objects, EXCEPT those in a non-system db.

所以我想这就是失败的原因,但是我应该如何接触到其他项目中的元素?

So I guess this is why this fails, but then how am I supposed to reach up to elements inside that other project?

推荐答案

如果要查询引用项目中的对象,请打开该引用项目的 dacpac 并进行查询.

If you want to query the object in the referenced project then open the dacpac for that referenced project and query that.

ExternalDb 是一个指针,但不是您想要的项目的 id.

The ExternalDb is a pointer to but not an id of the item you want.

这篇关于如何通过 DAC api 联系 DACPAC 项目参考资料?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆