Método LoadFromSource
CarregarFromSource(String)
Responsável por carregar o objeto da fonte de dados. A chave é passada como parâmetro.
Declaração
ProviderCacheItem LoadFromSource(string key)
parâmetros
Formato | Nome | Descrição |
---|---|---|
System.String | chave | Chave usada para referenciar o objeto. |
Returns
Formato | Descrição |
---|---|
ProviderCacheItem | Um CacheItem com alguns campos limitados. |
Exemplos
O exemplo a seguir executa uma única operação na fonte de dados.
public ProviderCacheItem LoadFromSource(string key)
{
return new ProviderCacheItem(_source.LoadCustomer(key));
}
LoadFromSource(ICollection )
Responsável por carregar array de objetos da fonte de dados. As chaves são passadas como parâmetro.
Declaração
IDictionary<string, ProviderCacheItem> LoadFromSource(ICollection<string> keys)
parâmetros
Formato | Nome | Descrição |
---|---|---|
System.Collections.Generic.ICollection<System.String> | chaves | Matriz de chaves. |
Returns
Formato | Descrição |
---|---|
System.Collections.Generic.IDictionary<System.String, ProviderCacheItem> |
Exemplos
O exemplo a seguir executa diversas operações na fonte de dados.
public IDictionary<string, ProviderCacheItem> LoadFromSource(ICollection<string> keys)
{
Dictionary<string, ProviderCacheItem> dictionary = new Dictionary<string, ProviderCacheItem>();
foreach (string key in keys)
{
ProviderCacheItem item = LoadFromSource(key);
dictionary.Add(key, item);
}
return dictionary;
}