This is a migrated thread and some comments may be shown as answers.

Reserved Keywords problem

7 Answers 28 Views
Feature Requests
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Erik
Top achievements
Rank 2
Erik asked on 03 Apr 2011, 01:56 PM
Hi,


I have an entity that exposes a property "ReadOnly". Because this is an reserved keyword in VB, the IDE throws an error.

I think a simple solution is to put the name of the property between brackets: 
    Public Overridable Property [Readonly] As Integer

for just C#/VB.NET keywords of all of them.

Regards,


Erik

7 Answers, 1 is accepted

Sort by
0
PetarP
Telerik team
answered on 06 Apr 2011, 03:59 PM
Hello Erik,

 How you have added this property to your model? Did you add it on hand via the add property option in the dsl designer? If that is the case please be aware that currently we are not validating user added properties. At the moment we validate (and correct where needed) properties that are added when you reverse map an already existing table. So for example if in your database you had a column ReadOnly you would have gotten __readOnly for field and _ReadOnly for property names.

Greetings,
Petar
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Erik
Top achievements
Rank 2
answered on 06 Apr 2011, 04:05 PM
Hi Petar,

No, it's is a column in my database table (sql server) (ReadOnly as bit)
I did not add it, the model creates the entity with the property name "ReadOnly".

I do update from database, and then the property "ReadOnly" is created by the model, what of course triggers an error, because it is a reserved word in VB.NET. When put between brackets [ReadOnly] this would not be the case.

Thanks,

Erik
0
PetarP
Telerik team
answered on 06 Apr 2011, 04:30 PM
Hello Erik,

 I have exactly the same setup. I have a column of type bit that is named ReadOnly in my database. I am using two approaches when I try to reproduce your case.
1. I reverse map the table from the start.
2. I update my model after intentionally skipping the ReadOnly column on the first adding.
Both approaches produce this result:

Private __readOnly As Boolean
   Public Overridable Property _ReadOnly As Boolean
       Get
           Return Me.__readOnly
       End Get
       Set(ByVal value As Boolean)
           Me.__readOnly = value
       End Set
   End Property
Please note that I am using the latest internal build that is uploaded to our website.


Greetings,
Petar
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Erik
Top achievements
Rank 2
answered on 07 Apr 2011, 10:44 AM
Hi Petar,

In my build 325 I created a new proj, add a new model with a table Test and a field ReadOnly. Then I get __ReadOnly as a property. So far so good... Then I add a new field in sql server, call it "Function" and do a "Update from database" in de model. Then I get Function and not _Function:

Private __ReadOnly As String
Public Overridable Property _ReadOnly As String
    Get
        Return Me.__ReadOnly
    End Get
    Set(ByVal value As String)
        Me.__ReadOnly = value
    End Set
End Property
 
Private _Function As Boolean?
Public Overridable Property Function As Boolean?
    Get
        Return Me._Function
    End Get
    Set(ByVal value As Boolean?)
        Me._Function = value
    End Set
End Property

So, it seems to be a problem with the update from db feature...
0
PetarP
Telerik team
answered on 12 Apr 2011, 04:41 PM
Hi Erik,

 I have managed to reproduce the false behavior you have encountered and we will address it as soon as possible. Thank you for your help and please find your Telerik points updated for bringing this issue to our attention.

Regards,
Petar
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Erik
Top achievements
Rank 2
answered on 12 Apr 2011, 05:14 PM

Hi Petar,

Great! that's fine.

But my question remains... why not put in between brackets (Public Property [Readonly] as Boolean)?
now I can't find my property... (not realy of course)

Regards,

Erik

0
Damyan Bogoev
Telerik team
answered on 15 Apr 2011, 04:49 PM
Hi Erik,

Currently if the provided identifier is not valid it will be prepended with an underscore. I am afraid that for time being we do not use language specific escape characters to escape the invalid identifier.
I am sorry for the inconvenience caused.

Regards,
Damyan Bogoev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Feature Requests
Asked by
Erik
Top achievements
Rank 2
Answers by
PetarP
Telerik team
Erik
Top achievements
Rank 2
Damyan Bogoev
Telerik team
Share this question
or