Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > Bugs & Issues> Cannot call TVF with Linq
 

Pages: 1
Bugs & Issues
Cannot call TVF with Linq
Page:1/1 

  Print all messages in this thread  
Poster Message
WayneBrantley
User



Location:
USA
Joined on:
10-Mar-2006 16:20:08
Posted:
1112 posts
# Posted on: 16-Jan-2014 03:33:15.  
I am using self servicing with two classes.
I downloaded and installed the Jan 14, 2014 release date (build Nov 26, 2013). It contains 4.1.14.110 versions of the dlls. Everything compiles and function normally.

I mapped a TVF into my project.
It appears under 'Table Valued Function Calls' in the designer.
It also created a TypedView for the result of my function call - that typed view appears correct.
After creating the call definition, I originally got a validation error, because the 'return element' was not defined - no problem, I just selected the typedview you created for me.

I now generate code.
Under TypedViewClasses, I get the typed view for the function result.
Under FactoryClasses, I get TvfCallFactory and it creates the factory for this call.

I do NOT get anything else - the LinqMetaData.cs file does not have an entry so that I can reference my TVF. According to the docs, I should be able to do metaData.MyTableValueFunction(), but that does not work as that member does not contain TVF. I also cannot find any code that was generated to support this.

Please advise.
SelfServicing, .Net 4.5, Web Applications, SqlServer 2014  Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
8076 posts
# Posted on: 16-Jan-2014 07:00:30.  
If you want to use a TVF on linq, it should be mapped onto an entity. As explained in the docs .

Otherwise you must use QuerySpec. See this documentation section.


David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
WayneBrantley
User



Location:
USA
Joined on:
10-Mar-2006 16:20:08
Posted:
1112 posts
# Posted on: 16-Jan-2014 08:45:00.  
Well, I had already read that.
I have now read it like 5 more times.

So, you are saying that if the result of the function HAPPENS to be the same structure as an existing Entity, then it will show up under Linq?

IMHO, That is not 'explained' very well at all. This is also a pretty limiting factor as very few of my TVF would return an existing Entity. Sad

Really need to have this as a Linq option even though it maps to a typedview (that designer created). Of course we need typedviews as Linq items without mapping to an entity (or as I have suggested even supporting 'read only' entities - which are essentially views - but with full linq capabilities).

Anyway, I am just restating many of the suggestions I have already made to Otis Laugh

Thanks for your help.
SelfServicing, .Net 4.5, Web Applications, SqlServer 2014  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37561 posts
# Posted on: 16-Jan-2014 11:06:34.  
WayneBrantley wrote:
Well, I had already read that.
I have now read it like 5 more times.

So, you are saying that if the result of the function HAPPENS to be the same structure as an existing Entity, then it will show up under Linq?

No, you have to set the return type of the TVF call in the designer to an existing entity. This is possible, have an entity mapped onto a table and also on a tvf call result. The mappings for the tvf call result are done with the tvf call, the mappings to the table (normal mappings) are done in the normal mappings tab of the entity.

Quote:

IMHO, That is not 'explained' very well at all. This is also a pretty limiting factor as very few of my TVF would return an existing Entity. Sad

Linq only works with entities, so if a tvf call has to be called in linq, it has to return an entity. It's how the linq engine works (and it takes a tremendous amount of work to change that, so we're not doing that soon)

Quote:
Really need to have this as a Linq option even though it maps to a typedview (that designer created). Of course we need typedviews as Linq items without mapping to an entity (or as I have suggested even supporting 'read only' entities - which are essentially views - but with full linq capabilities).

We'll see what we can do. Read only entities are planned for v4.2, we haven't designed that feature yet, but you do bring up a good point: if the entity is the return type of a TVF, then it doesn't have to be mapped onto a table/view as it's already mapped, making it effectively a readonly entity.


Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
WayneBrantley
User



Location:
USA
Joined on:
10-Mar-2006 16:20:08
Posted:
1112 posts
# Posted on: 16-Jan-2014 16:58:20.  
Thanks for your consideration.

In addition if the TVF does not map to an entity........

When I create a call definition - it created a typed view and it maps to that and that is not in linq.
What would be nice is to have it create a 'read only' entity (a typed view) and have it map to that.

Essentially I want to do most things with linq.

Thanks again guys!
SelfServicing, .Net 4.5, Web Applications, SqlServer 2014  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37561 posts
# Posted on: 16-Jan-2014 17:40:33.  
Good point. We'll take that into consideration when we'll work on readonly entities, thanks for the ideas Regular Smiley

Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
WayneBrantley
User



Location:
USA
Joined on:
10-Mar-2006 16:20:08
Posted:
1112 posts
# Posted on: 28-Oct-2014 16:25:46.  
Dont use old threads...I know the rule, but if it is my thread and I have the exact same issue can I re-use it? Regular Smiley

I am now using 4.2 and it is supposed to support the above the best I can tell. I mapped my TVF and it created a new typedview for me. I marked it as poco.

The generated code now does exactly as I said above...what am I missing?

Note, I can select 'TypedDataTable' as the output and I get the typedview, so I guess I will use that for now.
SelfServicing, .Net 4.5, Web Applications, SqlServer 2014  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37561 posts
# Posted on: 28-Oct-2014 16:31:17.  
WayneBrantley wrote:
Dont use old threads...I know the rule, but if it is my thread and I have the exact same issue can I re-use it? Regular Smiley

I am now using 4.2 and it is supposed to support the above the best I can tell. I mapped my TVF and it created a new typedview for me. I marked it as poco.

The generated code now does exactly as I said above...what am I missing?

You said more than one thing above, so what exactly are you referring at, could you give an example of what code you did expect?

A linq poco typedview is present as a method in the LinqMetaData:

Code:
var q = from o in metaData.GetOrdersForCustomerTV("ALFKI")
        where o.EmployeeId == 4
        select o;



Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
WayneBrantley
User



Location:
USA
Joined on:
10-Mar-2006 16:20:08
Posted:
1112 posts
# Posted on: 28-Oct-2014 16:40:26.  
I mapped a TVF into my project.
It appears under 'Table Valued Function Calls' in the designer.
It also created a TypedView for the result of my function call - that typed view appears correct.
After creating the call definition, I originally got a validation error, because the 'return element' was not defined - no problem, I just selected the typedview you created for me.

I marked it as a LinqPoco

I now generate code.
Under TypedViewClasses, I get the typed view for the function result.
Under FactoryClasses, I get TvfCallFactory and it creates the factory for this call.

I do NOT get anything else - the LinqMetaData.cs file does not have an entry so that I can reference my TVF. According to the docs, I should be able to do metaData.MyTableValueFunction(), but that does not work as that member does not contain TVF. I also cannot find any code that was generated to support this.

Maybe I am missing a template in my definition or something?
SelfServicing, .Net 4.5, Web Applications, SqlServer 2014  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37561 posts
# Posted on: 28-Oct-2014 16:48:30.  
What build of the designer are you using? Could you try the latest build if it's not a recent one? The thing is that it might be related to an include template issue we had in earlier builds of the designer which could lead to an include template not being run and thus not generating the functions you need.

Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
WayneBrantley
User



Location:
USA
Joined on:
10-Mar-2006 16:20:08
Posted:
1112 posts
# Posted on: 28-Oct-2014 16:56:52.  
4.2.18.427

I cannot update it right now, but will update to the latest shortly.

Was the bug fixed after the version I show I am running?
(What template is it that causes this code to run - just want to make sure it shows as included)
SelfServicing, .Net 4.5, Web Applications, SqlServer 2014  Top
Walaa
Support Team



Location:

Joined on:
21-Aug-2005 16:03:48
Posted:
14498 posts
# Posted on: 28-Oct-2014 17:57:15.  
Quote:
4.2.18.427

What is the release date of the designer (help/about) ?


  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37561 posts
# Posted on: 28-Oct-2014 20:38:35.  
Bug was in the code generator + designer assemblies, so you need the last designer. The runtime isn't at fault here. Regular Smiley

It's the issue fixed on August 8th:
Quote:
.lpt templates which are marked as 'includeOnly' and which can't stand on their own as a separate class could lead to a crash during code generation because the templates were still converted as separate classes for include into TDL templates.


This crash issue showed when testing it that the include templates didn't run in some cases. To be sure, I have verified it again that they do now, our generated code for out tests has the right methods for the TVF mapped typed views in Linq.
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
WayneBrantley
User



Location:
USA
Joined on:
10-Mar-2006 16:20:08
Posted:
1112 posts
# Posted on: 29-Oct-2014 04:45:57.  
The designer says version is "4.2 final". That seemed vague to me, so I gave you version number 4.2.18.427 from the exe of the designer, as the help|about seemed vague.

I downloaded and installed it again, still says the same thing. 4.2 final, however now the version number of the exe is 4.2.14.915the

That version number I gave you 4.2.18.427 was from the exe of the designer, as the help|about does not show anything else!!

Now the version number of the exe is 4.2.14.915

Anyway, the important thing is now code is generated! Thanks.


SelfServicing, .Net 4.5, Web Applications, SqlServer 2014  Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37561 posts
# Posted on: 29-Oct-2014 09:27:07.  
WayneBrantley wrote:
The designer says version is "4.2 final". That seemed vague to me, so I gave you version number 4.2.18.427 from the exe of the designer, as the help|about seemed vague.

The designer build date is in the about screen and in the window title bar

Quote:

I downloaded and installed it again, still says the same thing. 4.2 final, however now the version number of the exe is 4.2.14.915the

That version number I gave you 4.2.18.427 was from the exe of the designer, as the help|about does not show anything else!!

Yes it does: 'Released on' and then a date, in help about. Same date as in the window title bar.

The version of the exe is less important for the designer, it's the build date.

Quote:
Now the version number of the exe is 4.2.14.915
Anyway, the important thing is now code is generated! Thanks.

Regular Smiley
Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.