示例#1
0
        public MainContext()
        {
            var connectionString = "mongodb://localhost/?safe=true";
            var server           = MongoServer.Create(connectionString);

            database = server.GetDatabase("cardMage");

            Cartas       = database.GetCollection <Carta>("cartas");
            Baralhos     = database.GetCollection <Baralho>("baralhos");
            UserProfiles = database.GetCollection <UserProfile>("usuarios");

            if (Cartas.Count() <= 0)
            {
                Baralhos.RemoveAll();
                Cartas.RemoveAll();
                UserProfiles.RemoveAll();
                Seed();
            }
        }