Creating CLR Functions in non-default dbo Schema

  • I have created several CLR functions which I have assigned to the schema 'fn', rather than the default 'dbo', via a post-deployment script.

    As far as I know, it is not possible to specify the schema directly within the database project (other than the project-level 'Default schema'). Is this still the case?

    This solution seems clunky. If I add other functions which rely on the existence of the 'fn.' functions, I (unsurprisingly) get Build warnings, because the 'fn' functions do not exist at build time.

    Does anyone know whether there are plans to address this? Or perhaps there is a workaround I do not know about?

    Edit: Sorry about the title of this post. It would have been better as

    Creating CLR functions in non-default schemas

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • As no one has responded, I will assume that I have not missed anything.

    It's a grotty workaround because all of my CLR functions get dropped, created and schema-moved every time the DB is published.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • See response to issue here: http://stackoverflow.com/questions/34770688/vs-sqlclr-function-x-has-unresolved-reference-to-schema-y

    Essentially you add a CREATE SCHEMA object to your project, even if you know the target system will already have the schema.


    Have Fun!
    Ronzo

  • Ronzo (2/16/2016)


    See response to issue here: http://stackoverflow.com/questions/34770688/vs-sqlclr-function-x-has-unresolved-reference-to-schema-y

    Essentially you add a CREATE SCHEMA object to your project, even if you know the target system will already have the schema.

    It's certainly related to my problem, though not the same, I think.

    The critical difference relates to the fact that I wanted to create the CLR functions in a non-default schema. This one small detail changes everything.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

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

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