Posts

Showing posts with the label Visual Studio

Storage Table - Easy data access layer

You can simply use the below code structure when you want to write a data access layer for Azure Storage Table.  Use blow Interface as the skeleton of your data access class.       public interface ITableStorage<T>     {         Task<List<T>> GetAllAsync(string partitionKey);         Task<List<T>> RetrieveEntityAsync(string partitionKey, string rowPrefix);         Task<T> GetSingleAsync(T entity);         Task<T> GetSingleAsync(string partitionKey, string rowKey);         Task InsertEntityAsync(T entity, bool forInsert = true);         Task DeleteEntityAsync(T entity);         Task DeleteSingleAsync(string partitionKey, string rowKey);         Task<List<T>> RetrieveAsync(string partitionKey);     } Here is the generic concrete cl...

C# Interactive

Image
Think... You have a solution with multiple C# projects and include maybe 1000 classes which are so hard to debug and test. But you have a task to validate the output of certain functions when certain parameters have specific values assigned. Especially, you don't have unit tests added or difficult to implement unit tests.  Idea... You can use C# Interactive to cater to everything above and there are many benefits. C# Interactive is a feature that comes with Visual Studio 2015 update 1 and later versions. It is a REPL Editor for C# (Read-Evaluate-Print-Loop). If you are interested in learning how to code you can use the online version of this C# Interactive to write and execute codes.  You can use Microsoft's C# learning site if you don't have Visual Studio installed on your PC.  If you have Visual Studio installed in your machine you can go to View > Other Windows > C# Interactive to open the C# Interactive window. If you want to execute any method in C# Interac...