Entities and Models in large ASP.NET MVC application

ASP.NET MVC is a presentation framework. To build a largeĀ application, a few more architectural components are required. In the post, a greeting is retrieved from the database and displayed in the UX. Data Access Layer Data access layer is distributed into three assemblies: HelloWorldApp.Entities HelloWorldApp.Repositories HelloWorldApp.Repositories.Contracts Greeting class

IGreetingRepository interface

GreetingRepository class

Business Logic Layer The business[…]

Read more

Random Select using Fisher Yates algorithm

Today, I had a chance to use Fisher Yates algorithm. Here is the problem statement: Out of an array of N items, randomly pick K items where 0 < K < N. My first version of the algorithm was as follows:

The code above has two problems: When n == k, the loop takes a long time to complete.[…]

Read more