Function interface is not compartible with server stored...

Function interface is not compartible with server stored...

Postby Nahmis » Mon 13 Jul 2009 21:49

Not a typo, this is the error coming on most of our queries, unless I enumerate each table and then we're doing Linq to entities, this is what happens:
"Function interface is not compartible with server stored prpcedure."

Full stack:
Code: Select all
[InvalidOperationException: Function interface is not compartible with server stored prpcedure.]
   Devart.Data.Linq.Mapping.j.a() +918
   Devart.Data.Linq.Mapping.j..ctor(d A_0, MethodInfo A_1, Dictionary`2 A_2) +1935
   Devart.Data.Linq.Mapping.d.b() +358
   Devart.Data.Linq.Mapping.d.c(Type A_0) +335
   Devart.Data.Linq.Provider.Query.bk.a(NewExpression A_0) +613
   Devart.Data.Linq.Provider.Query.bk.j(Expression A_0) +1016
   Devart.Data.Linq.Provider.Query.bk.b(Expression A_0) +51
   Devart.Data.Linq.Provider.Query.bk.a(Expression A_0, Expression A_1, Expression A_2) +391
   Devart.Data.Linq.Provider.Query.bk.b(MethodCallExpression A_0) +2389
   Devart.Data.Linq.Provider.Query.bk.j(Expression A_0) +335
   Devart.Data.Linq.Provider.Query.bk.i(Expression A_0) +61
   Devart.Data.Linq.Provider.DataProvider.a(Expression A_0) +165
   Devart.Data.Linq.Provider.DataProvider.h(Expression A_0) +166
   Devart.Data.Linq.DataQuery`1.i() +53
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +7667702
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +61]


Code calling:
Code: Select all
  var protocols = from p in Data.Context.Protocols
         from po in p.ProtocolOrganizations
         select new { p.Fcocode, SponsorName = po.GlobalOrganization.OrganizationName, p.Name, p.ProtocolPhase, p.ProtocolStatus };


The above errors, where as something like this, which is converting each table to IEnumerable and Linq to entities (.Current() eliminates history records stored in the table), works fine:

Code: Select all
  var protocols = from p in Data.Context.Protocols.Current()
         from po in p.ProtocolOrganizations.Current()
         select new { p.Fcocode, SponsorName = po.GlobalOrganization.OrganizationName, p.Name, p.ProtocolPhase, p.ProtocolStatus };


This happens on any Linq query and on any stored procedure/function, is there a problem with our model or another common cause?

Let me know which information is most useful for your debugging. We're going against Oracle XE in the development environment, is there something unsupported in the XE implementation itself?
Nahmis
 
Posts: 30
Joined: Mon 13 Jul 2009 21:38

Postby AndreyR » Tue 14 Jul 2009 10:02

Thank you for the report, we have already found this problem.
It is associated with stored procedures with out reference cursor parameters.
As a temporary workaround, you'll have to make the following changes in the generated code file for all procedures
having both out cursor parameter and the return type:
- set the return type of the method to void;
- remove the return clause;
- change the cursor parameter types from ref object to out IEnumerable; //this is an optional step, you can leave the objects, but it will result in
obtaining Readers instead of IEnumerables.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby Nahmis » Tue 14 Jul 2009 11:01

In this case Protocols is not a stored procedure or a function, it's a basic table. Any idea why I'm getting this error when we're just trying to get results from a table?

I can simplify the example down to this, same error:
Code: Select all
            
var protocols = from p in Data.Context.Protocols
                select new { p.Fcocode, p.Name, p.ProtocolPhase, p.ProtocolStatus };


However, this works:
Code: Select all
            
var protocols = from p in Data.Context.Protocols
                select p;

Same with the Current Where IQueryable modifier we have:

Code: Select all
            
var protocols = from p in Data.Context.Protocols.Current()
                select p;


Is this a general problem with returning anonymous types?
Nahmis
 
Posts: 30
Joined: Mon 13 Jul 2009 21:38

Postby AndreyR » Tue 14 Jul 2009 14:31

All the same the problem is associated with stored procedures.
No matter they are not called explicitly, there is an InitProcedures() method call inside the DataContext initialization after the first materialization of a query more complex than simple select.
AndreyR
Devart Team
 
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Postby Nahmis » Wed 15 Jul 2009 03:33

Thanks Andrey, that was the cause and the recommended changes both cleaned a bit of future code up and solved the current issue. Really appreciate the fast response.
Nahmis
 
Posts: 30
Joined: Mon 13 Jul 2009 21:38


Return to dotConnect for Oracle