cannot pass a SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProQuery(Of <anonymous type>) to user control

Posts   
 
    
KOL
User
Posts: 3
Joined: 09-Mar-2017
# Posted on: 09-Mar-2017 12:09:11   

Hi There, I've tried many different ways of doing this, using this code inside my user control works just fine:


 Dim qAssets = (From A In DataAccess.LinqMetaData.AssetTradingControl _
                                  Join AA In DataAccess.LinqMetaData.Assets On A.AssetId Equals AA.AssetId _
                                  Join I In DataAccess.LinqMetaData.InvestingFunds On A.Ifid Equals I.Fund _
                                  Join TT In DataAccess.LinqMetaData.AssetTranTypes On A.TransTypeId Equals TT.TranTypeId
                                  Select
                                  A.RecordId,
                                  A.AssetId,
                                  AA.AssetDesc,
                                  A.Ifid,
                                  Fund = If(I.Fund.Equals(Nothing), "All Funds", I.[Description]),
                                  TransactionType = If(TT.TranTypeId.Equals(Nothing), "All Transaction Types", TT.TranTypeDesc),
                                  LastTradingDate = If(A.LastTradingDate.Equals(Nothing), SQL_LOWDATE, A.LastTradingDate),
                                  NextTradingDate = If(A.NextTradingDate.Equals(Nothing), SQL_HIGHDATE, A.NextTradingDate),
                                  ControlStatus = If(If(A.NextTradingDate.Equals(Nothing), SQL_HIGHDATE, A.NextTradingDate) <= DateTime.Now.Date, "Expired", "Active"),
                                  A.CreationDate,
                                  A.CreatedBy,
                                  A.LastModifiedDate,
                                  A.LastModifiedBy
                                  Order By AssetId, NextTradingDate).AsQueryable

        e.QueryableSource = qAssets.Where(Function(x) x.RecordId > 160).AsQueryable()
        e.QueryableSource = qAssets.Where(Function(x) x.AssetId = 11).AsQueryable()

However the idea is that the query will be passed in from whatever form is using the control.

So in the form I have this code:



        Dim qAssets = From A In DataAccess.LinqMetaData.AssetTradingControl _
                               Join AA In DataAccess.LinqMetaData.Assets On A.AssetId Equals AA.AssetId _
                               Join I In DataAccess.LinqMetaData.InvestingFunds On A.Ifid Equals I.Fund _
                               Join TT In DataAccess.LinqMetaData.AssetTranTypes On A.TransTypeId Equals TT.TranTypeId
                               Select
                               A.RecordId,
                               A.AssetId,
                               AA.AssetDesc,
                               A.Ifid,
                               Fund = If(I.Fund.Equals(Nothing), "All Funds", I.[Description]),
                               TransactionType = If(TT.TranTypeId.Equals(Nothing), "All Transaction Types", TT.TranTypeDesc),
                               LastTradingDate = If(A.LastTradingDate.Equals(Nothing), SQL_LOWDATE, A.LastTradingDate),
                               NextTradingDate = If(A.NextTradingDate.Equals(Nothing), SQL_HIGHDATE, A.NextTradingDate),
                               ControlStatus = If(If(A.NextTradingDate.Equals(Nothing), SQL_HIGHDATE, A.NextTradingDate) <= DateTime.Now.Date, "Expired", "Active"),
                               A.CreationDate,
                               A.CreatedBy,
                               A.LastModifiedDate,
                               A.LastModifiedBy
                               Order By AssetId, NextTradingDate


        XFilterActionGrid1.qAssets = qAssets

and in the user control I have this:




#Region "Properties and variables"
    Public qAssets
#End Region


#Region "Methods"

    Private Sub LinqInstantFeedbackSource1_GetQueryable(ByVal sender As Object, ByVal e As DevExpress.Data.Linq.GetQueryableEventArgs) Handles LinqInstantFeedbackSource1.GetQueryable

        e.QueryableSource = qAssets.Where(Function(x) x.RecordId > 160).AsQueryable()
        e.QueryableSource = qAssets.Where(Function(x) x.AssetId = 11).AsQueryable()

    End Sub

and I get this error:

Public member 'Where' on type 'LLBLGenProQuery(Of VB$AnonymousType_39(Of Integer,Integer,String,Nullable(Of Integer),String,String,Nullable(Of Date),Nullable(Of Date),String,Nullable(Of Date),String,Nullable(Of Date),String))' not found.

Can you show me an example where a form can pass the query to a usercontrol and have it work? regards Kevin

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 09-Mar-2017 17:21:10   

You can't pass an anonymous type to another method, that's a limitation of anonymous types in general (e.g. you can't return them from a method either).

What's the llblgen pro runtime framework version you're using?

Frans Bouma | Lead developer LLBLGen Pro
KOL
User
Posts: 3
Joined: 09-Mar-2017
# Posted on: 09-Mar-2017 17:27:27   

v4.1

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39590
Joined: 17-Aug-2003
# Posted on: 10-Mar-2017 10:03:08   

KOL wrote:

v4.1

http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=12769

and I explained some things about anonymous types. Not really sure if that sheds some light on the matter, it now looks as if you haven't read it at all.

Frans Bouma | Lead developer LLBLGen Pro
KOL
User
Posts: 3
Joined: 09-Mar-2017
# Posted on: 10-Mar-2017 10:28:36   

Wow, thats an astonishing attitude to take with your customers. I read your post regarding anonymous types and yes it did help.

If your sending me that last link to complain that we are using an old version of Gem Pro, I have not control over that, and frankly I find your comment unkind, unnessasary and unprofesional.