private string GetTable <T>()
 {
     if (!TableCache.ContainsKey(typeof(T)))
     {
         throw new Exception("Table not found");
     }
     return(TableCache[typeof(T)]);
 }
Example #2
0
        public static AzureTableContext <T> GetContext <T>(string tableName) where T : ITableEntity, new()
        {
            lock (TableCache) {
                if (!TableCache.ContainsKey(tableName))
                {
                    var context = new AzureTableContext <T>(GetAccount(), tableName);
                    TableCache.Add(tableName, context);
                    context.Create();
                }

                return(TableCache[tableName] as AzureTableContext <T>);
            }
        }
Example #3
0
        private DataTable <T> GetCachedTable <T>() where T : DataEntity
        {
            lock (TableCache)
            {
                if (!TableCache.ContainsKey(typeof(T)))
                {
                    Logger.Trace($"{nameof(DynamoStore)}.{nameof(GetCachedTable)}<{typeof(T).Name}>",
                                 new LogItem("Action", "Not cached, call GetOrCreateTable"));
                    GetOrCreateTable <T>();
                }

                return((DataTable <T>)TableCache[typeof(T)]);
            }
        }