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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:00:09+00:00 2026-05-15T00:00:09+00:00

For various reasons I am having to send a typed dataset to a WCF

  • 0

For various reasons I am having to send a typed dataset to a WCF service endpoint. This works fine except that upon Deserializing, the RowState of each row in each DataTable is set to ‘Added’, regardless of what they were on the client. If I write the serialized stream out to a file, I see that the RowState is not part of the Serialized data. How can I add this so that I can preserve the RowState across service boundaries? Not that I think it matters, but the client process is running .net 3.5 while the service process is running .net 4.0

  • 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-15T00:00:09+00:00Added an answer on May 15, 2026 at 12:00 am

    Here is the code for the RowState property:

    public DataRowState RowState
    {
        get
        {
            if (this.oldRecord == this.newRecord)
            {
                if (this.oldRecord == -1)
                {
                    return DataRowState.Detached;
                }
                if (0 < this._columns.ColumnsImplementingIChangeTrackingCount)
                {
                    foreach (DataColumn column in this._columns.ColumnsImplementingIChangeTracking)
                    {
                        object obj2 = this[column];
                        if ((DBNull.Value != obj2) && ((IChangeTracking)obj2).IsChanged)
                        {
                            return DataRowState.Modified;
                        }
                    }
                }
                return DataRowState.Unchanged;
            }
            if (this.oldRecord == -1)
            {
                return DataRowState.Added;
            }
            if (this.newRecord == -1)
            {
                return DataRowState.Deleted;
            }
            return DataRowState.Modified;
        }
    }
    

    as you can see, there may be nothing you can do about its value, because it is calculated rather than just stored. The easiest solution may be to just add another column to the DataSet which contains the state of the row.


    (Why does it always calculate out to the value Added? Most likely because when your serialized dataset is rehydrated back on the server, new rows are created and added to the dataset – so the value is quite literally true. If you follow the above suggestion to add another column to the dataset, that will require a change to the server code to be able to examine and process it – if you are going to make that sort of change then maybe it is worth doing the whole thing and recode that service to use proper serializable DTOs instead?).

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

Sidebar

Related Questions

I have a Yahoo! Group that has its own Database tables for various reasons.
For various reasons, I like having openGL to use coordinates other than pixels, which
I suspect I'm doing this wrong. For various reasons, my app forces the user
For various reasons, I need to runOnUiThread() the actual instantiation & initialization of WebView
For various reasons (code review mostly) I need to switch from current development branch
I have been looking for an alternative to Hibernate for various reasons. I came
Using get/set seems to be a common practice in Java (for various reasons), but
I am creating a GTK Window which, for various reasons, I wish to make
So I've read some articles about scaling Socket.IO. For various reasons I don't want
I have created an MSBuild tasks for building my projects, but for various reasons

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.