ASP.NET 5缺少Linq到SQL类 [英] Asp.Net 5 missing Linq to Sql class

查看:77
本文介绍了ASP.NET 5缺少Linq到SQL类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在带有Mvc 6的Microsoft Asp.Net 5中将Linq添加到Sql文件中. 请参见下面的屏幕截图.没有办法可以找到此Linq to Sql文件. 侧面也没有C#标签?

How can I add a Linq to Sql file in Microsoft Asp.Net 5 with Mvc 6. see the screenshot below. There is no way where I can find this Linq to Sql file. As well there is no C# tab at the side??

当我使用Mvc 5在Asp.Net 4上打开项目时,会出现C#选项卡以及Linq to sql文件.

When I open the project on Asp.Net 4 with Mvc 5 there is this C# tab, as well as the Linq to sql file.

推荐答案

此处重复,但是我试图添加更多分步说明,以便对您和其他人有所帮助.

Duplicate here, however I've tried to add more step by step instructions so that it could help you and others.

右键单击src,然后单击添加">新项目".选择Class Libarary.请注意.NET Framework(我在此处使用4.6),因为您必须将其与主项目匹配.

Right click on src and Add > New Project. Select Class Libarary. Take note of the .NET Framework (I'm using 4.6 here), as you will have to match that with your main project.

类库应该出现在您的解决方案中.

The class library should appear in your solution.

右键单击类库(或您要使用Linq To Sql类的子文件夹),然后单击添加>新建项.在数据标签(左侧)中,该标签应包含LINQ to SQL Classes

Right click on the class library (or a sub folder where you want the Linq To Sql Classes), and Add > New Item. In the data tab (on the left), it should have the item LINQ to SQL Classes

配置LINQ to SQL.

Configure your LINQ to SQL.

在主要的asp.net-5 Web应用程序中,确保已设置project.json,以便它使用相同的.NET Framework 作为类库(请检查第一步).我在这里使用4.6.

In your main asp.net-5 web application, make sure your project.json is setup so that it's using the same .NET Framework as your Class Library (check first step). I'm using 4.6 here.

"frameworks": {
    "dnx46": {
    }
},

仍然在您的主要asp.net-5解决方案中,右键单击引用">添加引用".

Still in your main asp.net-5 solution, right click on References > Add Reference.

添加类库引用.

我希望这会有所帮助.

这篇关于ASP.NET 5缺少Linq到SQL类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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