How can I deploy SQL CLR assembly using SMO?

  • I am trying to make an sql clr deployer application with smo. I can create assembly, but cannot find anything about functions/aggregates/sp's. Is there any information about functions/aggregates/sp's to create them too or should I know every element in the assembly to create them?

  • emrahakdeniz (9/17/2009)


    I am trying to make an sql clr deployer application with smo. I can create assembly, but cannot find anything about functions/aggregates/sp's. Is there any information about functions/aggregates/sp's to create them too or should I know every element in the assembly to create them?

    The reason you can't is because assemblies don't contain functions/aggregates/sp's. They contain classes and methods. What links those classes and methods to database objects is the DDL (i.e. CREATE FUNCTION, CREATE AGGREGATE etc).

    If you want to do it entirely in code, your best bet is probably to define custom attributes, decorate the classes with them, and then use reflection to inspect the assemblies and find the relevant entries, generating DDL as needed.

    Atlantis Interactive - SQL Server Tools
    My blog[/url]
    Why I wrote a sql query analyzer clone

  • How can I inspect assembly? It only contains binary code. Is there a way to do this?

    Edit: I understood. Using reflection iterating through classes is the way.

  • emrahakdeniz (9/18/2009)


    I understood. Using reflection iterating through classes is the way.

    You got it. 🙂

    Atlantis Interactive - SQL Server Tools
    My blog[/url]
    Why I wrote a sql query analyzer clone

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply