New Posts New Posts RSS Feed: CodeDom generated query
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

CodeDom generated query

 Post Reply Post Reply
Author
chuckc View Drop Down
Groupie
Groupie


Joined: 27-Feb-2010
Posts: 54
Post Options Post Options   Quote chuckc Quote  Post ReplyReply Direct Link To This Post Topic: CodeDom generated query
    Posted: 25-Mar-2014 at 8:10pm
Do you have an email address where we can continue this conversation, and possibly exchange information on access to source code?
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 25-Mar-2014 at 3:57pm
Based on the exception, it looks like the entity type returned by the query is not being found.
Hard to tell why by looking at your snippet.
A repro solution will help to determine why this is happening.
Back to Top
chuckc View Drop Down
Groupie
Groupie


Joined: 27-Feb-2010
Posts: 54
Post Options Post Options   Quote chuckc Quote  Post ReplyReply Direct Link To This Post Posted: 25-Mar-2014 at 3:45pm
I'll try and get to that soon, but in the meantime is there any documentation on the exception in the original posting that you could pass along to me?
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 25-Mar-2014 at 3:42pm
Chuck,

I can't reproduce this issue here.
Please provide a small solution reproducing the issue.
Please target NorthwindIB in the repro solution.

Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post Posted: 25-Mar-2014 at 3:15pm
Hi Chuck,

I'm working on a repro and will follow up shortly.
Back to Top
chuckc View Drop Down
Groupie
Groupie


Joined: 27-Feb-2010
Posts: 54
Post Options Post Options   Quote chuckc Quote  Post ReplyReply Direct Link To This Post Posted: 22-Mar-2014 at 8:32am
Hello out there?

Anybody at IdeabBlade have some insight as to where this IdeaBlade.EntityModel.EntityServerException is coming from?  Any documentation on the exception? 

Thanks! 
Back to Top
chuckc View Drop Down
Groupie
Groupie


Joined: 27-Feb-2010
Posts: 54
Post Options Post Options   Quote chuckc Quote  Post ReplyReply Direct Link To This Post Posted: 18-Mar-2014 at 6:57am
I am using CodeDom to create and execute runtime specified full LINQ queries, which is working nicely. However, I am now trying to add support for IncludePaths and am getting the below exception that I can't find any documentation on.

Below is the full text of the generated code, which works properly until I add the line
query = query.Include("SourcePolicyPeriod.Certificates");

The same query - with the Include - works properly in the main project environment.
__________________________________________________________________
               using System;
               using System.Collections;
               using System.Collections.Generic;
               using System.Linq;
               using System.Text;
               using IdeaBlade.EntityModel;

               using iCatalyst.DomainModel;


               public class LinqTextQueryGeneratedClass
               {
                    private EntityQuery<Quote> source;

                    public LinqTextQueryGeneratedClass( EntityQuery<Quote> parmSource )
                    {
                        source = parmSource;
                    }

                     public IList Query()
                    {
                        var query = from Quote e in source where e.Name != null && e.SourcePolicyPeriod.Certificates.Any(x=>x.Provider.Person.FirstName.StartsWith("A"))
select new { __root=e, __item1 = new object(), __item2 = new object() };
                        query = query.Include("SourcePolicyPeriod.Certificates");
                        return query.ToList();
                    }
               }
_______________________________________________________________

Exception and stack trace:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> IdeaBlade.EntityModel.EntityServerException: IncludePaths can only be added to a queries that return an entity or a collection of entities ---> System.Exception: IncludePaths can only be added to a queries that return an entity or a collection of entities
   at IdeaBlade.EntityModel.EntityServerProxy.CheckConnection(Exception e)
   at IdeaBlade.EntityModel.EntityServerProxy.ExecFunc[T](Func`1 func, Boolean funcWillHandleException)
   at IdeaBlade.EntityModel.EntityServerProxy.ExecuteOnServer[T](Func`1 func, Boolean funcWillHandleException)
   at IdeaBlade.EntityModel.EntityServerProxy.Fetch(SessionBundle bundle, IEntityQuerySurrogate query)
   at IdeaBlade.EntityModel.EntityManager.ExecuteServerQuery(IEntityQuerySurrogate entityQuery)
   --- End of inner exception stack trace ---
   at IdeaBlade.EntityModel.EntityManager.HandleEntityServerException(Exception ex, Boolean tryToHandle, PersistenceOperation operation, Boolean throwOnError)
   at IdeaBlade.EntityModel.EntityManager.ExecuteServerQuery(IEntityQuerySurrogate entityQuery)
   at IdeaBlade.EntityModel.EntityManager.ExecuteFetch(IEntityFinder finder)
   at IdeaBlade.EntityModel.EntityQueryFinder.Execute()
   at IdeaBlade.EntityModel.EntityManager.ExecuteQueryCore(IEntityQuery query, Boolean isAsync)
   at IdeaBlade.EntityModel.EntityManager.ExecuteQuery[T](IEntityQuery`1 query)
   at IdeaBlade.EntityModel.EntityQueryExtensions.Execute[T](IEntityQuery`1 query)
   at IdeaBlade.EntityModel.EntityQuery`1.GetEnumerator()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at LinqTextQueryGeneratedClass.Query()
   --- End of inner exception stack trace ---
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
   at iCatalyst.LinqTextQuery.LinqTextQueryRuntime`1.ExecuteQuery(TSource source) in c:\ActiveProjects\icatERP2_MoDocs\iCatalyst\trunk\iCatalyst.LinqTextQuery\LinqTextQueryRuntime.cs:line 157
   at iCatalyst.LinqTextQuery.LinqTextQueryBuilder`1.Query(String queryText, String includeText) in c:\ActiveProjects\icatERP2_MoDocs\iCatalyst\trunk\iCatalyst.LinqTextQuery\LinqTextQueryBuilder.cs:line 73
   at iCatalyst.DataBrowser.QueryGenerator.Query(Type type, String expression, String displayList, String includeEntities) in c:\ActiveProjects\icatERP2_MoDocs\iCatalyst\trunk\iCatalyst.DataBrowser\QueryGenerator.cs:line 130
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down