Creating a System.Management assembly in order for my own Assembly to work?


hi

i bit paranoid did sql server 2005 clr experiment.

i created class lib in c# called inlinelib has class queue represents object  id field.

in separate namespace called inlineclrsql, i created class called test which hold function accessed db,  referenced , created instances of queue class, , retrieve it's id in function called printmessage.

namespace inlineclrsql{

public static class test{

public static void printmessage(){

inlinelib.queue q = new inlinelib.queue();

int = q.queueid ;

microsoft.sqlserver.server.sqlcontext.pipe.send(i.tostring());

}

}

}

to access db, attempted create assembley referencing inlineclrsql.dll. didn't work complained inlinelib assembly not existing in db. attempted create assembley for  inlinelib barfed saying  system.management assembly not created.

so did (and need know if ruined sql server or not):

1- alter database mydb set trustworthy on;.

2- create assembly systemmanagement

from 'c:\windows\microsoft.net\framework\v2.0.50727\system.management.dll'

with permission_set = unsafe

3- create assembly inlinelibmaster

from 'd:\inline\server\inlinelib\bin\debug\inlinelib.dll'

with permission_set = unsafe

4- ,

create assembly inlinelib

from 'd:\inline\server\clrsql\inlineclrsql\bin\debug\inlineclrsql.dll'

with permission_set = safe

 

everything works after steps (which took trial , error). can create sproc like:

create proc sp_test as

external name inlinelib.[inlineclrsql.test].printmessage

and returns queue id

is there unadvisable steps above?

 

thanks help

 

m

 

 

system.management not supported clr integration in sql server 2005. means has not been tested reliability , security work under hosted environment. (or all) parts of assembly might work fine , (or none) might not work reliably under conditions memory pressure, stack overflow, stress etc. need test scenario (for reliablilty , security) , ensure works you. list of supported .net framework assemblies following:

  • custommarshalers
  • microsoft.visualbasic
  • microsoft.visualc
  • mscorlib
  • system
  • system.configuration
  • system.data
  • system.data.oracleclient
  • system.data.sqlxml
  • system.deployment
  • system.security
  • system.transactions
  • system.web.services
  • system.xml
  • these have been tested sql server. apis not reliable in these assemblies have been marked hostprotectionattribute , hence cannot used in safe permission set.

    thanks,

    -vineet.



    SQL Server  >  .NET Framework inside SQL Server



    Comments

    Popular posts from this blog

    Conditional formatting a graph vertical axis in SSRS 2012 charts

    Register with Power BI failed

    SQL server replication error Cannot find the dbo or user defined function........