Example #1
0
        public void InsertOrReplaceEntity <T>(string nombreTabla, T entidad, bool createTable = false) where T : ITableEntity
        {
            using (var context = new AzureTableContext(cloudStorageAccount.TableEndpoint.AbsoluteUri, cloudStorageAccount.Credentials, maxAttempts, waitSeconds))
            {
                if (createTable)
                {
                    context.CreateTableIfNotExists(nombreTabla);
                }

                context.InsertOrReplaceEntity(entidad, nombreTabla);
            }
        }
Example #2
0
        public T GetEntity <T>(string nombreTabla, string partitionKey, string rowKey, bool createTable = false)
            where T : ITableEntity, new()
        {
            using (var context = new AzureTableContext(cloudStorageAccount.TableEndpoint.AbsoluteUri, cloudStorageAccount.Credentials, maxAttempts, waitSeconds))
            {
                if (createTable)
                {
                    context.CreateTableIfNotExists(nombreTabla);
                }

                return(context.GetEntity <T>(nombreTabla, partitionKey, rowKey));
            }
        }