I have a really simple think I'm trying to do to migrate some old DAL code to DAL2, slightly complicated by converting to C# at the same time. This first step should have been a piece of cake and I've hit a wall. All I want to do (for now) is query a view and display it in a datalist. Created a new project with the latest Christoc template, duplicated the View.* and item.cs and itemcontroller.cs, updated the manifest, and updated the view.ascx.cs to use the field names in the datalist. I made the model and controller to match the view, and the controller only does a GetAll since that's all I need (for now). I had to define a primary key on the decoration and return a portalid to get the caching to work, but now I get no errors, no records. I can find no real info on how to debug what's wrong. So my model has:
I have a really simple think I'm trying to do to migrate some old DAL code to DAL2, slightly complicated by converting to C# at the same time. This first step should have been a piece of cake and I've hit a wall. All I want to do (for now) is query a view and display it in a datalist. Created a new project with the latest Christoc template, duplicated the View.* and item.cs and itemcontroller.cs, updated the manifest, and updated the view.ascx.cs to use the field names in the datalist. I made the model and controller to match the view, and the controller only does a GetAll since that's all I need (for now). I had to define a primary key on the decoration and return a portalid to get the caching to work, but now I get no errors, no records. I can find no real info on how to debug what's wrong. So my model has:
[TableName("qryEventSummary")]
//setup the primary key for table
[PrimaryKey("RaceId", AutoIncrement = false)]
//configure caching using PetaPoco
[Cacheable("qryEventSummary_Items_", CacheItemPriority.Default, 20)]
//scope the objects to the ModuleId of a module on a page (or copy of a module on a page)
[Scope("PortalId")]
class EventSummary
{
///<summary>
/// Property for RaceId ()
///</summary>
[ColumnName("RaceId")]
int raceId { get; set; }
///<summary>
/// Property for PortalId ()
///</summary>
[ColumnName("PortalId")]
int portalId { get; set; }
and the controller has:
class EventSummaryController
{
public void CreateEventSummary(EventSummary t)
{
using (IDataContext ctx = DataContext.Instance())
{
var rep = ctx.GetRepository<EventSummary>();
rep.Insert(t);
}
}
public IEnumerable<EventSummary> GetEventSummary(int portalId)
{
IEnumerable<EventSummary> t;
using (IDataContext ctx = DataContext.Instance())
{
var rep = ctx.GetRepository<EventSummary>();
t = rep.Get(portalId);
}
return t;
}
but the call to get all the items:
rptEventSummaryList.DataSource = tc.GetEventSummary(PortalId);
returns nothing.
HELP!