using System.Data; using Database.Database; using Microsoft.EntityFrameworkCore; namespace Database; public class DbLogic { public static async Task GenIdAsync(ModelContext dbContext, string sequence) { var conn = dbContext.Database.GetDbConnection(); if (conn.State == ConnectionState.Closed) { await conn.OpenAsync(); } var command = conn.CreateCommand(); string query = "select " + sequence + ".nextval from dual"; command.CommandText = query; var reader = await command.ExecuteReaderAsync(); while (await reader.ReadAsync()) { var title = reader.GetString(0); //await conn.CloseAsync(); return int.Parse(title); } //await conn.CloseAsync(); return 0; } }