CodeFluent Entities: Basics, meta-model and aspects
CodeFluent Entities is a product integrated into Visual Studio 2008/2010/2012 which allows developers to generate components such as scripts (e.g. T-SQL, PL/SQL), code (e.g. C#, VB), web services(e.g. WCF, ASMX) and UIs (e.g. ASP.NET, SharePoint, WPF).
The code generation process is model-first and continuous: from your declarative model, a meta-model will be inferred which code generators will then translate into code. Over 20 code generators (a.k.a. “producers”) are provided “out of the box” and can be combined to create your own application following your desired architecture, using your desired technologies.
Figure 1 is in fact a little too simple: as mentioned earlier, producers don’t translate your model into code right away, instead a meta-model will be inferred first. This meta-model consists of of a ‘virtual’ persistence layer, a ‘virtual’ business object model and a ‘virtual’ user interface. By ‘virtual’ I mean that it’s all in-memory and that’s not actual code yet.
You can actually view those virtual bits using the Meta-Model Explorer (CodeFluent.View.exe) or by clicking on the “View Inferred Model” button of your project tab in Visual Studio:
Producers will then translate those virtual bits into actual scripts, code, web services and UIs.
This meta-model is the key. Thanks to it, before anything gets generated, CodeFluent Entities can ensure that your application is consistent and that it will all compile.
Furthermore, CodeFluent Entities provides what we call “CodeFluent Aspects” (formerly known as “CodeFluent Patterns”) which allow you to interact with this inferred meta-model and dynamically change it.
A set of built-in aspects are provided out-of-the-box but you can also create your own aspects. For instance, one could create an aspect that automatically adds tracking properties on all entities marked as “trackable”. It’s all done at generation time and can turn out to be very handy when working on big models and/or to externalize a feature that you have to implement often from one project to another.
More on this subject in a forthcoming post!