How to generate the 'using' command for our EFCore provider
I have created code in our EFCore provider to scaffold a database. This is based on the SQL Server EFCore provider and with one exception it seems to be working.
The exception is the "using Teradata.EntityFrameworkCore;" statement that we need to add at the top of the generated Context file.
Without this line any attempt to compile the generated source results in an error because it can not find the UseTeradata() extension method used in the OnConfiguring() method.
e.g.
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
optionsBuilder.UseTeradata("User Id=xxx;Data Source=yyy;Password=zzz");
}
}
I have searched both the SQLServer EFCore source code and the PgSQL code for a line that adds a similar using statement but I can't find one.
How do I tell it to add this line of code to the top of the context file. I suspect I just need to pass a string to some method but if so I can't find the method.
EF Core version: 2.1 Database Provider: Teradat.EntityFrameworkCore Operating system: Windows IDE: Visual Studio 2017 15.6)
Thanks, Mike.
@MikeDempseyFL The common pattern is to put UseXxx methods (and other extension methods that developers need to resolve easily) into the Microsoft.EntityFrameworkCore namespace.
OK Thanks. That explains why I couldn't find it :)