当前位置:Gxlcms > 数据库问题 > EF中使用NextVal(oracle)

EF中使用NextVal(oracle)

时间:2021-07-01 10:21:17 帮助过:2人阅读

编写扩展方法

public static decimal GetNextVal(this System.Data.Entity.DbContext ctx, string seqName)

        {

            return ctx.Database.SqlQuery<decimal>(string.Format("SELECT {0}.NEXTVAL FROM DUAL", seqName)).First();

        }

        public static decimal GetNextVal<T>(this DbContext ctx, T enumValue) where T : struct, IComparable, IConvertible, IFormattable

        {

            return ctx.GetNextVal(enumValue.ToString());

        }

EF中使用NextVal(oracle)

标签:

人气教程排行