简体   繁体   English

在TFS中共享数据库项目

[英]Sharing database project in TFS

I created a database project as part of my solution with scripts for my tables. 作为解决方案的一部分,我使用表脚本创建了一个数据库项目。 I'm using database first, so all I do is run the project to build/deploy my tables to the database. 我首先使用数据库,所以我要做的就是运行项目以将表构建/部署到数据库。

I'm working with a few others so I checked the SQL project into TFS. 我正在和其他一些人一起工作,所以我将SQL项目签入了TFS。

So the other people can get the solution, run the SQL project and generate the local database for themselves. 这样其他人可以获取解决方案,运行SQL项目并为自己生成本地数据库。

The problem is, it might generate them under another local instance. 问题是,它可能在另一个本地实例下生成它们。 For instance, on my home computer, it generated it under (localdb)\\Projects, but on my laptop, under (localdb)\\ProjectsV12. 例如,在我的家用计算机上,它是在(localdb)\\ Projects下生成的,而在我的笔记本电脑上是(localdb)\\ ProjectsV12下。

This breaks the connection strings (which of course can be fixed). 这会破坏连接字符串(当然可以固定)。 But this leaves me wondering, is there a better way to develop the SQL project collaboratively? 但这让我想知道,是否有更好的方法来协作开发SQL项目?

If you have the SQL code under source control then everyone can open that solution to edit/create copies of the database. 如果您具有源代码控制下的SQL代码,那么每个人都可以打开该解决方案来编辑​​/创建数据库副本。 Ideally you have an automated process but that does not work for local dev. 理想情况下,您有一个自动化流程,但不适用于本地开发人员。

Since sharing code is a bad idea and you have expressed that the database is used by more than one solution I would consider packaging and distributing it. 由于共享代码是一个坏主意,并且您已经表示数据库已被多个解决方案使用,因此我将考虑打包和分发它。

If you create a SSDT database project you can compile your database into a package that can upgrade any instance. 如果创建SSDT数据库项目,则可以将数据库编译为可以升级任何实例的软件包。 You can then share that .dacpac output easily. 然后,您可以轻松共享该.dacpac输出。

You might even what to share it with Nuget so that each dependency is automatically updated. 您甚至可以与Nuget共享它,以便每个依赖关系自动更新。

You can setup a SQL alias name to standardize the connection string across developer machines. 您可以设置SQL别名,以标准化开发人员计算机之间的连接字符串。

Alias .\\SQLEXPRESS to (LocalDB)\\MSSQLLocalDB 别名。\\ SQLEXPRESS到(LocalDB)\\ MSSQLLocalDB

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用与另一个数据库同义的TFS上的数据库项目 - Database Project on TFS using synonym to another database TFS迁移-数据库项目循环依赖 - TFS Migration - Database Project Circular Dependency 具有数据库的ASP.NET MVC项目的共享源 - Sharing source for an ASP.NET MVC project that has a database Visual Studio数据库项目+部署+ TFS构建+多租户 - Visual Studio Database Project + Deploy + TFS Build + Multi Tenancy 使用数据库来实现tSQLt框架,该数据库是TFS SQL项目的一部分 - Implement tSQLt Framework with database which is part of TFS SQL Project 将数据库脚本导入数据库项目时是否可以带来TFS历史记录? - Is it possible to bring TFS history along when importing database scripts into a database project? 可以从最新的数据库中更新过期的TFS数据库项目吗 - Can a TFS Database project that is out of date be updated from a database that is up to date VisualStudio SQL数据库项目sqlcmdvars TFS部署覆盖自定义文件路径? - VisualStudio SQL database project sqlcmdvars TFS deployment override custom File path? 对于SQL数据库项目不存在TFS vNext构建错误SQL72027文件 - TFS vNext build Error SQL72027 File Does Not Exists For SQL Database Project 在TFS上数据库项目的每个更改的每个版本中都需要生成SQL脚本文件 - Need to generate SQL script file in every build of every changes in database project on TFS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM