Extending DataRow with a generic Fill method ( map DataRow directly to user typed object )

יום חמישי, יולי 23, 2009

Background: Every developer creates a lot of classes based on database tables, the data binding is a routing i wanted to save.  so, First we had to create new attribute to bind the databse column to our field/property, then we had to creare the extention.  here is the source code of my class: Source: /// <summary>/// Uses to bind field or property to a specific database column/// </summary>public class ColumnAttribute : Attribute{public string ColumnName;public object DefaultValue;/// <summary>/// Initializes a new instance of the <see cref="ColumnAttribute"/> class./// </summary>/// <param name="ColumnName">Name of the column.</param>public ColumnAttribute(string ColumnName){   this.ColumnName = ColumnName;} /// <summary>/// Initializes a new instance of...
2 תגובות