Namespace name generation with general namespace prefix

4 posts, 0 answers
  1. Mathieu
    Mathieu avatar
    21 posts
    Member since:
    Feb 2014

    Posted 14 Jan 2015 Link to this post

    Hello,

    I am using the Telerik Data Access Domain Model wizard to create a model from an exsting database (SQL Server).

    My database contains several schemas, and I want to be able to generate the following structure, but I haven't managed to do so:

    Say my C# project name is "MyProject.Data" (Class library)

    Inside that project I create a new Telerik Data Access domain model.

    I want the wizard to be able to generate the classes with the "MyProject.Data" namespace as prefix.

    So say I have 3 namespaces inside my database that I wish to include tables from (dbo, Sales, Production), I want the dbo entities to go into the root namespace MyProject.Data. I want the sales entities go into MyProject.Data.Sales and I want the production entities to go into MyProject.Data.Production.

    I tried to achieve that with checking "use different namespaces for schemas", but it only generate namespace names like "Sales" and "Production", and not with the "MyProject.Data" prefix.

    Can this be achieved with the current version of Telerik DataAccess ? If not, is it something you could look into supporting in a future version ?

    Thanks
  2. Boyan
    Admin
    Boyan avatar
    100 posts

    Posted 18 Jan 2015 Link to this post

    Hi Mathieu,

    This is a known limitation of the namespace generation. Luckily there is an easy workaround for it. You could use the Model Operations dialog that allows you to execute a number of operations on multiple classes part of your model at the same time. Please refer to this documentation article for more information.

    In order to adjust the namespaces of the classes corresponding to tables from a given schema, please follow those steps:
    1. Right click in the diagram background and select Model Operations... .
    2. On the left side you will notice a Search panel - please expand Table and through the Schema text-box filter out all classes corresponding to a given Schema
    3. Select all of those classes from the grid in the middle section.
    4. From the Operations panel located on the right, select the Change Namespace operation and in the New Namespace text-box specify the desired namespace.
    5. Repeat steps 2 to 4 for all schema.

    Once ready with adjusting the namespaces in order for those changes to come into effect, please make sure to re-save .rlinq (the diagram) file so the code generation is triggered updating your domain classes.

    Please note that should you update the model, the specified namespaces will remain for the existing classes. This means that you should adjust the namespaces for newly added classes and possibly also re-adjust the namespaces to reflect future changes made in the database schema.

    Should you have any more questions do not hesitate to get back to us.

    Regards,
    Boyan
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
  3. DevCraft banner
  4. Mathieu
    Mathieu avatar
    21 posts
    Member since:
    Feb 2014

    Posted 18 Jan 2015 in reply to Boyan Link to this post

    Dear Boyan,

    thank you for your reply and your workaround instructions. I will test them out.

    Any chance that this limitation could be fixed in future releases of Telerik DataAccess ? Would be a good feature I think.

    Thank you
  5. Boyan
    Admin
    Boyan avatar
    100 posts

    Posted 21 Jan 2015 Link to this post

    Hi Mathieu,

    Thank you for your input.
    If this a feature that you could really like to see implemented in Telerik Data Access could I kindly ask you to create new item at our Ideas & Feedback Portal describing the functionality you would like to have. Voting for it would help us prioritize it and eventually schedule it for implementation.

    Do let us know if you need any further assistance.

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