From the course: Learning Entity Framework Core

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

SqlServerTypeMapper

SqlServerTypeMapper - Entity Framework Tutorial

From the course: Learning Entity Framework Core

Start my 1-month free trial

SqlServerTypeMapper

- [Instructor] Entity Framework Core has several types of database provider services. And one of them is called SQL Server Type Mapper. Sometimes there are certain bits of information you may need during development, and it's cool to know that there's quick ways to get that information. For example, you might want to know when you're using a certain type in code, what does it translate to, in the database? That is, what's the equivalent type? So for example, if you're using a boolean in code, how does that translate in the database? Well I want to show you how to do this, using the SQL Server Type Mapper. So the first thing that we'll want to do is, in our project, within our Using Statement here, let's enter in variable sp, and we'll going to call GetInfrastructure. And we'll need to bring in the namespace, I'll hit ctrl period, to bring in EntityFrameworkCore.Infrastructure. And within brackets, specify IServiceProvider. And what we're doing here, is on the DB Context, we're calling…

Contents