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

  • Home
  • SEARCH
  • 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 913709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:36:14+00:00 2026-05-15T17:36:14+00:00

I’m sure most people who use the entity framework sometimes need an entity only

  • 0

I’m sure most people who use the entity framework sometimes need an entity only for some business operations without it actually ever getting persisted to the database. For example, an online shop checkout wizard where you want to fill the customer and address info, but only persist it once the customer is at the end of the wizard and actually buys the product. There could be other things that I would like to save in the meantime, so I can’t have my user object attached to the context, because then it will be saved as well.

Generally I use a unit of work pattern, so my context lifetime is short. The entity would have to exist between different context instances.

These are some of the possibilities I thought of so far:

  • Use detached entities in-memory (session state) and attach them when you want to save them.
  • Just save them anyway and later delete them when they turn out to be unwanted data.
  • Use separate non-EF classes for this and convert to EF when you want to save.

Any other possibilities?
Thanks for your insights.

  • 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-05-15T17:36:14+00:00Added an answer on May 15, 2026 at 5:36 pm

    I would suggest either approach 1 or 3, depending on the rest of your architecture.

    If you use EF with POCOs, this really isn’t a problem – however, if you use the generated entity classes, you might have another problem: do you map them into POCOs before sending them to the UI layer?
    If not, you should change that. Take a look at for example AutoMapper, which will make the mapping process smooth and simple.

    The reason I’m pointing you in this direction, is that if you have EF Entities tightly coupled to your business and/or UI layers and later on want to switch EF to something else, you have a lot more work ahead of you than if you have proper mappings.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.