Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to use code templates for entity properties
Message
De
26/05/2007 15:00:34
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Conception classe
Titre:
How to use code templates for entity properties
Versions des environnements
Environment:
C# 2.0
Divers
Thread ID:
01228732
Message ID:
01228732
Vues:
66
I'm using VCS Express 2005.
I have a lot of property definitions in different classes like

public class MyEntity {
public string somestringfield {
get { return (string)Row["somestringfield"]; }
set { Row["somestringfield"] = value; }
}

public string someotherstringfield {
get { return (string)Row["someotherstringfield"]; }
set { Row["someotherstringfield"] = value; }
}
}

When template changes I must manually change it in hundreds of places.

I tried to use template

#define StringFieldTemplate( propname ) \
public string propname { \
get { return (string)Row[propname]; } }
set { Row[propname] = value; } \
};

public class MyEntity {
StringFieldTemplate("somestringfield2")
StringFieldTemplate("someotherstringfield2")
}

But got error.
How to implement this ?
Andrus
Répondre
Fil
Voir

Click here to load this message in the networking platform