How can I execute an Oracle function from within a LINQ expression in Entity Framework 4?

后端 未结 2 1287
盖世英雄少女心
盖世英雄少女心 2021-01-27 05:25

I am using Visual Studio 2010, C#, Entity Framework 4 and Oracle 10g.

I need to be able to return the result of a database function as a scalar property of an anonymous

2条回答
  •  故里飘歌
    2021-01-27 05:44

    Use the Model.Store namespace:

    public partial class LINQtest2Entities
    {
        [EdmFunction("LINQtest2Model.Store", "FNC_ADD")]
        public decimal FNC_ADD(decimal V1, decimal V2)
        {
            // don’t need to implement the function
            throw new ApplicationException();
        }
    }

    In case you have provided the namespace correctly everything works smoothly.

提交回复
热议问题