Posts

Showing posts with the label Unity Container

Donate

Using Unity IoC Container Dependency Injection, Dapper ORM and SQL Server In Visual Basic .NET Core Or .NET 5 Application

Image
Hi All, This article is the VB.NET version of this post Getting Started With Unity IoC Container Dependency Injection In .NET Core Using Entity Framework Core ORM And SQL Server . We will create a .NET Core Console Application that will utilize the Unity IoC Container for Dependency Injection, SQL Server and Dapper ORM. Instead of using Entity Framework, I'm using Dapper ORM coz EF does not support reverse engineering in .NET Core. There are existing power tools or other solutions on how to reverse engineer a database table but for now I'll just use Dapper. I'll be using Microsoft's sample database called ContosoRetailsDw as the datasource of this tutorial. Project Setup 1. Start off by creating a Visual Basic .NET Core Console Application targetting the latest framework which is .NET 5.0 2. Add three new folders Models, Repository and UnitOfWork. These folders contain the model and DAL classes used in this project. 3. Add the following NuGet packages: Dapper O

Getting Started With Unity IoC Container Dependency Injection In .NET Core Using Entity Framework Core ORM And SQL Server

Image
Hello Fellow Programmers! Visual Basic Version: Using Unity IoC Container Dependency Injection, Dapper ORM and SQL Server In Visual Basic .NET Core Or .NET 5 Application In this article, I'll demonstrate on how to incorporate the Unity IoC Container into a .NET Core Console Application using Entity Framework Core ORM and SQL Server.This will apply the constructor injection methodology of dependency injection where in dependencies are provided through a constructor. I've used this IoC Container several years ago and have not done any coding after that. So it's time to revisit this terrific tool again and create a simple application that will retrieve a single record from Microsoft's sample database called ContosoRetailsDw . Make sure the DB is installed on your machine. Once done, we may now proceed in creating the sample program by performing the steps below. Project Setup 1. Start off by creating a .NET Core Console Application targetting the latest framework wh

Unity already has a dependency defined for CommonServiceLocator (VS 2012 Ultimate)

Image
Hello, While trying to add Unity to a Console Project, I encountered an error as stated by the title of this post. After doing some research, I found a post in Stack Overflow which is to update Nuget Package Manager. When I checked my VS, the nuget package manager is an older version. So, I removed/uninstalled it and added the recent version of Nuget package manager through Tools -> Exentsion and Updates then look for Nuget Package Manager. Then install/download it in your VS IDE. See image for current Nuget Package Manager. That's It.. :)

Donate