Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8625241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:44:04+00:00 2026-06-12T07:44:04+00:00

In Entity Framework 5 model first, there seem to be some breaking changes due

  • 0

In Entity Framework 5 model first, there seem to be some breaking changes due to the way the class files are generated (No more code generation, but T4 templates)

2 examples:

  • The generated context file doesn’t implement IDisposable anymore
  • There isn’t a constructor which takes a connectionstring anymore

Are there more breaking changes? And what is the solution to them?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:44:05+00:00Added an answer on June 12, 2026 at 7:44 am

    The default code generated from a model in Entity Framework 5 now inherits DbContext instead of ObjectContext.

    This still implements IDisposable, but if you’re getting an error from a line of code similar to this:

    using (var mymodel = new MyModelContext()) { ... }
    

    …complaining about not implementing IDisposable, then your problem is most likely that your model is defined in a separate assembly that references EF5 and you have not added an EF5 reference to your project.

    As Ladislav Mrnka has already mentioned in his answer, if you want to pass a connection string to the constructor you have to create your own constructor manually to do this.

    If you want to switch Entity Framework back to the older style of generated code, which will automatically generate the constructor you’re looking for, then follow these steps:

    1. Click on the designer surface of your EDMX file, and look at the properties window. Find a property called “Code Generation Strategy” and set this to “Default” instead of “None”. This will tell Visual Studio to start creating the code for your object model in MyModel.Designer.cs in one big file, this time using ObjectContext instead of DbContext.
    2. Delete the following sub files from below your EDMX file: MyModel.Context.tt, MyModel.tt. These are the auto generated files that you don’t want anymore. If you don’t delete them you’ll get class naming conflicts because your objects will be created twice.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's sample model classes, which being use with Entity Framework Code First: public class
I'm trying to make some changes to our Entity Framework model, which is causing
i use Entity Framework 5.0 by Model First. In 4.x there is a bug:
I am getting started with Entity Framework 4, using model-first development. I am building
I am creating a new database model using Entity Framework 4.3 Code-FIrst; using Fluent
We have an entity framework model with has some inheritance in it. The following
Is there any tool to generate CRUD admin site from Entity Framework Model? Something
When using the Entity Framework there are basically two ways to create your model.
I'm using Entity Framework 4. I am using a database first model, meaning that
I am working with Entity Framework Code first. I have a simple model: public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.