Last active
December 26, 2015 20:39
-
-
Save UberMouse/7210195 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void InsertGames(params SteamGame[] game) | |
{ | |
var collection = GetGamesCollection(); | |
try | |
{ | |
collection.InsertBatch(game, WriteConcern.Acknowledged); | |
} | |
catch (MongoCommandException ex) | |
{ | |
var x = ex; | |
} | |
} | |
public IEnumerable<SteamGame> RetrieveGames(params string[] appIds) | |
{ | |
var collection = GetGamesCollection(); | |
return collection.FindAs<SteamGame>(Query<SteamGame>.In(x => x.AppId, appIds.Select(x => new BsonString(x)))); | |
} | |
private MongoCollection<SteamGame> GetGamesCollection() | |
{ | |
var client = (ConfigurationManager.AppSettings["onAzure"] == "true") ? new MongoClient(connectionString) : new MongoClient(); | |
var database = client.GetServer()[dbName]; | |
return database.GetCollection<SteamGame>(collectionName); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment