Reserved Keywords problem

8 posts, 0 answers
  1. Erik
    Erik avatar
    314 posts
    Member since:
    Feb 2008

    Posted 03 Apr 2011 Link to this post

    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
  2. PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 06 Apr 2011 Link to this post

    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
  3. DevCraft banner
  4. Erik
    Erik avatar
    314 posts
    Member since:
    Feb 2008

    Posted 06 Apr 2011 Link to this post

    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
  5. PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 06 Apr 2011 Link to this post

    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
  6. Erik
    Erik avatar
    314 posts
    Member since:
    Feb 2008

    Posted 07 Apr 2011 Link to this post

    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...
  7. PetarP
    Admin
    PetarP avatar
    754 posts

    Posted 12 Apr 2011 Link to this post

    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
  8. Erik
    Erik avatar
    314 posts
    Member since:
    Feb 2008

    Posted 12 Apr 2011 Link to this post

    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

  9. Damyan Bogoev
    Admin
    Damyan Bogoev avatar
    581 posts

    Posted 15 Apr 2011 Link to this post

    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
Back to Top
DevCraft banner