<?xml version="1.0" encoding="UTF-8"?>

<rss version='2.0' 
     xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
     xmlns:doap="http://usefulinc.com/ns/doap#"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">

    <channel>
        <!-- This XML Feed shows details for the page tag4sree 
             and everything recently tagged tag4sree -->
        <creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.5/
          </creativeCommons:license>
        <title>tag4sree on SWiK</title>
        <doap:name>tag4sree</doap:name>
        <doap:description>
</doap:description>
        <description>
</description> 
	  <!-- see doap:description for full description -->
        <link>http://swik.net/tag4sree</link>
        <doap:homepage></doap:homepage>
        
        <pubDate>Fri, 28 Dec 2007 17:53:06 -0800</pubDate>
        <lastBuildDate>Fri, 28 Dec 2007 17:53:06 -0800</lastBuildDate>
            
        <item>
            <title>Generic pipeline for business objects using Castle Windsor</title>
            <link>http://swik.net/tag4sree/Hibernate+-+Objects/Generic+pipeline+for+business+objects+using+Castle+Windsor/cawox</link>
            <description>&lt;p&gt;Currently I&#039;m working with a system handling different operations when receiving business documents in object form. Its quite obvious that the code for handling this has evolved to have a lot more responsibilities than it was intended to.&lt;/p&gt;  &lt;p&gt;So already having an Inversion of Control container in our stack I thought we could make the operations in the pipeline configurable using the container. To achieve this we need to specify an interface for the tasks in the pipeline, in our case its pretty simple:&lt;/p&gt;  &lt;pre class=&quot;c-sharp&quot;&gt;public interface IPipelineTask&amp;lt;T&amp;gt;
{
    T Perform(T instance);
}&lt;/pre&gt;

&lt;p&gt;Secondly we need to define the pipeline itself, again using a generic interface:&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;public interface IPipeline&amp;lt;T&amp;gt;
{
    T Execute(T instance);
}&lt;/pre&gt;

&lt;p&gt;So basically what I want to accomplish is the ability to ask my Inversion of control container for a pipeline for a certain type and be able to call the Execute method on the instance and have all associated tasks performed on the instance I pass to the method. So the code for handling an incoming object of type Invoice would look like this:&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;Invoice incomingInvoice = ....;
ProjectContainer container = new ProjectContainer();
IPipeline&amp;lt;Invoice&amp;gt; pipeline = container.Resolve&amp;lt;IPipeline&amp;lt;Invoice&amp;gt;&amp;gt;();
Invoice processedInvoice = pipeline.Execute(incomingInvoice);
container.Release(pipeline);&lt;/pre&gt;

&lt;p&gt;So lets look at the implementation of the generic pipeline that handles executing of each task:&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;public class Pipeline&amp;lt;T&amp;gt; : IPipeline&amp;lt;T&amp;gt;
{
    private IPipelineTask&amp;lt;T&amp;gt;[] tasks;
    public Pipeline(IPipelineTask&amp;lt;T&amp;gt;[] pipelinetasks)
    {
        tasks = pipelinetasks;
    }

    public T Execute(T instance)
    {
        T processedInstance = instance;
        foreach (var task in tasks)
        {
            processedInstance = task.Perform(processedInstance);
        }
        return processedInstance;
    }
}&lt;/pre&gt;

&lt;p&gt;Note the constructor takes an array of IPipelineTasks&amp;lt;T&amp;gt; this is here our Inversion of Control container comes to play and does this for us using constructor dependency injection. &lt;/p&gt;

&lt;p&gt;Each task needs to implement the IPipelineTask&amp;lt;T&amp;gt; with its specific business object type:&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;public class InvoiceNotifier : IPipelineTask&amp;lt;Invoice&amp;gt;
{
    private IUserNotifier usernotifier;
    public InvoiceNotifier(IUserNotifier notifier)
    {
        usernotifier = notifier;
    }

    public Invoice Perform(Invoice instance)
    {
        usernotifier.Notify(Notification.IncomingInvoice,
                            &amp;quot;The invoice with identifier &amp;quot; + instance.ID + &amp;quot; changed state to &amp;quot; + instance.State);
        return instance;
    }
}&lt;/pre&gt;

&lt;p&gt;Normally when working with arrays in Castle Windsor we have to specify each service to be part of the array in the configuration, however in our case we want all registered implementations of the specific interface to be passed to the pipeline. To do this we can add a custom sub dependency resolver to castle, in fact we can use &lt;a href=&quot;http://hammett.castleproject.org/?p=257&quot;&gt;the ArraySubDependencyResolver&lt;/a&gt; already written by &lt;a href=&quot;http://hammett.castleproject.org/&quot;&gt;Castle projects founder (and soon to be Microsoftee) Hammett&lt;/a&gt;. With this in place we can make the following configuration and our mission is accomplished and all tasks registered in the configuration will be injected when we request the generic Pipeline of this type. &lt;/p&gt;

&lt;pre class=&quot;xml&quot;&gt;&amp;lt;components&amp;gt;
   &amp;lt;!--Register the generic pipeline--&amp;gt; 
  &amp;lt;component
    id=&amp;quot;bussiness.document.pipeline&amp;quot;
    service=&amp;quot;Services.IPipeline`1, Services&amp;quot;
    type=&amp;quot;Services.Pipeline`1, Services&amp;quot;
    lifetype=&amp;quot;Thread&amp;quot;
    /&amp;gt;
   &amp;lt;!--Register our pipeline tasks--&amp;gt;
  &amp;lt;component
    id=&amp;quot;invoice.notification&amp;quot;
    service=&amp;quot;Services.IPipelineTask`1[[Domain.Invoice, Domain]], Services&amp;quot;
    type=&amp;quot;Services.InvoiceNotifier, Services&amp;quot;
    lifetype=&amp;quot;Thread&amp;quot;
    /&amp;gt;
  &amp;lt;component
    id=&amp;quot;invoice.reciever&amp;quot;
    service=&amp;quot;Services.IPipelineTask`1[[Domain.Invoice, Domain]], Services&amp;quot;
    type=&amp;quot;Services.InvoiceReciever, Services&amp;quot;
    lifetype=&amp;quot;Thread&amp;quot;
    /&amp;gt;
  
   &amp;lt;!--Registration of services and repositories which our pipeline tasks uses--&amp;gt;
   ....
&amp;lt;/components&amp;gt;&lt;/pre&gt;

&lt;p&gt;Using this infrastructure custom tasks can be specified easily in the configuration even from other namespaces and assemblies. And the pipeline doesn&#039;t need to worry about the dependencies of each Pipeline task, the container handles this&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=Wlnu3J&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=Wlnu3J&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=CU1EcJ&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=CU1EcJ&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=3EUj6J&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=3EUj6J&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=IU9Wbj&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=IU9Wbj&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=7M9dej&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=7M9dej&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=7g0ckJ&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=7g0ckJ&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/intellectdk/~4/340900038&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
            
            <pubDate>Sun, 20 Jul 2008 13:54:39 -0700</pubDate>
        </item>
            
        <item>
            <title>Generic pipeline for business objects using Castle Windsor</title>
            <link>http://swik.net/tag4sree/responding+to+change/Generic+pipeline+for+business+objects+using+Castle+Windsor/cawow</link>
            <description>&lt;p&gt;Currently I&#039;m working with a system handling different operations when receiving business documents in object form. Its quite obvious that the code for handling this has evolved to have a lot more responsibilities than it was intended to.&lt;/p&gt;  &lt;p&gt;So already having an Inversion of Control container in our stack I thought we could make the operations in the pipeline configurable using the container. To achieve this we need to specify an interface for the tasks in the pipeline, in our case its pretty simple:&lt;/p&gt;  &lt;pre class=&quot;c-sharp&quot;&gt;public interface IPipelineTask&amp;lt;T&amp;gt;
{
    T Perform(T instance);
}&lt;/pre&gt;

&lt;p&gt;Secondly we need to define the pipeline itself, again using a generic interface:&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;public interface IPipeline&amp;lt;T&amp;gt;
{
    T Execute(T instance);
}&lt;/pre&gt;

&lt;p&gt;So basically what I want to accomplish is the ability to ask my Inversion of control container for a pipeline for a certain type and be able to call the Execute method on the instance and have all associated tasks performed on the instance I pass to the method. So the code for handling an incoming object of type Invoice would look like this:&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;Invoice incomingInvoice = ....;
ProjectContainer container = new ProjectContainer();
IPipeline&amp;lt;Invoice&amp;gt; pipeline = container.Resolve&amp;lt;IPipeline&amp;lt;Invoice&amp;gt;&amp;gt;();
Invoice processedInvoice = pipeline.Execute(incomingInvoice);
container.Release(pipeline);&lt;/pre&gt;

&lt;p&gt;So lets look at the implementation of the generic pipeline that handles executing of each task:&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;public class Pipeline&amp;lt;T&amp;gt; : IPipeline&amp;lt;T&amp;gt;
{
    private IPipelineTask&amp;lt;T&amp;gt;[] tasks;
    public Pipeline(IPipelineTask&amp;lt;T&amp;gt;[] pipelinetasks)
    {
        tasks = pipelinetasks;
    }

    public T Execute(T instance)
    {
        T processedInstance = instance;
        foreach (var task in tasks)
        {
            processedInstance = task.Perform(processedInstance);
        }
        return processedInstance;
    }
}&lt;/pre&gt;

&lt;p&gt;Note the constructor takes an array of IPipelineTasks&amp;lt;T&amp;gt; this is here our Inversion of Control container comes to play and does this for us using constructor dependency injection. &lt;/p&gt;

&lt;p&gt;Each task needs to implement the IPipelineTask&amp;lt;T&amp;gt; with its specific business object type:&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;public class InvoiceNotifier : IPipelineTask&amp;lt;Invoice&amp;gt;
{
    private IUserNotifier usernotifier;
    public InvoiceNotifier(IUserNotifier notifier)
    {
        usernotifier = notifier;
    }

    public Invoice Perform(Invoice instance)
    {
        usernotifier.Notify(Notification.IncomingInvoice,
                            &amp;quot;The invoice with identifier &amp;quot; + instance.ID + &amp;quot; changed state to &amp;quot; + instance.State);
        return instance;
    }
}&lt;/pre&gt;

&lt;p&gt;Normally when working with arrays in Castle Windsor we have to specify each service to be part of the array in the configuration, however in our case we want all registered implementations of the specific interface to be passed to the pipeline. To do this we can add a custom sub dependency resolver to castle, in fact we can use &lt;a href=&quot;http://hammett.castleproject.org/?p=257&quot;&gt;the ArraySubDependencyResolver&lt;/a&gt; already written by &lt;a href=&quot;http://hammett.castleproject.org/&quot;&gt;Castle projects founder (and soon to be Microsoftee) Hammett&lt;/a&gt;. With this in place we can make the following configuration and our mission is accomplished and all tasks registered in the configuration will be injected when we request the generic Pipeline of this type. &lt;/p&gt;

&lt;pre class=&quot;xml&quot;&gt;&amp;lt;components&amp;gt;
   &amp;lt;!--Register the generic pipeline--&amp;gt; 
  &amp;lt;component
    id=&amp;quot;bussiness.document.pipeline&amp;quot;
    service=&amp;quot;Services.IPipeline`1, Services&amp;quot;
    type=&amp;quot;Services.Pipeline`1, Services&amp;quot;
    lifetype=&amp;quot;Thread&amp;quot;
    /&amp;gt;
   &amp;lt;!--Register our pipeline tasks--&amp;gt;
  &amp;lt;component
    id=&amp;quot;invoice.notification&amp;quot;
    service=&amp;quot;Services.IPipelineTask`1[[Domain.Invoice, Domain]], Services&amp;quot;
    type=&amp;quot;Services.InvoiceNotifier, Services&amp;quot;
    lifetype=&amp;quot;Thread&amp;quot;
    /&amp;gt;
  &amp;lt;component
    id=&amp;quot;invoice.reciever&amp;quot;
    service=&amp;quot;Services.IPipelineTask`1[[Domain.Invoice, Domain]], Services&amp;quot;
    type=&amp;quot;Services.InvoiceReciever, Services&amp;quot;
    lifetype=&amp;quot;Thread&amp;quot;
    /&amp;gt;
  
   &amp;lt;!--Registration of services and repositories which our pipeline tasks uses--&amp;gt;
   ....
&amp;lt;/components&amp;gt;&lt;/pre&gt;

&lt;p&gt;Using this infrastructure custom tasks can be specified easily in the configuration even from other namespaces and assemblies. And the pipeline doesn&#039;t need to worry about the dependencies of each Pipeline task, the container handles this&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=Wlnu3J&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=Wlnu3J&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=CU1EcJ&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=CU1EcJ&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=3EUj6J&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=3EUj6J&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=IU9Wbj&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=IU9Wbj&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=7M9dej&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=7M9dej&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=7g0ckJ&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=7g0ckJ&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/intellectdk/~4/340900038&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
            
            <pubDate>Sun, 20 Jul 2008 13:54:38 -0700</pubDate>
        </item>
            
        <item>
            <title>Generic pipeline for business objects using Castle Windsor</title>
            <link>http://swik.net/tag4sree/Detached+objects+in+nHibernate+and+Lazy+loading/Generic+pipeline+for+business+objects+using+Castle+Windsor/cawov</link>
            <description>&lt;p&gt;Currently I&#039;m working with a system handling different operations when receiving business documents in object form. Its quite obvious that the code for handling this has evolved to have a lot more responsibilities than it was intended to.&lt;/p&gt;  &lt;p&gt;So already having an Inversion of Control container in our stack I thought we could make the operations in the pipeline configurable using the container. To achieve this we need to specify an interface for the tasks in the pipeline, in our case its pretty simple:&lt;/p&gt;  &lt;pre class=&quot;c-sharp&quot;&gt;public interface IPipelineTask&amp;lt;T&amp;gt;
{
    T Perform(T instance);
}&lt;/pre&gt;

&lt;p&gt;Secondly we need to define the pipeline itself, again using a generic interface:&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;public interface IPipeline&amp;lt;T&amp;gt;
{
    T Execute(T instance);
}&lt;/pre&gt;

&lt;p&gt;So basically what I want to accomplish is the ability to ask my Inversion of control container for a pipeline for a certain type and be able to call the Execute method on the instance and have all associated tasks performed on the instance I pass to the method. So the code for handling an incoming object of type Invoice would look like this:&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;Invoice incomingInvoice = ....;
ProjectContainer container = new ProjectContainer();
IPipeline&amp;lt;Invoice&amp;gt; pipeline = container.Resolve&amp;lt;IPipeline&amp;lt;Invoice&amp;gt;&amp;gt;();
Invoice processedInvoice = pipeline.Execute(incomingInvoice);
container.Release(pipeline);&lt;/pre&gt;

&lt;p&gt;So lets look at the implementation of the generic pipeline that handles executing of each task:&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;public class Pipeline&amp;lt;T&amp;gt; : IPipeline&amp;lt;T&amp;gt;
{
    private IPipelineTask&amp;lt;T&amp;gt;[] tasks;
    public Pipeline(IPipelineTask&amp;lt;T&amp;gt;[] pipelinetasks)
    {
        tasks = pipelinetasks;
    }

    public T Execute(T instance)
    {
        T processedInstance = instance;
        foreach (var task in tasks)
        {
            processedInstance = task.Perform(processedInstance);
        }
        return processedInstance;
    }
}&lt;/pre&gt;

&lt;p&gt;Note the constructor takes an array of IPipelineTasks&amp;lt;T&amp;gt; this is here our Inversion of Control container comes to play and does this for us using constructor dependency injection. &lt;/p&gt;

&lt;p&gt;Each task needs to implement the IPipelineTask&amp;lt;T&amp;gt; with its specific business object type:&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;public class InvoiceNotifier : IPipelineTask&amp;lt;Invoice&amp;gt;
{
    private IUserNotifier usernotifier;
    public InvoiceNotifier(IUserNotifier notifier)
    {
        usernotifier = notifier;
    }

    public Invoice Perform(Invoice instance)
    {
        usernotifier.Notify(Notification.IncomingInvoice,
                            &amp;quot;The invoice with identifier &amp;quot; + instance.ID + &amp;quot; changed state to &amp;quot; + instance.State);
        return instance;
    }
}&lt;/pre&gt;

&lt;p&gt;Normally when working with arrays in Castle Windsor we have to specify each service to be part of the array in the configuration, however in our case we want all registered implementations of the specific interface to be passed to the pipeline. To do this we can add a custom sub dependency resolver to castle, in fact we can use &lt;a href=&quot;http://hammett.castleproject.org/?p=257&quot;&gt;the ArraySubDependencyResolver&lt;/a&gt; already written by &lt;a href=&quot;http://hammett.castleproject.org/&quot;&gt;Castle projects founder (and soon to be Microsoftee) Hammett&lt;/a&gt;. With this in place we can make the following configuration and our mission is accomplished and all tasks registered in the configuration will be injected when we request the generic Pipeline of this type. &lt;/p&gt;

&lt;pre class=&quot;xml&quot;&gt;&amp;lt;components&amp;gt;
   &amp;lt;!--Register the generic pipeline--&amp;gt; 
  &amp;lt;component
    id=&amp;quot;bussiness.document.pipeline&amp;quot;
    service=&amp;quot;Services.IPipeline`1, Services&amp;quot;
    type=&amp;quot;Services.Pipeline`1, Services&amp;quot;
    lifetype=&amp;quot;Thread&amp;quot;
    /&amp;gt;
   &amp;lt;!--Register our pipeline tasks--&amp;gt;
  &amp;lt;component
    id=&amp;quot;invoice.notification&amp;quot;
    service=&amp;quot;Services.IPipelineTask`1[[Domain.Invoice, Domain]], Services&amp;quot;
    type=&amp;quot;Services.InvoiceNotifier, Services&amp;quot;
    lifetype=&amp;quot;Thread&amp;quot;
    /&amp;gt;
  &amp;lt;component
    id=&amp;quot;invoice.reciever&amp;quot;
    service=&amp;quot;Services.IPipelineTask`1[[Domain.Invoice, Domain]], Services&amp;quot;
    type=&amp;quot;Services.InvoiceReciever, Services&amp;quot;
    lifetype=&amp;quot;Thread&amp;quot;
    /&amp;gt;
  
   &amp;lt;!--Registration of services and repositories which our pipeline tasks uses--&amp;gt;
   ....
&amp;lt;/components&amp;gt;&lt;/pre&gt;

&lt;p&gt;Using this infrastructure custom tasks can be specified easily in the configuration even from other namespaces and assemblies. And the pipeline doesn&#039;t need to worry about the dependencies of each Pipeline task, the container handles this&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=Wlnu3J&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=Wlnu3J&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=CU1EcJ&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=CU1EcJ&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=3EUj6J&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=3EUj6J&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=IU9Wbj&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=IU9Wbj&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=7M9dej&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=7M9dej&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=7g0ckJ&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=7g0ckJ&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/intellectdk/~4/340900038&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
            
            <pubDate>Sun, 20 Jul 2008 13:54:36 -0700</pubDate>
        </item>
            
        <item>
            <title>Generating DTO&#039;s from your fully populated domain classes</title>
            <link>http://swik.net/tag4sree/Hibernate+-+Objects/Generating+DTO%27s+from+your+fully+populated+domain+classes/b7wc5</link>
            <description>&lt;p&gt;When working with object relational mapping(or even handrolled DAL&#039;s) you most often work on fully populated objects. When working in an environment utilizing Data Transfer Object either for transport over the wire or screen bound&amp;#160; DTO&#039;s you have to slice or merge your fully populated objects. With LINQ for nHibernate, LINQ for SQL the solution for this is pretty obvious you populate the object using its constructor or object initialisers&amp;#160; in a LINQ query either directly on your data source or on one or more already populated instances.&lt;/p&gt;  &lt;p&gt;A quick example using LINQ for nHibernate could be:&lt;/p&gt;  &lt;pre class=&quot;c-sharp&quot;&gt;var result = from p in db.Products select new ProductDTO {p.ID, p.Name} ;&lt;/pre&gt;

&lt;p&gt;(Of course we need to make instances not anonymous types because we need to pass them out of the current scope)&lt;/p&gt;

&lt;p&gt;If we are stuck using traditional querying in nHibernate we can accomplish the same using HQL:&lt;/p&gt;

&lt;pre class=&quot;sql&quot;&gt;select new ProductDTO(p.ID, p.Name) from Product p&lt;/pre&gt;

&lt;p&gt;When using this HQL query its important to remember to import your DTO class in the mapping or else you will end up with an error like: &lt;/p&gt;

&lt;pre&gt;NHibernate.QueryException : class not found: ProductDTO&lt;/pre&gt;

&lt;p&gt;To import it just add &amp;lt;import class=&amp;quot;Name.Space.ProductDTO, Assembly&amp;quot;&amp;gt; right after your hibernate-mapping element. Of course the generating of the DTO&#039;s can get much more complex than the samples i have shown. They could span multiple business object requiring complex queries but the concept remains the same.&lt;/p&gt;

&lt;p&gt;Okay, so these options are valid only for folks using an LINQ empowered ORM&#039;s or frameworks with equivalent functionality to the nHibernate sample above. One thing we could do is to create the DTO&#039;s from the fully populated objects. Of course this could be a dangerous decision if you don&#039;t already have the objects in the current context and the DTO&#039;s require a very little subset of the data, so that&#039;s definitely worth noting. That beeing said we could do this in a number of ways all which i can thing of writing myself involves plumbing code. So a couple of days ago I stumbled upon a project called &lt;a href=&quot;http://code.google.com/p/otis-lib/&quot;&gt;otis&lt;/a&gt; a object transformer or Object-to-Object mapper if you prefer that term. &lt;/p&gt;

&lt;p&gt;The concept is pretty simple, we can define how one object map to another so if we take our very simple case we can specify a mapping on this form:&lt;/p&gt;

&lt;pre class=&quot;xml&quot;&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot; ?&amp;gt;
&amp;lt;otis-mapping xmlns=&amp;quot;urn:otis-mapping-1.0&amp;quot;&amp;gt;
  &amp;lt;class name=&amp;quot;Name.Space.ProductDTO, Assembly&amp;quot; source=&amp;quot;Name.Space.Product, Assembly&amp;quot; &amp;gt;
    &amp;lt;member name=&amp;quot;ID&amp;quot; /&amp;gt;
    &amp;lt;member name=&amp;quot;Name&amp;quot; /&amp;gt;
  &amp;lt;/class&amp;gt;
&amp;lt;/otis-mapping&amp;gt;&lt;/pre&gt;

&lt;p&gt;In the above case we have the same names on properties in both classes so its pretty simple, but the possibilities in the mapping is many. You can use expression to combine multiple values to one, projections, exchanging certain values etc. I will certainly have to look into the source code of otis and have a look of its capabilities as the documentation is a bit sparse.&lt;/p&gt;

&lt;p&gt;To utilize the above mapping we configure the framework and use a generic class to get Assembler classes that can convert our types, its pretty simple:&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;Product product = ...; //Our fully populated product instance
Otis.Configuration conf = new Otis.Configuration();
//Looks for embedded ressource with *.otis.xml ending
conf.AddAssemblyResources(Assembly.GetExecutingAssembly(), &amp;quot;otis.xml&amp;quot;); 
//Declare our assembler
var asm = conf.GetAssembler&amp;lt;ProductDTO, Product&amp;gt;();
//Use the assembler to get the DTO
ProductDTO dto = asm.AssembleFrom(product);&lt;/pre&gt;

&lt;p&gt;As I said I will definitely dive into the source to explore which features are available and how the transformation is done and what the costs of it is. The main issue I have with the approach is that we could do the same using code and to make it more flexible lambda expressions and have it strongly typed and avoid the verbosity of XML, but lets see how feature rich Otis is before dismissing it.&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=ZtuWvI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=ZtuWvI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=zxJV1I&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=zxJV1I&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=PGLCwI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=PGLCwI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=qbnmXi&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=qbnmXi&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=X4Fxci&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=X4Fxci&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=ziT26I&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=ziT26I&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/intellectdk/~4/315721502&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
            
            <pubDate>Thu, 19 Jun 2008 15:22:13 -0700</pubDate>
        </item>
            
        <item>
            <title>Generating DTO&#039;s from your fully populated domain classes</title>
            <link>http://swik.net/tag4sree/Detached+objects+in+nHibernate+and+Lazy+loading/Generating+DTO%27s+from+your+fully+populated+domain+classes/b7wc4</link>
            <description>&lt;p&gt;When working with object relational mapping(or even handrolled DAL&#039;s) you most often work on fully populated objects. When working in an environment utilizing Data Transfer Object either for transport over the wire or screen bound&amp;#160; DTO&#039;s you have to slice or merge your fully populated objects. With LINQ for nHibernate, LINQ for SQL the solution for this is pretty obvious you populate the object using its constructor or object initialisers&amp;#160; in a LINQ query either directly on your data source or on one or more already populated instances.&lt;/p&gt;  &lt;p&gt;A quick example using LINQ for nHibernate could be:&lt;/p&gt;  &lt;pre class=&quot;c-sharp&quot;&gt;var result = from p in db.Products select new ProductDTO {p.ID, p.Name} ;&lt;/pre&gt;

&lt;p&gt;(Of course we need to make instances not anonymous types because we need to pass them out of the current scope)&lt;/p&gt;

&lt;p&gt;If we are stuck using traditional querying in nHibernate we can accomplish the same using HQL:&lt;/p&gt;

&lt;pre class=&quot;sql&quot;&gt;select new ProductDTO(p.ID, p.Name) from Product p&lt;/pre&gt;

&lt;p&gt;When using this HQL query its important to remember to import your DTO class in the mapping or else you will end up with an error like: &lt;/p&gt;

&lt;pre&gt;NHibernate.QueryException : class not found: ProductDTO&lt;/pre&gt;

&lt;p&gt;To import it just add &amp;lt;import class=&amp;quot;Name.Space.ProductDTO, Assembly&amp;quot;&amp;gt; right after your hibernate-mapping element. Of course the generating of the DTO&#039;s can get much more complex than the samples i have shown. They could span multiple business object requiring complex queries but the concept remains the same.&lt;/p&gt;

&lt;p&gt;Okay, so these options are valid only for folks using an LINQ empowered ORM&#039;s or frameworks with equivalent functionality to the nHibernate sample above. One thing we could do is to create the DTO&#039;s from the fully populated objects. Of course this could be a dangerous decision if you don&#039;t already have the objects in the current context and the DTO&#039;s require a very little subset of the data, so that&#039;s definitely worth noting. That beeing said we could do this in a number of ways all which i can thing of writing myself involves plumbing code. So a couple of days ago I stumbled upon a project called &lt;a href=&quot;http://code.google.com/p/otis-lib/&quot;&gt;otis&lt;/a&gt; a object transformer or Object-to-Object mapper if you prefer that term. &lt;/p&gt;

&lt;p&gt;The concept is pretty simple, we can define how one object map to another so if we take our very simple case we can specify a mapping on this form:&lt;/p&gt;

&lt;pre class=&quot;xml&quot;&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot; ?&amp;gt;
&amp;lt;otis-mapping xmlns=&amp;quot;urn:otis-mapping-1.0&amp;quot;&amp;gt;
  &amp;lt;class name=&amp;quot;Name.Space.ProductDTO, Assembly&amp;quot; source=&amp;quot;Name.Space.Product, Assembly&amp;quot; &amp;gt;
    &amp;lt;member name=&amp;quot;ID&amp;quot; /&amp;gt;
    &amp;lt;member name=&amp;quot;Name&amp;quot; /&amp;gt;
  &amp;lt;/class&amp;gt;
&amp;lt;/otis-mapping&amp;gt;&lt;/pre&gt;

&lt;p&gt;In the above case we have the same names on properties in both classes so its pretty simple, but the possibilities in the mapping is many. You can use expression to combine multiple values to one, projections, exchanging certain values etc. I will certainly have to look into the source code of otis and have a look of its capabilities as the documentation is a bit sparse.&lt;/p&gt;

&lt;p&gt;To utilize the above mapping we configure the framework and use a generic class to get Assembler classes that can convert our types, its pretty simple:&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;Product product = ...; //Our fully populated product instance
Otis.Configuration conf = new Otis.Configuration();
//Looks for embedded ressource with *.otis.xml ending
conf.AddAssemblyResources(Assembly.GetExecutingAssembly(), &amp;quot;otis.xml&amp;quot;); 
//Declare our assembler
var asm = conf.GetAssembler&amp;lt;ProductDTO, Product&amp;gt;();
//Use the assembler to get the DTO
ProductDTO dto = asm.AssembleFrom(product);&lt;/pre&gt;

&lt;p&gt;As I said I will definitely dive into the source to explore which features are available and how the transformation is done and what the costs of it is. The main issue I have with the approach is that we could do the same using code and to make it more flexible lambda expressions and have it strongly typed and avoid the verbosity of XML, but lets see how feature rich Otis is before dismissing it.&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=ZtuWvI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=ZtuWvI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=zxJV1I&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=zxJV1I&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=PGLCwI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=PGLCwI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=qbnmXi&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=qbnmXi&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=X4Fxci&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=X4Fxci&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=ziT26I&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=ziT26I&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/intellectdk/~4/315721502&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
            
            <pubDate>Thu, 19 Jun 2008 15:22:13 -0700</pubDate>
        </item>
            
        <item>
            <title>Generating DTO&#039;s from your fully populated domain classes</title>
            <link>http://swik.net/tag4sree/responding+to+change/Generating+DTO%27s+from+your+fully+populated+domain+classes/b7wc3</link>
            <description>&lt;p&gt;When working with object relational mapping(or even handrolled DAL&#039;s) you most often work on fully populated objects. When working in an environment utilizing Data Transfer Object either for transport over the wire or screen bound&amp;#160; DTO&#039;s you have to slice or merge your fully populated objects. With LINQ for nHibernate, LINQ for SQL the solution for this is pretty obvious you populate the object using its constructor or object initialisers&amp;#160; in a LINQ query either directly on your data source or on one or more already populated instances.&lt;/p&gt;  &lt;p&gt;A quick example using LINQ for nHibernate could be:&lt;/p&gt;  &lt;pre class=&quot;c-sharp&quot;&gt;var result = from p in db.Products select new ProductDTO {p.ID, p.Name} ;&lt;/pre&gt;

&lt;p&gt;(Of course we need to make instances not anonymous types because we need to pass them out of the current scope)&lt;/p&gt;

&lt;p&gt;If we are stuck using traditional querying in nHibernate we can accomplish the same using HQL:&lt;/p&gt;

&lt;pre class=&quot;sql&quot;&gt;select new ProductDTO(p.ID, p.Name) from Product p&lt;/pre&gt;

&lt;p&gt;When using this HQL query its important to remember to import your DTO class in the mapping or else you will end up with an error like: &lt;/p&gt;

&lt;pre&gt;NHibernate.QueryException : class not found: ProductDTO&lt;/pre&gt;

&lt;p&gt;To import it just add &amp;lt;import class=&amp;quot;Name.Space.ProductDTO, Assembly&amp;quot;&amp;gt; right after your hibernate-mapping element. Of course the generating of the DTO&#039;s can get much more complex than the samples i have shown. They could span multiple business object requiring complex queries but the concept remains the same.&lt;/p&gt;

&lt;p&gt;Okay, so these options are valid only for folks using an LINQ empowered ORM&#039;s or frameworks with equivalent functionality to the nHibernate sample above. One thing we could do is to create the DTO&#039;s from the fully populated objects. Of course this could be a dangerous decision if you don&#039;t already have the objects in the current context and the DTO&#039;s require a very little subset of the data, so that&#039;s definitely worth noting. That beeing said we could do this in a number of ways all which i can thing of writing myself involves plumbing code. So a couple of days ago I stumbled upon a project called &lt;a href=&quot;http://code.google.com/p/otis-lib/&quot;&gt;otis&lt;/a&gt; a object transformer or Object-to-Object mapper if you prefer that term. &lt;/p&gt;

&lt;p&gt;The concept is pretty simple, we can define how one object map to another so if we take our very simple case we can specify a mapping on this form:&lt;/p&gt;

&lt;pre class=&quot;xml&quot;&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; encoding=&amp;quot;utf-8&amp;quot; ?&amp;gt;
&amp;lt;otis-mapping xmlns=&amp;quot;urn:otis-mapping-1.0&amp;quot;&amp;gt;
  &amp;lt;class name=&amp;quot;Name.Space.ProductDTO, Assembly&amp;quot; source=&amp;quot;Name.Space.Product, Assembly&amp;quot; &amp;gt;
    &amp;lt;member name=&amp;quot;ID&amp;quot; /&amp;gt;
    &amp;lt;member name=&amp;quot;Name&amp;quot; /&amp;gt;
  &amp;lt;/class&amp;gt;
&amp;lt;/otis-mapping&amp;gt;&lt;/pre&gt;

&lt;p&gt;In the above case we have the same names on properties in both classes so its pretty simple, but the possibilities in the mapping is many. You can use expression to combine multiple values to one, projections, exchanging certain values etc. I will certainly have to look into the source code of otis and have a look of its capabilities as the documentation is a bit sparse.&lt;/p&gt;

&lt;p&gt;To utilize the above mapping we configure the framework and use a generic class to get Assembler classes that can convert our types, its pretty simple:&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;Product product = ...; //Our fully populated product instance
Otis.Configuration conf = new Otis.Configuration();
//Looks for embedded ressource with *.otis.xml ending
conf.AddAssemblyResources(Assembly.GetExecutingAssembly(), &amp;quot;otis.xml&amp;quot;); 
//Declare our assembler
var asm = conf.GetAssembler&amp;lt;ProductDTO, Product&amp;gt;();
//Use the assembler to get the DTO
ProductDTO dto = asm.AssembleFrom(product);&lt;/pre&gt;

&lt;p&gt;As I said I will definitely dive into the source to explore which features are available and how the transformation is done and what the costs of it is. The main issue I have with the approach is that we could do the same using code and to make it more flexible lambda expressions and have it strongly typed and avoid the verbosity of XML, but lets see how feature rich Otis is before dismissing it.&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=ZtuWvI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=ZtuWvI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=zxJV1I&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=zxJV1I&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=PGLCwI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=PGLCwI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=qbnmXi&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=qbnmXi&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=X4Fxci&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=X4Fxci&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=ziT26I&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=ziT26I&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/intellectdk/~4/315721502&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
            
            <pubDate>Thu, 19 Jun 2008 15:22:12 -0700</pubDate>
        </item>
            
        <item>
            <title>Copenhagen .NET User Group - Startup</title>
            <link>http://swik.net/tag4sree/Hibernate+-+Objects/Copenhagen+.NET+User+Group+-+Startup/b7c0j</link>
            <description>&lt;p&gt;A .NET User Group is starting up in Copenhagen for more information check &lt;a href=&quot;http://cnug.dk/&quot;&gt;http://cnug.dk/&lt;/a&gt; (in Danish). I Hope to see many of the Danish developers on the 19th of June in Ballerup. Its gonna be a talk about expectations for the User Group and a presentation of some concepts from object relational mapping.&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=oHOFwI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=oHOFwI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=23Hm5I&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=23Hm5I&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=BFfeZI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=BFfeZI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=DZP8hi&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=DZP8hi&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=kJIoIi&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=kJIoIi&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=VhvckI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=VhvckI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/intellectdk/~4/311096138&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
            
            <pubDate>Fri, 13 Jun 2008 05:22:20 -0700</pubDate>
        </item>
            
        <item>
            <title>Copenhagen .NET User Group - Startup</title>
            <link>http://swik.net/tag4sree/Detached+objects+in+nHibernate+and+Lazy+loading/Copenhagen+.NET+User+Group+-+Startup/b7c0i</link>
            <description>&lt;p&gt;A .NET User Group is starting up in Copenhagen for more information check &lt;a href=&quot;http://cnug.dk/&quot;&gt;http://cnug.dk/&lt;/a&gt; (in Danish). I Hope to see many of the Danish developers on the 19th of June in Ballerup. Its gonna be a talk about expectations for the User Group and a presentation of some concepts from object relational mapping.&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=oHOFwI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=oHOFwI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=23Hm5I&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=23Hm5I&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=BFfeZI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=BFfeZI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=DZP8hi&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=DZP8hi&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=kJIoIi&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=kJIoIi&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=VhvckI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=VhvckI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/intellectdk/~4/311096138&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
            
            <pubDate>Fri, 13 Jun 2008 05:22:19 -0700</pubDate>
        </item>
            
        <item>
            <title>Copenhagen .NET User Group - Startup</title>
            <link>http://swik.net/tag4sree/responding+to+change/Copenhagen+.NET+User+Group+-+Startup/b7c0h</link>
            <description>&lt;p&gt;A .NET User Group is starting up in Copenhagen for more information check &lt;a href=&quot;http://cnug.dk/&quot;&gt;http://cnug.dk/&lt;/a&gt; (in Danish). I Hope to see many of the Danish developers on the 19th of June in Ballerup. Its gonna be a talk about expectations for the User Group and a presentation of some concepts from object relational mapping.&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=oHOFwI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=oHOFwI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=23Hm5I&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=23Hm5I&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=BFfeZI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=BFfeZI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=DZP8hi&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=DZP8hi&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=kJIoIi&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=kJIoIi&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=VhvckI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=VhvckI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/intellectdk/~4/311096138&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
            
            <pubDate>Fri, 13 Jun 2008 05:22:19 -0700</pubDate>
        </item>
            
        <item>
            <title>Why the database should handle paging</title>
            <link>http://swik.net/tag4sree/responding+to+change/Why+the+database+should+handle+paging/b6p09</link>
            <description>&lt;p&gt;Notice that the scrollbar isn&#039;t at the bottom. That&#039;s a lot of data to fetch if you only show a single page of them&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://intellect.dk/images/Whythedatabaseshouldhandlepaging_18A9/manypages_3.jpg&quot;&gt;&lt;img style=&quot;border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px&quot; height=&quot;348&quot; alt=&quot;manypages&quot; src=&quot;http://intellect.dk/images/Whythedatabaseshouldhandlepaging_18A9/manypages_thumb.jpg&quot; width=&quot;640&quot; border=&quot;0&quot;/&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;em&gt;(click for larger image)&lt;/em&gt;&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=g6HpzI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=g6HpzI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=E9rGZI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=E9rGZI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=zM94QI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=zM94QI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=w19kVi&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=w19kVi&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=bW106i&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=bW106i&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=Xu6xpI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=Xu6xpI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/intellectdk/~4/305663521&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
            
            <pubDate>Thu, 05 Jun 2008 17:01:38 -0700</pubDate>
        </item>
            
        <item>
            <title>Why the database should handle paging</title>
            <link>http://swik.net/tag4sree/Hibernate+-+Objects/Why+the+database+should+handle+paging/b6p08</link>
            <description>&lt;p&gt;Notice that the scrollbar isn&#039;t at the bottom. That&#039;s a lot of data to fetch if you only show a single page of them&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://intellect.dk/images/Whythedatabaseshouldhandlepaging_18A9/manypages_3.jpg&quot;&gt;&lt;img style=&quot;border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px&quot; height=&quot;348&quot; alt=&quot;manypages&quot; src=&quot;http://intellect.dk/images/Whythedatabaseshouldhandlepaging_18A9/manypages_thumb.jpg&quot; width=&quot;640&quot; border=&quot;0&quot;/&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;em&gt;(click for larger image)&lt;/em&gt;&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=g6HpzI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=g6HpzI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=E9rGZI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=E9rGZI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=zM94QI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=zM94QI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=w19kVi&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=w19kVi&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=bW106i&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=bW106i&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=Xu6xpI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=Xu6xpI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/intellectdk/~4/305663521&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
            
            <pubDate>Thu, 05 Jun 2008 17:01:37 -0700</pubDate>
        </item>
            
        <item>
            <title>Why the database should handle paging</title>
            <link>http://swik.net/tag4sree/Detached+objects+in+nHibernate+and+Lazy+loading/Why+the+database+should+handle+paging/b6p07</link>
            <description>&lt;p&gt;Notice that the scrollbar isn&#039;t at the bottom. That&#039;s a lot of data to fetch if you only show a single page of them&lt;/p&gt;  &lt;p&gt;&lt;a href=&quot;http://intellect.dk/images/Whythedatabaseshouldhandlepaging_18A9/manypages_3.jpg&quot;&gt;&lt;img style=&quot;border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px&quot; height=&quot;348&quot; alt=&quot;manypages&quot; src=&quot;http://intellect.dk/images/Whythedatabaseshouldhandlepaging_18A9/manypages_thumb.jpg&quot; width=&quot;640&quot; border=&quot;0&quot;/&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;em&gt;(click for larger image)&lt;/em&gt;&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=g6HpzI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=g6HpzI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=E9rGZI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=E9rGZI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=zM94QI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=zM94QI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=w19kVi&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=w19kVi&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=bW106i&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=bW106i&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=Xu6xpI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=Xu6xpI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/intellectdk/~4/305663521&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
            
            <pubDate>Thu, 05 Jun 2008 17:01:36 -0700</pubDate>
        </item>
            
        <item>
            <title>Generating passwords</title>
            <link>http://swik.net/tag4sree/Hibernate+-+Objects/Generating+passwords/b6jwk</link>
            <description>&lt;p&gt;So if you need to generate passwords easy you don&#039;t have to reinvent the wheel, you can use functionality that the Mempership functionality from ASP.NET already has. On the Membership class in System.Web.Security namespace is a static method for generating passwords. You can specify a length and how many non alphanumeric characters it should contain.&lt;/p&gt;  &lt;p&gt;Of course its not exotic in anyway and you can not control the set of characters used (apart from how many should be non alphanumeric) and it does not generate pronounceable passwords. &lt;/p&gt;  &lt;pre class=&quot;c-sharp&quot;&gt;string password = Membership.GeneratePassword(7, 1);&lt;/pre&gt;

&lt;p&gt;The above code will generate a string with seven random characters. Its worth taking note of the second parameter. It specifies the minimum number of non-alphanumerical characters so the generated password can contain more than one in the above case.&lt;/p&gt;

&lt;p&gt;If you need to generate pronounceable passwords I would recommend you take a look at the C implementation available here: &lt;a title=&quot;http://www.multicians.org/thvv/tvvtools.html#gpw&quot; href=&quot;http://www.multicians.org/thvv/tvvtools.html#gpw&quot;&gt;http://www.multicians.org/thvv/tvvtools.html#gpw&lt;/a&gt; it covers the theory behind using trigraphs and furthermore shows implementation of how to extract trigraphs from a dictionary and how to use this to generate the actual passwords.&lt;/p&gt;

&lt;p&gt;But to keep it short, if you just need a random set of chars. Use the features already in the framework instead of rolling your own! The lines saved makes fewer lines that could contain that tricky bug you are hunting a few months from now.&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=79jSmI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=79jSmI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=Ur2qQI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=Ur2qQI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=nl3PAI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=nl3PAI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=Kv57Ri&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=Kv57Ri&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=lNFQgi&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=lNFQgi&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=dDIwOI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=dDIwOI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/intellectdk/~4/304026534&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
            
            <pubDate>Tue, 03 Jun 2008 14:41:53 -0700</pubDate>
        </item>
            
        <item>
            <title>Generating passwords</title>
            <link>http://swik.net/tag4sree/Detached+objects+in+nHibernate+and+Lazy+loading/Generating+passwords/b6jwj</link>
            <description>&lt;p&gt;So if you need to generate passwords easy you don&#039;t have to reinvent the wheel, you can use functionality that the Mempership functionality from ASP.NET already has. On the Membership class in System.Web.Security namespace is a static method for generating passwords. You can specify a length and how many non alphanumeric characters it should contain.&lt;/p&gt;  &lt;p&gt;Of course its not exotic in anyway and you can not control the set of characters used (apart from how many should be non alphanumeric) and it does not generate pronounceable passwords. &lt;/p&gt;  &lt;pre class=&quot;c-sharp&quot;&gt;string password = Membership.GeneratePassword(7, 1);&lt;/pre&gt;

&lt;p&gt;The above code will generate a string with seven random characters. Its worth taking note of the second parameter. It specifies the minimum number of non-alphanumerical characters so the generated password can contain more than one in the above case.&lt;/p&gt;

&lt;p&gt;If you need to generate pronounceable passwords I would recommend you take a look at the C implementation available here: &lt;a title=&quot;http://www.multicians.org/thvv/tvvtools.html#gpw&quot; href=&quot;http://www.multicians.org/thvv/tvvtools.html#gpw&quot;&gt;http://www.multicians.org/thvv/tvvtools.html#gpw&lt;/a&gt; it covers the theory behind using trigraphs and furthermore shows implementation of how to extract trigraphs from a dictionary and how to use this to generate the actual passwords.&lt;/p&gt;

&lt;p&gt;But to keep it short, if you just need a random set of chars. Use the features already in the framework instead of rolling your own! The lines saved makes fewer lines that could contain that tricky bug you are hunting a few months from now.&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=79jSmI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=79jSmI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=Ur2qQI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=Ur2qQI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=nl3PAI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=nl3PAI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=Kv57Ri&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=Kv57Ri&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=lNFQgi&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=lNFQgi&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=dDIwOI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=dDIwOI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/intellectdk/~4/304026534&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
            
            <pubDate>Tue, 03 Jun 2008 14:41:52 -0700</pubDate>
        </item>
            
        <item>
            <title>Generating passwords</title>
            <link>http://swik.net/tag4sree/responding+to+change/Generating+passwords/b6jwi</link>
            <description>&lt;p&gt;So if you need to generate passwords easy you don&#039;t have to reinvent the wheel, you can use functionality that the Mempership functionality from ASP.NET already has. On the Membership class in System.Web.Security namespace is a static method for generating passwords. You can specify a length and how many non alphanumeric characters it should contain.&lt;/p&gt;  &lt;p&gt;Of course its not exotic in anyway and you can not control the set of characters used (apart from how many should be non alphanumeric) and it does not generate pronounceable passwords. &lt;/p&gt;  &lt;pre class=&quot;c-sharp&quot;&gt;string password = Membership.GeneratePassword(7, 1);&lt;/pre&gt;

&lt;p&gt;The above code will generate a string with seven random characters. Its worth taking note of the second parameter. It specifies the minimum number of non-alphanumerical characters so the generated password can contain more than one in the above case.&lt;/p&gt;

&lt;p&gt;If you need to generate pronounceable passwords I would recommend you take a look at the C implementation available here: &lt;a title=&quot;http://www.multicians.org/thvv/tvvtools.html#gpw&quot; href=&quot;http://www.multicians.org/thvv/tvvtools.html#gpw&quot;&gt;http://www.multicians.org/thvv/tvvtools.html#gpw&lt;/a&gt; it covers the theory behind using trigraphs and furthermore shows implementation of how to extract trigraphs from a dictionary and how to use this to generate the actual passwords.&lt;/p&gt;

&lt;p&gt;But to keep it short, if you just need a random set of chars. Use the features already in the framework instead of rolling your own! The lines saved makes fewer lines that could contain that tricky bug you are hunting a few months from now.&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=79jSmI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=79jSmI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=Ur2qQI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=Ur2qQI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=nl3PAI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=nl3PAI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=Kv57Ri&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=Kv57Ri&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=lNFQgi&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=lNFQgi&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=dDIwOI&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=dDIwOI&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/intellectdk/~4/304026534&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
            
            <pubDate>Tue, 03 Jun 2008 14:41:51 -0700</pubDate>
        </item>
            
        <item>
            <title>Common nHibernate exceptions and a question</title>
            <link>http://swik.net/tag4sree/Hibernate+-+Objects/Common+nHibernate+exceptions+and+a+question/b4013</link>
            <description>&lt;p&gt;I often get asked question about nHibernate issues the question discussed last in this post is often brought up. But lets start out with a few simple exceptions that can sometimes take up more of your time than you would like.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&amp;quot;NHibernate.MappingException : Unknown entity class: MyNamespace.With.Persistent.Class&amp;quot;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;You are trying to use a class as persistent that nHibernate wouldn&#039;t know how to handle. The number one reason for this error is that you have mapping files as embedded resources and that you forgot to actually embed the mapping file.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&amp;quot;NHibernate.MappingException : persistent class ClassName not found&amp;quot; &lt;/strong&gt;&lt;strong&gt;or &amp;quot;&lt;/strong&gt;&lt;strong&gt;NHibernate.MappingException : associated class not found: ClassName&amp;quot;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;This is usually an error in your mapping, nHibernate can&#039;t find the class you reference in your mapping. This is often caused by typos or missing to specify in which assembly or namespace your persistent class is to be found. You can specify a default assembly and namespace in the &amp;lt;hibernate-mapping&amp;gt; element or you can write the name of your classes with the assembly and namespace specified on the form &amp;quot;Namespace.ClassName, Assembly&amp;quot;.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&amp;quot;NHibernate.InvalidProxyTypeException : The following types may not be used as proxies&amp;quot;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;This is a classic, if you want to use nHibernates lazyloading features you need to specify your classes properties as virtual so nHibernate can create proxies for you. If you don&#039;t need to use lazyloading on specific type mark these types with lazy=&amp;quot;false&amp;quot; in the class element, and you won&#039;t have to mark its properties as virtual.&lt;/p&gt;  &lt;p&gt;So that&#039;s a handful of the most common exceptions when starting out with nHibernate. Lets move on to a question I have answered quite a few times. People often want to minimize the number of roundtrip&#039;s to the database by joining and retrieving larger resultsets and have nHibernate transform this larger set of results into the correct object graph. Whether this is a good optimization depends heavily on the expected data since it could result in a huge amount of redundant data transferred between database and application. But nonetheless the thing that often tricks people is illustrated by the following test:&lt;/p&gt;  &lt;pre class=&quot;c-sharp&quot;&gt;//Assumme we have 2 invoices with 3 invoicelines each
IList&amp;lt;Invoice&amp;gt; invoices = s.CreateCriteria(typeof (Invoice)).SetFetchMode(&amp;quot;InvoiceLines&amp;quot;, FetchMode.Join).List&amp;lt;Invoice&amp;gt;();
Assert.AreEqual(2, invoices.Count);&lt;/pre&gt;

&lt;p&gt;This test will fail, because you actually get 6 invoice entities back. That&#039;s because the resultset contains duplicate invoices (one for each InvoiceLine) and nHibernate transforms these into invoice instances. One way to fix this is to specify that you want distinct root entities back. This is done by specifying a result-transformer like this:&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;IList&amp;lt;Invoice&amp;gt; invoices =
                s.CreateCriteria(typeof (Invoice)).
                SetFetchMode(&amp;quot;InvoiceLines&amp;quot;, FetchMode.Join).
                SetResultTransformer(CriteriaUtil.DistinctRootEntity).
                List&amp;lt;Invoice&amp;gt;();&lt;/pre&gt;

&lt;p&gt;So what if your data isn&#039;t suitable for joining, you might end up with the large resultset I mentioned earlier? And we don&#039;t want to hit the N+1 Select problem by selecting the InvoiceLines for each of the fetched Invoice&#039;s. That&#039;s were nHibernates batch fetching can be used. We have retrieved all the Invoices we want to use and afterwards we want to select the invoicelines for those. We can specify that our InvoiceLines should be retrieved in batches by specifying a batch-size on the collection in our mapping file.&lt;/p&gt;

&lt;pre class=&quot;xml&quot;&gt;&amp;lt;set name=&amp;quot;InvoiceLines&amp;quot; batch-size=&amp;quot;20&amp;quot;&amp;gt;
	&amp;lt;key column=&amp;quot;InvoiceID&amp;quot; /&amp;gt;
	&amp;lt;one-to-many class=&amp;quot;InvoiceLine&amp;quot; /&amp;gt;
&amp;lt;/set&amp;gt;&lt;/pre&gt;

&lt;p&gt;I just used 20 as an example, this means that nHibernate will fetch the InvoiceLines for 20 Invoices at a time. So this will result in two roundtrip&#039;s(in our example case), and this without fetching duplicate data in the resultsets. You could optimize some scenarios like the one above using MultiQuery or MultiCriteria, that is sending multiple queries in one roundtrip, but that&#039;s another story.&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=gBQ9oH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=gBQ9oH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=iLlcGH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=iLlcGH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=kMQwUH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=kMQwUH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=YR49jh&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=YR49jh&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=6eBG4h&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=6eBG4h&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=XWu8uH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=XWu8uH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/intellectdk/~4/289471108&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
            
            <pubDate>Tue, 13 May 2008 08:23:27 -0700</pubDate>
        </item>
            
        <item>
            <title>Common nHibernate exceptions and a question</title>
            <link>http://swik.net/tag4sree/responding+to+change/Common+nHibernate+exceptions+and+a+question/b4012</link>
            <description>&lt;p&gt;I often get asked question about nHibernate issues the question discussed last in this post is often brought up. But lets start out with a few simple exceptions that can sometimes take up more of your time than you would like.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&amp;quot;NHibernate.MappingException : Unknown entity class: MyNamespace.With.Persistent.Class&amp;quot;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;You are trying to use a class as persistent that nHibernate wouldn&#039;t know how to handle. The number one reason for this error is that you have mapping files as embedded resources and that you forgot to actually embed the mapping file.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&amp;quot;NHibernate.MappingException : persistent class ClassName not found&amp;quot; &lt;/strong&gt;&lt;strong&gt;or &amp;quot;&lt;/strong&gt;&lt;strong&gt;NHibernate.MappingException : associated class not found: ClassName&amp;quot;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;This is usually an error in your mapping, nHibernate can&#039;t find the class you reference in your mapping. This is often caused by typos or missing to specify in which assembly or namespace your persistent class is to be found. You can specify a default assembly and namespace in the &amp;lt;hibernate-mapping&amp;gt; element or you can write the name of your classes with the assembly and namespace specified on the form &amp;quot;Namespace.ClassName, Assembly&amp;quot;.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&amp;quot;NHibernate.InvalidProxyTypeException : The following types may not be used as proxies&amp;quot;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;This is a classic, if you want to use nHibernates lazyloading features you need to specify your classes properties as virtual so nHibernate can create proxies for you. If you don&#039;t need to use lazyloading on specific type mark these types with lazy=&amp;quot;false&amp;quot; in the class element, and you won&#039;t have to mark its properties as virtual.&lt;/p&gt;  &lt;p&gt;So that&#039;s a handful of the most common exceptions when starting out with nHibernate. Lets move on to a question I have answered quite a few times. People often want to minimize the number of roundtrip&#039;s to the database by joining and retrieving larger resultsets and have nHibernate transform this larger set of results into the correct object graph. Whether this is a good optimization depends heavily on the expected data since it could result in a huge amount of redundant data transferred between database and application. But nonetheless the thing that often tricks people is illustrated by the following test:&lt;/p&gt;  &lt;pre class=&quot;c-sharp&quot;&gt;//Assumme we have 2 invoices with 3 invoicelines each
IList&amp;lt;Invoice&amp;gt; invoices = s.CreateCriteria(typeof (Invoice)).SetFetchMode(&amp;quot;InvoiceLines&amp;quot;, FetchMode.Join).List&amp;lt;Invoice&amp;gt;();
Assert.AreEqual(2, invoices.Count);&lt;/pre&gt;

&lt;p&gt;This test will fail, because you actually get 6 invoice entities back. That&#039;s because the resultset contains duplicate invoices (one for each InvoiceLine) and nHibernate transforms these into invoice instances. One way to fix this is to specify that you want distinct root entities back. This is done by specifying a result-transformer like this:&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;IList&amp;lt;Invoice&amp;gt; invoices =
                s.CreateCriteria(typeof (Invoice)).
                SetFetchMode(&amp;quot;InvoiceLines&amp;quot;, FetchMode.Join).
                SetResultTransformer(CriteriaUtil.DistinctRootEntity).
                List&amp;lt;Invoice&amp;gt;();&lt;/pre&gt;

&lt;p&gt;So what if your data isn&#039;t suitable for joining, you might end up with the large resultset I mentioned earlier? And we don&#039;t want to hit the N+1 Select problem by selecting the InvoiceLines for each of the fetched Invoice&#039;s. That&#039;s were nHibernates batch fetching can be used. We have retrieved all the Invoices we want to use and afterwards we want to select the invoicelines for those. We can specify that our InvoiceLines should be retrieved in batches by specifying a batch-size on the collection in our mapping file.&lt;/p&gt;

&lt;pre class=&quot;xml&quot;&gt;&amp;lt;set name=&amp;quot;InvoiceLines&amp;quot; batch-size=&amp;quot;20&amp;quot;&amp;gt;
	&amp;lt;key column=&amp;quot;InvoiceID&amp;quot; /&amp;gt;
	&amp;lt;one-to-many class=&amp;quot;InvoiceLine&amp;quot; /&amp;gt;
&amp;lt;/set&amp;gt;&lt;/pre&gt;

&lt;p&gt;I just used 20 as an example, this means that nHibernate will fetch the InvoiceLines for 20 Invoices at a time. So this will result in two roundtrip&#039;s(in our example case), and this without fetching duplicate data in the resultsets. You could optimize some scenarios like the one above using MultiQuery or MultiCriteria, that is sending multiple queries in one roundtrip, but that&#039;s another story.&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=gBQ9oH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=gBQ9oH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=iLlcGH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=iLlcGH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=kMQwUH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=kMQwUH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=YR49jh&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=YR49jh&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=6eBG4h&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=6eBG4h&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=XWu8uH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=XWu8uH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/intellectdk/~4/289471108&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
            
            <pubDate>Tue, 13 May 2008 08:23:21 -0700</pubDate>
        </item>
            
        <item>
            <title>Common nHibernate exceptions and a question</title>
            <link>http://swik.net/tag4sree/Detached+objects+in+nHibernate+and+Lazy+loading/Common+nHibernate+exceptions+and+a+question/b4011</link>
            <description>&lt;p&gt;I often get asked question about nHibernate issues the question discussed last in this post is often brought up. But lets start out with a few simple exceptions that can sometimes take up more of your time than you would like.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&amp;quot;NHibernate.MappingException : Unknown entity class: MyNamespace.With.Persistent.Class&amp;quot;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;You are trying to use a class as persistent that nHibernate wouldn&#039;t know how to handle. The number one reason for this error is that you have mapping files as embedded resources and that you forgot to actually embed the mapping file.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&amp;quot;NHibernate.MappingException : persistent class ClassName not found&amp;quot; &lt;/strong&gt;&lt;strong&gt;or &amp;quot;&lt;/strong&gt;&lt;strong&gt;NHibernate.MappingException : associated class not found: ClassName&amp;quot;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;This is usually an error in your mapping, nHibernate can&#039;t find the class you reference in your mapping. This is often caused by typos or missing to specify in which assembly or namespace your persistent class is to be found. You can specify a default assembly and namespace in the &amp;lt;hibernate-mapping&amp;gt; element or you can write the name of your classes with the assembly and namespace specified on the form &amp;quot;Namespace.ClassName, Assembly&amp;quot;.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&amp;quot;NHibernate.InvalidProxyTypeException : The following types may not be used as proxies&amp;quot;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;This is a classic, if you want to use nHibernates lazyloading features you need to specify your classes properties as virtual so nHibernate can create proxies for you. If you don&#039;t need to use lazyloading on specific type mark these types with lazy=&amp;quot;false&amp;quot; in the class element, and you won&#039;t have to mark its properties as virtual.&lt;/p&gt;  &lt;p&gt;So that&#039;s a handful of the most common exceptions when starting out with nHibernate. Lets move on to a question I have answered quite a few times. People often want to minimize the number of roundtrip&#039;s to the database by joining and retrieving larger resultsets and have nHibernate transform this larger set of results into the correct object graph. Whether this is a good optimization depends heavily on the expected data since it could result in a huge amount of redundant data transferred between database and application. But nonetheless the thing that often tricks people is illustrated by the following test:&lt;/p&gt;  &lt;pre class=&quot;c-sharp&quot;&gt;//Assumme we have 2 invoices with 3 invoicelines each
IList&amp;lt;Invoice&amp;gt; invoices = s.CreateCriteria(typeof (Invoice)).SetFetchMode(&amp;quot;InvoiceLines&amp;quot;, FetchMode.Join).List&amp;lt;Invoice&amp;gt;();
Assert.AreEqual(2, invoices.Count);&lt;/pre&gt;

&lt;p&gt;This test will fail, because you actually get 6 invoice entities back. That&#039;s because the resultset contains duplicate invoices (one for each InvoiceLine) and nHibernate transforms these into invoice instances. One way to fix this is to specify that you want distinct root entities back. This is done by specifying a result-transformer like this:&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;IList&amp;lt;Invoice&amp;gt; invoices =
                s.CreateCriteria(typeof (Invoice)).
                SetFetchMode(&amp;quot;InvoiceLines&amp;quot;, FetchMode.Join).
                SetResultTransformer(CriteriaUtil.DistinctRootEntity).
                List&amp;lt;Invoice&amp;gt;();&lt;/pre&gt;

&lt;p&gt;So what if your data isn&#039;t suitable for joining, you might end up with the large resultset I mentioned earlier? And we don&#039;t want to hit the N+1 Select problem by selecting the InvoiceLines for each of the fetched Invoice&#039;s. That&#039;s were nHibernates batch fetching can be used. We have retrieved all the Invoices we want to use and afterwards we want to select the invoicelines for those. We can specify that our InvoiceLines should be retrieved in batches by specifying a batch-size on the collection in our mapping file.&lt;/p&gt;

&lt;pre class=&quot;xml&quot;&gt;&amp;lt;set name=&amp;quot;InvoiceLines&amp;quot; batch-size=&amp;quot;20&amp;quot;&amp;gt;
	&amp;lt;key column=&amp;quot;InvoiceID&amp;quot; /&amp;gt;
	&amp;lt;one-to-many class=&amp;quot;InvoiceLine&amp;quot; /&amp;gt;
&amp;lt;/set&amp;gt;&lt;/pre&gt;

&lt;p&gt;I just used 20 as an example, this means that nHibernate will fetch the InvoiceLines for 20 Invoices at a time. So this will result in two roundtrip&#039;s(in our example case), and this without fetching duplicate data in the resultsets. You could optimize some scenarios like the one above using MultiQuery or MultiCriteria, that is sending multiple queries in one roundtrip, but that&#039;s another story.&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=gBQ9oH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=gBQ9oH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=iLlcGH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=iLlcGH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=kMQwUH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=kMQwUH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=YR49jh&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=YR49jh&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=6eBG4h&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=6eBG4h&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=XWu8uH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=XWu8uH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/intellectdk/~4/289471108&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
            
            <pubDate>Tue, 13 May 2008 08:23:18 -0700</pubDate>
        </item>
            
        <item>
            <title>BlogEngine.NET - Urlrewriting</title>
            <link>http://swik.net/tag4sree/Hibernate+-+Objects/BlogEngine.NET+-+Urlrewriting/b4w5f</link>
            <description>&lt;p&gt;So the first thing I usually do when reviewing web projects is to find the default entry page that the user would see. When doing this with BlogEngine.NET you find the default.aspx (obviously in most cases). The first thing in the Page_Load of this is the following code:&lt;/p&gt;  &lt;pre class=&quot;c-sharp&quot;&gt;if (Request.RawUrl.ToLowerInvariant().Contains(&amp;quot;/category/&amp;quot;)){...}
else if (Request.RawUrl.ToLowerInvariant().Contains(&amp;quot;/author/&amp;quot;)){...}
else if (Request.RawUrl.ToLowerInvariant().Contains(&amp;quot;?tag=&amp;quot;)){...}
//a couple of else if&#039;s more&lt;/pre&gt;

&lt;p&gt;So this makes it clear that the default.aspx page handles all listing of posts whether it is all in a category, all by an author or all having a specific tag. All these listings are requested using different URI&#039;s, to handle this an UrlRewrite HttpModule is implemented. If we look at some code in this UrlRewriter we will find:&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;if (context.Request.Path.Contains(&amp;quot;/blog.aspx&amp;quot;)){...}
else if (url.Contains(&amp;quot;/POST/&amp;quot;)){...}
else if (url.Contains(&amp;quot;/CATEGORY/&amp;quot;)){...}
else if (url.Contains(&amp;quot;/AUTHOR/&amp;quot;)){...}
//a couple of else if&#039;s more&lt;/pre&gt;

&lt;p&gt;So what happens here is we delegate the responsibility for different URL&#039;s to be handled on different pages, the responsibilities redirected to the default page is afterwards on the default page once again delegated to different methods handling databinding because presentation is alike. This results in some parsing of the URL&#039;s is duplicated in the UrlRewriter and in the default.aspx.cs file. And furthermore the collection of all posts is iterated both in the UrlRewriter and on the pages, that seems silly. Why not let UrlRewriting do what its intended for: to forward information and then keep the processing on simple pages for specific requests to avoid the redundant parsing and iteration?&lt;/p&gt;

&lt;p&gt;I read an &lt;a href=&quot;http://www.infoq.com/news/2007/11/BlogEngine&quot;&gt;interview with the BlogEngine.NET founder on InfoQ&lt;/a&gt; a while back, and it seems he has some issues with third party dependencies. I don&#039;t see the reason for this, if you can use a third party dependency too do a task it does well and have been doing in many projects already, why roll your own. So allow me to introduce &lt;a href=&quot;http://www.urlrewriting.net&quot;&gt;UrlRewritingNet.UrlRewrite&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;UrlRewritingNet basically consists of a generic HttpHandler that rewrites based on rules you set up in a configuration section in your web.config file, so instead of having to change code to change rewrites, we change simple regular expressions in our configuration of UrlRewritingNet. So lets see the rules I set up for BlogEngine.NET:&lt;/p&gt;

&lt;pre class=&quot;xml&quot;&gt;&amp;lt;configSections&amp;gt;
	&amp;lt;section name=&amp;quot;urlrewritingnet&amp;quot;
		restartOnExternalChanges=&amp;quot;true&amp;quot;
		requirePermission=&amp;quot;false&amp;quot;
		type=&amp;quot;UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter&amp;quot;
	/&amp;gt;
&amp;lt;/configSections&amp;gt;
&amp;lt;urlrewritingnet xmlns=&amp;quot;http://www.urlrewriting.net/schemas/config/2006/07&amp;quot;&amp;gt;
	&amp;lt;rewrites&amp;gt;
		&amp;lt;add name=&amp;quot;categoryRule&amp;quot; virtualUrl=&amp;quot;^~/category/(.*).aspx&amp;quot; destinationUrl=&amp;quot;~/category.aspx?name=$1&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;blogRule&amp;quot; virtualUrl=&amp;quot;^~/blog.aspx&amp;quot; destinationUrl=&amp;quot;~/default.aspx?blog=true&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;authorRule&amp;quot; virtualUrl=&amp;quot;^~/author/(.*).aspx&amp;quot; destinationUrl=&amp;quot;~/author.aspx?name?=$1&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;postRuleDate&amp;quot; virtualUrl=&amp;quot;^~/post/(\d{4})/([0-1]?\d)/([0-3]?\d)/(.*).aspx&amp;quot;
			destinationUrl=&amp;quot;~/post.aspx?year=$1&amp;amp;amp;month=$2&amp;amp;amp;day=$3&amp;amp;amp;name=$4&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;postRuleMonth&amp;quot; virtualUrl=&amp;quot;~/post/(\d{4})/([0-1]?\d)/(.*).aspx&amp;quot;
			destinationUrl=&amp;quot;~/post.aspx?year=$1&amp;amp;amp;month=$2&amp;amp;amp;name=$3&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;postRuleTitle&amp;quot; virtualUrl=&amp;quot;~/post/(.*).aspx&amp;quot; destinationUrl=&amp;quot;~/post.aspx?name=$1&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;pageRule&amp;quot; virtualUrl=&amp;quot;~/page/(.*).aspx&amp;quot; destinationUrl=&amp;quot;~/page.aspx?name=$1&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;calendarRule&amp;quot; virtualUrl=&amp;quot;~/calendar/.*&amp;quot; destinationUrl=&amp;quot;~/calendar.aspx&amp;quot;/&amp;gt;
	&amp;lt;/rewrites&amp;gt;
&amp;lt;/urlrewritingnet&amp;gt;
&amp;lt;system.web&amp;gt;
	&amp;lt;httpModules&amp;gt;
		&amp;lt;add name=&amp;quot;UrlRewriteModule&amp;quot; type=&amp;quot;UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter&amp;quot;/&amp;gt;
	&amp;lt;/httpModules&amp;gt;
&amp;lt;/system.web&amp;gt;&lt;/pre&gt;

&lt;p&gt;The above handles rewriting of Url&#039;s nothing more, nothing less. The existing BlogEngine.NET UrlRewrite have some business logic built in, for instance to retrieve the identifier of posts and sending them to the page that shows the post. I feel this doesn&#039;t belong in an UrlRewriter so I will implement this logic on the pages that actually handles the requests instead of on the UrlRewriter.&lt;/p&gt;

&lt;p&gt;So this was the first step, now we can move the if statement out of our default.aspx and let it concentrate on showing the default content which is the frontpage of the blog and the other pages concentrate on their tasks. How to implement the pages referred to in the mapping above will follow in the next post.&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=go8CzH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=go8CzH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=CjC8jH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=CjC8jH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=5jme0H&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=5jme0H&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=U45NZh&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=U45NZh&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=oHLSch&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=oHLSch&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=ErvAIH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=ErvAIH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/intellectdk/~4/286679450&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
            
            <pubDate>Fri, 09 May 2008 02:18:55 -0700</pubDate>
        </item>
            
        <item>
            <title>BlogEngine.NET - Urlrewriting</title>
            <link>http://swik.net/tag4sree/responding+to+change/BlogEngine.NET+-+Urlrewriting/b4w5e</link>
            <description>&lt;p&gt;So the first thing I usually do when reviewing web projects is to find the default entry page that the user would see. When doing this with BlogEngine.NET you find the default.aspx (obviously in most cases). The first thing in the Page_Load of this is the following code:&lt;/p&gt;  &lt;pre class=&quot;c-sharp&quot;&gt;if (Request.RawUrl.ToLowerInvariant().Contains(&amp;quot;/category/&amp;quot;)){...}
else if (Request.RawUrl.ToLowerInvariant().Contains(&amp;quot;/author/&amp;quot;)){...}
else if (Request.RawUrl.ToLowerInvariant().Contains(&amp;quot;?tag=&amp;quot;)){...}
//a couple of else if&#039;s more&lt;/pre&gt;

&lt;p&gt;So this makes it clear that the default.aspx page handles all listing of posts whether it is all in a category, all by an author or all having a specific tag. All these listings are requested using different URI&#039;s, to handle this an UrlRewrite HttpModule is implemented. If we look at some code in this UrlRewriter we will find:&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;if (context.Request.Path.Contains(&amp;quot;/blog.aspx&amp;quot;)){...}
else if (url.Contains(&amp;quot;/POST/&amp;quot;)){...}
else if (url.Contains(&amp;quot;/CATEGORY/&amp;quot;)){...}
else if (url.Contains(&amp;quot;/AUTHOR/&amp;quot;)){...}
//a couple of else if&#039;s more&lt;/pre&gt;

&lt;p&gt;So what happens here is we delegate the responsibility for different URL&#039;s to be handled on different pages, the responsibilities redirected to the default page is afterwards on the default page once again delegated to different methods handling databinding because presentation is alike. This results in some parsing of the URL&#039;s is duplicated in the UrlRewriter and in the default.aspx.cs file. And furthermore the collection of all posts is iterated both in the UrlRewriter and on the pages, that seems silly. Why not let UrlRewriting do what its intended for: to forward information and then keep the processing on simple pages for specific requests to avoid the redundant parsing and iteration?&lt;/p&gt;

&lt;p&gt;I read an &lt;a href=&quot;http://www.infoq.com/news/2007/11/BlogEngine&quot;&gt;interview with the BlogEngine.NET founder on InfoQ&lt;/a&gt; a while back, and it seems he has some issues with third party dependencies. I don&#039;t see the reason for this, if you can use a third party dependency too do a task it does well and have been doing in many projects already, why roll your own. So allow me to introduce &lt;a href=&quot;http://www.urlrewriting.net&quot;&gt;UrlRewritingNet.UrlRewrite&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;UrlRewritingNet basically consists of a generic HttpHandler that rewrites based on rules you set up in a configuration section in your web.config file, so instead of having to change code to change rewrites, we change simple regular expressions in our configuration of UrlRewritingNet. So lets see the rules I set up for BlogEngine.NET:&lt;/p&gt;

&lt;pre class=&quot;xml&quot;&gt;&amp;lt;configSections&amp;gt;
	&amp;lt;section name=&amp;quot;urlrewritingnet&amp;quot;
		restartOnExternalChanges=&amp;quot;true&amp;quot;
		requirePermission=&amp;quot;false&amp;quot;
		type=&amp;quot;UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter&amp;quot;
	/&amp;gt;
&amp;lt;/configSections&amp;gt;
&amp;lt;urlrewritingnet xmlns=&amp;quot;http://www.urlrewriting.net/schemas/config/2006/07&amp;quot;&amp;gt;
	&amp;lt;rewrites&amp;gt;
		&amp;lt;add name=&amp;quot;categoryRule&amp;quot; virtualUrl=&amp;quot;^~/category/(.*).aspx&amp;quot; destinationUrl=&amp;quot;~/category.aspx?name=$1&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;blogRule&amp;quot; virtualUrl=&amp;quot;^~/blog.aspx&amp;quot; destinationUrl=&amp;quot;~/default.aspx?blog=true&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;authorRule&amp;quot; virtualUrl=&amp;quot;^~/author/(.*).aspx&amp;quot; destinationUrl=&amp;quot;~/author.aspx?name?=$1&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;postRuleDate&amp;quot; virtualUrl=&amp;quot;^~/post/(\d{4})/([0-1]?\d)/([0-3]?\d)/(.*).aspx&amp;quot;
			destinationUrl=&amp;quot;~/post.aspx?year=$1&amp;amp;amp;month=$2&amp;amp;amp;day=$3&amp;amp;amp;name=$4&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;postRuleMonth&amp;quot; virtualUrl=&amp;quot;~/post/(\d{4})/([0-1]?\d)/(.*).aspx&amp;quot;
			destinationUrl=&amp;quot;~/post.aspx?year=$1&amp;amp;amp;month=$2&amp;amp;amp;name=$3&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;postRuleTitle&amp;quot; virtualUrl=&amp;quot;~/post/(.*).aspx&amp;quot; destinationUrl=&amp;quot;~/post.aspx?name=$1&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;pageRule&amp;quot; virtualUrl=&amp;quot;~/page/(.*).aspx&amp;quot; destinationUrl=&amp;quot;~/page.aspx?name=$1&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;calendarRule&amp;quot; virtualUrl=&amp;quot;~/calendar/.*&amp;quot; destinationUrl=&amp;quot;~/calendar.aspx&amp;quot;/&amp;gt;
	&amp;lt;/rewrites&amp;gt;
&amp;lt;/urlrewritingnet&amp;gt;
&amp;lt;system.web&amp;gt;
	&amp;lt;httpModules&amp;gt;
		&amp;lt;add name=&amp;quot;UrlRewriteModule&amp;quot; type=&amp;quot;UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter&amp;quot;/&amp;gt;
	&amp;lt;/httpModules&amp;gt;
&amp;lt;/system.web&amp;gt;&lt;/pre&gt;

&lt;p&gt;The above handles rewriting of Url&#039;s nothing more, nothing less. The existing BlogEngine.NET UrlRewrite have some business logic built in, for instance to retrieve the identifier of posts and sending them to the page that shows the post. I feel this doesn&#039;t belong in an UrlRewriter so I will implement this logic on the pages that actually handles the requests instead of on the UrlRewriter.&lt;/p&gt;

&lt;p&gt;So this was the first step, now we can move the if statement out of our default.aspx and let it concentrate on showing the default content which is the frontpage of the blog and the other pages concentrate on their tasks. How to implement the pages referred to in the mapping above will follow in the next post.&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=go8CzH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=go8CzH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=CjC8jH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=CjC8jH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=5jme0H&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=5jme0H&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=U45NZh&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=U45NZh&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=oHLSch&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=oHLSch&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=ErvAIH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=ErvAIH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/intellectdk/~4/286679450&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
            
            <pubDate>Fri, 09 May 2008 02:18:54 -0700</pubDate>
        </item>
            
        <item>
            <title>BlogEngine.NET - Urlrewriting</title>
            <link>http://swik.net/tag4sree/Detached+objects+in+nHibernate+and+Lazy+loading/BlogEngine.NET+-+Urlrewriting/b4w5d</link>
            <description>&lt;p&gt;So the first thing I usually do when reviewing web projects is to find the default entry page that the user would see. When doing this with BlogEngine.NET you find the default.aspx (obviously in most cases). The first thing in the Page_Load of this is the following code:&lt;/p&gt;  &lt;pre class=&quot;c-sharp&quot;&gt;if (Request.RawUrl.ToLowerInvariant().Contains(&amp;quot;/category/&amp;quot;)){...}
else if (Request.RawUrl.ToLowerInvariant().Contains(&amp;quot;/author/&amp;quot;)){...}
else if (Request.RawUrl.ToLowerInvariant().Contains(&amp;quot;?tag=&amp;quot;)){...}
//a couple of else if&#039;s more&lt;/pre&gt;

&lt;p&gt;So this makes it clear that the default.aspx page handles all listing of posts whether it is all in a category, all by an author or all having a specific tag. All these listings are requested using different URI&#039;s, to handle this an UrlRewrite HttpModule is implemented. If we look at some code in this UrlRewriter we will find:&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;if (context.Request.Path.Contains(&amp;quot;/blog.aspx&amp;quot;)){...}
else if (url.Contains(&amp;quot;/POST/&amp;quot;)){...}
else if (url.Contains(&amp;quot;/CATEGORY/&amp;quot;)){...}
else if (url.Contains(&amp;quot;/AUTHOR/&amp;quot;)){...}
//a couple of else if&#039;s more&lt;/pre&gt;

&lt;p&gt;So what happens here is we delegate the responsibility for different URL&#039;s to be handled on different pages, the responsibilities redirected to the default page is afterwards on the default page once again delegated to different methods handling databinding because presentation is alike. This results in some parsing of the URL&#039;s is duplicated in the UrlRewriter and in the default.aspx.cs file. And furthermore the collection of all posts is iterated both in the UrlRewriter and on the pages, that seems silly. Why not let UrlRewriting do what its intended for: to forward information and then keep the processing on simple pages for specific requests to avoid the redundant parsing and iteration?&lt;/p&gt;

&lt;p&gt;I read an &lt;a href=&quot;http://www.infoq.com/news/2007/11/BlogEngine&quot;&gt;interview with the BlogEngine.NET founder on InfoQ&lt;/a&gt; a while back, and it seems he has some issues with third party dependencies. I don&#039;t see the reason for this, if you can use a third party dependency too do a task it does well and have been doing in many projects already, why roll your own. So allow me to introduce &lt;a href=&quot;http://www.urlrewriting.net&quot;&gt;UrlRewritingNet.UrlRewrite&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;UrlRewritingNet basically consists of a generic HttpHandler that rewrites based on rules you set up in a configuration section in your web.config file, so instead of having to change code to change rewrites, we change simple regular expressions in our configuration of UrlRewritingNet. So lets see the rules I set up for BlogEngine.NET:&lt;/p&gt;

&lt;pre class=&quot;xml&quot;&gt;&amp;lt;configSections&amp;gt;
	&amp;lt;section name=&amp;quot;urlrewritingnet&amp;quot;
		restartOnExternalChanges=&amp;quot;true&amp;quot;
		requirePermission=&amp;quot;false&amp;quot;
		type=&amp;quot;UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter&amp;quot;
	/&amp;gt;
&amp;lt;/configSections&amp;gt;
&amp;lt;urlrewritingnet xmlns=&amp;quot;http://www.urlrewriting.net/schemas/config/2006/07&amp;quot;&amp;gt;
	&amp;lt;rewrites&amp;gt;
		&amp;lt;add name=&amp;quot;categoryRule&amp;quot; virtualUrl=&amp;quot;^~/category/(.*).aspx&amp;quot; destinationUrl=&amp;quot;~/category.aspx?name=$1&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;blogRule&amp;quot; virtualUrl=&amp;quot;^~/blog.aspx&amp;quot; destinationUrl=&amp;quot;~/default.aspx?blog=true&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;authorRule&amp;quot; virtualUrl=&amp;quot;^~/author/(.*).aspx&amp;quot; destinationUrl=&amp;quot;~/author.aspx?name?=$1&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;postRuleDate&amp;quot; virtualUrl=&amp;quot;^~/post/(\d{4})/([0-1]?\d)/([0-3]?\d)/(.*).aspx&amp;quot;
			destinationUrl=&amp;quot;~/post.aspx?year=$1&amp;amp;amp;month=$2&amp;amp;amp;day=$3&amp;amp;amp;name=$4&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;postRuleMonth&amp;quot; virtualUrl=&amp;quot;~/post/(\d{4})/([0-1]?\d)/(.*).aspx&amp;quot;
			destinationUrl=&amp;quot;~/post.aspx?year=$1&amp;amp;amp;month=$2&amp;amp;amp;name=$3&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;postRuleTitle&amp;quot; virtualUrl=&amp;quot;~/post/(.*).aspx&amp;quot; destinationUrl=&amp;quot;~/post.aspx?name=$1&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;pageRule&amp;quot; virtualUrl=&amp;quot;~/page/(.*).aspx&amp;quot; destinationUrl=&amp;quot;~/page.aspx?name=$1&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;calendarRule&amp;quot; virtualUrl=&amp;quot;~/calendar/.*&amp;quot; destinationUrl=&amp;quot;~/calendar.aspx&amp;quot;/&amp;gt;
	&amp;lt;/rewrites&amp;gt;
&amp;lt;/urlrewritingnet&amp;gt;
&amp;lt;system.web&amp;gt;
	&amp;lt;httpModules&amp;gt;
		&amp;lt;add name=&amp;quot;UrlRewriteModule&amp;quot; type=&amp;quot;UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter&amp;quot;/&amp;gt;
	&amp;lt;/httpModules&amp;gt;
&amp;lt;/system.web&amp;gt;&lt;/pre&gt;

&lt;p&gt;The above handles rewriting of Url&#039;s nothing more, nothing less. The existing BlogEngine.NET UrlRewrite have some business logic built in, for instance to retrieve the identifier of posts and sending them to the page that shows the post. I feel this doesn&#039;t belong in an UrlRewriter so I will implement this logic on the pages that actually handles the requests instead of on the UrlRewriter.&lt;/p&gt;

&lt;p&gt;So this was the first step, now we can move the if statement out of our default.aspx and let it concentrate on showing the default content which is the frontpage of the blog and the other pages concentrate on their tasks. How to implement the pages referred to in the mapping above will follow in the next post.&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=go8CzH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=go8CzH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=CjC8jH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=CjC8jH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=5jme0H&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=5jme0H&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=U45NZh&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=U45NZh&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=oHLSch&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=oHLSch&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=ErvAIH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=ErvAIH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src=&quot;http://feeds.feedburner.com/~r/intellectdk/~4/286679450&quot; height=&quot;1&quot; width=&quot;1&quot;/&gt;</description>
            
            <pubDate>Fri, 09 May 2008 02:18:53 -0700</pubDate>
        </item>
            
        <item>
            <title>BlogEngine.NET - DAL Architecture</title>
            <link>http://swik.net/tag4sree/Detached+objects+in+nHibernate+and+Lazy+loading/BlogEngine.NET+-+DAL+Architecture/b4wlb</link>
            <description>&lt;p&gt;So as I wrote a few days ago I have been looking at BlogEngine.NET and considered how I would have designed its lower layers. So lets kick off with the provider that&#039;s currently used in BlogEngine.NET for accessing the various storages (XML and RDBMS). The provider is responsible for accessing all data, that is Pages, Categories, Posts etc. Furthermore for each of these types of data it is responsible for the structure of the storage location, transforming the data from storage to objects including loading of related data. In my book this isn&#039;t good for extensibility, and as BlogEngine.NET provides multiple point for extending its functionality I would argue that it should be possible to extend its storage mechanism to handle new types of data just as easily. Currently extending the data access would involve adding new members to the provider and its implementations.&lt;/p&gt;  &lt;p&gt;So to solve this problem (and a few others I will address shortly) my suggestion would be to make data access classes responsible for a single type only, these can share some common functionality that deals with the structure of the storage when we talk about the XML provider. So basically we want to specify how these classes should look, the most generic approach is represented by this interface.&lt;/p&gt;   &lt;pre class=&quot;c-sharp&quot;&gt;public interface IRepository&amp;lt;T&amp;gt;
{
    //Retrieval
    T Load(Guid identifier);
    IList&amp;lt;T&amp;gt; LoadAll();

    //Modification
    void Save(T instance);
    void Delete(T instance);
    void Delete(Guid identifier);
}&lt;/pre&gt;


&lt;p&gt;I have made the assumption here that all data has a Guid identifier, of course this could be handled so that we are free to choose the type of our identifier. But for know im satisfied with the Guid-identifier&lt;/p&gt;

&lt;p&gt;Instead of implementing our repositories right away we can abstract common details for storage types away in abstract classes. This way the implementation of our actual repositories are as slim as possible. I have (based on the way XML is stored in BlogEngine.NET) chosen two different storage types for XML and implemented the abstract classes SingleFileRepository&amp;lt;T&amp;gt; and SingleFolderRepository&amp;lt;T&amp;gt;. The first one handles storage of data types where all instances are in a single XML file, the second one handles storage of data types where each instance has its own XML file all contained in a folder. So the basic responsibility of these two classes is to handle details of the storage, that is the structure on disk and the structure in the files. Let me remind you that these abstract classes are only for simplifying the implementation of the actual repositories, if development later requires changing minor details we can override or even change the implementations on these, and if we want to start from scratch without the assumptions build into these abstract classes we can implement IRepository&amp;lt;T&amp;gt; any way we would like. This gives great flexibility in how different data is stored and the opportunity for code reusability is very much still there.&lt;/p&gt;

&lt;p&gt;Lets take a look at the code for SingleFolderRepository: &lt;/p&gt;


&lt;pre class=&quot;c-sharp&quot;&gt;public abstract class SingleFolderRepository&amp;lt;T&amp;gt; : IRepository&amp;lt;T&amp;gt; where T : class, IEntity
{
    protected readonly IBlogSettings settings;
    protected readonly IObjectXmlConverter&amp;lt;T&amp;gt; converter;
    protected readonly string storagelocation;

    public SingleFolderRepository(IBlogSettings settings, IObjectXmlConverter&amp;lt;T&amp;gt; converter)
    {
        this.settings = settings;
        this.converter = converter;
        this.storagelocation = settings.StorageLocationFor(typeof (T));
    }

    public T Load(Guid identifier)
    {
        string path = Path.Combine(storagelocation, identifier + &amp;quot;.xml&amp;quot;);
        FileInfo datafile = new FileInfo(path);
        if (datafile.Exists)
        {
            return converter.Build(GetXml(datafile));
        }
        return null;
    }

    private string GetXml(FileInfo datafile)
    {
        string xml = string.Empty;
        using (StreamReader sr = new StreamReader(datafile.Open(FileMode.Open, FileAccess.Read, FileShare.Read)))
        {
            xml = sr.ReadToEnd();
        }
        return xml;
    }

    public IList&amp;lt;T&amp;gt; LoadAll()
    {
        List&amp;lt;T&amp;gt; instances = new List&amp;lt;T&amp;gt;();
        DirectoryInfo datadirectory = new DirectoryInfo(storagelocation);
        if (datadirectory.Exists)
        {
            foreach (FileInfo datafile in datadirectory.GetFiles(&amp;quot;*.xml&amp;quot;))
            {
                instances.Add(converter.Build(GetXml(datafile)));
            }
        }
        return instances;
    }

    public void Save(T instance)
    {
        if (converter.IsNew(instance))
        {
            instance.Identifier = Guid.NewGuid();
        }

        string path = Path.Combine(storagelocation, instance.Identifier + &amp;quot;.xml&amp;quot;);
        using (FileStream fs = File.Open(path, FileMode.Create, FileAccess.Write, FileShare.None))
        {
            using (StreamWriter writer = new StreamWriter(fs))
            {
                writer.Write(converter.Flatten(instance));
                writer.Flush();
            }
        }
    }

    public void Delete(T instance)
    {
        Delete(instance.Identifier);
    }

    public void Delete(Guid identifier)
    {
        string path = Path.Combine(storagelocation, identifier + &amp;quot;.xml&amp;quot;);
        File.Delete(path);
    }
}&lt;/pre&gt;


&lt;p&gt;So notice the constructor. The dependencies that this class has is passed into the contructor so before we can use the repository we need settings for the blog and an IObjectXmlConverter for the type that the repository handles. The IObjectXmlConverter handles flattening of objects to XML and building objects from XML. Below is an example an implementation of this.&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;public class CategoryConverter : IObjectXmlConverter&amp;lt;Category&amp;gt;
{
    public Category Build(string xml)
    {
        XmlDocument doc = new XmlDocument();
        doc.LoadXml(xml);
        Category c = new Category();
        c.Identifier = new Guid(doc.SelectSingleNode(&amp;quot;/category/&amp;quot;).Attributes[&amp;quot;id&amp;quot;].InnerText);
        c.Name = doc.SelectSingleNode(&amp;quot;/category/&amp;quot;).InnerText;
        return c;
    }

    public string Flatten(Category instance)
    {
        return
            XmlOutput.Create().XmlDeclaration()
                .Node(&amp;quot;category&amp;quot;)
                .Attribute(&amp;quot;id&amp;quot;, instance.Identifier.ToString())
                .InnerText(instance.Name).GetOuterXml();
    }
}&lt;/pre&gt;

&lt;p&gt;So this is where the mapping between the datastore and the objects happen, of course error handling should be in place here if we expect missing values in the data we load.&lt;/p&gt;

&lt;p&gt;With this change in structure presented above we have seperated concerns of the data access into smaller reusable components, furthermore in my book this makes the code easier to extend and understand but thats a subjective matter.&lt;/p&gt;

&lt;p&gt;So now its time to specify the actual repositories, we could settle for the functionality present on our generic IRepository but often we want more specific functionality for each datatype for instance fetching all posts in a specific category, paging of posts and so forth. So for each data type we define an interface with its actions. Currently in BlogEngine.NET much of this functionality is done in various places for instance sorting, filtering and paging. I would like to have our repositories responsible for this because the most efficient way to do these things depends on the type of storage. That is paging would for instance be done different for XML storage and RDBMS storage.&lt;/p&gt;

&lt;p&gt;So as an example we could make our repository for posts have an interface like this:&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;public interface IPostRepository : IRepository&amp;lt;Post&amp;gt;
{
    PageableList&amp;lt;Post&amp;gt; GetPage(int pagesize, int pagenum);
    PageableList&amp;lt;Post&amp;gt; GetPageInCategory(int category, int pagesize, int pagenum);
    PageableList&amp;lt;Post&amp;gt; GetPageWithTag(int tag, int pagesize, int pagenum);
    PageableList&amp;lt;Post&amp;gt; GetPageFromMonth(int month, int year, int pagesize, int pagenum);
}&lt;/pre&gt;

&lt;p&gt;Notice that we might need more methods, but this illustrates some examples on how we let the repository handle paging so it can optimize it based on the data storage.&lt;/p&gt;

&lt;p&gt;The actual implementation in the XML storage can be optimized but for now we load all data and do it in memory like BlogEngine.NET currently does. (I will discuss caching in a later post)&lt;/p&gt;

&lt;p&gt;The form and responsibility of our repositories is now pretty clear. You might have noticed that I have passed classes dependencies through their constructor. To avoid having to construct these dependencies myself I will use an Inversion of Control container that manages these dependencies for me. Furthermore configuration of the IoC container is what helps use interchange the repositiores for XML and RDBMS.&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=0VxmiH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=0VxmiH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=lJaIfH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=lJaIfH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=ljc8BH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=ljc8BH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=knbnuh&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=knbnuh&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=8v2Soh&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=8v2Soh&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=aL2NFH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=aL2NFH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
            
            <pubDate>Thu, 08 May 2008 05:20:26 -0700</pubDate>
        </item>
            
        <item>
            <title>Small challenge: call method on null</title>
            <link>http://swik.net/tag4sree/Detached+objects+in+nHibernate+and+Lazy+loading/Small+challenge%3A+call+method+on+null/b4wla</link>
            <description>&lt;p&gt;Inspired by some talk I &amp;quot;overheard&amp;quot; on twitter I thought it would be interesting to post a small challenge. Is it possible to implement the missing parts of the following code so it compiles and runs without exceptions, if yes how would you do it? You are not allowed to modify the body of the Main method but the rest is up to you.&lt;/p&gt;  &lt;pre class=&quot;c-sharp&quot;&gt;static void Main(string[] args)
{
    Foo f = null;
    f.Bar();
}&lt;/pre&gt;

&lt;p&gt;And yes its a pretty useless exercise :-)&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=ZWgC7H&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=ZWgC7H&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=efsGRH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=efsGRH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=Fn1EbH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=Fn1EbH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=so7QKh&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=so7QKh&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=ofMaih&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=ofMaih&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=lBJXIH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=lBJXIH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
            
            <pubDate>Thu, 08 May 2008 05:20:26 -0700</pubDate>
        </item>
            
        <item>
            <title>BlogEngine.NET - Urlrewriting</title>
            <link>http://swik.net/tag4sree/Detached+objects+in+nHibernate+and+Lazy+loading/BlogEngine.NET+-+Urlrewriting/b4wk9</link>
            <description>&lt;p&gt;So the first thing I usually do when reviewing web projects is to find the default entry page that the user would see. When doing this with BlogEngine.NET you find the default.aspx (obviously in most cases). The first thing in the Page_Load of this is the following code:&lt;/p&gt;  &lt;pre class=&quot;c-sharp&quot;&gt;if (Request.RawUrl.ToLowerInvariant().Contains(&amp;quot;/category/&amp;quot;)){...}
else if (Request.RawUrl.ToLowerInvariant().Contains(&amp;quot;/author/&amp;quot;)){...}
else if (Request.RawUrl.ToLowerInvariant().Contains(&amp;quot;?tag=&amp;quot;)){...}
//a couple of else if&#039;s more&lt;/pre&gt;

&lt;p&gt;So this makes it clear that the default.aspx page handles all listing of posts whether it is all in a category, all by an author or all having a specific tag. All these listings are requested using different URI&#039;s, to handle this an UrlRewrite HttpModule is implemented. If we look at some code in this UrlRewriter we will find:&lt;/p&gt;

&lt;pre class=&quot;c-sharp&quot;&gt;if (context.Request.Path.Contains(&amp;quot;/blog.aspx&amp;quot;)){...}
else if (url.Contains(&amp;quot;/POST/&amp;quot;)){...}
else if (url.Contains(&amp;quot;/CATEGORY/&amp;quot;)){...}
else if (url.Contains(&amp;quot;/AUTHOR/&amp;quot;)){...}
//a couple of else if&#039;s more&lt;/pre&gt;

&lt;p&gt;So what happens here is we delegate the responsibility for different URL&#039;s to be handled on different pages, the responsibilities redirected to the default page is afterwards on the default page once again delegated to different methods handling databinding because presentation is alike. This results in some parsing of the URL&#039;s is duplicated in the UrlRewriter and in the default.aspx.cs file. And furthermore the collection of all posts is iterated both in the UrlRewriter and on the pages, that seems silly. Why not let UrlRewriting do what its intended for: to forward information and then keep the processing on simple pages for specific requests to avoid the redundant parsing and iteration?&lt;/p&gt;

&lt;p&gt;I read an &lt;a href=&quot;http://www.infoq.com/news/2007/11/BlogEngine&quot;&gt;interview with the BlogEngine.NET founder on InfoQ&lt;/a&gt; a while back, and it seems he has some issues with third party dependencies. I don&#039;t see the reason for this, if you can use a third party dependency too do a task it does well and have been doing in many projects already, why roll your own. So allow me to introduce &lt;a href=&quot;http://www.urlrewriting.net&quot;&gt;UrlRewritingNet.UrlRewrite&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;UrlRewritingNet basically consists of a generic HttpHandler that rewrites based on rules you set up in a configuration section in your web.config file, so instead of having to change code to change rewrites, we change simple regular expressions in our configuration of UrlRewritingNet. So lets see the rules I set up for BlogEngine.NET:&lt;/p&gt;

&lt;pre class=&quot;xml&quot;&gt;&amp;lt;configSections&amp;gt;
	&amp;lt;section name=&amp;quot;urlrewritingnet&amp;quot;
		restartOnExternalChanges=&amp;quot;true&amp;quot;
		requirePermission=&amp;quot;false&amp;quot;
		type=&amp;quot;UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter&amp;quot;
	/&amp;gt;
&amp;lt;/configSections&amp;gt;
&amp;lt;urlrewritingnet xmlns=&amp;quot;http://www.urlrewriting.net/schemas/config/2006/07&amp;quot;&amp;gt;
	&amp;lt;rewrites&amp;gt;
		&amp;lt;add name=&amp;quot;categoryRule&amp;quot; virtualUrl=&amp;quot;^~/category/(.*).aspx&amp;quot; destinationUrl=&amp;quot;~/category.aspx?name=$1&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;blogRule&amp;quot; virtualUrl=&amp;quot;^~/blog.aspx&amp;quot; destinationUrl=&amp;quot;~/default.aspx?blog=true&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;authorRule&amp;quot; virtualUrl=&amp;quot;^~/author/(.*).aspx&amp;quot; destinationUrl=&amp;quot;~/author.aspx?name?=$1&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;postRuleDate&amp;quot; virtualUrl=&amp;quot;^~/post/(\d{4})/([0-1]?\d)/([0-3]?\d)/(.*).aspx&amp;quot;
			destinationUrl=&amp;quot;~/post.aspx?year=$1&amp;amp;amp;month=$2&amp;amp;amp;day=$3&amp;amp;amp;name=$4&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;postRuleMonth&amp;quot; virtualUrl=&amp;quot;~/post/(\d{4})/([0-1]?\d)/(.*).aspx&amp;quot;
			destinationUrl=&amp;quot;~/post.aspx?year=$1&amp;amp;amp;month=$2&amp;amp;amp;name=$3&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;postRuleTitle&amp;quot; virtualUrl=&amp;quot;~/post/(.*).aspx&amp;quot; destinationUrl=&amp;quot;~/post.aspx?name=$1&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;pageRule&amp;quot; virtualUrl=&amp;quot;~/page/(.*).aspx&amp;quot; destinationUrl=&amp;quot;~/page.aspx?name=$1&amp;quot;/&amp;gt;
		&amp;lt;add name=&amp;quot;calendarRule&amp;quot; virtualUrl=&amp;quot;~/calendar/.*&amp;quot; destinationUrl=&amp;quot;~/calendar.aspx&amp;quot;/&amp;gt;
	&amp;lt;/rewrites&amp;gt;
&amp;lt;/urlrewritingnet&amp;gt;
&amp;lt;system.web&amp;gt;
	&amp;lt;httpModules&amp;gt;
		&amp;lt;add name=&amp;quot;UrlRewriteModule&amp;quot; type=&amp;quot;UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter&amp;quot;/&amp;gt;
	&amp;lt;/httpModules&amp;gt;
&amp;lt;/system.web&amp;gt;&lt;/pre&gt;

&lt;p&gt;The above handles rewriting of Url&#039;s nothing more, nothing less. The existing BlogEngine.NET UrlRewrite have some business logic built in, for instance to retrieve the identifier of posts and sending them to the page that shows the post. I feel this doesn&#039;t belong in an UrlRewriter so I will implement this logic on the pages that actually handles the requests instead of on the UrlRewriter.&lt;/p&gt;

&lt;p&gt;So this was the first step, now we can move the if statement out of our default.aspx and let it concentrate on showing the default content which is the frontpage of the blog and the other pages concentrate on their tasks. How to implement the pages referred to in the mapping above will follow in the next post.&lt;/p&gt;&lt;div class=&quot;feedflare&quot;&gt;
&lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=ouCiCH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=ouCiCH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=5wJMWH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=5wJMWH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=hTQuyH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=hTQuyH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=wXIhyh&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=wXIhyh&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=bNgImh&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=bNgImh&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href=&quot;http://feeds.feedburner.com/~f/intellectdk?a=Zp1bdH&quot;&gt;&lt;img src=&quot;http://feeds.feedburner.com/~f/intellectdk?i=Zp1bdH&quot; border=&quot;0&quot;&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;</description>
            
            <pubDate>Thu, 08 May 2008 05:20:26 -0700</pubDate>
        </item>
            
        <item>
            <title>BlogEngine.NET - DAL Architecture</title>
            <link>http://swik.net/tag4sree/Hibernate+-+Objects/BlogEngine.NET+-+DAL+Architecture/b4wk8</link>
            <description>&lt;p&gt;So as I wrote a few days ago I have been looking at BlogEngine.NET and considered how I would have designed its lower layers. So lets kick off with the provider that&#039;s currently used in BlogEngine.NET for accessing the various storages (XML and RDBMS). The provider is responsible for accessing all data, that is Pages, Categories, Posts etc. Furthermore for each of these types of data it is responsible for the structure of the storage location, transforming the data from storage to objects including loading of related data. In my book this isn&#039;t good for extensibility, and as BlogEngine.NET provides multiple point for extending its functionality I would argue that it should be possible to extend its storage mechanism to handle new types of data just as easily. Currently extending the data access would involve adding new members to the provider and its implementations.&lt;/p&gt;  &lt;p&gt;So to solve this problem (and a few