Using Linq to SQL in asp.net 5 MVC 6

萝らか妹 提交于 2019-12-10 22:46:59

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!