Skip to content
This repository was archived by the owner on Feb 22, 2020. It is now read-only.

Commit 3051a77

Browse files
committed
Dev -> Trunk
1 parent 9957d66 commit 3051a77

File tree

10 files changed

+49
-28
lines changed

10 files changed

+49
-28
lines changed

MongoRepository/trunk/Help/MongoRepository.shfbproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<SccProvider>SAK</SccProvider>
3838
<SccAuxPath>SAK</SccAuxPath>
3939
<SccLocalPath>SAK</SccLocalPath>
40-
<HelpFileVersion>1.6.4.0</HelpFileVersion>
40+
<HelpFileVersion>1.6.5.0</HelpFileVersion>
4141
<BuildAssemblerVerbosity>OnlyWarningsAndErrors</BuildAssemblerVerbosity>
4242
<HelpFileFormat>HtmlHelp1, Website</HelpFileFormat>
4343
<IndentHtml>False</IndentHtml>

MongoRepository/trunk/MongoRepository.nuspec

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
<package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
33
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
44
<id>MongoRepository</id>
5-
<version>1.6.4</version>
5+
<title>MongoRepository</title>
6+
<version>1.6.5</version>
67
<authors>tgeek, RobIII</authors>
78
<owners>tgeek</owners>
89
<licenseUrl>http://mongorepository.codeplex.com/license</licenseUrl>
@@ -12,14 +13,14 @@
1213
<tags>mongo mongodb repository</tags>
1314
<iconUrl>http://download-codeplex.sec.s-msft.com/Download?ProjectName=mongorepository&amp;DownloadId=334950&amp;Build=19692</iconUrl>
1415
<releaseNotes>
15-
Updated to MongoCSharp driver 1.9.0.200
16+
Updated to MongoCSharp driver 1.9.1.221, added GetById(ObjectId) overload, added CollectionName property (convenience property)
1617
</releaseNotes>
1718
<summary>
1819
Provides a repository pattern on top of 10gen's MongoDB C# driver.
1920
</summary>
2021
<language>en-US</language>
2122
<dependencies>
22-
<dependency id="mongocsharpdriver" version="[1.9.0]" />
23+
<dependency id="mongocsharpdriver" version="[1.9.1]" />
2324
</dependencies>
2425
</metadata>
2526
<files>

MongoRepository/trunk/MongoRepository/MongoRepository.Net35.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@
4040
<DocumentationFile>bin\Release\MongoRepository.Net35.xml</DocumentationFile>
4141
</PropertyGroup>
4242
<ItemGroup>
43-
<Reference Include="MongoDB.Bson, Version=1.9.0.200, Culture=neutral, PublicKeyToken=f686731cfb9cc103, processorArchitecture=MSIL">
43+
<Reference Include="MongoDB.Bson, Version=1.9.1.221, Culture=neutral, PublicKeyToken=f686731cfb9cc103, processorArchitecture=MSIL">
4444
<SpecificVersion>False</SpecificVersion>
45-
<HintPath>..\packages\mongocsharpdriver.1.9.0\lib\net35\MongoDB.Bson.dll</HintPath>
45+
<HintPath>..\packages\mongocsharpdriver.1.9.1\lib\net35\MongoDB.Bson.dll</HintPath>
4646
</Reference>
47-
<Reference Include="MongoDB.Driver, Version=1.9.0.200, Culture=neutral, PublicKeyToken=f686731cfb9cc103, processorArchitecture=MSIL">
47+
<Reference Include="MongoDB.Driver, Version=1.9.1.221, Culture=neutral, PublicKeyToken=f686731cfb9cc103, processorArchitecture=MSIL">
4848
<SpecificVersion>False</SpecificVersion>
49-
<HintPath>..\packages\mongocsharpdriver.1.9.0\lib\net35\MongoDB.Driver.dll</HintPath>
49+
<HintPath>..\packages\mongocsharpdriver.1.9.1\lib\net35\MongoDB.Driver.dll</HintPath>
5050
</Reference>
5151
<Reference Include="System" />
5252
<Reference Include="System.Configuration" />

MongoRepository/trunk/MongoRepository/MongoRepository.Net40.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@
4040
<DocumentationFile>bin\Release\MongoRepository.Net40.xml</DocumentationFile>
4141
</PropertyGroup>
4242
<ItemGroup>
43-
<Reference Include="MongoDB.Bson, Version=1.9.0.200, Culture=neutral, PublicKeyToken=f686731cfb9cc103, processorArchitecture=MSIL">
43+
<Reference Include="MongoDB.Bson, Version=1.9.1.221, Culture=neutral, PublicKeyToken=f686731cfb9cc103, processorArchitecture=MSIL">
4444
<SpecificVersion>False</SpecificVersion>
45-
<HintPath>..\packages\mongocsharpdriver.1.9.0\lib\net35\MongoDB.Bson.dll</HintPath>
45+
<HintPath>..\packages\mongocsharpdriver.1.9.1\lib\net35\MongoDB.Bson.dll</HintPath>
4646
</Reference>
47-
<Reference Include="MongoDB.Driver, Version=1.9.0.200, Culture=neutral, PublicKeyToken=f686731cfb9cc103, processorArchitecture=MSIL">
47+
<Reference Include="MongoDB.Driver, Version=1.9.1.221, Culture=neutral, PublicKeyToken=f686731cfb9cc103, processorArchitecture=MSIL">
4848
<SpecificVersion>False</SpecificVersion>
49-
<HintPath>..\packages\mongocsharpdriver.1.9.0\lib\net35\MongoDB.Driver.dll</HintPath>
49+
<HintPath>..\packages\mongocsharpdriver.1.9.1\lib\net35\MongoDB.Driver.dll</HintPath>
5050
</Reference>
5151
<Reference Include="System" />
5252
<Reference Include="System.Configuration" />

MongoRepository/trunk/MongoRepository/MongoRepository.Net45.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@
4040
<DocumentationFile>bin\Release\MongoRepository.Net45.xml</DocumentationFile>
4141
</PropertyGroup>
4242
<ItemGroup>
43-
<Reference Include="MongoDB.Bson, Version=1.9.0.200, Culture=neutral, PublicKeyToken=f686731cfb9cc103, processorArchitecture=MSIL">
43+
<Reference Include="MongoDB.Bson, Version=1.9.1.221, Culture=neutral, PublicKeyToken=f686731cfb9cc103, processorArchitecture=MSIL">
4444
<SpecificVersion>False</SpecificVersion>
45-
<HintPath>..\packages\mongocsharpdriver.1.9.0\lib\net35\MongoDB.Bson.dll</HintPath>
45+
<HintPath>..\packages\mongocsharpdriver.1.9.1\lib\net35\MongoDB.Bson.dll</HintPath>
4646
</Reference>
47-
<Reference Include="MongoDB.Driver, Version=1.9.0.200, Culture=neutral, PublicKeyToken=f686731cfb9cc103, processorArchitecture=MSIL">
47+
<Reference Include="MongoDB.Driver, Version=1.9.1.221, Culture=neutral, PublicKeyToken=f686731cfb9cc103, processorArchitecture=MSIL">
4848
<SpecificVersion>False</SpecificVersion>
49-
<HintPath>..\packages\mongocsharpdriver.1.9.0\lib\net35\MongoDB.Driver.dll</HintPath>
49+
<HintPath>..\packages\mongocsharpdriver.1.9.1\lib\net35\MongoDB.Driver.dll</HintPath>
5050
</Reference>
5151
<Reference Include="System" />
5252
<Reference Include="System.Configuration" />

MongoRepository/trunk/MongoRepository/Repository/MongoRepository.cs

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,12 @@ public MongoRepository(MongoUrl url, string collectionName)
8181
/// <value>The Mongo collection (to perform advanced operations).</value>
8282
public MongoCollection<T> Collection
8383
{
84-
get
85-
{
86-
return this.collection;
87-
}
84+
get { return this.collection; }
85+
}
86+
87+
public string CollectionName
88+
{
89+
get { return this.collection.Name; }
8890
}
8991

9092
/// <summary>
@@ -96,12 +98,22 @@ public virtual T GetById(TKey id)
9698
{
9799
if (typeof(T).IsSubclassOf(typeof(Entity)))
98100
{
99-
return this.collection.FindOneByIdAs<T>(new ObjectId(id as string));
101+
return this.GetById(new ObjectId(id as string));
100102
}
101103

102104
return this.collection.FindOneByIdAs<T>(BsonValue.Create(id));
103105
}
104106

107+
/// <summary>
108+
/// Returns the T by its given id.
109+
/// </summary>
110+
/// <param name="id">The Id of the entity to retrieve.</param>
111+
/// <returns>The Entity T.</returns>
112+
public virtual T GetById(ObjectId id)
113+
{
114+
return this.collection.FindOneByIdAs<T>(id);
115+
}
116+
105117
/// <summary>
106118
/// Adds the new entity in the repository.
107119
/// </summary>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="mongocsharpdriver" version="1.9.0" targetFramework="net45" />
3+
<package id="mongocsharpdriver" version="1.9.1" targetFramework="net35" />
44
</packages>

MongoRepository/trunk/MongoRepositoryTests/MongoRepositoryTests.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@
4141
<ItemGroup>
4242
<Reference Include="Microsoft.CSharp" />
4343
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
44-
<Reference Include="MongoDB.Bson, Version=1.9.0.200, Culture=neutral, PublicKeyToken=f686731cfb9cc103, processorArchitecture=MSIL">
44+
<Reference Include="MongoDB.Bson, Version=1.9.1.221, Culture=neutral, PublicKeyToken=f686731cfb9cc103, processorArchitecture=MSIL">
4545
<SpecificVersion>False</SpecificVersion>
46-
<HintPath>..\packages\mongocsharpdriver.1.9.0\lib\net35\MongoDB.Bson.dll</HintPath>
46+
<HintPath>..\packages\mongocsharpdriver.1.9.1\lib\net35\MongoDB.Bson.dll</HintPath>
4747
</Reference>
48-
<Reference Include="MongoDB.Driver, Version=1.9.0.200, Culture=neutral, PublicKeyToken=f686731cfb9cc103, processorArchitecture=MSIL">
48+
<Reference Include="MongoDB.Driver, Version=1.9.1.221, Culture=neutral, PublicKeyToken=f686731cfb9cc103, processorArchitecture=MSIL">
4949
<SpecificVersion>False</SpecificVersion>
50-
<HintPath>..\packages\mongocsharpdriver.1.9.0\lib\net35\MongoDB.Driver.dll</HintPath>
50+
<HintPath>..\packages\mongocsharpdriver.1.9.1\lib\net35\MongoDB.Driver.dll</HintPath>
5151
</Reference>
5252
<Reference Include="System" />
5353
<Reference Include="System.Configuration" />

MongoRepository/trunk/MongoRepositoryTests/RepoTests.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ public void CollectionNamesTest()
207207
Assert.IsTrue(am.Exists);
208208
Assert.IsInstanceOfType(a.GetById(va.Id), typeof(Dog));
209209
Assert.AreEqual(am.Name, "AnimalsTest");
210+
Assert.AreEqual(a.CollectionName, "AnimalsTest");
210211

211212
var cl = new MongoRepository<CatLike>();
212213
var clm = new MongoRepositoryManager<CatLike>();
@@ -216,6 +217,7 @@ public void CollectionNamesTest()
216217
Assert.IsTrue(clm.Exists);
217218
Assert.IsInstanceOfType(cl.GetById(vcl.Id), typeof(Lion));
218219
Assert.AreEqual(clm.Name, "Catlikes");
220+
Assert.AreEqual(cl.CollectionName, "Catlikes");
219221

220222
var b = new MongoRepository<Bird>();
221223
var bm = new MongoRepositoryManager<Bird>();
@@ -225,6 +227,7 @@ public void CollectionNamesTest()
225227
Assert.IsTrue(bm.Exists);
226228
Assert.IsInstanceOfType(b.GetById(vb.Id), typeof(Bird));
227229
Assert.AreEqual(bm.Name, "Birds");
230+
Assert.AreEqual(b.CollectionName, "Birds");
228231

229232
var l = new MongoRepository<Lion>();
230233
var lm = new MongoRepositoryManager<Lion>();
@@ -234,6 +237,7 @@ public void CollectionNamesTest()
234237
Assert.IsTrue(lm.Exists);
235238
Assert.IsInstanceOfType(l.GetById(vl.Id), typeof(Lion));
236239
Assert.AreEqual(lm.Name, "Catlikes");
240+
Assert.AreEqual(l.CollectionName, "Catlikes");
237241

238242
var d = new MongoRepository<Dog>();
239243
var dm = new MongoRepositoryManager<Dog>();
@@ -243,6 +247,7 @@ public void CollectionNamesTest()
243247
Assert.IsTrue(dm.Exists);
244248
Assert.IsInstanceOfType(d.GetById(vd.Id), typeof(Dog));
245249
Assert.AreEqual(dm.Name, "AnimalsTest");
250+
Assert.AreEqual(d.CollectionName, "AnimalsTest");
246251

247252
var m = new MongoRepository<Bird>();
248253
var mm = new MongoRepositoryManager<Bird>();
@@ -252,6 +257,7 @@ public void CollectionNamesTest()
252257
Assert.IsTrue(mm.Exists);
253258
Assert.IsInstanceOfType(m.GetById(vm.Id), typeof(Macaw));
254259
Assert.AreEqual(mm.Name, "Birds");
260+
Assert.AreEqual(m.CollectionName, "Birds");
255261

256262
var w = new MongoRepository<Whale>();
257263
var wm = new MongoRepositoryManager<Whale>();
@@ -261,7 +267,7 @@ public void CollectionNamesTest()
261267
Assert.IsTrue(wm.Exists);
262268
Assert.IsInstanceOfType(w.GetById(vw.Id), typeof(Whale));
263269
Assert.AreEqual(wm.Name, "Whale");
264-
270+
Assert.AreEqual(w.CollectionName, "Whale");
265271
}
266272

267273
[TestMethod]
@@ -287,6 +293,7 @@ public void CustomIDTest()
287293

288294
Assert.IsTrue(ym.Exists);
289295
Assert.AreEqual(ym.Name, "MyTestCollection");
296+
Assert.AreEqual(y.CollectionName, "MyTestCollection");
290297
Assert.IsInstanceOfType(y.GetById("xyz"), typeof(CustomIDEntityCustomCollection));
291298

292299
y.Delete("xyz");
@@ -314,6 +321,7 @@ public void OverrideCollectionName()
314321
_customerRepo.Add(new Customer() { FirstName = "Test" });
315322
Assert.IsTrue(_customerRepo.Single().FirstName.Equals("Test"));
316323
Assert.AreEqual("TestCustomers123", _customerRepo.Collection.Name);
324+
Assert.AreEqual("TestCustomers123", ((MongoRepository<Customer>)_customerRepo).CollectionName);
317325

318326
IRepositoryManager<Customer> _curstomerRepoManager = new MongoRepositoryManager<Customer>("mongodb://localhost/MongoRepositoryTests", "TestCustomers123");
319327
Assert.AreEqual("TestCustomers123", _curstomerRepoManager.Name);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="mongocsharpdriver" version="1.9.0" targetFramework="net40" />
3+
<package id="mongocsharpdriver" version="1.9.1" targetFramework="net40" />
44
</packages>

0 commit comments

Comments
 (0)