Skip to content

Commit a9b1d9a

Browse files
authored
Update libraries - underlying table storage sdk now uses newer Azure.… (#13)
* Update libraries - underlying table storage sdk now uses newer Azure.Data.Tables SDK * minor refactoring * update readme
1 parent f11c93f commit a9b1d9a

20 files changed

+2740
-2658
lines changed

src/TableStorage.Abstractions.POCO.SecondaryIndexes/PocoStoreIndexer.cs

Lines changed: 142 additions & 200 deletions
Large diffs are not rendered by default.
Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,24 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<TargetFramework>netstandard2.0</TargetFramework>
55
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
6-
<Version>1.3.0.0</Version>
6+
<Version>1.4.0.0</Version>
77
<PackageLicenseExpression>MIT</PackageLicenseExpression>
88
<Authors>Giovanni Galbo</Authors>
99
<Company>Giovanni Galbo</Company>
1010
<Description>Geared more toward Azure Table Storage (vs CosmosDB, which has an ATS api), using an intra/inter partition (or table) secondary index pattern. This library handles keeping the indexes up to date as data gets mutated.</Description>
11-
<Copyright>2020</Copyright>
11+
<Copyright>2022</Copyright>
1212
<PackageIcon>xtensible-x.png</PackageIcon>
1313
<RepositoryUrl>https://github.com/giometrix/TableStorage.Abstractions.POCO</RepositoryUrl>
1414
<PackageTags>table-storage azure-table-storage poco table-entities tableentity index secondary-index</PackageTags>
15-
<AssemblyVersion>1.3.0.0</AssemblyVersion>
15+
<AssemblyVersion>1.4.0.0</AssemblyVersion>
1616
<PackageReleaseNotes>Updated underlying table storage</PackageReleaseNotes>
17-
<FileVersion>1.3.0.0</FileVersion>
17+
<FileVersion>1.4.0.0</FileVersion>
1818
<IncludeSymbols>true</IncludeSymbols>
1919
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
20-
<PackageVersion>1.3.2.0</PackageVersion>
20+
<PackageProjectUrl>https://github.com/giometrix/TableStorage.Abstractions.POCO</PackageProjectUrl>
21+
<PackageReadmeFile>README.md</PackageReadmeFile>
2122
</PropertyGroup>
2223

2324
<ItemGroup>
@@ -28,11 +29,18 @@
2829
</ItemGroup>
2930

3031
<ItemGroup>
31-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0">
32+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
3233
<PrivateAssets>all</PrivateAssets>
3334
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3435
</PackageReference>
35-
<PackageReference Include="TableStorage.Abstractions.POCO" Version="3.1.0" />
36+
<PackageReference Include="TableStorage.Abstractions.POCO" Version="3.2.0-beta" />
37+
</ItemGroup>
38+
39+
<ItemGroup>
40+
<None Update="README.md">
41+
<Pack>True</Pack>
42+
<PackagePath>\</PackagePath>
43+
</None>
3644
</ItemGroup>
3745

3846
</Project>
Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Linq.Expressions;
5-
using System.Text;
6-
using System.Threading.Tasks;
72

8-
namespace TableStorage.Abstractions.POCO
9-
{
10-
public class CalculatedKeyMapper<T, TKey> : KeyMapper<T,TKey>
3+
namespace TableStorage.Abstractions.POCO ;
4+
5+
public class CalculatedKeyMapper<T, TKey> : KeyMapper<T, TKey>
116
{
12-
public CalculatedKeyMapper(Func<T, string> toKey, Func<string, TKey> fromKey, Func<TKey, string> toKeyFromParameter) : base(toKey, fromKey, null, toKeyFromParameter)
7+
public CalculatedKeyMapper(Func<T, string> toKey, Func<string, TKey> fromKey, Func<TKey, string> toKeyFromParameter)
8+
: base(toKey, fromKey, null, toKeyFromParameter)
139
{
1410
}
15-
}
16-
}
11+
}
Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
using System;
22
using System.Linq.Expressions;
3-
using Microsoft.Azure.Cosmos.Table;
3+
using Azure.Data.Tables;
44
using Newtonsoft.Json;
55
using TableStorage.Abstractions.TableEntityConverters;
66

7-
namespace TableStorage.Abstractions.POCO
8-
{
7+
namespace TableStorage.Abstractions.POCO ;
8+
99
public class CalculatedKeysConverter<T, TPartitionKey, TRowKey> : IKeysConverter<T, TPartitionKey, TRowKey>
10-
where T: new()
10+
where T : new()
1111
{
12-
private readonly KeyMapper<T, TPartitionKey> _partitionMapper;
13-
private readonly KeyMapper<T, TRowKey> _rowMapper;
12+
private readonly Expression<Func<T, object>>[] _ignoredProperties;
1413
private readonly JsonSerializerSettings _jsonSerializerSettings;
14+
private readonly KeyMapper<T, TPartitionKey> _partitionMapper;
1515
private readonly PropertyConverters<T> _propertyConverters;
16-
private readonly Expression<Func<T, object>>[] _ignoredProperties;
16+
private readonly KeyMapper<T, TRowKey> _rowMapper;
1717

18-
public CalculatedKeysConverter(KeyMapper<T, TPartitionKey> partitionMapper, KeyMapper<T,TRowKey> rowMapper, JsonSerializerSettings jsonSerializerSettings,
18+
public CalculatedKeysConverter(KeyMapper<T, TPartitionKey> partitionMapper, KeyMapper<T, TRowKey> rowMapper, JsonSerializerSettings jsonSerializerSettings,
1919
PropertyConverters<T> propertyConverters = default,
2020
params Expression<Func<T, object>>[] ignoredProperties)
2121
{
@@ -25,30 +25,32 @@ public CalculatedKeysConverter(KeyMapper<T, TPartitionKey> partitionMapper, KeyM
2525
_propertyConverters = propertyConverters ?? new PropertyConverters<T>();
2626
_ignoredProperties = ignoredProperties;
2727
}
28-
public CalculatedKeysConverter(KeyMapper<T, TPartitionKey> partitionMapper, KeyMapper<T, TRowKey> rowMapper,
28+
29+
public CalculatedKeysConverter(KeyMapper<T, TPartitionKey> partitionMapper, KeyMapper<T, TRowKey> rowMapper,
2930
PropertyConverters<T> propertyConverters = default,
30-
params Expression<Func<T, object>>[] ignoredProperties) : this(partitionMapper, rowMapper, new JsonSerializerSettings(), propertyConverters, ignoredProperties)
31+
params Expression<Func<T, object>>[] ignoredProperties)
32+
: this(partitionMapper, rowMapper, new JsonSerializerSettings(), propertyConverters, ignoredProperties)
3133
{
3234
}
33-
public DynamicTableEntity ToEntity(T obj)
35+
36+
public string PartitionKey(TPartitionKey key)
3437
{
35-
return obj.ToTableEntity(_partitionMapper.ToKey(obj), _rowMapper.ToKey(obj), _jsonSerializerSettings, _propertyConverters, _ignoredProperties);
38+
return _partitionMapper.ToKeyFromParameter(key);
3639
}
3740

38-
public T FromEntity(DynamicTableEntity entity)
41+
public string RowKey(TRowKey key)
3942
{
40-
return entity.FromTableEntity(_partitionMapper.KeyProperty, _partitionMapper.FromKey, _rowMapper.KeyProperty,
41-
_rowMapper.FromKey, _jsonSerializerSettings, _propertyConverters);
43+
return _rowMapper.ToKeyFromParameter(key);
4244
}
4345

44-
public string PartitionKey(TPartitionKey key)
46+
public TableEntity ToEntity(T obj)
4547
{
46-
return _partitionMapper.ToKeyFromParameter(key);
48+
return obj.ToTableEntity(_partitionMapper.ToKey(obj), _rowMapper.ToKey(obj), _jsonSerializerSettings, _propertyConverters, _ignoredProperties);
4749
}
4850

49-
public string RowKey(TRowKey key)
51+
public T FromEntity(TableEntity entity)
5052
{
51-
return _rowMapper.ToKeyFromParameter(key);
53+
return entity.FromTableEntity(_partitionMapper.KeyProperty, _partitionMapper.FromKey, _rowMapper.KeyProperty,
54+
_rowMapper.FromKey, _jsonSerializerSettings, _propertyConverters);
5255
}
53-
}
54-
}
56+
}
Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
using System;
1+
namespace TableStorage.Abstractions.POCO ;
22

3-
namespace TableStorage.Abstractions.POCO
4-
{
53
public class FixedKeyMapper<T, TKey> : KeyMapper<T, TKey>
64
{
7-
public FixedKeyMapper(string key) : base(x=>key, null, null, x=>key)
5+
public FixedKeyMapper(string key) : base(x => key, null, null, x => key)
86
{
97
}
10-
}
11-
}
8+
}
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-

2-
using Microsoft.Azure.Cosmos.Table;
1+
using Azure.Data.Tables;
32

4-
namespace TableStorage.Abstractions.POCO
5-
{
6-
public interface IKeysConverter<T, in TPartitionKey, in TRowKey>
3+
namespace TableStorage.Abstractions.POCO;
4+
5+
public interface IKeysConverter<T, in TPartitionKey, in TRowKey>
76
{
8-
DynamicTableEntity ToEntity(T obj);
9-
T FromEntity(DynamicTableEntity entity);
7+
TableEntity ToEntity(T obj);
8+
T FromEntity(TableEntity entity);
109
string PartitionKey(TPartitionKey key);
1110
string RowKey(TRowKey key);
12-
}
13-
}
11+
}

0 commit comments

Comments
 (0)