简体   繁体   English

我的Visual Studio 2012中不存在LINQ to SQL

[英]LINQ to SQL doesn't exist in my visual studio 2012

I am learning about how to add a data access layer to my project. 我正在学习如何在项目中添加数据访问层。

I found this tutorial http://msdn.microsoft.com/en-us/library/bb470374.ASPX : 我发现本教程http://msdn.microsoft.com/en-us/library/bb470374.ASPX

  1. Right-click the App_Code folder and then click Add New Item. 用鼠标右键单击App_Code文件夹,然后单击添加新项。 The Add New Item dialog box is displayed. 系统弹出“添加新项”对话框。

  2. Under Visual Studio installed templates, select the LINQ to SQL Classes template and rename the file Tasks.dbml. 在Visual Studio安装的模板下,选择LINQ to SQL Classes模板,然后重命名文件Tasks.dbml。

  3. Click Add. 单击添加。

but when I right click I see this: 但是当我右键单击时,我会看到:

在此处输入图片说明

there is no Visual Studio installed templates nor LINQ to SQL Classes 没有Visual Studio installed templates也没有LINQ to SQL Classes

Under VS2102, in your solution explorer, right click on your project, and select "Add/New Element" (something like this, my VS version is in french..) 在VS2102下,在您的解决方案资源管理器中,右键单击您的项目,然后选择“添加/新元素”(类似这样,我的VS版本是法语。)

Then you might find : C# -> Data -> "Linq to Sql classes" (depending on your Visual studio version i guess) or you can select "Entity Data Model", An assistant should appear to guide you through the rest of the process. 然后,您可能会发现:C#->数据->“ Linq到Sql类”(我想取决于您的Visual Studio版本),或者您可以选择“实体数据模型”,然后会出现一个助手来指导您完成其余的过程。

In your project classes you should then use your dataModel, and use Linq to make your requests. 然后,在项目类中,应使用dataModel,并使用Linq发出请求。

I don't have everything in mind right now, you should check that tutorial : http://msdn.microsoft.com/en-US/en-en/library/vstudio/bb399182(v=vs.100).aspx 我目前尚无所有想法,您应该检查该教程: http : //msdn.microsoft.com/zh-CN/en-en/library/vstudio/bb399182(v=vs.100).aspx

Hint: the generated model has a partial class for all your table fields, this is usefull for creating another class of the same name to add specific functions, or fields ;) 提示:生成的模型对您所有的表字段都有一个局部类,这对于创建另一个具有相同名称的类以添加特定的功能或字段很有用;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM