public static BDDModel.Session EnsureSessionIsCreated(SoccerDataModelDataContext theContext, Player thePlayer, string sessionKey) { var session = (from dbSession in theContext.Sessions where dbSession.FacebookSession == sessionKey select dbSession).FirstOrDefault(); if (session == null) { session = new BDDModel.Session(); session.Player = thePlayer; session.FacebookSession = sessionKey; session.CreationDate = DateTime.Now; // En horario del servidor theContext.Sessions.InsertOnSubmit(session); } return session; }
private void detach_Sessions(Session entity) { this.SendPropertyChanging(); entity.Player = null; }
private SoccerDataModelDataContext CreateDataForRequest() { mContext = new SoccerDataModelDataContext(); HttpContext theCurrentHttp = HttpContext.Current; if (!theCurrentHttp.Request.QueryString.AllKeys.Contains("SessionKey")) throw new Exception("SessionKey is missing"); string sessionKey = theCurrentHttp.Request.QueryString["SessionKey"]; mSession = (from s in mContext.Sessions where s.FacebookSession == sessionKey select s).FirstOrDefault(); if (mSession == null) throw new Exception("Invalid SessionKey: " + sessionKey); mPlayer = mSession.Player; return mContext; }
private void attach_Sessions(Session entity) { this.SendPropertyChanging(); entity.Player = this; }