Posts

Showing posts from November, 2016

How can I create a generic data repository for my Entity Framework solution?

I recently created a quick console application that required CRUD activities on a SQL database. I had a few tables to update and did not want the headache of creating multiple items in my DAL. Enter a generic data repository. The code is pretty simple: 1. Create a base interface for the CRUD operations public interface IGenericDataRepository<T> where T : class     {         List<T> GetAll(params Expression<Func<T, object>>[] navigationProperties);         List<T> GetList(Func<T, bool> where, params Expression<Func<T, object>>[] navigationProperties);         T GetSingle(Func<T, bool> where, params Expression<Func<T, object>>[] navigationProperties);         void Add(params T[] items);         void Update(params T[] items);         void Remove(params T[] items);     ...

Azure: How do I create an MVC site to load files to BLOB storage?

I recently created a simple POC site to load files to blob storage containers in Azure. Here is how I achieved it. My code is based on the sample provided  here After creating a simple MVC web project, I added the following nuget packages: DropZone WindowsAzure.Storage Microsoft.WindowsAzure.ConfigurationManager The code is pretty simple: Here is Index.cshtml: @model List<string> <script src="~/Scripts/dropzone/dropzone.min.js"></script> <script src="~/Scripts/bootstrap.min.js"></script> <link href="~/Scripts/dropzone/dropzone.min.css" rel="stylesheet" /> <div class="jumbotron">     <h2>FILE UPLOAD</h2>     <form action="~/Home/Upload"           class="dropzone"           id="dropzoneJsForm"           style="background-color:#00BFFF"></form>         <button id="refresh" onc...