This is a migrated thread and some comments may be shown as answers.

Detach issue

2 Answers 38 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Oscar
Top achievements
Rank 1
Oscar asked on 14 Oct 2015, 05:30 PM

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 Answers, 1 is accepted

Sort by
0
Thomas
Telerik team
answered on 16 Oct 2015, 11:59 AM
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.
0
Oscar
Top achievements
Rank 1
answered on 21 Oct 2015, 10:11 AM

I solved the problem with the parameter MaxFetchDepth=5

 

Thanks

Tags
Data Access Free Edition
Asked by
Oscar
Top achievements
Rank 1
Answers by
Thomas
Telerik team
Oscar
Top achievements
Rank 1
Share this question
or