Multiple schemas with the same table names

Thread is closed for posting
2 posts, 1 answers
  1. Simon
    Simon avatar
    3 posts
    Member since:
    Feb 2014

    Posted 11 May 2014 Link to this post

    I have multiple schemas with the same tables name i.e.
    When I create a domain model using the 'Generate in Nested Namespaces' option it generates the following classes
    Is there a way to edit the templates to stop it adding the 1?
  2. Answer
    Kristian Nikolov
    Kristian Nikolov avatar
    206 posts

    Posted 14 May 2014 Link to this post

    Hi Simon,

    The behavior you are experiencing is normal for Telerik Data Access. Even when the persistent classes have different namespaces due to selecting the Use schema names for namespaces and/or Generate in Nested Namespaces options Telerik Data Access requires that the classes have unique names. This is the reason why a number is appended to the name of one of the persistent classes.

    To avoid the numeral suffix, you could add the schema name as a prefix. To do this for classes already present in your model you could use the Model Operations dialog:
    1. Open the Model Operations dialog.
    2. Select Entities as the Display Mode.
    3. Select all required entities from the grid.
    4. From the Operations drop-down select Rename Classes.
    5. Check the Add Schema Name as Prefix check-box.
    6. Click the Execute button.

    This will add the name of the schema to the classes of your model. Then you would be able to remove the numeral suffix from your classes.

    To enable this option for classes which you add to the model from the database at a later point, you need to set the Add Schema Name as Prefix option in the Model Settings Dialog at the Model Names screen. With this configuration, newly added classes (due to an update from the database) will not have a numeral suffix even if the names of their respective tables match.

    I hope this helps. Feel free to post at our forums again in case you have additional questions.

    Kristian Nikolov
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
Back to Top