Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/RobThree/MongoRepository
Repository abstraction layer on top of Official MongoDB C# driver
https://github.com/RobThree/MongoRepository
api c-sharp dotnet mongodb repository
Last synced: 9 days ago
JSON representation
Repository abstraction layer on top of Official MongoDB C# driver
- Host: GitHub
- URL: https://github.com/RobThree/MongoRepository
- Owner: RobThree
- License: mit
- Archived: true
- Created: 2015-02-12T16:56:30.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-01-13T12:37:00.000Z (almost 5 years ago)
- Last Synced: 2024-09-25T12:21:40.196Z (about 1 month ago)
- Topics: api, c-sharp, dotnet, mongodb, repository
- Language: C#
- Homepage: https://www.nuget.org/packages/MongoRepository/
- Size: 11.2 MB
- Stars: 308
- Watchers: 42
- Forks: 139
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-mongodb - MongoRepository - Repository abstraction layer on top of the C# driver (Libraries / C#/.NET ###)
- awesome-mongodb - MongoRepository - Repository abstraction layer on top of the C# driver (Libraries / C#/.NET ###)
README
# ![Logo](https://raw.githubusercontent.com/RobThree/MongoRepository/master/mongorepositorylogo.png) Project Description
An easy to use library to use MongoDB with .NET. It implements a Repository pattern on top of Official MongoDB C# driver. This project is now available as a [NuGet](https://www.nuget.org) package for your convenience. If you're new to NuGet, [check it out](http://docs.nuget.org/); it's painless, easy and fast. You can find this project by [searching for MongoRepository](https://www.nuget.org/packages?q=mongorepository) in NuGet (or [simply clicking here](http://nuget.org/packages/MongoRepository)).
Check the [documentation](https://github.com/RobThree/MongoRepository/wiki/Documentation) for a step-by-step example and more advanced usage.
## Example:
```c#
// The Entity base-class is provided by MongoRepository
// for all entities you want to use in MongoDb
public class Customer : Entity
{
public string FirstName { get; set; }
public string LastName { get; set; }
}public class CustomerRepoTest
{
public void Test()
{
var repo = new MongoRepository();// adding new entity
var newCustomer = new Customer {
FirstName = "Steve",
LastName = "Cornell"
};repo.Add(newCustomer);
// searching
var result = repo.Where(c => c.FirstName == "Steve");// updating
newCustomer.LastName = "Castle";
repo.Update(newCustomer);
}
}
```
[](http://www.jetbrains.com/resharper/features/index.html)