How to use PagedList In MVC

PagedList.Mvc is one of many good paging and sorting packages for ASP.NET MVC, in the below simple example I'm gonna to implement it for content (posts) of a blog post, install the PagedList.Mvc via nuget and take a look at this code. This is an action which returns blog posts:

  1.        public ActionResult List(int? page)
  2.         {
  3.             var posts = _blogService.GetAllBlogPosts();
  4.             var pageNumber ... Continue

Multiple submit buttons in MVC

In MVC you can submit a form by @using(Html.BeginForm()). You can Post the model you have binded via this operation and command the begin form to post to a Post action:   @using(Html.BeginForm("Create","FooController")).

Now if you have more than one submit button to send the page content to different post action, there are few ways: one of them is to post the content to a specific action and then decide in it to redirect which action:


  1. <input type="submit" value="Field1" name=&quo... Continue

Domain driven design VS model driven architecture

Domain Driven design(DDDesign) is not the same Model Driven Architecture(MDA). Although The root of both DDDesign and MDA is the same and it is Model Driven Engineering and also both of them aim to solve the problem of converting a 'pure' problem domain model into a full software system. But there are some differences.

Domain Driven Design concentrates on Modeling and solving the Domain problem by Capturing the model from Ubiquitous language. it is about m... Continue

What's the DDD-lite?

Based on Vaughn Vernon 's definition , "DDD-Lite is a means of picking and choosing a subset of the DDD tactical patterns, but without giving full attention to discovering, capturing, and enhancing the Ubiquitous Language." most of DDD-like approaches are not really DDD! If you don’t have bounded contexts so Ubiquitous language(UL) doesn't mean anything and if you have no UL, you won't have business rules.

In DDD, you should ... Continue

Introducing sqlbulktools

In my previews blog post I wrote about Z.bulkOperation. I migrated to sqlbulktools just because it's free with the same ability!(to be frank). Now to see the reason of my migration, fire up visual studio and Install the latest version of the library using the following command in console package manager:

Install-Package sqlbulktools

And get started!

  1.  static void Main(string[] args)
  2.         {
  4.           &nb... Continue

Fluent Nhibernate Sample Project in MVC

Nhibernate is an ORM designed for Microsoft.Net, it's free and open source and it's a port of java mapper to Dot Net. And fluent Nhibernate is a separate version of Nhibernate which lets you write your entities according to your business instead of starting from creating tables, fluent Nhibernate is just a fluent API for mapping classes with NHibernate. what an ORM does, is persisting object In database and then retrieving when it is needed, indeed it translates the object to database and vice versa.

In Entity Framework yo... Continue

How to query over Icollection<> of a type with linq

When you are implementing many to many relation in SQL, in the case of using entity framework code fist you must use Icollection<> or Ilist<> of an entity. Imagine that you have this classes , an Author class which has a collection of books

  1.     public class Author
  2.     {
  3.         public int Id { get; set; }
  4.         public string FirstName { get; set; }
  5.         public string LastName { get; set; }
  7.   &nbs... Continue

Redis as a cache server

Although Redis is much more than a cache, But it's possible to use as cache server specially in distributed applications. Redis lets you operate on the values and it's just a key value pair in memory database.

To getting start, get the latest version of Redis from here and install in your  windows machine (Server) by instruction and run it in your services. Redis runs in your server machine (you can have redis server and client in one machine which could be you client development machine) and you call it from client by a library... Continue

Layer Supertype pattern with example in C#

First of all look at the definition by @martinfowler "A type that acts as the supertype for all types in its layer" all you need is a Supertype Class for all the Objects. I usually use it in Repository layer as a generic Repository. I recommend to use it if you have more than one kind of object in your layer. Let's consider an example in real world , Create a class and name it Profile

  1.    public class Profile
  2.     {
  3.         public string Name { get; set; }
  4.     &n... Continue

Around big data world explosion

"Big data is a collection of data sets so large and complex that it becomes difficult to process using on-hand database management tools or traditional data processing applications. The challenges include capture, curation , storage, search, sharing, transfer, analysis, and visualization. The trend to larger data sets is due to the additional information derivable from analysis of a single large set of related data, as compared to separate smaller sets with the same total amount of data, allowing correlations to be found to "spot business trends, d... Continue