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

后端 未结 2 1288
盖世英雄少女心
盖世英雄少女心 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.

    0 讨论(0)
  • 2021-01-27 05:53

    Your namespace arg to EdmFunctionAttribute looks suspicious. That looks like a CLR type, not a store space. This blog post might help you sort that out.

    0 讨论(0)
提交回复
热议问题