1

Is this possible? I mean, I'm basically looking to do the following...

I have created a function already in my database (although if there's a way to create it using code first migrations, that's fine by me too) called GetPlayerPosition that accepts 1 parameter (an integer representing a Player ID).

I'm looking to do something like this with LINQ in my MVC code:

from p in db.Players
select new { p.PlayerId, GetPlayerPosition(p.PlayerId)};

I know I can't just simply do this, unfortunately (at least not without someway of getting EF to recognize this function), but I've tried hunting around for a while to find a way to do this and I'm just spinning my wheels. Any help is appreciated.

1 Answer 1

3

You can use the Code First Functions convention to invoke stored procedures, TVFs and scalar UDFs from Code First (EF 6.1.1).

Sign up to request clarification or add additional context in comments.

1 Comment

I will take a look at this, thanks a lot for the info, Pawel! I unfortunately can't vote up though due to being a new user.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.