Scalar UDF, Table Valued UDF, Views and SP RRS feed

  • Question

  • Hi

    We are trying to evaluate EF Code-first approach for maintaining many similar databases.

    We find that with classes representing tables and inheritance of classes, maintaining definitions of such databases becomes very easy. Further, seeding helps to populate these databases in a more structured manner.

    However, we cant find how to maintain UDFs, views and stored procedures.

    Any pointers ?



    Thursday, March 6, 2014 8:02 PM


  • >>Can you provide example on how to create views/UDF during the seed method ?

    I think Fred has gave a nice example and clear description at:

    You can check it. It uses the script in actually which is the ADO.NET way.

    >>Particular concern is the fact that how to check whether the view/UDF already exists

    EF does not support such check. We also need to use the ADO.NET way:

    For views:

        table_name = 'Order'
        and table_schema = 'dbo'

    For functions:

    SELECT  count(*)
    FROM    Information_schema.Routines
    WHERE   Specific_schema = 'dbo'
                        AND specific_name = 'CountSalesOrderHeader'
                        AND Routine_Type = 'FUNCTION'

    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.

    Monday, March 10, 2014 6:53 AM

All replies