{"id":1543,"date":"2011-03-22T21:04:21","date_gmt":"2011-03-22T20:04:21","guid":{"rendered":"http:\/\/www.gamlor.info\/wordpress\/?p=1543"},"modified":"2021-10-16T01:29:40","modified_gmt":"2021-10-16T00:29:40","slug":"making-of-db4o-linqpad-driver-linqpad-drivers","status":"publish","type":"post","link":"https:\/\/www.gamlor.info\/wordpress\/2011\/03\/making-of-db4o-linqpad-driver-linqpad-drivers\/","title":{"rendered":"Making of the db4o LINQPad Driver: LINQPad Drivers"},"content":{"rendered":"<div id=\"attachment_1549\" style=\"width: 310px\" class=\"wp-caption alignright\"><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/03\/linqpad-drivers.png\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-1549\" class=\"size-medium wp-image-1549\" title=\"linqpad-drivers\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/03\/linqpad-drivers-300x225.png\" alt=\"LINQPad drivers\" width=\"300\" height=\"225\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/03\/linqpad-drivers-300x225.png 300w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/03\/linqpad-drivers.png 800w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><p id=\"caption-attachment-1549\" class=\"wp-caption-text\">LINQPad drivers<\/p><\/div>\n<p>In this little post series I\u2019m going to show how my <a href=\"?p=1350\">db4o LINQPad driver<\/a> is implemented. Some parts of these posts useful for other drivers, other parts will be db4o specific.<\/p>\n<p>Side note: There\u2019s already a new version of the <a href=\"https:\/\/www.gamlor.info\/files\/db4oPad.lpx\">LINQPad driver<\/a> out which fixes some issues.<\/p>\n<h2>Overview<\/h2>\n<p>The <a href=\"http:\/\/www.linqpad.net\/HowLINQPadWorks.aspx\">LINQPad website<\/a> explains well how LINQPad works. For each query LINQPad starts an <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/2bh4z9hs(v=VS.100).aspx\">app domain<\/a>. This ensures that LINQPad can cleanly kill a query or any code running. For each query LINQPad generates the CIL code dynamically and then runs it.<\/p>\n<p>As I explained in <a title=\"db4o: Tools For Adhoc Querying And Modification\" href=\"?p=949\">a earlier post<\/a> you can provide additional assemblies to the query execution context. These assemblies are also included in these app domains. That allows you run use any library in LINQPad.<\/p>\n<h2>Drivers<\/h2>\n<p>LINQPad supports different drivers for different data source. A driver is responsible for creating connections, showing the available entities or tables and executing queries. You can find the official <a href=\"http:\/\/www.linqpad.net\/extensibility.aspx\">documentation here<\/a>. Also two example drivers are available there.<\/p>\n<p>There are two kinds of drivers, static and dynamic drivers. In static drivers you statically provide a query-context. This means you have to provide an assembly with the code for the entities etc. In a dynamic driver the driver generates the data-context dynamically, including the classes to represent entities.<\/p>\n<h2>Packaging a Driver<\/h2>\n<p>LINQPad drivers have to be packaged in a certain way to work. Basically a driver is a zip-file with all required assemblies and a description-file. The description-file is called header.xml and contains the name of the driver assembly. The driver-assembly has to be <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/wd40t7ad.aspx\">strongly named<\/a>, otherwise LINQPad won\u2019t accept it. Finally the file-extension for the driver zip file is lpx.<\/p>\n<h2>Driver Code<\/h2>\n<p>The entry point into the driver is a class which inherits either from the DynamicDataContextDriver or the StaticDataContextDriver class. In that class you need to implement a few things. Like the dialog for creating a new connection, name-properties etc. In the case of a dynamic driver you also have to implement a method to generate to required assemblies at runtime. After that you can ship your driver.<\/p>\n<h2>Conclusion<\/h2>\n<p>LINQPad supports plugins for all kinds of datasources. You are free to implement your own driver. This <a href=\"http:\/\/www.linqpad.net\/extensibility.aspx\">site contains<\/a> the official documentation and example projects.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this little post series I\u2019m going to show how my db4o LINQPad driver is implemented. Some parts of these posts useful for other drivers, other parts will be db4o&hellip; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[126],"tags":[21,214],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/posts\/1543"}],"collection":[{"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/comments?post=1543"}],"version-history":[{"count":11,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/posts\/1543\/revisions"}],"predecessor-version":[{"id":3910,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/posts\/1543\/revisions\/3910"}],"wp:attachment":[{"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/media?parent=1543"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/categories?post=1543"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/tags?post=1543"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}