Define your connection in the configuration file or context
e.g
var connection = @"Server=.;Database=Testing;Trusted_Connection=True;ConnectRetryCount=0";
Go to your startup file and add the correct context
e.g
services.AddDbContext<ExampleContext>(options => options.UseSqlServer(connection)); }
or
var connection = Configuration.GetConnectionString("DatabaseConnection");
services.AddDbContext<DatabaseContext>(options => options.UseSqlServer(connection));
e.g
var connection = @"Server=.;Database=Testing;Trusted_Connection=True;ConnectRetryCount=0";
Go to your startup file and add the correct context
e.g
services.AddDbContext<ExampleContext>(options => options.UseSqlServer(connection)); }
or
var connection = Configuration.GetConnectionString("DatabaseConnection");
services.AddDbContext<DatabaseContext>(options => options.UseSqlServer(connection));
No comments:
Post a Comment