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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:06:19+00:00 2026-05-12T15:06:19+00:00

Question: How do I preserve dirtiness of SubSonic objects when they are sent back

  • 0

Question: How do I preserve “dirtiness” of SubSonic objects when they are sent back and forth across a Windows Communication Foundation service?

To wit:

I have a WCF service call that returns a collection of SubSonic (2.2) objects, like so:

// WCF server side
public MyObjectCollection GetAllMyObjects()
{
   // Retrieve a MyObjectCollection (SubSonic-generated class) from the DB
   return DB.Select().From<MyObject>.ExecuteAsCollection<MyObjectCollection>();
}

and another that lets the client save them:

// WCF server side
public void SaveAllMyObjects(MyObjectCollection objs)
{
   objs.SaveAll();
}

On the WCF client side, I retrieve this collection (via the generated WCF proxy), I modify some of its members, then I save it:

// WCF client side
MyObject[] allObjects = myWcfClient.GetAllMyObjects();
allObjects[3].SomeProperty = "Some other value";
myWcfClient.SaveAllMyObjects(allObjects);

What happens, however, is that the SubSonic “objs.SaveAll()” call does not save anything, as it does not “realize” that objs[3] has been modified, i.e. nobody has flipped the “dirty” bit on that column.

Is this an anti-pattern I’m implementing, or is this a sensible way of doing things? If so, how can I convince SubSonic to mark my objects as dirty when they go across the WCF wire?

  • 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-12T15:06:19+00:00Added an answer on May 12, 2026 at 3:06 pm

    I have found a solution, but it feels hacky, and it would be great for it to be vetted by someone who knows more about SubSonic than I. The idea is that in the server-side code that saves MyObjectCollection I’d create as many new MyObject instances as were passed in, set the correct primary key, fake SubSonic into believing they were just loaded from the DB, populate the new objects from the old ones, then save the new collection. So the method above looks like this:

    // WCF server side
    public void SaveAllMyObjects(MyObjectCollection objs)
    {
       MyObjectCollection fakeColl = new MyObjectCollection();
       foreach (var oneObj in objs)
       {
           var oneFakeObj = new MyObject();
           oneFakeObj.Id = oneObj.Id;    // Primary key
           // Pretend oneFakeObj was just loaded from the DB
           oneFakeObj.IsNew = False;
           oneFakeObj.IsLoaded = True;
           // Copy all column values
           foreach (var col in MyObject.Schema.Columns)
           {
               oneFakeObj.SetColumnValue(col.ColumnName, oneObj.GetColumnValue(col.ColumnName));
           }
           fakeColl.Add(oneFakeObj);
      }
      fakeColl.SaveAll();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My question involves this simple walkthrough shown in the article Preserve Size and Location
My question is on how to preserve data during the redirect when using the
I'd like to preserve the back button functionality when loading pages via AJAX (jQuery
I recently came across a Microsoft Interview Question for Software Engineer. Given an array
There is a simlar question in Preserve ls colouring after grep’ing but it annoys
Just a question of curiosity. When i preserve object refernces while serializing an object
This is my edited previous question for line breaks before the preserve space elements.
Question Is it possible to stop a Message Driven Bean (programmatically), so that it
Question context: let say that there is some really important row in config/locales/en.yml that
Question from Object-Oriented JavaScript book: Imagine Array() doesn't exist and the array literal notation

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.