I call the method LeerAlerta()
, which I want to return the list of rows from a simple query.
This is the method that makes the query in Linq:
internal List<alertas> LeerAlerta()
{
using (var db = new alertas2015())
{
var alertas = db.alertas.ToList();
return alertas;
}
}
This is the operation Contract:
[OperationContract]
List<alertas> LeerAlerta();
And this is the object alertas:
public partial class alertas
{
public int id { get; set; }
public int modulos_id { get; set; }
public string proceso { get; set; }
public string metodo { get; set; }
public string descripcion { get; set; }
public int estado { get; set; }
public string receptor { get; set; }
public System.DateTime fecha { get; set; }
public System.DateTime fecha_aceptada { get; set; }
public virtual modulos modulos { get; set; }
}
When I call LeerAlertas it just stops connection and:
System.Runtime.Serialization.SerializationException is all i'm getting from tracing it.
The message:
No se espera el tipo 'System.Data.Entity.DynamicProxies.alertas_7895CEE569AEBE6977614A1873DB1D304F0CEC3F6B5A87E3B3C324BA933840CA' con el nombre de contrato de datos 'alertas_7895CEE569AEBE6977614A1873DB1D304F0CEC3F6B5A87E3B3C324BA933840CA:http://schemas.datacontract.org/2004/07/System.Data.Entity.DynamicProxies'. Intente usar DataContractResolver o agregar tipos no conocidos estáticamente a la lista de tipos conocidos (por ejemplo, usando el atributo KnownTypeAttribute o agregándolos a la lista de tipos conocidos que se pasa a DataContractSerializer).
I have 0 experience in serializing objects so I don't realy know how to fix this problem.