Ejemplo n.º 1
0
 public static void Initialize()
 {
     using (var context = new ElmahContext())
     {
         context.Database.Initialize(true);
     }
 }
Ejemplo n.º 2
0
        public static void Initialize()
        {
            var errorLogSection = ConfigurationManager.GetSection("elmah/errorLog") as IDictionary;

            if (errorLogSection == null)
            {
                throw new NullReferenceException("elmah/errorLog section in web.config is missing");
            }


            if (!errorLogSection.Contains("connectionStringName"))
            {
                throw new NullReferenceException("elmah/errorLog section in web.config is missing \"connectionStringName\" property");
            }


            using (var context = new ElmahContext(errorLogSection["connectionStringName"].ToString()))
            {
                context.Database.Initialize(true);
            }
        }