6 Answers, 1 is accepted
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.
Kaloyan Nikolov
the Telerik team
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.
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
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.
Kaloyan Nikolov
the Telerik team
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