Blogs Hub

by AskGif | Aug 05, 2019 | Category :coding

Implementing .NET Core Logging Levels and Categories

Implementing .NET Core Logging Levels and Categories

In .NET Core. One thing that I never implemented was granular control of logging specific levels by category. It turns out that it’s pretty easy to do, though. Logging in .NET Core passes LogLevel and Category whenever something is to be logged. Category corresponds, afaik, to namespaces. Y

read more...

by AskGif | Jun 25, 2019 | Category :coding

Nginx Reverse Proxy to ASP.NET Core In Same Docker Container

Nginx Reverse Proxy to ASP.NET Core In Same Docker Container

As mentioned in the <a title="Hosting ASP.NET Core in Docker" href="../../../../blog/404/hosting-asp-net-core-in-docker/" target="_blank" rel="noopener">previous post (Hosting ASP.NET Core in Docker)</a>, it is recommended to use something other than Kestrel as the front-line web server. In this

read more...

by AskGif | Jun 24, 2019 | Category :coding

Hosting ASP.NET Core in Docker

Hosting ASP.NET Core in Docker

The containerization trend has been growing for a while now in the industry. The idea is to &ldquo;containerize&rdquo; (or package) any application into a well-defined container. This allows the same packaged application to be deployed to run on any infrastructure. &nbsp; In other

read more...

by AskGif | Mar 23, 2019 | Category :coding

Learning Routing and AttributeRouting Web API 2 Controllers in MVC with Areas

Learning Routing and AttributeRouting Web API 2 Controllers in MVC with Areas

The Acumen ASP.NET MVC development team started working with the new Web API 2 controllers released with Visual Studio 2013, and quickly hit some important issues that took some research to resolve. &nbsp; Routing and AttributeRouting and using Web API 2 controllers inside an Area

read more...

by AskGif | Mar 23, 2019 | Category :coding

New features about ASP.NET and C#

New features about ASP.NET and C#

Microsoft is coming out with a bunch of new features that make me very glad to be a .NET-oriented developer. The ASP.NET vNext platform looks like it is going to be a solid improvement to the environment; no longer will users be tied to IIS or Visual Studio and I anticipate some strong VS competi

read more...

by AskGif | Mar 23, 2019 | Category :coding

How to Configure Log4Net file appender in C#?

How to Configure Log4Net file appender in C#?

I&rsquo;ll be honest. Setting up Log4net for ASP.NET MVC apps is a pain. For better or worse, Log4net doesn&rsquo;t error-out whenever things aren&rsquo;t set up correctly; it fails silently (really it&rsquo;s for the better, but it gets annoying!). Lately, I&rsquo;ve been using this C# snippet t

read more...

by AskGif | Mar 23, 2019 | Category :coding

How to use libgit2sharp to commit to Git repositories in C# ?

How to use libgit2sharp to commit to Git repositories in C# ?

I helped design an interesting deployment strategy for an Azure application. For one of our projects, we have an existing upgrade solution that will distribute new versions of our ASP.NET application to our clients. One of our clients runs in the app in Azure. To support this automated distributi

read more...

by AskGif | Mar 23, 2019 | Category :coding

Listening to IIS Application pool recycle events in ASP.NET

Listening to IIS Application pool recycle events in ASP.NET

One of my .NET apps was having some strange issues. It was attached to an IIS app pool, so it was possible that the app pool was recycling due to some other application&rsquo;s events or otherwise. I decided to create a listener to detect whenever the app pool was recycling and log what was causi

read more...

by AskGif | Mar 23, 2019 | Category :coding

Using Moq to Mock Entity Framework DBSet objects

Using Moq to Mock Entity Framework DBSet objects

Unit testing in .NET is pretty nice when your dependency injection/IoC is set up well, but Entity Framework 6 isn&rsquo;t the nicest framework for mocking and testing. If you&rsquo;re using ASP.NET MVC 5, you may have run into this scenario. &nbsp; Problem: You want to use or mock

read more...

by AskGif | Mar 21, 2019 | Category :coding

Learning Postgresql (npgsql), Entity Framework 7 (EF Core), and ASP.NET MVC 6

Learning Postgresql (npgsql), Entity Framework 7 (EF Core), and ASP.NET MVC 6

Finally, Entity Framework has support for databases other than SQL Server, and as many of us know, MVC 6 is cross-platform. This means we .NET devs can now launch our ASP.NET applications on a Linux server, saving huge on server costs and giving us some freedom. EF7 now supports SQL Server, Postg

read more...

by AskGif | Mar 21, 2019 | Category :coding

Ninject InSingletonScope still creates new objects

Ninject InSingletonScope still creates new objects

Me: Kernel.Bind&lt;IDataCache&gt;().To&lt;InMemoryDataCache&gt;().InSingletonScope(); Ninject: Haha, nah. Here&rsquo;s a new object bro. I don&rsquo;t know why exactly this happens but for some reason, I&rsquo;ve seen it happen in more than one project. Binding an implemen

read more...

by AskGif | Mar 21, 2019 | Category :coding

Correct way to Inject MVC and HTTP attributes and filters using Ninject

Correct way to Inject MVC and HTTP attributes and filters using Ninject

Ninject has some fun quirks. For instance, one "bug" I came across was that if you hit an ASP.NET controller with a custom attribute, the attribute&rsquo;s constructor-injected dependencies would be null on startup. For example, take the following ActionFilterAttribute: <pre class="language-

read more...