Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

Why This Nonsense?? : System.Data.Entity.Core.Objects.ObjectResult`1[Some Stored Procedure]] List

$
0
0

Ok this is just nuts... and I am guessing this is some microsoft poor QA bug that will never be fixed but I am wondering if you gurus on this forum have some way of working around this:

I have a stored procedure that can return more than one row of info

But for some reason when I call the Stored Procedure I get this on the MVC partial view:

System.Data.Entity.Core.Objects.ObjectResult`1[CMS.Models.SPROC_GET_CONTESTANTS_SCORE_SUBTOTALS_Result] List

The wizard wrote auto generated the code below and forced me to add a using statement to add :     using System;
    using System.Data.Entity;
    using System.Data.Entity.Core;
    using System.Data.Entity.Core.Objects;
    using System.Data.Entity.Infrastructure;

here is the source codes. 

        public virtual ObjectResult<SPROC_GET_CONTESTANTS_SCORE_SUBTOTALS_Result> SPROC_GET_CONTESTANTS_SCORE_SUBTOTALS(Nullable<int> contestantID)
        {
            var contestantIDParameter = contestantID.HasValue ?
                new ObjectParameter("ContestantID", contestantID) :
                new ObjectParameter("ContestantID", typeof(int));

            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<SPROC_GET_CONTESTANTS_SCORE_SUBTOTALS_Result>("SPROC_GET_CONTESTANTS_SCORE_SUBTOTALS", contestantIDParameter);



        }

I am totally lost on this

Because on the view page it displays this:

System.Data.Entity.Core.Objects.ObjectResult`1[CMS.Models.SPROC_GET_CONTESTANTS_SCORE_SUBTOTALS_Result] List      

Id I try this 

    return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<SPROC_GET_CONTESTANTS_SCORE_SUBTOTALS_Result>("SPROC_GET_CONTESTANTS_SCORE_SUBTOTALS", contestantIDParameter).First();

<div>Severity Code Description Project File Line Suppression State</div> <div>Error CS0029 Cannot implicitly convert type 'CMS.Models.SPROC_GET_CONTESTANTS_SCORE_SUBTOTALS_Result' to 'System.Data.Entity.Core.Objects.ObjectResult<CMS.Models.SPROC_GET_CONTESTANTS_SCORE_SUBTOTALS_Result>' CMS C:\APP_DEV\CMS\CMS\Models\CMS_DM_DATA_Model.Context.cs 61 Active</div>

One last thing... this happen when there is data and when there is not data...for some reason this just displays and it sucks.         


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>