标签:
编写扩展方法
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());
}
标签:
原文地址:http://www.cnblogs.com/woxiangxin/p/4707035.html