[英]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 DataProject和SQLDatabaseProject之间建立关系?
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
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.