Value cannot be null. Parameter name: mi

Value cannot be null. Parameter name: mi

Postby hepek » Tue 19 Mar 2013 21:31

I have a query like this:
Code: Select all
var job = DB.Jobs
   .LoadWith(x => x.Deal)
   .LoadWith(x => x.Deal.Status)
   .LoadWith(x => x.Status)
   .LoadWith(x => x.Cycles)
   .LoadWith(x => x.Cycles.LoadWith(c => c.Status))
   .LoadWith(x => x.Cycles.LoadWith(c => c.Process))
   .Where(x => x.JobNumber == jobNum).FirstOrDefault();

I receive this error: "Value cannot be null. Parameter name: mi"

When I use DataLoadOptions as shown below it works fine.

Code: Select all
DataLoadOptions options = new DataLoadOptions();
options.LoadWith<Deal>(x => x.Status);
options.LoadWith<Job>(x => x.Deal);
options.LoadWith<Job>(x => x.Cycles);
options.LoadWith<Job>(x => x.Status);
options.LoadWith<Cycle>(x => x.Process);
options.LoadWith<Cycle>(x => x.Status);
DB.LoadOptions = options;

var job = DB.Jobs.Where(x => x.JobNumber == jobNum).FirstOrDefault();
hepek
 
Posts: 115
Joined: Thu 07 Jul 2011 13:59

Re: Value cannot be null. Parameter name: mi

Postby hepek » Wed 20 Mar 2013 14:03

one more question: is this a valid command?

Code: Select all
var jobs = DB.ExecuteQuery<Job>(sql).LoadWith(x => x.Status).ToList();


It compiles ok, but on runtime gives me an error: LoadWith extention method.

• LoadWith extention method.
(System.NotSupportedException)
at Devart.Data.Linq.Queryable.LoadWith[TEntity](IEnumerable`1 source, Expression`1 predicate, FetchMode fetchMode)
at RRD.OnePlace.BLL.JobBO.GetJobArchive(Int64 jobNum) in C:\OnePlace\WebSite\RRD.OnePlace.BLL\JobBO.cs:line 728
at RRD.OnePlace.BLL.JobBO.GetJobLite(Int64 jobNum) in C:\OnePlace\WebSite\RRD.OnePlace.BLL\JobBO.cs:line 784
at RRD.OnePlace.WEB.Popups.CloneJob.Retrieve() in C:\OnePlace\WebSite\RRD.OnePlace.WEB\Popups\CloneJob.aspx.cs:line 30
at RRD.OnePlace.WEB.Popups.CloneJob.Page_Load(Object sender, EventArgs e) in C:\OnePlace\WebSite\RRD.OnePlace.WEB\Popups\CloneJob.aspx.cs:line 22
at RRD.OnePlace.WEB.BasePage.OnLoad(EventArgs e) in C:\OnePlace\WebSite\RRD.OnePlace.WEB\AppClasses\BasePage.cs:line 64
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

• Exception of type 'System.Web.HttpUnhandledException' was thrown.
(System.Web.HttpUnhandledException)
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.popups_clonejob_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\rrd.oneplace.web\81038742\7108709b\App_Web_thdgm1ed.0.cs:line 0
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

hepek
 
Posts: 115
Joined: Thu 07 Jul 2011 13:59

Re: Value cannot be null. Parameter name: mi

Postby MariiaI » Thu 21 Mar 2013 13:16

We couldn't reproduce the "Value cannot be null. Parameter name: mi" exception in our environment. Please send us a small test project with which this error could be reproduced.
As for the query like this
var jobs = DB.ExecuteQuery<Job>(sql).LoadWith(x => x.Status).ToList();

LoadWith can't be used on the results of direct queries through the ExecuteQuery method. The LoadWith method should be used only on IEnumerable<TEntity> instances that belong to either of the following groups:
- Devart.Data.Linq.Table objects;
- 'many' navigation properties;
- results of LoadWith invocation on objects from the previous two groups.
For more information please refer to http://www.devart.com/linqconnect/docs/EagerLoading.html

Looking forward to your reply.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17


Return to dotConnect for Oracle