Skip to content

Commit 80151b8

Browse files
author
Bart Koelman
committed
Update README.md
Updated instructions for development Switched order of sections, based on chronological needs
1 parent f995da3 commit 80151b8

File tree

1 file changed

+41
-20
lines changed

1 file changed

+41
-20
lines changed

README.md

Lines changed: 41 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Plug-n-play implementation of `IResourceRepository<TResource, TId>` allowing you to use [MongoDB](https://www.mongodb.com/) with your [JsonApiDotNetCore](https://github.com/json-api-dotnet/JsonApiDotNetCore) APIs.
44

55
[![Build](https://ci.appveyor.com/api/projects/status/dadm2kr2y0353mji/branch/master?svg=true)](https://ci.appveyor.com/project/json-api-dotnet/jsonapidotnetcore-mongodb/branch/master)
6-
[![codecov](https://codecov.io/gh/json-api-dotnet/JsonApiDotNetCore.MongoDb/branch/master/graph/badge.svg?token=QPVf8rii7l)](https://codecov.io/gh/json-api-dotnet/JsonApiDotNetCore.MongoDb)
6+
[![Coverage](https://codecov.io/gh/json-api-dotnet/JsonApiDotNetCore.MongoDb/branch/master/graph/badge.svg?token=QPVf8rii7l)](https://codecov.io/gh/json-api-dotnet/JsonApiDotNetCore.MongoDb)
77
[![NuGet](https://img.shields.io/nuget/v/JsonApiDotNetCore.MongoDb.svg)](https://www.nuget.org/packages/JsonApiDotNetCore.MongoDb/)
88

99
## Installation and Usage
@@ -14,8 +14,8 @@ dotnet add package JsonApiDotNetCore.MongoDb
1414

1515
### Models
1616

17-
```cs
18-
public sealed class Book : MongoIdentifiable
17+
```c#
18+
public class Book : MongoIdentifiable
1919
{
2020
[Attr]
2121
public string Name { get; set; }
@@ -24,10 +24,11 @@ public sealed class Book : MongoIdentifiable
2424

2525
### Controllers
2626

27-
```cs
28-
public sealed class BooksController : JsonApiController<Book, string>
27+
```c#
28+
public class BooksController : JsonApiController<Book, string>
2929
{
30-
public BooksController(IJsonApiOptions options, ILoggerFactory loggerFactory, IResourceService<Book, string> resourceService)
30+
public BooksController(IJsonApiOptions options, ILoggerFactory loggerFactory,
31+
IResourceService<Book, string> resourceService)
3132
: base(options, loggerFactory, resourceService)
3233
{
3334
}
@@ -36,15 +37,15 @@ public sealed class BooksController : JsonApiController<Book, string>
3637

3738
### Middleware
3839

39-
```cs
40+
```c#
4041
public class Startup
4142
{
4243
public IServiceProvider ConfigureServices(IServiceCollection services)
4344
{
44-
services.AddSingleton<IMongoDatabase>(sp =>
45+
services.AddSingleton<IMongoDatabase>(_ =>
4546
{
46-
var client = new MongoClient(Configuration.GetSection("DatabaseSettings:ConnectionString").Value);
47-
return client.GetDatabase(Configuration.GetSection("DatabaseSettings:Database").Value);
47+
var client = new MongoClient("mongodb://localhost:27017");
48+
return client.GetDatabase("ExampleDbName");
4849
});
4950

5051
services.AddJsonApi(resources: builder =>
@@ -66,7 +67,7 @@ public class Startup
6667
```
6768
Note: If your API project uses only MongoDB (not in combination with EF Core), then instead of
6869
registering all MongoDB resources and repositories individually, you can use:
69-
```cs
70+
```c#
7071
public class Startup
7172
{
7273
public IServiceProvider ConfigureServices(IServiceCollection services)
@@ -86,17 +87,35 @@ public class Startup
8687
}
8788
```
8889

90+
## Limitations
91+
92+
- JSON:API relationships are currently not supported. You can use complex object graphs though, which are stored in a single document.
93+
94+
## Contributing
95+
96+
Have a question, found a bug or want to submit code changes? See our [contributing guidelines](https://github.com/json-api-dotnet/JsonApiDotNetCore/blob/master/.github/CONTRIBUTING.md).
97+
98+
## Trying out the latest build
99+
100+
After each commit to the master branch, a new prerelease NuGet package is automatically published to AppVeyor at https://ci.appveyor.com/nuget/jsonapidotnetcore. To try it out, follow the next steps:
101+
102+
* In Visual Studio: **Tools**, **NuGet Package Manager**, **Package Manager Settings**, **Package Sources**
103+
* Click **+**
104+
* Name: **AppVeyor JADNC MongoDb**, Source: **https://ci.appveyor.com/nuget/jsonapidotnetcore-mongodb**
105+
* Click **Update**, **Ok**
106+
* Open the NuGet package manager console (**Tools**, **NuGet Package Manager**, **Package Manager Console**)
107+
* Select **AppVeyor JADNC MongoDb** as package source
108+
* Run command: `Install-Package JonApiDotNetCore -pre`
109+
89110
## Development
90111

91-
Restore all NuGet packages with:
112+
To build the code from this repository locally, run:
92113

93114
```bash
94-
dotnet restore
115+
dotnet build
95116
```
96117

97-
### Testing
98-
99-
You don't need to have a running instance of MongoDB on your machine. To run the tests just type the following command in your terminal:
118+
You don't need to have a running instance of MongoDB on your machine to run tests. Just type the following command in your terminal:
100119

101120
```bash
102121
dotnet test
@@ -105,15 +124,17 @@ dotnet test
105124
If you want to run the examples and explore them on your own **you are** going to need that running instance of MongoDB. If you have docker installed you can launch it like this:
106125

107126
```bash
108-
docker run -p 27017:27017 -d mongo:latest
127+
run-docker-mongodb.ps1
109128
```
110129

111130
And then to run the API:
112131

113132
```bash
114-
dotnet run
133+
dotnet run --project src/Examples/GettingStarted
115134
```
116135

117-
## Limitations
136+
Alternatively, to build and validate the code, run all tests, generate code coverage and produce the NuGet package:
118137

119-
- Relationships are not supported
138+
```bash
139+
Build.ps1
140+
```

0 commit comments

Comments
 (0)