CodeTrigger has a fine grained settings facility that allows you to select all or any of the following options for your project:

  • Generation of business objects
  • Generation of data access objects
  • Generation of lazy loading member/child collections
  • Prefix your stored procedures
  • Prefix your parameter names
  • Ignore database table and view prefixes
  • Automatically script the changes directly into your database
  • Generate SQL/PLSQL script files instead, or
  • Generate inline sql in your code to avoid modifying the database
  • Generate simple single tiered projects
  • Generate complex multi-tier architectured projects using wizards

  • And this is all in addition to being able to select from Microsoft SQL Server, Oracle and MySQL datasource, or create a project that combines all three!

    There is a choice of multiple settings for SQL generation, so that you can customise the output to your preferences. SQL can either be directly (automatically) scripted into your database to create procedures and packages, or can be generated as a script file that you need to run, or can be generated as inline-sql so you dont need to modify the database (MSQL & MYSQL only);

    Relationships between objects are derived from the Primary & Foreign key relationships in the database and represented as Business Object collections. You can choose to include collection-management methods in your generated classes or not.

    There are dozens of combinations of options for code generation. Some of the options are
    1. Generate Interfaces - Select this option for scenarios when you might need to swap between implementations of certain functions, CodeTrigger will then generate interface definition files for all its classes, and ensure that the classes implement those interfaces.

    2. Repository Pattern - You can select this option to enable the swapping in and out of repository implementations, when using repository pattern.

    3. Dependency Injection and IOC - If using this pattern you can configure CodeTrigger to generate code and attributes to enable the use of common containers such as Unity and Ninject, if required.

    4. Unit of Work pattern - Selecting this option decorates your classes with the relevant attributes and interfaces to enable to construction of a transaction worker for multiple database ops that can be rolled back as a unit. There is built-in support for both the repository and non-repository-pattern use-case.

    5. Database concurrency management - This option generates basic multi-user data-versioning & concurrency management code blocks assuming an 'Optimistic Concurrency' scenario.

    6. Logging support - You can select this option to generate logging callbacks so you can easily add logging for all user actions and capture information all "insert", "update", and "delete" requests with a minimum of effort. This option generates a callback to allows you to provide the implementation or call the third party logger of your choice, eg log4net or Microsoft Enterprise Practices Logging Block.

    7. Exception handling - This option generates exception handling callbacks so you can easily insert your preferred exception handling implementation or call/configure a third party enterprise level exception handling library.
    These are just a few of the many options available, for both simple and complex projects, from basic 1-tier database query apps, to multi-tier architectured enterprise level apps.

    Build your own queries using the criteriaquery api, concatenating 'where' filter clauses, using 'projection' to select specific fields from the database, re-using database results as sub-query filters with 'in-subquery' and ordering results with 'order by' clauses.

    There are several ways of customising the generated code
    1. CodeTrigger makes use of the partial classes approach, so you can extend the generated code by declaring partial classes with the additional functionality.

    2. You can always override the virtual methods in the generated classes, providing your own implementation

    3. You can select the option to generate interfaces, and inherit from those interfaces to provide your own implementation

    4. You can use the repository pattern to inject your own repository implementation, derived or otherwise from the base generated implementation

    5. And finally, as a last resort, you can directly modify the generated code, and then add that file to the 'escaped file list' thus preventing it from being overwritten. This is a last resort as if you accidentally run without the file listed in the escaped file list, you could lose all your changes! So never use this approach unless you have a versioning/source control system.

    To assist with projects under source control, the 'escaped file list' allows you to define files which should not be regenerated, so as to avoid having to keep checking them out. These files are typically the shared base files.

    To assist with advanced scenarios such as continous integration, and automated deployment etc, a command line version is available to run a pre-defined code generation project, prior to code build. You can schedule this command line to run after your continous integration environment has (re)built your database.

    CodeTrigger gives you the option of creating WCF services for your project. Interfaces, Service methods and WCF config files are generated if you select the option. You can also choose to have each Business Object represented as a service, or whether to combine all the Business Objects and Operations in a single service.

    CodeTrigger provides a comprehensive sample generation facility to enable you quickly get to grips with the possibilities available with the generated code. Samples are designed to be no-frills code samples to demonstrate the working capabilities of CodeTrigger generated code and different ways you can interact with it in your project. Most importantly, CodeTrigger generated samples use actual objects from your provided database so you can see a real world example that is relevant to you.

    However it is important to note that CodeTrigger is not a GUI or UI generation tool. The UI sample generation feature provided is purely for the purposes of evaluation of other features of CodeTrigger and is not a supported feature in itself.

    Project Wizards allow you to generate a Visual Studio project structure in a matter of seconds, and creates a fully fledged CodeTrigger project settings file, that you can build on directly during your project lifecycle.

    CodeTrigger generates raw code and only raw code, there is NO need to reference CodeTrigger assemblies and libraries in your final output. All code generated by CodeTrigger when used in your application is 100% redistributable.
    [Re-distributability applies only to the generated code, not CodeTrigger assemblies/libs].

    See the numerous tutorials on the site for getting started guides for different scenarios you might be interested in. Please feel free to contact us if you have any questions on these scenarios or any variation of. Currently provided tutorials cover Single-tier to Multi-tier projects, WPF, Winforms and Webforms, WCF Services, Unit testing & Mocking with Moq, & Dependency inject with Unity and Ninject.

    All tutorials can be run with either Oracle, MYSQL or Microsoft SQL Server database instances. However for brevity we have used screen shots from Microsoft SQL Server 2012, and the tutorials that involve Unit Test clients have fragments of Code assuming the Northwind database schema (downloadable from the net).