public DisplayPage GetDisplayPage() { { var sc = new FlipSideDataContext(); DisplayPage dp; //dp=sc.DisplayPage.SqlQuery("sp_getDisplay"); return(new DisplayPage()); } }
public static List <StoryPair> GetTodaysStories() { var result = new List <StoryPair>(); using (var db = new Repository().CreateConnection()) { db.Database.Initialize(force: false); var cmd = db.Database.Connection.CreateCommand(); cmd.CommandText = "CALL sp_getDisplay"; using (var context = new FlipSideDataContext()) { var spp = context.Story.SqlQuery("CALL sp_getDisplay").ToList(); } try { db.Database.Connection.Open(); var r = db.Database.SqlQuery <Story>(" CALL flipside.sp_getDisplay"); var e = r.CountAsync(); var spp = new StoryPair(); MySqlDataReader reader = (MySqlDataReader)cmd.ExecuteReader(); //db.Database.Log = query => System.Diagnostics.Debug.Write(query); if (reader.HasRows) { while (reader.Read()) { var sp = new StoryPair { LeftStory = ((IObjectContextAdapter)db).ObjectContext .Translate <Story>(reader) .Where(c => c.lean == 1) .ToList(), RightStory = ((IObjectContextAdapter)db) .ObjectContext .Translate <Story>(reader) .Where(c => c.lean == 2) .ToList() }; //// Move to second result set result.Add(sp); reader.NextResult(); } reader.Close(); } //// Move to second result set //reader.NextResult(); //sp.RightStory = ((IObjectContextAdapter)db) // .ObjectContext // .Translate<Story>(reader); //result.Add(sp); } finally { //db.Database.Connection.Close(); } return(result); } }
public DA(FlipSideDataContext context) { this._context = context; }
public StoriesController(FlipSideDataContext context) { _context = context; }