The type '' in Assembly '' is not marked as serializable. LINQ to SQL

I am using asp.net and have configured sessions to store on a SQL server. My object has many objects and several linq-to-sql dbml. I configured all of them for unidirectional serialization, and also made several individual changes.

When I run the application, I keep getting this error in the application_error event handler

The type 'Data.Karaoke.spCWP_SelUserPrivilegesResult' in Assembly 'App_Code.thzd8p2j, Version = 0.0.0.0, Culture = neutral, PublicKeyToken = null' is not marked as serializable.

from the error, I'm not sure if it comes from the dbml.designer.cs file, which is the code:

[Function(Name="dbo.spCWP_SelUserPrivileges")]
public ISingleResult<spCWP_SelUserPrivilegesResult> spCWP_SelUserPrivileges([Parameter(Name="IDCWPUser", DbType="Int")] System.Nullable<int> iDCWPUser)
{
  IExecuteResult result = this.ExecuteMethodCall(this, ((MethodInfo)(MethodInfo.GetCurrentMethod())), iDCWPUser);
  return ((ISingleResult<spCWP_SelUserPrivilegesResult>)(result.ReturnValue));
}

and

[DataContract()]
public partial class spCWP_SelUserPrivilegesResult
{

  private int _IDTypeCWPModule;

  private string _TypeKey;

  private bool _Security;

  public spCWP_SelUserPrivilegesResult()
  {
  }

  [Column(Storage="_IDTypeCWPModule", DbType="Int NOT NULL")]
  [DataMember(Order=1)]
  public int IDTypeCWPModule
  {
    get
    {
      return this._IDTypeCWPModule;
    }
    set
    {
      if ((this._IDTypeCWPModule != value))
      {
        this._IDTypeCWPModule = value;
      }
    }
  }

  [Column(Storage="_TypeKey", DbType="VarChar(10) NOT NULL", CanBeNull=false)]
  [DataMember(Order=2)]
  public string TypeKey
  {
    get
    {
      return this._TypeKey;
    }
    set
    {
      if ((this._TypeKey != value))
      {
        this._TypeKey = value;
      }
    }
  }

  [Column(Storage="_Security", DbType="Bit NOT NULL")]
  [DataMember(Order=3)]
  public bool Security
  {
    get
    {
      return this._Security;
    }
    set
    {
      if ((this._Security != value))
      {
        this._Security = value;
      }
    }
  }
}

How to determine where the error came from? Or what does the error mean?

, , .

+3
2

, - . DataContract.

:

[Serializable]
public partial class spCWP_SelUserPrivilegesResult { }

, dbml .

+6

, SQL Server CLR, .Net , , :

[Serializable()]
[DataContract()]
public partial class spCWP_SelUserPrivilegesResult
{
    ...
0

All Articles