@@ -20,30 +20,31 @@ let (|BlobOnlyAccount|FullAccount|) = function
2020/// Builds up the Table Storage member
2121let getTableStorageMembers optionalStaticSchema schemaInferenceRowCount humanize ( connectionString , domainType : ProvidedTypeDefinition ) =
2222 async {
23- match ! ( getTableClient connectionString). GetTableReference( " 1" ). ExistsAsync() |> Async.AwaitTask |> Async.toAsyncResult with
24- | BlobOnlyAccount -> return None
25- | FullAccount ->
26- let tableListingType = ProvidedTypeDefinition( " Tables" , Some typeof< obj>, hideObjectMethods = true )
27- domainType.AddMember tableListingType
23+ let tableListingType = ProvidedTypeDefinition( " Tables" , Some typeof< obj>, hideObjectMethods = true )
24+ domainType.AddMember tableListingType
2825
29- /// Creates an individual Table member
30- let createTableType columnDefinitions connectionString tableName propertyName =
31- let tableEntityType = ProvidedTypeDefinition( tableName + " Entity" , Some typeof< LightweightTableEntity>, hideObjectMethods = true )
32- let tableType = ProvidedTypeDefinition( tableName + " Table" , Some typeof< AzureTable>, hideObjectMethods = true )
33- domainType.AddMembers [ tableEntityType; tableType ]
26+ /// Creates an individual Table member
27+ let createTableType columnDefinitions connectionString tableName propertyName =
28+ let tableEntityType = ProvidedTypeDefinition( tableName + " Entity" , Some typeof< LightweightTableEntity>, hideObjectMethods = true )
29+ let tableType = ProvidedTypeDefinition( tableName + " Table" , Some typeof< AzureTable>, hideObjectMethods = true )
30+ domainType.AddMembers [ tableEntityType; tableType ]
3431
35- TableEntityMemberFactory.buildTableEntityMembers columnDefinitions humanize ( tableType, tableEntityType, domainType, connectionString, tableName)
36- let tableProp = ProvidedProperty( propertyName, tableType, getterCode = ( fun _ -> <@@ TableBuilder.createAzureTable connectionString tableName @@>))
37- tableProp.AddXmlDoc <| sprintf " Provides access to the '%s ' table." tableName
38- tableProp
39-
40- match optionalStaticSchema with
41- | Some ( optionalStaticSchema: StaticSchema .Parsed .TableSchema ) ->
42- optionalStaticSchema.Tables
43- |> Array.map( fun table -> createTableType table.Columns connectionString table.Table table.Table)
44- |> Array.toList
45- |> tableListingType.AddMembers
46- | None ->
32+ TableEntityMemberFactory.buildTableEntityMembers columnDefinitions humanize ( tableType, tableEntityType, domainType, connectionString, tableName)
33+ let tableProp = ProvidedProperty( propertyName, tableType, getterCode = ( fun _ -> <@@ TableBuilder.createAzureTable connectionString tableName @@>))
34+ tableProp.AddXmlDoc <| sprintf " Provides access to the '%s ' table." tableName
35+ tableProp
36+
37+ match optionalStaticSchema with
38+ | Some ( optionalStaticSchema: StaticSchema .Parsed .TableSchema ) ->
39+ optionalStaticSchema.Tables
40+ |> Array.map( fun table -> createTableType table.Columns connectionString table.Table table.Table)
41+ |> Array.toList
42+ |> tableListingType.AddMembers
43+ | None ->
44+ match ! ( getTableClient connectionString). GetTableReference( " 1" ). ExistsAsync() |> Async.AwaitTask |> Async.toAsyncResult with
45+ | BlobOnlyAccount ->
46+ ()
47+ | FullAccount ->
4748 tableListingType.AddMembersDelayed( fun _ ->
4849 async {
4950 let! tables = getTables connectionString
@@ -73,11 +74,11 @@ let getTableStorageMembers optionalStaticSchema schemaInferenceRowCount humanize
7374 metricsTablesProp.AddXmlDoc " Provides access to metrics tables populated by Azure that are available on this storage account."
7475 [ metricsTablesProp ])
7576
76- let ctcProp = ProvidedProperty( " CloudTableClient" , typeof< CloudTableClient>, getterCode = ( fun _ -> <@@ TableBuilder.createAzureTableRoot connectionString @@>))
77- ctcProp.AddXmlDoc " Gets a handle to the Table Azure SDK client for this storage account."
78- tableListingType.AddMember ctcProp
79-
80- let tableListingProp = ProvidedProperty( " Tables" , tableListingType, isStatic = true , getterCode = ( fun _ -> <@@ () @@>))
81- tableListingProp.AddXmlDoc " Gets the list of all tables in this storage account."
82- return Some tableListingProp }
77+ let ctcProp = ProvidedProperty( " CloudTableClient" , typeof< CloudTableClient>, getterCode = ( fun _ -> <@@ TableBuilder.createAzureTableRoot connectionString @@>))
78+ ctcProp.AddXmlDoc " Gets a handle to the Table Azure SDK client for this storage account."
79+ tableListingType.AddMember ctcProp
80+
81+ let tableListingProp = ProvidedProperty( " Tables" , tableListingType, isStatic = true , getterCode = ( fun _ -> <@@ () @@>))
82+ tableListingProp.AddXmlDoc " Gets the list of all tables in this storage account."
83+ return Some tableListingProp }
8384 |> Async.RunSynchronously
0 commit comments