From 31b6a5c14c19d9e280c09a97b8f76822ec7f201b Mon Sep 17 00:00:00 2001 From: VjParmar Date: Tue, 10 Oct 2017 18:38:06 +0530 Subject: [PATCH 1/5] Add files via upload --- MongoRepository/CollectionName.cs | 3 - MongoRepository/MongoRepository.Net45.csproj | 159 ++++++++++--------- MongoRepository/packages.config | 10 +- 3 files changed, 91 insertions(+), 81 deletions(-) diff --git a/MongoRepository/CollectionName.cs b/MongoRepository/CollectionName.cs index e294e82..5118b3a 100644 --- a/MongoRepository/CollectionName.cs +++ b/MongoRepository/CollectionName.cs @@ -1,9 +1,6 @@ namespace MongoRepository { using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; /// /// Attribute used to annotate Enities with to override mongo collection name. By default, when this attribute diff --git a/MongoRepository/MongoRepository.Net45.csproj b/MongoRepository/MongoRepository.Net45.csproj index db235e6..fb21a69 100644 --- a/MongoRepository/MongoRepository.Net45.csproj +++ b/MongoRepository/MongoRepository.Net45.csproj @@ -1,82 +1,91 @@ - - - - Debug - AnyCPU - 8.0.30703 - 2.0 - {CE75B2FE-C027-42F6-8D00-E44CC38BE7C7} - Library - Properties - MongoRepository - MongoRepository.Net45 - v4.5 - 512 - SAK - SAK - SAK - SAK - ..\..\MongoRepository\ - true - - - true - full - false - bin\Debug\ - TRACE;DEBUG - prompt - 4 - - - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - bin\Release\MongoRepository.Net45.xml - - - - ..\packages\mongocsharpdriver.1.11.0\lib\net35\MongoDB.Bson.dll - True - - - ..\packages\mongocsharpdriver.1.11.0\lib\net35\MongoDB.Driver.dll - True - - - - - - - - - - - - - - - - - - - - - - - - - + + + + Debug + AnyCPU + 8.0.30703 + 2.0 + {CE75B2FE-C027-42F6-8D00-E44CC38BE7C7} + Library + Properties + MongoRepository + MongoRepository.Net45 + v4.5.2 + 512 + SAK + SAK + SAK + SAK + ..\..\MongoRepository\ + true + + + + true + full + false + bin\Debug\ + TRACE;DEBUG + prompt + 4 + + + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + bin\Release\MongoRepository.Net45.xml + + + + ..\packages\MongoDB.Bson.2.4.3\lib\net45\MongoDB.Bson.dll + True + + + ..\packages\MongoDB.Driver.2.4.3\lib\net45\MongoDB.Driver.dll + True + + + ..\packages\MongoDB.Driver.Core.2.4.3\lib\net45\MongoDB.Driver.Core.dll + True + + + ..\packages\mongocsharpdriver.2.4.3\lib\net45\MongoDB.Driver.Legacy.dll + True + + + + + + + + + + + + + + + + + + + + + + + + + + --> \ No newline at end of file diff --git a/MongoRepository/packages.config b/MongoRepository/packages.config index 1c60ec1..7c32a95 100644 --- a/MongoRepository/packages.config +++ b/MongoRepository/packages.config @@ -1,4 +1,8 @@ - - - + + + + + + + \ No newline at end of file From 1793849f6158ed75eed6b5c2255845dd3e98412c Mon Sep 17 00:00:00 2001 From: VjParmar Date: Tue, 10 Oct 2017 18:39:16 +0530 Subject: [PATCH 2/5] Add files via upload --- MongoRepository/Properties/AssemblyInfo.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/MongoRepository/Properties/AssemblyInfo.cs b/MongoRepository/Properties/AssemblyInfo.cs index 67ac4bb..c95890d 100644 --- a/MongoRepository/Properties/AssemblyInfo.cs +++ b/MongoRepository/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following From ddb315895c7f487f96dd617bfeb0cea62cc235af Mon Sep 17 00:00:00 2001 From: VjParmar Date: Tue, 10 Oct 2017 18:39:36 +0530 Subject: [PATCH 3/5] Add files via upload --- MongoRepository/Repository/IRepository.cs | 31 +----------- MongoRepository/Repository/MongoRepository.cs | 47 +------------------ 2 files changed, 3 insertions(+), 75 deletions(-) diff --git a/MongoRepository/Repository/IRepository.cs b/MongoRepository/Repository/IRepository.cs index 954cdce..20c5c2d 100644 --- a/MongoRepository/Repository/IRepository.cs +++ b/MongoRepository/Repository/IRepository.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; - using MongoDB.Bson; using MongoDB.Driver; /// @@ -95,35 +94,7 @@ public interface IRepository : IQueryable /// True when an entity matching the predicate exists, false otherwise. bool Exists(Expression> predicate); - /// - /// Lets the server know that this thread is about to begin a series of related operations that must all occur - /// on the same connection. The return value of this method implements IDisposable and can be placed in a using - /// statement (in which case RequestDone will be called automatically when leaving the using statement). - /// - /// A helper object that implements IDisposable and calls RequestDone() from the Dispose method. - /// - /// Sometimes a series of operations needs to be performed on the same connection in order to guarantee correct - /// results. This is rarely the case, and most of the time there is no need to call RequestStart/RequestDone. - /// An example of when this might be necessary is when a series of Inserts are called in rapid succession with - /// SafeMode off, and you want to query that data in a consistent manner immediately thereafter (with SafeMode - /// off the writes can queue up at the server and might not be immediately visible to other connections). Using - /// RequestStart you can force a query to be on the same connection as the writes, so the query won't execute - /// until the server has caught up with the writes. - /// A thread can temporarily reserve a connection from the connection pool by using RequestStart and - /// RequestDone. You are free to use any other databases as well during the request. RequestStart increments a - /// counter (for this thread) and RequestDone decrements the counter. The connection that was reserved is not - /// actually returned to the connection pool until the count reaches zero again. This means that calls to - /// RequestStart/RequestDone can be nested and the right thing will happen. - /// - IDisposable RequestStart(); - - /// - /// Lets the server know that this thread is done with a series of related operations. - /// - /// - /// Instead of calling this method it is better to put the return value of RequestStart in a using statement. - /// - void RequestDone(); + } /// diff --git a/MongoRepository/Repository/MongoRepository.cs b/MongoRepository/Repository/MongoRepository.cs index 4ea2e9c..da538f9 100644 --- a/MongoRepository/Repository/MongoRepository.cs +++ b/MongoRepository/Repository/MongoRepository.cs @@ -234,51 +234,8 @@ public virtual bool Exists(Expression> predicate) { return this.collection.AsQueryable().Any(predicate); } - - /// - /// Lets the server know that this thread is about to begin a series of related operations that must all occur - /// on the same connection. The return value of this method implements IDisposable and can be placed in a using - /// statement (in which case RequestDone will be called automatically when leaving the using statement). - /// - /// A helper object that implements IDisposable and calls RequestDone() from the Dispose method. - /// - /// - /// Sometimes a series of operations needs to be performed on the same connection in order to guarantee correct - /// results. This is rarely the case, and most of the time there is no need to call RequestStart/RequestDone. - /// An example of when this might be necessary is when a series of Inserts are called in rapid succession with - /// SafeMode off, and you want to query that data in a consistent manner immediately thereafter (with SafeMode - /// off the writes can queue up at the server and might not be immediately visible to other connections). Using - /// RequestStart you can force a query to be on the same connection as the writes, so the query won't execute - /// until the server has caught up with the writes. - /// - /// - /// A thread can temporarily reserve a connection from the connection pool by using RequestStart and - /// RequestDone. You are free to use any other databases as well during the request. RequestStart increments a - /// counter (for this thread) and RequestDone decrements the counter. The connection that was reserved is not - /// actually returned to the connection pool until the count reaches zero again. This means that calls to - /// RequestStart/RequestDone can be nested and the right thing will happen. - /// - /// - /// Use the connectionstring to specify the readpreference; add "readPreference=X" where X is one of the following - /// values: primary, primaryPreferred, secondary, secondaryPreferred, nearest. - /// See http://docs.mongodb.org/manual/applications/replication/#read-preference - /// - /// - public virtual IDisposable RequestStart() - { - return this.collection.Database.RequestStart(); - } - - /// - /// Lets the server know that this thread is done with a series of related operations. - /// - /// - /// Instead of calling this method it is better to put the return value of RequestStart in a using statement. - /// - public virtual void RequestDone() - { - this.collection.Database.RequestDone(); - } + + #region IQueryable /// From 73ba2a44d6068a2ab36590d1c5fb0f71c9dced31 Mon Sep 17 00:00:00 2001 From: VjParmar Date: Tue, 10 Oct 2017 18:39:55 +0530 Subject: [PATCH 4/5] Add files via upload --- MongoRepository/RepositoryManager/IRepositoryManager.cs | 1 - MongoRepository/RepositoryManager/MongoRepositoryManager.cs | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/MongoRepository/RepositoryManager/IRepositoryManager.cs b/MongoRepository/RepositoryManager/IRepositoryManager.cs index a7846f1..8641eeb 100644 --- a/MongoRepository/RepositoryManager/IRepositoryManager.cs +++ b/MongoRepository/RepositoryManager/IRepositoryManager.cs @@ -2,7 +2,6 @@ { using System.Collections.Generic; using MongoDB.Driver; - using System; /// /// IRepositoryManager definition. diff --git a/MongoRepository/RepositoryManager/MongoRepositoryManager.cs b/MongoRepository/RepositoryManager/MongoRepositoryManager.cs index 8659349..afe1869 100644 --- a/MongoRepository/RepositoryManager/MongoRepositoryManager.cs +++ b/MongoRepository/RepositoryManager/MongoRepositoryManager.cs @@ -235,7 +235,7 @@ public virtual void ReIndex() [Obsolete("This method will be removed in the next version of the driver")] public virtual long GetTotalDataSize() { - return this.collection.GetTotalDataSize(); + return this.collection.GetStats().DataSize; } /// @@ -245,7 +245,7 @@ public virtual long GetTotalDataSize() [Obsolete("This method will be removed in the next version of the driver")] public virtual long GetTotalStorageSize() { - return this.collection.GetTotalStorageSize(); + return this.collection.GetStats().StorageSize; } /// From 56dd9e87c1965e93b1b9c2e014446f7228d4027b Mon Sep 17 00:00:00 2001 From: VjParmar Date: Tue, 10 Oct 2017 18:41:44 +0530 Subject: [PATCH 5/5] Add files via upload --- MongoRepositoryTests/App.config | 12 +- MongoRepositoryTests/Entities/Animals.cs | 4 +- .../Entities/CustomIDEntity.cs | 2 - MongoRepositoryTests/Entities/Customer.cs | 2 +- MongoRepositoryTests/Entities/Product.cs | 3 +- .../MongoRepositoryManagerTest.cs | 4 +- .../MongoRepositoryTests.csproj | 187 ++++++++++-------- .../Properties/AssemblyInfo.cs | 1 - MongoRepositoryTests/RepoTests.cs | 2 +- MongoRepositoryTests/packages.config | 10 +- 10 files changed, 119 insertions(+), 108 deletions(-) diff --git a/MongoRepositoryTests/App.config b/MongoRepositoryTests/App.config index 55ed765..8d4ad35 100644 --- a/MongoRepositoryTests/App.config +++ b/MongoRepositoryTests/App.config @@ -1,6 +1,6 @@ - - - - - - \ No newline at end of file + + + + + + diff --git a/MongoRepositoryTests/Entities/Animals.cs b/MongoRepositoryTests/Entities/Animals.cs index a26f868..512ae6e 100644 --- a/MongoRepositoryTests/Entities/Animals.cs +++ b/MongoRepositoryTests/Entities/Animals.cs @@ -1,5 +1,5 @@ -using MongoRepository; -using MongoDB.Bson.Serialization.Attributes; +using MongoDB.Bson.Serialization.Attributes; +using MongoRepository; namespace MongoRepositoryTests.Entities { diff --git a/MongoRepositoryTests/Entities/CustomIDEntity.cs b/MongoRepositoryTests/Entities/CustomIDEntity.cs index 874c13e..d6fa43e 100644 --- a/MongoRepositoryTests/Entities/CustomIDEntity.cs +++ b/MongoRepositoryTests/Entities/CustomIDEntity.cs @@ -1,6 +1,4 @@ using MongoRepository; -using System; -using MongoDB.Bson.Serialization.Attributes; namespace MongoRepositoryTests.Entities { diff --git a/MongoRepositoryTests/Entities/Customer.cs b/MongoRepositoryTests/Entities/Customer.cs index 9b903a0..e9deb9b 100644 --- a/MongoRepositoryTests/Entities/Customer.cs +++ b/MongoRepositoryTests/Entities/Customer.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -using MongoRepository; using MongoDB.Bson.Serialization.Attributes; +using MongoRepository; namespace MongoRepositoryTests.Entities { diff --git a/MongoRepositoryTests/Entities/Product.cs b/MongoRepositoryTests/Entities/Product.cs index ae96a74..d7b7437 100644 --- a/MongoRepositoryTests/Entities/Product.cs +++ b/MongoRepositoryTests/Entities/Product.cs @@ -1,5 +1,4 @@ -using System; -using MongoRepository; +using MongoRepository; namespace MongoRepositoryTests.Entities { diff --git a/MongoRepositoryTests/MongoRepositoryManagerTest.cs b/MongoRepositoryTests/MongoRepositoryManagerTest.cs index faa7ff2..1f554ce 100644 --- a/MongoRepositoryTests/MongoRepositoryManagerTest.cs +++ b/MongoRepositoryTests/MongoRepositoryManagerTest.cs @@ -1,6 +1,4 @@ -using MongoRepository; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; +using Microsoft.VisualStudio.TestTools.UnitTesting; namespace MongoRepositoryTests { diff --git a/MongoRepositoryTests/MongoRepositoryTests.csproj b/MongoRepositoryTests/MongoRepositoryTests.csproj index 7aeefd3..e444412 100644 --- a/MongoRepositoryTests/MongoRepositoryTests.csproj +++ b/MongoRepositoryTests/MongoRepositoryTests.csproj @@ -1,94 +1,107 @@ - - - - Debug - AnyCPU - - - 2.0 - {7C8276C3-819A-4EA1-BFDA-64C3760B0037} - Library - Properties - MongoRepositoryTests - MongoRepositoryTests - v4.0 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - SAK - SAK - SAK - SAK - ..\..\MongoRepository\ - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - ..\packages\mongocsharpdriver.1.11.0\lib\net35\MongoDB.Bson.dll - True - - - ..\packages\mongocsharpdriver.1.11.0\lib\net35\MongoDB.Driver.dll - True - - - - - 3.5 - - - - - - False - - - - - - - - - - - - - - - Designer - - - - - {e2c4a7f9-4b14-46cb-bfce-afabfacb3390} - MongoRepository.Net40 - - - - + + + + Debug + AnyCPU + + + 2.0 + {7C8276C3-819A-4EA1-BFDA-64C3760B0037} + Library + Properties + MongoRepositoryTests + MongoRepositoryTests + v4.5.2 + 512 + {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + SAK + SAK + SAK + SAK + ..\..\MongoRepository\ + true + + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + false + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + false + + + + + + ..\packages\MongoDB.Bson.2.4.3\lib\net45\MongoDB.Bson.dll + True + + + ..\packages\MongoDB.Driver.2.4.3\lib\net45\MongoDB.Driver.dll + True + + + ..\packages\MongoDB.Driver.Core.2.4.3\lib\net45\MongoDB.Driver.Core.dll + True + + + ..\packages\mongocsharpdriver.2.4.3\lib\net45\MongoDB.Driver.Legacy.dll + True + + + + + 3.5 + + + + ..\packages\System.Runtime.InteropServices.RuntimeInformation.4.0.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll + True + + + + + False + + + + + + + + + + + + + + + + + + {ce75b2fe-c027-42f6-8d00-e44cc38be7c7} + MongoRepository.Net45 + + + + + --> \ No newline at end of file diff --git a/MongoRepositoryTests/Properties/AssemblyInfo.cs b/MongoRepositoryTests/Properties/AssemblyInfo.cs index e080e33..60513bc 100644 --- a/MongoRepositoryTests/Properties/AssemblyInfo.cs +++ b/MongoRepositoryTests/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/MongoRepositoryTests/RepoTests.cs b/MongoRepositoryTests/RepoTests.cs index d96d45b..303ebad 100644 --- a/MongoRepositoryTests/RepoTests.cs +++ b/MongoRepositoryTests/RepoTests.cs @@ -1,11 +1,11 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using MongoDB.Driver; -using MongoRepository; using MongoRepositoryTests.Entities; using System; using System.Collections.Generic; using System.Configuration; using System.Linq; +using MongoRepository; namespace MongoRepositoryTests { diff --git a/MongoRepositoryTests/packages.config b/MongoRepositoryTests/packages.config index 1c60ec1..46c3107 100644 --- a/MongoRepositoryTests/packages.config +++ b/MongoRepositoryTests/packages.config @@ -1,4 +1,8 @@ - - - + + + + + + + \ No newline at end of file