Calling UDF as property of entity in EF6.1 RRS feed

  • Question

  • I've been searching for a solution for this one for weeks. Hopefully someone out there can point me in the right direction.

    I'm using EF6 with MVC5.1. In my db, I have a table of products with a integer PK of ProdID. I also have a SQL UDF called GetStockLevel, which accepts the ProdID integer as an input, and outputs the stock level as an integer.

    I have created my EF Model first, and have the PRODUCT table entity. What I want to work out, is how can I add a calculated property to the PRODUCT entity that calls the GetStockLevel UDF to populate the values. I've tried using Function Imports, but it gives me an error 6046: Unable to generate function import return types of the store function.... etc

    I hope someone can help with this - driving me crazy!

    Cheers G

    Sunday, July 6, 2014 2:34 AM