Posts

Showing posts with the label Entity Framework Core

Donate

Entity Framework Core Scaffold-DbContext Error - The certificate chain was issued by an authority that is not trusted.

Image
Hello, I was converting a .NET core 2.2 console application into a .NET 7 project that will reverse engineer a sample database from Microsoft called ContosoRetailDW as the data source for my Entity Framework Core project. Upon running the Scaffold-DbContext command in Nuget Package Manager Console, an error occured was shown on the window with the specific message "A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - The certificate chain was issued by an authority that is not trusted.)" Scaffold-DbContext "Server=Your_Server;Database=ContosoRetailDW;Integrated Security=True" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models After reading through the forums, the solution that worked form me was to add a TrustServerCertifcate setting with a value to true or Encrypt setting set to false. The latter is the recommended one based from the forum answers. Option

Getting Started With Bootstrap-Table In An ASP.NET Core MVC 5 Web Application With Entity Framework Core And SQL Server

Image
Hello, In this tutorial, I will demonstrate on how to integrate Bootstrap-Table created by Wenzhixin in an ASP.NET Core MVC 5 with Entity Framework Core and SQL Server. For this post, I'll be using Microsoft's free database called ContosoRetailDW. Most of the ASP.NET MVC 5 web project in our company use this widget for showing records to clients because this has tons of features like exporting, paging, searching, sorting by column names and a whole lot more and this awesome widget has been constantly improved by the product owner and some dedicated developers. Project Setup 1. Lets start by creating an ASP.NET Core MVC application targeting the latest framework which is .NET 5 using Visual Studio 2019. 2. Add these NuGet packages for Entity Framework Core and ASP.NET Core MVC Newtonsoft.Json 3. Next is to reverse engineer the ContosoRetailDW so that we can use it's tables. The bootstrap-table widget will load records from DimPromotions table. Scaffold-DbContext "

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

ASP.NET Core MVC CRUD Using Entity Framework Core, Bootstrap 4 and SQL Server

Image
Hello and Good Day! This article demonstrates on how to create an ASP.NET Core MVC application using Entity Framework Core Database First, Bootstrap 4, SQL Server, Unit Of Work And Repository Design Pattern. The IDE for this project is Visual Studio 2019 version 16.9.2. I also installed the Font Awesome icons since glyphicons are not supported in Bootstrap 4 and applied the Model Validation technique for checking of input data during submission of a form. I. Project Setup 1. Create an ASP.NET Core MVC application targetting .NET Core 3.1 or perhaps .NET 5.0 if you have it installed in your machine. 2. The project structure is composed of several folders such as Controllers, Data Access, Models and Views. For Data Access, add two more subfolders called Repository and UnitOfWork. We will need to segregate the interface and classes for the Data Access Layer. For the purpose of this tutorial, I did not add several class libraries in order keep this simple and straightforward. 3. A

Add-Migration : Cannot bind argument to parameter 'Path' because it is null - Entity Framework Core Error

Image
Good morning! Recently, I've been reading some tutorials on .NET Core specifically Entity Framework Core and doing some basic coding of the Code First Paradigm using a Console Application. However, running the first command Add-Migration "Migration Name" to enable migrations for the application produced an error "Unable to resolve startup project ''. Using project 'ConsoleDemoEF' as the startup project. Add-Migration : Cannot bind argument to parameter 'Path' because it is null" . The full details of the issue is provided below. PM> Add-Migration InitialTestMigration Unable to resolve startup project ''. Using project 'ConsoleDemoEF' as the startup project. Add-Migration : Cannot bind argument to parameter 'Path' because it is null. At line:1 char:1 + Add-Migration InitialTestMigration + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Add-Migration], ParameterBindingValidationE

Donate