This project is read-only.

Linq Intellisense Not Working

May 9, 2010 at 4:11 PM

I'm sure what I'm battling is an environment issue but as everyone was once new too nHydrate like me I thought I'd start here.


So far I've followed the videos and have everything to generated but I can't get the linq stuff working to save my life.  If I follow an example like this:


CustomerCollection customerCollection =
CustomerCollection.RunSelect(x=>x.BaseName == "SomeValue");


intellisense wants to turn all my x's into xhtmlmobiledoctype and when I manage to get the syntax typed in it tells me that ..Business.objects.X is not accessible because it is 'Friend'.

Can anyone help me get my vs2008 setup right.  I'm really anxious to get using this but something simple is holding me back.

Thanks in advance,


May 9, 2010 at 7:03 PM

I have looked at this with a simple project but have no answer off the bat. You need to be able to use LINQ of course. I even removed the "System.Data.Linq" assembly from my test project but it still worked.

Please zip your projects, generated code, sample project and all and send to I think that this is something simple but I need to look at it.

May 10, 2010 at 1:44 PM

I think the problem will likely be found between my chair and my keyboard.  I was trying to use c# code samples in a vb project. 

I've sent the project and I'd be delighted if you were able to show me the proper syntax but don't feel obligated if it is actually something that dumb. 

Thanks again

May 10, 2010 at 2:57 PM

The issue is the lambda syntax. Please read up on LINQ using VB.NET. I am not that well versed in VB.NET LINQ however I did put this together for you. The following code hits your database and pulls back all "Branch" objects with a branchId greater than 1.

Dim q As BranchCollection
q = BranchCollection.RunSelect(New Func(Of BranchQuery, Boolean)(Function(x As BranchQuery) x.Branchid > 1))

Also I notice that your database installer does not work. In your views (and stored procedures if you had any) please do NOT append the "Create View" syntax to the SQL. The SQL field fould be the actual SQL and not any DDL. All the create, updates, deletes, etc will be handled by the generator.

May 10, 2010 at 9:12 PM

Thanks so much.  The vb linq syntax is pretty lousy compared to c#.  Yikes.  I haven't even dug into the installer part of this yet.  I think I'll be handling that part manually until I get a better handle on it.

Thanks so much.  Great framework with great support.  What's not to like?!?!?!

May 10, 2010 at 11:00 PM
You will need to run the installer since it installs many stored procedures you need to run queries from the framework. All non-LINQ queries are run through the generated stored procedures.
May 13, 2010 at 12:34 AM

I'm doing what I can to get a handle on Linq and  The sample that you provided above didn't work for some reason though.  It didn't know what a BranchQuery was.  In the func it shows all that as a type but it doesn't let me select it or even enter it.  I couldn't find anything with Query at the end of it.  Collection and search but no Query.

I just ran the thing against the database I had and didn't do anything with the sql, I think it just pulled that in on it's own.  Are you saying that I can delete the "Create View dbo.GetParents As" and just leave the select?  That's cool.


May 13, 2010 at 6:32 PM

As to views the answer is yes, you should not add an SQL that creates the view. Just enter the selection query. The genreator handles the add/delete stuff. Also as to not seeing the XXXQuery object. I added an Imports statement to the top. If you do not do that it will not find the object. You can import the absolute namespace or prefix the object with the name space, which is something like Acme.Sales.Business.LINQ.CustomerQuery. It is like that with your company name, project name, etc.