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

arefinsami picture arefinsami · Sep 23, 2012 · Viewed 7.6k times · Source

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.

Answer

McGarnagle picture McGarnagle · Sep 24, 2012

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.)