Stored Procedures

  • tsarris 4 years, 4 months ago

    Can i map a Stored Procedure to a c1DataSource? What if this store procedure has parameters?

  • 2p
    C1_MichaelE2p 4 years, 4 months ago

    You can use stored procedures when you create an EF model, to map your entity sets to tham, see for example "How to: Define a Model with a Stored Procedure" (http://msdn.microsoft.com/en-us/library/bb896279.aspx). Then you can use those entity sets in C1DataSource and in SEF in general.

  • tsarris 4 years, 1 month ago

    I have this case:
    a stored procedure named Humans with parameters JobID and ReadinessDate and i have a complex type for this named: HumanResults.
    How can i use c1datasource or direclty scope.getitems with this?
    Can you give me an example please?

  • 3p
    C1_NodirT3p 4 years, 1 month ago

    Unfortunately, this is not supported in SEF yet. ClientScope.GetItems and C1DataSource can retrieve entity sets only.

    We will consider adding this feature. Thank you for the feedback.

  • 3p
    C1_NodirT3p 4 years ago

    I might make you think that stored procedures are not supported at all, but this is not true.

    If a stored procedure returns Complex Type objects, then you can use the procedure as is because Complex Type objects are not tracked.

    Otherwise, if it returns entities, you can execute it together with DataExtensions.ExecuteIn extension method like this:

    var entities = context.MyStoredProcedure()
        .ExecuteIn(clientScope).ToList();

    Alternatively, you can add the retrieved entities to the ClientScope using the AddRef method:

    var entities = context.MyStoredProcedure().ToList();
    foreach(var e in entities) { 
       clientScope.AddRef(e);
    }

    -Nodir

  • tsarris 4 years ago

    Thank you very much

  • njcampbell 3 months ago

    Can you provide a visual basic example?
    I am trying to bind a FlexGrid to the resultset of a stored procedure.
    I currently have the StoredProcedure_Result defined as a complex type in the data model.

    Thank you.

  • 14p
    Nilay Vishwakarma14p 3 months ago

    Hi njcampbell,

    Apologies for responding late on this thread. We are working on the sample and would provide you once it is done from our side.

    Regards,
    Nilay Vishwakarma

  • 14p
    Nilay Vishwakarma14p 2 months, 1 week ago

    Hi njCampbell,

    I apologize for the time taken to reply on this thread.
    This is a limitation, C1DataSource supports only entity sets at design-time, and does not support stored procedure result sets.

    Regards,
    Nilay Vishwakarma

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.