Jul 24th, 2009 | 1 Comment

Text Template Transformation Toolkit (T4) is a template-based code generation engine. This is one of the best things I found out today, so just thought of sharing with you guys.

This is awesome code generator template. This template is best used to generate your business logic code that will communicate with the database.

You can create a code page that will have all your database tables as Classes and their fields as its variables. So you will have your database tables as class and its columns as variables. You will have everything object oriented.

This template has an extension “.tt” and you can write code in any language C# or Vb and have the code file generated in any of these language you want. All you have to do is write the code in “.tt” file and its corresponding “.cs” or “.vb” file will be generated once you save your “.tt” file.

Its truly AMAZING!!!

Check this out.

[googlevideo=http://video.google.com/videoplay?docid=-3383108526856631845&hl=en]

Jul 22nd, 2009 | No Comments

Another one of those problems that can stump you for a while. I often make backups of files as I progress and sometimes leave them in the website folder, this was fine with classic ASP but as I have found with ASP.Net can cause all sorts of problems.One issue I was having was trying to reference a component in my aspx page from the codebehind page and seeing the following error when trying to reference a label control:

“Label2 does not exist in the current context”

So I found that the problem was even though I renamed one of my old files it still contained the class that my codebehind was referencing (i.e. the class names were still the same) – and therefore was not seeing the newly added Label control to my new code.Shame the compiler doesn’t realise the duplication and give some indication.

Lesson: Remove any backed up files from the web folder and/or build directory to avoid pain )

Written by Ajay Matharu

July 22nd, 2009 at 11:24 pm