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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:24:05+00:00 2026-05-23T04:24:05+00:00

I have a bit of a unique database structure but the query I’m attempting

  • 0

I have a bit of a unique database structure but the query I’m attempting to do isn’t too out of the ordinary, I think.

Basically, I create a new record. Then, I save this record, then I update a bit of XML and then update the record with the new XML. I’m having problems in that the second save doesn’t do anything.

    var applicant = new Applicant();
    applicant.XmlData = "";
applicant.Save(); //save once and initiate the record
    data.RecordRID = applicant.ApplicantRID;
    applicant.XmlData = data.SerializeToXml();
    var c=applicant.GetDirtyColumns().Count; //this returns a count of 0
    applicant.Save(); //save twice to populate RecordRID

Also, for reference, the XmlData property generated looks like this:

    public string XmlData
    {
        get { return _XmlData; }
        set
        {
            if(_XmlData!=value){
                _XmlData=value;
                var col=tbl.Columns.SingleOrDefault(x=>x.Name=="XmlData");
                if(col!=null){
                    if(!_dirtyColumns.Any(x=>x.Name==col.Name) && _isLoaded){ //_isLoaded is never set to true for either saves
                        _dirtyColumns.Add(col);
                    }
                }
                OnChanged();
            }
        }
    }

So.. What is the problem? Do I need to run a query and get the object from the database and then update it? or am I missing something?

Note: I have to save this twice because the ApplicantRID is a unique primary key. So I have to insert a record before I can know what it is

  • 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-23T04:24:06+00:00Added an answer on May 23, 2026 at 4:24 am

    I ended up modifying the T4 templates of SubSonic to fix this.

    In ActiveRecord.tt around line 466 under the function void Add(IDataProvider):

            var key=KeyValue();
            if(key==null){
                var newKey=_repo.Add(this,provider);
                this.SetKeyValue(newKey);
            }else{
                _repo.Add(this,provider);
            }
            SetIsNew(false);
            SetIsLoaded(true); //Added this line
            OnSaved();
    

    I have not noticed any weirdness from this change, and it seems like a bug that it wasn’t already in there as it is.

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

Sidebar

Related Questions

I have a bit of code that basically reads an XML document using the
Question: When you have a .NET GUID for inserting in a database, it's structure
I feel like a bit of a newbie posting this, but anyway: I have
I have this bit of javascript written with jQuery 1.2.5. It's contained inside the
I have a bit of code that passes around a ton of objects and
I have a bit of a hybrid situation on my hands. I'm writing an
I have a bit of html like so: <a href=#somthing id=a1><img src=something /></a> <a
I have this bit of script to widen a text box on mouseover and
I have a bit of an unusual question. I'm running an old DOS game
I have a bit of a problem. I wrote an API a long time

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.