Deserializing inherited linq object issue

Mar 25, 2012 at 10:04 AM
Edited Mar 25, 2012 at 10:07 AM

Hi, I have used Linq-to-SQL objects in my web app. My base and inherited classes look like this:

//Base Class: this will define the attributes that is auto-generated
//when using Linq-2-SQL ORM. Note this class is a partial class
[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.Categories")]
[global::System.Runtime.Serialization.DataContractAttribute()]
public partial class Category : INotifyPropertyChanging, INotifyPropertyChanged 

//Inherited Class:
[Serializable]
public class CategoryEntity : Category
    {
        private int _ActiveAdsCount;

        public int ActiveAdsCount
        {
            get
            {
                return _ActiveAdsCount;
            }

            set
            {
                _ActiveAdsCount = value;
            }
        }

        public int DisplaySequence { get; set; }

    }

 

when serialize Json OUTPUT (note the ActiveAdsCount and DisplaySequence values):

[{"ActiveAdsCount":3429,"DisplaySequence":99,"CategoryID":636,"ParentCategoryID":635,"CategoryName":"propForRent","CategoryImageFN":null}]

When I am calling the deserialze object method, it shows "ActiveAdsCount" and "DisplaySequence" have 0 values while the json shows proper correct information coming from Database. So, the problem is in deserialization. Kindly help...

Thanks in advance