Exemple #1
0
        public void GetOnMissingTableShouldWork()
        {
            var missingTableName = "t" + Guid.NewGuid().ToString("N");

            // checking the 4 overloads
            var enumerable = TableStorage.Get <string>(missingTableName);
            int count      = enumerable.Count();

            Assert.AreEqual(0, count, "#A00");

            enumerable = TableStorage.Get <string>(missingTableName, "my-partition");
            count      = enumerable.Count();
            Assert.AreEqual(0, count, "#A01");

            enumerable = TableStorage.Get <string>(missingTableName, "my-partition", "start", "end");
            count      = enumerable.Count();
            Assert.AreEqual(0, count, "#A02");

            enumerable = TableStorage.Get <string>(missingTableName, "my-partition", new[] { "my-key" });
            count      = enumerable.Count();
            Assert.AreEqual(0, count, "#A03");
        }
        /// <seealso cref="ITableStorageProvider.Get{T}(string, string)"/>
        public Maybe <CloudEntity <T> > Get(string partitionName, string rowKey)
        {
            var entity = _provider.Get <T>(_tableName, partitionName, new[] { rowKey }).FirstOrDefault();

            return(null != entity ? new Maybe <CloudEntity <T> >(entity) : Maybe <CloudEntity <T> > .Empty);
        }
Exemple #3
0
        public CloudEntity <T> Get(string partitionName, string rowKey)
        {
            var entity = _provider.Get <T>(_tableName, partitionName, new[] { rowKey }).FirstOrDefault();

            return(entity);
        }
        /// <summary>Gets the specified cloud entity if it exists.</summary>
        /// <typeparam name="T"></typeparam>
        public static Maybe <CloudEntity <T> > Get <T>(this ITableStorageProvider provider, string tableName, string partitionName, string rowKey)
        {
            var entity = provider.Get <T>(tableName, partitionName, new[] { rowKey }).FirstOrDefault();

            return(null != entity ? new Maybe <CloudEntity <T> >(entity) : Maybe <CloudEntity <T> > .Empty);
        }