Moving to ASP.net from ColdFusion

This article provides:

  1. A link to MSDN (Microsoft Developer Network) where you can see some of the ColdFusion® to .net translations that Microsoft has provided

  2. Some of my own suggestions that a ColdFusion developer should know when going to .net


This page on MSDN provides some .net translations to some ColdFusion functionality.

1. Topics that MSDN Covers



  • Sessions

  • Email

  • HTTP Request (server-side)

  • Date and Time Formatting

  • Cookies

  • Database Query & Output

  • Try/Catch


2. Important Things You Should Know


Strong-Type vs Loose-Type

  • .net is a strongly typed language. This means that if you want to put an integer into a variable, the variable has to be declared as an integer type from the beginnning, and you will never be able to put anything other than an integer into that variable.

  • ColdFusion is loosely-typed so that you can put any type of object you want into any variable.


Case Sensitive

  • When referencing variables or methods in .net you must use the same case.


Methods

  • Methods are just another word for functions. (As far as I know.)

  • All methods must be declared either public, private, or protected. This is called the "access modifier"

  • All methods must specify what type of variable they will return. If it won't return a variable then you must specify "void".

  • All arguments must have their type specified.

  • Examples:
    [php]
    // Author: Anthony Tietjen
    // Date: April 2009

    // This method concatenates two strings and returns the result as a string
    // The "access modifier" of private means that code outside of
    // this file can access this method.
    public String Concatenate(String Text1, String Text2)
    {
    String result = Text1 + Text2;
    return result;
    }

    // This method adds two integers and returns the result as an integer
    // The "access modifier" of private means that only code within
    // this file can access this method.
    private int Add(int Number1, int Number2)
    {
    int result = Number1 + Number2;
    return result;
    }

    // The "access modifier" of protecteds means that only a class that
    // inherits from this class can call this method.
    protected void Save(String FirstName, String LastName)
    {
    // Process code here

    // Don't return anything
    }
    [/php]


Inheritance

  • ColdFusion Example
    [xml]<cfcomponent name="User" extends="DatabaseObject">
    <cffunction name="Add">
    ...
    </cffunction>
    </cfcomponent>
    [/xml]

  • .net Example
    [php]public class User : DatabaseObject {
    public int Add(int Number1, int Number2){
    ...
    }
    }[/php]

Comments

Celebrity Blog said…
Extra Reading...

[...]we like to honor other sites on the web, even if they aren't related to us, by linking to them. Below are some sites worth checking out[...]...
Armagard said…
The info on this post is beneficial.
Aneita said…
educational post. you're always making us learn something new, thanks.http://www.jogosdocartoon.net

Popular posts from this blog

Adobe® Flex® Combobox: Selecting an Item Without Using SelectedIndex

Parameters Sent by TinyWebDB in App Inventor for Android