Skip to content

Commit 5f27ea7

Browse files
author
Jeff Treuting
committed
Merged master into AOP
1 parent ed87e59 commit 5f27ea7

463 files changed

Lines changed: 791867 additions & 30061 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,14 @@ How do I get started?
1313
Check out the [getting started guide](https://github.com/SharpRepository/SharpRepository/wiki/Getting-started). When you're done there, review the SharpRepository.Samples, SharpRepository.Tests.Integration and SharpRepository.Tests
1414
project for additional sample usage and implementation details.
1515

16+
Important EntityFramework Notice
17+
--------------------------------
18+
Please use SharpRepository.EfRepository moving forward instead of Ef5Repository. Both will work with EF5 and EF6 but the naming was confusing once EF6 was released so we basically renamed the package. All updates will be made to EfRepository moving forward.
19+
20+
Have Questions?
21+
--------------------------------
22+
Please use the google group for SharpRepository:
23+
24+
* https://groups.google.com/d/forum/sharprepository
1625

1726

SharpRepository.Benchmarks.Configuration/SharpRepository.Benchmarks.Configuration.csproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@
5959
<Project>{06111314-669B-4E35-A0B9-AF67FA3F0FFD}</Project>
6060
<Name>SharpRepository.Caching.Memcached</Name>
6161
</ProjectReference>
62-
<ProjectReference Include="..\SharpRepository.Ef5Repository\SharpRepository.Ef5Repository.csproj">
63-
<Project>{7ACC7E0F-2EB9-45E1-8841-A00A40BCF0B5}</Project>
64-
<Name>SharpRepository.Ef5Repository</Name>
65-
</ProjectReference>
6662
<ProjectReference Include="..\SharpRepository.InMemoryRepository\SharpRepository.InMemoryRepository.csproj">
6763
<Project>{13ad3fca-4c9d-4674-b786-f30843638d3b}</Project>
6864
<Name>SharpRepository.InMemoryRepository</Name>

SharpRepository.CacheRepository/CacheConfigRepositoryFactory.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ public CacheConfigRepositoryFactory(IRepositoryConfiguration config)
1010
{
1111
}
1212

13+
public override IRepository<T> GetInstance<T>()
14+
{
15+
return new CacheRepository<T>(RepositoryConfiguration["prefix"]);
16+
}
17+
1318
public override IRepository<T, TKey> GetInstance<T, TKey>()
1419
{
1520
return new CacheRepository<T, TKey>(RepositoryConfiguration["prefix"]);

SharpRepository.Caching.Redis/SharpRepository.Caching.Redis.csproj

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,21 @@
3131
<WarningLevel>4</WarningLevel>
3232
</PropertyGroup>
3333
<ItemGroup>
34-
<Reference Include="ServiceStack.Common">
35-
<HintPath>..\packages\ServiceStack.Common.3.9.21\lib\net35\ServiceStack.Common.dll</HintPath>
34+
<Reference Include="ServiceStack.Common, Version=3.9.64.0, Culture=neutral, processorArchitecture=MSIL">
35+
<SpecificVersion>False</SpecificVersion>
36+
<HintPath>..\packages\ServiceStack.Common.3.9.64\lib\net35\ServiceStack.Common.dll</HintPath>
3637
</Reference>
37-
<Reference Include="ServiceStack.Interfaces">
38-
<HintPath>..\packages\ServiceStack.Common.3.9.21\lib\net35\ServiceStack.Interfaces.dll</HintPath>
38+
<Reference Include="ServiceStack.Interfaces, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
39+
<SpecificVersion>False</SpecificVersion>
40+
<HintPath>..\packages\ServiceStack.Common.3.9.64\lib\net35\ServiceStack.Interfaces.dll</HintPath>
3941
</Reference>
40-
<Reference Include="ServiceStack.Redis">
41-
<HintPath>..\packages\ServiceStack.Redis.3.9.14\lib\net35\ServiceStack.Redis.dll</HintPath>
42+
<Reference Include="ServiceStack.Redis, Version=3.9.64.0, Culture=neutral, processorArchitecture=MSIL">
43+
<SpecificVersion>False</SpecificVersion>
44+
<HintPath>..\packages\ServiceStack.Redis.3.9.64\lib\net35\ServiceStack.Redis.dll</HintPath>
4245
</Reference>
43-
<Reference Include="ServiceStack.Text">
44-
<HintPath>..\packages\ServiceStack.Text.3.9.21\lib\net35\ServiceStack.Text.dll</HintPath>
46+
<Reference Include="ServiceStack.Text, Version=3.9.65.0, Culture=neutral, processorArchitecture=MSIL">
47+
<SpecificVersion>False</SpecificVersion>
48+
<HintPath>..\packages\ServiceStack.Text.3.9.64\lib\net35\ServiceStack.Text.dll</HintPath>
4549
</Reference>
4650
<Reference Include="System" />
4751
<Reference Include="System.Configuration" />
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="ServiceStack.Common" version="3.9.21" targetFramework="net45" />
4-
<package id="ServiceStack.Redis" version="3.9.14" targetFramework="net45" />
5-
<package id="ServiceStack.Text" version="3.9.21" targetFramework="net45" />
3+
<package id="ServiceStack.Common" version="3.9.64" targetFramework="net40" />
4+
<package id="ServiceStack.Redis" version="3.9.64" targetFramework="net40" />
5+
<package id="ServiceStack.Text" version="3.9.64" targetFramework="net40" />
66
</packages>

SharpRepository.CouchDbRepository/CouchDbRepositoryBase.cs

Lines changed: 205 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
using System;
22
using System.Linq;
3+
using System.Linq.Expressions;
34
using SharpRepository.CouchDbRepository.Linq;
45
using SharpRepository.Repository;
56
using SharpRepository.Repository.FetchStrategies;
7+
using SharpRepository.Repository.Queries;
8+
using SharpRepository.Repository.Specifications;
69

710
namespace SharpRepository.CouchDbRepository
811
{
@@ -46,7 +49,6 @@ internal CouchDbRepositoryBase(string host, int port, string database = null, st
4649
protected override IQueryable<T> BaseQuery(IFetchStrategy<T> fetchStrategy = null)
4750
{
4851
return CouchDbQueryFactory.Queryable<T>(_serverUrl, _database);
49-
//return Client.GetAllDocuments().AsQueryable();
5052
}
5153

5254
// we override the implementation of LinqBaseRepository because this is built in
@@ -64,6 +66,208 @@ protected override T GetQuery(string key)
6466
return id == null ? null : item;
6567
}
6668

69+
public override TResult Min<TResult>(ISpecification<T> criteria, Expression<Func<T, TResult>> selector)
70+
{
71+
var pagingOptions = new PagingOptions<T, TResult>(1, 1, selector);
72+
73+
return QueryManager.ExecuteMin(
74+
() => FindAll(criteria, selector, pagingOptions).ToList().First(),
75+
selector,
76+
criteria
77+
);
78+
}
79+
80+
public override TResult Max<TResult>(ISpecification<T> criteria, Expression<Func<T, TResult>> selector)
81+
{
82+
var pagingOptions = new PagingOptions<T, TResult>(1, 1, selector, isDescending: true);
83+
84+
return QueryManager.ExecuteMin(
85+
() => FindAll(criteria, selector, pagingOptions).ToList().First(),
86+
selector,
87+
criteria
88+
);
89+
}
90+
91+
public override int Sum(ISpecification<T> criteria, Expression<Func<T, int>> selector)
92+
{
93+
return QueryManager.ExecuteSum(
94+
() => FindAll(criteria, selector).ToList().Sum(),
95+
selector,
96+
criteria
97+
);
98+
}
99+
100+
public override decimal? Sum(ISpecification<T> criteria, Expression<Func<T, decimal?>> selector)
101+
{
102+
return QueryManager.ExecuteSum(
103+
() => FindAll(criteria, selector).ToList().Sum(),
104+
selector,
105+
criteria
106+
);
107+
}
108+
109+
public override decimal Sum(ISpecification<T> criteria, Expression<Func<T, decimal>> selector)
110+
{
111+
return QueryManager.ExecuteSum(
112+
() => FindAll(criteria, selector).ToList().Sum(),
113+
selector,
114+
criteria
115+
);
116+
}
117+
118+
public override double? Sum(ISpecification<T> criteria, Expression<Func<T, double?>> selector)
119+
{
120+
return QueryManager.ExecuteSum(
121+
() => FindAll(criteria, selector).ToList().Sum(),
122+
selector,
123+
criteria
124+
);
125+
}
126+
127+
public override double Sum(ISpecification<T> criteria, Expression<Func<T, double>> selector)
128+
{
129+
return QueryManager.ExecuteSum(
130+
() => FindAll(criteria, selector).ToList().Sum(),
131+
selector,
132+
criteria
133+
);
134+
}
135+
136+
public override float? Sum(ISpecification<T> criteria, Expression<Func<T, float?>> selector)
137+
{
138+
return QueryManager.ExecuteSum(
139+
() => FindAll(criteria, selector).ToList().Sum(),
140+
selector,
141+
criteria
142+
);
143+
}
144+
145+
public override float Sum(ISpecification<T> criteria, Expression<Func<T, float>> selector)
146+
{
147+
return QueryManager.ExecuteSum(
148+
() => FindAll(criteria, selector).ToList().Sum(),
149+
selector,
150+
criteria
151+
);
152+
}
153+
154+
public override int? Sum(ISpecification<T> criteria, Expression<Func<T, int?>> selector)
155+
{
156+
return QueryManager.ExecuteSum(
157+
() => FindAll(criteria, selector).ToList().Sum(),
158+
selector,
159+
criteria
160+
);
161+
}
162+
163+
public override long? Sum(ISpecification<T> criteria, Expression<Func<T, long?>> selector)
164+
{
165+
return QueryManager.ExecuteSum(
166+
() => FindAll(criteria, selector).ToList().Sum(),
167+
selector,
168+
criteria
169+
);
170+
}
171+
172+
public override long Sum(ISpecification<T> criteria, Expression<Func<T, long>> selector)
173+
{
174+
return QueryManager.ExecuteSum(
175+
() => FindAll(criteria, selector).ToList().Sum(),
176+
selector,
177+
criteria
178+
);
179+
}
180+
181+
public override double Average(ISpecification<T> criteria, Expression<Func<T, int>> selector)
182+
{
183+
return QueryManager.ExecuteAverage(
184+
() => FindAll(criteria, selector).ToList().Average(),
185+
selector,
186+
criteria
187+
);
188+
}
189+
190+
public override decimal? Average(ISpecification<T> criteria, Expression<Func<T, decimal?>> selector)
191+
{
192+
return QueryManager.ExecuteAverage(
193+
() => FindAll(criteria, selector).ToList().Average(),
194+
selector,
195+
criteria
196+
);
197+
}
198+
199+
public override decimal Average(ISpecification<T> criteria, Expression<Func<T, decimal>> selector)
200+
{
201+
return QueryManager.ExecuteAverage(
202+
() => FindAll(criteria, selector).ToList().Average(),
203+
selector,
204+
criteria
205+
);
206+
}
207+
208+
public override double? Average(ISpecification<T> criteria, Expression<Func<T, double?>> selector)
209+
{
210+
return QueryManager.ExecuteAverage(
211+
() => FindAll(criteria, selector).ToList().Average(),
212+
selector,
213+
criteria
214+
);
215+
}
216+
217+
public override double Average(ISpecification<T> criteria, Expression<Func<T, double>> selector)
218+
{
219+
return QueryManager.ExecuteAverage(
220+
() => FindAll(criteria, selector).ToList().Average(),
221+
selector,
222+
criteria
223+
);
224+
}
225+
226+
public override float? Average(ISpecification<T> criteria, Expression<Func<T, float?>> selector)
227+
{
228+
return QueryManager.ExecuteAverage(
229+
() => FindAll(criteria, selector).ToList().Average(),
230+
selector,
231+
criteria
232+
);
233+
}
234+
235+
public override float Average(ISpecification<T> criteria, Expression<Func<T, float>> selector)
236+
{
237+
return QueryManager.ExecuteAverage(
238+
() => FindAll(criteria, selector).ToList().Average(),
239+
selector,
240+
criteria
241+
);
242+
}
243+
244+
public override double? Average(ISpecification<T> criteria, Expression<Func<T, int?>> selector)
245+
{
246+
return QueryManager.ExecuteAverage(
247+
() => FindAll(criteria, selector).ToList().Average(),
248+
selector,
249+
criteria
250+
);
251+
}
252+
253+
public override double? Average(ISpecification<T> criteria, Expression<Func<T, long?>> selector)
254+
{
255+
return QueryManager.ExecuteAverage(
256+
() => FindAll(criteria, selector).ToList().Average(),
257+
selector,
258+
criteria
259+
);
260+
}
261+
262+
public override double Average(ISpecification<T> criteria, Expression<Func<T, long>> selector)
263+
{
264+
return QueryManager.ExecuteAverage(
265+
() => FindAll(criteria, selector).ToList().Average(),
266+
selector,
267+
criteria
268+
);
269+
}
270+
67271
protected override void AddItem(T entity)
68272
{
69273
string id;

SharpRepository.Db4oRepository/Db4oConfigRepositoryFactory.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ public Db4oConfigRepositoryFactory(IRepositoryConfiguration config)
1212
{
1313
}
1414

15+
public override IRepository<T> GetInstance<T>()
16+
{
17+
throw new NotImplementedException("Db4oRepository does not support using IRepository<T> directly to reference a IRepository<T, string>");
18+
}
19+
1520
public override IRepository<T, TKey> GetInstance<T, TKey>()
1621
{
1722
// check for required parameters

0 commit comments

Comments
 (0)