How do I change an auto-implemented property to use a private member variable while keeping the table/column association unchanged?
<p>I want to change a C# class member from being an auto-implemented property (auto-property?) to use a private member variable instead, in my Windows Phone C#-based app. The change is simple except that the class represents a database table. A simplified version of the original class looks like this:</p>

<pre><code>[Table]
public class ResourceItem
{
    [Column(IsPrimaryKey=true, IsDbGenerated=true)]
    public long m_ItemId { get; set; }

    [Column(CanBeNull=true)]
    private int? m_Order;
}
</code></pre>

<p>A bad decision years ago has led to me now need a custom getter method for m_Order. The new class looks like this: </p>

<pre><code>[Table]
public class ResourceItem
{
    [Column(IsPrimaryKey=true, IsDbGenerated=true)]
    public long m_ItemId { get; set; }

    private int? _order;
    [Column(CanBeNull=true)]
    public int? m_Order 
    {
        set { _order = value; } 
        get { return _order == 999999 ? 0 : _order; }
    }
}
</code></pre>

<p>This all works fine and when the unwanted 999999 value is discovered, the code returns 0, which is totally appropriate.</p>

<p>The original bug is not the issue, nor is the change to the class in regards to C#. The problem is with this being a database column. When I run the new app with a database created by the old version of the app, I get "Row not found or changed" errors when an object of this type is updated in the database.</p>

<p>Why does the update cause a problem? Shouldn't the database schema remain completely unchanged by this class change?</p>

<p>Using <code>[Column(CanBeNull=true, UpdateCheck=UpdateCheck.Never)]</code> as the column definition gets rid of the error but I would like to know why the error shows up in the first place.</p>

<p>Is there a different way to specify the <code>Column</code> attribute to avoid the error? Should I use the <code>Column</code> attribute on the private member instead?</p>

<p>And most importantly, are my database updates working correctly now that I've taken away the update check on this column?</p>