Friday 15 July 2011

c# - Using Microsoft T4 to create data access classes -


I'm new to T4, but I've stumbled it and it looks very useful.

I am trying to generate some simple DA classes and a certain part of my code needs some advice.

How do I create a given code already, I have a table name and column name (in this case the table " Agreement " and the column " Agreement id < / Em> "," ContactId ", etc.)?

  if ((Ordinal_TableName_ColumnName1 == -1) || (ordinal_TableName_ColumnName2 == -1) || (ordinal_TableName_ColumnName3 == -1) || (ordinal_TableName_ColumnName4 == -1)) // Not interested in set {set Ordian (reader); } While (reader.HasRows ()) {returnCollection.Add (new unit (reader);}  

-1 is the default value and due to failure of the condition.

Audiences have fixed integer values ​​for the location only in some static DataReader results, they are set using the setordinals (Data Reader Reader) method.

Thanks Anthony

< P>

answer detected.

for (int i = 0; i & lt; table. Calculation; i ++) {written (string.format ("(ordinal_ {0} _ {1}. Z "), table .name, table.column [i] .name)); if (i> (table.Columns). Count - 1)) {WriteLine (" || ")}}}

thanks, ant


No comments:

Post a Comment