Esempio n. 1
0
        public T Retrieve(string pk, string rk)
        {
            AzureKeyValidator.ValidatePartitionKey(pk); //altfel da eroare daca string-ul este null, gol, >512ch sau are ch. speciale
            AzureKeyValidator.ValidateRowKey(rk);

            var operation = TableOperation.Retrieve <T>(pk, rk);
            var result    = Table.Execute(operation);

            return((T)result.Result); // this will be null if it doesn't exist ...daca T este de tip Interfata, nu poti folosi la final constructia "as T"
        }
Esempio n. 2
0
 public void Add(GenericTableEntity entity)
 {
     AzureKeyValidator.ValidatePartitionKey(entity.PartitionKey);
     AzureKeyValidator.ValidateRowKey(entity.RowKey);
     lock ( _entities )
     {
         if (_entities.ContainsKey(entity.RowKey))
         {
             throw new EntityAlreadyExistsException();
         }
         entity.ETag              = GetNewETag();
         entity.Timestamp         = DateTimeOffset.UtcNow;
         _entities[entity.RowKey] = entity;
     }
 }