Skip to content

Commit

Permalink
* Added back IRepository<T> and IRepositoryManager<T> interfaces to r…
Browse files Browse the repository at this point in the history
…estore backward compatibility

* Added buildfile for nuget packages
  • Loading branch information
RobThree committed Oct 25, 2013
1 parent ccb128a commit 624956c
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 15 deletions.
2 changes: 1 addition & 1 deletion MongoRepository/dev/Help/MongoRepository.shfbproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
<HelpFileVersion>1.6.0.0</HelpFileVersion>
<HelpFileVersion>1.6.1.0</HelpFileVersion>
<BuildAssemblerVerbosity>OnlyWarningsAndErrors</BuildAssemblerVerbosity>
<HelpFileFormat>HtmlHelp1</HelpFileFormat>
<IndentHtml>False</IndentHtml>
Expand Down
3 changes: 2 additions & 1 deletion MongoRepository/dev/MongoRepository.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>MongoRepository</id>
<version>1.6.0</version>
<version>1.6.1</version>
<authors>tgeek, RobIII</authors>
<owners>tgeek</owners>
<licenseUrl>http://mongorepository.codeplex.com/license</licenseUrl>
Expand All @@ -15,6 +15,7 @@
Updated to MongoCSharp driver 1.8.3.9 (discussion 461602),
Added constructor parameters to override collectionnames (discussion 456452),
IEntity&lt;T&gt; support (discussion 454482)
Hotfix for 1.6.0: Added back IRepository&lt;T&gt; and IRepositoryManager&lt;T&gt; interfaces to restore backward compatibility
</releaseNotes>
<summary>
Provides a repository pattern on top of 10gen's MongoDB C# driver.
Expand Down
5 changes: 4 additions & 1 deletion MongoRepository/dev/MongoRepository.sln
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MongoRepository", "MongoRepository\MongoRepository.csproj", "{E2C4A7F9-4B14-46CB-BFCE-AFABFACB3390}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MongoRepositoryTests", "MongoRepositoryTests\MongoRepositoryTests.csproj", "{7C8276C3-819A-4EA1-BFDA-64C3760B0037}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D62DDBAF-08C6-4130-890A-888910785B65}"
ProjectSection(SolutionItems) = preProject
buildnugetpackage.cmd = buildnugetpackage.cmd
MongoRepository.nuspec = MongoRepository.nuspec
Help\MongoRepository.shfbproj = Help\MongoRepository.shfbproj
mongorepositorylogo.png = mongorepositorylogo.png
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("7e3d1784-b1f3-4b33-a303-7facc780917e")]

[assembly: AssemblyVersion("1.6.0.0")]
[assembly: AssemblyFileVersion("1.6.0.0")]
[assembly: AssemblyVersion("1.6.1.0")]
[assembly: AssemblyFileVersion("1.6.1.0")]
7 changes: 7 additions & 0 deletions MongoRepository/dev/MongoRepository/Repository/IRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,11 @@ public interface IRepository<T, TKey> : IQueryable<T>
void RequestDone();
}

/// <summary>
/// IRepository definition.
/// </summary>
/// <typeparam name="T">The type contained in the repository.</typeparam>
/// <remarks>Entities are assumed to use strings for Id's.</remarks>
public interface IRepository<T> : IQueryable<T>, IRepository<T, string>
where T : IEntity<string> { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public IQueryProvider Provider
/// </summary>
/// <typeparam name="T">The type contained in the repository.</typeparam>
/// <remarks>Entities are assumed to use strings for Id's.</remarks>
public class MongoRepository<T> : MongoRepository<T, string>, IRepository<T, string>
public class MongoRepository<T> : MongoRepository<T, string>, IRepository<T>
where T : IEntity<string>
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/// </summary>
/// <typeparam name="T">The type contained in the repository to manage.</typeparam>
/// <typeparam name="TKey">The type used for the entity's Id.</typeparam>
public interface IRepositoryManager<T, TKey>
public interface IRepositoryManager<T, TKey>
where T : IEntity<TKey>
{
/// <summary>
Expand Down Expand Up @@ -159,4 +159,11 @@ public interface IRepositoryManager<T, TKey>
GetIndexesResult GetIndexes();
}

/// <summary>
/// IRepositoryManager definition.
/// </summary>
/// <typeparam name="T">The type contained in the repository to manage.</typeparam>
/// <remarks>Entities are assumed to use strings for Id's.</remarks>
public interface IRepositoryManager<T> : IRepositoryManager<T, string>
where T : IEntity<string> { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ public GetIndexesResult GetIndexes()
/// </summary>
/// <typeparam name="T">The type contained in the repository to manage.</typeparam>
/// <remarks>Entities are assumed to use strings for Id's.</remarks>
public class MongoRepositoryManager<T> : MongoRepositoryManager<T, string>, IRepositoryManager<T, string>
public class MongoRepositoryManager<T> : MongoRepositoryManager<T, string>, IRepositoryManager<T>
where T : IEntity<string>
{
/// <summary>
Expand Down
14 changes: 7 additions & 7 deletions MongoRepository/dev/MongoRepositoryTests/RepoTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ private void DropDB()
[TestMethod]
public void AddAndUpdateTest()
{
IRepository<Customer, string> _customerRepo = new MongoRepository<Customer>();
IRepositoryManager<Customer, string> _customerMan = new MongoRepositoryManager<Customer>();
IRepository<Customer> _customerRepo = new MongoRepository<Customer>();
IRepositoryManager<Customer> _customerMan = new MongoRepositoryManager<Customer>();

Assert.IsFalse(_customerMan.Exists);

Expand Down Expand Up @@ -87,8 +87,8 @@ public void AddAndUpdateTest()
[TestMethod]
public void ComplexEntityTest()
{
IRepository<Customer, string> _customerRepo = new MongoRepository<Customer>();
IRepository<Product, string> _productRepo = new MongoRepository<Product>();
IRepository<Customer> _customerRepo = new MongoRepository<Customer>();
IRepository<Product> _productRepo = new MongoRepository<Product>();

var customer = new Customer();
customer.FirstName = "Erik";
Expand Down Expand Up @@ -142,7 +142,7 @@ public void ComplexEntityTest()
[TestMethod]
public void BatchTest()
{
IRepository<Customer, string> _customerRepo = new MongoRepository<Customer>();
IRepository<Customer> _customerRepo = new MongoRepository<Customer>();

var custlist = new List<Customer>(new Customer[] {
new Customer() { FirstName = "Customer A" },
Expand Down Expand Up @@ -310,12 +310,12 @@ public void CustomIDTypeTest()
[TestMethod]
public void OverrideCollectionName()
{
IRepository<Customer, string> _customerRepo = new MongoRepository<Customer>("mongodb://localhost/MongoRepositoryTests", "TestCustomers123");
IRepository<Customer> _customerRepo = new MongoRepository<Customer>("mongodb://localhost/MongoRepositoryTests", "TestCustomers123");
_customerRepo.Add(new Customer() { FirstName = "Test" });
Assert.IsTrue(_customerRepo.Single().FirstName.Equals("Test"));
Assert.AreEqual("TestCustomers123", _customerRepo.Collection.Name);

IRepositoryManager<Customer, string> _curstomerRepoManager = new MongoRepositoryManager<Customer>("mongodb://localhost/MongoRepositoryTests", "TestCustomers123");
IRepositoryManager<Customer> _curstomerRepoManager = new MongoRepositoryManager<Customer>("mongodb://localhost/MongoRepositoryTests", "TestCustomers123");
Assert.AreEqual("TestCustomers123", _curstomerRepoManager.Name);
}
}
Expand Down
1 change: 1 addition & 0 deletions MongoRepository/dev/buildnugetpackage.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.nuget\nuget pack MongoRepository.nuspec

0 comments on commit 624956c

Please sign in to comment.