Views and Stored Procedures

2 posts, 0 answers
  1. Christopher Blickley
    Christopher Blickley avatar
    202 posts
    Member since:
    Jan 2004

    Posted 04 Jan 2013 Link to this post


    I need to add a database (SQL Server) view instead of a table.  I can do that easily.  I am doing this so I can have a few additional fields included in the view that wouldn't otherwise be included in any object and are not part of the table.  I now need to map stored procedures to the view to do the update, create, and delete functions.  I see lots of references to this online, but with regards to the old menu options and reverse mapping screens that don't exist in the new domain model setup.

    In the mapping window, I see where I can check off to map a stored procedure and it creates a stored procedure in the model when I check that off.  However, these stored procedures are not correct because they include all the fields in the view.  I really want to update just the fields that exist in the underlying table.  For example, I may have added a field from a lookup table.  That field doesn't get updated back into the database.

    How can I either:

    * Alter the stored procedures that it create
    * Preferably, use my own stored procedures that I create.

  2. Damyan Bogoev
    Damyan Bogoev avatar
    581 posts

    Posted 07 Jan 2013 Link to this post

    Hi Chris,

    What you could do in order to use stored procedures, for handling the view CUD scenarios, is to alter the given stored procedures. You need to exclude the unneeded CUD operations on the view's custom columns from the stored procedure body.

    Hope that helps. If any other questions arise, do not hesitate to contact us back.

    Kind regards,
    Damyan Bogoev
    the Telerik team
    Q3'12 SP1 of OpenAccess ORM packs Multi-Table Entities mapping support. Check it out.
  3. DevCraft banner
Back to Top