Reserved words

Posts   
 
    
Rob
User
Posts: 54
Joined: 17-Sep-2004
# Posted on: 17-Sep-2004 13:59:26   

Hi,

I am still very new to the product. I have desperately tried to generate functioning code för my latest db. I still can't get it to work, but there is probably not a problem with the gen. I suspect I am using reserved works.

So I wonder, is there a list of reserved works I can reference? I am also curious if this problem is automatically solved in the new beta?

regards,

!Rob

Rob
User
Posts: 54
Joined: 17-Sep-2004
# Posted on: 17-Sep-2004 14:02:18   

hmm, I didn't mean to create this thread under bugs. I am obviously new to the forum as well...

!R

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 17-Sep-2004 14:15:51   

I've moved your thread to the generated code forum simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 17-Sep-2004 14:18:42   

Rob wrote:

Hi,

I am still very new to the product. I have desperately tried to generate functioning code för my latest db. I still can't get it to work, but there is probably not a problem with the gen. I suspect I am using reserved works.

So I wonder, is there a list of reserved works I can reference? I am also curious if this problem is automatically solved in the new beta?

You shouldn't use a name for an entity which is part of a .NET class name ending with Collection. So if you name your entity 'Property' and you generate code, you'll end up with 'PropertyCollection', which is a .NET class as well. There are other examples as well.

What's the name you're using that makes your code not compiling?

Frans Bouma | Lead developer LLBLGen Pro
Rob
User
Posts: 54
Joined: 17-Sep-2004
# Posted on: 17-Sep-2004 19:54:02   

Hi!

The words so far are Entity and Transaction. SQLserver has no problem with it so I did not suspect the Gen would. I am not sure whether I have problems with further words as well since VS gives up reporting problems after a certain number of errors.

Is there a list of reserved words?

Or is there a square bracket scenario. Like in SQL-server where you can name i.e. a field anything as long as it is in brackets [UPDATE].

!Rob

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 18-Sep-2004 11:04:24   

Rob wrote:

The words so far are Entity and Transaction. SQLserver has no problem with it so I did not suspect the Gen would. I am not sure whether I have problems with further words as well since VS gives up reporting problems after a certain number of errors.

Transaction clashes with the Transaction class in the helperclasses namespace. I don't see with which class 'Entity' would clash though.

Is there a list of reserved words?

No, there isn't such a list.

Or is there a square bracket scenario. Like in SQL-server where you can name i.e. a field anything as long as it is in brackets [UPDATE]. !Rob

That's not useful and results in ugly code. Not useful because some languages don't support this construct and in theory the generated code can be used in whatever .NET language that's out there... (that's also the reason why all checks are done case-insensitive to prevent clashes in case insensitive languages like VB.NET

Frans Bouma | Lead developer LLBLGen Pro
Rob
User
Posts: 54
Joined: 17-Sep-2004
# Posted on: 20-Sep-2004 02:28:07   

I do seem to have a bunch of problems using Entity as well actually. But the problem could perhaps be originate in Transaction in some earlier instance?

If I was to change the word Transaction to MoneyTransaction, would that solve my problem?

There reason I ask, instead of trying myself, is that I have 130 tables in the solution and very many relations to the Transaction and Entity tables, which means I have to manually try to find all of these in the GUI. And since it finds hundreds of "false" many to many relations it is not funny to go in and disable and rename them all just in order to find out the answer to my above question.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 20-Sep-2004 10:28:09   

Rob wrote:

I do seem to have a bunch of problems using Entity as well actually. But the problem could perhaps be originate in Transaction in some earlier instance?

If I was to change the word Transaction to MoneyTransaction, would that solve my problem?

The problem is this: an entity has fields mapped onto relations with other entities. These fields will become properties in the entity class. So if an entity Foo has a field 'Transaction' mapped on its relation with the Transaction entity, the FooEntity class will get a property called 'Transaction'.

The base class of the entity already has a property called 'Transaction'. This means that the new property hides the property of the base class.

To find out which properties are not allowed (or are defined in the base class), please consult the reference manual: open the ORMSupportClasses book and if you use adapter, check EntityBase2, otherwise check EntityBase.

To avoid name clashes, all classes are suffixed with 'Entity' or other suffix, so most of the time there are no problems.

There reason I ask, instead of trying myself, is that I have 130 tables in the solution and very many relations to the Transaction and Entity tables, which means I have to manually try to find all of these in the GUI. And since it finds hundreds of "false" many to many relations it is not funny to go in and disable and rename them all just in order to find out the answer to my above question.

Delete the entity from the project, for example the Transaction entity. Then re-add it and in the add screen, give it another name, then click OK. The names of the fields mapped on the relations with this entity in other entities are now based on the new name of the entity, so you don't have to rename all these entities.

You can 'hide' the m:n relations you don't want (hide both sides) in the editor of an entity.

(edit) I've added to the todo a better name checking routine, which consults the latest runtime lib base classes for name clashes and it should then adjust the name accordingly.

Frans Bouma | Lead developer LLBLGen Pro