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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:22:51+00:00 2026-05-15T08:22:51+00:00

I want to track a list of root objects which are not contained by

  • 0

I want to track a list of root objects which are not contained by any element. I want the following pseudo code to work:

using (session1 = [...]) {
  IList<FavoriteItem>list = session1.Linq<FavoriteItem>().ToList();
}

list.Add(item1);
list.Add(item2);
list.Remove(item3);
list.Remove(item4);
var item5 = list.First(i => i.Name = "Foo");
item5.Name = "Bar";

using (session2 = [...]) {
  session2.Save(list);
}

This should automatically insert item1 and item2, delete item3 and item3 and update item5 (i.e. I don’t want to call sesssion.SaveOrUpdate() for all items separately.

Is it possible to define a pseudo entity that is not associated with a table? For example I want to define the class Favorites and map 2 collection properties of it and than I want to write code like this:

using (session1 = [...]) {
   var favs = session1.Linq<Favorites>();
}
favs.FavoriteColors.Add(new FavoriteColor(...));
favs.FavoriteMovies.Add(new FavoriteMovie(...));

 using (session2 = [...]) {
  session.SaveOrUpdate(favs);  
}

FavoriteColors and FavoriteMovies are the only properties of the Favorites class and are of type IList and IList. I do only want to persist the these two collection properties but not the Favorites class.

Actually I want a IPersistentCollection object that tracks adds and removes that belongs to no parent entity and stands for itself (the same stuff that happens to collection properties of entities, only in my case I have no parent entity). This works perfectly well if the collections belong to an entity in which case I can add and remove items between two sessions.

Any help is much appreciated.

  • 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-15T08:22:51+00:00Added an answer on May 15, 2026 at 8:22 am

    I still have not found a real solution to this problem. My work around so far is that I have added the collection as a child collection property to another entity from which only one instance exists so far. But this solution breaks if there will be more instances of this entity and it has the disadvantage that the version of it is incremented every time a item is added or removed.

    The other work around would have been to create a pseudo entity with no properties/columns (except an ID).

    The third alternative I could think of is recreating the whole collection every time which is quite slow and does not work if other entities are referencing one of the items.

    The last alternative would be to reimplement the dirty checking functionality myself but this would add some complexity and code duplication.

    If somebody knows better alternatives I would be glad for any comments.

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

Sidebar

Related Questions

I want to put track numbering in my views.List, is there any option for
I am storing Integer objects representing an index of objects I want to track.
I'm building a chatroom application, and I want to keep track of which users
When querying for a object by id or returning a list of objects using
I have a my custom collection derived from List(.MyItem.) I want to trace if
I have a list of artists, albums and tracks that I want to sort
We want to track the time taken by a web service call between a
I want to track incoming traffic to a website from campaigns. A campain link
I want to track a person's movement on mapview in my iphone. I am
i have a table where i want to track time so a valid entry

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.