1

Recently I've been trying out the new .Net 4.0 toolchains for Visual Studio 2010, and the new Nuget Package Manager. I've played with MVC3 a fair bit, and tried out the MVCScaffolding package, and was pretty impressed. To close the loop, I decided to check out Entity Framework 4 to really get into the rapid prototyping funness.

Alas, I am not able to create a simple model with EF4, and successfully generate a usable scaffold from that structure.

The structure I have scoped down to at this point is an entity "Cake", with a primary key Id and a string FrostingColor. After generating the sql and deploying it to the database, I generated the scaffold with MVCScaffolding.

Then, I compile and run, and attempt to visit my site/Cakes/Index page. I receive the server error:

The type 'MvcApplication1.Models.Cake' is not a supported entity type.

I've spent a while googling for others with this problem, but can't make heads or tails of it. Has anyone tried this, or happens to know what might be causing it?

Thanks!

1

2 Answers 2

2

Have a look at the MVC Music Store Tutorial. It uses EF CodeFirst and MVC3. You can also take a look at MVC Scaffolding: Standard Usage

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the links. They are both better than the slightly less detailed tutorials I had been following.
1

As best as I can understand at this point - the generated classes from the edmx cannot be used as an entity. After installing the ADO.NET C# POCO Entity Generator and generating the appropriate POCO class for my "cake" entity, everything seems to work fine. I'm still baffled by why the partial classes inheriting from "entityobject" can't be used as an entity, but at least have a workable solution to generate a quick prototype from a given database model.

Relevant Resources:

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.