简体   繁体   English

如何在Visual Studio中的其他项目中使用SQL Server数据库项目?

[英]How to use SQL Server Database Project in other Projects in Visual Studio?

Always in my projects i add a ADO.net Data Model (from database connection) to my Data Access Layer Project that i named it DataProject , but now i need to use SQL Server Databse project that i named it SQLDatabaseProject . 总是在我的项目中,我将ADO.net数据模型 (从数据库连接)添加到我将其命名为DataProject的 数据访问层项目 ,但现在我需要使用SQL Server Databse项目 ,我将其命名为SQLDatabaseProject

Now, i want how can i make relation between My DataProject and SQLDatabaseProject ? 现在,我想如何在My DataProjectSQLDatabaseProject之间建立关系?

I mean as my old way adding "ADO.net Data Model" from database connection to DataProject and separately i can deploy db or change tables in SQLDatabaseProject!! 我的意思是我从旧的方式将数据库连接中的“ADO.net数据模型”添加到DataProject,并且我可以单独部署db或更改SQLDatabaseProject中的表! i want to know is there anyway to make model in DataProject from SQLDatabaseProject? 我想知道有没有从SQLDatabaseProject在DataProject中制作模型? not from my old way? 不是从我的旧方式?

for more details i used Visual Studio 2012 and i used C# with .net 4.5 and my projects in my solution is like this: 有关更多详细信息,我使用Visual Studio 2012,我使用C#和.net 4.5,我的解决方案中的项目是这样的:

TestSolution TestSolution

  • SQLDatabaseProject SQLDatabaseProject
  • DataProject DataProject

and i added reference from SQLDatabaseProject in DataProject but i cant see any namespace of data or something else when i want to create model or ...!!? 我在DataProject中添加了SQLDatabaseProject的引用,但是当我想创建模型或者......时,我无法看到任何数据库命名空间或其他东西。

There are two ways you can do this: 1) You can use T4 templates to generate code for you from the scripts you have in the database project. 有两种方法可以做到这一点:1)您可以使用T4模板从数据库项目中的脚本为您生成代码。 2) Have a model and dev database on your machine and then simply do the db changes on model and update those changes on your database project and (Eg. Entity Framework). 2)在您的机器上安装模型和开发数据库,​​然后简单地对模型进行数据库更改并更新数据库项目上的更改(例如,实体框架)。 When you're happy with the changes made to the model database (which should be empty), then publish the changes to the dev database. 如果对模型数据库所做的更改(应为空)感到满意,则将更改发布到dev数据库。

暂无
暂无

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

相关问题 如何复制Visual Studio 2010项目以在其他系统中使用? - How to copy Visual studio 2010 projects to use in other system? 从 Visual Studio 2013 数据库项目中清理 SQL Server 数据库 - Clean SQL Server database from Visual Studio 2013 database project 我是否必须在 Visual Studio 中连接 SQL 服务器数据库才能在 C# 项目中使用它? - Do I have to connect a SQL Server database in Visual Studio to use it in C# project? Visual Studio - SQL Server 数据库项目的连接字符串 - Visual Studio - Connection String for SQL Server Database Project 如何将我的 Microsoft SQL Server 2016 数据库附加到 Visual Studio 2015 中的 installshield 项目? - How to attach my Microsoft SQL Server 2016 database to installshield project in Visual Studio 2015? 如何在Visual Studio 2010中使用我的设置和部署项目部署SQL Server数据库? - How can I deploy the SQL server database with my setup and deployment project in Visual Studio 2010? 如何在Visual Studio(C#)中将ASP.NET项目与SQL Server数据库表连接 - How to connect ASP.NET project with SQL Server database table in Visual Studio (C#) 如何在SQL Server Management Studio中使用Visual Studio创建连接数据库? - How connect database created in SQL Server Management Studio with Visual Studio? Visual Studio 2012无法构建引用其他项目的新项目 - Visual Studio 2012 Fails To Build New Project That References Other Projects Visual Studio项目无法解析添加为外部对象的其他项目的符号 - Visual Studio project cannot resolve symbols of other projects added as externals
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM