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 8631167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:10:52+00:00 2026-06-12T09:10:52+00:00

If I have two distinct methods – one deletes a user and another deletes

  • 0

If I have two distinct methods – one deletes a user and another deletes the user’s address (for argument’s sake, let’s assume they have to be deleted and cannot be set to inactive). If each method creates a repository of that type in order to delete the record, is it considered good practice to create an ObjectContext in the first method and then pass it to the other? If so, should it be passed by value, or reference? What issues or problems can arise from doing this?

  • 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-12T09:10:53+00:00Added an answer on June 12, 2026 at 9:10 am

    Yes it is a valid approach. The pattern of sharing one context to act on several repositories to accomplish a specific use case is referred to as the Unit of Work pattern.

    http://blogs.msdn.com/b/adonet/archive/2009/06/16/using-repository-and-unit-of-work-patterns-with-entity-framework-4-0.aspx

    http://joel.net/repository-and-unit-of-work-for-entity-framework-ef4-for-unit-testing

    Note that you must share a context if you require transactional integrity. If you used separate contexts, and your second delete failed, you would have no way to roll back the first delete.

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

Sidebar

Related Questions

I have two distinct scenarios. One, where there is a many to many case,
Let's say I have two different, distinct stack panels (we'll call them SPA and
I have two distinct (no inheritance) interfaces: IInvestable and IPricable and two classes: IndexClass
I have a clojure/ring project that has two distinct app/handlers running on different ports
I have this little problem. My client wanted two distinct swf on a web
I have these two queries to test my output SELECT DISTINCT( providerId ), SUM((
Have two actionsheet buttons and one modalviewcontroller on mainviewcontroller in application. Now for two
I have two classes (MVC view model) which inherits from one abstract base class.
I have one page with two dropdownlists with different IDs and in my codebehind
I have the following construct in EJB-QL several EJB 2.1 finder methods: SELECT distinct

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.