Visual Studio 2010中的数据库设计器 [英] DB Designer in Visual Studio 2010

查看:183
本文介绍了Visual Studio 2010中的数据库设计器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个全新的Sql Server 2008数据库,并想在Visual Studio 2010(最终版)中使用数据库项目.我已经创建了项目,并在 dbo 模式下添加了一个表.

.sql 仅显示为纯文本,但带有颜色.它没有设计器,没有添加列,也没有自动完成功能.现有列的属性显示为灰色.

通常,我使用DB Project只是为了出于源代码控制目的而存储 .sql 文件,但是我假设它可以帮助我设计数据库.目前,它没有提供此类帮助,我认为这是因为我做错了什么.也许我需要首先将DB部署到服务器,或类似的东西.我一直在寻找入门指南,但是我发现的所有指南都是从导入现有数据库开始的.

请帮助我理解数据库项目可以为我做些什么以及如何做.

谢谢,
阿萨夫

解决方案

VSTS DB的整个想法是让您设置在正确的路径上,即.将数据库对象定义存储为.sql文件,而不是一些精美的图表.通过修改SQL定义对对象所做的任何修改.通过这种方式,您可以按照DDL语法的要求对对象进行任何修改,而不是visual-designer-du-jour认为可以做或不能做的事情.更不用说与所有设计人员相关的大量SQL代码生成错误.

最接近可视视图的是Schema View,它在树视图中显示表,列,索引等,您可以从那里查看属性.

通过将开发过程和Visual Studio项目的重点放在.sql源文件上,团队可以使用久经考验的源代码控制方法(签出/签入,锁定文件,冲突检测和合并)在数据库设计上进行合作.集成,分支等).

VSTS DB项目的交付物是.dbschema文件,该文件可以通过

I need to create an entirely new Sql Server 2008 database and want to use a Database Project in Visual Studio 2010 (Ultimate). I've created the project and added a table under the dbo schema.

The table .sql is shown only as plain text, though with colors. It has no designer, no Add Column, and no autocomplete. Existing column's properties are grayed out.

Usually, I use DB Project for nothing more than storing .sql files for source control purposes, but I'm assuming it can help me with designing the DB. Currently, it offers no such help and I think it's because I'm doing something wrong. Perhaps I need to deploy the DB to server first, or something of the such. I've looked for a Getting Started guide, but all guides I found start from importing an existing database.

Please help my understand what a DB Project can do for me and how.

Thanks,
Asaf

解决方案

The whole idea of the VSTS DB is to get you set on the right path, ie. store database object definitions as .sql files, not as some fancy diagram. Any modification you do to the objects you do it by modifying the SQL definition. This way you get to do any modification to the objects, as permitted by the DDL syntax, as opposed to whatever the visual-designer-du-jour thinks you can and can't do. Not to mention the plethora of SQL code generation bugs associated with all designers out there.

The closes to a visual view is the Schema View, which shows tables, columns, indexes etc in a tree view and you can see the properties from there.

By focusing the development process and the Visual Studio project on the .sql source files, teams can cooperate on the database design using tried and tested source control methods (check-out/check-in, lock file, conflict detection and merge integration, branching etc).

the deliverable of a VSTS DB project is a the .dbschema file, which can be deployed on any server via the vsdbcmd tool. This is an intelligent deployment that does a a schema synchronization (merge of new object, modifies existing ones) and can detect and prevent data loss during deployment. By contrast, the 'classical' way of doing it (from VS Server eExplorer, or from SSMS) the deliverable was the MDF file itself, the database. This poses huge problems at deployment. The deployment of v1 is really smooth (just copy the MDF, done), but as soon as you want to release v1.1 you're stuck: you have a new MDF, but the production is running on its own MDF and does not want to replace it with yours, since it means data loss. Now you turn around and wish you have some sort of database schema version deployment story, and this is what VSTS DB does for you from day 0.

这篇关于Visual Studio 2010中的数据库设计器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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