I wrote a C# project with the change that I used migration To be able to use sturtup in the program: public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) .ConfigureWebHostDefaults( webBuilder => webBuilder.UseStartup<startup>() ); , and commands in Startup: public class Startup { public IConfiguration Configuration { get; set; } public Startup(IConfiguration configuration) { Configuration = configuration; } } public void ConfigureServices(IServiceCollection services) { services.AddDbContext<readscalecontext>(options => { options.UseSqlServer(Configuration.GetConnectionString("ReadScaleConnection")); }); } The tables were all created correctly with the migration command. I just want to know why the tables are not called and it returns null. The example of my first command is: List<accounttype> GetAllAccountType(); and used this: dgvOperators.DataSource = _operatorService.GetAllOperatore(); Thank you very much for your guidance Error: System.NullReferenceException: 'Object reference not set to an instance of an object.' db was null. What I have tried: i use enabale-migration and update-database
System.NullReferenceException: 'Object reference not set to an instance of an object.'
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)