I tried mapping under plain ado.net to object using the excerpt of the code below
calling the code
dim personList as List(of Person) = new List<Person>()
personList = GetList(of Person)(iconn,"persons")
the function
Public Function GetList(Of T As Class)(conn As IDbConnection, tableName As String) As List(Of T)
' get body
Using cmd As New MySqlCommand(sql, conn, trans)
'cmd.Parameters.Add( ,)
Using rdr = cmd.ExecuteReader()
ret = MapToObject(rdr) -----> Error line
End Using
End Using
Return ret
' rest of body
End Function
'Map data
Public Function MapToObject(Of T As {Class, New})(dr As IDataReader) As List(Of T)
' Function body
End Function
bu t i get the following error
BC32050 Type parameter 'T' for 'Public Function MapToObject(Of T As {Class, New})(dr As IDataReader) As List(Of T)' cannot be inferred.
Where am i getting it wrong?
Aucun commentaire:
Enregistrer un commentaire