Solved

Get list from context with storeproc

Posted on 2013-11-05
2
224 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
Comment Utility
I don't understand what you are looking for...
0
 
LVL 9

Author Closing Comment

by:sevensnake77
Comment Utility
I got it.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now