Archive
Navigate To… is now supported by CodeFluent Entities
I don’t know you, but one of my favorite (and useful) commands in Visual Studio is the “Navigate to…” command (VS 2010 or higher), Menu->Edit->Navigate to… Or Ctrl+, (coma). This is one of my top most used commands in Visual Studio.
I find very useful to find all kind of custom symbols (classes, enums, attributes, properties, methods, events…) within my Visual Studio solution.
Once you have made a search, a list of results is displayed. At the left of each result you can see an icon that represents the type of the matched item (class, property, method…), you can find the entire list of icons here.
I have seen other kind of techniques to perform a symbol search. For example, some people do a simple search (string search) at the solution (or project) level Edit->Find and Replace->Find in Files or (Ctrl+Shift+F).
This works fine but it would not be as accurate as the “Navigate to…” search. Indeed, a global search will also search in string definitions, encapsulated variables and within all kind of files (if the file type has not been specified).
Well, good news every one! Now the CodeFluent Entities model (Designer Surface and XML representation) is integrated in to the “Navigate to…” search results.
Is not that great? On the search results we can distinguish the CodeFluent Entities concepts like Entities, Properties, Relations and even Instances. You can easily identify the CodeFluent Entities related concepts by the suffix [of Entity ‘EntityName’].
You may only want to search within the CodeFluent Entities concepts, well this is possible by typing “_cfe ” before the search term. For example, if I type “_cfe Artist” I will only get CodeFluent Entities results.
You can even search for entities instances. Imagine I have in my model an instance of type “Artist” called “The Police” (value of the Name property), if I type “The Police” in the “Navigate to…” window I will also get results related to the instances in my model matching this term.
Finally, when you choose to navigate to a search result, a nice zoom effect will take you directly to the related entity on the CodeFluent Entities Modeler Designer.
Hint: if you press “Shift” when navigating to a search result (OK button or Enter key) you go directly to the XML definition (CodeFluent Entities parts).
This feature is available since build number (1.0.61214.701), you can download the latest version here or find some information on how to update your CodeFluent Entities version in this post.
If you want to know more about the navigation in the modeler you may appreciate this post.
I know you will find this feature useful.
Regards.
Pablo Fernandez Duran
Generating JSON web services from an existing database with CodeFluent Entities
This article posted on CodeProject will show you how to generate a JSON base web service layer from an existing database using CodeFluent Entities. We will also generate a web client back office following an “Import wizard”.
A common scenario
Let us say that we are facing the following scenario:
- We have a database that we want to expose via a JSON based web service layer, providing CRUD (Create, Read, Update and Delete) operations.
- We also need to build a back office in order to manage and administrate the data coming from our database.
- We may need, on a future, to access in a different way our database, for example from a Smart Client or expose a SOAP based web services layer (there are always new ideas).
- We need to deploy this system as soon as possible.
Let us start, what we need to do is:
- Build a data access layer capable to load data, create new data, update and delete existing data (and make sure it works).
- Manage validation data (and make sure it works).
- Build a JSON based web service layer:
- Build every needed service contract and operations.
- Configure our service contracts to support JSON.
- Host our services.
- Make sure it works
- Build a web based client (and make sure it works).
- Lay the foundations so any possible evolution and additional architecture can be supported including mobile access through different smartphone devices.
- And everything I have missed.
Or…. We can use CodeFluent Entities to do the plumbing and being sure that it works.
In the starter wizard, we can see some of the possible built-in architectures that can be generated by CodeFluent Entities, and of course you can imagine your own architecture by creating a custom CodeFluent Entities project with your relevant set of producers.
The scenario we mention here is developed "step by step" in the full article on CodeProject
Count and Delete methods now supported by Event Rules
Event rules are triggered upon a lifecycle event of a CodeFluent Entities concept allowing the developer to plug himself in the lifecycle (e.g. before saving an entity, or before the validation step) of an entity to extend its behavior. Event rules can be applied on the following three concepts:
- On entities,
- On properties,
- On methods.
- The third one (On Methods) contains three event rule types:
- OnAddParameters
- OnAfter
- OnBefore
- Until today the Count and Delete methods were not supported by Method event rules. This post is meant to let you know that as of today Delete and Count methods can be used with event rules.
More information on Event rules in the documentation.
Cheers,
Thibault NESTOR
SQL Azure producer now has its “Diff engine”!
CodeFluent Entities provides an out-of-the-box SQL Azure producer. Using this producer you can generate SQL Azure scripts and automatically run them on your SQL Azure database.
Although this producer enables you to work on a local SQL Server instance in order to benefit of the producer’s Diff Engine on the local instance, it was missing its own Diff Engine! Indeed, for each generation the producer was dropping tables before recreating them.
This new build 686 brings to the SQL Azure Producer its own Diff Engine. It means that as of today, either using SQL Azure or SQL Server producer, you can continuously generate without loosing data.
The SQL Azure producer’s property grid as been reorganized so the distinction between Local SQL server and Online SQL Azure properties is clearer. Besides, you’ll find a new property under the Online SQL Azure category called “Create Diffs” to enable or disable the SQL Azure Diff Engine. The Diff Engine is enable by default.
Cheers,
Thibault Nestor
User Interfaces generated by CodeFluent Entities using out-of-the-box producers
Over the past articles we showed you how to use the following UI producers provided out of the box by CodeFluent Entities:
· ASP.NET Web Forms Producer / AJAX/JSON
· SharePoint Web Part Producer
In this article I want to emphasize the fact that CodeFluent Entities is totally UI-agnostic. Indeed from the same and unique model you can generate screens that will be rendered in the targeted platforms of your choice. Here is for instance the list of all UI producers available:
Let see all the user interfaces that CodeFluent Entities has been able to generate from the exact same model, using those different producers.
Note that the generated applications are not just a set of user interfaces; they are actually complete interactive applications sharing the same business object model, database and are 100% functional.
We used the “ContactManager Sample Model” supply by CodeFluent Entities:
Here is the ContactManager model:
Since we’ve already seen how to use the producers provided by CodeFluent Entities in previous blog posts I’m going to skip their configurations and directly present you the generated UIs:
UI generated using the Windows 8 Store Producer:
The homepage generated by default lists all namespaces and their contained entities:
Clicking on an entity gets you to the entity page.
On this entity page you’ll find a screenshot of the entity from which this page was generated.
Right Clicking on this page or typing Ctrl+Z will bring up a menu at the bottom where you’ll find the list of actions available on this entity. Those actions correspond in fact to business methods provided by the entity:
Here is the screen displaying for the Contact entity when clicking on the “LoadAll” button and then selecting a contact:
Bringing back the menu by hitting Ctrl+z or right clicking will enable you to create, edit or delete an entry:
For instance, pushing the Edit button will give you the following screen:
UI generated using the ASP .NET MVC Producer:
The homepage generated by default lists all namespaces and their contained entities:
Clicking on an entity gets you to the entity page.
On this entity page you’ll find a screenshot of the entity from which this page was generated.
On the left side of the page you’ll find a list of actions available on this entity. Those actions correspond to business methods provided by the entity:
Here is the screen displaying for the Contact entity when clicking on the “LoadAll” button:
It lists all the contacts through an HTML table and enables sorting.
From it you can detail, edit or remove a contact.
Clicking on the “Details” hyperlink will bring up the following screen:
Clicking on the “Edit” hyperlink will enable you to edit the entry:
UI generated using the ASP .NET AJAX Producer:
The homepage generated by default lists all namespaces and their contained entities:
Clicking on an entity gets you to the entity page.
On this entity page you’ll find a screenshot of the entity from which this page was generated.
On the left side of the page you’ll find a list of actions available on this entity. Those actions correspond to business methods provided by the entity:
Here is the screen displaying for the Contact entity when clicking on the “LoadAll” button:
It lists all the contacts through an Ajax grid supporting sorting and paging.
From it you can detail, edit or remove a contact.
And the one when clicking on the “Edit” button:
UI generated using the ASP .NET WebForms Producer:
The homepage generated by default lists all namespaces and their contained entities:
Clicking on an entity gets you to the entity page.
On this entity page you’ll find a screenshot of the entity from which this page was generated.
On the left side of the page you’ll find a list of actions available on this entity. Those actions correspond to business methods provided by the entity:
Here is the screen displaying for the Contact entity when clicking on the “LoadAll” button:
It lists all the contacts through an HTML table and enables sorting.
From it you can edit or remove a contact.
And the one when clicking on the “Edit” button:
UI generated using the Smart Client (WPF) Producer:
The first screen generated by default lists all namespaces and their contained entities:
Clicking on an entity will load all the data corresponding to it:
From it you can create, edit or remove an entry.
Clicking on an entry will open a window to edit it:
UI generated using the SharePoint WebParts Producer:
The homepage generated by default lists all namespaces:
Clicking on a namespace lists all its entities:
Clicking on an entity gets you to the entity page:
It lists all the data of that entity through a Web Part.
From it you can create a new entry, detail, edit or delete one.
![]()
For instance, clicking on an entry brings up its details:
and clicking on the “Edit” button brings up the editor:
As you can see, from a same model we have generated several UIs all consistent with each other.
Besides, thanks to the Platform Independent Form Editor you can also define forms directly on their entities which will then be translated into actual screens by user interface producers. We talked about it in details in this article.
Finally, in the case you did not find the desired producer, I remind you that you can create your own template and use it with the Template Producer or you can even create your own custom producer. All you’ll need to do would be to implement the IProducer interface.
To sum up, CodeFluent Entities is able to generate 100% functional applications with the UI of your choice just by using the right producer.
Cheers,
Thibault Nestor
The Method Editor got better
Since the build 682 the Method Editor has been improved. Indeed, instead of having a single window where all method types were mixed up we now have a new window that breaks them down by types:
If your are not familiar with the Method concept of CodeFluent Entities yet, then I invite you to read about it in the documentation.
As you can see, you can choose the method type you want:
- CFQL
- Snippet with method signature
- Snippet without method signature.
Selecting the CFQL method type will bring up the CFQL Method Editor:
This editor provides intellisense as well as error recognition.
It will also automatically switch to the RAW edit mode when necessary, letting you select the raw body language of your choice.
Selecting the Snippet with method signature’s method type, will ask you to choose the class that will use the snippet: the entity or the collection.
Clicking OK will bring up the Snippet Method Editor:
It enables you to choose the language of your choice to write your snippet.
As for the Snippet with signature method type, selecting the Snippet without method signature’s method type, will also ask you to choose the class that will use the snippet: the entity or the collection.
Clicking OK will bring up the same Snippet Method Editor you’ve just seen.
This Method Editor is clearer and we hope it helps to make your developer life easier.
Cheers
Thibault Nestor
Introducing the CodeFluent Entities Windows Store producer
In this article, we’ll see how to use the brand new CodeFluent Entities “Windows Store” producer.
We’re going to create a complete back-end application that will host web services exposing data which will be consumed by a Windows Store application.
I will use an existing model provided out-of-the-box by CodeFluent Entities for this demo, namely the “ContactManager” model.
Creating the solution
Since my Windows Store application is going to consume web services, I’ll need to do some work before I can add the “Windows Store” producer.
First, I’ll add two projects to my solution, a standard C# class library project and an empty Web Application project. My class library project will contain the CodeFluent Entities generated business entity classes, SQL scripts and WCF services. Here is what I will do for this:
· Add the “Business Object Model” producer, make it point to my class library project;
· Add a “Service Object Model” sub-producer to this producer. For this sub-producer I’ll specify “Enable JSON” as “JSON options” and I don’t want to produce a proxy so I’ll set the “Produce Proxy” property to “False”;
· Create a new folder named “Scripts” to my class library project which will contain my generated SQL scripts to generate my database. Note we could also create a specific “SQL Server Database” project to hold these files;
· Add a new persistence “SQL Server” producer, and set its target directory to the “Scripts” folder we’ve just created;
· Now, my empty web application project will host my standard WCF .svc files. To quickly generate these, I will add an instance of the “Template” producer (Add new producer > “Utility Producers” > Template). Since I want to generate JSON, I’ll specify for the “Source Directory” the “Services” folder located at “CodeFluent Entities installation folder > Modeler >Templates > ServiceModel > JsonWebServices > Services” and for the “Target Directory” my empty web application folder.
Adding the Windows Store project
I’ll now add a new Windows Store Visual Studio project, a JavaScript Grid App project. Note: this is the only project type supported by the CodeFluent Entities Windows Store producer for the moment. This is pretty much what we have to do regarding the Windows Store project.
Adding the Windows Store producer
Now that our standard Windows Store project is added, I’ll need to add an instance of the brand new CodeFluent Entities Windows Store producer to my model:
Since the Windows Store application will consume the web services that will be generated, I’ll need to reference the “Server Url“ in the Windows Store producer configuration. In this case, the “Server Url” is the URL of the web application I added earlier: http://localhost:49774/ (Please adapt to your settings). I’ll also set the “Base Services Url” to http://localhost:49774/Services.
Then I’ll set the “Target Directory“ property to point to the Windows Store project folder I added and leave other properties to their default values according to the screenshot below.
I’m now ready to build all that!
Generating the code and launch the app
To generate, as usual, I’ll right click on my CodeFluent Entities project and hit ‘Build’.
Note: you may get back a CodeFluent Entities CF3708 error while trying to generate. It means the project attribute ‘createDefaultMethodForms’ is set to false. To set it to True, go to your CodeFluent Entities project properties, find the attribute in the ‘UI’ section, and set it to True. Starting with build 1.0.61003.684, the ‘createDefaultMethodForms’ attribute is set to True by default, on new projects.
Now that all our layers are generated, I’ll need to specify on my solution properties that I want multiple startup projects.
So I’ll set as first startup project my web application project which host my services and as second startup project my Windows Store application project like this:
Now let’s hit ‘F5’ to run my projects and voilà! Here is my complete Windows Store connected application consuming my WCF/JSON web services, without a single line of code!
Cheers,
Aymeric ROLAND.
Introducing CodeFluent Entities PostgreSQL Producer
CodeFluent Entities 2012 – Build 060809 introduced a new Persistence layer producer: the PostgreSQL Producer!
The producer supports PostgreSQL 8.4 and above (8.3 is soon to be discontinued) and relies on the ADO.NET data provider Npgsql 2.0.11. The producer will try to load dynamically the Npgsql assembly. (You might need to copy the Npgsql.dll and Mono.Security.dll in your CodeFluent Entities installation directory if you don’t want to register Npgsql in the GAC).
Please also note the PostgreSQL Producer also requires the liboss-uuid library to be installed on your server. On Windows, this library is shipped with the standard Windows packages of PostgreSQL 8.4+, and on Unix/Linux, you may need to install the postgresql-contrib package and its dependencies like libossp-uuid16, for the producer to be able to deploy the generated script on your server.
Getting started
The producer is available in the Persistence Layer Producers section of the Add New Producer window:
as well as directly from the Starter Wizard:
This is how you can set the connection string (in the Wizard pages):
A first model
I created a new project with the Start Wizard and design this very simple two-entity model:
Basically all the employees have a first name, a last name, a birth date, and a job. Each job has salary – of type currency, a name and employees. I added two instances to the model: an employee named John Doe, born on June 12th, 1974 with a job named CEO and which salary is 30,000.
I just set the Target Version of the PostgreSQL Producer to version 9.0 which the version I am currently running on my computer, and built the project.In the output window I can see the result of the generation process; the PostgreSQL producer generated 11 files and succeeded:
All the automatically generated .SQL script files are available in the Persistence project of the solution:
If I connect to my database with an administration tool I can see that a new database has been created with the named I specified in the Connection String, and populated with my model and instances:
And I haven’t written a line of code yet!
Consuming the generated persistence layer
Consuming the PostgreSQL generated database is as easy as configuring the right connection string in the client project. In my case I created a Console Application Project named MyCompany.Management.Client.
To prepare it, I had to reference my BOM Project – in my case MyCompany.Management – that was automatically created by the Starter Wizard, Npgsql.dll and CodeFluent Entities runtime, i.e. CodeFluent.Runtime.dll and CodeFluent.Runtime.PostgreSQL.dll. Note that you might need to set the Copy Local property to True for the Npgsql.dll reference if the dll is not registered in the GAC.
I also had to change the target framework of the project from .NET Framework 4.0 Client Profile to the full .NET Framework 4.0.
As I am using the PostgreSQL Producer I have to set the correct Connection String in App.config file:
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="MyCompany.Management" type="CodeFluent.Runtime.CodeFluentConfigurationSectionHandler, CodeFluent.Runtime" />
</configSections>
<MyCompany.Management persistenceTypeName="PostgreSQL" connectionString="Server=localhost;Database=MyCompany_Management;User Id=postgres;Pwd=password" />
</configuration>
Note it is important to specify the persistenceTypeName=“PostgreSQL” attribute.
Here is now the code of my console application :
using System;
namespace MyCompany.Management.Client
{
class Program
{
static void Main(string[] args)
{
// Create a new employee
Employee newbie = new Employee();
newbie.FirstName = "Jane";
newbie.LastName = "Doe";
newbie.BirthDate = new DateTime(1990, 01, 15);
// Persist Jane Doe
newbie.Save();
// Load all the employees
EmployeeCollection employees = EmployeeCollection.LoadAll();
foreach (Employee employee in employees)
{
Console.Write("- {0} {1}, born on {2:MM-dd-yyyy}",
employee.FirstName,
employee.LastName,
employee.BirthDate);
if (employee.Job != null)
{
Console.Write(", is {0} with a salary of {1:C}",
employee.Job.Name,
employee.Job.Salary);
}
Console.WriteLine();
}
}
}
}
It creates a new employee, saves it, and then loads a list of all the employees. As we can see, there is no specific code about PostgreSQL. Its use is completely transparent at this level.
And here is the result:
And the populated table:
Happy PostgreSQL-ing!
Baudouin Giard
CodeFluent Entities Summer Contest
You are a developer? A blogger? If so, you may have chance to win one of the packages given away by SoftFluent!
So what’s the catch?
The only thing you have to do is to share your opinion through an article on your blog or on a public platform.

What an easy way to win some money!
The deadline for the contest is the 31st of August. So why are you still reading rather than clicking the following link to get more information!
http://www.softfluent.com/community-support/codefluent-entities/summer-2012-blogger-contest
CodeFluent Entities: new ASP.NET Web Site Web Forms Template sneak peek
A brand new ASP.NET Web Site Producer (v2) is shipped in alpha in the latest build available (666 and upper).
As mentioned in our Web Platform Roadmap post, this new producer will be shipped with three templates:
- ASP.NET Ajax/JSON (alpha, available since build 663)
- ASP.NET Web Forms (alpha, available since build 666)
- ASP.NET MVC (coming soon!)
Here’s a sneak peek of what gets generated when using this new template (codename: “Airport”) ![]()
The homepage generated by default lists all namespaces and their contained entities:
Clicking on an entity gets you to the entity page:
On this entity page you’ll find a screenshot of the entity from which this page was generated.
On the left side of the page you’ll find a list of actions available on this entity. Those actions correspond in fact to business methods provided by the entity:
Unlike the Ajax/JSON template which consumes WCF JSON services, the ASP.NET Web Forms template is built directly on top of your generated .NET Domain Model, skipping this service layer. Yet, the generated .NET Domain Model (a.k.a. .NET Business Object Model) is not specific to ASP.NET and the exact same object model can be used from any other .NET technology such as SharePoint, WinForms, Console applications, services, etc.
Any feedback? Share them on this blog, on our forums or on our Facebook page!
Cheers,
Carl Anderson



















