Reputation: 1194
I have a table :
create table scheduled_task
(
scheduled_task_id serial primary key,
description varchar(255),
predicate varchar(10485760),
path varchar(255),
scheduled_task_type_id int references scheduled_task_type (scheduled_task_type_id)
);
My data object :
[Table("scheduled_task")]
public class DOScheduledTask
{
[Key]
[Column("scheduled_task_id")]
public long? ScheduledTaskId { get; set; }
[Column("description")]
public string Description { get; set;}
[Column("predicate")]
public string Predicate { get; set; }
[Column("path")]
public string Path { get; set; }
[Column("scheduled_task_type_id")]
public long? ScheduledTaskTypeId { get; set; }
}
I inserted one record into the table, that populates all fields.
I perform this in code :
var schedules = conn.Connection.Query<DOScheduledTask>("select * from scheduled_task ;");
var schedulesb = conn.Connection.GetList<DOScheduledTask>();
The first line yields a record, with everything but scheduled_task_id and scheduled_task_type_id are both null. For the second query, it is populated in full.
What am I doing wrong?
Upvotes: 4
Views: 358
Reputation: 1194
The problem is that the .Query
and .GetList
are from two different implementations; the one is from Dapper, and the other is from SimpleCRUD.
The solution was to create a custom mapper, due to the naming of the columns being different in code than in the DB.
Upvotes: 1