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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:54:36+00:00 2026-06-09T18:54:36+00:00

I have two Classes public class Notification { public virtual Guid ID { get;

  • 0

I have two Classes

public class Notification
{
    public virtual Guid ID { get; set; }
    public virtual IEnumerable<Message> Messages {get;set;}
}

public class Message
{
    public virtual Guid ID { get; set; }
    public virtual string Message { get; set; }
}

I have two .ascx controls on my page and one invokes a Bind on the other through a public method. Now if I add a row to the Message List and then run my bind method that simply Gets a notification by ID and returns messages. I dont get the newly added message. I must refresh the page again before it gets this data.

Is there something about the IEnumerable caching or how do I force it to go back to the Database I run Session.Get<> but it does not have the effect I want.

I have also tried

Session.Evict
Session.Refresh

  • 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-09T18:54:38+00:00Added an answer on June 9, 2026 at 6:54 pm

    Please check the Q and A posted below, I think their case is very similar to yours. Maybe by simply changing he way you are handling your collections

    Reload association/related collection in NHibernate
    What's the best way to refresh entities in nhibernate
    https://forum.hibernate.org/viewtopic.php?f=1&t=968923

    The main problem is that the NH doesn’t have a “collection” notion. All it is about is handling objects and maping them to tables. If you follow a relation, NH generates a query, downloads list of objects, thinks it has done and is happy about that. You get a collection of Objects that were returned by query. To re-read the collection you actually have to re-run the query. This is what Queries and Criteria are about: to prepare something that you can reuse for refreshing your collections. Refreshing – by re-fetching them from DB.

    IIRC, the NH tracks objects. This means that if a first run of the query returned objects A,B,C and put them in a List<>, then the hext run returned A,C,D,E and returned them in some other List<>, then the objects A anc C will be all the same objects as in the first time. There will be no object-cloning unless you use different NH sessions. Of course it is up to you to take care of both List<> – that is, you have to decide how to merge them in to one thing shown to the user. usually you will want to wither drop the first and use only the most fresh one to indicate instantly that ‘B’ as removed, or to merge them both pretending that ‘B’ was never removed and silently patching that on the commit.

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

Sidebar

Related Questions

I have two classes: public class RichMan { public string ID {get;set;} List<Car> _cars=new
I have two classes: public class Foo { public int FooId {get;set;} public virtual
I have two classes: public class Artikel { int id{get;set;}; string name{get;set;}; } public
I have two classes: public class DocumentViewModel { public virtual string DocumentNumber { get;
I have two classes, public class BookItem { public string BookID { get; set;
I have two classes: public class MultilingualString { public int Id { get; set;
I have two classes: public class TestClass1 { public int TestInt { get; set;
I have two following classes: public class User { public virtual Guid Id {
I have two classes: public class Parent { public virtual long? ID { get;
I have two classes: public class Person { public string FirstName { get {

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.