Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6115545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:06:13+00:00 2026-05-23T15:06:13+00:00

I am just starting out with the Entity Framework 4.0 and ASP.NET MVC 2

  • 0

I am just starting out with the Entity Framework 4.0 and ASP.NET MVC 2 and have a few questions regarding the use of stored procedures and paging.

You can map the Insert, Update, and Delete actions to stored procedures and I have already done this. However for my paging to work I need to map the Select action.

Now is the only / best way I can do this by going to my model browser, right clicking on the stored procedure and “Add Function Import” and adding it.

This results in the following code….

var contactFormSubmissions = _entities.ContactFormSubmission_GetContactFormSubmissions(1, 10);

My issue with this is that it adds it to the global entity container at root level rather than the ContactFormSubmission entity like the Insert / Update and Delete actions.

I would rather something like this but through through a stored procedure…

_entities.ContactFormSubmissions.Select<ContactFormSubmission>(string.Empty, pageParam, pageSizeParam);

This way the select is called in the same way as the other actions and I dont end up with lots of functions in the root of the Entity Container which could get unmanagable.

This is a lesser issue as at least its all working currently.

My next question is how to best implement paging using this function.

All of the examples I have seen on how to accomplish paging using MVC and the Entity Framework have used LINQ and IQueryable. Is there a way of using IQueryable with lazy loading and the LINQ functions Skip / Take with a table based function /sproc?

http://blog.wekeroad.com/2007/12/10/aspnet-mvc-pagedlistt/

PS – any examples of paging in MVC with the Entity Framework using SP’s would be great!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T15:06:13+00:00Added an answer on May 23, 2026 at 3:06 pm

    LINQ out of the box will not wrap a stored procedure. Entity Framework functions are the only way to call stored procedures via EF and return an entity. It’s understandable, as EF has know what of knowing what parameter to map your paging variables too.

    You would/should never do this, but I feel compelled (since nothing is impossible) to say you could write a custom implementation of LINQ for your procedures, but that would be a mountain of work to cleanly wrap a couple of procedures.

    Some suggestions:

    • You can just use linq and skip the stored procedure
    • If you stay with EF wrapping a stored procedure via a function, you can alleviate the many function problem by breaking up your model into several contexts
    • You can use the connection property of the EF context to call the stored procedure directly, and have a read-only(non-EF attached) viewmodel class to use for display purposes. The id (or other primary key) field would still be the right value to get you to a detail screen or json callback to get an editable version of the real EF object

    None of these are perfect, but lots of ways to deal with this.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am just starting out with ADO.net Entity Framework I have mapped two tables
Just starting out with ASP.NET MVC and have come across a stumbling block already.
Just starting out in ASP.NET MVC - I have a page in ASP.NET MVC3
I'm just starting out with the Entity Framework and ADO.NET Data Services and I've
Just starting out in asp.net. Have just created a login.aspx page in my site
I Just starting out w/ ASP.NET MVC 3 and I am trying to render
I'm just starting out with some entity framework exploration, I figured it was time
I am just starting to use the Entity Framework 4 for the first time
I am just starting out with the Entity Framework and in my ms sql
Just starting out with subversion, have set up repos for 3 current projects and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.