Package | Release | Pre-release |
---|---|---|
TableStorage.UnsupportedTypes |
CI | Status | Platform(s) | Framework(s) | Test Framework(s) |
---|---|---|---|---|
AppVeyor | Windows |
nestandard2.0 |
netcoreapp3.1 |
Azure Table storage supports a limited set of data types (namely byte[]
, bool
, DateTime
, double
, Guid
, int
, long
and string
). Unsupported Types
allows to store unsupported data types with some limitations:
- Your
Type
should be serializable / deserializable to and fromJSON
using Json.NET - The entity should fit in
1 MB
This is distributed via a NuGet
package but the implementation is so simple that you can just copy the classes into your own solution if that works better for you.
🚨 I'm using the legacy WindowsAzure.Storage NuGet
package, let me know if there is interest in using Microsoft.Azure.Cosmos.Table instead.
- Your
TableEntity
should inherit fromUnsupportedTypesTableEntity
- Decorate the properties you want to store with the
UnsupportedTypeAttribute
- That's all
public class Unimportant
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
public class UnsupportedTypesTestTableEntity : UnsupportedTypesTableEntity
{
[UnsupportedType]
public Unimportant VeryImportant { get; set; }
}
There is a console application in src/SampleConsole demonstrating Unsupported Types
:
- You'll need the Azure storage emulator 5.5 or later
- Alternatively you can use a storage account and modify
AzureTableStorage:ConnectionString
accordingly inappsettings.json
- Alternatively you can use a storage account and modify
You will not be able to filter the entities using the unsupported types. You'll need to materialize them first and then use LINQ to Objects.
Each read and write to Azure Table storage
will trigger the use of Reflection
. This could be improved by caching the unsupported properties, in this case the scan would happen once per application lifetime.
- .NET Core SDK v3.1.300 and higher
.\bootstrap.ps1
./bootstrap.sh
dotnet cake build.cake