i call method leeralerta()
, want return list of rows simple query.
this method makes query in linq:
internal list<alertas> leeralerta() { using (var db = new alertas2015()) { var alertas = db.alertas.tolist(); return alertas; } }
this operation contract:
[operationcontract] list<alertas> leeralerta();
and 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 call leeralertas stops connection and:
system.runtime.serialization.serializationexception i'm getting 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 la lista de tipos conocidos (por ejemplo, usando el atributo knowntypeattribute o agregándolos la lista de tipos conocidos que se pasa datacontractserializer).
i have 0 experience in serializing objects don't realy know how fix problem.
the answer @codecaster told me, put in dbcontext next thing:
configuration.proxycreationenabled = false;
Comments
Post a Comment