Пример #1
0
        public static void InitializeDatabase()
        {
            if (!Directory.Exists(dbDIR))
            {
                var dirInfo = Directory.CreateDirectory(dbDIR);
                var dirSec  = dirInfo.GetAccessControl();

                dirSec.AddAccessRule(new FileSystemAccessRule(
                                         "Users",
                                         FileSystemRights.FullControl,
                                         AccessControlType.Allow));

                dirInfo.SetAccessControl(dirSec);
            }

            database = new ESB2DatabaseContainer();
            database.Database.CreateIfNotExists();

            if (database.Users.Count() == 0)
            {
                CreateAdminAccount();
            }

            if (!database.StatusPageGroupings.Any(s => s.IsStatusBar == true))
            {
                CreateStaticStatusPage();
            }
        }
Пример #2
0
        internal static ESB2DatabaseContainer GetDatabase()
        {
            if (database == null)
            {
                database = new ESB2DatabaseContainer();
            }

            return(database);
        }