码迷,mamicode.com
首页 > 数据库 > 详细

EF中使用NextVal(oracle)

时间:2015-08-06 09:22:27      阅读:239      评论:0      收藏:0      [点我收藏+]

标签:

编写扩展方法

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)

标签:

原文地址:http://www.cnblogs.com/woxiangxin/p/4707035.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!