Across this series of posts we have seen how is to design and build a business application using CodeFluent Entities and Entity Framework 5 and as you have seen, we can say that CodeFluent Entities can be located as a superset of Entity Framework (taking into account that CodeFluent Entities does not rely on Entity Framework).
As you could see, the CodeFluent Entities modeler is a very advanced one. The number of notions supported by CodeFluent Entities is larger than those of Entity Framework:
- model search engine
- aspects and dynamic modeling
- code snippets
- rules editor
- forms editor
- configuration properties
- model design customization
- menu/action ribbon
- inferred model
- multi surface/file model
- naming conventions
- user defined types
Performance and readability
Entity Framework generate SQL code dynamically which can be ok when you have a small application and when you don’t need to debug/understand your SQL code. Indeed, dynamically generated code is not easy to read and can present performance issues when dealing with complex queries. All SQL code generated by CodeFluent Entities is generated in design time so you know in advance exactly the code that will be called.
The first image shows a query using Entity Framework and Linq-to-Entities, we can also see the dynamically SQL generated code translated from the C# code. The second image shows the same query using CodeFluent Entities and its language agnostic query system (CFQL), all this in design time.
When working with a large model or when several members of a team modify the same model it is really handy to split the model in different parts (files), this is not possible with Entity Framework without losing information and you may have experienced the consequences: merge conflicts, Visual Studio slows down…
When modeling your business domain with CodeFluent Entities you don’t need to make any specific mapping, you can easily add, remove and update elements in your model and CodeFluent Entities does the rest.
CodeFluent Entities embraces the notion of Continuous Generation, it means that you can “tune” your model (update, go back) until it suits your needs and then generate it over and over again without losing any data, this is possible thanks to the CodeFluent Entities diff engine. This way you can more easily support functional changes.
Write less code
CodeFluent Entities will save you thousands of lines of code, code that the development team would have to write, code that would need to be tested and code that would always have a risk to have errors. As all we know:
the less code we write…
- the less that can go wrong
- the sooner we’ll be done
- the fewer bugs we write
- the less we have to maintain
- the better…
We haven’t seen everything
We have only covered a piece of the potential of CodeFluent, it provides a huge set of producers:
- Windows 8
- ASP.NET MVC
- REST/JSON web services
- Silverlight proxy
- advanced web services proxies
- automatic traces
- cache features
- documentation files
- Access and Excel lists
- MS Build tasks
- web controls
- and more…
That is explained by saying that CodeFluent Entities is not an ORM, it is a full model-driven software factory.
Let’s see a comparison of code metrics between the application built with CodeFluent Entities and Entity Framework.
We used the Visual Studio 2012 tool for code metrics analysis (Analyze -> Calculate Code Metrics for Solution).
We focalize on 3 indexes: Lines of Code, Maintainability Index and Cyclomatic Complexity. For each index the less is better.
Entity Framework – Code Metrics:
CodeFluent Entities – Code Metrics:
The code metrics analysis has not been applied to generated code, that’s why the “PetShopReloaded” project has a value of 0 Lines of Code for the CodeFluent Entities solution.
We needed to modify the t4 templates (Model.tt and Model.Context.tt) for Entity Framework in order to generate the System.CodeDom.Compiler.GeneratedCodeAttribute attribute so the generated code has not been taken in account by the code metrics tool. CodeFluent Entities generated that attribute by default.
As we can see we will need to maintain more code (and more complex) for the solution built with Entity Framework.
If you are convinced by all the advantages that CodeFluent Entities can provide to your software engineering process but you have already started with Entity Framework, don’t worry, CodeFluent Entities provides a “Entity Framework Importer” (http://www.softfluent.com/documentation/Importer_EntityFrameworkImporter.html) 🙂
The SoftFluent team
Good news: Visual Studio 2013 is now available for download and CodeFluent Entities latest build (61214.761) runs great on it!
You can learn the new features of Visual Studio 2013 here:
- What’s New in Visual Studio 2013 (Microsoft)
- What’s New in Visual Studio 2013 (msdn)
- What’s New in the Visual Studio 2013 IDE (Channel 9 video)
The Visual Studio 2013 download includes the .NET framework 4.5.1. If you have not seen it yet, you can read about the framework here:
- What’s New in the .NET Framework 4.5 (msdn)
- .NET Framework 4.5.1 RTM => start coding (.NET Framework blog)
On November 13th, do not miss the Visual Studio 2013 Virtual Launch. You will discover the breadth and depth of new features and capabilities in the Visual Studio 2013 release.
Remember that you can follow the latest new features and bug fixes of CodeFluent Entities subscribing to this RSS.