Methods in CodeFluent Entities (Video)

More than a simple Object Relational Mapper (ORM) tool, or just generating the Create, Read, Update, Delete (CRUD) methods, CodeFluent Entities – through its method concept – allows to go way further. It allows architects and developers to define methods that will be available in all generated layers. Defining them in the model results in adding platform independent methods to the inferred meta-model, ergo those methods will be translated by each producer to generate platform specific and optimized code.

For instance, from a given method, the Microsoft SQL Server Producer will generate a stored procedure, the Business Object Model Producer will generate an actual C# method in the defined class and mapped on the previous stored procedure, the Service Object Model Producer will generate the corresponding operation and contract mapped on the method defined in the object model, as well as a proxy method in the Smart Client Object Model enabling smart client developers to consume that remote operation just as if they were developing on the server through the Business Object Model.

Using methods truly enables development teams to streamline their developments since each business rule provided by a method will be useable in all layers of the application.

CodeFluent Entities can generate two types of methods:

  • Model methods: methods within a scope bound to the object model (e.g. the Validate or Sort methods),
  • Persistence methods: methods within a scope including the persistence layer as well (e.g. the Load, Search, Count, Save, Delete methods).

By default, CodeFluent Entities generates a set of methods including CRUD methods, and methods which are a physical implementation of the designed relations. For instance, if an entity Order is related to a Customer entity, a LoadByCustomer method will be generated automatically for the Order entity.

At last, from a given model, here are the default methods generated in output:

  • Load / LoadBy[CollectionKey] / LoadBy[RelatedEntity] / Save / Delete in the entity class,
  • LoadAll / SaveAll in the entity set class,
  • Load / Save / Delete for all Binary Large Objects (Blobs) properties if any.

Of course you can define your own extra methods in the model, and here’s a video illustrating how to create one using the Visual Studio integrated interface:

Defining Methods
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

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

You are commenting using your 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