Tuesday, August 30, 2011

FubuMVC - Nuget

FubuMVC now is available via Nuget.Org.

You can install this package in Visual Studio's Package Manager Console by this command.

Install-Package FubuMVC

if you are not interested in Fubu's other packages( Spark, FubuMVC.Validation...) you can get the minimal version on nuget.

Install-Package FubuMVC.References

Also, a nice document is designed by the development team.
Take look at FubuMVC Documents.

Friday, August 26, 2011

EF Code-First in the shape of NHibernate - Profiling



ORM tools made datacentric programs too easy to develop, but if it's been used without care, it will soon face a disaster in terms of SQL efficiency.
Microsoft proposes a tool for the developers who wants to know what is happening under the hood in EF.
It means, all SQL statements and information can be traced and logged in a file based on the developer's desire.
All you have to do is :
   1. Install two wrappers for EntityFramework from Nuget.org

  •    CommunityEFProviderWrappers.EFProviderWrapperToolkit
  •    CommunityEFProviderWrappers.EFTracingProvider

   2. Create a DbConnection object that is configured to log SQL staements like the one below and inject this object into DbContext.

var context = new DbContext(CreateTracingConnection(connectionString, "System.Data.SqlClient");
        detail implementation of CreateTracingConnection is written below.


   3. EnableTracing for data context.

      ((IObjectContextAdapter)this).ObjectContext.EnableTracing();

By this approach, you definitely know what commands are being executed when your application is running in debug mode.