CodeFluent Entities Aspects
CodeFluent Entities Aspects, formerly known as “Patterns”, allow developers to modify and extend the meta-model built by CodeFluent Entities before production. Aspects are platform independent, external to your model and therefore reusable in future developments. Moreover since aspects intervene upstream generation, they have an application-wide, cross-layer scope.
Let’s say a developer wants to add data localization capabilities to his application. CodeFluent Entities actually provides an internationalization aspect named SoftFluent.Localization. This aspect adds localization capabilities to your model by adding a new boolean property named “localizable” which can be set on properties.
Once the aspect was added to your project, you can declare a property localizable by selecting it and setting in the property grid the “Is Localizable” property to true.
For instance, we added a Description property to the Contact entity, defined as localizable. At generation, but before producers are actually run, the aspect will modify the in-memory representation of the model to add localization support. Technically speaking it will:
· add a ContactLocalized table with an Lcid column and the Description column,
· modify the stored procedures so the localized description column is retrieved as well,
· modify the C# methods to specify the Lcid as a parameter to those stored procedures.
Aspects being external to your model, once you created one, you can reuse it on other applications. Say your applications frequently need tracking capabilities of write operations. You could wrap those up in an aspect, so that you’re investing time to implement such feature once and for all.