3

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.

Now, i want how can i make relation between My DataProject and 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!! i want to know is there anyway to make model in DataProject from SQLDatabaseProject? 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:

TestSolution

  • SQLDatabaseProject
  • 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 ...!!?

7
  • Do you means that you wanna do changes in project DataProject, and effect to the SQL DataProject either? Commented Jul 16, 2013 at 2:06
  • @Eugene tanx for check my question, no.. contrary of you said, i want do changes in SQLDatabase Project and effect to DataProject. Commented Jul 16, 2013 at 10:51
  • if I understand you correct you want to update the DataProject model based on SQLDatabaseProject if yes you only need to change the connection string from the ADO.net Data Model from DataProject to point to SQLDatabseProject. Commented Jul 18, 2013 at 14:35
  • @Pedro.The.Kid, tanQ for comment, yes, you understood great. but what should i set connection string of ado.net data model? i searched in google but i cant find some example of connection string to sql server project..!!?? Commented Jul 19, 2013 at 20:30
  • To set the ADO.net Connection string you go to the edmx model right click in an empty area and select properties. NOTE: this is just the EDMX connection string when you run the program it uses the one in your .config file. Commented Jul 23, 2013 at 10:34

1 Answer 1

2
+25

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. 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). When you're happy with the changes made to the model database (which should be empty), then publish the changes to the dev database.

Sign up to request clarification or add additional context in comments.

3 Comments

tanx for answer to my question,i really need a good answer, i know about T4 or changing model and commit changes in dev db and i know about features, Capabilities or .. of model and sql project, i used both of these projects before but my problem is relation between 2 projects without real db .. i want make changes in sql project and then my model update it from sql project without db, check my question!! i want to know about making relation between these projects not another application like real sql server database or exporting/importing db, if you know something more or my mistakes plz tell
Well then in that case you only have my option 1. If I were you, I would then use T4. In a T4 file you can scan through the project and look for the table scripts. From that you create your objects and a data repository.
tanx, i give you upvote for answer and comment, but do you have more details for how could i do this and how can i make T4 script for detect changes in sql server project and fix my model?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.