public SimpleMembershipInitializer()
            {
                DataContext init = new DataContext();
                init.Database.Initialize(true);
                Database.SetInitializer<UsersContext>(null);

                try
                {
                    using (var context = new UsersContext())
                    {
                        if (!context.Database.Exists())
                        {
                            // Create the SimpleMembership database without Entity Framework migration schema
                            ((IObjectContextAdapter)context).ObjectContext.CreateDatabase();
                        }
                    }

                    WebSecurity.InitializeDatabaseConnection(
                        Config.ConnectionStringName,
                        Config.UsersTableName,
                        Config.UsersPrimaryKeyColumnName,
                        Config.UsersUserNameColumnName,
                        autoCreateTables: true);
                }
                catch (Exception ex)
                {
                    throw new InvalidOperationException("The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588", ex);
                }
            }
        static void Main(string[] args)
        {
            Console.WriteLine("Initializing Database...");

            DataContext context = new DataContext();
            context.Database.Initialize(true);

            Console.WriteLine("Done...");
            Console.ReadLine();
        }
Example #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Initializing Database...");

            DataContext context = new DataContext();
            context.Database.Initialize(true);

            Console.WriteLine("Done");
            Console.ReadLine();

            //ApplicationUnit unit = new ApplicationUnit();

            //unit.Users.
        }
        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("Initializing Database...");
                DataContext context = new DataContext();
                context.Database.Initialize(true);

                Console.WriteLine("Done...");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            
            Console.ReadLine();
        }
Example #5
0
 public ActionResult Index()
 {
     DataContext context = new DataContext();
     context.Database.Initialize(true);
     return View();
 }