LinQ. update column with auto generated value

  • Thread starter Thread starter Roger Tranchez
  • Start date Start date
R

Roger Tranchez

The problem I'm coming across now is that I can't update such a column,
because I have set the auto generated value to true, and LINQ won't let me
change such a value, a la "System.InvalidOperationException: Value of member
'Activated' of an object of type 'Customers' changed. A member that is
computed or generated by the database cannot be changed."



This is fine for identity fields, but the field I'm updating is a bit that
starts off FALSE on every record, and is later updated to TRUE. How can I
resolve this, so that when inserting records I don't have to include this
column, yet when updating records I can change its value?
 
Hello Carles,

The symptom sounds very similar to the problem described in the codeproject
article:
http://www.codeproject.com/KB/linq/SettingDefaultValues.aspx
(see the part of the author set the IsDbGenerated property to true)

The workaround is to hook the Updating and Inserting events of
LinqDataSource, and reset the LINQ object's default values for insert and
update.

Please have a look and let me know whether the article is helpful to you or
not. If you have any other concerns or questions, DON'T hesitate to tell me.

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hello Carles

I am writing to check the status of the issue on your side. Would you mind
letting me know the result of the suggestions? If you need further
assistance, feel free to let me know. I will be more than happy to be of
assistance.

Have a great day!

Regards,
Jialiang Ge ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================
 
Back
Top