Hey folks,
Due to the holiday season coincidentally being smack in the middle of our CodeBreeze 1.1 release plans, we are delayed in finalizing the beta testing phase. We anticipate the release time being some time in the middle January and have no reason to believe another delay will occur. All production coding is complete and we're only undergoing final beta testing and help-file updating. We appreciate everyone's patience and to keep your anticipation energized, here's the "What's New" document:
What's New in 1.1?
The following is an overview of the new features in CodeBreeze 1.1. Fixes and minor modifications are not listed here so please check the Release Notes for a complete list of enhancements, modifications, and fixes.
Nested Templates
This is one of the more exciting features in this release. You can now create code templates that are meant to be reused by other code templates. To use a code template a nested template, add the new Include directive to the parent code template.
The format is as follows:
<%@ Include Template="SubTemplateName" File="Relative Path" %>
The File attribute must include the relative path to the sub-template; relative to the location of the current template (ex: ..\..\MySubTemplace.cct )
The Template attribute is set to a name that you wish to use to identify this sub-template. This only needs to be unique within the parent template because in your code later you will use the following function call: RenderSubTemplateName().
This is a function that returns a string so you would normally put it in logic code that looks like this:
<%=RenderSubTempalateName()%>
Any properties in the sub template that are also in the parent template will automatically be filled with the same values as those in the parent. If your sub template contains additional properties, you can set their values by sending pairs of arguments in the function call. For example, if your sub-template, identified once again by a value of SubTemplateName in the Template attribute of the Include directive, also defines a property called _ReadOnly of type System.Boolean, you can send a value of true into this property from the parent like this:
<%=RenderSubTemplateName("_ReadOnly", true)%>
If you have more than one property who's value you want to change, or you want to change the value of properties that exist in both templates, you just add argument pairs. Let's say both your parent and sub-template have the _Project and _ActionTarget properties, but your sub-template also has a _ReadOnly property as described above. You not only want to set the _ReadOnly property, but for some reason you want to change the _ActionTarget property to a value of "Other":
<%=RenderSubTemplateName("_ActionTarget", "Other", "_ReadOnly", true)
Code templates can be unlimitedly nested in CodeBreeze.
The CSLA 3.5 & 3.6 templates demonstrate usage of nested code templates.
_________________________________________________________________________________________
In-Line Logic Functions
If you don't want to go through the trouble of creating and using code-behind classes for your code templates (perhaps you don't need the reusability), you can now create actual functions to call directly in your code templates by creating a logic code block using the new <%# and %> tags.
For example:
<%#
Public Function GetSomeCode(ByVal param1 As Integer) As String
Return "This is the integer you sent: " & param1.ToString()
End Function
%>
Now you can call this function anywhere in your code template like this:
<%=GetSomeCode(5)%>
_________________________________________________________________________________________
New Template.Render Method
An earlier release of CodeBreeze introduced the variable that allowed you to access any attribute in your Template directive as if it were a property. This variable now has a Render method that accepts a string value. Use it like this:
<%
Template.Render("// this is a code comment")
%>
This is the equivalent of inserting logic code like this:
<%="// this is a code comment"%>
This method is good when you don't want to constantly change in and out of hardcode and logic code so you can simply create a <% ... %> logic block and use Template.Render several times within it instead of having to close the logic code block and reopen them several times.
For you ASP people, this is similar to Response.Write.
_________________________________________________________________________________________
Code Templates use .NET 3.5
Provided that .NET 3.5 is installed on the machine on which you are running CodeBreeze, compiling code templates will now target that compiler. This will allow you to use LINQ code in your code template logic now.
If .NET 3.5 is not found on the machine, the 2.0 compiler will be automatically used. If you wish for a code template to target the 2.0 compiler even if you have .NET 3.5 installed, add the CompilerVersion="2.0" attribute to your Template directive.
_________________________________________________________________________________________
Improved Template Debugging and Error Reporting
This is also one of the more exciting features in this release.
Compiler errors within code templates, sub templates, and/or code-behind classes are now tracked and pinpointed on the original file in which they occur. This gives you greater power in tracking down problems in your code templates.
Furthermore, all errors are now reported in their own Error Panel (similar to that of Visual Studio), allowing you to see the error, file of origin, and line number in the original file. Double clicking on any error in the list will take you to that file and line. Within the template editor, the line(s) in question are underlined red for easy finding.
_________________________________________________________________________________________
Code Template Property Presets
When setting up Code-Gen Processes in Project Templates, you can now preset some of the properties (this applies to properties of type System.String only). This will allow to have more than one Code-Gen Process that target the same Code Template, yet each send a different value into one or more of the Code Template's properties.
_________________________________________________________________________________________
Custom Field Tooltips include Description
When defining Custom Fields in Project Templates, you can now give them a Description that is added to the tooltip that pops up when hovering over said field in a CodeBreeze Project's Preference Window.
_________________________________________________________________________________________
Gen-Tasks
This too is one of the major additions to CodeBreeze.
Gen-Tasks in essence are subsets of Code-Gen Processes, allowing you to target specific Business Entities or Query Wrappers.
The Project menu has the selection for the Gen-Task Maintenance Window where you can view your Code-Gen Processes in a nicely organized tree fashion by Architecture Layer. Here you can extend this tree by creating Gen-Tasks under any Code-Gen Process you wish. You then select that target type for this Gen-Task and one or more targets.
Gen-Tasks appear in both the Code Generation menu and the Code Generation panel indented under their parent code-gen process. Clicking on them will run that Code-Gen Process for the pre-specified targets only.
_________________________________________________________________________________________
New Code-Gen Batches
The Code-Gen Batches Maintenance screen has been completely reworked to be more intuitive and also to support the new Gen-Tasks feature. The same "Architecture Layer->Code-gen Process->GenTask" tree used in the Gen-Task Maintenance screen is used here to display Code-Gen Processes and Gen-Tasks available for a batch as well as those in a batch.
A Code-Gen Batch can now include a combination of Code-Gen Processes and Gen-Tasks.
_________________________________________________________________________________________
Template Processing Cache
Code Template parsing and processing (not Rendering) is now cached for each call to generate. This can be a call to a Code-Gen Process or a Batch. This greatly increases generation performance as the compilation need only happen one time when attempting to render for the same code template for multiple targets.
_________________________________________________________________________________________
New "Find/Replace" Window
The "Find/Replace" Window has been completely rewritten as has the actual functionality. Find & Replace are now two separate options in the Search menu. Functionality now follows industry standards including the ability to pre-populate the form from highlighted text and for the search to correspond to any open window.
_________________________________________________________________________________________
More Extensibility Points
There are four new extensibility points for which you can write CodeBreeze Modules.
The new injection points are:
· BusinessEntityCreation
· BusinessEntityFieldCreation
· QueryWrapperCreation
· QueryWrapperArgumentCreation
These occur at various times when targets and their members are created from database elements, including initial creation, maintenance, and resynchronization.
You can write CodeBreeze Modules to tap into any of these events, change any of the information being put into the new target or cancel that specific target element creation.
This enhancement works well with a new property called State which is now a part the following objects:
· BusinessEntity
· EntityField
· QueryWrapper
· WrapperArguments
The State property is of type ItemState and is very simply a name-value collection of object types. It can be used to store anything you want so you can tap into any of the above-mentioned extensibility points in order to place information into this property.
A CodeBreeze Module called PrecisionAndScaleInserter is shipped with CodeBreeze 1.1 (complete with source) and is used to insert database precision and scale information into EntityField types during the creation of business entities. It uses the new State property.
_________________________________________________________________________________________
Flexible Code-Generation Output File
Previous versions of CodeBreeze have forced you to determine what the output file name is when you design the Code-Gen Process in a Project Template, though you've always been able to base the output folder location on a custom field. This flexibility is now extended to the output file name. You can now select either an output file name (pattern actually, with a {0} used in the place of the target name), or the name of a File-type Custom Field. Later in a CodeBreeze Project, you can fill the field with the output file name you want. This gives you the ability to make the output file name decision at the CodeBreeze Project level, not only at the Project Template level.
In the past you could have simulated this behavior by editing the project template applied to a project, but of course any re-application of the project template would override your changes so this enhancement makes things a bit more robust.
_________________________________________________________________________________________