Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nicolaiarocci/boxroom
Boxroom aims at making CRUD operations very boring across all kinds of backends
https://github.com/nicolaiarocci/boxroom
crud mongodb netframework netstandard redis rest webapi
Last synced: 18 days ago
JSON representation
Boxroom aims at making CRUD operations very boring across all kinds of backends
- Host: GitHub
- URL: https://github.com/nicolaiarocci/boxroom
- Owner: nicolaiarocci
- License: other
- Created: 2018-10-29T10:42:29.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-03-04T01:15:21.000Z (over 1 year ago)
- Last Synced: 2024-10-12T04:07:59.306Z (about 1 month ago)
- Topics: crud, mongodb, netframework, netstandard, redis, rest, webapi
- Language: C#
- Homepage:
- Size: 111 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES
- License: LICENSE
Awesome Lists containing this project
README
# Boxroom: CRUD for Humans
The Boxroom experiment is a project that aims to allow for asynchronous CRUD
operations on POCO objects to be easily executable against **any** kind of
backend storage system, no matter the underlying technology, thanks to a
uniform, yet simple interface. Currently, REST services and databases (either
SQL or NoSQL) are primary targets.```cs
static async Task DoWork()
{
// IDatabaseBox and IRestBox both inherit from IBox.
IDatabaseBox database = MongoBox();
IRestBox remote = WebApiBox();var customer = new Customer { Name = "John Doe" };
var invoice = new Invoice { Number = "ABC/123" };// Insert (and other CRUD methods) are all defined by IBox.
await remote.Insert(customer);
await database.Insert(invoice);// Lookups also work alike, no matter where and how data is stored.
var brooklynCustomers = await database.Find(c => c.Zip == "11201");var invoices = await remote.Find(
inv => inv.Date >= DateTime.Now.AddDays(-10),
new FindOptions { IfModifiedSince = DateTime.Now.Date }
);Console.WriteLine($"We got back {brooklynCustomers.Count} customers and {invoices.Count} invoices");
}static IDatabaseBox MongoBox()
{
return new MongoBox()
{
ConnectionString = "mongodb://localhost:27017/my_database",
// In the context of database boxes, DataSources maps types to tables/collections.
DataSources = new Dictionary {
{ typeof (Customer), "customers" },
{ typeof (Invoice), "invoices" }
}
};
}
static IRestBox WebApiBox()
{
return new WebApiBox()
{
BaseAddress = new Uri("https://myservice.com"),
// In the context of rest boxes, DataSources maps types to endpoints.
DataSources = new Dictionary {
{ typeof (Customer), "/api/customers" },
{ typeof (Invoice), "/api/invoices" }
}
};
}
```Available projects:
- `Boxroom.Core`: core classes and interfaces
- `Boxroom.Database`: Database base classes and inerfaces
- `Boxroom.Database.MongoDB`: Mongo client
- `Boxroom.Database.RedisBox`: Redis client
- `Boxroom.Rest`: REST base classes and interfaces
- `Boxroom.Rest.WebApi`: WebApi REST clientAt this time all projects reside together but are likely to be split into
separate repositories when they are mature enough. They all conform to
NetStandard 2.0, and are under active development. They are probably not
ready for production use.Boxes (drivers, or clients) provide concrete interface implementations:
- `MongoBox` a MongoDB box;
- `RedisBox` a Redis box;
- `WebApiBox` a WebApi REST box;Both are in active development.
## Documentation
Documentation is planned.
## License
Boxroom is a [Nicola Iarocci](https://nicolaiarocci.com) open source
project distributed under the
[BSD](https://raw.githubusercontent.com/nicolaiarocci/Boxroom/master/LICENSE) license.