Tools for developers, by developers

CodeFluent Entites

Less plumbing, more productivity!

Free for personal use

CodeFluent Entities is a unique product integrated into Visual Studio 2008 SP1 / 2010 / 2012 / 2013 / 2015 which allows developers to generate database scripts (e.g. T-SQL, PL/SQL, MySQL, Pg/SQL), code (e.g. C#, VB), web services (e.g. WCF, JSON/REST) and UIs (e.g. Windows 8, ASP.NET, MVC, 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.

CodeFluent Entities: Why? Examples!

A Model-First Tool

CodeFluent Entities is a model-first code generator: it's not an ORM (therefore it's not a mapping model), nor a UML modeling tool (no need for several UML diagrams). Designing your application is done using a single pragmatic model, readable by non-technical users, and which centralizes all application logic.

Here's how a model looks like:

It's platform independent, simple, yet powerful as from this model you'll drive all your developments.

Code generation is done thanks to what we call "producers" which are code generators that will translate this model into actual code.

Decouple Business Logic From Technology

CodeFluent Entities will infer an in-memory representation of your model, which will be passed to producers. Producers are code generators, each one targeting a single platform, which will translate this model into code.

For instance, adding an instance of the SQL Server Producer to your project will translate your model into a database (shemas, tables, stored procedures, views, constraints, etc.):

Adding an instance of the Business Object Model Producer will translate your model into .NET classes consuming the persistence layer:

Adding a WCF Producer will generate WCF services, contracts and proxies exposing your .NET classes:

Adding a WPF Smart Client Producer will generate a WPF application consuming the WCF services thanks to the generated proxy:

Your application is layered applying best practices, all its business logic is in the middle-tier, and supporting a new technology gets down to adding a new producer or creating screens on the generated code.

Continuous Generation

Generation is continuous: the differential engine enables hassle-free schema updates without losing any data.

Say you have an existing Customer entity:

From which you generated a Customer table containing data:

Adding a new Name property to the entity:

And generating over will preserve our existing data:

Please note that things like up-casting, adding/removing constraints or relations are fully supported so you can generate continuously throughout your developments.


Using the Instance concept you can define lines of data in your model, so your generated persistence layer is automatically initialized.

Use the Instance Grid to create batches of them:

CodeFluent Query Language (CFQL)

Write platform independent data accessing queries and let the tool translate them into platform optimized stored procedures. For instance writing the following CFQL query in your model:

<cf:method name="LoadByName" 
           body="load(Name) where Name startswith @Name"/>

The SQL Server Producer will generate the following stored procedure:

CREATE PROCEDURE [dbo].[Test_LoadByName]
@Name [nvarchar] (256)
SELECT DISTINCT [Test].[Test_Id], [Test].[Test_Name]
    FROM [Test]
    WHERE ([Test].[Test_Name] LIKE (@Name + '%'))


The Oracle Database Producer will generate the following equivalent:

CF_CURSOR OUT "Post1336"."CF_#Runtime".CF_CURSOR_TYPE, "#Name" NVARCHAR2) AS V_CF_CURSOR "Post1336"."CF_#Runtime".CF_CURSOR_TYPE; BEGIN OPEN V_CF_CURSOR FOR SELECT "Test"."Test_Id", "Test"."Test_Name" FROM "Post1336"."Test" WHERE ("Test"."Test_Name" LIKE ("#Name" || N'%')); CF_CURSOR := V_CF_CURSOR; END;

Furthermore, as you can see the data accessing code is not dynamic making it predictable, and easier to debug.

Support For Multiple Database Systems 

Persistence producers generate scripts from the model and deploy them on the specified database to create your persistence layer. 

Furthermore the persistence layer used is independent from the upper layers (.NET classes, services, user interfaces), so switching database systems comes down to switching producers.

Multiple User Interface Producers 

Using out-of-the-box UI producers you can generate user interfaces.


Here are some examples:

Windows Store

WPF Smart Client



ASP.NET WebForms

SharePoint WebParts

Support for Multiple .NET Languages

The Business Object Model Producer, the code generator translating the model into a .NET class library, can generate the exact same .NET object model in either C# or VB.NET:

Support for all .NET Platforms

Code generated by CodeFluent Entities supports .NET Framework versions from 2.0 to 4.0 and runs on all .NET platforms: ASP.NET Web Forms, ASP.NET MVC, Windows Forms, WPF, Silverlight (2 to 4), SharePoint, Windows Workflow Foundation, WCF, etc.

Apply Application-Wide Changes Smoothly

Apply application wide changes in a few clicks such as adding data localization, tracking to multiple tables or changing naming conventions. For instance lets do the latter, and select an upper case decamelized naming convention:

Generating our persistence layer will rename all our database objects:

Selecting the lower case naming convention:

Would generate the following persistence layer:


Unlike ORMs, such features are possible as all layers are generated from the model, and unlike code generators as generation is model-based and not template-based.

CodeFluent Aspects

Building an application using CodeFluent Entities implies designing a model representing your application: its business logic, architecture, technologies, etc. From this model a platform independent meta-model is inferred, and only then, producers will translate this in-memory representation into actual code.

CodeFluent Aspects (formerly and also known as CodeFluent patterns) introduce a new notion allowing you to plug into this process. Using aspects you'll be able to work on this in-memory representation of the model, before anything is produced, and dynamically add/remove/modify elements in your model: this is what we call dynamic modeling and it allows developers to implement behaviors in models.

Aspects are external to your model, and a set of aspects are shipped out-of-the-box along with the product. Among them, you'll find aspects allowing developers to add data localization or "middle of word" text search to their application by importing them in their model.

For instance adding the data localization aspect will modify all layers, starting by the persistence layer where it adds a localized version of the entity table, containing all localized columns and their corresponding LCID:

And all corresponding data access methods in all layers will change from this:

// (...)
persistence.AddParameter("@id", id, DefaultGuidValue);
// (...)

To this, taking into account the current locale as you can see:

// (...)
persistence.AddParameter("@id", id, DefaultGuidValue);
persistence.AddParameter("@lcid", lcid, 1033);
// (...)

Likewise, you can create your own custom aspects in order to add specific behaviors which you'd like to industrialize.

Full Continuity Between Generated Object Model & Database

There's a full continuity between generated object model and database providing an actual answer to the object-relational impedance mismatch. For instance, an entity hierarchy will be translated following the Table-Per-Type pattern in the persistence layer, when, in the generated business object model, this will be a regular class inheritance. Say we have the following hierarchy:

Here's the result in database:

Which data access methods will automatically support so loading those entities using our .NET classes will get us the appropriate hierarchy:

CREATE PROCEDURE [dbo].[DiscountProduct_Load]
@Id [uniqueidentifier]
SELECT DISTINCT [DiscountProduct].*, Product].* 
  FROM [DiscountProduct] dp
   INNER JOIN [Product] p ON (dp.[Product_Id] = p.[Product_Id])
  WHERE ([DiscountProduct].[Product_Id] = @Id)


Another great example of this continuity is the fact that you never have to struggle with DbNull and data conversions: the tool does it all for you, so you don't have to.

Full Enumeration Support Since Day 1

Unlike ORMs like Entity Framework which still does not fully supports enumerations, CodeFluent Entities fully supports .NET enumerations since 2005, and this support includes:

  • Being able to create your own enumerations at design time,
  • Use already existing CLR enumerations.
  • Using our designer, you can create and use enumerations in your model (e.g. OrderStatus in the screenshot below):

While actual values of the enum will be used in database, the Business Object Model Producer will generate an actual .NET enumeration. Likewise you can reuse any standard CLR enumeration like System.DayOfWeek for instance.

Full .NET Resources Support

Specifying resources in your model will generate actual .NET resources (.resx).

Application-Oriented Features

CodeFluent Entities can generate application-oriented features so you don't have to code them: data binding support, validation, paging, sorting, search, security, localization, concurrency, transactions, caching, blobs, etc.


For instance, security is implemented using standard ASP.NET Membership and Role Providers which can be used across all .NET applications, and for which ASP.NET and WCF provide a native support. Those membership providers can be generated by declaring membership entities:

Pure .NET Development

Generated classes are regular .NET classes:

  • They are all partial classes so you can extend them at your will,
  • They do not derive from any base technical class,
  • Yet, they implement an extensive set of interfaces to ease your custom developments.


Using snippets you can paste custom code into generated code:

  • Persistence layer example:
<cf:method name="LoadByDates" body="load(datetime maxDate) raw">
   SELECT * FROM [product]
WHERE DATEDIFF(year, [register], GETDATE()) > @maxDate </cf:method>
  • C# example: 
    private void MyCustomMethod()
        // Do some custom code here

Customer's opinion

Richard Clark - C2I

"As a service company, CodeFluent Entities empowers us to stand out at low cost while reducing implementation risks."

Sébastien Mizon - Clovidis

I have used CodeFluent Entities for over 2 years and it has completely changed my way of implementing .NET applications. I can't do without it any more!

Peter Standford - Artefaction

SoftFluent sales staff have been responsive without being pushy and it’s refreshing to find a company that knows the quality, support and productivity improvements available through their product is more important to developers than anything else.


Related Information


  • Visual Studio