Exemplo n.º 1
0
 public EFRepository()
 {
     if (HttpContext.Current.Session["contexte"] == null)
     {
         HttpContext.Current.Session["contexte"] = new TireBase();
     }
     else
     {
         EFContext = (TireBase)HttpContext.Current.Session["contexte"];
     }
 }
Exemplo n.º 2
0
 protected void Session_Start()
 {
     Session["panier"]   = new Commande();
     Session["contexte"] = new TireBase(); // contexte qui existe tant que la session existe :
     //plus simple pour les écritures dans la base (évite les problèmes de tracking dus aux multiples instances de repository/contexte)
 }
Exemplo n.º 3
0
        public static DbContextTransaction Commencer()
        {
            TireBase contexte = (TireBase)HttpContext.Current.Session["contexte"];

            return(contexte.Database.BeginTransaction());
        }