As we can not see your code, we have no idea why it behaves this way. I’d assume you have some init code that needs to run on a schema change.
A weired error about HTTP 500 !
I created a web user asp.net 8.0 mvc without ef.
When I modify the stucture of oracle datebase table ,such as add a field ,then the web related to the table report a error about HTTP 500 . But after I restart the iis,it works well without doing anything else!
2 answers
Sort by: Most helpful
-
-
Alick Wang 266 Reputation points
2024-04-11T08:51:09.7866667+00:00 .net 8.0 with Dependency Injection
In Program.cs
builder.Services.AddScoped<DAL.Account.IAccount,DAL.Account.Account>();
In Account.cs
public class Account : IAccount
{
private readonly IOptions<DAL._DBConnStr> _dbconnStr;
public Account(IOptions<DAL._DBConnStr> dbconnStr)
{
_dbconnStr = dbconnStr;
}
public DataTable GetRoles()
{
using (OracleConnection conn = new OracleConnection(_dbconnStr.Value.myConnectionString))
{
DataTable dt = new DataTable();
OracleCommand selectCmd = new OracleCommand("select * from roles order by sortindex", conn);
OracleDataAdapter da = new OracleDataAdapter();
da.SelectCommand = selectCmd;
da.Fill(dt);
return dt;
}
}
In AccountController
IAccount AccountDA;
public AccountController(IAccount accountDA)
{
AccountDA = accountDA;
}
public IActionResult Login(string ua)
{
DataTable dt = AccountDA.GetUserAccountByUser(ua);
}