<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: shariaretanvir</title>
    <description>The latest articles on DEV Community by shariaretanvir (@shariaretanvir).</description>
    <link>https://dev.to/shariaretanvir</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F698648%2F71e1279a-e9fb-4460-8591-97e114c6c150.jpg</url>
      <title>DEV Community: shariaretanvir</title>
      <link>https://dev.to/shariaretanvir</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shariaretanvir"/>
    <language>en</language>
    <item>
      <title>Custom Middleware in .Net core</title>
      <dc:creator>shariaretanvir</dc:creator>
      <pubDate>Mon, 27 Sep 2021 19:11:13 +0000</pubDate>
      <link>https://dev.to/shariaretanvir/custom-middleware-in-net-core-3402</link>
      <guid>https://dev.to/shariaretanvir/custom-middleware-in-net-core-3402</guid>
      <description>&lt;p&gt;There are basically two ways to implement custom middleware outside of startup class. In real world it’s not recommended to write middleware inside startup class.  In this article I will show those two ways to implement custom middleware.&lt;/p&gt;

&lt;h1&gt;
  
  
  Custom middleware in a separate class
&lt;/h1&gt;

&lt;p&gt;So create a new class named MyCustomMiddleware and in the constructor initialize the RequestDelegate. Inside the class create a method named InvokeAsync which will call the next middleware and do some changes in the application. Here is the code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    public class MyCustomMiddleware
    {
        private readonly RequestDelegate next;

        public MyCustomMiddleware(RequestDelegate next)
        {
            this.next = next;
        }

        public async Task InvokeAsync(HttpContext context) {
            await context.Response.WriteAsync("In custom middleware\n");
            await next.Invoke(context);
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we need to register this class as a custom middleware. For that we need to extend the implementation of IApplicationBuilder interface. In the method body we have to register our middleware into the application pipeline by using UseMiddleware method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    public static class MiddlwareExtensions
    {
        public static IApplicationBuilder UseCustomMiddleware(this IApplicationBuilder app)
            =&amp;gt; app.UseMiddleware&amp;lt;MyCustomMiddleware&amp;gt;();
    }  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At the end we have to modify our Configure method in the startup class by this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app.Use(async (contect, next) =&amp;gt;
            {
                await contect.Response.WriteAsync("Use middleware 1 start\n");
                await next.Invoke();
                await contect.Response.WriteAsync("Use middleware 1 end\n");
            });
            app.UseCustomMiddleware();

app.Run(async context =&amp;gt;
            {
                await context.Response.WriteAsync("Run middleware\n");
            });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When we run the application we can see our middleware get executed. And the results looks like this.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IZ6ywseG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9e3tu6ukx2d2als5x1z3.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IZ6ywseG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9e3tu6ukx2d2als5x1z3.PNG" alt="custom class"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Using IMiddleware interface
&lt;/h1&gt;

&lt;p&gt;Imiddleware interface have the invoke method by which we can get access both HttpContext and RequestDelegate. So we don’t need to create constructor for initializing delegates.&lt;br&gt;
There are some benefits using this approach like &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Application activates our custom middleware as per request as we register our middleware in the service as Transient.&lt;/li&gt;
&lt;li&gt; We can use strongly type with our middleware
&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class FactoryBasedCustomMiddleware : IMiddleware
    {
        public async Task InvokeAsync(HttpContext context, RequestDelegate next)
        {
            await context.Response.WriteAsync("Factory based custom middleware.\n");
            await next.Invoke(context);
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now as before we have to register our custom middleware class to the IApplicationBuilder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public static class MiddlwareExtensions
    {
        public static IApplicationBuilder UseCustomMiddleware(this IApplicationBuilder app)
            =&amp;gt; app.UseMiddleware&amp;lt;MyCustomMiddleware&amp;gt;();

        public static IApplicationBuilder UseFactoryBasedCustomMiddleware(this IApplicationBuilder app)
            =&amp;gt; app.UseMiddleware&amp;lt;FactoryBasedCustomMiddleware&amp;gt;();
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Also change the Configure method like before.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app.Use(async (contect, next) =&amp;gt;
            {
                await contect.Response.WriteAsync("Use middleware 1 start\n");
                await next.Invoke();
                await contect.Response.WriteAsync("Use middleware 1 end\n");
            });
            app.UseCustomMiddleware();
            app.UseFactoryBasedCustomMiddleware();
app.Run(async context =&amp;gt;
            {
                await context.Response.WriteAsync("Run middleware\n");
            });

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But in this approach we need to register our middleware class as a service in the ConfigureServices method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;services.AddTransient&amp;lt;FactoryBasedCustomMiddleware&amp;gt;();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the output will looks like this and we can see that both our custom middleware will execute.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---1Jc7H1Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ad8aq2h15f67apro64g.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---1Jc7H1Z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4ad8aq2h15f67apro64g.PNG" alt="postman 2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Both of this approach is easy to implement.&lt;/p&gt;

&lt;p&gt;Feel free to comment and let me know your opinion about those approach. &lt;/p&gt;

</description>
      <category>csharp</category>
      <category>dotnet</category>
      <category>todayilearned</category>
    </item>
    <item>
      <title>Middleware in .Net core</title>
      <dc:creator>shariaretanvir</dc:creator>
      <pubDate>Mon, 27 Sep 2021 19:03:18 +0000</pubDate>
      <link>https://dev.to/shariaretanvir/middleware-in-net-core-k9g</link>
      <guid>https://dev.to/shariaretanvir/middleware-in-net-core-k9g</guid>
      <description>&lt;p&gt;Asp.net core middleware is a software component integrated with application pipeline that we can use to handle http requests and responses. It’s a very important concepts in .net core environment. In .net core middleware are used in the configure method on startup class. We can also use custom middleware in that section. There are couple of ways to implement custom middleware which I will cover in another article. &lt;/p&gt;

&lt;p&gt;There are mainly 3 methods by which we can manage middleware in our application.&lt;/p&gt;

&lt;h1&gt;
  
  
  Run()
&lt;/h1&gt;

&lt;p&gt;This middleware is basically used at the end of the pipeline. It adds a terminal component in the pipeline. It has a single parameter which takes request delegates. It doesn’t has any next delegate as it terminates the pipeline. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; app.Run(async context =&amp;gt;
   {
      await context.Response.WriteAsync("Started");
   });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we use run method and in the output we will see Started. After executing run method no other middleware will be executed as it return back to the pipeline process.&lt;/p&gt;

&lt;h1&gt;
  
  
  Use()
&lt;/h1&gt;

&lt;p&gt;To use multiple middleware we can use this method. It takes 2 parameters, one is request delegate another one is next delegates. Next is used to call the next middleware in the pipeline. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app.Use(async (contect, next) =&amp;gt; {
                await contect.Response.WriteAsync("Use middleware 1 start\n");
                await next.Invoke();
                await contect.Response.WriteAsync("Use middleware 1 end\n");
            });

            app.Use(async (context, next) =&amp;gt; {
                await context.Response.WriteAsync("Use middleware 2 start\n");
                await next.Invoke();
                await context.Response.WriteAsync("Use middleware 2 end\n");
            });

            app.Run(async context =&amp;gt;
            {
                await context.Response.WriteAsync("Run middleware\n");
            });

            app.Use(async (context, next) =&amp;gt; {
                await context.Response.WriteAsync("Use middleware 3 start\n");
                await next.Invoke();
                await context.Response.WriteAsync("Use middleware 3 end\n");
            });


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here we can see multiple use middleware and those are communicating to each other. So in the postman output will be like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Use middleware 1 start
Use middleware 2 start
Run middleware
Use middleware 2 end
Use middleware 1 end

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One major thing to notice is that middleware 3 is not executing after run middleware. That’s because run doesn’t call next middleware and it terminates the cycle and return back to the upper middleware. &lt;/p&gt;

&lt;h1&gt;
  
  
  Map()
&lt;/h1&gt;

&lt;p&gt;Map function is used to branch the middleware. When a request comes with a specific path then map function is execute. When the path get matched the in the map function we can use use and run method to execute the middleware.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app.Use(async (contect, next) =&amp;gt; {
                await contect.Response.WriteAsync("Use middleware 1 start\n");
                await next.Invoke();
                await contect.Response.WriteAsync("Use middleware 1 end\n");
            });
            app.Map("/getdata", builder =&amp;gt;
            {
                builder.Use(async (context, next) =&amp;gt;
                {
                    await context.Response.WriteAsync("Map middleware start\n");
                    await next.Invoke();
                    await context.Response.WriteAsync("Map middleware end\n");
                });
                builder.Run(async (context) =&amp;gt;
                {
                    await context.Response.WriteAsync("Map Run middleware\n");
                });
            });


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So when we call /getdata we can see the following output.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Use middleware 1 start
Map middleware start
Map Run middleware
Map middleware end
Use middleware 1 end

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s because after the use function get called map middleware will get executed and in the map function there are two function. When run method get executed middleware get terminated and no other middleware will execute.  &lt;/p&gt;

&lt;h1&gt;
  
  
  MapWhen()
&lt;/h1&gt;

&lt;p&gt;Mapwhen function is used to branch the pipeline depending of the given predicate. When the condition returns true then this function executes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app.Use(async (contect, next) =&amp;gt; {
                await contect.Response.WriteAsync("Use middleware 1 start\n");
                await next.Invoke();
                await contect.Response.WriteAsync("Use middleware 1 end\n");
            });

app.MapWhen(context =&amp;gt; context.Request.Query.ContainsKey("token"), builder =&amp;gt;
            {
                builder.Use(async (context, next) =&amp;gt;
                {
                    await context.Response.WriteAsync("Use map start\n");
                    await next.Invoke();
                    await context.Response.WriteAsync("use map end\n");
                });
                builder.Run(async context =&amp;gt;
                {
                    await context.Response.WriteAsync("use map run executes");
                });
            });


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If we request with the query string contains token then web can see the output given below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Ii7HFmKA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x4ganoj1daarakkpmgqq.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Ii7HFmKA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x4ganoj1daarakkpmgqq.PNG" alt="postman" width="681" height="556"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can see the request link as it contains key name token. &lt;/p&gt;

&lt;p&gt;If we have several middleware but not having token query string then those middleware will not execute.&lt;/p&gt;

&lt;p&gt;So those are the core concepts of .net core middleware. We can use those concepts to build our custom middleware and use it to our application. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gfg5GhnA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e8djuj903wrcfeb2k9bw.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gfg5GhnA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e8djuj903wrcfeb2k9bw.PNG" alt="Image description" width="880" height="510"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Summery
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt; Middleware is a component which has the ability to access incoming request and responses.&lt;/li&gt;
&lt;li&gt; It can communicate to another middleware.&lt;/li&gt;
&lt;li&gt; It has an order in which it executes.&lt;/li&gt;
&lt;li&gt; We can terminates middleware whenever we want to.&lt;/li&gt;
&lt;li&gt; Common functionality like log, exception handling, authentication, and authorization based components can be a proper example for using middleware.
In the next article I will be covering how to create custom middleware and incorporate with the application.&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>dotnet</category>
      <category>csharp</category>
      <category>todayilearned</category>
    </item>
    <item>
      <title>IDisposable pattern in .Net Core</title>
      <dc:creator>shariaretanvir</dc:creator>
      <pubDate>Sat, 11 Sep 2021 12:48:24 +0000</pubDate>
      <link>https://dev.to/shariaretanvir/idisposable-pattern-in-net-core-7b8</link>
      <guid>https://dev.to/shariaretanvir/idisposable-pattern-in-net-core-7b8</guid>
      <description>&lt;p&gt;In .Net we have two kind of resources. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Managed resource&lt;/li&gt;
&lt;li&gt; Unmanaged resource&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;To understand IDisposable pattern we need to understand those concepts.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Managed resource&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Managed resource are those which are created and handled by CLR (common language runtime). Garbage collector do a very pretty job to clean up the managed resources. We don’t need to manually clean those resources.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Unmanaged resource&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Unmanaged resource are those which are outside of the scope of CLR (common language runtime). Garbage collector most of the time cannot clean up those resources. We developer need to manually clean those resources as soon as they are done.&lt;/p&gt;

&lt;p&gt;To handle unmanaged resources .Net give us IDisposable interface. We have to use that pattern to clean &lt;br&gt;
Unmanaged resources.&lt;/p&gt;

&lt;p&gt;So to implement IDisposable pattern we have to inherit that interface and implement the pattern. Basic code looks like this. I will explain each line step by step.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class Excel : IDisposable
    {
        public string FileObject { get; set; }
        public string ConnectionObject { get; set; }

public void OpenExcelFile()
        {
            FileObject = "demo";
            //open excel from specific file path.
            //creating unmanaged resources
        }

        public void OpenManageonnection()
        {
            ConnectionObject = "Managed Connection opened";
        }

}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is my class which implement IDisposable interface.  Here I created demo managed and unmanaged class just to show the purpose of this tutorial. As you can see I have created both resources, now it’s the time to implement pattern. After implementing the pattern we can see the two methods.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dispose&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public void Dispose()
        {
            // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
            Dispose(disposing: true);
            GC.SuppressFinalize(this);
        }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Dispose is the main method which gets called when someone implement dispose method by finally scope or using statements. What dispose does is to call dispose method which is virtual and it can be inherited by child classes. This is the dispose virtual method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    // TODO: dispose managed state (managed objects)
                    Console.WriteLine("managed object clean");
                    ConnectionObject = "";
                }

                // TODO: free unmanaged resources (unmanaged objects) and override finalizer
                // TODO: set large fields to null
                if (FileObject != "")
                {
                    Console.WriteLine("unmanaged object clean");
                    FileObject = "";
                }


                disposedValue = true;
            }
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This method gets called by Dispose with true value and also get called by Finalizer with false value. disposedValue is a local flag value which get track that this method can only execute once. So if the disposing is true then both managed and unmanaged objects will cleaned up. disposedValue then set to true so that it won’t execute again.&lt;/p&gt;

&lt;p&gt;After disposing we have to set that object as it won’t get into the finalizing queue and doesn’t get cleaned again. So we need to call GC for that.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GC.SuppressFinalize(this); 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will do the job for us.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Initialization of Dispose pattern&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In the calling method we can simply call this class like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;static void Main(string[] args)
 {
using (Excel excel = new Excel())
            {
                excel.OpenExcelFile();
                excel.OpenManageonnection();
            }
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using statement will automatically call the dispose method of Excel class and thus cleaned up the memory of this class.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Finalizer&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Finalizer in C# get called by Garbage collector to remove unmanaged resources. But we already clean our resource. But what will happen when developer forget to using the using statement? Then those resources won’t get cleaned. This is what finalizer is useful.&lt;/p&gt;

&lt;p&gt;GC automatically call finalizer to clean unmanaged resources. So even if we forgot to clean the unmanaged resources GC will take care if we use finalizer.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
        ~Excel()
        {
            // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
            Console.WriteLine("Finilizing");
            Dispose(disposing: false);
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As we can see in finalizer method we call dispose method with false value, which will only clean the unmanaged resources. We don’t need to worry about managed resources, GC will simply take care of that. &lt;/p&gt;

&lt;p&gt;So now the IDisposable pattern is complete. We can put some custom code in dispose method if we wish. &lt;/p&gt;

&lt;p&gt;The full implementation is looks like that.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class Excel : IDisposable
    {
        private bool disposedValue;
        public string FileObject { get; set; }
        public string ConnectionObject { get; set; }
        public void OpenExcelFile()
        {
            FileObject = "demo";
            //open excel from specific file path.
            //creating unmanaged resources
        }

        public void OpenManageonnection()
        {
            ConnectionObject = "Managed Connection opened";
        }

        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    // TODO: dispose managed state (managed objects)
                    Console.WriteLine("managed object clean");
                    ConnectionObject = "";
                }

                // TODO: free unmanaged resources (unmanaged objects) and override finalizer
                // TODO: set large fields to null
                if (FileObject != "")
                {
                    Console.WriteLine("unmanaged object clean");
                    FileObject = "";
                }


                disposedValue = true;
            }
        }

        // // TODO: override finalizer only if 'Dispose(bool disposing)' has code to free unmanaged resources
        ~Excel()
        {
            // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
            Console.WriteLine("Finilizing");
            Dispose(disposing: false);
        }

        public void Dispose()
        {
            // Do not change this code. Put cleanup code in 'Dispose(bool disposing)' method
            Dispose(disposing: true);
            Console.WriteLine("disposing start");
            GC.SuppressFinalize(this);
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is recommended if you don’t have any unmanaged resource then don’t use Finalizer as it is a costly process which may hamper performance.&lt;/p&gt;

&lt;p&gt;If you have any feedback about this topic feel free to comment.&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>dotnet</category>
      <category>todayilearned</category>
    </item>
    <item>
      <title>Use of Static class in .Net core</title>
      <dc:creator>shariaretanvir</dc:creator>
      <pubDate>Sat, 11 Sep 2021 07:41:13 +0000</pubDate>
      <link>https://dev.to/shariaretanvir/use-of-static-class-in-net-core-bem</link>
      <guid>https://dev.to/shariaretanvir/use-of-static-class-in-net-core-bem</guid>
      <description>&lt;p&gt;We all know about static class. When we use data which will not change according to caller then we can mark that as static.&lt;/p&gt;

&lt;p&gt;Today I will show an example to use static class in .Net core. We can use static class for retrieving common information like appsettings or database connection information.&lt;/p&gt;

&lt;p&gt;So we need to create a class named DBConnection.cs. We all know for accessing appsettings.json in .Net core we need to implement IConfiguration interface. IConfiguration can be accessed in controller using construction which is done by Dependency injection. Here is the example of this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class MyController : ControllerBase
    {
        public IConfiguration Configuration { get; }
        public IWebHostEnvironment Environment { get; }

        public MyController(IConfiguration configuration, IWebHostEnvironment environment, IUnitOfWork unitOfWork)
        {
            Configuration = configuration;
            Environment = environment;            
        }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But IConfiguration is not automatically accessed in any custom class other than controller, but we have to need that object to getting data from appsettings.json. &lt;/p&gt;

&lt;p&gt;So our static class will do that for us. Why we use static class for this? Because this data will not be changed or need to modified by caller methods. If you still get confused read my article about static keyword where I briefly describe about static and when to use static and when not to.&lt;/p&gt;

&lt;p&gt;So here is my code for accessing IConfiguration.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public static class DBConnection
    {
        private static IConfiguration config;
        public static IConfiguration Configuration {
            get {
                var builder = new ConfigurationBuilder()
                    .SetBasePath(Directory.GetCurrentDirectory())
                    .AddJsonFile("appsettings.json");
                config = builder.Build();
                return config;
            }
         }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So now any class can access IConfiguration object by calling our DBConnection class like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;string connectionString =  DBConnection.Configuration.GetSection("LiveConnectionStrings:CapitalMarketDB").Value;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now we can also get the common information like DBPath, Connection string from our DBConnection static class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public static string DBPath {
            get {
                return Configuration.GetSection("DBPath:Environment").Value;
            }            
        }

        public static string GetCapitalMarketConnectionString()
        {            
            return DBPath == "UAT" ? Configuration.GetSection("UATConnectionStrings:CapitalMarketDB").Value
                : Configuration.GetSection("LiveConnectionStrings:CapitalMarketDB").Value;
        }
        public static string GetCommonDBConnectionString()
        {
            return DBPath == "UAT" ? Configuration.GetSection("UATConnectionStrings:CommonDB").Value
                : Configuration.GetSection("LiveConnectionStrings:CommonDB").Value;
        }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;SO this is a real life example of static class which is implemented on .Net perspective. &lt;/p&gt;

&lt;p&gt;Feel free to comment and share your views about this article. &lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>csharp</category>
    </item>
    <item>
      <title>When to use static and when not to in C#</title>
      <dc:creator>shariaretanvir</dc:creator>
      <pubDate>Sat, 11 Sep 2021 07:36:42 +0000</pubDate>
      <link>https://dev.to/shariaretanvir/when-to-use-static-and-when-not-to-in-c-1p6</link>
      <guid>https://dev.to/shariaretanvir/when-to-use-static-and-when-not-to-in-c-1p6</guid>
      <description>&lt;p&gt;In the last post I talked about static keyword. Today I will write about the usage of static. I recommend first read that &lt;a href="https://dev.to/shariaretanvir/all-about-static-in-c-4me5"&gt;article&lt;/a&gt; where you can get a brief idea about static before read this article.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use static in C#&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Static provide an easy way to call methods and fields.&lt;/li&gt;
&lt;li&gt; Method which doesn’t work differently for different objects can be used as static.&lt;/li&gt;
&lt;li&gt; App configuration class can be a good example for static class/methods. Because it stays same throughout the application.&lt;/li&gt;
&lt;li&gt; Database Connection string is another good use case of static method.&lt;/li&gt;
&lt;li&gt; Static members make code cleaner.&lt;/li&gt;
&lt;li&gt; Mainly utility kind operations should be mark as static.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;When not to use static in C#&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Static hinders unit testing.&lt;/li&gt;
&lt;li&gt; Static missing OOP concepts including abstractions.&lt;/li&gt;
&lt;li&gt; Do not use static when the class or field is going to change according to caller class.&lt;/li&gt;
&lt;li&gt; Async or multithreading sometimes conflicts with static, mostly if someone mark data access layer as static(which is not recommended)&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>csharp</category>
      <category>dotnet</category>
    </item>
    <item>
      <title>All about Static in C#</title>
      <dc:creator>shariaretanvir</dc:creator>
      <pubDate>Sat, 11 Sep 2021 07:28:41 +0000</pubDate>
      <link>https://dev.to/shariaretanvir/all-about-static-in-c-4me5</link>
      <guid>https://dev.to/shariaretanvir/all-about-static-in-c-4me5</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is static means?&lt;/strong&gt;&lt;br&gt;
In real world static means something which is stable or sort of fixed. Something which will act similarly in all aspects. &lt;/p&gt;

&lt;p&gt;In C# static is a keyword which makes a member, property, method, constructor or class as a static which we will understand one by one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Static class&lt;/strong&gt;&lt;br&gt;
When we put static keyword on a class it becomes static class. And we cannot instantiate a static class. As a result a static class cannot be inherited by another class.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public static class Calculator
    {
        public static double Result { get; set; }
        public static string Mode { get; set; } = "Normal";
        public static double Add(double num1 , double num2)
        {
            return num1+num2;
        }

        public static void SaveResult(double result)
        {
            Result = result;
        }
    }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In calling function&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;double result = Calculator.Add(10,20);
            Calculator.SaveResult(result);
            Console.WriteLine("Latest Result {0} ",Calculator.Mode);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As we can see to call a static class we do not need to instantiate an instance. &lt;br&gt;
Important things to note&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Static classes cannot be instantiated.&lt;/li&gt;
&lt;li&gt; All the members of a static class must be static; otherwise the compiler will give an error.&lt;/li&gt;
&lt;li&gt; A static class cannot contain instance members and constructors.&lt;/li&gt;
&lt;li&gt; Static classes are sealed class and therefore, cannot be inherited.&lt;/li&gt;
&lt;li&gt; Static class members can be accessed using ClassName.MemberName.&lt;/li&gt;
&lt;li&gt; A static class remains in memory for the lifetime of the application domain in which your program resides.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Static members:&lt;/strong&gt;&lt;br&gt;
Properties and field having static keyword called static members. Static members can be use inside non static class also. Usually we can use static members when there is like constant or fixed value.&lt;br&gt;
Example :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class Employee
    {
        public int EmployeeID { get; set; }
        public string Name { get; set; }
        public string CompanyName { get; set; }
        public static string Nationality { get; set; } = "Bangladeshi";

        public void SaveEmployee(Employee employee)
        {
            string a = Employee.Nationality;
        }
    }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the calling function&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Employee employee = new Employee
            {
                EmployeeID = 0,
                Name = "Akash",
                CompanyName = "abc"
            };
            employee.SaveEmployee(employee);

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example we define Nationality as static because this is common for all objects. So we don’t need to define it for all objects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Static constructor:&lt;/strong&gt;&lt;br&gt;
Constructor having static identifier called static constructor. It will execute only for once. It execute when static method is executes or creating an instance of that object for the first time. After that it will not being called. We call use this feature to initiate some static value for the first time. A non-static class can contain one parameter less static constructor. Parameterized static constructors are not allowed.&lt;/p&gt;

&lt;p&gt;Example :&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class Employee
    {
        public int EmployeeID { get; set; }
        public string Name { get; set; }
        public string CompanyName { get; set; }
        public static string Nationality { get; set; }

        static Employee()
        {
            Nationality = "Bangladeshi";
        }
        public void SaveEmployee(Employee employee)
        {
            string a = Employee.Nationality;
        }
    }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;static void Main(string[] args)
        {
            //double result = Calculator.Add(10,20);
            //Calculator.SaveResult(result);
            //Console.WriteLine("Latest Result {0} ", Calculator.Mode);
            Employee employee = new Employee
            {
                EmployeeID = 0,
                Name = "Akash",
                CompanyName = "abc"
            };
            employee.SaveEmployee(employee);
            Console.WriteLine("Saved ");
        }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here Nationality is set in static constructor as it is common for all objects. A non-static class can contain one parameter less static constructor. Parameterized static constructors are not allowed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Static method:&lt;/strong&gt;&lt;br&gt;
Method using static keyword is called static method. Concept of static method is easy. Basically the purpose of using static method is to use this method without creating instance. &lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public class Employee
    {
        public int EmployeeID { get; set; }
        public string Name { get; set; }
        public string CompanyName { get; set; }
        public static string Nationality { get; set; }

        static Employee()
        {
            Nationality = "Bangladeshi";
        }
        public static void SaveEmployee(Employee employee)
        {
            string a = Employee.Nationality;
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;static void Main(string[] args)
        {
            //double result = Calculator.Add(10,20);
            //Calculator.SaveResult(result);
            //Console.WriteLine("Latest Result {0} ", Calculator.Mode);
            Employee employee = new Employee
            {
                EmployeeID = 0,
                Name = "Akash",
                CompanyName = "abc"
            };
            Employee.SaveEmployee(employee);
            Console.WriteLine("Saved ");
        }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Static methods cannot access or call non-static variables unless they are explicitly passed as parameters. Static methods can contain local static variables.&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>dotnet</category>
    </item>
    <item>
      <title>Enable SQL Server Authentication in SQL-server</title>
      <dc:creator>shariaretanvir</dc:creator>
      <pubDate>Fri, 03 Sep 2021 16:53:01 +0000</pubDate>
      <link>https://dev.to/shariaretanvir/enable-sql-server-authentication-in-sql-server-1j5c</link>
      <guid>https://dev.to/shariaretanvir/enable-sql-server-authentication-in-sql-server-1j5c</guid>
      <description>&lt;p&gt;Step by step process for enable SQL server authentication.&lt;/p&gt;

&lt;p&gt;SQL-server is a very popular RDBMS. After installation the authentication mode is by default set to Windows Authentication. But in real scenario its not recommended for security purpose. SQL-server also give us the option for SQL-authentication. So today I will show how to configure SQL- authentication in SQL-Server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step by step process&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;step 1. First login to sql server using windows authentication.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Bj1EnH5_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vv2ih57ugrkofgw4vq2g.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Bj1EnH5_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vv2ih57ugrkofgw4vq2g.PNG" alt="1"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;step 2. Now we need to go to the properties of sql server instance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xJADHDbE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bnud32wzwlgqajb1udeg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xJADHDbE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bnud32wzwlgqajb1udeg.png" alt="2"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;step 3. After that go to security tab and check SQL server and windows authentication mode and click OK.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oSI21SyW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qeobzd9n0gxplpyzfud0.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oSI21SyW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qeobzd9n0gxplpyzfud0.PNG" alt="3"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;step 4.Now we need to create a user who will access our database as a SQL authentication. For that go to security -&amp;gt; login -&amp;gt; new login options.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oocnN7X9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yorlic2nywm75lcym23x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oocnN7X9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yorlic2nywm75lcym23x.png" alt="4"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;step 5. Now give a user name and set up the password for that user.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--paGaoAX_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vl4ltvjstd7r9595f16v.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--paGaoAX_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vl4ltvjstd7r9595f16v.PNG" alt="5"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;step 6. Now give the user role as per requirements. For example I give all the permission for this testuser.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OvnCzK20--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g15moijd21pb15gjhw0e.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OvnCzK20--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g15moijd21pb15gjhw0e.PNG" alt="6"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;step 7. Also set up the status tab just like this. Permission will be grant and login will be Enabled. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Bm5nSmGn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/us65q5cv67pmmnladqva.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Bm5nSmGn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/us65q5cv67pmmnladqva.PNG" alt="7"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So all the necessary setting is done for our new user. Click on the OK button.&lt;/p&gt;

&lt;p&gt;Now restart the SQL server and try to login using SQL server authentication mode. Give the user login and password. You will login this time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;#Points of Interest&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sometimes SQL-server can not login and shows some error like this user can not login. For this case you can restart the sqlexpress from the services. After that try to login again. This will solve the error.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--90XeBkWd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zvxoyk8evzcwgznedmv5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--90XeBkWd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zvxoyk8evzcwgznedmv5.png" alt="8"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So after login you will see that the new SQL user is logged in.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QA2uMeCV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0p0kydl71my7ihpd57ue.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QA2uMeCV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0p0kydl71my7ihpd57ue.PNG" alt="10"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That's it. Now you can login in to SQL server using SQL authentication as well as windows authentication .&lt;/p&gt;

</description>
      <category>sql</category>
      <category>authentication</category>
      <category>sqlserver</category>
    </item>
  </channel>
</rss>
