我的visual studio 2012中不存在LINQ to SQL

时间:2022-12-31 09:01:52

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. The Add New Item dialog box is displayed.

    右键单击App_Code文件夹,然后单击“添加新项”。将显示“添加新项”对话框。

  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:

但当我右键点击时,我看到了这个:

我的visual studio 2012中不存在LINQ to SQL

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

没有安装Visual Studio的模板,也没有LINQ to SQL类

1 个解决方案

#1


3  

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 to Sql classes”(取决于你猜测的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/en-US/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 ;)

提示:生成的模型具有所有表字段的部分类,这对于创建另一个具有相同名称的类来添加特定函数或字段非常有用;)

#1


3  

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 to Sql classes”(取决于你猜测的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/en-US/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 ;)

提示:生成的模型具有所有表字段的部分类,这对于创建另一个具有相同名称的类来添加特定函数或字段非常有用;)