本文整理汇总了C#中IMongoCollection类的典型用法代码示例。如果您正苦于以下问题:C# IMongoCollection类的具体用法?C# IMongoCollection怎么用?C# IMongoCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMongoCollection类属于命名空间,在下文中一共展示了IMongoCollection类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ApplicationIdentityContext
private ApplicationIdentityContext(IMongoCollection<ApplicationUser> users, IMongoCollection<IdentityRole> roles, IMongoCollection<Client> clients, IMongoCollection<RefreshToken> refreshTokens)
{
Users = users;
Roles = roles;
Clients = clients;
RefreshTokens = refreshTokens;
}
开发者ID:DureSameen,项目名称:eTimeSheets.API,代码行数:7,代码来源:ApplicationIdentityContext.cs
示例2: ExpressionMethod
private static Task ExpressionMethod(IMongoCollection<Person> col)
{
var filter = new ExpressionFilterDefinition<Person>(x => x.Id == "my id" && x.Name == "Jack");
filter.Render(col.DocumentSerializer, col.Settings.SerializerRegistry);
//await col.Find(x => x.Id == "my id" && x.Name == "Jack").ToListAsync();
return Task.FromResult(true);
}
开发者ID:RavenZZ,项目名称:MDRelation,代码行数:7,代码来源:FilterMeasuring.cs
示例3: SearchByName
private static void SearchByName(IMongoCollection<EnergyDrink> collection)
{
Console.Clear();
Console.Write("Enter the name:");
var inputName = Console.ReadLine();
var fileter = Builders<EnergyDrink>.Filter.Eq("Name", inputName);
var result = collection.Find(fileter).ToListAsync().Result;
if (result.Count == 0)
{
Console.WriteLine("\nThere are no drinks with name {0}", inputName);
}
else
{
foreach (var item in result)
{
Console.WriteLine("Name: {0} => Price: {1}", item.Name, item.Price);
}
}
Console.WriteLine("\nPress any key to continue..");
Console.ReadLine();
}
开发者ID:ni4ka7a,项目名称:TelerikAcademyHomeworks,代码行数:25,代码来源:EntryPoint.cs
示例4: ExecuteAsync
public async Task<IEnumerable<Climb>> ExecuteAsync(GetClimbsQueryParameters parameters,
IMongoCollection<Climb> collection)
{
var filters = new List<FilterDefinition<Climb>>();
if (parameters.Id != Guid.Empty)
{
var filter = Builders<Climb>.Filter.Eq(c => c.Id == parameters.Id, true);
filters.Add(filter);
}
if (parameters.Styles != null && parameters.Styles.Count > 0)
{
var filter = Builders<Climb>.Filter.AnyIn(c => c.Styles, parameters.Styles);
filters.Add(filter);
}
if (!string.IsNullOrEmpty(parameters.Name))
{
var filter = Builders<Climb>.Filter.Eq(c => c.Name == parameters.Name, true);
filters.Add(filter);
}
var complexFilter = Builders<Climb>.Filter.And(filters);
var fullCollection = await collection.FindAsync(complexFilter);
return await fullCollection.ToListAsync();
}
开发者ID:MikeBeastall,项目名称:MonkeyStrong,代码行数:29,代码来源:GetClimbsQuery.cs
示例5: loadColors
public void loadColors(IMongoCollection<board_item> coll, string boardName)
{
List<board_item> colors = coll.Find(brd => brd.Type == "Color" && brd.Board_Name == boardName)
.ToListAsync()
.Result;
int i = 1;
foreach (board_item color in colors)
{
if (i == 1)
{
colorPlace1.ImageUrl = color.Image_Link;
i++;
colorPlace2.ImageUrl = "https://upload.wikimedia.org/wikipedia/commons/thumb/7/70/Solid_white.svg/2000px-Solid_white.svg.png";
}
else if (i == 2)
{
colorPlace2.ImageUrl = color.Image_Link;
i++;
colorPlace3.ImageUrl = "https://upload.wikimedia.org/wikipedia/commons/thumb/7/70/Solid_white.svg/2000px-Solid_white.svg.png";
}
else if (i == 3)
{
colorPlace3.ImageUrl = color.Image_Link;
}
}
}
开发者ID:dseller1,项目名称:Inspire-Design,代码行数:27,代码来源:inspiration.aspx.cs
示例6: AddMovies
private static void AddMovies(IMongoCollection<Movie> collection)
{
var movies = new List<Movie>
{
new Movie
{
Title = "The Perfect Developer",
Category = "SciFi",
Minutes = 118
},
new Movie
{
Title = "Lost In Frankfurt am Main",
Category = "Horror",
Minutes = 122
},
new Movie
{
Title = "The Infinite Standup",
Category = "Horror",
Minutes = 341
}
};
//collection.InsertBatch(movies);
collection.InsertManyAsync(movies).Wait();
}
开发者ID:sjbgit,项目名称:mongo_map_reduce_net,代码行数:26,代码来源:Program.cs
示例7: Querying
public Querying()
{
client = new MongoClient(); ;
database = client.GetDatabase("test");
collection = database.GetCollection<Student>("Users");
}
开发者ID:maximburyak,项目名称:TODA,代码行数:7,代码来源:Querying.cs
示例8: ChoiceRepository
public ChoiceRepository()
{
var client = new MongoClient(ConfigurationManager.ConnectionStrings["Mongo_patientcare"].ConnectionString);
_log = new Logger("WebAPI:ChoiceController");
_db = client.GetDatabase("patientcaredb");
_choices = _db.GetCollection<BsonDocument>("Choice");
}
开发者ID:dsb92,项目名称:patientcare,代码行数:7,代码来源:ChoiceRepository.cs
示例9: UserStoreTests
public UserStoreTests(string collectionPrefix)
{
collectionPrefix = $"{typeof(UserStoreTests).Name}_{collectionPrefix}";
_databaseFixture = new DatabaseFixture(collectionPrefix);
_userCollection = _databaseFixture.GetCollection<IdentityUser>();
_roleCollection = _databaseFixture.GetCollection<IdentityRole>();
_databaseContext = new IdentityDatabaseContext { UserCollection = _userCollection, RoleCollection = _roleCollection };
_errorDescriber = new IdentityErrorDescriber();
_userStore = new UserStore<IdentityUser, IdentityRole>(_databaseContext, null, _errorDescriber);
_claim1 = new Claim("ClaimType1", "some value");
_claim2 = new Claim("ClaimType2", "some other value");
_claim3 = new Claim("other type", "some other value");
_claim1SameType = new Claim(_claim1.Type, _claim1.Value + " different");
_identityClaim1 = new IdentityClaim(_claim1);
_identityClaim2 = new IdentityClaim(_claim2);
_identityClaim3 = new IdentityClaim(_claim3);
_identityClaim1SameType = new IdentityClaim(_claim1SameType);
}
开发者ID:saan800,项目名称:SaanSoft.AspNet.Identity3.MongoDB,代码行数:25,代码来源:UserStoreTests.cs
示例10: AccountController
public AccountController()
{
mongoClient = new MongoClient(Settings.Default.MongoDBConnectionString);
KonradRequirementsDatabase = mongoClient.GetDatabase("KonradRequirements");
usersCollection = KonradRequirementsDatabase.GetCollection<BsonDocument>("Users");
}
开发者ID:thEpisode,项目名称:Sistema-de-gestion-de-requerimientos-konrad-lorenz,代码行数:7,代码来源:AccountController.cs
示例11: WorkitemsController
public WorkitemsController()
{
_client = new MongoClient("mongodb://localhost:27017");
_database = _client.GetDatabase("integrity");
_collection = _database.GetCollection<BsonDocument>("workitems");
}
开发者ID:DaveWelling,项目名称:IntegrityKatana,代码行数:7,代码来源:WorkitemsController.cs
示例12: CategoryController
/// <summary>
/// CategoryController constructor
/// </summary>
public CategoryController()
{
var client = new MongoClient(ConfigurationManager.ConnectionStrings["Mongo_patientcare"].ConnectionString);
_log = new Logger("WebAPI:CategoryController");
_db = client.GetDatabase("patientcaredb");
_categories = _db.GetCollection<BsonDocument>("Category");
}
开发者ID:dsb92,项目名称:patientcare,代码行数:10,代码来源:CategoryController.cs
示例13: HomeController
public HomeController()
{
connectionString = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
mongoClient = new MongoClient(connectionString);
db = mongoClient.GetDatabase("zngndb");
userCollection = db.GetCollection<BsonDocument>("User");
}
开发者ID:huseyinzengin91,项目名称:MongoDBCRUD,代码行数:7,代码来源:HomeController.cs
示例14: MessageDeduplicationPersistorMongoDb
public MessageDeduplicationPersistorMongoDb()
{
var settings = DeduplicationFilterSettings.Instance;
var mongoClient = new MongoClient(settings.ConnectionStringMongoDb);
var mongoDatabase = mongoClient.GetDatabase(settings.DatabaseNameMongoDb);
_collection = mongoDatabase.GetCollection<ProcessedMessage>(settings.CollectionNameMongoDb);
}
开发者ID:R-Suite,项目名称:ServiceConnect-CSharp,代码行数:7,代码来源:MessageDeduplicationPersistorMongoDb.cs
示例15: MongoService
public MongoService()
{
var mongo = new Mongo();
mongo.Connect();
IMongoDatabase mongoDatabase = mongo.GetDatabase(ConfigurationManager.AppSettings["Database"]);
_collection = mongoDatabase.GetCollection<Entity>("entity");
}
开发者ID:christiaan-stoffer,项目名称:euh,代码行数:7,代码来源:MongoService.cs
示例16: UpdateModifiersTests
public UpdateModifiersTests()
{
var admin = new MongoAdmin("mongodb://localhost/admin?pooling=false&strict=true");
_server = Mongo.Create("mongodb://localhost/NormTests?pooling=false&strict=true");
_collection = _server.GetCollection<Post>("Posts");
_buildInfo = admin.BuildInfo();
}
开发者ID:gaoninggn,项目名称:NoRM,代码行数:7,代码来源:UpdateModifiersTests.cs
示例17: Logger
public Logger(string logger)
{
var client = new MongoClient(Properties.Settings.Default.Mongo_log);
_db = client.GetDatabase("patientcarelog");
_logCollection = _db.GetCollection<BsonDocument>("Logs");
_logger = logger;
}
开发者ID:dsb92,项目名称:patientcare,代码行数:7,代码来源:Logger.cs
示例18: PatientRepository
/// <summary />
public PatientRepository()
{
var client = new MongoClient(ConfigurationManager.ConnectionStrings["Mongo_patientcare_datamock"].ConnectionString);
_log = new Logger("WebAPI : PatientRepository");
_db = client.GetDatabase("patientcare_datamock");
_patients = _db.GetCollection<BsonDocument>("Patients");
}
开发者ID:dsb92,项目名称:patientcare,代码行数:8,代码来源:PatientRepository.cs
示例19: Initialize
public void Initialize()
{
var connect = "mongodb://localhost";
_client = new MongoClient(connect);
_db = _client.GetDatabase("local");
_collection = _db.GetCollection<Person>("Person");
}
开发者ID:overload17,项目名称:Database,代码行数:7,代码来源:DS_MONGODB.cs
示例20: TodoItemRepository
public TodoItemRepository(string mongoConnection, string databaseName)
{
collectionName = "todoitems";
var client = new MongoClient(mongoConnection);
this.database = client.GetDatabase(databaseName);
this.collection = database.GetCollection<TodoItem>(collectionName);
}
开发者ID:CedricLeblond,项目名称:MultiChannelTodo,代码行数:7,代码来源:TodoItemRepository.cs
注:本文中的IMongoCollection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论