none
Can't Import Stored Procedure In To Entity Model RRS feed

  • Question

  • I created a stored procedure and am trying to import it in to the entity model with no luck.   I'm taking the following steps:

    1. Right click on the edmx diagram, select 'Update Model from Database'

    2. I'm able to see my stored procedure in the list, so I select it.  All 3 checkboxes at the bottom are checked (including 'Import selected stored procedures and functions into the entity model')

    3. Click Finish.

    My stored procedure is not in the edmx diagram and doesn't show up under Function Imports.

    If I try again and un-check the 'Import selected stored procedures and functions into the entity model' option I'm able to see my sp under Common.Store/Stored Procedures / Functions, but of course not in the edmx diagram.

    I've tried granting execute permissions to public for my stored proc...no luck.  I also tried calling a different stored procedure with simpler in/out parameters...still no luck.

    Any help would be greatly appreciated as I'm stuck on this for 2 days now.

    .... After posting this I tried to import again and un-check the 'Import selected stored procedures and functions into the entity model' option, then add a function import to my diagram and map to the function.  When I click 'Get Column Information' I see the following...

    An exception of type "System.NotSupportedException" occurred while attempting to get columns information.  The exception message is: The specified type is not supported by this selector.  Is this a driver issue???

    • Edited by MercuryMama Friday, January 22, 2016 7:29 PM
    Friday, January 22, 2016 6:58 PM

Answers

  • Hi MercuryMama,

    According to your description, I create a demo, I also can’t find the store procedures in the edmx diagram, but I can find them under xxContext.tt. I can use you them like below.

    using (var db = new DemoEntities())
    {
       var query = from p in db.GetCustomerReport()
                   select p;
       foreach (var item in query)
       {
            Console.WriteLine(item.Customer);
    
       }
       Console.ReadLine();
    }
    

    Best regards,

    Cole Wu

    • Marked as answer by MercuryMama Saturday, January 23, 2016 3:19 PM
    Saturday, January 23, 2016 7:31 AM
    Moderator

All replies

  • Hi MercuryMama,

    According to your description, I create a demo, I also can’t find the store procedures in the edmx diagram, but I can find them under xxContext.tt. I can use you them like below.

    using (var db = new DemoEntities())
    {
       var query = from p in db.GetCustomerReport()
                   select p;
       foreach (var item in query)
       {
            Console.WriteLine(item.Customer);
    
       }
       Console.ReadLine();
    }
    

    Best regards,

    Cole Wu

    • Marked as answer by MercuryMama Saturday, January 23, 2016 3:19 PM
    Saturday, January 23, 2016 7:31 AM
    Moderator
  • Yes, that works.  Thanks very much Cole Wu!
    Saturday, January 23, 2016 3:19 PM