in

Community

Take part in the community surrounding CodeBreeze and other products from SteelBlue Solutions.

CodeBreeze Blog

  • CodeBreeze 2.0.3 released

    The next maintenance build of CodeBreeze, version 2.0.3 is now online at www.steelbluesolutions.com

     

  • CodeBreeze on Twitter

    Follow CodeBreeze on Twitter !!!

  • Using Target Tags to identify parent-child relationships

    CodeBreeze is not marketed as an ORM product and thus does not allow the identification of a parent-child relationship in the entity list.  It especially does not map this from database foreign-key information as more often than not, foreign key setup in a database is not a parent-child definition as many think it is.  It is merely a case of normalization and hierarchical representations.  Instead, Codebreeze being a full-featured code-generator supplies an answer to this dillemma using a different technique.  CodeBreeze allows you do define what's known as target-tags at the project template level.  Target-tags are simple strings that are defined in a project template and later attached to either business entities or query wrappers in a CodeBreeze Project.  You can think of this "attachment" as decorating classes with attributes.  And like .NET attributes, they are only as useful as that which calls upon them.

    The CSLA Project Templates that ship with CodeBreeze define target tags called Parent, Child, IsParent, and IsChild.  To take advantage of these in a parent-child scenario within your generated code, you would create your CodeBreeze Project based on one of the CSLA Project Templates as you have probably been doing so already.  You then go to the Project menu and select the "Assign Target Tags" option.  The screen that comes up allows you to see a list of your business entities or your query wrapper, though I'm willing to say that more often than not you would assign target tags to business entities.  You'll see that everytime you select an entity, you'll see the list of available target tags with any possible values.  All target-tag values are simply string entries.  As of right now, you can only see target-tags for a selected business entity using this screen, but an upcoming CodeBreeze release will include a screen that will pivot this information; allowing you to select a target-tag and see their values for all entities in a single list.  There will also be an icon indicator in the project explorer in the future that will tell you that element in the project has one or more target tag values set.

    A logical use for the target-tags defined in the CSLA project templates would be a situation where you have a business entity called Order and one called OrderDetail.  You would set the value of the IsParent target tag of the Order entity to the word "true" and the Child target tag of the Order entity to the word "OrderDetail".  Then you would set the value of the IsChild target tag of the OrderDetail to "true" and the Parent target tag to "Order".

    This is a pattern that you would repeat for any other relationships you may have.  It's even possible to use both the IsParent and IsChild target tag on an entity if you have a parent-child-grandchild scenario, though getting to that level more than likely indicates you may have too complex a design.

    Target-tag values on any project member are accessible from a code-template.  This is illustrated by the CSLA code templates that use the CSLA base classes, BusinessBase, BusinessListBase, and EditableRootListBase.

    If you have an object defined in a code template of type CodeBreeze.Business.BusinessEntity to indicate the current entity for which you are currently generating code (say in a variable called _Entity), you can access the value of a target-tag by saying: _Entity.Tags("IsChild").Value.

    Note that I'm using VB syntax here so of course, square brackets would have to be used in C#.  If you didn't set a value for a specific target-tag, this would simply return an empty string.  Also note that since all target-tags are string values, if you want to express a boolean, you would need to set the value to the string "true" or "false" and then perform a Convert.ToBoolean in the code template.  The CSLA code-templates check for these values and set appropriate simple variables in the InitializeVariables method of the code-templates code-behind class.

    Later, throughout the code template you can use these values to determine what code gets generated.  In the case of the CodeBreeze CSLA templates, you'll see usage of IsChild and IsParent variables throughout to determine generated output.

    If you have a situation where one parent entity may support more than one possible child entity type, you have define this using one target-tag.  Since target-tags can only have one string value for each entity, you would define your values using a delimiter then parse it out in the code-template later.

    The target-tag approach keeps CodeBreeze from becoming "just another ORM" and also potentially solve many other problems besides parent-child relationship.  You can define a target-tag for anything you think you may need, then assign it and use it in a code template if you wish to alter the generated code at an entity-basis.

    We hope this blog-entity helps you in deciphering how target-tags work and how they can be used to handle parent-child relationships.

    Remember, CodeBreeze ships with CSLA templates that support the latest CSLA release (3.6).  Code-templates for previous CSLA versions still ship with the product but are NOT supported and will not continue to be enhanced.  Only the latest code-templates will be fixed or enhanced continuously.

    As always, thanks for using CodeBreeze !

     

  • CodeBreeze 2.0.2 is available.

    The second maintenance release for CodeBreeze 2.0 is out.  There is a small quirk in assigning code templates in a project template.  We've posted a quick-fix in the forums here:

    http://community.steelbluesolutions.com/forums/t/39.aspx

     

  • CodeBreeze 2.0.1 is available

    The first maintenance release for CodeBreeze 2.0 has been released and is available at www.steelbluesolutions.com.

     

  • CodeBreeze 2 licensing

    CodeBreeze 2 does NOT require a new license.  Our EULA states that we reserve the right to request upgrade license fees on "Major" revision releases, but we have decided against that for version 2.  Everyone who has purchased CodeBreeze 1 can install CodeBreeze 2 with their exact same unlock credentials.

  • CodeBreeze 2 released !

    Why is it such an anxious and even terrifying time putting a new release online?  Well, I guess some day we'll figure out the answer to that question.

    CodeBreeze 2 is now available on www.steelbluesolutions.com.

    Please be sure to read the "Release Notes" and the new "What's New" section (available from a button in the upper right hand corner of the Start Page).

    Even the installer is new as you will no doubt notice.  One of the questions the installer will ask you is for your mail server information.  This is so CodeBreeze can send out emails from any error report.  Some of you have reported that this feature was broken and it was due to our mail server requiring login credentials for SMTP outgoing mails.  Obviously this is not information that we can put into a config file, or even hard code, so now you can enter your own outgoing server info to make this feature work.

    The Help file is also updated and includes the Schema Providers Guide and the CodeBreeze Modules Guide.  Be sure to read the topic on "Working with Code Templates" in the Users Guide as this is where much of the new functionality in CodeBreeze 2 resides.

    As always, please be sure to give us feedback and report any issues you find right away.  CodeBreeze 2 has undergone some serious testing but you know how software issues can creep up.

    Build-releases will be done to push out fixes only for now on.  As new features are added during the year or major modifications made, we will increase the application's minor number (CodeBreeze 2.1 is already in the works).

    Once again, thank you for using CodeBreeze and we look forward to version 3.

     

  • Final Update !

    OK folks.  Two items of interest here.  First of all, the next release of CodeBreeze is ready to be rolled out.  We're finalizing the documentation and look to post it on Monday or Tuesday of next week.  Pushing a new release on a Friday is never a good idea since we want to be completely available for support immediately.  The other item of interest is the ever-so-popular versioning dillemma.  After discussion with a couple of beta-testers and other people of influence (some users in fact), we dedided that this release has too many new features and improvements and have re-dubbed it CodeBreeze 2.  The features we have not finished but will release throughout the year will increase the minor version number (2.1, 2.2, etc.).  This product has been out for a year now and we think that it deserves a major version # increase. 

    Several of you have sent us feedback and agree with this position so we hope that CodeBreeze 2 lives up to your expectations.  The next posting you should see from us will be announcing that CodeBreeze 2 is online and available for download.  Of course you know, CodeBreeze itself will tell you that when you open it :).

    Thank you again for your continued support - and spread the good word.

  • Another 1.1 Update

    In the interest of keeping everyone up to speed, all is done and we're finalizing the doc-changes as we speak.  We expect to get the 1.1 release online some in the middle of next week.

  • Update on CodeBreeze 1.1

    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.

    _________________________________________________________________________________________

     

     

  • Polling Question on the forums

    We've posted a polling question on the CodeBreeze Forums - please visit them to cast your opinion.

    thank you

  • Upcoming release schedule

    So here's the deal foks:

    Certain features planned for CodeBreeze 2 will not be ready by end of year, but we do not want to hold up the release and make anyone wait longer so we've planned to revert back to the original release name of CodeBreeze 1.1 and ship the product with the features that are tested and ready.  The additional database providers, UI enhancements, additional extensibility points, and CodeBreeze Trainer (video) application will be put off until CodeBreeze 2, scheduled for release in 2009 Q1.

    CodeBreeze 1.1 will be released before end of year and will include the following enhancements over 1.0:

    • Unlimited code-template nesting
    • Enhanced template error reporting
    • CSLA 3.6 templates
    • Additional DevExpress XPO templates
    • Snippet generation support

    We hope this will satisfy those who have been inquiring as to the release of the next version of CodeBreeze, while still leave you with a pleasant anticpation for 2.0.  There are also a couple of surprise features being released in 2.0 that we're sure will excite everyone.

    Thank you all for your continued support.

  • CSLA 3.6 Templates will be out with CodeBreeze 2

    We're hopeing to push out CodeBreeze 2 (previously named CodeBreeze 1.1) by end of year.  This build will include templates for CSLA 3.6 as well as a DalBase class that takes advantage of CSLA's new ConnectionManager class.  The 3.5 templates will remain with the product but will not be further enhanced or supported by us so it's up to the community on this one.

    Thanks again to everyone for their great comments on the product !

  • Minor issue with a Project Template in 1.0.0088 - fix going out today.

    Thanks to Burim Ratkoceri who noticed that the CSLA 2005 Project Templates were missing a boolean field in the custom fields section.  This field should be called AutoGenBusinessRules and needs to be added to the two language-specific project templates for CSLA 2005 and the aggregate one as well.  Any CodeBreeze Projects already created using any of these three Project Templates need to either re-apply the project template or edit the project-specific project template and add the field there as well.  The field is being accessed by the BusinessObjectBase code templates in order to generate StringRequired and StringMaxLength business rules based on database information.

    Today, Monday Sept. 1st (Labor Day), we're pushing out the fix in build 1.0.0089.

  • Great new feature for CodeBreeze 1.1 is complete !

    We've mentioned before that CodeBreeze 1.1 will have improved template error reporting for debugging purposes.  This means that compilation errors in the code template are traced back to the actual line in the code template that caused them.  This will now be reported in an error panel much like the one in Visual Studio.  The new panel will list errors out with their line number and the code template in which they were found.  This is relevant because of another great new feature: nested code templates, and compiling a code template also compiles any sub-templates in the tree.  Also like Visual Studio, double clicking on an error in the panel will expose the culprit template and jump that line where the error will be shown in an underline.  This is going to make tracking errors in code templates unbelievable easier than it currently is.

More Posts Next page »
2008 - All rights reserved
Powered by Community Server (Commercial Edition), by Telligent Systems