Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting StackOverflowException when setting property
    primarykey
    data
    text
    <pre><code>public List&lt;Empleado&gt; ListarEmpleados() { List&lt;Empleado&gt; returnList = new List&lt;Empleado&gt;(); var lista = from u in DB.tabEmpleado select new { u.idEmpleado, u.idUsuario, u.Nombre, u.Apellidos, u.Telefono1 }; foreach (var e in lista) { Empleado empleado = new Empleado(); empleado.idEmpleado = e.idEmpleado; empleado.idUsuario = e.idUsuario; empleado.nombre = e.Nombre; empleado.apellidos = e.Apellidos; empleado.telefono1 = e.Telefono1; returnList.Add(empleado); } return returnList; } </code></pre> <p>This is a WCF service, when is called it returns StackOverflow error in the class definition, exactly in the Set property of idEmpleado.</p> <p>Class definition is here.</p> <pre><code>[DataContract] public class Empleado { private int _idEmpleado; [DataMember(IsRequired = false)] public int idEmpleado { get { return _idEmpleado; } set { idEmpleado = value; } ERROR } private int _idUsuario; [DataMember(IsRequired = false)] public int idUsuario { get { return _idUsuario; } set { idUsuario = value; } } private string _nombre; [DataMember(IsRequired = false)] public string nombre { get { return _nombre; } set { nombre = value; } } private string _apellidos; [DataMember(IsRequired = false)] public string apellidos { get { return _apellidos; } set { apellidos = value; } } private string _telefono1; [DataMember(IsRequired = false)] public string telefono1 { get { return _telefono1; } set { telefono1 = value; } } } </code></pre> <p>}</p> <p>Does anybody know where the error is?</p> <p>Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload