Visual Studio SSDT 项目中的多个 CLR 架构

发布于 2025-01-12 17:30:51 字数 546 浏览 4 评论 0原文

我尝试在 Visual Studio 2022 中创建一个 sqlproj 项目,代表我的 SQL Server 数据库。

在 C# 中创建 CLR 存储过程或函数时,SqlFunctionSqlProcedure 属性具有 Name 属性,但没有架构。看来整个项目都会使用默认模式。我希望能够拥有多个包含 CLR 项的架构。

我发现了几种不同的方法可以在部署后将过程从一个模式移动到另一个模式,但是有没有什么方法可以一开始就把它做好呢?

例如,默认情况下,如果我创建一个 MyProc 过程,我可以从常规过程将其引用为 dbo.MyProc 。但我希望它存在于 other 模式中。即使我将架构更改为部署后步骤,我使用 EXEC [other].[MyProc] 的常规过程也不会在 Visual Studio 中正确编译,因为它认为它引用了一个不存在的过程。

我不需要多个项目,因为我想要整个数据库的功能齐全的模式比较和发布步骤。

I'm trying to have a single sqlproj project in Visual Studio 2022, representing my SQL Server database.

When creating a CLR stored proc or function in C#, the SqlFunction or SqlProcedure attribute has a Name property, but not a schema. It seems the entire project will use the default schema. I'd like to be able to have more than one schema with CLR items.

I've found a couple different ways of moving procs from one schema to another after deployment, but is there any way to get it right in the first place?

For example, by default, if I create a MyProc procedure, I can reference it as dbo.MyProc from a regular proc. But I want that to live in the other schema. Even if I change schemas as a post-deploy step, then my regular procs with EXEC [other].[MyProc] will not compile properly in Visual Studio since it thinks it's referencing a non-existent procedure.

I don't want multiple projects because I want fully-functional schema compare and publish steps for the whole database.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文