سؤال

I have a team working on a project. For the purpose of collaboration we are using Team Foundation Server.

Now we want to create a shared database so that each team member can connect to the database, manipulate it, and retrieve data.

I've already created a SQL Database Project and I've added it to TFS but I don't know how to connect to it from my code ?

هل كانت مفيدة؟

المحلول

The SQL Database Project is just a representation of the database schema and objects. It isn't a database that you "connect to".

Instead you will need a SQL server running somewhere. You might decide to run it locally on each of your dev machines or have a common server that everyone accesses. Either way, a regular SQL server needs to be installed somewhere.

نصائح أخرى

This doesn't have anything to do with TFS. This is just a Visual Studio project like any other.

What exactly do you mean by "connect to it from my code"? .NET code doesn't directly interact with a database project, but can form a data access layer to interact with a database.

If you right-click on the database project in Visual Studio, there is an option to deploy (or perhaps publish, depending on the Visual Studio version). You can deploy the database project to a live database and then your .NET code can interact with that database.

This can be multiple databases. For example, your automated builds can deploy to a shared database for everyone to use, and individual developers can deploy to their local workstations for development and debugging purposes.

The Sql Database project is not a database in itself - it is a project that describes a database. You need to deploy that project (typically to an instance of Sql Server) in order to connect to it in the way you describe.

In a typical team development environment, each member of your team might have their own local instance of Sql Server, and deploy the project to it. In this way, your team members won't get in eachother's way as they create and delete data during the course of development. You will possibly also want a shared instance for a more formal testing environment.

So ultimately, what you've created is not a shared database: it's a template that a database can be created from.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top