Solved

Get list from context with storeproc

Posted on 2013-11-05
2
233 Views
Last Modified: 2013-11-07
I want to have the results to a select list in my controller I want to do this instead of Linq.

 protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            throw new UnintentionalCodeFirstException();
        }
    
        public DbSet<User> Users { get; set; }
        public DbSet<UserStore> UserStores { get; set; }
    
        public virtual ObjectResult<string> spGetStoreList(string userID)
        {
            var userIDParameter = userID != null ?
                new ObjectParameter("UserID", userID) :
                new ObjectParameter("UserID", typeof(string));
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<string>("spGetStoreList", userIDParameter);
        }


/######################## Excerpt # Stored procedure ###############
ALTER PROCEDURE [dbo].[spGetStoreList] 
  @UserID	VARCHAR(200)
AS
  SET NOCOUNT ON
select  StoreId from UserStore where UserID IN (SELECT UserKey from Users WHERE UserID = @UserId) ORDER BY StoreID
		

Open in new window

0
Comment
Question by:sevensnake77
2 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 39627997
I don't understand what you are looking for...
0
 
LVL 9

Author Closing Comment

by:sevensnake77
ID: 39631069
I got it.
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Adding items to a C# list incrementally 5 64
Where does legacy ASP.NET initialize language? 2 63
vb.net convert long time to mm:ss 23 22
ASP.net Markup for Sub Menu 2 46
This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question