Detach issue

3 posts, 0 answers
  1. Oscar
    Oscar avatar
    4 posts
    Member since:
    Feb 2011

    Posted 14 Oct 2015 Link to this post

    Hi.I am using DataAcess Q1 2015, when use CreateDetachCopy the graph does not fill it as indicated in fetchstrategy. For example, the following code does not bring data Fac_Clientes

     

    try
                {
     
                    using (FluentModel context = new FluentModel())
                    {
                        Telerik.OpenAccess.FetchOptimization.FetchStrategy fetchStrategy = new Telerik.OpenAccess.FetchOptimization.FetchStrategy();
                        context.FetchStrategy = fetchStrategy;
                        fetchStrategy.LoadWith<Ag_huecos>(h => h.Cc_pas);
                        fetchStrategy.LoadWith<Ag_huecos>(h => h.Ag_tramos);
                        fetchStrategy.LoadWith<Ag_huecos>(h => h.Pac_paciente);
                        fetchStrategy.LoadWith<Ag_huecos>(h => h.Ag_agenda);
                        fetchStrategy.LoadWith<Ag_huecos>(h => h.Pac_tarjetas);
                        fetchStrategy.LoadWith<Pac_tarjetas>(h => h.Pac_polizasxpaciente);
                        fetchStrategy.LoadWith<Pac_polizasxpaciente>(h => h.Fac_polizas);
                        fetchStrategy.LoadWith<Fac_polizas>(h => h.Fac_clientes);
                        var query = (from p in context.Ag_huecos
                                     where idagenda.Contains(p.Idagenda)
                                     && p.Fechahorainicio > dia
                                     && p.Fechahorainicio < dia.AddDays(1)
                                     select p).ToList();
                        Telerik.OpenAccess.FetchOptimization.FetchStrategy fetchStrategydetach = new Telerik.OpenAccess.FetchOptimization.FetchStrategy();
     
                        fetchStrategydetach.LoadWith<Ag_huecos>(h => h.Cc_pas);
                        fetchStrategydetach.LoadWith<Ag_huecos>(h => h.Ag_tramos);
                        fetchStrategydetach.LoadWith<Ag_huecos>(h => h.Pac_paciente);
                        fetchStrategydetach.LoadWith<Ag_huecos>(h => h.Ag_agenda);
                        fetchStrategydetach.LoadWith<Ag_huecos>(h => h.Pac_tarjetas);
                        fetchStrategydetach.LoadWith<Pac_tarjetas>(h => h.Pac_polizasxpaciente);
                        fetchStrategydetach.LoadWith<Pac_polizasxpaciente>(h => h.Fac_polizas);
                        fetchStrategydetach.LoadWith<Fac_polizas>(h => h.Fac_clientes);
     
                        var detachedContact = context.CreateDetachedCopy<List<Ag_huecos>>(query, fetchStrategydetach);

     

     

  2. Thomas
    Admin
    Thomas avatar
    590 posts

    Posted 16 Oct 2015 Link to this post

    Without knowing the model (is it a collection or a reference that is missing?) it is really hard to figure out what could possibly have gone wrong.
    Please give us a glimpse on the used model (CLR/Tables) so that we stand a chance to reproduce this here.
    Is this a regression from an earlier version?

    Regards,
    Thomas
    Telerik
     
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
  3. DevCraft banner
  4. Oscar
    Oscar avatar
    4 posts
    Member since:
    Feb 2011

    Posted 21 Oct 2015 in reply to Thomas Link to this post

    I solved the problem with the parameter MaxFetchDepth=5

     

    Thanks

Back to Top