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

Multiple schemas with the same table names

1 Answer 305 Views
Design Time (Visual Designer & Tools)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Simon
Top achievements
Rank 1
Simon asked on 11 May 2014, 07:49 PM
I have multiple schemas with the same tables name i.e.
Sales.OrderHeader
Purchase.OrderHeader
When I create a domain model using the 'Generate in Nested Namespaces' option it generates the following classes
Sales.OrderHeader
Purchase.OrderHeader1
Is there a way to edit the templates to stop it adding the 1?

1 Answer, 1 is accepted

Sort by
0
Accepted
Kristian Nikolov
Telerik team
answered on 14 May 2014, 11:05 AM
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.


Regards,
Kristian Nikolov
Telerik
 
OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
 
Tags
Design Time (Visual Designer & Tools)
Asked by
Simon
Top achievements
Rank 1
Answers by
Kristian Nikolov
Telerik team
Share this question
or