how to implement factory design pattern in C#
<p>I am trying to implement <code>Factory pattern</code> in my application. </p>

<p>With reference to these links, I am trying to implement but stuck at one place &amp; not sure how to proceed.</p>

<ul>
<li><a href="https://stackoverflow.com/questions/41237261/how-to-update-this-class-method-to-improve-code-metrics">How to update this class/method to improve Code Metrics</a></li>
<li><a href="http://www.dofactory.com/net/factory-method-design-pattern" rel="nofollow noreferrer">http://www.dofactory.com/net/factory-method-design-pattern</a></li>
<li><a href="https://stackoverflow.com/questions/33462867/how-to-implement-factory-pattern">How to implement Factory pattern?</a></li>
</ul>

<blockquote>
  <p>Please find "// confused here how do I implement here" comment in my
  code to get where I am stuck.</p>
</blockquote>

<pre><code> //DAL Layer
 public interface IReportHandler
{
     IEnumerable&lt;DocumentMapper&gt; FetchDocumentsList(Guid clientId, int pager = 0);


}



public class ReportHandler : IReportHandler
{
      public IEnumerable&lt;DocumentMapper&gt; FetchDocumentsList(Guid clientId,  int pager = 0)
    {
          //implentation of the method
    }
}



//BLL 
public interface IReportFactory
{
    IReportHandler Create(int factoryId);
}

public class ReportFactory : IReportFactory
{
    private IReportHandler reportObj;

    public override IReportHandler Create(int factoryId)
    {
        switch (factoryId)
        {
            case 1:
                reportObj = new ReportHandler();
                return reportObj;
            default:
                throw new ArgumentException("");
        }


    }
}

//UI Layer
  public String GetAllDocuments(string url,int pager =0)
    {
        if (SessionInfo.IsAdmin)
        {
            string documents ; 
            //call GetDocumentIntoJson() private method 

        }
        else
        {
            return "Sorry!! You are not authorized to perform this action";
        }
    }


    private static string GetDocumentIntoJson(int clientId, int pager)
    {
       // confused here how do I implement here
        IReportHandler dal = ReportFactory
        var documents = dal.FetchDocumentsList(clientId, pager);
        string documentsDataJSON = JsonConvert.SerializeObject(documents);

        return documentsDataJSON;
    }
</code></pre>

<p>Can somebody guide me to implement the factory pattern + improve my code-snippet?</p>

<p>Any help/suggestion highly appreciated. </p>