3

Can I use Linq to SQL in asp.net 5 mvc 6?

There is no "Linq to SQL Classes" in "Add New Item" form enter image description here

I know its not supported in dot net core 5 but I don't need dnx core 5 and cross platform feature. I'm ok with dnx core 4.5.1

How can I add Linq to SQL Classes file (.dbml) to MVC 6 Project?

2
  • 1
    There is no error. I just can't find "Linq to SQL Classes" in "Add New Item Page". What is wrong? Screenshot added. Commented Nov 4, 2015 at 12:23
  • 1
    Probably because LINQ to SQL has been depricated ages ago. You will need to look into using Entity Framework going forwards, if you want to use a Microsoft supported ORM. Is LINQ to SQL deprecated? Commented Nov 4, 2015 at 12:31

2 Answers 2

5

To add Linq To SQL Classes file, you have to add Class Library project to your solution. Now you can add Linq to SQL Classes (.dbml file) to this project.

Then add reference to this Class Library from your main project.

NOTE: you can not use dnxcore 5 in this way. Your main project should use dnx 4.5.1 and class library should use dotNet framework 4.5.1 as target framework.

Using linq to SQL in asp.net 5 mvc 6

Sign up to request clarification or add additional context in comments.

Comments

3

To solve this problem, in VS just go to Tools - Get tools and features - Individual components - Select LINQ to SQL tools and then click on Modify.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.