Category: ef

  • Comparing EFCore Database Providers part 3

    I did not have the opportunity to migrate from a database from another . But seems to me that,when using EF,the principal problem will be the stored procedures,not the code that EF ( and providers) are generating automatically.  Yes,there are some problems ( see part 1 and part 2),but those seems not so important and…

  • Comparing EFCore Database Providers-part-2

    I have started with a simple table  –  Department( id autogenerated,name) and generate EFCore context and classes with scaffolding templates https://learn.microsoft.com/en-us/ef/core/managing-schemas/scaffolding/templates?tabs=dotnet-core-cli . Then I have created a simple text ( XUnit + LightBDD ) in order to test –  generateDatabase from classes – CRUD – some simple search . Works perfectly,so to the next –…

  • Comparing EFCore Database Providers-part-1

    I wanted to see if there are any differences in EFCore database providers listed at  https://learn.microsoft.com/en-us/ef/core/providers/?tabs=dotnet-core-cli I want to test the capabilities for each one within a standard choice of tables,in order to know the capabilities I choose only those that have a version for current STS / LTS,whatever it is current. ( I am…

  • Db2Code–part 1–idea

    From the second year that I have started programming,I find tedious to replicate the tables structure to code and to generate classes and SQL . I started asking questions  – and no one has ever envisaged near me an ORM ( it was not a definition then ). I have made my own ORM  –…

  • Passing a WebAPI application from .NET Core 2 to .NET Core 3 in 5 +1 (EF) steps

    Simple steps: 1. Modiffy in the .csproj  <TargetFramework>netcoreapp2.0</TargetFramework> to <TargetFramework>netcoreapp3.1</TargetFramework>  2.Delete <PackageReference Include=”Microsoft.AspNetCore.All” Version=”2.0.8″ /> 3. Modify public static IWebHost BuildWebHost(string[] args) =>public static IHostBuilder CreateHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args)Host.CreateDefaultBuilder(args) .UseStartup<Startup>() .ConfigureWebHostDefaults(webBuilder => .Build(); to public static IHostBuilder CreateHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args)Host.CreateDefaultBuilder(args) .UseStartup<Startup>() .ConfigureWebHostDefaults(webBuilder => .Build(); { webBuilder.UseStartup<Startup>(); }); 3.  Modify BuildWebHost(args).Run();  to CreateHostBuilder(args).Build().Run(); 4. Modify…

  • EF Core identical tables and partial–part 30

    Let’s suppose that you have 2 identical tables and you scaffold from the context the tables. It will give you 2 classes  – with the same properties. How can you make to work for the programmer as the same class,without modifying the models scaffolded by EF ? Example – class Ecb and class Nbr from…

  • String interpolation for EFCore and Like

    I have had a problem with EF Core and String Interpolation – until I realized that was a problem with sp_executesql But let’s see the whole problem. ta EFCore supports string interpolation –  that means,if you give this code <context>.<table>.FromSql($”select blabla from table where id={id}”) it will transform into exec sp_executesql N’select blabla from table…