Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I observed something similar when I let Linq to SQL use stored procedures for inserting/updating. I am not sure if I remember correctly, but I think that Linq to SQL uses these three instances of the entity class to figure out what changed so that the required SQL statement can be built.</p> <p>I see basically two options (though I am not sure if this really works):</p> <ol> <li>You could probably store the extra field(s) in the "OnValidate" event of the entity. </li> <li>You could overwrite the partial methods for inserting/updating. In that case you will also need to take care of storing the entity in the database (e.g. with stored procedure).</li> </ol> <p>The property would look then like this:</p> <pre><code>private string address = null; public string Address { get { if (this.address == null) { // Load on first use: This might make a problem... UserProfile profile = UserProfile.GetUserProfile(UserName); this.address = profile.Address; } return this.address; } set { this.address = value; } } </code></pre> <p>In both cases you have the problem that you might update the extra fields though the update of the rest of the entity fails. This was of course also a problem with your initial approach. </p> <p>I think the best solution would be to implement your own profile provider and store the profile information in your own tables. If you do that you could let Linq to SQL create entities for your profile information: Everything would be "standard" and you would not have to resort to some kind of "hack"...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload