📜  实体框架数据库序列 - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:48.702000             🧑  作者: Mango

代码示例1
public partial class YourEfContext : DbContext 
{
    .... (other EF stuff) ......

    // get your EF context
    public int GetNextSequenceValue()
    {
        var rawQuery = Database.SqlQuery("SELECT NEXT VALUE FOR dbo.TestSequence;");
        var task = rawQuery.SingleAsync();
        int nextVal = task.Result;

        return nextVal;
    }
}