none
The 'Timestamp' property on 'TableName' could not be set to a 'String' value. You must set this property to a non-null value of type 'Byte[]' RRS feed

  • Question

  • Hi,
    I am getting this error randomly when calling a method from GUI to my WCF window service.
    The method does a Get from the EntityFramework and it was working fine all the while. Recently it hits this error when the transaction getting more and more.

    Other than this, I have the following for different tables when retrieving data from EF.

    The 'ID' property on 'TableName' could not be set to a 'Int64' value. You must set this property to a non-null value of type 'Int32'

    or

    The 'IsSerialized' property on 'TableName' could not be set to 'Int32' value. You must set this property to a non-null value of type 'Boolean'

    Sample code at GUI:

    MyServiceClient client = new MyServiceClient();
    try
    {
    client.Open();
    allEmployees = client.GetAllEmployees();
    client.Close();
    }
    catch {something here}

    Sample code at WCF GetAllEmployees() method:

    using (MyEntities context = new MyEntities())
    {
      context.EmployeeSet.MergeOption = MergeOption.NoTracking;
      return context.EmployeeSet.ToList<Employee>();
    }

    Anyone encountered this kind of error before? After restarting the WCF window service the error will be gone and it works back as normal again.

    Tuesday, April 17, 2012 6:38 AM

Answers

  • Hi STPHNG,

    Welcome!

    I think the problem relate to your models, you should use "?" for the nullable columns:

    Public class MyClass
    {
    public int? Id{get;set;}
    public Boolean? Iserialized {get; set;}
    
    }
    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, April 18, 2012 7:56 AM
    Moderator