I know SQL 2008 doesn't support .NET 4.0.
I have several assemblies, all compiled for .NET 4.0. I need a SQL trigger to kick off a routine in one of these 开发者_运维知识库assemblies.
Is there any way (without getting WCF or other forms of inter-process communication involved). to get the SQL CLR to kick off this routine? Maybe I could have a 2.0 targeted assembly that kicks off the 4.0 code somehow? I know that .NET 4.0 allows multiple runtime versions to be hosted in the same process, but I'm not sure how I might leverage this.
As a fallback, I could use a COM wrapper to kick off the .NET 4.0 code...but I'd prefer not to.
If you relax the security of a SQL CLR Trigger, it's possible to write a file to disk aka a 'Message Queue' and either use a FileSystemMonitor or official Message Queue Monitor to process the required task using any .NET version. This avoids the complexity of multiple .NET framework versions and the risk of the direct risk of the command shell and writing an XML or other structured data to the file allows the passing of required data fields.
For security don't make this system so flexible it can call any program defined in the file. I would suggest only using the file to pass parameters to known programs.
I would make a very simple console app. It would reference the binaries needed. It would then be simple to kick of the method by calling the console app with arguments which would pass it to the method you want to invoke.
精彩评论