Archive for February, 2011

Model Versioning

February 24, 2011 Leave a comment

Say you developed your application using CodeFluent Entities and shipped several versions of your application: how can you know from the code in production which model version was used to generate it?

First, in SQL a cf_modelVersion function is generated which allows you to retrieve a “model version number” indicating the model version used to generate the current SQL.

Likewise, in the generated Business Object Model (BOM), you’ll find something like this:

[assembly: CodeFluent.Runtime.Utilities.CodeFluentGeneratedAttribute("1.0.50204.0578", "CodeFluent Entities generated ( Date: Wednesday, 23 February 2011 22:20.", CodeFluent.Runtime.Utilities.CodeFluentGeneratedAttributeOptions.CompiledWithCodeFluent, 1431726511u)]

As you can see it also contains the same model version number: starting from the code, you can know which model version was used to generate them, and in addition, you can check that the BOM and SQL are consistent.

In fact, the CodeFluent Runtime even provides a method to do so programmatically:


CodeFluent Entities SQL Azure Producer Unveiled!

February 24, 2011 6 comments

I am really excited to announce today the forthcoming support of Microsoft SQL Azure in CodeFluent Entities.

What is Microsoft SQL Azure?

Microsoft® SQL Azure™ Database is a cloud-based relational database service (RDBMS) built on SQL Server® technologies. It is a highly available, scalable, multi-tenant database service hosted by Microsoft in the cloud. SQL Azure Database helps to ease provisioning and deployment of multiple databases. Developers do not have to install, setup, patch or manage any software, as all that is taken care of by Microsoft with this platform as a service (PAAS). High availability and fault tolerance is built-in and no physical administration is required.

More information here (official Microsoft SQL Azure website).

What is CodeFluent Entities SQL Azure Producer ?

CodeFluent Entities SQL Azure Producer allows you to easily generate code for Microsoft SQL Azure databases. The generated code is fully compatible with the Business Object layer generated by the CodeFluent Entities BOM Producer.

The SQL Azure producer brings many benefits including:

  • Ability to develop your application on a local MS SQL Server and deploy it to SQL Azure only when you decide it. This is a key feature that will save you money as you will not consume SQL Azure resources during development phase
  • Ensure reversibility in your application as you will be able to select the SQL Server Producer (or Oracle Producer) at any time and regenerate the persistence layer without any impact on the existing application
  • Access your SQL Azure database and data using the integrated database explorer available in CodeFluent Entities Modeler
    The next CodeFluent Entities build planned for March 2011 will include a beta version of this new producer.

In the meantime, check out this video preview!

SQL Azure Producer Preview – Watch on Youtube in 720p for high quality video


More on : (click Get Started)


Copy As XML

February 22, 2011 2 comments

As we saw in the previous post, CodeFluent Entities models are XML based: you can either design your model by drawing shapes on a canvas, or by declaring your elements in XML; both views are synchronized to one-another and the result will be the same.

Furthermore, using the surface view, you can copy shapes on the surface but you can also copy them “as XML” so you can paste and edit them in the XML directly.


Clicking “Copy As Xml” on the shape above will allow you to then paste the following XML:

<cf:entity name="Order" namespace="MyApp" xmlns:cf="">
  <cf:property name="Id" key="true" />
  <cf:property name="Price" typeName="currency" />
  <cf:property name="Tag" />
  <cf:property name="LineItems" typeName="OrderLineItemsCollection" />

XML Synchronization

February 17, 2011 2 comments

Using the modeler, you can either design your model using surfaces or parts. A surface is basically a canvas on which you can CodeFluent Entities concepts such as namepsaces, entities, enumerations etc. On the other hand, a part is a XML file, and offers the same experience as developers know using the builder (CodeFluent.Build.exe) in command line with XML files.

However, both techniques are actually two views of the same in-memory model, and so both are in fact synchronized. Adding a concept in the part is reflected on the surface and vice-versa. This way you get the best of the two worlds: a fast, convenient and intuitive UI as well as an unbounded, human-editable, declarative view for power-users.

XML Synchronized View

Integrating your Custom Producer to the Modeler

February 16, 2011 2 comments

Creating your own custom producers in CodeFluent Entities is pretty straightforward: all you have to do is implement the IProducer interface. This interface contains three methods:

  • Initialize, which takes as a parameter an instance of the CodeFluent Entities project and the current producer
  • Produce,
  • Terminate

When using CodeFluent Entities directly from the command line via its CodeFluent.Build.exe, nothing special was required: declare a producer element as usual and set the typeName attribute of the producer element to your IProducer implementation. But what about integrating to the Modeler? Well it’s just as easy!

First, open Visual Studio and in Tools > Options… > CodeFluent Entities, select the advanced view using the advanced button at the top of the property grid. As you can see, there’s a property named “Custom Configuration File Path” which points to a Custom.config file.


By default, this file doesn’t exist, get to the pointed directory and create this Custom.config file with the following content:

      <producerDescriptor name="MyProducer" displayName="MyProducer" category="MyStuff" typeName="CodeFluent.Producers.CodeDom.EntityFrameworkProducer, CodeFluent.Producers.CodeDom" />

As you can see, we’re adding a producer descriptor named “MyProducer” in the “MyStuff” category, and this producer points to the EntityFrameworkProducer provided in the CodeFluent.Producers.CodeDom assembly.

If you create a new CodeFluent Entities project and add a new producer to your project, you’ll now see:


Voilà! The “MyProducer” was added to the “MyStuff” category and you can now use your own custom producer just as any other producer Smile

Updating a Production Database

February 15, 2011 Leave a comment

Here’s a tip on how to easily update the database of a CodeFluent Entities application that is already in production.

Say your application is already in production, and meanwhile you added some extra features, made some bug fixes, and etc. which in the end changed the schema of your database.

The trick to easily update the schema of your application is to leverage CodeFluent Entities’ diff engine to update your application.

To do so:

  • Backup your production database,
  • On your development environment, run your SQL Server producer on it!
  • Restore the updated database on the production server,
  • Don’t forget to update upper layers as well Smile

Modeler Error Reports

February 14, 2011 Leave a comment

Experiencing an unexpected behavior using the Modeler? We’re sorry for the inconvenience, but you’ll be glad to know that thanks to your error report it sure won’t happen again!

Whenever an unexpected error occurs in the modeler, this error is logged in an error report in your user profile. You can access error reports from Visual Studio by going in Tools > Options, and selecting the Tools page in the CodeFluent Entities section:


Click on the “Browse Files” under “Error Reports” and it’ll open the folder containing all error reports.

Those reports are very valuable to us, since they contain details on the error you experienced.

In conclusion, don’t hesitate sending them to us at support ‘at’ softfluent ‘dot’ com, with the steps to reproduce it!

The R&D Team