I am trying to use Npoco but running into some problems with FetchOneToMany
I have a sql statement that joins two tables and I output all the columns.
[TableName("TableA")] [PrimaryKey("Id")] public class TableA { public int Id { get; set; } public DateTime EffectiveDate { get; set; } public IList<TableB> TableBs { get; set; } } [TableName("TableB")] [PrimaryKey("TableBId")] public class TableB { public int TableBId { get; set; } public int SomeNumber { get; set; } public int Id { get; set; }
I pass 4 parameters in my real request. I return the result and the TableBs property fills up and looks good. However, EffectiveDate for some reason does not populate and is the default C # time.
What am I missing?
Edit
This is what I have as my request
SELECT TableA.Id, TableA.EffectiveDate, TableB.TableBId, TableB.SomeNumber FROM TableA INNER JOIN TableB ON TableA.Id = TableB.Id WHERE (TableA.EffectiveDate = @0) Func<TableA, object> func1 = (x) => x.Id; Func<TableB, object> func2 = (x) => x.Id; var test = RelationExtensions.FetchOneToMany<AdminFeeBandGroup, AdminFeeBand>(unitOfWork.Db, func1,func2,sql, "10-18-2012");
chobo2
source share