Closed richarddavenport closed 7 years ago
@richarddavenport how do you execute the query with Dapper?
Like this:
db.Query<HouseAccount>(query.Sql, query.Params);
So I tried using the generic query like this:
var data = db.Query(query.Sql, query.Params);
And I now get results! But now I'm not sure how to cast the dynamic list to an IEnumerable<HouseAccount>
I get a cast error when I use (IEnumerable<HouseAccount>)data
@richarddavenport in your HouseAccountMap
you have this method:
public void ProductMap() { ... }
You probably copied the ProductMap
from an example and added void
to it. But that should be the constructor of the HouseAccountMap
for the mapping to work, like this:
public class HouseAccountMap : EntityMap<HouseAccount>
{
public HouseAccountMap()
{
// Define your mappings here
}
}
Closing this for now. Please re-open if it's still an issue.
Here's my model:
Here's my map:
Here's my sql
Using OWIN I have a startup.cs and I'm calling FluentMapper.Initialize() in there, like this:
My model gets serialized as all null values.