Reputation: 6766
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??
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.
Upvotes: 3
Views: 3651
Reputation: 5262
Duplicate here, however I've tried to add more step by step instructions so that it could help you and others.
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.
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
Configure your LINQ to SQL.
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": {
}
},
Still in your main asp.net-5 solution, right click on References > Add Reference.
Add the Class Library reference.
I hope this helps.
Upvotes: 4