in

Community

Take part in the community surrounding CodeBreeze and other products from SteelBlue Solutions.
Latest post 05-06-2009 1:09 AM by Joseph Baggett. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 02-18-2009 1:53 PM

    Code-behind only in VB?

    I was really excited about CodeBreeze, but it sure looks to me like all the code-behind, even for C# projects, is in VB.  This is hugely disappointing.  Is there a reason for this?  If I write my own templates, is there something restricting me to VB?  Anyone have CSLA templates with code-behind written in C#?

  • 02-20-2009 7:53 AM In reply to

    Re: Code-behind only in VB?

    You can have C# or VB.NET.  In your C# code behind file do this:

    <%@ Template Name="TemplateNameHere" LogicLanguage="CSharp" OutputLanguage="CSharp" Inherits="TemplateHelper" CodeFile="..\\..\\TemplateHelper.cs" %>

    Just make sure your path to your code behind is correct in relation to your code template you are using.

     

    public 

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    class TemplateHelper : CodeBreezeTemplateBase

    {

    public static string YourMethod(CodeBreeze.Business.BusinessEntity entity)

     

     

     

    {

    return "Called CodeBehind TemplateHelper";

    }

     

     

     

    }

     

  • 02-25-2009 4:00 PM In reply to

    Re: Code-behind only in VB?

    We had to chose a language to use for code-template logic code and code-behind code.  We chose VB.  The important thing was to release code templates that generate in either language.  But doubling the quantity of code templates just to have identical templates with the logic script written in two languages was not an efficient use of time.  You can certainly use C# or VB as your logic language, so you're not restricted.

    A personal note: There's to much language bigotry out there, let's get over that.  Any good .NET developer should be able to code both languages, but unfortunately I hear people even *** about books when they're not released in both languages.  This is pretty perplexing to me.  I even have books written for Java simply because they are good books and teach good concepts and good designs and patterns.

    As always, thank you for the comments.

  • 05-05-2009 7:33 PM In reply to

    Re: Code-behind only in VB?

    With all due respect, the idea that any "good" .NET dev should be able to use either C# or VB is quite a value judgment.  I can write in a few languages, but one of them doesn't happen to be VB.NET.  When .NET came out, I chose C# for a reason - I don't say it's better, but I just find VB personally icky to look at and it reminds me too vividly of my old VB6 days that I'd just as soon forget.  Obviously, I can read the VB logic, but it would be nice to have at least one sample template written in C# (easier to cut and paste, you know . . . )  Anyway, given the learning curve that's already present to get up to speed using Code Breeze, I would suggest that templates that output C# should probably have thier logic language also be C#, if adoption is a concern.

  • 05-06-2009 1:09 AM In reply to

    Re: Code-behind only in VB?

    I would agree on the fact if you code in C#, you should be able to read/translate code code from VB, and vice-versa.  Bottom line is the syntax is very similar with few differences.  Some people have even made the mistake that each language feature is featured in both languages which is not true.  Since they are so similar, Microsoft has even announced since version 4.0 of the languages each feature introduced will be featured in both languages, so it will be true now and in the future for every new feature.  You'll usually find people that are one sided, and will say one is better than the other, when it really comes down to whatever you are more comfortable with because you are fluent at the language.

    I personally prefer C#, and still code in VB(when needed).  There are even tools like Reporting Services(not saying it is the best reporting tool in the world, but sometimes the client determines the technology used) which don't even give you the option of using C#... so regardless, you should be familiar enough with C# to be able to read VB.  I'm sure you have looked up coding examples before only to find VB and have had to convert it to C# right?  I would be really surprised if you didn't.

    Take care.

Page 1 of 1 (5 items)
2008 - All rights reserved
Powered by Community Server (Commercial Edition), by Telligent Systems