{"id":1597,"date":"2011-04-19T21:18:39","date_gmt":"2011-04-19T20:18:39","guid":{"rendered":"http:\/\/www.gamlor.info\/wordpress\/?p=1597"},"modified":"2022-02-14T07:09:57","modified_gmt":"2022-02-14T06:09:57","slug":"linqpad-db4o-driver-feature-overview","status":"publish","type":"post","link":"https:\/\/www.gamlor.info\/wordpress\/2011\/04\/linqpad-db4o-driver-feature-overview\/","title":{"rendered":"LINQPad db4o Driver: Feature Overview"},"content":{"rendered":"<p>This time I\u2019m giving a small feature overview for my LINQPad driver for db4o. I promise that is the last post about this for a while =). Why now? Because I\u2019ve implemented the core set of features and now it is has reached a usable state.<\/p>\n<h2>Installation<\/h2>\n<p>Well, just take a look at my <a href=\"?p=1530\">previous post<\/a>. I just repeat the most important steps here: <a href=\"https:\/\/www.gamlor.info\/files\/db4oPad.lpx\">Download the plugin-file<\/a> and save it somewhere. Open LINQPad and add a new connection. Click on \u2018View more drivers\u2019 and there on \u2018Browse\u2019. Now choose the downloaded lpx-file and confirm it.<\/p>\n<h2>Opening a Database<\/h2>\n<p>After installing there\u2019s a new \u2018db4o Driver\u2019 entry in the \u2018Add connection\u2019 dialog. After choosing it&nbsp; &nbsp;you need to specify the path to your db4o database file. Optionally you can add the assemblies which contain the classes of the domain model. If you do so, you can access the original classes in LINQPad. You can also enable the write access to the database, when you want to do updates from within LINQPad. Of course that\u2019s a little dangerous, since you can potentially destroy your database with it, due to bugs in the Driver or a bogues update statement.<\/p>\n<p><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/open-dialog1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1599\" title=\"open-dialog\" alt=\"The Open Dialog\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/open-dialog1.png\" width=\"495\" height=\"217\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/open-dialog1.png 495w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/open-dialog1-300x131.png 300w\" sizes=\"(max-width: 495px) 100vw, 495px\" \/><\/a><\/p>\n<h2>The Schema<\/h2>\n<p>On the left you can see the schema of the stored objects. Note that it is a little simplified. Especially instances of generic types are simplified. For example an instance of Preference&lt;Food&gt; is shown as Preference_1_Food. Also the schema explorer doesn\u2019t show any inheritance structure.<\/p>\n<p style=\"text-align: center;\"><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/schema.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1600\" title=\"schema\" alt=\"Schema Overview\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/schema.png\" width=\"440\" height=\"315\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/schema.png 440w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/schema-300x214.png 300w\" sizes=\"(max-width: 440px) 100vw, 440px\" \/><\/a><\/p>\n<h2>Write Queries<\/h2>\n<p>Now we can write queries. Ensure that the database is selected in the query window. You can query by just using the entity name. We just can write a simple query like this:<\/p>\n<p><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/first-query.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1602\" title=\"first-query\" alt=\"Simple Query\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/first-query.png\" width=\"405\" height=\"305\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/first-query.png 405w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/first-query-300x225.png 300w\" sizes=\"(max-width: 405px) 100vw, 405px\" \/><\/a><\/p>\n<p>Now we can start using the fields etc. in the database. When you didn\u2019t specify any assemblies for the connection, then you can refer any field by its name or by a capitalized property. When there\u2019s a field called \u2018name\u2019 you can access it with \u2018name\u2019 or with \u2018Name\u2019. Auto properties are accessed by their name. However when you\u2019ve specified the assemblies for the classes in the beginning, then you have the API etc. from your classes available.<\/p>\n<p><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/access-fields-or-properties.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1603\" title=\"access-fields-or-properties\" alt=\"Access Fields or Properties\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/access-fields-or-properties.png\" width=\"504\" height=\"293\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/access-fields-or-properties.png 504w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/access-fields-or-properties-300x174.png 300w\" sizes=\"(max-width: 504px) 100vw, 504px\" \/><\/a><\/p>\n<p>Now you can see why generic instances have such a silly name. That makes queries for them much easier.<\/p>\n<p><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/query-generics.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1604\" title=\"query-generics\" alt=\"\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/query-generics.png\" width=\"595\" height=\"339\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/query-generics.png 595w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/query-generics-300x170.png 300w\" sizes=\"(max-width: 595px) 100vw, 595px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h2>Access Meta Data<\/h2>\n<p>You just can access the \u2018MetaData\u2019 property in LINQPad to see the meta-data:<\/p>\n<p><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/meta-data.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1605\" title=\"meta-data\" alt=\"\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/meta-data.png\" width=\"591\" height=\"530\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/meta-data.png 591w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/meta-data-300x269.png 300w\" sizes=\"(max-width: 591px) 100vw, 591px\" \/><\/a><\/p>\n<p>Or drill down further:<\/p>\n<p><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/meta-data-drill.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1606\" title=\"meta-data-drill\" alt=\"\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/meta-data-drill.png\" width=\"593\" height=\"240\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/meta-data-drill.png 593w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/meta-data-drill-300x121.png 300w\" sizes=\"(max-width: 593px) 100vw, 593px\" \/><\/a><\/p>\n<h2>Insert New Instances<\/h2>\n<p>In order to create a new instance you can call .New() on the entities. If you have specified you\u2019re assemblies you can pass in the arguments for the constructor. Or just use directly the constructor of your classes. After that you just can store the created instance. Of course you need to allow write access to the connection to use this feature.<\/p>\n<p><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/store-new-instance.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1607\" title=\"store-new-instance\" alt=\"\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/store-new-instance.png\" width=\"577\" height=\"129\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/store-new-instance.png 577w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/store-new-instance-300x67.png 300w\" sizes=\"(max-width: 577px) 100vw, 577px\" \/><\/a><\/p>\n<h2>Update Objects<\/h2>\n<p>You can update objects by just using the Store-method. Or you can use the .UpdateAll extension method which iterates over a query result and applies the changes:<\/p>\n<p><a href=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/update.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-1608\" title=\"update\" alt=\"Update Objects\" src=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/update.png\" width=\"566\" height=\"267\" srcset=\"https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/update.png 566w, https:\/\/www.gamlor.info\/wordpress\/wp-content\/uploads\/2011\/04\/update-300x141.png 300w\" sizes=\"(max-width: 566px) 100vw, 566px\" \/><\/a><\/p>\n<h2>That\u2019s It<\/h2>\n<p>Well that\u2019s about the features currently implemented. Any wishes, questions or issues? Let me know. Any feedback is welcome. I\u2019ll <a href=\"http:\/\/twitter.com\/GamlerHart\">tweet<\/a> if there are minor updates.<\/p>\n<p>Btw. the code is still hosted <a href=\"https:\/\/github.com\/gamlerhart\/db4opad\">here<\/a>.&nbsp; Maybe I get around making real project out of it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This time I\u2019m giving a small feature overview for my LINQPad driver for db4o. I promise that is the last post about this for a while =). Why now? Because&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,100,214],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/posts\/1597"}],"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=1597"}],"version-history":[{"count":6,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/posts\/1597\/revisions"}],"predecessor-version":[{"id":3930,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/posts\/1597\/revisions\/3930"}],"wp:attachment":[{"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/media?parent=1597"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/categories?post=1597"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gamlor.info\/wordpress\/wp-json\/wp\/v2\/tags?post=1597"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}