如何为 Visual Studio 数据库项目创建 SQL 文件的项目模板

发布于 2024-08-31 20:41:37 字数 319 浏览 2 评论 0原文

可以为普通项目类型定义您自己的自定义模板,例如类库项目的 C# 文件模板。

“数据库项目”场景怎么样?

我想定义一个用于添加存储过程的标准模板,该模板使用公司对所有存储过程的约定,例如顶部的标准注释。


在浏览了有关该主题的 MSDN 文章后,似乎不支持数据库项目:

图 5 项目的 TemplateData 元素

项目类型 | 指示该项目可以添加到的项目类型。可能的值包括 CSharp、VisualBasic、VisualC、JSharp 和 Web。

It's possible to define your own custom templates for normal project types, such as templates for C# files, for a Class Library project.

What about a 'Database Project' scenario?

I would like to define a standard template for adding a stored procedure, which uses the company's conventions for all stored procedures, such as standard comments at the top.


After looking through an MSDN article on the topic, it seems as though the Database Project isn't supported:

Figure 5 TemplateData Elements for an Item

ProjectType |
Indicates the type of project that this item can be added to. Possible values include CSharp, VisualBasic, VisualC, JSharp, and Web.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

自找没趣 2024-09-07 20:41:37

您可以为数据库项目创建自定义项目项模板,我们一直这样做,

该项目必须放置在以下文件夹中:

C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\Templates\Database Project Items

,然后你可以选择它

you can created customized project item templates for the database project , we do it all the time

the item must be placed in the following folder:

C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\Templates\Database Project Items

and then you can select it

若水般的淡然安静女子 2024-09-07 20:41:37

找到它:

C:\Program Files\Microsoft Visual Studio 10.0\VSTSDB\Extensions\SqlServer\Items

这不是您要的项目模板,它是每种类型的对象的项目模板。

Found it:

C:\Program Files\Microsoft Visual Studio 10.0\VSTSDB\Extensions\SqlServer\Items

It's not the project template you're after, it's the item templates for each type of object.

鱼窥荷 2024-09-07 20:41:37

您可以使用代码片段获得相同的结果。创建代码片段后(我复制/粘贴了内置 SQL 代码片段之一),右键单击脚本文件并选择“插入代码片段...”

关键字替换效果很好。

You can achieve the same result using code snippets. Once you have created your snippet (I copy/pasted one of the built-in SQL snippets), right click in your script file and select "Insert Snippet..."

The keyword replacement works nicely.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文