Eager loading related objects?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Cloud Applications
Post Reply
papirov
Posts: 1
Joined: Mon 09 Sep 2013 15:04

Eager loading related objects?

Post by papirov » Mon 09 Sep 2013 15:21

Trying the product out to support EntityFramework access to Salesforce data.

Having an issue with trying to eagerly load related entities using Entity Framework:

Simple test code:

Code: Select all

            var context = new SalesforceEF();
            var contacts = context.Contacts.Include("Account").ToList();
            var contacts2 = context.Contacts.Select(n => new {n, n.Account}).ToList();

Either of the queries throws an exception:

Index was outside the bounds of the array.
at Devart.Data.Salesforce.ad.a(sObject A_0)
at Devart.Data.Salesforce.y.r(Int32 A_0)
at Devart.Data.Salesforce.SalesforceDataReader.IsDBNull(Int32 ordinal)
at System.Data.Common.Internal.Materialization.Shaper.ErrorHandlingValueReader`1.GetValue(DbDataReader reader, Int32 ordinal)
at System.Data.Common.Internal.Materialization.Shaper.GetPropertyValueWithErrorHandling[TProperty](Int32 ordinal, String propertyName, String typeName)
at lambda_method(Closure , Shaper )
at System.Data.Common.Internal.Materialization.Shaper.HandleEntityAppendOnly[TEntity](Func`2 constructEntityDelegate, EntityKey entityKey, EntitySet entitySet)
at lambda_method(Closure , Shaper )
at System.Data.Common.Internal.Materialization.Coordinator`1.ReadNextElement(Shaper shaper)
at System.Data.Common.Internal.Materialization.Shaper`1.SimpleEnumerator.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at ClassLibrary1.Class1.test() in d:\Dev\Spikes\SalesforceBulkAPI\ClassLibrary1\Class1.cs:line 18
Tried this using the LazyLoad ON or OFF at the EDMX level. Would appreciate any advice.

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Eager loading related objects?

Post by MariiaI » Wed 11 Sep 2013 10:56

We couldn't reproduce this issue in our environment with the latest version of dotConnect for Salesforce 2.3.210. We have made a test with the account and contact tables.
Please send us a test project so that we are able to reproduce this issue and investigate it in more details.

Looking forward to your reply.

rguenette
Posts: 3
Joined: Mon 23 Sep 2013 19:51

Re: Eager loading related objects?

Post by rguenette » Mon 23 Sep 2013 19:56

Same problem here with the Account table. Did you find any solution?

Thanks

MariiaI
Devart Team
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Eager loading related objects?

Post by MariiaI » Tue 24 Sep 2013 13:49

We still couldn't reproduce this issue in our environment with the latest version of dotConnect for Salesforce 2.3.221. We have made a test with the Account and Contact tables and this code works without errors:

Code: Select all

var context = new VitaliybdevartcomEntities();
            var contacts = context.Contacts.Include("Account").ToList();
            var contacts2 = context.Contacts.Select(n => new { n, n.Account }).ToList();
Please send us a test project so that we are able to reproduce this issue and investigate it in more details.

Post Reply