none
How to Access all the Extended properties of SQL Server objects through Linq? RRS feed

  • General discussion

  • Hello msdn, 

        I have got one sql query to List  all columns Extended properties as given below

    SELECT OBJECT_NAME(EXP.major_id) AS TableName, 
           C.name                    AS ColumnName, 
           EXP.name                  AS PropertyName, 
           EXP.value                 AS PropertyValue
    FROM   sys.extended_properties AS EXP
    LEFT OUTER JOIN sys.columns AS C
    ON    C.object_id = EXP.major_id
    AND   C.column_id = EXP.minor_id
    WHERE EXP.class_desc = 'OBJECT_OR_COLUMN'

    How can I convert this query into a Linq query, Because I want to bind this result into a gridcontrol's ItemsSource?.

    Please help me

    ANY SUGGESTIONS WILL BE APPRECIATED

    Regards

    Salam

     

    salampv.07

    Monday, February 20, 2012 5:29 AM

All replies

  • I think the best way (I'm not sure you can map the sys tables to Linq) would be to create a Stored Procedure or a View.  You could then map that view/SP to LInq and get your data that way.

    Hope this helps

    Lloyd Sheen


    Lloyd Sheen

    Just did small test and created a view.  Then dragged it into the DBML and added some test code.  It brought back the data no problem.  

    Hope this helps

    LS

    • Edited by sqlguy Monday, February 20, 2012 9:05 PM More Info
    Monday, February 20, 2012 8:56 PM