internal static EasyTableContext CreateContext(EasyTablesConfiguration config, EasyTableAttribute attribute, INameResolver resolver)
        {
            Uri    resolvedMobileAppUri = config.MobileAppUri;
            string resolvedApiKey       = config.ApiKey;

            // Override the config Uri with value from the attribute, if present.
            if (!string.IsNullOrEmpty(attribute.MobileAppUri))
            {
                string uriString = EasyTablesConfiguration.GetSettingFromConfigOrEnvironment(attribute.MobileAppUri);
                resolvedMobileAppUri = new Uri(uriString);
            }

            // If the attribute specifies an empty string ApiKey, set the ApiKey to null.
            if (attribute.ApiKey == string.Empty)
            {
                resolvedApiKey = null;
            }
            else if (attribute.ApiKey != null)
            {
                resolvedApiKey = EasyTablesConfiguration.GetSettingFromConfigOrEnvironment(attribute.ApiKey);
            }

            return(new EasyTableContext
            {
                Config = config,
                Client = CreateMobileServiceClient(config.ClientFactory, resolvedMobileAppUri, resolvedApiKey),
                ResolvedId = Resolve(attribute.Id, resolver),
                ResolvedTableName = Resolve(attribute.TableName, resolver)
            });
        }
 public EasyTableAttributeBindingProvider(JobHostConfiguration config, EasyTablesConfiguration easyTableConfig, INameResolver nameResolver)
 {
     _jobHostConfig   = config;
     _easyTableConfig = easyTableConfig;
     _nameResolver    = nameResolver;
 }