问题
Can I use Linq to SQL in asp.net 5 mvc 6?
There is no "Linq to SQL Classes" in "Add New Item" form
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?
回答1:
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.
来源:https://stackoverflow.com/questions/33516188/using-linq-to-sql-in-asp-net-5-mvc-6