There are different approaches to place your business logic using Code Cruiser.

By business logic we mean any complex data manipulation that needs coding.


Here are several options:


Option 1. Database.


Take advantage of SQL views, storage procedures, triggers and other DB specific objects.


We don't recommend this approach with Code Cruiser.

Ideally you should not use any views, triggers or stored procedures in application building.


Database entities lack access to your server side environment (file system, email service, etc.)

This approach is much harder to debug and maintain then if all logic would be on server side.

Also keep in mind that Code Cruiser was build to be multi database, so you could easily switch between open source an enterprise level databases without rewriting you application (although currently Code Cruiser supports only MS SQL Server and MS SQL Azure databases).


Option 2. Server (Query and Entity repository classes).


Implement business logic by overriding methods in query or repository classes in Custom Code.

Although this option is best for small applications at some point you can stuck with circular dependency in dependency injection.

There is a solution to use lazy injection but still if you seeing this problem consider using next option.


Option 3. Server (Business Logic Layer)


Create special classes for business logic and place logic there.

Don't use business logic classes in entity and repository classes (think of business logic layer as a high level layer).

Use change trackers to track changes (see example in Notifiers chapter)


The main benefit of this option in comparison with previous one is that you separate CRUD operations from business logic and lover possibility of a circular dependency problem.


Created with the Personal Edition of HelpNDoc: Single source CHM, PDF, DOC and HTML Help creation