Entity Framework is Open Source Now!!!

Just in time when I have invested my time heavily on Asp.net MVC + Entity Framework, MS has announced that EF is now Open Source. This is huge. This will help me better understand the inner workings of EF and better design my applications.

As a reminder, Asp.net MVC is already Open source. Going through the code helped me understand how model binding work. 

Earlier I was nHibernate guy. Now I have totally switched to EF and this news further solidifies my leanings towards EF.

EF source code can be downloaded at http://entityframework.codeplex.com. It can be downloaded as a GIT repository. I was actually expecting a Zip file. But again, I can live with git based download too. 🙂

 


How to set Html.RadioButtonFor as selected by default in Asp.net MVC3

The below is the code snippet of how to use the Html helper for Radio Button in Asp.net MVC.

<td> Will Accept?</td>

 <td>

@Html.RadioButtonFor(x => x.WillAccept, true)

@Html.RadioButtonFor(x => x.WillAccept, false)

</td>

 

Now how can we show one radio button selected by default? There are two ways of doing it.

The first option is to pass the “checked” html attribute as a parameter to the Html helper method by creating an anonymous object as below

<td> Will Accept?</td>

<td>

@Html.RadioButtonFor(x => x.WillAccept, true, new { @checked = “checked” })

@Html.RadioButtonFor(x => x.WillAccept, false)

</td>

The Second option is to set the value of the corresponding model property in the controller itself

public ActionResult Feedback()

{

UserResponse usr= new UserResponse();

usr.WillAccept = false;

return View(“Feedback”,usr);

}

Both work perfectly, but note that, setting the value via model overrides passing via html parameter. So if both of the above options are used the default value of the radio button will be false.

Leave a reply if you find it useful


Asp.net vs LAMP – Case of Digg and StackOverflow Sites

ScottGu retweeted an interesting post today about Digg and StackOverflow

Nice RT @spolsky Digg: 200MM page views, 500 servers. Stack Overflow: 60MM page views, 5 servers. What am I missing?

then goes on to retweet the reason too

RT @spolsky (nb Stack Overflow is ASP.NET MVC + SQL Server, Digg was LAMP)

now that is very bold to claim isnt it..? Is PHP on Linux that bad in terms of performance..? I did some search and it seems the claim might be indeed valid at least as per the below link

http://www.computerworld.com/s/article/9017778/How_Digg.com_uses_the_LAMP_stack_to_scale_upward_

I will try to post some ASP.net MVC related stuff in coming weeks.