<feed xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US">
    <title>C# ASP.NET UTILS</title>
    <link rel="self" type="application/xml" href="http://geekswithblogs.net/diadiora/Atom.aspx" />
    <subtitle type="html">Programming blogus :-)</subtitle>
    <id>http://geekswithblogs.net/diadiora/Default.aspx</id>
    <author>
        <name>Diadiora Alexandru</name>
        <uri>http://geekswithblogs.net/diadiora/Default.aspx</uri>
    </author>
    <generator uri="http://subtextproject.com" version="Subtext Version 0.0.0.0">Subtext</generator>
    <updated>2009-04-21T00:31:34Z</updated>
    <entry>
        <title>Difference between Mocks and Stubs.</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/diadiora/archive/2009/04/21/difference-between-mocks-and-stubs.aspx" />
        <id>http://geekswithblogs.net/diadiora/archive/2009/04/21/difference-between-mocks-and-stubs.aspx</id>
        <published>2009-04-21T00:29:00-05:00:00</published>
        <updated>2009-04-21T00:31:34Z</updated>
        <summary type="html">There are nowadays two terms that are used by the developers : 'stub' and 'mock'. </summary>
        <content type="html">&lt;p&gt;&lt;font face="Arial"&gt;There are nowadays two terms that are used by the developers : 'stub' and 'mock'. As I found in &lt;/font&gt; &lt;/p&gt;
&lt;p&gt;the article of Martin Fowler 'Mocks Aren't Stubs', he is using the vocabulary of Gerard &lt;/p&gt;
&lt;p&gt;Meszaros's book, where there is the division into : 'dummy', 'fake', 'stub' and 'mock' points. &lt;/p&gt;
&lt;p&gt;I'll metnion only what 'dummy' and 'fake' are, and I'll try to concentrate over 'mock' and &lt;/p&gt;
&lt;p&gt;'stub'. So 'dummy' objects as Thesaurus says represents a copy, figure, form, model in its mean. &lt;/p&gt;
&lt;p&gt;In reallity passing to developper language, the goal of dummy objects is to be passed, in this &lt;/p&gt;
&lt;p&gt;sence the general use of dummy objects is to fill parameter lists. I should metion that 'dummy' &lt;/p&gt;
&lt;p&gt;objects do not have their working implementation. If we are speaking about 'fake' objects, than &lt;/p&gt;
&lt;p&gt;from the beginning we must emphasize that these type objects have their implementations, an &lt;/p&gt;
&lt;p&gt;important point of distinguishing here is that 'fake' objects are not used for production, they &lt;/p&gt;
&lt;p&gt;represent something like an alternate route, timesaving method. For example an SQLLite database &lt;/p&gt;
&lt;p&gt;represents a 'fake' object.&lt;br /&gt;
In the following part of this article I'll try to concentrate on two important concepts: 'stub' &lt;/p&gt;
&lt;p&gt;and 'mock'. Many often confuse these terms speaking about them as about the same thing. From the &lt;/p&gt;
&lt;p&gt;conceptual point of view they both represent methodologies that share some common things. I &lt;/p&gt;
&lt;p&gt;thinks there is also an historical motivation of the confusion between them: from the first &lt;/p&gt;
&lt;p&gt;appeared the therm 'stub' and it was used for a long period of time, when in some communities &lt;/p&gt;
&lt;p&gt;appeared and started to be used the them of 'mock'. On the first glance they are suitable to &lt;/p&gt;
&lt;p&gt;accomplish the same things. I can caracterize a 'mock' as an imitation or make-believe, and a &lt;/p&gt;
&lt;p&gt;'stub' as a dock. The 'mock' object request the behavior check, while 'stub' is for state check. &lt;/p&gt;
&lt;p&gt;The 'mock' represents an object that englobes a specification of expectations for the calls it is &lt;/p&gt;
&lt;p&gt;expected to receive, while 'stub' represents preserved answers to requests that are made during &lt;/p&gt;
&lt;p&gt;the test ( as a rule, the 'stub' does not respond to smth else that's programmed especially for &lt;/p&gt;
&lt;p&gt;the test). &lt;/p&gt;
&lt;p&gt;&lt;br /&gt;
We'll examine an example of using 'mock' and 'stub' in the same scenario and we'll get deeper &lt;/p&gt;
&lt;p&gt;into discussion based on some code. So we have the situation that based on the number of users on &lt;/p&gt;
&lt;p&gt;a portal, the owner of the portal receives an sms on his mobile phone to be informed about the &lt;/p&gt;
&lt;p&gt;event. Let's assume that at 100.000 visitors he gets a message about this. We'll use Rhino Mocks &lt;/p&gt;
&lt;p&gt;and NUnit for our testing purposes.&lt;/p&gt;
&lt;p&gt;Class Msg - a simple CLR object that encapsulates the message to be send via SMS:&lt;/p&gt;
&lt;p&gt; public class Msg&lt;br /&gt;
 {&lt;br /&gt;
  private string message;&lt;br /&gt;
  public Msg(string message)&lt;br /&gt;
  {&lt;br /&gt;
   this.message = message;&lt;br /&gt;
  }&lt;/p&gt;
&lt;p&gt;  public string Message &lt;br /&gt;
  { &lt;br /&gt;
   get&lt;br /&gt;
   {&lt;br /&gt;
    return message;&lt;br /&gt;
   }&lt;br /&gt;
   set&lt;br /&gt;
   {&lt;br /&gt;
    message = value;&lt;br /&gt;
   }&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;/p&gt;
&lt;p&gt;Interface IServiceSMS contains the method Send() for sending the SMS:&lt;/p&gt;
&lt;p&gt; using TheDiff.BusinessObjects;&lt;/p&gt;
&lt;p&gt; namespace TheDiff.Interfaces&lt;br /&gt;
 {&lt;br /&gt;
     public interface IServiceSMS&lt;br /&gt;
     {&lt;br /&gt;
         bool Send(Msg msg);&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;/p&gt;
&lt;p&gt;Class for tests MockTests:&lt;/p&gt;
&lt;p&gt;using Rhino.Mocks;&lt;br /&gt;
using NUnit.Framework;&lt;br /&gt;
using TheDiff.BusinessObjects;&lt;br /&gt;
using TheDiff.Interfaces;&lt;/p&gt;
&lt;p&gt;namespace TheDiff&lt;br /&gt;
{&lt;br /&gt;
    [TestFixture]&lt;br /&gt;
    public class MockTests&lt;br /&gt;
    {&lt;br /&gt;
        private IServiceSMS serviceSMS;&lt;br /&gt;
        [SetUp]&lt;br /&gt;
        public void SetUp()&lt;br /&gt;
        {&lt;br /&gt;
            serviceSMS = MockRepository.GenerateMock&amp;lt;IServiceSMS&amp;gt;();&lt;br /&gt;
        }&lt;/p&gt;
&lt;p&gt;        [Test]&lt;br /&gt;
        public void Mocker()&lt;br /&gt;
        {&lt;br /&gt;
            var msg = new Msg("Online users are 100.000!");&lt;br /&gt;
            serviceSMS.Expect(x =&amp;gt; x.Send(msg)).Return(true);&lt;br /&gt;
            var wasSent = serviceSMS.Send(msg);&lt;br /&gt;
            Assert.IsTrue(wasSent);&lt;br /&gt;
            serviceSMS.VerifyAllExpectations();&lt;br /&gt;
        }&lt;/p&gt;
&lt;p&gt;    }&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;Class for tests StubTests:&lt;/p&gt;
&lt;p&gt;using Rhino.Mocks;&lt;br /&gt;
using NUnit.Framework;&lt;br /&gt;
using TheDiff.BusinessObjects;&lt;br /&gt;
using TheDiff.Interfaces;&lt;/p&gt;
&lt;p&gt;namespace TheDiff&lt;br /&gt;
{&lt;br /&gt;
    [TestFixture]&lt;br /&gt;
    public class StubTests&lt;br /&gt;
    {&lt;br /&gt;
        private MockRepository mocks;&lt;br /&gt;
        private IServiceSMS serviceSMS;&lt;br /&gt;
        [SetUp]&lt;br /&gt;
        public void SetUp()&lt;br /&gt;
        {&lt;br /&gt;
            mocks = new MockRepository();&lt;br /&gt;
            serviceSMS = mocks.Stub&amp;lt;IServiceSMS&amp;gt;();&lt;br /&gt;
        }&lt;/p&gt;
&lt;p&gt;        [Test]&lt;br /&gt;
        public void Stuber()&lt;br /&gt;
        {&lt;br /&gt;
            var msg = new Msg("Online users are 100.000!");&lt;/p&gt;
&lt;p&gt;            using (mocks.Record())&lt;br /&gt;
            {&lt;br /&gt;
                SetupResult.For(serviceSMS.Send(msg)).Return(true);&lt;br /&gt;
            }&lt;br /&gt;
            var wasSent = serviceSMS.Send(msg);&lt;br /&gt;
            Assert.IsTrue(wasSent);&lt;br /&gt;
        }&lt;/p&gt;
&lt;p&gt;    }&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt; &lt;/p&gt;&lt;img src="http://geekswithblogs.net/diadiora/aggbug/131344.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/diadiora/comments/131344.aspx</wfw:comment>
        <slash:comments>1</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/diadiora/comments/commentRss/131344.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/diadiora/services/trackbacks/131344.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Domain Driven Design Step 2</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/diadiora/archive/2009/03/08/domain-driven-design-step-2.aspx" />
        <id>http://geekswithblogs.net/diadiora/archive/2009/03/08/domain-driven-design-step-2.aspx</id>
        <published>2009-03-08T20:56:43-05:00:00</published>
        <updated>2009-03-08T21:01:11Z</updated>
        <summary type="html">SharpArhitecture use FluentValidators instead of NHibernate Validators.</summary>
        <content type="html">&lt;p&gt;I want to mention SharpArhitecture project. This represents a solid architectural foundation for rapidly building maintainable web applications leveraging the ASP.NET MVC framework with NHibernate.&lt;/p&gt;
&lt;p&gt;What I want here is to show some advantages/disadvantages and the points of interested that I faced up. So when analysing the possibilities that this code offers, I discovered that :&lt;/p&gt;
&lt;p&gt;1) NHibernate validation is not suitable for a series of scenarious that mostly enterprise level applications require. Let's assume that we have the following scenario: there is the entity 'case' and this entity should be introduced (inserted) in our system by the worker with position 'Secretary'. The Secretary shoul introduce only the CaseName. Later the worker that is in position 'President' should alter the case and set the number.&lt;/p&gt;
&lt;p&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; &lt;span class="type"&gt;Case&lt;/span&gt;&lt;br /&gt;
{&lt;br /&gt;
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;virtual&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Id  { &lt;span class="kwrd"&gt;get&lt;/span&gt; { &lt;span class="kwrd"&gt;return&lt;/span&gt; id; }  }&lt;/p&gt;
&lt;p&gt;  [&lt;span class="type"&gt;NotEmpty&lt;/span&gt;, &lt;span class="type"&gt;NotNull&lt;/span&gt;]&lt;br /&gt;
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;virtual&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; CaseName  {  &lt;span class="kwrd"&gt;get&lt;/span&gt; ; &lt;span class="kwrd"&gt;set&lt;/span&gt; ;  }&lt;br /&gt;
&lt;br /&gt;
  [&lt;span class="type"&gt;Email&lt;/span&gt;]&lt;br /&gt;
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;virtual&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Email {  &lt;span class="kwrd"&gt;get&lt;/span&gt; ; &lt;span class="kwrd"&gt;set&lt;/span&gt; ;  }&lt;br /&gt;
&lt;br /&gt;
  [&lt;span class="type"&gt;Min&lt;/span&gt;(20000, Message=&lt;span class="str"&gt;"The number should be greater than 20000!"&lt;/span&gt;)]&lt;br /&gt;
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Nr{  &lt;span class="kwrd"&gt;get&lt;/span&gt; ; &lt;span class="kwrd"&gt;set&lt;/span&gt; ;  }&lt;br /&gt;
  &lt;br /&gt;
  &lt;span class="rem"&gt;///... &lt;/span&gt;&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;In the scenario described above we better have also 2 validation scenarious. It's a simple case, but assume that when creating the record the number should be greater than 20000 and when updating the record the Number should be less 2000. Of course non-sense here, but assume it's a custom scenario. Than in this case the NHibernate validators are not suitable for accomplishing the validation. &lt;/p&gt;
&lt;p&gt;I solved this issue by eliminationg the Nhibernate validators and pass to FluentValidation framework. Now I have different validator classes for different scenaious. It's more flexible approach and gives the power of more deep validation.&lt;/p&gt;
&lt;p&gt;The advantage is considerable we don't tie the validation to the entity. We have in my case:&lt;/p&gt;
&lt;p&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; &lt;span class="type"&gt;Case&lt;/span&gt;&lt;br /&gt;
{&lt;br /&gt;
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;virtual&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Id  { &lt;span class="kwrd"&gt;get&lt;/span&gt; { &lt;span class="kwrd"&gt;return&lt;/span&gt; id; }  }&lt;/p&gt;
&lt;p&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;virtual&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; CaseName  {  &lt;span class="kwrd"&gt;get&lt;/span&gt; ; &lt;span class="kwrd"&gt;set&lt;/span&gt; ;  }&lt;br /&gt;
&lt;br /&gt;
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;virtual&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Email {  &lt;span class="kwrd"&gt;get&lt;/span&gt; ; &lt;span class="kwrd"&gt;set&lt;/span&gt; ;  }&lt;br /&gt;
&lt;br /&gt;
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt; Nr{  &lt;span class="kwrd"&gt;get&lt;/span&gt; ; &lt;span class="kwrd"&gt;set&lt;/span&gt; ;  }&lt;br /&gt;
  &lt;br /&gt;
  &lt;span class="rem"&gt;///... &lt;/span&gt;&lt;br /&gt;
}&lt;/p&gt;
&lt;p&gt;and some classes for validation with structure similar to:&lt;/p&gt;
&lt;p&gt;public class CaseValidator:AbstractValidator&amp;lt;Case&amp;gt;&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;public CaseValidator(){}&lt;/p&gt;
&lt;p&gt;RuleFor(x=&amp;gt;x.CaseName).NotEmpty();&lt;/p&gt;
&lt;p&gt;RuleFor(x=&amp;gt;x.CaseName).NotNull();&lt;/p&gt;
&lt;p&gt;//..&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;that have different set of rules for validation that meets my custom scenarious. &lt;font color="#dfdfbf" size="3"&gt;&lt;font color="#dfdfbf" size="3"&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;img src="http://geekswithblogs.net/diadiora/aggbug/129929.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/diadiora/comments/129929.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/diadiora/comments/commentRss/129929.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/diadiora/services/trackbacks/129929.aspx</trackback:ping>
    </entry>
    <entry>
        <title>MBUnit Plugin for Resharper </title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/diadiora/archive/2009/02/04/mbunit-plugin-for-resharper.aspx" />
        <id>http://geekswithblogs.net/diadiora/archive/2009/02/04/mbunit-plugin-for-resharper.aspx</id>
        <published>2009-02-04T01:38:53-06:00:00</published>
        <updated>2009-02-04T01:43:44Z</updated>
        <content type="html">&lt;p&gt;To run the tests that use MBUnit, you should install the following plugin for resharper: &lt;a href="http://code.google.com/p/mbunit-resharper/" target="_blank"&gt;MbUnit Plugin Resharper&lt;/a&gt;, in this case you'll never fail again when you choose 'Run Unit Tests' in the context menu.&lt;/p&gt;&lt;img src="http://geekswithblogs.net/diadiora/aggbug/129192.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/diadiora/comments/129192.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/diadiora/comments/commentRss/129192.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/diadiora/services/trackbacks/129192.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Asp.net cpu loads to maximum, cpu leak 100%</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/diadiora/archive/2009/01/21/asp.net-cpu-loads-to-maximum-cpu-leak-100.aspx" />
        <id>http://geekswithblogs.net/diadiora/archive/2009/01/21/asp.net-cpu-loads-to-maximum-cpu-leak-100.aspx</id>
        <published>2009-01-21T21:40:33-06:00:00</published>
        <updated>2009-01-21T21:42:35Z</updated>
        <summary type="html">You encounter the problem that your CPU is very high? Don't think it's a disaster, try to check this solution. I may be suitable for you case.</summary>
        <content type="html">Yesterday I have done some changes on a web app, and today when it was send to testing server it was observed that the processor is working on high scale. As it's very clear the fact that almost always the problem of memory leaks fall in memory increasement. But it wasn't the case, only the processor was working intensively. I realized my gap suddenly :-), it was all about the fact that I put on every request end to run the GC. This is why the &lt;em&gt;.NET CLR Memory\% Time in GC&lt;/em&gt;  was showing me these oddities.&lt;br /&gt;
So my advice is the next, use:&lt;br /&gt;
            GC.Collect();&lt;br /&gt;
            GC.WaitForPendingFinalizers();&lt;br /&gt;
only for testing purposes and never in production mode. In production mode you can use it only in very and very indeed needed cases(consider it as an exception), but it's more that your design and code it's not appropriate to accomplish the specified tasks, you should refactor it and avoid using declarative invocation of GC.&lt;img src="http://geekswithblogs.net/diadiora/aggbug/128886.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/diadiora/comments/128886.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/diadiora/comments/commentRss/128886.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/diadiora/services/trackbacks/128886.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Best .NET ORM Tool</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/diadiora/archive/2009/01/12/best-.net-orm-tool.aspx" />
        <id>http://geekswithblogs.net/diadiora/archive/2009/01/12/best-.net-orm-tool.aspx</id>
        <published>2009-01-12T23:21:47-06:00:00</published>
        <updated>2009-01-12T23:41:22Z</updated>
        <summary type="html">In this post I share my experience in choosing the most elegant .NET ORM Tool, that you cand also be in searching of</summary>
        <content type="html">&lt;p&gt;&lt;strong&gt;My Considerations&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Until now I used some custom orm tool (written by me), it was working with stored procedures, because my idea is that the best optimization you may accomplish in sql code. But now as the project increased and its fonctionality has blow up, I realise that in the future must be used some more adapted orm for supporting Domain Model and Data Mapper, with wich can be used in a more simple fashion the concepts of Unit of Work, Repositories etc. I indeed fell the necessity to pass to this kind of aproach because Transaction Script approach that I used in conjuction with Data Mapping leads in hard maintenace problems when in enterprise application you have sophisticated workflows and transactions to be performed.&lt;/p&gt;
&lt;p&gt;I spent some time searching through the existing ORM Mappers (commercial and not only), of course my idea was to find a free mapper, but if another commercial tool is more powerful in the sence that it offer more access in using the enterprise patterns and it's more flexible, than it can be used instead.&lt;/p&gt;
&lt;p&gt;My decision was in favor of NHibernate. First of all it's ported from java environment and has proven its viability over the years and the multitude of serios projects based on it. Of course we can describe different pros and cons of using it, and other OPRMs such as SubSonic or  LBLGEN. But in fact with some more or less effort the things are pretty well done with NHibernate. Second of all it's not as complicated as it seems at first glance, you'll discover that at first examples that you'll do with it. Third it offers very clean and separated approach to perform the necessary operations, I was excited of the granularity that it offers comparing to other similar tools.&lt;/p&gt;
&lt;p&gt;I dislike the fact that more and more vendors try to make their ORMs more simple to use by not allowing the developper to dive into some subtle things that in the end lead to optimisations, that's crucial for serios applications. From my point of view the best approach are stored procedures, because you may fine tune their granularity as you wish, but from the maintenace point of view it's not the best solution. After this approach the best one will be this NHibernate. During surfing the web you can find different tests on the efficiency of this tool compared to other such as EntityFramework and LINQ. I can emphasize that in practically all cases NHibernate generates less sql code than those mentioned. NHibernate is the most closely to pure ADO.NET efficiency. That's why I recommend it.&lt;/p&gt;
&lt;div id="result_box" dir="ltr"&gt;
&lt;p&gt;&lt;strong&gt;Performance Tests&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Next I'll show you the results of some tests:&lt;/p&gt;
&lt;/div&gt;
&lt;div dir="ltr"&gt;The results of the tests several unusual. First, I ran the queries of each test in one set and looked at Query cost for each query, which is about the whole set. &lt;br /&gt;
&lt;br /&gt;
In the first test, I got the following results: &lt;br /&gt;
&lt;br /&gt;
Classic ADO.NET - 15% &lt;br /&gt;
LINQ 2 SQL  = 48% &lt;br /&gt;
Entity Framework - 23% &lt;br /&gt;
Active Record (NHibernate) - 15% &lt;br /&gt;
&lt;br /&gt;
The interesting thing here is that LINQ 2 SQL is indeed slowerthan the request performed by EntityFramework.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In the second test, I have a complex query with joins for LINQ 2 SQL: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Complex queries with joins - 24% &lt;br /&gt;
A set of simple queries - 76% &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As you can see, one request has won, it's not surprising. However, in general, we can say that in terms of databases losses are not as lazy loading too long. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The third test was for EntityFramework: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Complex queries with joins - 19% &lt;br /&gt;
A set of simple queries - 71% &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As you can see, the results are practically similar. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The forth test was for NHibernate: &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Complex queries with joins - 8% &lt;br /&gt;
A set of simple queries - 92% &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
So now you can see by yourself and make some base ideas on how it is.&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;List of  .NET ORM Tools&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt; Next I'll give a list with good .NET ORM Tools, and you may compare them by yourself:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;cite&gt;&lt;a href="http://www.adapdev.com/codus/"&gt;www.adapdev.com/&lt;strong&gt;codus&lt;/strong&gt;/&lt;/a&gt; &lt;/cite&gt;&lt;/li&gt;
    &lt;li&gt;&lt;cite&gt;&lt;cite&gt;&lt;a href="http://www.opf3.com/Opf3/About/Default.aspx"&gt;www.opf3.com/Opf3/About/Default.aspx&lt;/a&gt; &lt;/cite&gt;&lt;/cite&gt;&lt;/li&gt;
    &lt;li&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;a href="http://www.dadosolution.com/object_relational_mapping/index.html"&gt;www.&lt;strong&gt;dado&lt;/strong&gt;solution.com/&lt;strong&gt;object&lt;/strong&gt;_relational_&lt;strong&gt;map&lt;/strong&gt;ping/index.html&lt;/a&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt; &lt;/li&gt;
    &lt;li&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;a href="http://www.devexpress.com/Products/NET/ORM/"&gt;www.dev&lt;strong&gt;express&lt;/strong&gt;.com/Products/&lt;strong&gt;NET&lt;/strong&gt;/ORM/&lt;/a&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt; &lt;/li&gt;
    &lt;li&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;a href="http://www.chilisoftware.net/OPFNET/"&gt;www.chilisoftware.net/&lt;strong&gt;OPFNET&lt;/strong&gt;/&lt;/a&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt; &lt;/li&gt;
    &lt;li&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;a href="http://www.llblgen.com/"&gt;www.&lt;strong&gt;llblgen&lt;/strong&gt;.com/&lt;/a&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt; &lt;/li&gt;
    &lt;li&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;a href="http://www.netdataobjects.com/"&gt;www.netdataobjects.com/&lt;/a&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt; &lt;/li&gt;
    &lt;li&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;a href="http://www.versant.com/products/openaccess/dotnet"&gt;www.&lt;strong&gt;versant&lt;/strong&gt;.com/products/&lt;strong&gt;openaccess&lt;/strong&gt;/dot&lt;strong&gt;net&lt;/strong&gt;&lt;/a&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt; &lt;/li&gt;
    &lt;li&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;a href="http://www.x-tensive.com/Products/DO/"&gt;www.x-tensive.com/Products/DO/&lt;/a&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt; &lt;/li&gt;
    &lt;li&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;strong&gt;&lt;a href="http://www.subsonicproject.com/"&gt;www.subsonic&lt;/a&gt;&lt;/strong&gt;project.com/&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt; &lt;/li&gt;
    &lt;li&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;a href="http://www.nhibernate.org/"&gt;www.&lt;strong&gt;nhibernate&lt;/strong&gt;.org/&lt;/a&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt; &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/cite&gt;&lt;/p&gt;&lt;img src="http://geekswithblogs.net/diadiora/aggbug/128619.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/diadiora/comments/128619.aspx</wfw:comment>
        <slash:comments>7</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/diadiora/comments/commentRss/128619.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/diadiora/services/trackbacks/128619.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Domain Driven Design Step 1</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/diadiora/archive/2008/12/16/domain-driven-design-step-1.aspx" />
        <id>http://geekswithblogs.net/diadiora/archive/2008/12/16/domain-driven-design-step-1.aspx</id>
        <published>2008-12-16T23:42:48-06:00:00</published>
        <updated>2008-12-16T23:47:48Z</updated>
        <summary type="html">Case Study, learning materials for domain driven design, that I suggest to all of you to get aquainted with DDD.</summary>
        <content type="html">&lt;p&gt;So as I dive into DDD - Domain Driven Design, I would like first to recommend to you some good resources following this theme:&lt;/p&gt;
&lt;p&gt;The books:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;'Patterns of Enterprise Application Architecture' by Martin Fowler, David Rice, Matthew Foemmel, Edward Hieatt, Robert Mee and Randy Stafford &lt;/li&gt;
    &lt;li&gt;'Domain Driven Design Quickly' a summary of Eric Evan &lt;/li&gt;
    &lt;li&gt;'.NET Domain-Driven Design with C# ' by Tim McCarthy &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These 3 books provides a real help in understanding the principles and the patterns that are used during domain development. The first book fromk the list in my opinion should be exploited in deep by every programer, because it's a synthesys of high quality design approaches.&lt;/p&gt;&lt;img src="http://geekswithblogs.net/diadiora/aggbug/127998.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/diadiora/comments/127998.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/diadiora/comments/commentRss/127998.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/diadiora/services/trackbacks/127998.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Call a method from MasterPage in Content Page</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/diadiora/archive/2008/12/01/call-a-method-from-masterpage-in-content-page.aspx" />
        <id>http://geekswithblogs.net/diadiora/archive/2008/12/01/call-a-method-from-masterpage-in-content-page.aspx</id>
        <published>2008-12-01T02:58:57-06:00:00</published>
        <updated>2009-01-12T23:42:51Z</updated>
        <summary type="html">Shows you an elegant way of accessing the methods declared in master page from the content page.</summary>
        <content type="html">&lt;p&gt;To access a method from master page in the content page ensure first:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;      The method in master page is declared as &lt;span style="FONT-FAMILY: Courier New"&gt;public&lt;/span&gt;&lt;/p&gt;
    &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;than call this code from your content page code behind:&lt;/p&gt;
&lt;p&gt;                     &lt;span style="FONT-FAMILY: Courier New"&gt;MasterPageClassName MyMasterPage = (MasterPageClassName)Page.Master;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-FAMILY: Courier New"&gt;         MyMasterPage.SetMenuToRegistered();&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;where:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;
    &lt;p&gt;&lt;span style="FONT-FAMILY: Courier New"&gt;SetMenuToRegistered()&lt;/span&gt; - is a method positioned in the master page class.&lt;/p&gt;
    &lt;/li&gt;
&lt;/ul&gt;&lt;img src="http://geekswithblogs.net/diadiora/aggbug/127491.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/diadiora/comments/127491.aspx</wfw:comment>
        <slash:comments>3</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/diadiora/comments/commentRss/127491.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/diadiora/services/trackbacks/127491.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Increase the number of sessions in WCF</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/diadiora/archive/2008/11/26/increase-the-number-of-sessions-in-wcf.aspx" />
        <id>http://geekswithblogs.net/diadiora/archive/2008/11/26/increase-the-number-of-sessions-in-wcf.aspx</id>
        <published>2008-11-26T19:03:49-06:00:00</published>
        <updated>2009-01-12T23:44:11Z</updated>
        <summary type="html">You are stuck into the problem that your WCF application don't support more that 5 users simultaneously? Check it here the answer to your problem.</summary>
        <content type="html">I got a problem on which was spent over two days in order to fix it. The discovery was that in the scenario: one WCF service application that for convinience is hosted in IIS and one WEB application that uses the WCF services the number of users was limited. So if the 11th user tried to access the application he was oblidged to wait an undetermined period of time(and in the end the log process was failing). The process started, first the idea was that maybe we were wrong in our layers, because of static methods used for our singletones and so on.&lt;br /&gt;
  So really the problem is in WCF configuration, I didn't see it by googling my problem. Now I got it, so all you'll have to do in order to increase the number of concurrent users of your application is to add &amp;lt;serviceThrottling /&amp;gt; tag into the &amp;lt;serviceBehaviors&amp;gt; and specify the maximum number of concurrent sessions, like so:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="FONT-FAMILY: Courier New"&gt;      &lt;span style="COLOR: rgb(255,0,255)"&gt;&amp;lt;serviceBehaviors&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br style="FONT-FAMILY: Courier New" /&gt;
&lt;span style="FONT-FAMILY: Courier New"&gt;        &amp;lt;behavior name="BehaviorConfigurationServiceDOS"&amp;gt;&lt;/span&gt;&lt;br style="FONT-FAMILY: Courier New" /&gt;
&lt;span style="FONT-FAMILY: Courier New"&gt;          &amp;lt;serviceMetadata httpGetEnabled="true" /&amp;gt;&lt;/span&gt;&lt;br style="FONT-FAMILY: Courier New" /&gt;
&lt;span style="FONT-FAMILY: Courier New"&gt;          &amp;lt;serviceDebug includeExceptionDetailInFaults="true" /&amp;gt;&lt;/span&gt;&lt;br style="FONT-FAMILY: Courier New" /&gt;
&lt;span style="FONT-FAMILY: Courier New"&gt;          &lt;span style="COLOR: rgb(255,0,0)"&gt;&amp;lt;serviceThrottling maxConcurrentSessions="100" /&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br style="FONT-FAMILY: Courier New" /&gt;
&lt;span style="FONT-FAMILY: Courier New"&gt;          &amp;lt;dataContractSerializer maxItemsInObjectGraph="2147483647" /&amp;gt;&lt;/span&gt;&lt;br style="FONT-FAMILY: Courier New" /&gt;
&lt;span style="FONT-FAMILY: Courier New"&gt;        &amp;lt;/behavior&amp;gt;&lt;/span&gt;&lt;br style="FONT-FAMILY: Courier New" /&gt;
&lt;span style="FONT-FAMILY: Courier New"&gt;      &lt;span style="COLOR: rgb(255,0,255)"&gt;&amp;lt;/serviceBehaviors&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Hope this helps :------))))&lt;br /&gt;
&lt;br /&gt;
Quite a simple solution, but it's not as well documented as it's impementation.&lt;img src="http://geekswithblogs.net/diadiora/aggbug/127420.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/diadiora/comments/127420.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/diadiora/comments/commentRss/127420.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/diadiora/services/trackbacks/127420.aspx</trackback:ping>
    </entry>
    <entry>
        <title>C# Parse(Grab) XML Feeds</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/diadiora/archive/2008/11/26/c-parsegrab-xml-feeds.aspx" />
        <id>http://geekswithblogs.net/diadiora/archive/2008/11/26/c-parsegrab-xml-feeds.aspx</id>
        <published>2008-11-26T02:22:09-06:00:00</published>
        <updated>2008-12-16T23:48:39Z</updated>
        <summary type="html">Easiest way to get the data from RSS Feed.</summary>
        <content type="html">I want to show you one of the simplest way to parse xml feeds that you want to grab from the site offering this functionality. For this we need only a DataSet, that will store the parsed data in his tables. So try for example the following code and you'll see what the dataset contains after execution:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="FONT-FAMILY: Courier New"&gt;            DataSet ds = new DataSet();&lt;/span&gt;&lt;br style="FONT-FAMILY: Courier New" /&gt;
&lt;span style="FONT-FAMILY: Courier New"&gt;            ds.ReadXml("http://weather.yahooapis.com/forecastrss?p=MDXX0003&amp;amp;u=c", XmlReadMode.Auto); &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
And, what do you think? That's all you have to do! Pretty simple, yah!&lt;img src="http://geekswithblogs.net/diadiora/aggbug/127404.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/diadiora/comments/127404.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/diadiora/comments/commentRss/127404.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/diadiora/services/trackbacks/127404.aspx</trackback:ping>
    </entry>
    <entry>
        <title>Get URL from code behind</title>
        <link rel="self" type="text/html" href="http://geekswithblogs.net/diadiora/archive/2008/11/26/get-url-from-code-behind.aspx" />
        <id>http://geekswithblogs.net/diadiora/archive/2008/11/26/get-url-from-code-behind.aspx</id>
        <published>2008-11-26T02:05:58-06:00:00</published>
        <updated>2008-12-16T23:50:15Z</updated>
        <summary type="html">How to establish the correct url of application no matter the server on wich is running the application without configure it in the web.config</summary>
        <content type="html">During the development I faced this problem, but because I have no time to spend to see how to accomplish this, I met for simplicity in my web.config file a key with the right link. But now I have some time to revise the code and adjusted it. The situation is the following: on one server the application is configured to use the following URL in IIS&lt;br /&gt;
&lt;br /&gt;
&lt;span style="FONT-FAMILY: Courier New"&gt;http://localhost/DOD.DefaultWebApp/Information.aspx&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
on another server :&lt;br /&gt;
&lt;br /&gt;
&lt;span style="FONT-FAMILY: Courier New"&gt;http://www.dod.com/Information.aspx&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Now how to accomplish this without using a key in web config file where is stipulated the correct URL address.&lt;br /&gt;
The solution is pretty simple, I solved it like this:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="FONT-FAMILY: Courier New"&gt;string requestedPage = Request.Url.Scheme + "://" + Request.Url.Authority.TrimEnd(Convert.ToChar("/")) + ResolveUrl(LinksWebApp.Information);&lt;/span&gt;&lt;br style="FONT-FAMILY: Courier New" /&gt;
&lt;br /&gt;
this also may be used in aspx, for example:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="FONT-FAMILY: Courier New"&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;/span&gt;&lt;br style="FONT-FAMILY: Courier New" /&gt;
&lt;span style="FONT-FAMILY: Courier New"&gt;window.location='&amp;lt;%=Request.Url.Scheme + "://" + Request.Url.Authority.TrimEnd(Convert.ToChar("/")) + ResolveUrl(LinksWebApp.Information);%&amp;gt;';&lt;/span&gt;&lt;br style="FONT-FAMILY: Courier New" /&gt;
&lt;span style="FONT-FAMILY: Courier New"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
where:&lt;br /&gt;
&lt;br /&gt;
&lt;span style="FONT-FAMILY: Courier New"&gt;public static class LinksWebApp&lt;/span&gt;&lt;br style="FONT-FAMILY: Courier New" /&gt;
&lt;span style="FONT-FAMILY: Courier New"&gt;{&lt;/span&gt;&lt;br style="FONT-FAMILY: Courier New" /&gt;
&lt;span style="FONT-FAMILY: Courier New"&gt;    public static string Information = "~/Information.aspx";&lt;/span&gt;&lt;br style="FONT-FAMILY: Courier New" /&gt;
&lt;span style="FONT-FAMILY: Courier New"&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
NOTE:&lt;br /&gt;
1) I used the syntax :&lt;br /&gt;
      &lt;span style="FONT-FAMILY: Courier New"&gt;Request.Url.Authority.TrimEnd(Convert.ToChar("/"))&lt;/span&gt;&lt;br /&gt;
   instead of&lt;br /&gt;
      &lt;span style="FONT-FAMILY: Courier New"&gt;Request.Url.Authority.TrimEnd('/')&lt;/span&gt;&lt;br /&gt;
  not because I love conversions :-), but it suits the case when we are using this syntax in the js like with &lt;span style="FONT-FAMILY: Courier New"&gt;window.location='...';&lt;/span&gt;&lt;br /&gt;
2) You may adjust with string.Format and other techniques to avoid string invariation, but for simplicity I showed you this  simple code.&lt;img src="http://geekswithblogs.net/diadiora/aggbug/127403.aspx" width="1" height="1" /&gt;</content>
        <wfw:comment>http://geekswithblogs.net/diadiora/comments/127403.aspx</wfw:comment>
        <slash:comments>0</slash:comments>
        <wfw:commentRss>http://geekswithblogs.net/diadiora/comments/commentRss/127403.aspx</wfw:commentRss>
        <trackback:ping>http://geekswithblogs.net/diadiora/services/trackbacks/127403.aspx</trackback:ping>
    </entry>
</feed>