Search code examples
asp.net-mvcasp.net-mvc-3linq-to-sqlasp.net-mvc-scaffolding

Error:'Unsupported context type' while creating a new controller


I am going to implement MvcMusicStore using ASP.NET MVC3, Linq to Sql class instead of Entity Framework, MS SQL Server 2008 pro instead of express ed.

I got the tutorial from mvcmusicstore.codeplex.com

I used Linq to Sql class and the Datacontext is MvcMusicSrotedataContext. When i try to create a new class using this

image

it shows an error in a new window when i click add button Error:'Unsupported context Type'

So, could you please help me to solve this? Thank You.


Solution

  • The built-in MVC scaffolding doesn't support Linq to SQL -- you'll have to use Entity Framework instead. (Or don't use the scaffolding, build your own controller/action logic manually. Or use a scaffolding plugin that supports Linq to SQL.)