public Task <IValueProvider> BindAsync(BindingContext context) { TableEntityPath boundPath = _path.Bind(context.BindingData); IStorageTable table = _client.GetTableReference(boundPath.TableName); TableEntityContext entityContext = new TableEntityContext { Table = table, PartitionKey = boundPath.PartitionKey, RowKey = boundPath.RowKey }; return(BindEntityAsync(entityContext, context.ValueContext)); }
public Task <IValueProvider> BindAsync(BindingContext context) { if (context == null) { throw new ArgumentNullException("context"); } TableEntityPath boundPath = _path.Bind(context.BindingData); var table = _client.GetTableReference(boundPath.TableName); TableEntityContext entityContext = new TableEntityContext { Table = table, PartitionKey = boundPath.PartitionKey, RowKey = boundPath.RowKey }; return(BindEntityAsync(entityContext, context.ValueContext)); }
public static IBindableTableEntityPath Create(string tableNamePattern, string partitionKeyPattern, string rowKeyPattern) { BindingTemplate tableNameTemplate = BindingTemplate.FromString(tableNamePattern); BindingTemplate partitionKeyTemplate = BindingTemplate.FromString(partitionKeyPattern); BindingTemplate rowKeyTemplate = BindingTemplate.FromString(rowKeyPattern); if (tableNameTemplate.ParameterNames.Count() > 0 || partitionKeyTemplate.ParameterNames.Count() > 0 || rowKeyTemplate.ParameterNames.Count() > 0) { return new ParameterizedTableEntityPath(tableNameTemplate, partitionKeyTemplate, rowKeyTemplate); } TableClient.ValidateAzureTableName(tableNamePattern); TableClient.ValidateAzureTableKeyValue(partitionKeyPattern); TableClient.ValidateAzureTableKeyValue(rowKeyPattern); TableEntityPath innerPath = new TableEntityPath(tableNamePattern, partitionKeyPattern, rowKeyPattern); return new BoundTableEntityPath(innerPath); }
public TableEntityContext Convert(string input) { TableEntityPath path; // For convenience, treat an an empty string as a request for the default value (when valid). if (String.IsNullOrEmpty(input) && _defaultPath.IsBound) { path = _defaultPath.Bind(null); } else { path = TableEntityPath.ParseAndValidate(input); } return(new TableEntityContext { Table = _client.GetTableReference(path.TableName), PartitionKey = path.PartitionKey, RowKey = path.RowKey }); }
public static IBindableTableEntityPath Create(string tableNamePattern, string partitionKeyPattern, string rowKeyPattern) { BindingTemplate tableNameTemplate = BindingTemplate.FromString(tableNamePattern); BindingTemplate partitionKeyTemplate = BindingTemplate.FromString(partitionKeyPattern); BindingTemplate rowKeyTemplate = BindingTemplate.FromString(rowKeyPattern); if (tableNameTemplate.HasParameters || partitionKeyTemplate.HasParameters || rowKeyTemplate.HasParameters) { return(new ParameterizedTableEntityPath(tableNameTemplate, partitionKeyTemplate, rowKeyTemplate)); } TableClient.ValidateAzureTableName(tableNamePattern); TableClient.ValidateAzureTableKeyValue(partitionKeyPattern); TableClient.ValidateAzureTableKeyValue(rowKeyPattern); TableEntityPath innerPath = new TableEntityPath(tableNamePattern, partitionKeyPattern, rowKeyPattern); return(new BoundTableEntityPath(innerPath)); }
public static bool TryParseAndValidate(string value, out TableEntityPath path) { if (value == null) { path = null; return(false); } string[] components = value.Split(new char[] { '/' }); if (components.Length != 3) { path = null; return(false); } string tableName = components[0]; string partitionKey = components[1]; string rowKey = components[2]; if (!TableClient.IsValidAzureTableName(tableName)) { path = null; return(false); } if (!TableClient.IsValidAzureTableKeyValue(partitionKey)) { path = null; return(false); } if (!TableClient.IsValidAzureTableKeyValue(rowKey)) { path = null; return(false); } path = new TableEntityPath(tableName, partitionKey, rowKey); return(true); }
public static bool TryParseAndValidate(string value, out TableEntityPath path) { if (value == null) { path = null; return false; } string[] components = value.Split(new char[] { '/' }); if (components.Length != 3) { path = null; return false; } string tableName = components[0]; string partitionKey = components[1]; string rowKey = components[2]; if (!TableClient.IsValidAzureTableName(tableName)) { path = null; return false; } if (!TableClient.IsValidAzureTableKeyValue(partitionKey)) { path = null; return false; } if (!TableClient.IsValidAzureTableKeyValue(rowKey)) { path = null; return false; } path = new TableEntityPath(tableName, partitionKey, rowKey); return true; }
public BoundTableEntityPath(TableEntityPath innerPath) { _innerPath = innerPath; }