예제 #1
0
 public static void InitializePagesMongoDb(IServiceProvider serviceProvider)
 {
     if (NetworkHelper.ConnectionCheck(27017))
     {
         using (var db = serviceProvider.GetService <IMongoDbDataContext>())
         {
             //db.MongoDatabase.DropCollection(db.CollectionNameSelector.GetCollectionName<Page>());
             //var pages = BsonSampleData.GetPages();
             //db.Collection<Page>().InsertMany(pages);
         }
     }
 }
예제 #2
0
 public static void InitializeMusicStoreMongoDb(IServiceProvider serviceProvider)
 {
     if (NetworkHelper.ConnectionCheck(27017))
     {
         using (var db = serviceProvider.GetService <IMongoDbDataContext>())
         {
             db.MongoDatabase.DropCollection(db.CollectionNameSelector.GetCollectionName <AlbumBson>());
             var albums = BsonSampleData.GetAlbums(imgUrl, BsonSampleData.Genres, BsonSampleData.Artists);
             db.Collection <AlbumBson>().InsertMany(albums);
         }
     }
 }