Telerik blogs

We've been working on a lightweight code generation tool for Telerik Data Access. Here is a sneak peek at what's ahead.

We're happy to share that the tool for code generation of Data Access fluent models is already in development. As promised in our communication with you, we are working on a lightweight Fluent Model generator. It will be capable of:

  • Generating new fluent models based on the schemata of your databases
  • Updating existing fluent models with the changes in the respective databases

You will be able to easily integrate the Fluent Model generator in your applications, as we plan to package it in a new Telerik Data Access NuGet package. Furthermore, you will be able to bend the tool any way you please, because it will be an open-source project in GitHub.

At its core, the tool is a PowerShell script capable of reading the schema of your database and generating the appropriate persistent classes, a metadatasource and a context class. Although it sounds simple, the choice of PowerShell is not an arbitrary one. This approach permanently breaks the coupling between the Data Access code generation capabilities and Visual Studio.

As a result, you have code generation with Visual Studio 2010, 2012, 2013, 2015, and whatever comes next without the complications related to the T4 templates. An additional benefit that comes with PowerShell is the ability to execute the script directly from NuGet Package Manager in Visual Studio.

To serve its purpose, the Fluent Model generator will consume a predefined set of text files that serve as code generation templates. As you will see for yourself, these files make the whole code generation process much more comprehensive and customizable.

The code output by default, however, won’t be much different from what you already recognize as a Data Access fluent model. The Fluent Model generator will produce persistent classes, a metadatasource and a context class. The noticeable change in it is that the mapping configuration is backend independent. This means that out-of-the-box, you will get a model that can be targeted at Microsoft SQL Server and Oracle without any adjustments.

Though the tool is not yet available, we are committed to releasing a Beta version in November 2015. So keep an eye out, as it's coming soon.

Please let us know how this sounds to you—we can't wait to hear your feedback.

Update Summer 2016: We've had to push the release back, and we know many of you are eager for updates. There is now an unofficial Beta you can find at this link—that's also the best place for you to leave questions about the tool.

About the Author

Ivailo Ivanov

 is Team Lead in Telerik Data Access

Comments

Comments are disabled in preview mode.