Oracle Entity Framework - Call custom function (EDIT_DISTANCE)

后端 未结 3 365
花落未央
花落未央 2021-01-13 09:18

I am using Entity Framework 6 and Oracle Database 11g (ODP.NET Manage Driver).

How to call UTL_MATCH.EDIT_DISTANCE function in LINQ query?

3条回答
  •  无人共我
    2021-01-13 09:54

    I agree with Gerrie Pretorius and if you used database first model , you must add a function to edmx file like below

       
              
            
    

    Then add a static function to OracleFunctions class like below

    [EdmFunction("Model.Store", "TO_CHAR")]
    public static int? ToNumber(this string value) {
        throw new NotSupportedException("this function is not supported");
    }
    

    After that you can use ToNumber function freely.

提交回复
热议问题