Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c082ae6

Browse filesBrowse files
committed
Resolved all compile errors in the core project.
1 parent 8c1f9aa commit c082ae6
Copy full SHA for c082ae6
Expand file treeCollapse file tree

21 files changed

+217
-91
lines changed
Open diff view settings
Collapse file

‎SharpRepository.Repository/Caching/Hash/LocalCollectionExpander.cs‎

Copy file name to clipboardExpand all lines: SharpRepository.Repository/Caching/Hash/LocalCollectionExpander.cs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected override Expression VisitMethodCall(MethodCallExpression node)
3939
let elementType = x.Param.GetGenericArguments().Single()
4040
let printer = MakePrinter((ConstantExpression)x.Arg, elementType)
4141
select new { x.Arg, Replacement = printer }).ToList();
42-
#elif NETSTANDARD1_4
42+
#elif NETSTANDARD1_6
4343
var replacements = (from x in map
4444
where x.Param != null && x.Param.GetType().GetTypeInfo().IsGenericType
4545
let g = x.Param.GetGenericTypeDefinition()
Collapse file

‎SharpRepository.Repository/Caching/StandardCachingStrategyBase.cs‎

Copy file name to clipboardExpand all lines: SharpRepository.Repository/Caching/StandardCachingStrategyBase.cs
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,11 @@ public bool TryPartitionValue(T entity, out TPartition value)
168168

169169
// use the partition name (which is a property) and reflection to get the value
170170
var type = typeof(T);
171+
#if NET451
171172
var propInfo = type.GetProperty(partitionName, typeof(TPartition));
173+
#elif NETSTANDARD1_6
174+
var propInfo = type.GetTypeInfo().DeclaredProperties.FirstOrDefault(p => p.Name == partitionName && p.PropertyType == typeof(TPartition));
175+
#endif
172176

173177
if (propInfo == null)
174178
return false;
Collapse file

‎SharpRepository.Repository/Caching/StandardCompoundKeyCachingStrategyBase.cs‎

Copy file name to clipboardExpand all lines: SharpRepository.Repository/Caching/StandardCompoundKeyCachingStrategyBase.cs
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ public bool TryPartitionValue(T entity, out TPartition value)
169169
var type = typeof(T);
170170
#if NET451
171171
var propInfo = type.GetProperty(partitionName, typeof(TPartition));
172-
#elif NETSTANDARD1_4
172+
#elif NETSTANDARD1_6
173173
var propInfo = type.GetRuntimeProperties().Where(p => p.Name == partitionName && p.PropertyType == typeof(TPartition)).FirstOrDefault();
174174
#endif
175175

@@ -538,7 +538,7 @@ public bool TryPartitionValue(T entity, out TPartition value)
538538
var type = typeof(T);
539539
#if NET451
540540
var propInfo = type.GetProperty(partitionName, typeof(TPartition));
541-
#elif NETSTANDARD1_4
541+
#elif NETSTANDARD1_6
542542
var propInfo = type.GetRuntimeProperties().Where(p => p.Name == partitionName && p.PropertyType == typeof(TPartition)).FirstOrDefault();
543543
#endif
544544

@@ -907,7 +907,7 @@ public bool TryPartitionValue(T entity, out TPartition value)
907907
var type = typeof(T);
908908
#if NET451
909909
var propInfo = type.GetProperty(partitionName, typeof(TPartition));
910-
#elif NETSTANDARD1_4
910+
#elif NETSTANDARD1_6
911911
var propInfo = type.GetRuntimeProperties().Where(p => p.Name == partitionName && p.PropertyType == typeof(TPartition)).FirstOrDefault();
912912
#endif
913913

Collapse file

‎SharpRepository.Repository/CompoundKeyRepositoryBase.cs‎

Copy file name to clipboardExpand all lines: SharpRepository.Repository/CompoundKeyRepositoryBase.cs
+42-16Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,10 @@ public IEnumerable<TResult> GetAll<TResult>(Expression<Func<T, TResult>> selecto
136136
public IEnumerable<TResult> GetAll<TResult>(Expression<Func<T, TResult>> selector, IQueryOptions<T> queryOptions, IFetchStrategy<T> fetchStrategy)
137137
{
138138
if (selector == null) throw new ArgumentNullException("selector");
139+
var selectFunc = selector.Compile();
139140

140141
return _queryManager.ExecuteGetAll(
141-
() => GetAllQuery(queryOptions, fetchStrategy).Select(selector).ToList(),
142+
() => GetAllQuery(queryOptions, fetchStrategy).Select(selectFunc).ToList(),
142143
selector,
143144
queryOptions
144145
);
@@ -173,6 +174,7 @@ public T Get(params object[] keys)
173174
public TResult Get<TResult>(Expression<Func<T, TResult>> selector, params object[] keys)
174175
{
175176
if (selector == null) throw new ArgumentNullException("selector");
177+
var selectFunc = selector.Compile();
176178

177179
return _queryManager.ExecuteGet(
178180
() =>
@@ -182,7 +184,7 @@ public TResult Get<TResult>(Expression<Func<T, TResult>> selector, params object
182184
return default(TResult);
183185

184186
var results = new[] { result };
185-
return results.AsQueryable().Select(selector).First();
187+
return results.AsEnumerable().Select(selectFunc).First();
186188
},
187189
selector,
188190
keys
@@ -229,9 +231,10 @@ public IEnumerable<T> FindAll(ISpecification<T> criteria, IQueryOptions<T> query
229231
public IEnumerable<TResult> FindAll<TResult>(ISpecification<T> criteria, Expression<Func<T, TResult>> selector, IQueryOptions<T> queryOptions = null)
230232
{
231233
if (criteria == null) throw new ArgumentNullException("criteria");
234+
var selectFunc = selector.Compile();
232235

233236
return _queryManager.ExecuteFindAll(
234-
() => FindAllQuery(criteria, queryOptions).Select(selector).ToList(),
237+
() => FindAllQuery(criteria, queryOptions).Select(selectFunc).ToList(),
235238
criteria,
236239
selector,
237240
queryOptions
@@ -273,6 +276,7 @@ public TResult Find<TResult>(ISpecification<T> criteria, Expression<Func<T, TRes
273276
{
274277
if (criteria == null) throw new ArgumentNullException("criteria");
275278
if (selector == null) throw new ArgumentNullException("selector");
279+
var selectFunc = selector.Compile();
276280

277281
return _queryManager.ExecuteFind(
278282
() =>
@@ -282,7 +286,7 @@ public TResult Find<TResult>(ISpecification<T> criteria, Expression<Func<T, TRes
282286
return default(TResult);
283287

284288
var results = new[] { result };
285-
return results.AsQueryable().Select(selector).First();
289+
return results.AsEnumerable().Select(selectFunc).First();
286290
},
287291
criteria,
288292
selector,
@@ -586,8 +590,13 @@ protected virtual ISpecification<T> ByPrimaryKeySpecification(object[] keys)
586590
protected virtual PropertyInfo[] GetPrimaryKeyPropertyInfo()
587591
{
588592
var type = typeof(T);
593+
#if NET451
594+
var properties = type.GetProperties();
595+
#elif NETSTANDARD1_6
596+
var properties = type.GetTypeInfo().DeclaredProperties;
597+
#endif
589598

590-
return type.GetProperties().Where(x => x.HasAttribute<RepositoryPrimaryKeyAttribute>()).OrderBy(x => x.GetOneAttribute<RepositoryPrimaryKeyAttribute>().Order).ToArray();
599+
return properties.Where(x => x.HasAttribute<RepositoryPrimaryKeyAttribute>()).OrderBy(x => x.GetOneAttribute<RepositoryPrimaryKeyAttribute>().Order).ToArray();
591600
}
592601
}
593602

@@ -720,9 +729,10 @@ public IEnumerable<TResult> GetAll<TResult>(Expression<Func<T, TResult>> selecto
720729
public IEnumerable<TResult> GetAll<TResult>(Expression<Func<T, TResult>> selector, IQueryOptions<T> queryOptions, IFetchStrategy<T> fetchStrategy)
721730
{
722731
if (selector == null) throw new ArgumentNullException("selector");
732+
var selectFunc = selector.Compile();
723733

724734
return _queryManager.ExecuteGetAll(
725-
() => GetAllQuery(queryOptions, fetchStrategy).Select(selector).ToList(),
735+
() => GetAllQuery(queryOptions, fetchStrategy).Select(selectFunc).ToList(),
726736
selector,
727737
queryOptions
728738
);
@@ -758,6 +768,7 @@ public T Get(TKey key, TKey2 key2)
758768
public TResult Get<TResult>(TKey key, TKey2 key2, Expression<Func<T, TResult>> selector)
759769
{
760770
if (selector == null) throw new ArgumentNullException("selector");
771+
var selectFunc = selector.Compile();
761772

762773
return _queryManager.ExecuteGet(
763774
() =>
@@ -767,7 +778,7 @@ public TResult Get<TResult>(TKey key, TKey2 key2, Expression<Func<T, TResult>> s
767778
return default(TResult);
768779

769780
var results = new[] { result };
770-
return results.AsQueryable().Select(selector).First();
781+
return results.AsEnumerable().Select(selectFunc).First();
771782
},
772783
selector,
773784
key,
@@ -830,9 +841,10 @@ public IEnumerable<T> FindAll(ISpecification<T> criteria, IQueryOptions<T> query
830841
public IEnumerable<TResult> FindAll<TResult>(ISpecification<T> criteria, Expression<Func<T, TResult>> selector, IQueryOptions<T> queryOptions = null)
831842
{
832843
if (criteria == null) throw new ArgumentNullException("criteria");
844+
var selectFunc = selector.Compile();
833845

834846
return _queryManager.ExecuteFindAll(
835-
() => FindAllQuery(criteria, queryOptions).Select(selector).ToList(),
847+
() => FindAllQuery(criteria, queryOptions).Select(selectFunc).ToList(),
836848
criteria,
837849
selector,
838850
queryOptions
@@ -874,6 +886,7 @@ public TResult Find<TResult>(ISpecification<T> criteria, Expression<Func<T, TRes
874886
{
875887
if (criteria == null) throw new ArgumentNullException("criteria");
876888
if (selector == null) throw new ArgumentNullException("selector");
889+
var selectFunc = selector.Compile();
877890

878891
return _queryManager.ExecuteFind(
879892
() =>
@@ -883,7 +896,7 @@ public TResult Find<TResult>(ISpecification<T> criteria, Expression<Func<T, TRes
883896
return default(TResult);
884897

885898
var results = new[] { result };
886-
return results.AsQueryable().Select(selector).First();
899+
return results.AsEnumerable().Select(selectFunc).First();
887900
},
888901
criteria,
889902
selector,
@@ -1188,8 +1201,13 @@ protected virtual ISpecification<T> ByPrimaryKeySpecification(TKey key, TKey2 ke
11881201
protected virtual PropertyInfo[] GetPrimaryKeyPropertyInfo()
11891202
{
11901203
var type = typeof(T);
1204+
#if NET451
1205+
var properties = type.GetProperties();
1206+
#elif NETSTANDARD1_6
1207+
var properties = type.GetTypeInfo().DeclaredProperties;
1208+
#endif
11911209

1192-
return type.GetProperties().Where(x => x.HasAttribute<RepositoryPrimaryKeyAttribute>()).OrderBy(x => x.GetOneAttribute<RepositoryPrimaryKeyAttribute>().Order).ToArray();
1210+
return properties.Where(x => x.HasAttribute<RepositoryPrimaryKeyAttribute>()).OrderBy(x => x.GetOneAttribute<RepositoryPrimaryKeyAttribute>().Order).ToArray();
11931211
}
11941212
}
11951213

@@ -1322,9 +1340,10 @@ public IEnumerable<TResult> GetAll<TResult>(Expression<Func<T, TResult>> selecto
13221340
public IEnumerable<TResult> GetAll<TResult>(Expression<Func<T, TResult>> selector, IQueryOptions<T> queryOptions, IFetchStrategy<T> fetchStrategy)
13231341
{
13241342
if (selector == null) throw new ArgumentNullException("selector");
1343+
var selectFunc = selector.Compile();
13251344

13261345
return _queryManager.ExecuteGetAll(
1327-
() => GetAllQuery(queryOptions, fetchStrategy).Select(selector).ToList(),
1346+
() => GetAllQuery(queryOptions, fetchStrategy).Select(selectFunc).ToList(),
13281347
selector,
13291348
queryOptions
13301349
);
@@ -1361,6 +1380,7 @@ public T Get(TKey key, TKey2 key2, TKey3 key3)
13611380
public TResult Get<TResult>(TKey key, TKey2 key2, TKey3 key3, Expression<Func<T, TResult>> selector)
13621381
{
13631382
if (selector == null) throw new ArgumentNullException("selector");
1383+
var selectFunc = selector.Compile();
13641384

13651385
return _queryManager.ExecuteGet(
13661386
() =>
@@ -1370,7 +1390,7 @@ public TResult Get<TResult>(TKey key, TKey2 key2, TKey3 key3, Expression<Func<T,
13701390
return default(TResult);
13711391

13721392
var results = new[] { result };
1373-
return results.AsQueryable().Select(selector).First();
1393+
return results.AsEnumerable().Select(selectFunc).First();
13741394
},
13751395
selector,
13761396
key,
@@ -1434,9 +1454,10 @@ public IEnumerable<T> FindAll(ISpecification<T> criteria, IQueryOptions<T> query
14341454
public IEnumerable<TResult> FindAll<TResult>(ISpecification<T> criteria, Expression<Func<T, TResult>> selector, IQueryOptions<T> queryOptions = null)
14351455
{
14361456
if (criteria == null) throw new ArgumentNullException("criteria");
1457+
var selectFunc = selector.Compile();
14371458

14381459
return _queryManager.ExecuteFindAll(
1439-
() => FindAllQuery(criteria, queryOptions).Select(selector).ToList(),
1460+
() => FindAllQuery(criteria, queryOptions).Select(selectFunc).ToList(),
14401461
criteria,
14411462
selector,
14421463
queryOptions
@@ -1478,6 +1499,7 @@ public TResult Find<TResult>(ISpecification<T> criteria, Expression<Func<T, TRes
14781499
{
14791500
if (criteria == null) throw new ArgumentNullException("criteria");
14801501
if (selector == null) throw new ArgumentNullException("selector");
1502+
var selectFunc = selector.Compile();
14811503

14821504
return _queryManager.ExecuteFind(
14831505
() =>
@@ -1487,7 +1509,7 @@ public TResult Find<TResult>(ISpecification<T> criteria, Expression<Func<T, TRes
14871509
return default(TResult);
14881510

14891511
var results = new[] { result };
1490-
return results.AsQueryable().Select(selector).First();
1512+
return results.AsEnumerable().Select(selectFunc).First();
14911513
},
14921514
criteria,
14931515
selector,
@@ -1805,8 +1827,12 @@ protected virtual ISpecification<T> ByPrimaryKeySpecification(TKey key, TKey2 ke
18051827
protected virtual PropertyInfo[] GetPrimaryKeyPropertyInfo()
18061828
{
18071829
var type = typeof(T);
1808-
1809-
return type.GetProperties().Where(x => x.HasAttribute<RepositoryPrimaryKeyAttribute>()).OrderBy(x => x.GetOneAttribute<RepositoryPrimaryKeyAttribute>().Order).ToArray();
1830+
#if NET451
1831+
var properties = type.GetProperties();
1832+
#elif NETSTANDARD1_6
1833+
var properties = type.GetTypeInfo().DeclaredProperties;
1834+
#endif
1835+
return properties.Where(x => x.HasAttribute<RepositoryPrimaryKeyAttribute>()).OrderBy(x => x.GetOneAttribute<RepositoryPrimaryKeyAttribute>().Order).ToArray();
18101836
}
18111837
}
18121838
}
Collapse file

‎SharpRepository.Repository/Configuration/CachingProviderCollection.cs‎

Copy file name to clipboardExpand all lines: SharpRepository.Repository/Configuration/CachingProviderCollection.cs
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Collections.Generic;
33
#if NET451
44
using System.Configuration;
5-
#elif NETSTANDARD1_4
5+
#elif NETSTANDARD1_6
66
using System.Collections.ObjectModel;
77
#endif
88
using System.Linq;
@@ -12,7 +12,7 @@ namespace SharpRepository.Repository.Configuration
1212
#if NET451
1313
[ConfigurationCollection(typeof(RepositoryElement), AddItemName = "cachingProvider", CollectionType = ConfigurationElementCollectionType.BasicMap)]
1414
public class CachingProviderCollection : ConfigurationElementCollection
15-
#elif NETSTANDARD1_4
15+
#elif NETSTANDARD1_6
1616
public class CachingProviderCollection : Collection<CachingProviderElement>
1717
#endif
1818
{
@@ -39,7 +39,7 @@ public string Default
3939
#if NET451
4040
get { return (string)base["default"]; }
4141
set { base["default"] = value; }
42-
#elif NETSTANDARD1_4
42+
#elif NETSTANDARD1_6
4343
get;
4444
set;
4545
#endif
Collapse file

‎SharpRepository.Repository/Configuration/CachingProviderElement.cs‎

Copy file name to clipboardExpand all lines: SharpRepository.Repository/Configuration/CachingProviderElement.cs
+7-7Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace SharpRepository.Repository.Configuration
1010
{
1111
#if NET451
1212
public class CachingProviderElement : ConfigurationElement, ICachingProviderConfiguration
13-
#elif NETSTANDARD1_4
13+
#elif NETSTANDARD1_6
1414
public class CachingProviderElement : ICachingProviderConfiguration
1515
#endif
1616
{
@@ -24,7 +24,7 @@ public string Name
2424
#if NET451
2525
get { return (string) base["name"]; }
2626
set { base["name"] = value; }
27-
#elif NETSTANDARD1_4
27+
#elif NETSTANDARD1_6
2828
get;
2929
set;
3030
#endif
@@ -35,22 +35,22 @@ public string Name
3535
/// </summary>
3636
#if NET451
3737
[ConfigurationProperty("factory", IsRequired = true), TypeConverter(typeof (TypeNameConverter))]
38-
#elif NETSTANDARD1_4
38+
#elif NETSTANDARD1_6
3939
private Type _factory;
4040
#endif
4141
public Type Factory
4242
{
4343
#if NET451
4444
get { return (Type) base["factory"]; }
45-
#elif NETSTANDARD1_4
45+
#elif NETSTANDARD1_6
4646
get { return _factory; }
4747
#endif
4848
set
4949
{
5050
ConfigurationHelper.CheckForInterface(value, typeof (IConfigCachingProviderFactory));
5151
#if NET451
5252
base["factory"] = value;
53-
#elif NETSTANDARD1_4
53+
#elif NETSTANDARD1_6
5454
_factory = value;
5555
#endif
5656
}
@@ -66,15 +66,15 @@ public ICachingProvider GetInstance()
6666

6767
#if NET451
6868
public new string this[string key]
69-
#elif NETSTANDARD1_4
69+
#elif NETSTANDARD1_6
7070
public string this[string key]
7171
#endif
7272
{
7373
get
7474
{
7575
return !_attributes.ContainsKey(key) ? null : _attributes[key];
7676
}
77-
#if NETSTANDARD1_4
77+
#if NETSTANDARD1_6
7878
private set
7979
{
8080
_attributes[key] = value;
Collapse file

‎SharpRepository.Repository/Configuration/CachingStrategyCollection.cs‎

Copy file name to clipboardExpand all lines: SharpRepository.Repository/Configuration/CachingStrategyCollection.cs
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
using System.Collections.Generic;
33
#if NET451
44
using System.Configuration;
5-
#elif NETSTANDARD1_4
5+
#elif NETSTANDARD1_6
66
using System.Collections.ObjectModel;
77
#endif
88
using System.Linq;
@@ -12,7 +12,7 @@ namespace SharpRepository.Repository.Configuration
1212
#if NET451
1313
[ConfigurationCollection(typeof(RepositoryElement), AddItemName = "cachingStrategy", CollectionType = ConfigurationElementCollectionType.BasicMap)]
1414
public class CachingStrategyCollection : ConfigurationElementCollection
15-
#elif NETSTANDARD1_4
15+
#elif NETSTANDARD1_6
1616
public class CachingStrategyCollection : Collection<CachingStrategyElement>
1717
#endif
1818
{
@@ -39,7 +39,7 @@ public string Default
3939
#if NET451
4040
get { return (string)base["default"]; }
4141
set { base["default"] = value; }
42-
#elif NETSTANDARD1_4
42+
#elif NETSTANDARD1_6
4343
get;
4444
set;
4545
#endif

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.