R – Ado Net Data Services BeginExecute Problem

astorialinq-to-entitieswcf-data-services

public void metodoX()
{ 
 foreach (TURNO t in listaTurnoPersona)
 {
  DataServiceQuery<VST_CANTIDAD_PERSONAS_POR_DIA> query = 
    General.Entities.VST_CANTIDAD_PERSONAS_POR_DIA.Where(
                    z => z.ID_TURN == t.ID_TURN 
                        && z.FE_CALE >= RadDatePicker1.SelectedDate.Value
                        && z.FE_CALE <= RadDatePicker1.SelectedDate.Value.AddDays(6)) 
    as DataServiceQuery<VST_CANTIDAD_PERSONAS_POR_DIA>;
  query.BeginExecute(ProcesarHorarioPersonasTurno, query);
  //HERE THE ID_TURN CHANGE 1, 2, 3 , 4 ...
 }
}

public void ProcesarHorarioPersonasTurno(IAsyncResult result)
{
            List<VST_CANTIDAD_PERSONAS_POR_DIA> listaDias = (result.AsyncState as   DataServiceQuery<VST_CANTIDAD_PERSONAS_POR_DIA>).EndExecute(result).ToList();
         //HERE ALWAYS I GET THE RESULT IDTURN = 1}

Please Check the code above, why is happening this, is supposed that the ID_TURN also change, this doesn't was happening before.

Best Answer

i Found that the entity returned VST_CANTIDAD_PERSONAS_POR_DIA is just being created only once!(when the the method is called for first time); i think this maybe is because the model is in another project or because im using Entity framework extensions.

BTW im registered now, sorry thtat i add an answer but i can comment or edit the another post.

Related Topic