1

I have a project that is using Entity Framework Code First but with an Existing Database. So far I have been creating the class for each existing table accordingly and it's all worked out great. What would be brilliant is if there was some way to quickly generate a table to a class to save time on manually coding each class, any ideas? I want to stay with Code First so please don't suggest alternatives, thanks.

2
  • So you want to use code first but generate your code? Seems like a chicken/egg problem. Commented Mar 9, 2013 at 23:07
  • I want to use Entity Framework but code only. Everywhere I look online defines this as "Entity Framework Code First with an Existing Database". Commented Mar 9, 2013 at 23:16

1 Answer 1

1

You can use EF database first - that will generate .cs classes you can use as a base. Just copy the CS code and then delete the EF database first stuff.

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

2 Comments

As in create a seperate project to generate a one off set of classes, that does seem quite a simple and easy solution. Can you generate the class one table at a time with Database First or do you have to do all?
Sure you can do one table at a time or select them all to get it done with. The GUI with EF is extremely easy to use. You don't have to make it in another project - but that will keep your configs clean.

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.