Compare commits

...

14 Commits

Author SHA1 Message Date
Alexandre SPIESER 8d6b796e7f Merge pull request #22 from alexandre-spieser/alex/refactorForKeyTypeRepo
1.4.0 release
2019-04-18 08:22:35 +01:00
Alexandre SPIESER 1a7763a312 1.4.0 release 2019-04-18 08:21:18 +01:00
Alexandre SPIESER 77cc85574c Update BaseMongoRepository.TKey.Update.cs 2019-04-17 19:08:13 +01:00
Alexandre SPIESER 846bb16730 Update BaseMongoRepository.TKey.Index.cs 2019-04-17 19:05:17 +01:00
Alexandre SPIESER 5e4cbfa1b3 Update BaseMongoRepository.TKey.Delete.cs 2019-04-17 19:04:38 +01:00
Alexandre SPIESER 804dc18c4f Update BaseMongoRepository.TKey.Create.cs 2019-04-17 19:03:59 +01:00
Alexandre SPIESER 182ee0a335 Update BaseMongoRepository.Update.cs 2019-04-17 19:02:57 +01:00
Alexandre SPIESER bd662d25d6 Update BaseMongoRepository.Index.cs 2019-04-17 19:00:33 +01:00
Alexandre SPIESER 6c8d4bdafb Update BaseMongoRepository.Delete.cs 2019-04-17 18:59:27 +01:00
Alexandre SPIESER 4d94a1b436 Update BaseMongoRepository.Create.cs 2019-04-17 18:58:47 +01:00
Alexandre SPIESER d91a644b4a Update README.md 2019-04-15 23:58:44 +01:00
Alexandre SPIESER 9d1950e9c7 Update README.md 2019-04-15 23:58:13 +01:00
Alexandre SPIESER 67d0a4c8a3 Update README.md 2019-04-15 00:48:19 +01:00
Alexandre SPIESER 1826668cea Update README.md 2019-04-15 00:47:06 +01:00
16 changed files with 53 additions and 32 deletions
@@ -9,7 +9,7 @@
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="2.1.2" /> <PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="2.1.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Include="MongoDB.Driver" Version="2.7.0" /> <PackageReference Include="MongoDB.Driver" Version="2.7.0" />
<PackageReference Include="MongoDbGenericRepository" Version="1.3.9" /> <PackageReference Include="MongoDbGenericRepository" Version="1.4.0" />
<PackageReference Include="xunit" Version="2.4.0" /> <PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.console" Version="2.4.0" /> <PackageReference Include="xunit.runner.console" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" /> <PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
@@ -61,7 +61,7 @@ namespace MongoDbGenericRepository
{ {
private readonly object _initLock = new object(); private readonly object _initLock = new object();
private MongoDbCreator _mongoDbCreator; private MongoDbCreator _mongoDbCreator;
protected MongoDbCreator MongoDbCreator protected virtual MongoDbCreator MongoDbCreator
{ {
get get
{ {
@@ -77,6 +77,7 @@ namespace MongoDbGenericRepository
return _mongoDbCreator; return _mongoDbCreator;
} }
set { _mongoDbCreator = value; }
} }
/// <summary> /// <summary>
@@ -105,7 +105,7 @@ namespace MongoDbGenericRepository
public abstract partial class BaseMongoRepository : IBaseMongoRepository_Delete public abstract partial class BaseMongoRepository : IBaseMongoRepository_Delete
{ {
private MongoDbEraser _mongoDbEraser; private MongoDbEraser _mongoDbEraser;
protected MongoDbEraser MongoDbEraser protected virtual MongoDbEraser MongoDbEraser
{ {
get get
{ {
@@ -121,6 +121,7 @@ namespace MongoDbGenericRepository
return _mongoDbEraser; return _mongoDbEraser;
} }
set { _mongoDbEraser = value; }
} }
#region Delete #region Delete
@@ -113,7 +113,7 @@ namespace MongoDbGenericRepository
public abstract partial class BaseMongoRepository : IBaseMongoRepository_Index public abstract partial class BaseMongoRepository : IBaseMongoRepository_Index
{ {
private MongoDbIndexHandler _mongoDbIndexHandler; private MongoDbIndexHandler _mongoDbIndexHandler;
protected MongoDbIndexHandler MongoDbIndexHandler protected virtual MongoDbIndexHandler MongoDbIndexHandler
{ {
get get
{ {
@@ -128,6 +128,7 @@ namespace MongoDbGenericRepository
} }
return _mongoDbIndexHandler; return _mongoDbIndexHandler;
} }
set { _mongoDbIndexHandler = value; }
} }
/// <summary> /// <summary>
@@ -140,7 +140,7 @@ namespace MongoDbGenericRepository
public abstract partial class BaseMongoRepository : IBaseMongoRepository_Update public abstract partial class BaseMongoRepository : IBaseMongoRepository_Update
{ {
private MongoDbUpdater _mongoDbUpdater; private MongoDbUpdater _mongoDbUpdater;
protected MongoDbUpdater MongoDbUpdater protected virtual MongoDbUpdater MongoDbUpdater
{ {
get get
{ {
@@ -156,6 +156,7 @@ namespace MongoDbGenericRepository
return _mongoDbUpdater; return _mongoDbUpdater;
} }
set { _mongoDbUpdater = value; }
} }
#region Update #region Update
@@ -56,7 +56,7 @@ namespace MongoDbGenericRepository
/// <summary> /// <summary>
/// The MongoDb accessor to insert data. /// The MongoDb accessor to insert data.
/// </summary> /// </summary>
protected MongoDbCreator MongoDbCreator protected virtual MongoDbCreator MongoDbCreator
{ {
get get
{ {
@@ -72,6 +72,7 @@ namespace MongoDbGenericRepository
} }
return _mongoDbCreator; return _mongoDbCreator;
} }
set { _mongoDbCreator = value; }
} }
/// <summary> /// <summary>
@@ -98,7 +98,7 @@ namespace MongoDbGenericRepository
/// <summary> /// <summary>
/// The MongoDb accessor to delete data. /// The MongoDb accessor to delete data.
/// </summary> /// </summary>
protected MongoDbEraser MongoDbEraser protected virtual MongoDbEraser MongoDbEraser
{ {
get get
{ {
@@ -113,6 +113,7 @@ namespace MongoDbGenericRepository
} }
return _mongoDbEraser; return _mongoDbEraser;
} }
set { _mongoDbEraser = value; }
} }
/// <summary> /// <summary>
@@ -109,7 +109,7 @@ namespace MongoDbGenericRepository
/// <summary> /// <summary>
/// The MongoDb accessor to manage indexes. /// The MongoDb accessor to manage indexes.
/// </summary> /// </summary>
protected MongoDbIndexHandler MongoDbIndexHandler protected virtual MongoDbIndexHandler MongoDbIndexHandler
{ {
get get
{ {
@@ -124,6 +124,7 @@ namespace MongoDbGenericRepository
} }
return _mongoDbIndexHandler; return _mongoDbIndexHandler;
} }
set { _mongoDbIndexHandler = value; }
} }
/// <summary> /// <summary>
@@ -116,7 +116,7 @@ namespace MongoDbGenericRepository
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
private MongoDbUpdater _mongoDbUpdater; private MongoDbUpdater _mongoDbUpdater;
protected MongoDbUpdater MongoDbUpdater protected virtual MongoDbUpdater MongoDbUpdater
{ {
get get
{ {
@@ -132,6 +132,7 @@ namespace MongoDbGenericRepository
return _mongoDbUpdater; return _mongoDbUpdater;
} }
set { _mongoDbUpdater = value; }
} }
/// <summary> /// <summary>
@@ -2,7 +2,7 @@
<package > <package >
<metadata> <metadata>
<id>MongoDbGenericRepository</id> <id>MongoDbGenericRepository</id>
<version>1.3.9</version> <version>1.4.0</version>
<title>MongoDb Generic Repository</title> <title>MongoDb Generic Repository</title>
<authors>Alexandre Spieser</authors> <authors>Alexandre Spieser</authors>
<owners>Alexandre Spieser</owners> <owners>Alexandre Spieser</owners>
@@ -1085,7 +1085,7 @@
"DnsClient/1.0.7": { "DnsClient/1.0.7": {
"type": "package", "type": "package",
"serviceable": true, "serviceable": true,
"sha512": "sha512-f3k5ufhUSL658fy/ac1mReqRIr0jGMyOJFvBqJ+7cASq01NIysYbrrRDjboYKAGrd0Y2mc1A749uQvT8vAA91A==", "sha512": "sha512-i6Imdyz+dvljMtQh1QtjMzguLEFFJCilecHiaRPIbNX4gK3zluf/3OQWD1XbVy5PXf1u394x5ImB+uu7DNMS1w==",
"path": "dnsclient/1.0.7", "path": "dnsclient/1.0.7",
"hashPath": "dnsclient.1.0.7.nupkg.sha512" "hashPath": "dnsclient.1.0.7.nupkg.sha512"
}, },
@@ -1113,28 +1113,28 @@
"Microsoft.Win32.Registry/4.0.0": { "Microsoft.Win32.Registry/4.0.0": {
"type": "package", "type": "package",
"serviceable": true, "serviceable": true,
"sha512": "sha512-mYUxH/YY9PwvuWY93/qsovFHAh+Lu2CNxNHWxB/x0dnpaEy6oIy/9d7R2J6dFaLZ7jhE7emLjn7A8kSzsP1A+Q==", "sha512": "sha512-UiSp7lTxGtsF6J96wwErFeM0jygj/bWWKvbqwtRP2t6OohgT7TCTpjvQ1+7DLQLH3DR70i6+eRGX/y85WFuz1Q==",
"path": "microsoft.win32.registry/4.0.0", "path": "microsoft.win32.registry/4.0.0",
"hashPath": "microsoft.win32.registry.4.0.0.nupkg.sha512" "hashPath": "microsoft.win32.registry.4.0.0.nupkg.sha512"
}, },
"MongoDB.Bson/2.7.0": { "MongoDB.Bson/2.7.0": {
"type": "package", "type": "package",
"serviceable": true, "serviceable": true,
"sha512": "sha512-vzpTDHYX/X6gF9qtDuKRJiLkqpj5OZuT1bIzJCiBiU8CwJ37becYmaXuy/QSuWnYN6j6ZdVTWILKbWt2MXL8DA==", "sha512": "sha512-BBPKyeYmhRduXuDQsFvB2bw34rAqJrT9UZPHAVLGLtvp5wYxhzP8r7SrSn//f91Xst09Ww/5lq3DD5byn0fdLw==",
"path": "mongodb.bson/2.7.0", "path": "mongodb.bson/2.7.0",
"hashPath": "mongodb.bson.2.7.0.nupkg.sha512" "hashPath": "mongodb.bson.2.7.0.nupkg.sha512"
}, },
"MongoDB.Driver/2.7.0": { "MongoDB.Driver/2.7.0": {
"type": "package", "type": "package",
"serviceable": true, "serviceable": true,
"sha512": "sha512-5wP5BBwm5YO6h2Vhw6zQmOwSW9WP2d6kgRM6E7uIbwIJz4+j2trS2Wo7/+IYow5WVN8Jd6O27bIB/4gKNepO1Q==", "sha512": "sha512-HcifZthdICkC5oXnIrxH8TJTDc8JMym+X1NR/oJjcDm841fkvSvg1MEL8LNu/FLlwQQq3XxtrxKGDvTT/z1RmA==",
"path": "mongodb.driver/2.7.0", "path": "mongodb.driver/2.7.0",
"hashPath": "mongodb.driver.2.7.0.nupkg.sha512" "hashPath": "mongodb.driver.2.7.0.nupkg.sha512"
}, },
"MongoDB.Driver.Core/2.7.0": { "MongoDB.Driver.Core/2.7.0": {
"type": "package", "type": "package",
"serviceable": true, "serviceable": true,
"sha512": "sha512-SepB4KT+zXA3iFaIFwXVKmk6BZIp0EGE/iWqNbDZ1mca9e8EhtqYPwOOzFmEbdKAzmVvF1y86kNI4agWP6I5sg==", "sha512": "sha512-oPlQUCdysl9AL9TlTDsadrjWbiZDSbl6N4AGAe04gY2qYsJ9r7Pu5+TvFf7epAl3tOt6art3/maOhg7KL2vDng==",
"path": "mongodb.driver.core/2.7.0", "path": "mongodb.driver.core/2.7.0",
"hashPath": "mongodb.driver.core.2.7.0.nupkg.sha512" "hashPath": "mongodb.driver.core.2.7.0.nupkg.sha512"
}, },
@@ -1323,7 +1323,7 @@
"System.Diagnostics.Process/4.1.0": { "System.Diagnostics.Process/4.1.0": {
"type": "package", "type": "package",
"serviceable": true, "serviceable": true,
"sha512": "sha512-4dlFhzwmI3hl32P+8c9hnytYtV7Xldhsokm5i7Fvv5PmTS68TQCfsuJrREIyF9N1B8zlsSomp7AVrXLe45kKFQ==", "sha512": "sha512-S2YC+MwpWZ6e7h2lqNce/ubMjD4vf2Ea/uOEncYNH1/fFXaXlKDM9ig/zCE1rR+wwYzE8FXtvj+1Nymh6oZ9bg==",
"path": "system.diagnostics.process/4.1.0", "path": "system.diagnostics.process/4.1.0",
"hashPath": "system.diagnostics.process.4.1.0.nupkg.sha512" "hashPath": "system.diagnostics.process.4.1.0.nupkg.sha512"
}, },
@@ -1337,7 +1337,7 @@
"System.Diagnostics.TraceSource/4.0.0": { "System.Diagnostics.TraceSource/4.0.0": {
"type": "package", "type": "package",
"serviceable": true, "serviceable": true,
"sha512": "sha512-bGUeY5wiCHYSWbYZS3QjbaQ1hNoJ1RQBQMB3E0Cgh6AH//4rXfXIOHKIW46HDOsTEDoNfvFNDXphL5W5B/XMwQ==", "sha512": "sha512-q5bGzzvXVi+dIMiPWRhXZV7r+Os3TEOuRW5LHsAUDGpqJHol8XiLokVpsgAfPqHHNkyx1bbv5lRZqRkRrGZKxQ==",
"path": "system.diagnostics.tracesource/4.0.0", "path": "system.diagnostics.tracesource/4.0.0",
"hashPath": "system.diagnostics.tracesource.4.0.0.nupkg.sha512" "hashPath": "system.diagnostics.tracesource.4.0.0.nupkg.sha512"
}, },
@@ -1463,7 +1463,7 @@
"System.Net.Security/4.0.0": { "System.Net.Security/4.0.0": {
"type": "package", "type": "package",
"serviceable": true, "serviceable": true,
"sha512": "sha512-iavC4j5XrRyX3aXbn23jHHF0NTxw9F+2vi3a94VY4BgfrYm5VQBh8OzU1TkNahTSlcKzjGhEc7ZfTfe4b62J6Q==", "sha512": "sha512-e7y/92A7436wJ33VOnUf5XbIlubGgHH7+cODaQkeYwU0xXd/fB/j6KiOdS6VvHcRfBXUYIPsvBOdz3WSNE1siQ==",
"path": "system.net.security/4.0.0", "path": "system.net.security/4.0.0",
"hashPath": "system.net.security.4.0.0.nupkg.sha512" "hashPath": "system.net.security.4.0.0.nupkg.sha512"
}, },
@@ -1666,7 +1666,7 @@
"System.Threading.Overlapped/4.3.0": { "System.Threading.Overlapped/4.3.0": {
"type": "package", "type": "package",
"serviceable": true, "serviceable": true,
"sha512": "sha512-JpukcZA7kre2gQ7GrhtvZu1xv/LVEG5HV9AajQ3XV7l36T6ICalw/llfkBHeK/eqo8UWpMNqkWGCzzlSuqE6pg==", "sha512": "sha512-JWEtWIoYBHzMmgt2I/1e4FFG6veDL4yzA1Y7iuEY2G+GyZyrzqx/GQlM92M+d81D1cH2dp2KRhbZdQebn8Q+RA==",
"path": "system.threading.overlapped/4.3.0", "path": "system.threading.overlapped/4.3.0",
"hashPath": "system.threading.overlapped.4.3.0.nupkg.sha512" "hashPath": "system.threading.overlapped.4.3.0.nupkg.sha512"
}, },
@@ -984,7 +984,7 @@
"DnsClient/1.0.7": { "DnsClient/1.0.7": {
"type": "package", "type": "package",
"serviceable": true, "serviceable": true,
"sha512": "sha512-f3k5ufhUSL658fy/ac1mReqRIr0jGMyOJFvBqJ+7cASq01NIysYbrrRDjboYKAGrd0Y2mc1A749uQvT8vAA91A==", "sha512": "sha512-i6Imdyz+dvljMtQh1QtjMzguLEFFJCilecHiaRPIbNX4gK3zluf/3OQWD1XbVy5PXf1u394x5ImB+uu7DNMS1w==",
"path": "dnsclient/1.0.7", "path": "dnsclient/1.0.7",
"hashPath": "dnsclient.1.0.7.nupkg.sha512" "hashPath": "dnsclient.1.0.7.nupkg.sha512"
}, },
@@ -1012,28 +1012,28 @@
"Microsoft.Win32.Registry/4.0.0": { "Microsoft.Win32.Registry/4.0.0": {
"type": "package", "type": "package",
"serviceable": true, "serviceable": true,
"sha512": "sha512-mYUxH/YY9PwvuWY93/qsovFHAh+Lu2CNxNHWxB/x0dnpaEy6oIy/9d7R2J6dFaLZ7jhE7emLjn7A8kSzsP1A+Q==", "sha512": "sha512-UiSp7lTxGtsF6J96wwErFeM0jygj/bWWKvbqwtRP2t6OohgT7TCTpjvQ1+7DLQLH3DR70i6+eRGX/y85WFuz1Q==",
"path": "microsoft.win32.registry/4.0.0", "path": "microsoft.win32.registry/4.0.0",
"hashPath": "microsoft.win32.registry.4.0.0.nupkg.sha512" "hashPath": "microsoft.win32.registry.4.0.0.nupkg.sha512"
}, },
"MongoDB.Bson/2.7.0": { "MongoDB.Bson/2.7.0": {
"type": "package", "type": "package",
"serviceable": true, "serviceable": true,
"sha512": "sha512-vzpTDHYX/X6gF9qtDuKRJiLkqpj5OZuT1bIzJCiBiU8CwJ37becYmaXuy/QSuWnYN6j6ZdVTWILKbWt2MXL8DA==", "sha512": "sha512-BBPKyeYmhRduXuDQsFvB2bw34rAqJrT9UZPHAVLGLtvp5wYxhzP8r7SrSn//f91Xst09Ww/5lq3DD5byn0fdLw==",
"path": "mongodb.bson/2.7.0", "path": "mongodb.bson/2.7.0",
"hashPath": "mongodb.bson.2.7.0.nupkg.sha512" "hashPath": "mongodb.bson.2.7.0.nupkg.sha512"
}, },
"MongoDB.Driver/2.7.0": { "MongoDB.Driver/2.7.0": {
"type": "package", "type": "package",
"serviceable": true, "serviceable": true,
"sha512": "sha512-5wP5BBwm5YO6h2Vhw6zQmOwSW9WP2d6kgRM6E7uIbwIJz4+j2trS2Wo7/+IYow5WVN8Jd6O27bIB/4gKNepO1Q==", "sha512": "sha512-HcifZthdICkC5oXnIrxH8TJTDc8JMym+X1NR/oJjcDm841fkvSvg1MEL8LNu/FLlwQQq3XxtrxKGDvTT/z1RmA==",
"path": "mongodb.driver/2.7.0", "path": "mongodb.driver/2.7.0",
"hashPath": "mongodb.driver.2.7.0.nupkg.sha512" "hashPath": "mongodb.driver.2.7.0.nupkg.sha512"
}, },
"MongoDB.Driver.Core/2.7.0": { "MongoDB.Driver.Core/2.7.0": {
"type": "package", "type": "package",
"serviceable": true, "serviceable": true,
"sha512": "sha512-SepB4KT+zXA3iFaIFwXVKmk6BZIp0EGE/iWqNbDZ1mca9e8EhtqYPwOOzFmEbdKAzmVvF1y86kNI4agWP6I5sg==", "sha512": "sha512-oPlQUCdysl9AL9TlTDsadrjWbiZDSbl6N4AGAe04gY2qYsJ9r7Pu5+TvFf7epAl3tOt6art3/maOhg7KL2vDng==",
"path": "mongodb.driver.core/2.7.0", "path": "mongodb.driver.core/2.7.0",
"hashPath": "mongodb.driver.core.2.7.0.nupkg.sha512" "hashPath": "mongodb.driver.core.2.7.0.nupkg.sha512"
}, },
@@ -1061,7 +1061,7 @@
"runtime.native.System.Net.Security/4.0.1": { "runtime.native.System.Net.Security/4.0.1": {
"type": "package", "type": "package",
"serviceable": true, "serviceable": true,
"sha512": "sha512-OpQmF7Ol4t3BVl+x2SURhymksME8f9Ke4uKWAVKPZhGZn6g5bBKvaSllV4nmNKgNQSIhM1x4IOtgc6/32H1OUg==", "sha512": "sha512-pnBEZovOBrJJFp+2ORAs+bYuEQFcO2iYBNbNwRCqzZ9U7Vu66qoTJaekvOGgCyKmslvcevAVLxn7/K9Xc6lwlw==",
"path": "runtime.native.system.net.security/4.0.1", "path": "runtime.native.system.net.security/4.0.1",
"hashPath": "runtime.native.system.net.security.4.0.1.nupkg.sha512" "hashPath": "runtime.native.system.net.security.4.0.1.nupkg.sha512"
}, },
@@ -1138,14 +1138,14 @@
"System.Diagnostics.Process/4.1.0": { "System.Diagnostics.Process/4.1.0": {
"type": "package", "type": "package",
"serviceable": true, "serviceable": true,
"sha512": "sha512-4dlFhzwmI3hl32P+8c9hnytYtV7Xldhsokm5i7Fvv5PmTS68TQCfsuJrREIyF9N1B8zlsSomp7AVrXLe45kKFQ==", "sha512": "sha512-S2YC+MwpWZ6e7h2lqNce/ubMjD4vf2Ea/uOEncYNH1/fFXaXlKDM9ig/zCE1rR+wwYzE8FXtvj+1Nymh6oZ9bg==",
"path": "system.diagnostics.process/4.1.0", "path": "system.diagnostics.process/4.1.0",
"hashPath": "system.diagnostics.process.4.1.0.nupkg.sha512" "hashPath": "system.diagnostics.process.4.1.0.nupkg.sha512"
}, },
"System.Diagnostics.TraceSource/4.0.0": { "System.Diagnostics.TraceSource/4.0.0": {
"type": "package", "type": "package",
"serviceable": true, "serviceable": true,
"sha512": "sha512-bGUeY5wiCHYSWbYZS3QjbaQ1hNoJ1RQBQMB3E0Cgh6AH//4rXfXIOHKIW46HDOsTEDoNfvFNDXphL5W5B/XMwQ==", "sha512": "sha512-q5bGzzvXVi+dIMiPWRhXZV7r+Os3TEOuRW5LHsAUDGpqJHol8XiLokVpsgAfPqHHNkyx1bbv5lRZqRkRrGZKxQ==",
"path": "system.diagnostics.tracesource/4.0.0", "path": "system.diagnostics.tracesource/4.0.0",
"hashPath": "system.diagnostics.tracesource.4.0.0.nupkg.sha512" "hashPath": "system.diagnostics.tracesource.4.0.0.nupkg.sha512"
}, },
@@ -1250,7 +1250,7 @@
"System.Net.Security/4.0.0": { "System.Net.Security/4.0.0": {
"type": "package", "type": "package",
"serviceable": true, "serviceable": true,
"sha512": "sha512-iavC4j5XrRyX3aXbn23jHHF0NTxw9F+2vi3a94VY4BgfrYm5VQBh8OzU1TkNahTSlcKzjGhEc7ZfTfe4b62J6Q==", "sha512": "sha512-e7y/92A7436wJ33VOnUf5XbIlubGgHH7+cODaQkeYwU0xXd/fB/j6KiOdS6VvHcRfBXUYIPsvBOdz3WSNE1siQ==",
"path": "system.net.security/4.0.0", "path": "system.net.security/4.0.0",
"hashPath": "system.net.security.4.0.0.nupkg.sha512" "hashPath": "system.net.security.4.0.0.nupkg.sha512"
}, },
@@ -1467,7 +1467,7 @@
"System.Threading.Overlapped/4.3.0": { "System.Threading.Overlapped/4.3.0": {
"type": "package", "type": "package",
"serviceable": true, "serviceable": true,
"sha512": "sha512-JpukcZA7kre2gQ7GrhtvZu1xv/LVEG5HV9AajQ3XV7l36T6ICalw/llfkBHeK/eqo8UWpMNqkWGCzzlSuqE6pg==", "sha512": "sha512-JWEtWIoYBHzMmgt2I/1e4FFG6veDL4yzA1Y7iuEY2G+GyZyrzqx/GQlM92M+d81D1cH2dp2KRhbZdQebn8Q+RA==",
"path": "system.threading.overlapped/4.3.0", "path": "system.threading.overlapped/4.3.0",
"hashPath": "system.threading.overlapped.4.3.0.nupkg.sha512" "hashPath": "system.threading.overlapped.4.3.0.nupkg.sha512"
}, },
+15 -2
View File
@@ -4,7 +4,7 @@ An example of generic repository implementation using the MongoDB C# Sharp 2.0 d
Now available as a nuget package: Now available as a nuget package:
https://www.nuget.org/packages/MongoDbGenericRepository/ https://www.nuget.org/packages/MongoDbGenericRepository/
Covered by 200+ integration tests and counting. Covered by 400+ integration tests and counting.
The MongoDbGenericRepository is also used in [AspNetCore.Identity.MongoDbCore](https://github.com/alexandre-spieser/AspNetCore.Identity.MongoDbCore). The MongoDbGenericRepository is also used in [AspNetCore.Identity.MongoDbCore](https://github.com/alexandre-spieser/AspNetCore.Identity.MongoDbCore).
@@ -40,6 +40,18 @@ Here is an example of repository usage, where the TestRepository is implementing
} }
} }
``` ```
If all your documents have the same type of `Id`, you can use the more specific `BaseMongoRepository<TKey>` where `TKey` is the type of the `Id` of your documents.
```csharp
public class TestTKeyRepository<TKey> : BaseMongoRepository<TKey>, ITestRepository<TKey> where TKey : IEquatable<TKey>
{
const string connectionString = "mongodb://localhost:27017/MongoDbTests";
private static readonly ITestRepository<TKey> _instance = new TestTKeyRepository<TKey>(connectionString);
/// <inheritdoc />
private TestTKeyRepository(string connectionString) : base(connectionString)
{
}
}
```
## Instantiation ## Instantiation
@@ -47,6 +59,7 @@ The repository can be instantiated like so:
```csharp ```csharp
ITestRepository testRepository = new TestRepository(connectionString, "MongoDbTests"); ITestRepository testRepository = new TestRepository(connectionString, "MongoDbTests");
ITestRepository<TKey> testTKeyRepository = new TestTKeyRepository<TKey>(connectionString);
``` ```
If you prefer to reuse the same MongoDb database across your application, you can use the `MongoDatabase` from the MongoDb driver implementing the `IMongoDatabase` interface: If you prefer to reuse the same MongoDb database across your application, you can use the `MongoDatabase` from the MongoDb driver implementing the `IMongoDatabase` interface:
@@ -145,7 +158,7 @@ It is now possible to change the collection name by using the `CollectionName` a
Documents of this type will be inserted into a collection named "MyCollectionName". Documents of this type will be inserted into a collection named "MyCollectionName".
## Index Management ## Index Management
From version 1.3.8 the `MongoDbGenericRepository` implements the `IMongoDbCollectionIndexRepository` interface. From version 1.3.8 the `MongoDbGenericRepository` implements the `IBaseMongoRepository_Index` and `IBaseMongoRepository_Index<TKey>` interfaces.
This exposes the functionality to programmatically manage indexes against your collections in a generic fashion. This exposes the functionality to programmatically manage indexes against your collections in a generic fashion.
The following methods are exposed and fully integration tested: The following methods are exposed and fully integration tested: