none
the type parameter in execute function is incompatible with the type returned by the function RRS feed

  • Question

  • Hello Sir,

    I have getting the such type of Error : the type parameter in execute function is incompatible with the type returned by the function ....when I am using the Entity Framework in WCF Service.

    In my WCF Service, I have call the Store Procedure for the Returning Multiple Result Sets from an Entity Framework Stored Procedure with Function Import Mappings

    But this SP is generate error. In my SP having the " two Temp table" It means that I am writing the three select statement in one SP.

    Thanks,

    Sr. SE - Vasudev Choudhary

     
    Wednesday, May 21, 2014 7:17 PM

All replies

  • I do not know if this helps, but here is what I generally do:

    Assuming that you have the following POCO class from the Entity Framework:

    using System;
    
    public partial class testy_Result
    {
        public string hello { get; set; }
    }

    The following call generally does the trick for me:

    public partial class Entities: DbContext
    {
    
        public virtual ObjectResult<testy_Result> testy()
        {
            ((IObjectContextAdapter)this).ObjectContext.MetadataWorkspace.LoadFromAssembly(typeof(testy_Result).Assembly);
    
            return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction<testy_Result>
                ("testy", MergeOption.OverwriteChanges);
        }
    }

    Also, just in case, I wrap my calls inside the using clause:

            try
            {
                using (Models.Data.Entities Entities = new Models.Data.Entities())
                {
                    var x = Entities.testy().FirstOrDefault().hello;
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Error: " + ex.Message);
            }

    Let me know if it worked for you.

    Friday, May 23, 2014 10:23 AM
  • Hi,

    Without your code, it is hard to tell. Could you please try to post your code here? Then I want to test it in my computer.

    Best Regards,
    Amy Peng


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, May 27, 2014 6:58 AM
    Moderator