diff --git a/CoreIntegrationTests/CoreIntegrationTests.csproj b/CoreIntegrationTests/CoreIntegrationTests.csproj index fdc9f8d..85f6a8d 100644 --- a/CoreIntegrationTests/CoreIntegrationTests.csproj +++ b/CoreIntegrationTests/CoreIntegrationTests.csproj @@ -9,16 +9,13 @@ + - - - - ..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Configuration.dll diff --git a/IntegrationTests/IntegrationTests.csproj b/IntegrationTests/IntegrationTests.csproj index 6884596..47b9de0 100644 --- a/IntegrationTests/IntegrationTests.csproj +++ b/IntegrationTests/IntegrationTests.csproj @@ -30,22 +30,35 @@ 4 + + ..\packages\MongoDbGenericRepository.1.3.6\lib\net45\DnsClient.dll + - ..\packages\MongoDB.Bson.2.5.0\lib\net45\MongoDB.Bson.dll + ..\packages\MongoDbGenericRepository.1.3.6\lib\net45\MongoDB.Bson.dll - ..\packages\MongoDB.Driver.2.5.0\lib\net45\MongoDB.Driver.dll + ..\packages\MongoDbGenericRepository.1.3.6\lib\net45\MongoDB.Driver.dll - ..\packages\MongoDB.Driver.Core.2.5.0\lib\net45\MongoDB.Driver.Core.dll + ..\packages\MongoDbGenericRepository.1.3.6\lib\net45\MongoDB.Driver.Core.dll + + + ..\packages\MongoDbGenericRepository.1.3.6\lib\net45\MongoDbGenericRepository.dll ..\packages\NUnit.3.9.0\lib\net45\nunit.framework.dll + + ..\packages\MongoDbGenericRepository.1.3.6\lib\net45\System.Buffers.dll + + + ..\packages\MongoDbGenericRepository.1.3.6\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll + True + @@ -74,11 +87,5 @@ - - - {efc776c4-2af3-440c-be80-3fbe335817a5} - MongoDbGenericRepository - - \ No newline at end of file diff --git a/IntegrationTests/packages.config b/IntegrationTests/packages.config index b8fecf4..3891bf8 100644 --- a/IntegrationTests/packages.config +++ b/IntegrationTests/packages.config @@ -4,6 +4,7 @@ + diff --git a/MongoDbGenericRepository/Abstractions/IBaseMongoRepository.cs b/MongoDbGenericRepository/Abstractions/IBaseMongoRepository.cs index f7274e8..b8a962d 100644 --- a/MongoDbGenericRepository/Abstractions/IBaseMongoRepository.cs +++ b/MongoDbGenericRepository/Abstractions/IBaseMongoRepository.cs @@ -167,6 +167,7 @@ namespace MongoDbGenericRepository /// The document filter. /// The field selector. /// The new value of the property field. + /// The partition key for the document. bool UpdateOne(Expression> filter, Expression> field, TField value, string partitionKey = null) where TDocument : IDocument; @@ -183,11 +184,11 @@ namespace MongoDbGenericRepository /// For the entity selected by the filter, updates the property field with the given value. /// /// The type representing a Document. - /// The type of the primary key for a Document. /// The type of the field. /// The document filter. /// The field selector. /// The new value of the property field. + /// The partition key for the document. Task UpdateOneAsync(Expression> filter, Expression> field, TField value, string partitionKey = null) where TDocument : IDocument; @@ -255,6 +256,7 @@ namespace MongoDbGenericRepository /// The document filter. /// The field selector. /// The new value of the property field. + /// The partition key for the document. bool UpdateOne(Expression> filter, Expression> field, TField value, string partitionKey = null) where TDocument : IDocument where TKey : IEquatable; @@ -281,6 +283,7 @@ namespace MongoDbGenericRepository /// The document filter. /// The field selector. /// The new value of the property field. + /// The partition key for the document. Task UpdateOneAsync(Expression> filter, Expression> field, TField value, string partitionKey = null) where TDocument : IDocument where TKey : IEquatable; diff --git a/MongoDbGenericRepository/Attributes/CollectionNameAttribute.cs b/MongoDbGenericRepository/Attributes/CollectionNameAttribute.cs index 7a5984c..3d851ed 100644 --- a/MongoDbGenericRepository/Attributes/CollectionNameAttribute.cs +++ b/MongoDbGenericRepository/Attributes/CollectionNameAttribute.cs @@ -17,6 +17,10 @@ namespace MongoDbGenericRepository.Attributes /// public string Name { get; set; } + /// + /// The constructor. + /// + /// The name of the collection. public CollectionNameAttribute(string name) { this.Name = name; diff --git a/MongoDbGenericRepository/BaseMongoDbRepository.cs b/MongoDbGenericRepository/BaseMongoDbRepository.cs index 68c75a4..d6dc091 100644 --- a/MongoDbGenericRepository/BaseMongoDbRepository.cs +++ b/MongoDbGenericRepository/BaseMongoDbRepository.cs @@ -284,6 +284,7 @@ namespace MongoDbGenericRepository /// The document filter. /// The field selector. /// The new value of the property field. + /// The partition key for the document. public virtual bool UpdateOne(Expression> filter, Expression> field, TField value, string partitionKey = null) where TDocument : IDocument { @@ -313,11 +314,11 @@ namespace MongoDbGenericRepository /// For the entity selected by the filter, updates the property field with the given value. /// /// The type representing a Document. - /// The type of the primary key for a Document. /// The type of the field. /// The document filter. /// The field selector. /// The new value of the property field. + /// The partition key for the document. public virtual async Task UpdateOneAsync(Expression> filter, Expression> field, TField value, string partitionKey = null) where TDocument : IDocument { @@ -470,6 +471,7 @@ namespace MongoDbGenericRepository /// The document filter. /// The field selector. /// The new value of the property field. + /// The partition key for the document. public virtual async Task UpdateOneAsync(Expression> filter, Expression> field, TField value, string partitionKey = null) where TDocument : IDocument where TKey : IEquatable @@ -507,6 +509,7 @@ namespace MongoDbGenericRepository /// The document filter. /// The field selector. /// The new value of the property field. + /// The partition key for the document. public virtual bool UpdateOne(Expression> filter, Expression> field, TField value, string partitionKey = null) where TDocument : IDocument where TKey : IEquatable diff --git a/MongoDbGenericRepository/MongoDbGenericRepository.nuspec b/MongoDbGenericRepository/MongoDbGenericRepository.nuspec index 804763a..95efe1b 100644 --- a/MongoDbGenericRepository/MongoDbGenericRepository.nuspec +++ b/MongoDbGenericRepository/MongoDbGenericRepository.nuspec @@ -2,7 +2,7 @@ MongoDbGenericRepository - 1.3.5 + 1.3.6 MongoDb Generic Repository Alexandre Spieser Alexandre Spieser @@ -10,7 +10,7 @@ https://github.com/alexandre-spieser/mongodb-generic-repository false A generic repository implementation using the MongoDB C# Sharp 2.0 driver. - Adding CollectionName attribute to specify alternate collection name (thanks Etchelon). + Adding support for Id of type ObjectId. Copyright 2017 (c) Alexandre Spieser. All rights reserved. MongoDb Repository Generic NoSql diff --git a/MongoDbGenericRepository/Utils/IdGenerator.cs b/MongoDbGenericRepository/Utils/IdGenerator.cs index f28b49f..4397a6c 100644 --- a/MongoDbGenericRepository/Utils/IdGenerator.cs +++ b/MongoDbGenericRepository/Utils/IdGenerator.cs @@ -3,10 +3,18 @@ using System; namespace MongoDbGenericRepository.Utils { + /// + /// The IdGenerator instance, used to generate Ids of different types. + /// public static class IdGenerator { private static readonly Random Random = new Random(); + /// + /// Generates a random value of a given type. + /// + /// The type of the value to generate. + /// A value of type TKey. public static TKey GetId() { var idTypeName = typeof(TKey).Name; diff --git a/MongoDbGenericRepository/lib/net45/MongoDbGenericRepository.dll b/MongoDbGenericRepository/lib/net45/MongoDbGenericRepository.dll index 02f7392..f0d0e37 100644 Binary files a/MongoDbGenericRepository/lib/net45/MongoDbGenericRepository.dll and b/MongoDbGenericRepository/lib/net45/MongoDbGenericRepository.dll differ diff --git a/MongoDbGenericRepository/lib/net45/MongoDbGenericRepository.xml b/MongoDbGenericRepository/lib/net45/MongoDbGenericRepository.xml index e775c67..f599a93 100644 --- a/MongoDbGenericRepository/lib/net45/MongoDbGenericRepository.xml +++ b/MongoDbGenericRepository/lib/net45/MongoDbGenericRepository.xml @@ -141,6 +141,7 @@ The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -155,11 +156,11 @@ For the entity selected by the filter, updates the property field with the given value. The type representing a Document. - The type of the primary key for a Document. The type of the field. The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -213,6 +214,7 @@ The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -235,6 +237,7 @@ The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -830,6 +833,12 @@ The name of the collection in which your documents are stored. + + + The constructor. + + The name of the collection. + The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation. @@ -985,6 +994,7 @@ The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -1002,11 +1012,11 @@ For the entity selected by the filter, updates the property field with the given value. The type representing a Document. - The type of the primary key for a Document. The type of the field. The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -1094,6 +1104,7 @@ The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -1117,6 +1128,7 @@ The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -1870,6 +1882,18 @@ The collection partition key. + + + The IdGenerator instance, used to generate Ids of different types. + + + + + Generates a random value of a given type. + + The type of the value to generate. + A value of type TKey. + Container for registered Vocabularies. At present, only a single vocabulary is supported: Default. diff --git a/MongoDbGenericRepository/lib/netstandard1.5/MongoDbGenericRepository.dll b/MongoDbGenericRepository/lib/netstandard1.5/MongoDbGenericRepository.dll index 4301049..c198950 100644 Binary files a/MongoDbGenericRepository/lib/netstandard1.5/MongoDbGenericRepository.dll and b/MongoDbGenericRepository/lib/netstandard1.5/MongoDbGenericRepository.dll differ diff --git a/MongoDbGenericRepository/lib/netstandard1.5/MongoDbGenericRepository.xml b/MongoDbGenericRepository/lib/netstandard1.5/MongoDbGenericRepository.xml index e775c67..f599a93 100644 --- a/MongoDbGenericRepository/lib/netstandard1.5/MongoDbGenericRepository.xml +++ b/MongoDbGenericRepository/lib/netstandard1.5/MongoDbGenericRepository.xml @@ -141,6 +141,7 @@ The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -155,11 +156,11 @@ For the entity selected by the filter, updates the property field with the given value. The type representing a Document. - The type of the primary key for a Document. The type of the field. The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -213,6 +214,7 @@ The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -235,6 +237,7 @@ The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -830,6 +833,12 @@ The name of the collection in which your documents are stored. + + + The constructor. + + The name of the collection. + The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation. @@ -985,6 +994,7 @@ The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -1002,11 +1012,11 @@ For the entity selected by the filter, updates the property field with the given value. The type representing a Document. - The type of the primary key for a Document. The type of the field. The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -1094,6 +1104,7 @@ The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -1117,6 +1128,7 @@ The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -1870,6 +1882,18 @@ The collection partition key. + + + The IdGenerator instance, used to generate Ids of different types. + + + + + Generates a random value of a given type. + + The type of the value to generate. + A value of type TKey. + Container for registered Vocabularies. At present, only a single vocabulary is supported: Default. diff --git a/MongoDbGenericRepository/lib/netstandard2.0/MongoDbGenericRepository.dll b/MongoDbGenericRepository/lib/netstandard2.0/MongoDbGenericRepository.dll index 135ebe2..3af9dbc 100644 Binary files a/MongoDbGenericRepository/lib/netstandard2.0/MongoDbGenericRepository.dll and b/MongoDbGenericRepository/lib/netstandard2.0/MongoDbGenericRepository.dll differ diff --git a/MongoDbGenericRepository/lib/netstandard2.0/MongoDbGenericRepository.xml b/MongoDbGenericRepository/lib/netstandard2.0/MongoDbGenericRepository.xml index e775c67..f599a93 100644 --- a/MongoDbGenericRepository/lib/netstandard2.0/MongoDbGenericRepository.xml +++ b/MongoDbGenericRepository/lib/netstandard2.0/MongoDbGenericRepository.xml @@ -141,6 +141,7 @@ The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -155,11 +156,11 @@ For the entity selected by the filter, updates the property field with the given value. The type representing a Document. - The type of the primary key for a Document. The type of the field. The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -213,6 +214,7 @@ The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -235,6 +237,7 @@ The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -830,6 +833,12 @@ The name of the collection in which your documents are stored. + + + The constructor. + + The name of the collection. + The base Repository, it is meant to be inherited from by your custom custom MongoRepository implementation. @@ -985,6 +994,7 @@ The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -1002,11 +1012,11 @@ For the entity selected by the filter, updates the property field with the given value. The type representing a Document. - The type of the primary key for a Document. The type of the field. The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -1094,6 +1104,7 @@ The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -1117,6 +1128,7 @@ The document filter. The field selector. The new value of the property field. + The partition key for the document. @@ -1870,6 +1882,18 @@ The collection partition key. + + + The IdGenerator instance, used to generate Ids of different types. + + + + + Generates a random value of a given type. + + The type of the value to generate. + A value of type TKey. + Container for registered Vocabularies. At present, only a single vocabulary is supported: Default.