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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:19:21+00:00 2026-05-28T14:19:21+00:00

I am using subsonic to access my DB in a mvc application. When trying

  • 0

I am using subsonic to access my DB in a mvc application.
When trying to update a record using the mvc model binding the record does not update because non of the columns are marked as dirty.

I tried manually marking all the columns as dirty by tweaking the subsonic code, but sometimes i only want to update some of the properties so i do not want to mark them all as dirty.

What is the best way about to do this?

this is my action:

        [HttpPost]
        public ActionResult Update(mapping m)
        {
           m.SetIsNew(false);
           m.Update(true); // here i tweaked the subsonic code passing true sets all the columns to be dirty and updates the record even though isLoaded=false
           return RedirectToAction("New");
        }

this is how i tweaked the subsonic code:

public void Update(IDataProvider provider, Boolean forceUpdate){
            if(this._dirtyColumns.Count>0 || forceUpdate){
                if(forceUpdate)
                    this._dirtyColumns = this.Columns.ToList();
                _repo.Update(this,provider);
                _dirtyColumns.Clear();    
            }
            OnSaved();
       }

EDIT:

I tried out this code to see where the problem lies:

var m = new mapping { ID = 2, Name = "33" };
m.SetIsNew(false);
m.Save();

This too does not work the columns are not set to dirty. It seems that when the an object initializer is used the setters do not get called so the columns are not set to dirty.

I would assume that the default mvc.net model binding works this way and that is why the record is not being updated.

Edit 2

My first edit is wrong as @dyork12 pointed out.
Subsonic uses a ‘isLoaded’ flag, when it is set to false setting properties does not set them as dirty. this is used by subsonic when loading a record, to make sure setting properties while loading does not set then as dirty.

But my question remains what is the best workaround for editing a subsonic object from an mvc.net view using the automatic model binding.

  • 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-28T14:19:22+00:00Added an answer on May 28, 2026 at 2:19 pm

    So the original problem (as now understood) is that MVC somehow loads rows and creates DAL objects for them without setting the isLoaded flag, and then any calls to setters do not get added into the dirtyColumns list. You have to find a way to set isLoaded after the record is loaded and the DAL object is created, before any setters are called.

    Sorry, I don’t know MVC well enough to help, and you didn’t include any code for that part. I would expect to insert some kind of event, or inherit from something, or modify a template, or something. As soon as you find a way to set isLoaded, you will solve the problem. I hope.

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

Sidebar

Related Questions

I'm interested in using Subsonic 3.0 for developing a new ASP.Net MVC application that
I am developing MVC 3 application and its first time i am using subsonic.
i´m using subsonic 3 trying convert a SQL2008 project to MySQL. when the projects
I'm looking at using Subsonic with a multi-tenant ASP.net web application. There are multiple
I have a relatively simple ASP.net MVC 2 app that is using SubSonic. Everything
I have an MVC project setup, and I've brought the subsonic Active Record templates
Hey all i am using SubSonic 2.1 Version, how to access the scaffold control
I am using Subsonic v3.0.0.3 with the Linq templates. I am attempting to update
I was not able to insert data into table with computed column using Subsonic.
I'm trying to start using Subsonic (v3). The brief installation instructions indicate that I

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.