C#哪里dbml的文件从何而来? [英] C# where does the dbml file come from?

查看:1194
本文介绍了C#哪里dbml的文件从何而来?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在学习C#和LINQ。我有很多关于他们的问题。基本上,我需要一步步的教程。




  1. 我想在 DBML 文件是数据库的配置文件。如果我双击 DBML VS文件将在设计图中打开它。我可以创建/删除/修改此处表?我可以使用添加新项目添加 LINQ to SQL类获得的dbml 文件?


  2. 接下来是什么?生成数据库表?生成SQL脚本?生成CS文件?什么时候?怎么样?



解决方案

该DBML文件没有在相关的数据库服务器所有。这是一个完全客户端的东西。它本质上是一组有关数据库中的表和如何你将它们映射到.NET对象的信息。



当然,你也可以从数据库中拖动一个表,并具有Visual Studio自动推断出一些信息给你,但改变​​的文件,不会影响数据库。您可以从头开始创建一个DBML文件,而无需任何数据库了。



在内部,DBML文件很简单,是由Visual Studio送入一个自定义工具,并生成一个XML文件代表从它的数据库中的LINQ对象模型的.cs 文件。


I am currently learning C# and LINQ. I have lots of questions about them. Basically, I need a step by step tutorial.

  1. I suppose the dbml file is the configuration file of the database. If I double click the dbml file VS will open it in a design diagram. Can I create/delete/modify tables here? I can use add new item to add the LINQ to SQL Classes to get a dbml file?

  2. What's next? Generate tables in database? Generate SQL script? Generate cs files? When? How?

解决方案

The DBML file is not related to the database server at all. It's a completely client side thing. It's essentially a set of information about your tables in the database and how you're going to map them to .NET objects.

Of course, you can drag a table from a database and have Visual Studio infer some information for you automatically, but changing the file will not affect the database. You can create a DBML file from scratch without any database too.

Internally, the DBML file is simply an XML file that's fed into a custom tool by Visual Studio and generates .cs files representing the LINQ object model for your database from it.

这篇关于C#哪里dbml的文件从何而来?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆