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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:25:25+00:00 2026-06-11T17:25:25+00:00

Maybe i’m already doing this in the ideal way but somehow it does not

  • 0

Maybe i’m already doing this in the “ideal” way but somehow it does not feel right to me.

I’ve got a search form which after finding the result instantly display the information over different controls (of which three are datagrids bound to eachother).

Currently i’ve set my UoW management up as following:

  • When ever a users starts a search check if we had an old UoW and dispose it (and it’s session)
  • Create a new UoW
  • Begin transactions
  • Perform search
  • Commit transaction

Code example:

if(_unitOfWork != null)
{
    _unitOfWork.Dispose();
}

_unitOfWork = new UnitOfWork();

_unitOfWork.Begin();
ICollection<Case> cases = casesQuery.ToList();
_unitOfWork.Commit();

iDeally i’d like all objects to be databound at this point, and after the databinding is completed i’d like to dispose of the UoW.

Sadly, i can’t do this because of the lazy loading beeing done to databind two of the three datagrids. Explicitly loading the collections & object graphs in these entities is not really an option due to the fact some of these entities are subclasses with different properties & references. Explicitly loading those seems like to much work.

What i’d like to know is if there is a way to make this nicer, i’ve considered the following:

  • Use a Converter to get the value beeing databound, findout if it’s a proxy and if so load this proxy. This would mean i’d have to set a converter to every databound property which again seems inefficient
  • Explicitly loading, reasons for not doing this are mentioned above
  • My current solution, make the UoW span the “search”, biggest issue with this is that i cannot keep a transaction open while stuff is beeing lazy loaded. (I could but that seems like a VERY bad thing to do due to the fact a user can keep that transaction open indefinatly)

Does anyone have a better way to handle this situation or is what i’m doing currently the best thing possible?

  • 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-11T17:25:26+00:00Added an answer on June 11, 2026 at 5:25 pm

    In MVVM apps, the most common pattern is to have a session per VM. This enables lazy loading and rich client change tracking without much additional effort.

    There’s nothing wrong with the current approach. Not being able to do lazy loading inside a transaction is not that big of a deal.

    Now, explicit loading doesn’t look like “too much work” if you can create a reflection-based solution. But you still need to know what to load. In any case, it’s a lot less work than the converters idea.

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

Sidebar

Related Questions

Maybe I'm going about this the wrong way, but I'll lay out the process
Maybe this question should be easy, but it is not. I have read Problem
Maybe not really big, but a hundred frames or something. Is the only way
Maybe there is a package to do this, but I have not been able
Maybe I'm just going about this the wrong way, but I'm trying to have
Maybe this is a very simple question, but I just can not figure out.
Maybe I'm not using the right key words, but all my searches are coming
Maybe the title is not so clear, but this is what I'm experiencing: I
Maybe this is a dumb question, but is there any way to convert a
Maybe this has already been answered and I am searching incorrectly, but here is

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.