CodeFluent Entities: The Business Object Model
The Business Object Model (a.k.a. BOM) is generated by the Business Object Model Producer and is a .NET translation of your platform independent model which you designed in CodeFluent Entities.
In practice it’s a set of C# or VB.NET classes which was inferred from your entities. Two classes are generated per entity, one representing the entity (e.g. Customer) and one representing a collection of this entity (e.g. CustomerCollection). This set of classes is built to contain all the business logic of your application (entities, methods, rules, custom code, etc.) and to be easily used in upper layers.
By that I mean that this BOM can be used across all .NET applications may they be WPF, Windows Forms, ASP.NET Web Forms, ASP.NET MVC, WCF web services, ASMX web services, console applications, Windows Workflows and so on.
Furthermore, those classes are built to ease your life when building your app:
- They are all serializable (XML, .NET binary / SOAP, WCF, etc.)
- They are all partial
- They do not derive from a base technical class but are plain old classes
- They implement by default an extensive set of .NET inferfaces to ease your life (System.ComponentModel.IDataErrorInfo, System.IEquatable<T>, System.ComponentModel.INotifyPropertyChanged, System.ICloneable, System.IComparable<T>, etc.)
On a higher level, the BOM also provides application oriented features that are common to enterprise-class applications so developers won’t have to code them over and over again from one project to another. Here’s a bulk list of out-of-the-box features provided by the BOM:
- Data Binding,
- Data Validation,
- Paging and Sorting,
- Localization (with .NET resources, but also data localization),
- Blob management.
I’m probably be missing some, but you get the general idea: let the tool take care of all the plumbing and recurrent but yet necessary code so you can spend time on what matters such as the UI.
Furthermore, since those features are implemented in the BOM, they’ll be shared by all clients using that BOM so that UI is just UI, meaning that if you started by developing a Windows Forms application and then need to go to WPF, you don’t have to write everything over, but just the UI specific code. And this is also true from desktop to web, web to mobile or even in-house to cloud.
To paraphrase Rockford Lhotka in his "Silverlight 6 doesn’t matter" post, in the end the key is architecture.