Generate rlinq xml programatically

7 posts, 1 answers
  1. Dragos
    Dragos avatar
    4 posts
    Member since:
    Jun 2011

    Posted 03 Apr 2013 Link to this post

    Hi everyone,

    There is a way to generate rlinq xml file programmatically?

    Thank you in advance
  2. Kaloyan Nikolov
    Admin
    Kaloyan Nikolov avatar
    118 posts

    Posted 05 Apr 2013 Link to this post

    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 >>
  3. DevCraft banner
  4. Dragos
    Dragos avatar
    4 posts
    Member since:
    Jun 2011

    Posted 08 Apr 2013 Link to this post

    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. 

  5. Kaloyan Nikolov
    Admin
    Kaloyan Nikolov avatar
    118 posts

    Posted 09 Apr 2013 Link to this post

    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 >>
  6. Dragos
    Dragos avatar
    4 posts
    Member since:
    Jun 2011

    Posted 10 Apr 2013 Link to this post

    Unfortunately the generated rlinq is not a "truly" rlinq structure because there is no persistent types. It seems to contains just schema informations.
  7. Answer
    Kaloyan Nikolov
    Admin
    Kaloyan Nikolov avatar
    118 posts

    Posted 11 Apr 2013 Link to this post

    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 >>
  8. Dragos
    Dragos avatar
    4 posts
    Member since:
    Jun 2011

    Posted 11 Apr 2013 Link to this post

    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
Back to Top
DevCraft banner