{"id":484,"date":"2012-06-18T15:08:00","date_gmt":"2012-06-18T15:08:00","guid":{"rendered":"\/blogs\/bobb\/post\/Does-everybody-get-that-(SQLCLR).aspx"},"modified":"2012-06-18T15:08:00","modified_gmt":"2012-06-18T15:08:00","slug":"does-everybody-get-that-sqlclr","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/bobb\/does-everybody-get-that-sqlclr\/","title":{"rendered":"Does everybody get that? (SQLCLR)"},"content":{"rendered":"<p>\nJust came back from TechEd, where I had a bit of time to think about training vs speaking. When I&#39;m teaching, I&#39;m not just speaking facts and doing neat demos (ta da!) at folks. I look at their eyes to make sure they &quot;get it&quot; and aren&#39;t satisfied until they do. During the presentation, I&#39;d noticed that the lights were turned down low, and I couldn&#39;t do that. This manifested itself in my saying &quot;Does everybody get that?&quot;. Maybe once too often&#8230; In a classroom, you also have more time to talk to individuals about their specific issues. I&#39;ve heard this called &quot;bring your own problem&quot;.\n<\/p>\n<p>\nMany of my blog posts come from thinking about and solving (even after the class) problems that are brought up during classes. So I thought it would be worthwhile to present a series of them (without identifying info, naturally) that I haven&#39;t posted about yet.\n<\/p>\n<p>\nHere&#39;s one on SQLCLR assemblies. I&#39;m working on a payroll system and want to expose a set of calculations in a SQLCLR assembly. But, if all assemblies are loaded into the same .NET appdomain, I won&#39;t be able to keep a programmer that &quot;knows better&quot; from invoking my methods through reflection, thereby&nbsp;circumventing security. Having a different appdomain (you get one per assembly owner per database) means I won&#39;t be able to call to the other appdomain (for users that need to call my methods from other appdomains) without using a remoting technology. This seems like a bit of overhead, to use web services to call one SQLCLR appdomain from another. Didn&#39;t there used to be an &quot;EXECUTE&quot; permission on assemblies? (BTW, that permission did exist in 2005 beta 1, but didn&#39;t do anything, it was removed pre-RTM).\n<\/p>\n<p>\nWell, how about using SQL? When you expose an algorithm (say, the pension calculation algorithm) as a T-SQL function\/procedure, rather than just having&nbsp;your function&nbsp;available in an assembly to call via other SQLCLR .NET code, security is enforced through SQL permissions, the same as with other SQL objects.\n<\/p>\n<p>\nThis brings up another misconception about SQLCLR (.NET assemblies in SQL Server) code. Programmers sometimes think there is a special pipeline when calling from a .NET client to a SQLCLR object (e.g. a stored procedure) and that the rules (like type usage) of .NET apply. The only way to call from a .NET client to a SQLCLR stored procedure is by using SQL; that is, ADO.NET SqlCommand objects. And of course, you must define &quot;entry points&quot; into your .NET code using SQL DDL, such as CREATE PROCEDURE foo&#8230; EXTERNAL NAME [AssemblyName].[ClassName].[MethodName]. There is no .NET client-to-.NET sproc pipeline.\n<\/p>\n<p>\nGet that?\n<\/p>\n<p>\n@bobbeauch<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Just came back from TechEd, where I had a bit of time to think about training vs speaking. When I&#39;m teaching, I&#39;m not just speaking facts and doing neat demos (ta da!) at folks. I look at their eyes to make sure they &quot;get it&quot; and aren&#39;t satisfied until they do. During the presentation, I&#39;d [&hellip;]<\/p>\n","protected":false},"author":7,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38],"tags":[],"class_list":["post-484","post","type-post","status-publish","format-standard","hentry","category-sqlclr"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.9.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Does everybody get that? (SQLCLR) - Bob Beauchemin<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/bobb\/does-everybody-get-that-sqlclr\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Does everybody get that? (SQLCLR) - Bob Beauchemin\" \/>\n<meta property=\"og:description\" content=\"Just came back from TechEd, where I had a bit of time to think about training vs speaking. When I&#039;m teaching, I&#039;m not just speaking facts and doing neat demos (ta da!) at folks. I look at their eyes to make sure they &quot;get it&quot; and aren&#039;t satisfied until they do. During the presentation, I&#039;d [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/bobb\/does-everybody-get-that-sqlclr\/\" \/>\n<meta property=\"og:site_name\" content=\"Bob Beauchemin\" \/>\n<meta property=\"article:published_time\" content=\"2012-06-18T15:08:00+00:00\" \/>\n<meta name=\"author\" content=\"Bob Beauchemin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Bob Beauchemin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/does-everybody-get-that-sqlclr\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/does-everybody-get-that-sqlclr\/\",\"name\":\"Does everybody get that? (SQLCLR) - Bob Beauchemin\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website\"},\"datePublished\":\"2012-06-18T15:08:00+00:00\",\"dateModified\":\"2012-06-18T15:08:00+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/does-everybody-get-that-sqlclr\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/bobb\/does-everybody-get-that-sqlclr\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/does-everybody-get-that-sqlclr\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQLCLR\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/category\/sqlclr\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Does everybody get that? (SQLCLR)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/\",\"name\":\"Bob Beauchemin\",\"description\":\"SQL Server Blog\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e\",\"name\":\"Bob Beauchemin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g\",\"caption\":\"Bob Beauchemin\"},\"sameAs\":[\"http:\/www.sqlskills.com\/blogs\/bobb\/\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/bobb\/author\/bobb\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Does everybody get that? (SQLCLR) - Bob Beauchemin","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/bobb\/does-everybody-get-that-sqlclr\/","og_locale":"en_US","og_type":"article","og_title":"Does everybody get that? (SQLCLR) - Bob Beauchemin","og_description":"Just came back from TechEd, where I had a bit of time to think about training vs speaking. When I&#39;m teaching, I&#39;m not just speaking facts and doing neat demos (ta da!) at folks. I look at their eyes to make sure they &quot;get it&quot; and aren&#39;t satisfied until they do. During the presentation, I&#39;d [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/does-everybody-get-that-sqlclr\/","og_site_name":"Bob Beauchemin","article_published_time":"2012-06-18T15:08:00+00:00","author":"Bob Beauchemin","twitter_misc":{"Written by":"Bob Beauchemin","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/does-everybody-get-that-sqlclr\/","url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/does-everybody-get-that-sqlclr\/","name":"Does everybody get that? (SQLCLR) - Bob Beauchemin","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website"},"datePublished":"2012-06-18T15:08:00+00:00","dateModified":"2012-06-18T15:08:00+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/does-everybody-get-that-sqlclr\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/bobb\/does-everybody-get-that-sqlclr\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/does-everybody-get-that-sqlclr\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/bobb\/"},{"@type":"ListItem","position":2,"name":"SQLCLR","item":"https:\/\/www.sqlskills.com\/blogs\/bobb\/category\/sqlclr\/"},{"@type":"ListItem","position":3,"name":"Does everybody get that? (SQLCLR)"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/","name":"Bob Beauchemin","description":"SQL Server Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/bobb\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/62bfa986c5b5d28fcffd8b4fc409c73e","name":"Bob Beauchemin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/bobb\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6f80e6cc667410857fa6a21931dc528b8092f4d112bf7a8ff7c267674d44ee37?s=96&d=mm&r=g","caption":"Bob Beauchemin"},"sameAs":["http:\/www.sqlskills.com\/blogs\/bobb\/"],"url":"https:\/\/www.sqlskills.com\/blogs\/bobb\/author\/bobb\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts\/484","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/users\/7"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/comments?post=484"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/posts\/484\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/media?parent=484"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/categories?post=484"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/bobb\/wp-json\/wp\/v2\/tags?post=484"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}