[RESOLVED]Saffolding Problem

I am currently trying to complete an MVC3 project called Music Store which is free online. I reached a scaffolding part and I am unable to proceed past this problem. When I try to create a a scaffold I receive a message 

Unable to retrieve metadata for ‘MVCMusicStore.Models.Album’. Unable to cast object of type ‘System.Data.Entity.Core.Objects.ObjectContext’ to type ‘System.Data.Objects.ObjectContext’

I just don’t know what to do to get past this point. Any help would be appreciated

Hi 05beckga,

Thanks for your post.

According to your description,

05beckga

Unable to retrieve metadata for ‘MVCMusicStore.Models.Album’. Unable to cast object of type ‘System.Data.Entity.Core.Objects.ObjectContext’ to type ‘System.Data.Objects.ObjectContext’

Try comment out your connection string and use default when create controller,after creation return your connection string.

Hope this can be helpful.

Best Regards,

Eileen

Hello!

Commenting connections string or replacing it by any default one did no fix the same issue in my case.

So i uninstalled EF 6 and EF for SQLserverCE 4.0( donno why i installed it at all), Then i installed EF 5 and got it work. By the way EF 4 can be found in MusicStore package. I also cleaned up my web.config but it is another story…

Good luck!

Leave a Reply