Archives

Archives / 2011
  • Building a Windows Azure App using Azure Queue, Azure Table and ASP.NET MVC Web Role

    In this post, I will demonstrate a Windows Azure app using Azure Queue, Azure Table and a ASP.NET MVC 4 Web Role application. This post is explaining few initial steps for building a demo Azure app where asynchronous commands (write operations that changes the data) put into Azure Queue and an Azure Work Role will persist the data into Azure Table from Queue messages for the read operations. The source code is available from http://azurehack.codeplex.com/ .The demo application will modify and add more functionality on later.

  • Startup Tasks for Windows Azure Roles

    Windows Azure supports startup tasks that can be use to perform operations and install components before your Azure Role starts on Virtual Server. You can use to startup tasks to install other software, register COM components, setting registry keys, start another process, etc. This is very useful in many situations where you might want to running an initialization scripts, execute batch files and PowerShell scripts etc before your Role starts. In the past, I had used a startup task to install ASP.NET MVC 3 when ASP.NET MVC 3 web role was not supported. You can add startup tasks by editing the ServiceDefinition.csdef file. The below configuration in the Service Definition  file will add a startup task.

  • Commands, Command Handlers and Command Dispatcher

    In this post, I am trying to add some CQRS principles onto my EFMVC project. EFMVC is a small web app for demonstrating ASP.NET MVC and EF Code First. Please keep in mind that this is not the implementation CQRS patterns, but trying to add some CQRS flavors on the Solution Architecture with Commands that changes the data (Create, Update and Delete). The current implementation of command execution is implemented in a synchronous way. 

  • EFMVC 1.0 Preview Released

    A while ago, I have released EFMVC, a demo web app built using ASP.NET MVC 3, EF Code First and Unity. The EFMVC app has demonstrated many architectural patterns and practices such as Generic Repository, Repository pattern, Unit of Work pattern, Dependency Injection pattern and Application Service later.  Today I would like to announce the release of EFMVC 1.0 Preview. This release is an early preview release that has made some changes in the solution architecture.  The preview is written in ASP.NET MVC 3 version and will be migrated to ASP.NET MVC 4 with new features on later.

  • Removing EdmMetadata table in EF Code First

     EF Code First Framework is using a table named EdmMetadata on the database to check the current model is compatible with the database. When your model is changing, you need to drop the database and create a new database. In that scenario, you can add a initialization strategy using DropCreateDatabaseIfModelChanges<TContext>. You can avoid the EdmMetadata table from your database so it won't check the schema of database with model. When you are using Code First Migrations or updating your database schema is manually, you don't need to EdmMetadata on the database. The following code in the DbContext class will not create EdmMetadata on the database.

  • Autofac - My Choice of IoC Container

    I have been using Unity for dependency injection since the early days of ASP.NET MVC framework. Recently I have evaluated other IoC containers and really impressed with Autofac. The next version of my codeplex project EFMVC will be use Autofac as IoC container.  Autofac is a lightweight IoC container that providing better performance and can easily integrate with .NET applications. Autofac is developed by Nicholas Blumhardt and the community is actively working on the code base.

  • Auto Registration in Microsoft Unity

    Unlike many other .NET IoC containers, Microsoft Unity does not support auto registrations. Auto registration is a very useful feature for any IoC container and it would be very helpful in some specific contexts.  The Unity Auto Registration project in Codeplex will provide the support for automatic registration using a fluent API. You can add Unity Auto Registration package using NuGet. The following command will add reference to Unity Auto Registration.

    PM> Install-Package UnityAutoRegistration

    The following registration syntax will scan the all assemblies except system assemblies and will register all types that implemented the open generic type ICommandHandler<> 

  • Building JavaScript MVVM apps in ASP.NET MVC using KnockoutJS

    JavaScript is getting more attention in modern web application development and increasing the popularity of JavaScript on every day. HTML 5 is making a revolution in web apps world and it is becoming a common platform for variety of scenarios. JavaScript is the language for HTML 5. The next question is how we can write highly maintainable JavaScript code and how to write testable JavaScript code. The answer would be to use a high level JavaScript framework such as KnockoutJS, BackboneJS and SpineJS. In this post, I will demonstrate how to use KnockoutJS in your ASP.NET MVC apps. KnockoutJS is an open source JavaScript library developed by Steven Sanderson. I am a big admirer of Steven Sanderson so I decided to first evaluate  KnockoutJS  and really excited about the framework so far. You can download the source code of the demo app from here

  • Speaking at Kerala Microsoft User Group on JavaScript MVVM and KnockoutJS

    I will be speaking about JavaScript MVVM and KnockoutJS at Kerala Microsoft User Group, Kochi on August 20. In this session, I will provide an overview of KnockoutJS, a MVVM framework for creating rich, interactive  user interfaces with JavaScript and HTML. Finally, I will demonstrate how to use KnockoutJS in your ASP.NET/ASP.NET MVC applications. The event details  available from here.  

  • EF Code First Migrations August 2011 CTP Released

    EF Code First is a great ORM tool which lets you to develop applications in a Domain Driven approach. One of the pain point of EF Code First was the data migrations when your domain model is changing. Finally the ADO.NET team is providing a data migration solution for EF Code First that will incrementally evolve the database schema as you model changes over time. The ADO.NET team has released the CTP version of Code First migration solution named EF Code First Migrations August 2011 CTP. EF Code First Migrations is available as NuGet package named EntityFramework.SqlMigrations. The following command in the NuGet console will install the the EF Code First Migrations

  • Using MvcPaging in ASP.NET MVC Apps

    In this post, I will demonstrate how to use NuGet package MvcPaging in ASP.NET MVC apps. MvcPaging provides a Pager HtmlHelper that renders a pager based on a PagedList implementation. MvcPaging’s Pager helper is also providing Ajax functionality for the paging implementation. You can add MvcPaging package via NuGet. The following command in the NuGet console will install MvcPaging in your project.

  • ASP.NET Universal Providers (System.Web.Providers)

    Microsoft Web Platform and Tools (WPT)  team has announced the release of ASP.NET Universal Providers that allows you to use Session, Membership, Roles and Profile providers along with all editions of SQL Server 2005 and later. This support includes Sql Server Express, Sql Server CE and Sql Azure.ASP.NET Universal Providers is available as a NuGet package and the following command will install the package via NuGet.

  • mvc-mini-profiler - An effective mini profiler for ASP.NET MVC

    The mvc-mini-profiler is a lightweight, but effective mini profiler tool for ASP.NET apps specially designed for ASP.NET MVC 3 apps. The mvc-mini-profiler is an free and open source tool from Stack Overflow team. The tool is initially developed for StackOverflow family of websites and open sources the tool later. This is an another great open source tool from Stack Overflow team after Dapper object mapper for .Net. The mvc-mini-profiler is available from http://code.google.com/p/mvc-mini-profiler/ . The mvc-mini-profiler is also available as a NuGet package .

  • Azure Storage Explorer

    Azure Storage Explorer is an open source tool at Codeplex that can allow you to inspecting and altering the data in your Windows Azure Storage projects including the logs of your cloud-hosted applications. Azure Storage Explorer is an excellent GUI tool that will be a very useful when you are working with Azure storage services. All 3 types of cloud storage can be viewed and edited: blobs, queues, and tables.

  • Using Windows Azure AppFabric Caching

    Microsoft has announced the production version of Windows Azure AppFabric Caching service. Today, scalability and performance are the most challenging areas in enterprise application development and a distributed caching solution can avoid unnecessary round-trips to the database and give you better performance and even better availability. The Windows Azure AppFabric Caching service lets you create high performance apps for the Windows Azure cloud computing platform. Windows Azure AppFabric Caching is a distributed in-memory Cache platform hosted in Windows Azure. AppFabric Caching caches all types of data such as CLR objects, XML, binary data etc. Windows Azure AppFabric Caching service is an extensible caching platform that can also use as a storage mechanism for ASP.NET Session and ASP.NET page output caching.

  • SQL Azure Migration Wizard Tool

    The SQL Azure Migration Wizard (SQLAzureMW) is an open source tool at CodePlex that can help you migrate your SQL Server database to SQL Azure.The SQL Azure Migration Wizard tools will help you analyze your SQL Server database for compatibility issues and will migrate your schema and data to SQL Azure. Check out the SQLAzureMW tool from http://sqlazuremw.codeplex.com/. the SQLAzureMW tool can use to migrate the data between the following

  • ASP.NET MVC 3 Tools Update

    Microsoft has released a new update for ASP.NET MVC 3 named  ASP.NET MVC 3 Tools Update. ASP.NET MVC 3 Tools Update won’t update the MVC 3 runtime and it  only updates the tooling for ASP.NET MVC 3. ASP.NET MVC 3 Tools Update is also includes the NuGet 1.2 version. You can download the ASP.NET MVC 3 Tools Update from here.

  • Entity Framework 4.1 Release Candidate Released

    Microsoft ADO.NET team has announced the Release Candidate version of Entity Framework 4.1. You can download the  Entity Framework 4.1 Release Candidate from here . You can also use NuGet to get Entity Framework 4.1 Release Candidate. The Code First approach is available with Entity Framework 4.1.I have upgraded my ASP.NET MVC 3/EF Code First demo web app (http://efmvc.codeplex.com) to Entity Framework 4.1  version

  • Mobile enabled web apps with ASP.NET MVC 3 and jQuery Mobile

    In my previous blog posts, I have demonstrated a simple web app using ASP.NET MVC 3 and EF Code First. In this post, I will be focus on making this application for mobile devices. A single web site will be used for both mobile browsers and desktop browsers. If users are accessing the web app from mobile browsers, users will be redirect to mobile specific pages and will get normal pages if users are accessing from desktop browsers. In this demo app, the mobile specific pages are maintained in an ASP.NET MVC Area named Mobile and mobile users will be redirect to MVC Area Mobile.

  • Dependency Injection in ASP.NET MVC 3 using DependencyResolver and ControllerActivator

    In my previous examples for dependency injection in ASP.NET MVC, I have used an approach where creating a custom controller factory deriving from DefaultControllerFactory and override the GetControllerInstance method for dependency injection. But ASP.NET MVC 3 is providing great support for dependency injection with very nice abstraction. In this post, I will demonstrate how to achieve dependency injection using two interfaces introduced in ASP.NET MVC 3 - IDependencyResolver and IControllerActivator. Unity 2.0 will be using as the dependency injection  container for this demo app.

  • Developing web apps using ASP.NET MVC 3, Razor and EF Code First - Part 2

    In my previous post Developing web apps using ASP.NET MVC 3, Razor and EF Code First - Part 1, we have discussed on how to work with ASP.NET MVC 3 and EF Code First for developing web apps. We have created generic repository and unit of work with EF Code First for our ASP.NET MVC 3 application and did basic CRUD operations against a simple domain entity. In this post, I will demonstrate on working with domain entity with deep object graph, Service Layer and View Models and will also complete the rest of the demo application. In the previous post, we have done CRUD operations against Category entity and this post will be focus on Expense entity those have an association with Category entity. You can download the source code from http://efmvc.codeplex.com .

  • Developing web apps using ASP.NET MVC 3, Razor and EF Code First - Part 1

    In this post, I will demonstrate web application development using ASP. NET MVC 3, Razor and EF code First. This post will also cover Dependency Injection using Unity 2.0 and generic Repository and Unit of Work for EF Code First.You can download the source code from http://efmvc.codeplex.com.The following frameworks will be used for this step by step tutorial.