Cannot compile Generic-project

Posts   
 
    
Stephan
User
Posts: 63
Joined: 16-Jan-2007
# Posted on: 20-Jul-2009 17:47:00   

I feel kind a stupid, but I cannot compile my newly created project. I have nothing special. Only five or six table. Using LLBLGen 2.6, TwoClasses template. Select 3.5 as target framework. Created the projects in an empty folder, but when I try to compile I get a lot of errormessages:

like: Error 19 An object reference is required for the non-static field, method, or property 'TimeSheet.EntityClasses.UrenEntity.TimeSheet.get' C:\Users\Stephan\Projects\LLBLGen-LiemersCare.source\DatabaseGeneric\EntityClasses\UrenEntity.cs 590 66 TimeSheet

and: Error 18 'TimeSheet.EntityClasses.TimeSheetEntity' does not contain a definition for 'EntityType' and no extension method 'EntityType' accepting a first argument of type 'TimeSheet.EntityClasses.TimeSheetEntity' could be found (are you missing a using directive or an assembly reference?) C:\Users\Stephan\Projects\LLBLGen-LiemersCare.source\DatabaseGeneric\EntityClasses\ReiskostenEntity.cs 441 66 TimeSheet

and: Error 1 'SD.LLBLGen.Pro.LinqSupportClasses.DataSource2<TimeSheet.EntityClasses.MyTimeSheetEntity>' does not contain a definition for 'EntityType' and no extension method 'EntityType' accepting a first argument of type 'SD.LLBLGen.Pro.LinqSupportClasses.DataSource2<TimeSheet.EntityClasses.MyTimeSheetEntity>' could be found (are you missing a using directive or an assembly reference?) C:\Users\Stephan\Projects\LLBLGen-LiemersCare.source\DatabaseGeneric\Linq\LinqMetaData.cs 64 20 TimeSheet

I think I miss somehting basic here. But simpler than this project I cannot create. So what did I overlook, of miss in this case. Any help is appreciated.

Stephan
User
Posts: 63
Joined: 16-Jan-2007
# Posted on: 20-Jul-2009 17:50:09   

Ok, I found it.

The problem was cause by the fact I named the namespace of my project TimeSheet. Seems this cause problems because on of my objects (tables) is also called TimeSheet.

I renamed, set the namespace to DAL.TimeSheet and now it compiles. I'm curious however if this is a bug.

So is this behaviour as expected or is it a bug.

Thx

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 20-Jul-2009 18:41:59   

In general C# code, you also can't name your namespace the same as a class, as the compiler then gets confused: did you mean the namespace (which means an error) or the class? It doesn't check for this, if that's what you're asking. Rule of thumb: don't name your entities and fields similar to normal .NET classes nor give the rootnamespace the same name as one of the elements in a project or a .NET class (as that's also a possibility which will not compile).

Frans Bouma | Lead developer LLBLGen Pro
Stephan
User
Posts: 63
Joined: 16-Jan-2007
# Posted on: 20-Jul-2009 19:30:25   

Hi Otis, that is what i meant. I named the rootnamespace the same as one of my tables (TimeSheet in this case).

This caused the problem.

Thankx