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

Adding multiple .rlinq files into one

1 Answer 99 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Yug J
Top achievements
Rank 1
Yug J asked on 15 Jul 2013, 02:32 PM
Hi,
I've multiple .rlinq files (EntityModels) in my solution. Now, I want to add those file content into a single .rlinq file. Please let me know how I can do it.

Thanks!

1 Answer, 1 is accepted

Sort by
0
Doroteya
Telerik team
answered on 18 Jul 2013, 02:44 PM
Hi Jug J,

Generally, it is possible to combine a few .rlinq files into one, if their underlying database is the same. The point here is that every domain model is managed by a context class which can be instantiated only for the database that holds its storage model.

If the condition for the underlying database is satisfied, you can apply one of the following approaches:
- Manually edit the XML representation of one of the .rlinq files, enhancing it with the XML content of the others - the benefit here is that you will preserve all the custom adjustments made in these models. This process, however, will not create any relations between the already existing objects and the integrated ones. The risk in this case is to duplicate parts of the XML code. 
Update one of the domain models through the Update from Database wizard - the benefit from this approach is a seamless integration of the domain models into one and creation of the appropriate associations. The manual effort here is to adjust the newly imported classes so that their settings match the settings from the other models.

If you choose to use the first approach, you can apply the following steps:
1. Open the target .rlinq file (the one that you will integrate into) in the XML editor.
2. Open the source .rlinq file (the one that will be integrated into the target) in the XML editor.
3. To create all the classes in one namespace copy the content of each <orm:namespace> tag from the source file inside the <orm:namespace> tag of the target file. To create them in different namespaces copy the entire <orm:namespace> tag from the source file after the <orm:namespace> tag of the target file and delete the default="true" attribute of the newly added content.
4. Copy the content of the <orm:schema schema=""> tag from the source file after the content of the same tag in the target file. Also copy all the <orm:schema schema="schema_name"> tags from the source file after the <orm:schema schema=""> tag in the target file (if there are any).
5. Copy the entire content of the <Types> tag from the source file in the <Types> tag of the target file.
6. Edit the namespace attribute of the newly copied <DomainClass> tags so that their values match the namespaces they will reside in in the target file.
7. Copy all the <entitySetProperty> tags from the source file in the <domainContainer> tag of the target file.
8. Edit the namespace attribute in each of the newly added <entitySetProperty> tags appropreately.
9. Save the target file.
10. In Solution Explorer, delete the .diagram file under the target file.
11. Open the target file in Visual Designer and click the Layout Diagram button to arrange the classes.
12. Save the target file.
13. In Solution Explorer, select Show All Files and include the newly created .diagram file in the project

At this point, if you have achieved the necessary result, you can delete the source .rlinq file, so that the code generated for the target is buildable.

Repeat the process for the rest of the .rlinq files.

I hope this helps. If you have additional questions, do not hesitate to get back to us. 



Regards,
Doroteya
Telerik
OpenAccess ORM Q2 2013 brings you a more powerful code generation and a unique Bulk Operations support with LINQ syntax. Check out the list of new functionality and improvementsshipped with this release.

Tags
Data Access Free Edition
Asked by
Yug J
Top achievements
Rank 1
Answers by
Doroteya
Telerik team
Share this question
or