while (rdr.Read())
{
List<PackageDetailFile> pkgFiles = rdr.AutoMap <PackageDetailFile> ().ToList();
foreach (PackageDetailFile pkgf in pkgFiles)
{
PackageDetail pkgd = getPackageDetail((long)pkgf.PackageDetailId);
}
I have an error like:
'System.Data.SqlClient.SqlDataReader' does not contain a definition for 'AutoMap' and no extension method 'AutoMap' accepting a first argument of type 'System.Data.SqlClient.SqlDataReader' could be found (are you missing a using directive or an assembly reference?)
and I can't find the AutoMap reference.
The simple answer is to add a reference to the AutoMapper library. How you do that, you can easily find out if you search. I'll help you on your way: http://msdn.microsoft.com/en-us/library/wkze6zky(v=vs.100).aspx has a rather full-length exhaustive how-to, and https://stackoverflow.com/a/2157158/64976 is a more concise answer to a question about how to add references.
A more extended answer would perhaps be to suggest that you return to the basics of the AutoMapper documentation, .NET development and project structure and learn how to add a reference to a downloaded, third party assembly. http://automapper.org/ is a good place to start for information on AutoMapper itself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With