C# - IDataReader to Object mapping using generics

后端 未结 10 741
情歌与酒
情歌与酒 2020-12-16 19:07

How can I map a DataReader object into a class object by using generics?

For example I need to do the following:

public class Mapper
    {
          


        
10条回答
  •  清酒与你
    2020-12-16 19:35

    I don't think you'll be able to get around defining the relationship between fields in some form. Take a look at this article and pay particular attention to how the mapping is defined, it may work for you.

    http://www.c-sharpcorner.com/UploadFile/rmcochran/elegant_dal05212006130957PM/elegant_dal.aspx

提交回复
热议问题