diff --git a/README.md b/README.md
index b1f5954..17f28a0 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,8 @@ The goal is to create a provider which allows lightweight access to your Azure s
Support exists reading and writing from Blobs, Tables and Queues, as well as fallback to the standard .NET Azure SDK.
+[![AppVeyor build status](https://ci.appveyor.com/api/projects/status/github/fsprojects/AzureStorageTypeProvider?svg=true)](https://ci.appveyor.com/project/fsprojectsgit/azurestoragetypeprovider)
+
### Maintainer(s)
- [@isaacabraham](https://github.com/isaacabraham)
diff --git a/paket.dependencies b/paket.dependencies
index 371c813..d10153b 100644
--- a/paket.dependencies
+++ b/paket.dependencies
@@ -8,6 +8,7 @@ nuget Unquote
nuget WindowsAzure.Storage 6.0.0
nuget xunit 1.9.2
nuget xunit.runners 1.9.2
+nuget xunit.runner.visualstudio version_in_path: true
nuget FSharp.Formatting
nuget Deedle
nuget FSharp.Charting
@@ -16,4 +17,3 @@ nuget Newtonsoft.Json 6.0.8
github fsprojects/FSharp.TypeProviders.StarterPack src/ProvidedTypes.fsi
github fsprojects/FSharp.TypeProviders.StarterPack src/ProvidedTypes.fs
-github fsprojects/FSharp.TypeProviders.StarterPack src/DebugProvidedTypes.fs
diff --git a/paket.lock b/paket.lock
index 926141c..47fcb3c 100644
--- a/paket.lock
+++ b/paket.lock
@@ -1,40 +1,38 @@
REDIRECTS: ON
NUGET
- remote: https://nuget.org/api/v2
- specs:
+ remote: https://www.nuget.org/api/v2
Deedle (1.2.4)
FAKE (4.4.5)
FSharp.Charting (0.90.12)
FSharp.Compiler.Service (0.0.90)
FSharp.Core (3.1.2.5)
- FSharp.Formatting (2.11.0)
+ FSharp.Formatting (2.11)
FSharp.Compiler.Service (>= 0.0.90 <= 1.3)
- FSharpVSPowerTools.Core (1.9.0)
- FSharpVSPowerTools.Core (1.9.0)
+ FSharpVSPowerTools.Core (1.9)
+ FSharpVSPowerTools.Core (1.9)
FSharp.Compiler.Service (>= 0.0.90)
FsUnit.xUnit (1.3.1)
xunit (1.9.2)
- Microsoft.Azure.KeyVault.Core (1.0.0) - framework: wpv8.0, >= net40
- Microsoft.Data.Edm (5.6.4) - framework: winv4.5, wpv8.1, wpv8.0, >= net40
- Microsoft.Data.OData (5.6.4) - framework: winv4.5, wpv8.1, wpv8.0, >= net40
+ Microsoft.Azure.KeyVault.Core (1.0) - framework: >= net40, wpv8.0
+ Microsoft.Data.Edm (5.6.4) - framework: >= net40, winv4.5, wpv8.0, wpav8.1
+ Microsoft.Data.OData (5.6.4) - framework: >= net40, winv4.5, wpv8.0, wpav8.1
Microsoft.Data.Edm (5.6.4)
System.Spatial (5.6.4)
Microsoft.Data.Services.Client (5.6.4) - framework: >= net40
Microsoft.Data.OData (5.6.4)
Newtonsoft.Json (6.0.8)
NuGet.CommandLine (2.8.6)
- System.Spatial (5.6.4) - framework: winv4.5, wpv8.1, wpv8.0, >= net40
- Unquote (3.0.0)
- WindowsAzure.Storage (6.0.0)
- Microsoft.Azure.KeyVault.Core (>= 1.0.0) - framework: wpv8.0, >= net40
- Microsoft.Data.OData (>= 5.6.4) - framework: winv4.5, wpv8.1, wpv8.0, >= net40
+ System.Spatial (5.6.4) - framework: >= net40, winv4.5, wpv8.0, wpav8.1
+ Unquote (3.0)
+ WindowsAzure.Storage (6.0)
+ Microsoft.Azure.KeyVault.Core (>= 1.0) - framework: >= net40, wpv8.0
+ Microsoft.Data.OData (>= 5.6.4) - framework: >= net40, winv4.5, wpv8.0, wpav8.1
Microsoft.Data.Services.Client (>= 5.6.4) - framework: >= net40
- Newtonsoft.Json (>= 6.0.8) - framework: winv4.5, wpv8.1, wpv8.0, >= net40
+ Newtonsoft.Json (>= 6.0.8) - framework: >= net40, winv4.5, wpv8.0, wpav8.1
xunit (1.9.2)
+ xunit.runner.visualstudio (2.1.0) - version_in_path: true
xunit.runners (1.9.2)
GITHUB
remote: fsprojects/FSharp.TypeProviders.StarterPack
- specs:
- src/DebugProvidedTypes.fs (f1234ba078dad7cbb674b1d1ab8b94f92f827911)
- src/ProvidedTypes.fs (f1234ba078dad7cbb674b1d1ab8b94f92f827911)
- src/ProvidedTypes.fsi (f1234ba078dad7cbb674b1d1ab8b94f92f827911)
\ No newline at end of file
+ src/ProvidedTypes.fs (dfbca9b83fb70067e85abddcb8b89332aae4c28d)
+ src/ProvidedTypes.fsi (dfbca9b83fb70067e85abddcb8b89332aae4c28d)
\ No newline at end of file
diff --git a/src/FSharp.Azure.StorageTypeProvider/FSharp.Azure.StorageTypeProvider.fsproj b/src/FSharp.Azure.StorageTypeProvider/FSharp.Azure.StorageTypeProvider.fsproj
index 0126cd2..dc2f852 100644
--- a/src/FSharp.Azure.StorageTypeProvider/FSharp.Azure.StorageTypeProvider.fsproj
+++ b/src/FSharp.Azure.StorageTypeProvider/FSharp.Azure.StorageTypeProvider.fsproj
@@ -43,6 +43,14 @@
..\..\bin\FSharp.Azure.StorageTypeProvider.XML
+
+ True
+ paket-files/ProvidedTypes.fsi
+
+
+ True
+ paket-files/ProvidedTypes.fs
+
@@ -54,15 +62,6 @@
-
- paket-files/ProvidedTypes.fsi
-
-
- paket-files/ProvidedTypes.fs
-
-
- paket-files/DebugProvidedTypes.fs
-
@@ -106,7 +105,7 @@
-
+
..\..\packages\FSharp.Core\lib\net40\FSharp.Core.dll
@@ -115,46 +114,46 @@
-
+
- ..\..\packages\FSharp.Core\lib\portable-net45+netcore45\FSharp.Core.dll
+ ..\..\packages\FSharp.Core\lib\portable-net45+monoandroid10+monotouch10+xamarinios10\FSharp.Core.dll
True
True
-
+
- ..\..\packages\FSharp.Core\lib\portable-net45+monoandroid10+monotouch10+xamarinios10\FSharp.Core.dll
+ ..\..\packages\FSharp.Core\lib\portable-net45+netcore45\FSharp.Core.dll
True
True
-
+
- ..\..\packages\FSharp.Core\lib\portable-net45+sl5+netcore45\FSharp.Core.dll
+ ..\..\packages\FSharp.Core\lib\portable-net45+netcore45+wp8\FSharp.Core.dll
True
True
-
+
- ..\..\packages\FSharp.Core\lib\portable-net45+netcore45+wp8\FSharp.Core.dll
+ ..\..\packages\FSharp.Core\lib\portable-net45+netcore45+wpa81+wp8\FSharp.Core.dll
True
True
-
+
- ..\..\packages\FSharp.Core\lib\portable-net45+netcore45+wpa81+wp8\FSharp.Core.dll
+ ..\..\packages\FSharp.Core\lib\portable-net45+sl5+netcore45\FSharp.Core.dll
True
True
@@ -162,7 +161,7 @@
-
+
..\..\packages\Microsoft.Azure.KeyVault.Core\lib\net40\Microsoft.Azure.KeyVault.Core.dll
@@ -171,7 +170,7 @@
-
+
..\..\packages\Microsoft.Azure.KeyVault.Core\lib\portable-net45+wp8+wpa81+win\Microsoft.Azure.KeyVault.Core.dll
@@ -182,7 +181,7 @@
-
+
..\..\packages\Microsoft.Data.Edm\lib\net40\Microsoft.Data.Edm.dll
@@ -191,7 +190,7 @@
-
+
..\..\packages\Microsoft.Data.Edm\lib\portable-net45+wp8+win8+wpa\Microsoft.Data.Edm.dll
@@ -202,7 +201,7 @@
-
+
..\..\packages\Microsoft.Data.OData\lib\net40\Microsoft.Data.OData.dll
@@ -211,7 +210,7 @@
-
+
..\..\packages\Microsoft.Data.OData\lib\portable-net45+wp8+win8+wpa\Microsoft.Data.OData.dll
@@ -222,7 +221,7 @@
-
+
..\..\packages\Microsoft.Data.Services.Client\lib\net40\Microsoft.Data.Services.Client.dll
@@ -233,10 +232,10 @@
-
+
- ..\..\packages\Newtonsoft.Json\lib\netcore45\Newtonsoft.Json.dll
+ ..\..\packages\Newtonsoft.Json\lib\net20\Newtonsoft.Json.dll
True
True
@@ -251,46 +250,46 @@
-
+
- ..\..\packages\Newtonsoft.Json\lib\net20\Newtonsoft.Json.dll
+ ..\..\packages\Newtonsoft.Json\lib\net40\Newtonsoft.Json.dll
True
True
-
+
- ..\..\packages\Newtonsoft.Json\lib\net40\Newtonsoft.Json.dll
+ ..\..\packages\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll
True
True
-
+
- ..\..\packages\Newtonsoft.Json\lib\net45\Newtonsoft.Json.dll
+ ..\..\packages\Newtonsoft.Json\lib\netcore45\Newtonsoft.Json.dll
True
True
-
+
- ..\..\packages\Newtonsoft.Json\lib\portable-net45+wp80+win8+wpa81+aspnetcore50\Newtonsoft.Json.dll
+ ..\..\packages\Newtonsoft.Json\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll
True
True
-
+
- ..\..\packages\Newtonsoft.Json\lib\portable-net40+sl5+wp80+win8+wpa81\Newtonsoft.Json.dll
+ ..\..\packages\Newtonsoft.Json\lib\portable-net45+wp80+win8+wpa81+aspnetcore50\Newtonsoft.Json.dll
True
True
@@ -298,7 +297,7 @@
-
+
..\..\packages\System.Spatial\lib\net40\System.Spatial.dll
@@ -307,7 +306,7 @@
-
+
..\..\packages\System.Spatial\lib\portable-net45+wp8+win8+wpa\System.Spatial.dll
@@ -318,19 +317,19 @@
-
+
- ..\..\packages\WindowsAzure.Storage\lib\win8\Microsoft.WindowsAzure.Storage.dll
+ ..\..\packages\WindowsAzure.Storage\lib\net40\Microsoft.WindowsAzure.Storage.dll
True
True
-
+
- ..\..\packages\WindowsAzure.Storage\lib\net40\Microsoft.WindowsAzure.Storage.dll
+ ..\..\packages\WindowsAzure.Storage\lib\win8\Microsoft.WindowsAzure.Storage.dll
True
True
diff --git a/src/FSharp.Azure.StorageTypeProvider/Shared.fs b/src/FSharp.Azure.StorageTypeProvider/Shared.fs
index c6eebd3..45d7fb9 100644
--- a/src/FSharp.Azure.StorageTypeProvider/Shared.fs
+++ b/src/FSharp.Azure.StorageTypeProvider/Shared.fs
@@ -9,4 +9,10 @@ let internal ofNullable (value : Nullable<_>) =
let internal toNullable = function
| Some x -> Nullable x
- | None -> Nullable()
\ No newline at end of file
+ | None -> Nullable()
+
+let internal ofObj (value) = if value = null then None else Some value
+
+let internal toObj = function
+ | Some x -> x
+ | None -> null
\ No newline at end of file
diff --git a/src/FSharp.Azure.StorageTypeProvider/Table/ProvidedTableTypes.fs b/src/FSharp.Azure.StorageTypeProvider/Table/ProvidedTableTypes.fs
index 125ca08..2ead074 100644
--- a/src/FSharp.Azure.StorageTypeProvider/Table/ProvidedTableTypes.fs
+++ b/src/FSharp.Azure.StorageTypeProvider/Table/ProvidedTableTypes.fs
@@ -11,28 +11,36 @@ type AzureTable internal (defaultConnection, tableName) =
let getConnectionDetails (insertMode, connectionString) =
defaultArg insertMode TableInsertMode.Insert, defaultArg connectionString defaultConnection
let getTableForConnection = getTable tableName
-
- /// Gets a handle to the Azure SDK client for this table.
- member __.AsCloudTable(?connectionString) = getTableForConnection (defaultArg connectionString defaultConnection)
- /// Inserts a batch of entities into the table, using all public properties on the object as fields.
- member __.Insert(entities : seq, ?insertMode, ?connectionString) =
+ let buildInsertParams insertMode connectionString (entities : seq) =
let insertMode, connectionString = getConnectionDetails (insertMode, connectionString)
let table = getTableForConnection connectionString
let insertOp = createInsertOperation insertMode
-
+
let propBuilders =
typeof<'b>.GetProperties(Reflection.BindingFlags.Public ||| Reflection.BindingFlags.Instance)
|> Seq.map (fun prop entity -> prop.Name, prop.GetValue(entity, null))
|> Seq.toArray
- entities
- |> Seq.map (fun (partitionKey, rowKey, entity) ->
- LightweightTableEntity(partitionKey, rowKey, DateTimeOffset.MinValue,
- propBuilders
- |> Seq.map (fun builder -> builder (entity))
- |> Map.ofSeq))
- |> Seq.map buildDynamicTableEntity
- |> executeBatchOperation insertOp table
+
+ let tblEntities =
+ entities
+ |> Seq.map (fun (partitionKey, rowKey, entity) ->
+ let values = propBuilders |> Seq.map (fun builder -> builder entity) |> Map.ofSeq
+ LightweightTableEntity(partitionKey, rowKey, DateTimeOffset.MinValue, values) |> buildDynamicTableEntity)
+ tblEntities, insertOp, table
+
+ /// Gets a handle to the Azure SDK client for this table.
+ member __.AsCloudTable(?connectionString) = getTableForConnection (defaultArg connectionString defaultConnection)
+
+ /// Inserts a batch of entities into the table, using all public properties on the object as fields.
+ member __.Insert(entities : seq, ?insertMode, ?connectionString) =
+ let tblEntities, insertOp, table = buildInsertParams insertMode connectionString entities
+ tblEntities |> executeBatchOperation insertOp table
+
+ /// Inserts a batch of entities into the table, using all public properties on the object as fields.
+ member __.InsertAsync(entities : seq, ?insertMode, ?connectionString) = async{
+ let tblEntities, insertOp, table = buildInsertParams insertMode connectionString entities
+ return! tblEntities |> executeBatchOperationAsync insertOp table }
/// Inserts a single entity into the table, using public properties on the object as fields.
member this.Insert(partitionKey, rowKey, entity, ?insertMode, ?connectionString) =
@@ -41,26 +49,60 @@ type AzureTable internal (defaultConnection, tableName) =
|> Seq.head
|> snd
|> Seq.head
+
+ /// Inserts a single entity into the table asynchronously, using public properties on the object as fields.
+ member this.InsertAsync(partitionKey, rowKey, entity, ?insertMode, ?connectionString) = async{
+ let insertMode, connectionString = getConnectionDetails (insertMode, connectionString)
+ let! insertRes = this.InsertAsync([ partitionKey, rowKey, entity ], insertMode, connectionString)
+ return
+ insertRes
+ |> Seq.head
+ |> snd
+ |> Seq.head }
- /// Deletes a batch of entities from the table using the supplied pairs of Partition and Row keys.
+ /// Deletes a batch of entities from the table using the supplied pairs of Partition and Row keys.
member __.Delete(entities, ?connectionString) =
let table = getTableForConnection (defaultArg connectionString defaultConnection)
entities
|> Seq.map (fun entityId ->
- let Partition(partitionKey), Row(rowKey) = entityId
- DynamicTableEntity(partitionKey, rowKey, ETag = "*"))
+ let Partition(partitionKey), Row(rowKey) = entityId
+ DynamicTableEntity(partitionKey, rowKey, ETag = "*"))
|> executeBatchOperation TableOperation.Delete table
+ /// Asynchronously deletes a batch of entities from the table using the supplied pairs of Partition and Row keys.
+ member __.DeleteAsync(entities, ?connectionString) = async {
+ let table = getTableForConnection (defaultArg connectionString defaultConnection)
+ return! entities
+ |> Seq.map (fun entityId ->
+ let Partition(partitionKey), Row(rowKey) = entityId
+ DynamicTableEntity(partitionKey, rowKey, ETag = "*"))
+ |> executeBatchOperationAsync TableOperation.Delete table }
+
/// Deletes an entire partition from the table
member __.DeletePartition(partitionKey, ?connectionString) =
let table = getTableForConnection (defaultArg connectionString defaultConnection)
let filter = Table.TableQuery.GenerateFilterCondition ("PartitionKey", Table.QueryComparisons.Equal, partitionKey)
let projection = [|"RowKey"|]
+
(new Table.TableQuery()).Where(filter).Select(projection)
|> table.ExecuteQuery
|> Seq.map(fun e -> (Partition(e.PartitionKey), Row(e.RowKey)))
|> __.Delete
- |> ignore
+ |> ignore
+
+ /// Asynchronously deletes an entire partition from the table
+ member __.DeletePartitionAsync(partitionKey, ?connectionString) = async {
+ let table = getTableForConnection (defaultArg connectionString defaultConnection)
+ let connStringToUse =
+ match connectionString with
+ | Some c -> c
+ | None -> defaultConnection
+ let filter = Table.TableQuery.GenerateFilterCondition ("PartitionKey", Table.QueryComparisons.Equal, partitionKey)
+ let! response = executeGenericQueryAsync connStringToUse table.Name Int32.MaxValue filter (fun e -> (Partition(e.PartitionKey), Row(e.RowKey)))
+ return!
+ response
+ |> __.DeleteAsync
+ |> Async.Ignore }
/// Gets the name of the table.
member __.Name = tableName
diff --git a/src/FSharp.Azure.StorageTypeProvider/Table/TableEntityMemberFactory.fs b/src/FSharp.Azure.StorageTypeProvider/Table/TableEntityMemberFactory.fs
index 31fb254..a985c91 100644
--- a/src/FSharp.Azure.StorageTypeProvider/Table/TableEntityMemberFactory.fs
+++ b/src/FSharp.Azure.StorageTypeProvider/Table/TableEntityMemberFactory.fs
@@ -96,8 +96,17 @@ let buildTableEntityMembers (parentTableType:ProvidedTypeDefinition, parentTable
ProvidedParameter("connectionString", typeof, optionalValue = connection) ], parentTableEntityType.MakeArrayType(),
InvokeCode = (fun args -> <@@ getPartitionRows %%args.[1] %%args.[2] tableName @@>))
getPartition.AddXmlDocDelayed <| fun _ -> "Eagerly retrieves all entities in a table partition by its key."
+
+ let getPartitionAsync =
+ ProvidedMethod
+ ("GetPartitionAsync",
+ [ ProvidedParameter("key", typeof)
+ ProvidedParameter("connectionString", typeof, optionalValue = connection) ],
+ typeof>.GetGenericTypeDefinition().MakeGenericType(parentTableEntityType.MakeArrayType()),
+ InvokeCode = (fun args -> <@@ getPartitionRowsAsync %%args.[1] %%args.[2] tableName @@>))
+ getPartitionAsync.AddXmlDocDelayed <| fun _ -> "Asynchronously retrieves all entities in a table partition by its key."
+
let queryBuilderType, childTypes = TableQueryBuilder.createTableQueryType parentTableEntityType connection tableName propertiesCreated
-
let executeQuery =
ProvidedMethod
("Query",
@@ -116,6 +125,18 @@ let buildTableEntityMembers (parentTableType:ProvidedTypeDefinition, parentTable
(typeof
+
+
+
+ <__paket__xunit_runner_visualstudio_props>net20\xunit.runner.visualstudio
+
+
+
+
+ <__paket__xunit_runner_visualstudio_props>portable-net45+win8+wp8+wpa81\xunit.runner.visualstudio
+
+
+
+
+ <__paket__xunit_runner_visualstudio_props>win81\xunit.runner.visualstudio
+ <__paket__xunit_runner_visualstudio_targets>win81\xunit.runner.visualstudio
+
+
+
+
+ <__paket__xunit_runner_visualstudio_props>wpa81\xunit.runner.visualstudio
+ <__paket__xunit_runner_visualstudio_targets>wpa81\xunit.runner.visualstudio
+
+
+
+