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

Generate rlinq xml programatically

6 Answers 112 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.
Dragos
Top achievements
Rank 1
Dragos asked on 03 Apr 2013, 10:07 AM
Hi everyone,

There is a way to generate rlinq xml file programmatically?

Thank you in advance

6 Answers, 1 is accepted

Sort by
0
Kaloyan Nikolov
Telerik team
answered on 05 Apr 2013, 01:00 PM
Hi Dragos,

For the time being Telerik OpenAccess ORM does not provide an API automating the RLINQ file generation.


Could you please specify your particular business need in further details, we might be able to advice you how to achieve it in another way.

Please do not hesitate to contact us again if you have any other questions. 
 

Kind regards,
Kaloyan Nikolov
the Telerik team
Using Encrypted Connection Strings with Telerik OpenAccess ORM. Read our latest blog article >>
0
Dragos
Top achievements
Rank 1
answered on 08 Apr 2013, 08:22 AM

Hi Kaloyan,

Thank you for the answer.

I have a classical 3-tier, multi layer (on app side) solution.
I'm in a process of switching the ORM from EF to OpenAccess (with Database First scenario).I have a few of code generators for all layers(Repos,UnitOfWorks,Contexts,Filtering,Sorting,Mappers,Keys,Services so) and all of these use like a source my own xml structure.This structure is generated from rlinq(ex edmx) xml files (different databases) with your metadata structure (MetadataContainer, MetaPersistentType so).I have a template "controller" responsible for running all templates in a proper order.In order to automate the code resync with databases changes this template "controller" use EdmGen tool and I was looking for a similar tool from Telerik. 

0
Kaloyan Nikolov
Telerik team
answered on 09 Apr 2013, 03:42 PM
Hello Dragos,

In your scenario I suppose you can use our Add New Item Wizard to generate the RLINQ file in database first cases. Also Telerik OpenAccess ORM provides very helpful Web Services generation wizard based on the RLINQ file. Probably these functionalists are similar to the code you have and you can directly use them instead of you generators. 

If  for some reason you need to do it pragmatically I am attaching a simple project demonstrating how you can read the database schema and generate the RLINQ content from it. The sample uses the same infrastructure that helps the OpenAccess ORM Add New Item Wizard to generate the RLINQ file. 

Example:

BackendConfiguration backendConfiguration = new BackendConfiguration()
{
    Backend = "MsSql",
    Driver = "genericADO2",
    ProviderName = "System.Data.SqlClient"
};
 
string connectionString = "Data Source=.\\sqexpress;Initial Catalog=BookLibrary;Integrated Security=True";
 
OpenAccessSchemaReader schemaReader = new OpenAccessSchemaReader(backendConfiguration, connectionString);
 
var schemas = schemaReader.GetSchemas();
SchemaReadParameters parameters = new SchemaReadParameters(schemas);
 
string rlinqContent = schemaReader.ReadSchema(parameters);

I hope that helps. Do not hesitate to contact us again if you have any other questions.


All the best,
Kaloyan Nikolov
the Telerik team
Using Encrypted Connection Strings with Telerik OpenAccess ORM. Read our latest blog article >>
0
Dragos
Top achievements
Rank 1
answered on 10 Apr 2013, 11:33 AM
Unfortunately the generated rlinq is not a "truly" rlinq structure because there is no persistent types. It seems to contains just schema informations.
0
Accepted
Kaloyan Nikolov
Telerik team
answered on 11 Apr 2013, 04:09 PM
Hi Dragos,

I updated the sample application (see the attachment). Now it performs our Default Map procedure as a result in the Rlinq file you can find information about the classes to be generated (property names and property types, etc.). You can feed your code generators with this information to generate the entities and all assets you need.

To get the sample working ensure the reference to:
<Open Acces ORM Installation folder>\dsl2012\Telerik.OpenAccess.Dsl.11.dll

NOTE: the default map procedure doesn't handle Stored Procedures and Functions, they should be mapped manually.

I hope this will help you.

Kind regards,
Kaloyan Nikolov
the Telerik team
Using Encrypted Connection Strings with Telerik OpenAccess ORM. Read our latest blog article >>
0
Dragos
Top achievements
Rank 1
answered on 11 Apr 2013, 05:07 PM
Hi again Kaloyan,

I highly appreciate your effort.
Thank you very much.
It's all I wanted.
Now I can resynchronize all (generated) code with one single action.

Regarding your note. It's ok.The Stored Procedures and Functions are mapped manually

Best regards,
Dragos
Tags
Design Time (Visual Designer & Tools)
Asked by
Dragos
Top achievements
Rank 1
Answers by
Kaloyan Nikolov
Telerik team
Dragos
Top achievements
Rank 1
Share this question
or