Home > News > What’s new with CodeFluent Entities 773?

What’s new with CodeFluent Entities 773?

This new build includes one new feature : Database producers now support custom COUNT methods expression (including DISTINCT).

Until now, CodeFluent Entities could only generate COUNT(*) statement using the CFQL COUNT method. This new version (build 773) introduce new XML attributes in order to let you change the generated count expression. For instance you can now generate the following SQL code:


This is possible by using the new ‘countExpression’ xml attributes. The value of this attribute will be copied as is into the SQL COUNT statement.

As you are setting raw SQL, countExpression attribute is database producer specific, this means you have to set it once by database producer you use (SQL Server, Oracle, MySQL, and PostgreSQL).

<cf:method name="CustomByName" body="COUNT(Name) WHERE Name STARTSWITH @Name"
  cfps:countExpression="DISTINCT $Customer::Name$" 

  cfor:countExpression="DISTINCT $Customer::Name$" 

  cfpg:countExpression="DISTINCT $Customer::Name$" 

  cfmy:countExpression="DISTINCT $Customer::Name$"

This model will produce the following procedure:

CREATE PROCEDURE [dbo].[Customer_CountByName]
 @Name [nvarchar] (256)
SELECT COUNT(DISTINCT [Customer].[Customer_Name]) FROM [Customer]
    WHERE ([Customer].[Customer_Name] LIKE (@Name + '%'))


Note that Target Name Transformation (TNT) in countExpression is supported. Target Name Transformation (TNT) is a very powerful and important feature of CodeFluent which allows developers to use the names of entities, properties, and views inside SQL snippets and raw queries. Therefore, it allows developers to use actual output names of objects (tables, columns, views) with the support of the defined naming convention:

If you are not a current customer, you can always download our free evaluation and see it in action. Remember that you can follow the latest new features and bug fixes of CodeFluent Entities subscribing to this RSS Feed.

Happy Counting,

The R&D Team

Categories: News
  1. No comments yet.
  1. August 22, 2014 at 9:57 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s