[英]How to make Visual Studio automatically retrieve database changes from SQL Server?
So, I made a database in SQL Server Express 2014. After that, from Visual Studio 2015 Community, I make a new project, and then I add new data source, and then choosing Database, and then Dataset, and then choosing all tables and views in the database. 因此,我在SQL Server Express 2014中创建了一个数据库。此后,在Visual Studio 2015社区中,创建了一个新项目,然后添加了新的数据源,然后依次选择“数据库”,“数据集”,所有表和数据库中的视图。
The problem is, after I made some changes to the database from the SQL Server (either changing a column name, or column data type, or manually adding some data for testing), the changes are not pushed back to my project in Visual Studio, it also says error table name from the renamed Column Name. 问题是,在我从SQL Server对数据库进行了一些更改(更改列名称或列数据类型,或手动添加一些数据以进行测试)之后,这些更改没有被推回到Visual Studio中的项目中,它还从重命名的列名中说出错误表名。
Any idea how to automatically set the changes made in SQL Server to the Visual Studio side? 知道如何将SQL Server中所做的更改自动设置到Visual Studio端吗?
DataSets in .NET do not automatically sync their schemas with SQL, so changes made in SQL will not be reflected in Visual Studio. .NET中的数据集不会自动将其架构与SQL同步,因此在SQL中所做的更改不会反映在Visual Studio中。 To see the changes in Visual Studio you need to:
要查看Visual Studio中的更改,您需要:
That's obviously a nuisance to do, so you could use Entity Framework to automate this process. 显然这很麻烦,因此您可以使用Entity Framework来自动执行此过程。
Entity Framework allows you to work in a few different ways: 实体框架允许您以几种不同的方式工作:
This is the official site for Entity Framework. 这是 Entity Framework 的官方网站 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.