Exemplo n.º 1
0
        public async Task <object> GetConfigurationAsync(Type type, string configurationName = null)
        {
            string typeName = type.Name;

            if (!string.IsNullOrEmpty(configurationName))
            {
                configurationName = $"{typeName}-{configurationName}";
            }
            else
            {
                configurationName = $"{typeName}";
            }

            ConfigurationRecord record;

            using (ITransaction transaction = _transactionManager.CreateTransaction())
            {
                record = await _dataSource.ByIdAsync <ConfigurationRecord>(transaction, "Configuration", configurationName, configurationName);
            }

            return(JsonConvert.DeserializeObject(record.SerializedConfiguration, type, new JsonSerializerSettings {
                TypeNameHandling = TypeNameHandling.All
            }));
        }
Exemplo n.º 2
0
 public virtual Task <TEntity> ByIdAsync <TEntity>(ITransaction transaction, string storeName, string partitionKey, string entityId)
 {
     return(_internal.ByIdAsync <TEntity>(transaction, storeName, partitionKey, entityId));
 }
 async Task <TEntity> IRepository <TEntity> .ByIdAsync(ITransaction transaction, string partitionKey, string entityId)
 {
     return(await _dataSource.ByIdAsync <TEntity>(transaction, _storeName, partitionKey, entityId));
 }