TypedView With linq not work

Posts   
 
    
MGrassman
User
Posts: 7
Joined: 11-Dec-2006
# Posted on: 15-Jan-2009 22:26:13   

Please disreguard this is already answered and is not doable.

Am I missing something or is this not allowed on a TypedView?

var query = from p in ProjectActiveByUserIdTypedView where p.UserId == userId select new ProjectFields { RecId = p.RecId, Name = p.Name, Description = p.Description, StartDate = p.StartDate.Value, EndDate = p.EndDate.Value, PercentComplete = p.PercentComplete.Value

                    };

The error I receive states Error 1 Could not find an implementation of the query pattern for source type 'HITracker.DAL.TypedViewClasses.ProjectActiveByUserIdTypedView'. 'Where' not found. Are you missing a reference to 'System.Core.dll' or a using directive for 'System.Linq'? C:\Users\mgrassman.dswd\Documents_Development\SilverLight\HI Tracker\HI Tracker.Web\ProjectService.svc.cs 67 35 HI Tracker.Web

Both of the references are in my page.

Thanks,

Freddy V
User
Posts: 11
Joined: 05-Feb-2009
# Posted on: 05-Feb-2009 16:34:15   

I received exactly the same error today. I'm using self Servicing, 2 classes generated code.

The funny thing is that I can get the query to work by moving these few lines of code to a class file inside my web application that is referencing the LLBL generated project. But if I put this code in the user_code_region in the LLBL generated Entity class, it fails. However I can make the error disappear by commenting the "using SD.LLBLGen.Pro.ORMSupportClasses;" directive, alas, firing up 2 other errors instead concerning IValidator and IprefetchPath not being found.

Please help.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 06-Feb-2009 07:02:34   

Hi Freddy,

I don't understand what you mean. Please take a look at the LINQ2LLBL Preface and LinqMetadata to understand the difference between LINQ2LLBL and LINQ2Objects.

David Elizondo | LLBLGen Support Team
Freddy V
User
Posts: 11
Joined: 05-Feb-2009
# Posted on: 09-Feb-2009 15:09:27   

Yep, been there, read that simple_smile I do use linq to llbl

When I copy the example code of the help page to no matter what entity class inside the LLBL generated project, I get the error that I mentioned. (I did change the entity names of course) If I copy the same code to my aspx.cs class, it works, and it does what I want it to do!

It must be a matter of references.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 10-Feb-2009 04:46:49   

Could you please show us an example of what you mean?

Additionally, if you are using Adapter TemplateSet, be aware that putting persistence logic into Entity Classes will fail as Adapter isn't designed for that.

If you are using SelfServicing, it's likely you are missing a "using/Import" clause to "SD.LLBLGen.Pro.LinqSupportClasses".

David Elizondo | LLBLGen Support Team
Freddy V
User
Posts: 11
Joined: 05-Feb-2009
# Posted on: 12-Feb-2009 10:24:19   

I'm using selfservicing code (Preset: SD.Presets.Selfservicing.TwoClasses2008 )

The code example in my case is in the DL.EntityClasses.ActionEntity :


// __LLBLGENPRO_USER_CODE_REGION_START CustomEntityCode
public void setSequenceNr() {
            DL.Linq.LinqMetaData metaData = new DL.Linq.LinqMetaData();
            var results = from RCARecord in metaData.RcaRequest
                          where RCARecord.Closed == false || RCARecord.Closed == null
                          select RCARecord;

...

        }
// __LLBLGENPRO_USER_CODE_REGION_END

The text "metaData.RcaRequest" is underlined and the error message is:

Error   57  Could not find an implementation of the query pattern for source type 'SD.LLBLGen.Pro.LinqSupportClasses.DataSource<RCATool.DL.EntityClasses.RcaRequestEntity>'.  'Where' not found.  Are you missing a reference to 'System.Core.dll' or a using directive for 'System.Linq'?  d:\Projects\x\DL\EntityClasses\ActionEntity.cs  114 45  RCATool.DL

adding this, doesn't help:

using SD.LLBLGen.Pro.LinqSupportClasses;
Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 12-Feb-2009 11:02:06   

Try to add:

using System.Linq;
Freddy V
User
Posts: 11
Joined: 05-Feb-2009
# Posted on: 12-Feb-2009 13:55:52   

Walaa wrote:

Try to add:

using System.Linq;

OK, we have a winner. That made the difference.

Tnx Walaa!