Skip to content

Commit 853747c

Browse files
committed
refactoring
1 parent 980c19a commit 853747c

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/TableStorage.Abstractions.POCO/PocoTableStore.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
namespace TableStorage.Abstractions.POCO
1616
{
17-
public class PocoTableStore<T, TPartitionKey, TRowKey> : IPocoTableStore<T, TPartitionKey, TRowKey> where T : new()
17+
public class PocoTableStore<T, TPartitionKey, TRowKey> : IPocoTableStore<T, TPartitionKey, TRowKey> where T : class, new()
1818
{
1919
//hack because this is internal. Need to get this exposed.
2020
private static readonly ConcurrentDictionary<Type, ConstructorInfo> _pagedResultConstructors =
@@ -169,8 +169,7 @@ public void InsertOrReplace(T record)
169169
/// <exception cref="ArgumentNullException">records</exception>
170170
public void Insert(IEnumerable<T> records)
171171
{
172-
if (records == null)
173-
throw new ArgumentNullException(nameof(records));
172+
if (records == null) throw new ArgumentNullException(nameof(records));
174173

175174
var entities = CreateEntities(records);
176175
_tableStore.Insert(entities);
@@ -353,7 +352,9 @@ public IObservable<T> GetAllRecordsObservable()
353352
return Observable.Create<T>(o =>
354353
{
355354
foreach (var result in GetAllRecords())
355+
{
356356
o.OnNext(result);
357+
}
357358
return Disposable.Empty;
358359
});
359360
}
@@ -370,7 +371,9 @@ public IObservable<T> GetRecordsByFilterObservable(Func<T, bool> filter, int sta
370371
return Observable.Create<T>(o =>
371372
{
372373
foreach (var result in GetAllRecords().Where(filter).Page(start, pageSize))
374+
{
373375
o.OnNext(result);
376+
}
374377
return Disposable.Empty;
375378
});
376379
}
@@ -1085,7 +1088,9 @@ private IEnumerable<DynamicTableEntity> CreateEntities(IEnumerable<T> records)
10851088
private T CreateRecord(DynamicTableEntity entity)
10861089
{
10871090
if (entity == null)
1091+
{
10881092
return default(T);
1093+
}
10891094

10901095
return _keysConverter.FromEntity(entity);
10911096

@@ -1110,7 +1115,9 @@ private PagedResult<T> CreatePagedResult(PagedResult<DynamicTableEntity> result,
11101115
var records = CreateRecords(result.Items);
11111116

11121117
if (filter != null)
1118+
{
11131119
records = records.Where(filter);
1120+
}
11141121

11151122
return ctor.Invoke(new object[]
11161123
{records.ToList(), result.ContinuationToken, result.IsFinalPage}) as PagedResult<T>;

0 commit comments

Comments
 (0)