in src/WebJobs.Extensions.MobileApps/Config/MobileAppsExtensionConfigProvider.cs [45:76]
public void Initialize(ExtensionConfigContext context)
{
if (context == null)
{
throw new ArgumentNullException("context");
}
var rule = context.AddBindingRule<MobileTableAttribute>();
rule.AddValidator(ValidateMobileAppUri);
rule.BindToCollector<OpenType>(typeof(MobileTableCollectorBuilder<>), this);
rule.BindToInput<IMobileServiceClient>(new MobileTableClientBuilder(this));
// MobileType matching needs to know whether the attribute defines 'TableName', but
// OpenTypes can't get access to the attribute. So use filters to split into 2 cases.
rule.WhenIsNotNull(nameof(MobileTableAttribute.TableName)).
BindToInput<IMobileServiceTableQuery<MobileTypeWithTableName>>(typeof(MobileTableQueryBuilder<>), this);
rule.WhenIsNull(nameof(MobileTableAttribute.TableName)).
BindToInput<IMobileServiceTableQuery<MobileTypeWithoutTableName>>(typeof(MobileTableQueryBuilder<>), this);
rule.BindToInput<IMobileServiceTable>(new MobileTableJObjectTableBuilder(this));
rule.WhenIsNotNull(nameof(MobileTableAttribute.TableName)).
BindToInput<IMobileServiceTable<MobileTypeWithTableName>>(typeof(MobileTablePocoTableBuilder<>), this);
rule.WhenIsNull(nameof(MobileTableAttribute.TableName)).
BindToInput<IMobileServiceTable<MobileTypeWithoutTableName>>(typeof(MobileTablePocoTableBuilder<>), this);
rule.WhenIsNotNull(nameof(MobileTableAttribute.TableName)).
BindToValueProvider<MobileTypeWithTableName>(BindForItemAsync).AddValidator(HasId);
rule.WhenIsNull(nameof(MobileTableAttribute.TableName)).
BindToValueProvider<MobileTypeWithoutTableName>(BindForItemAsync).AddValidator(HasId);
}