<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Code on Ash Tewari</title><link>https://www.tewari.info/tag/code/</link><description>Recent content in Code on Ash Tewari</description><generator>Hugo -- gohugo.io</generator><language>en-US</language><lastBuildDate>Wed, 17 Oct 2012 16:10:42 +0000</lastBuildDate><atom:link href="https://www.tewari.info/tag/code/feed.xml" rel="self" type="application/rss+xml"/><item><title>Understanding and Using System.Transactions</title><link>https://www.tewari.info/2012/10/17/understanding-and-using-system-transactions/</link><pubDate>Wed, 17 Oct 2012 16:10:42 +0000</pubDate><guid>https://www.tewari.info/2012/10/17/understanding-and-using-system-transactions/</guid><description>&lt;p&gt;These are some resources to help grasp &lt;a class="link" href="http://msdn.microsoft.com/en-us/library/vstudio/system.transactions%28v=vs.90%29.aspx" title="System.Transactions Namespace"&#10; target="_blank" rel="noopener"&#10; &gt;System.Transactions&lt;/a&gt; functionality and use it effectively in your projects:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://msdn.microsoft.com/en-us/library/vstudio/ee818755%28v=vs.100%29.aspx" target="_blank" rel="noopener"&#10; &gt;Features Provided by System.Transactions&lt;/a&gt; to &lt;a class="link" href="http://msdn.microsoft.com/en-us/library/vstudio/ee818751%28v=vs.100%29.aspx" target="_blank" rel="noopener"&#10; &gt;create transactional applications&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://msdn.microsoft.com/en-us/library/vstudio/ee818746%28v=vs.100%29.aspx" target="_blank" rel="noopener"&#10; &gt;Implementing an Implicit Transaction using Transaction Scope&lt;/a&gt;&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;MSDN Magazine Articles by &lt;a class="link" href="http://www.johnpapa.net/" target="_blank" rel="noopener"&#10; &gt;John Papa&lt;/a&gt;:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;&lt;a class="link" href="http://msdn.microsoft.com/en-us/magazine/cc163847.aspx" target="_blank" rel="noopener"&#10; &gt;ADO.NET and System.Transactions&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a class="link" href="http://msdn.microsoft.com/en-us/magazine/cc163527.aspx" target="_blank" rel="noopener"&#10; &gt;Revisiting System.Transactions&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;These are specific to &lt;a class="link" href="http://msdn.microsoft.com/en-us/library/vstudio/system.transactions.transactionscope%28v=vs.100%29.aspx" target="_blank" rel="noopener"&#10; &gt;TransactionScope&lt;/a&gt;(the way to go in most cases):&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Here is a practical example of &lt;a class="link" href="http://thewayofcode.wordpress.com/2011/12/11/handling-transactions-in-net-using-transactionscope/" target="_blank" rel="noopener"&#10; &gt;Using TransactionScope to handle transactions in .net&lt;/a&gt;.&lt;/li&gt;&#10;&lt;li&gt;This &lt;a class="link" href="http://msdn.microsoft.com/en-us/magazine/cc300805.aspx" target="_blank" rel="noopener"&#10; &gt;article in MSDN Magazine&lt;/a&gt; gets in depth with the way a TransactionScope like functionality can be implemented. Gives you a good understanding of what is happening under the hood when using TransactionScope in some Repository implementations in multi-threaded scenarios.&lt;/li&gt;&#10;&lt;li&gt;This CodeProject article is another example of &lt;a class="link" href="http://www.codeproject.com/Articles/31270/A-Transactional-Repository-Implementation-in-NET" target="_blank" rel="noopener"&#10; &gt;implementing a transactional repository&lt;/a&gt;.&lt;/li&gt;&#10;&lt;li&gt;There are &lt;a class="link" href="http://blogs.msdn.com/b/dbrowne/archive/2010/06/03/using-new-transactionscope-considered-harmful.aspx" target="_blank" rel="noopener"&#10; &gt;excellent tips here&lt;/a&gt; about configuring TransactionScope when using it with SQL Server.&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;This is a good resource for &lt;a class="link" href="http://www.codeproject.com/Articles/55472/Committable-Transactions-in-C-SQL" target="_blank" rel="noopener"&#10; &gt;understanding CommitableTransaction&lt;/a&gt; usage.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;li&gt;&#10;&lt;p&gt;And this one on the CodeProject has brilliant, in-depth and under-the-hood coverage - &lt;a class="link" href="http://www.codeproject.com/Articles/35087/Truly-Understanding-NET-Transactions-and-WCF-Imple" target="_blank" rel="noopener"&#10; &gt;Truly Understanding .NET Transactions and WCF Implementation&lt;/a&gt;.&lt;/p&gt;&#10;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;p&gt;Features Provided by System.Transactions&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://msdn.microsoft.com/en-us/library/vstudio/ee818755%28v=vs.100%29.aspx" target="_blank" rel="noopener"&#10; &gt;http://msdn.microsoft.com/en-us/library/vstudio/ee818755(v=vs.100).aspx&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Implementing an Implicit Transaction using Transaction Scope&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://msdn.microsoft.com/en-us/library/vstudio/ee818746%28v=vs.100%29.aspx" target="_blank" rel="noopener"&#10; &gt;http://msdn.microsoft.com/en-us/library/vstudio/ee818746(v=vs.100).aspx&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;MSDN Articles by John Papa&lt;/p&gt;&#10;&lt;p&gt;ADO.NET and System.Transactions&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://msdn.microsoft.com/en-us/magazine/cc163847.aspx" target="_blank" rel="noopener"&#10; &gt;http://msdn.microsoft.com/en-us/magazine/cc163847.aspx&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Revisiting System.Transactions&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://msdn.microsoft.com/en-us/magazine/cc163527.aspx" target="_blank" rel="noopener"&#10; &gt;http://msdn.microsoft.com/en-us/magazine/cc163527.aspx&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;These are specific to TransactionScope (the way to go in most cases)&lt;/p&gt;&#10;&lt;p&gt;Here is a practical example of Using TransactionScope :&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://thewayofcode.wordpress.com/2011/12/11/handling-transactions-in-net-using-transactionscope/" target="_blank" rel="noopener"&#10; &gt;http://thewayofcode.wordpress.com/2011/12/11/handling-transactions-in-net-using-transactionscope/&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This one gets in depth with the way a TransactionScope like functionality can be implemented. Gives you a good understanding of what is happening under the hood when using TransactionScope in some Repository implementations in multi-threaded scenarios.&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://msdn.microsoft.com/en-us/magazine/cc300805.aspx" target="_blank" rel="noopener"&#10; &gt;http://msdn.microsoft.com/en-us/magazine/cc300805.aspx&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Here is another example of implementing a transactional repository :&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://www.codeproject.com/Articles/31270/A-Transactional-Repository-Implementation-in-NET" target="_blank" rel="noopener"&#10; &gt;http://www.codeproject.com/Articles/31270/A-Transactional-Repository-Implementation-in-NET&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;There are excellent tips here about configuring TransactionScope when used with SQL Server:&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="http://blogs.msdn.com/b/dbrowne/archive/2010/06/03/using-new-transactionscope-considered-harmful.aspx" target="_blank" rel="noopener"&#10; &gt;http://blogs.msdn.com/b/dbrowne/archive/2010/06/03/using-new-transactionscope-considered-harmful.aspx&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;This is a good resource for CommitableTransaction usage - &lt;a class="link" href="http://www.codeproject.com/Articles/55472/Committable-Transactions-in-C-SQL" target="_blank" rel="noopener"&#10; &gt;http://www.codeproject.com/Articles/55472/Committable-Transactions-in-C-SQL&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;And this one has brilliant under-the-hood coverage - &lt;a class="link" href="http://www.codeproject.com/Articles/35087/Truly-Understanding-NET-Transactions-and-WCF-Impl" target="_blank" rel="noopener"&#10; &gt;http://www.codeproject.com/Articles/35087/Truly-Understanding-NET-Transactions-and-WCF-Impl&lt;/a&gt;&lt;/p&gt;&#10;</description></item><item><title>Solution to the fetch puzzle</title><link>https://www.tewari.info/2012/01/03/solution-to-the-fetch-puzzle/</link><pubDate>Wed, 04 Jan 2012 03:00:38 +0000</pubDate><guid>https://www.tewari.info/2012/01/03/solution-to-the-fetch-puzzle/</guid><description>&lt;p&gt;Here is a brute force solution to the fetch problem -&lt;/p&gt;&#10;&lt;p&gt;Basically, at each step there are three possibilities :&lt;/p&gt;&#10;&lt;p&gt;1. You can fill a bucket.&lt;/p&gt;&#10;&lt;p&gt;2. You can transfer water from one bucket to the other one.&lt;/p&gt;&#10;&lt;p&gt;3. You can dump out the water from a bucket.&lt;/p&gt;&#10;&lt;p&gt;In this brute force solution, I try each one of these steps and then try all three again after each one of the previous steps. And on&lt;/p&gt;&#10;&lt;p&gt;and on untill I get the required amount of water in one of the buckets.&lt;/p&gt;&#10;&lt;p&gt;Check it out. Source code is on my github repo -&lt;/p&gt;&#10;&lt;p&gt;&lt;a class="link" href="https://github.com/ashtewari/fetch" target="_blank" rel="noopener"&#10; &gt;https://github.com/ashtewari/fetch&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;Here is a brute force solution to the &lt;a class="link" href="https://www.tewari.info/2011/12/26/solve-puzzle-with-code/" title="fetch-puzzle"&#10; &gt;fetch puzzle&lt;/a&gt;.&lt;/p&gt;&#10;&lt;p&gt;The puzzle goes like this – You have two buckets. A 3 gallon bucket and a 5 gallon bucket. Buckets are not marked or graduated. You are to fetch 4 gallons of water in a single trip to the river. How will you do it?&lt;/p&gt;&#10;&lt;p&gt;Basically, at each step there are three possibilities :&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;You can fill a bucket.&lt;/li&gt;&#10;&lt;li&gt;You can transfer water from one bucket to the other one.&lt;/li&gt;&#10;&lt;li&gt;You can dump out the water from a bucket.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;In this brute force solution, I try each one of these steps and then try all three again after each one of the previous steps. And on and on until I get the required amount of water in one of the buckets.&lt;/p&gt;&#10;&lt;p&gt;Check it out. Source code is on my github repo - &lt;a class="link" href="https://github.com/ashtewari/fetch" title="github-repo-fetch"&#10; target="_blank" rel="noopener"&#10; &gt;https://github.com/ashtewari/fetch&lt;/a&gt;&lt;/p&gt;&#10;</description></item><item><title>Solve puzzle with code</title><link>https://www.tewari.info/2011/12/26/solve-puzzle-with-code/</link><pubDate>Tue, 27 Dec 2011 04:44:17 +0000</pubDate><guid>https://www.tewari.info/2011/12/26/solve-puzzle-with-code/</guid><description>&lt;p&gt;Here is a quite common programming interview puzzle - You have two buckets. A 3 gallon bucket and a 5 gallon bucket. Buckets are not marked or graduated. You are to fetch 4 gallon of water in a single trip to the river. How will you do it?&lt;/p&gt;&#10;&lt;p&gt;Obviousy, this question is asked by changing the capacities of the two buckets and the amount of water to be fetched.&lt;/p&gt;&#10;&lt;p&gt;Your mission, should you choose to accept it, is to write a program to solve this puzzle in a generic way. Your program should take 3 inputs - capacities of the two buckets and the amount of water to be fetched. After solving the puzzle, your program must write out the solution step-by-step. You can use any programming language, any platform, any programming technique to write the program. Use whatever you like - C#, VB, C, C++, Java, Ruby, Python, F#, Boo, Javascript or any other language of your choice. Use design patterns, TDD, BDD, MVVM, Linq or whatever. Make it blazing fast, exploit multiple cores, use artificial intelligence. Go nuts! If you want to write the whole program in T-sql, powershell script or a batch script, go ahead. Heck ! you can even do it with regular expressions, if that your thing!&lt;/p&gt;&#10;&lt;p&gt;Your mission, should you choose to accept it, is to write a program to solve this common programming interview puzzle in a generic way.&lt;/p&gt;&#10;&lt;p&gt;The puzzle goes like this - You have two buckets. A 3 gallon bucket and a 5 gallon bucket. Buckets are not marked or graduated. You are to fetch 4 gallons of water in a single trip to the river. How will you do it?&lt;/p&gt;&#10;&lt;p&gt;&lt;img alt="tommylees-flickr-buckets" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://www.tewari.info/wp-content/tommylees-flickr-buckets.jpg"&gt;&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;Photo Credit : http://www.flickr.com/photos/71256895@N00/3688461774/sizes/l/in/photostream/&lt;/em&gt;&lt;/p&gt;&#10;&lt;p&gt;Your program should take 3 inputs - capacities of the two buckets and the amount of water to be fetched. After solving the puzzle, your program must write out the solution step-by-step. You can use any language, any platform and any technique to write the program. Use whatever you like - C#, VB, C, C++, Java, Ruby, Python, F#, Boo, Javascript, powershell script or any other language of your choice. Use design patterns, TDD, BDD, MVVM, Linq or whatever. Make it blazing fast, exploit multiple cores, use artificial intelligence. Go nuts! If you want to write the whole program in T-sql, go ahead. Heck ! you can even do it with regular expressions, if that your thing!&lt;/p&gt;&#10;</description></item><item><title>Getting Started with MVVM</title><link>https://www.tewari.info/2010/11/06/getting-started-with-mvvm/</link><pubDate>Sat, 06 Nov 2010 16:29:24 +0000</pubDate><guid>https://www.tewari.info/2010/11/06/getting-started-with-mvvm/</guid><description>&lt;p&gt;I just finished presenting here at &lt;a class="link" href="http://codecamp.org/" target="_blank" rel="noopener"&#10; &gt;RDU Code Camp&lt;/a&gt;. It was a great crowd ! Here are the slides -&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;&lt;a class="link" href="http://www.slideshare.net/ashtewari/getting-started-with-mvvm" title="Getting started with MVVM"&#10; target="_blank" rel="noopener"&#10; &gt;Getting started with MVVM&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;View more &lt;a class="link" href="http://www.slideshare.net/" target="_blank" rel="noopener"&#10; &gt;presentations&lt;/a&gt; from &lt;a class="link" href="http://www.slideshare.net/ashtewari" target="_blank" rel="noopener"&#10; &gt;ashtewari&lt;/a&gt;.&lt;/p&gt;&#10;</description></item><item><title>Using Model-View-ViewModel in WPF Applications</title><link>https://www.tewari.info/2010/01/25/using-model-view-viewmodel-in-wpf-applications/</link><pubDate>Mon, 25 Jan 2010 22:23:39 +0000</pubDate><guid>https://www.tewari.info/2010/01/25/using-model-view-viewmodel-in-wpf-applications/</guid><description>&lt;p&gt;I am presenting at &lt;a class="link" href="http://www.socalcodecamp.com/" title="socalcodecamp website"&#10; target="_blank" rel="noopener"&#10; &gt;SoCalCodeCamp&lt;/a&gt; this weekend (January 30th, 2010) - &lt;a class="link" href="http://www.socalcodecamp.com/socalcodecamp/session.aspx?sid=0b2ee44f-595d-4f55-a5d6-2b1293f546d0" title="WPF MVVM Presntation "&#10; target="_blank" rel="noopener"&#10; &gt;Advanced WPF - Using Model-View-ViewModel in WPF Applications&lt;/a&gt;.&lt;/p&gt;&#10;&lt;figure&gt;&lt;img src="https://www.tewari.info/wp-content/tasklist.png"&#10;&#9;&#9;&#9;alt="tasklist-mockup"&gt;&lt;figcaption&gt;&#10;&#9;&#9;&#9;&lt;p&gt;tasklist-mockup&lt;/p&gt;&#10;&#9;&#9;&lt;/figcaption&gt;&#10;&lt;/figure&gt;&#10;&#10;&lt;p&gt;Agenda :&lt;/p&gt;&#10;&lt;p&gt;1. Roles of the M-V-VM triad&lt;/p&gt;&#10;&lt;p&gt;2. Why use M-V-VM ?&lt;/p&gt;&#10;&lt;p&gt;3. Characteristics of the ViewModel&lt;/p&gt;&#10;&lt;p&gt;4. Build a Sample WPF Application using M-V-VM&lt;/p&gt;&#10;&lt;p&gt;Resources :&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;&lt;a class="link" href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx" title="MSDN Magazine Article"&#10; target="_blank" rel="noopener"&#10; &gt;MSDN Magazine Article&lt;/a&gt; and Sample Application &lt;a class="link" href="http://code.msdn.microsoft.com/mag200902MVVM/Release/ProjectReleases.aspx" title="Download Demo Application Code"&#10; target="_blank" rel="noopener"&#10; &gt;Download&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a class="link" href="http://martinfowler.com/eaaDev/PresentationModel.html" title="MartinFowler.com"&#10; target="_blank" rel="noopener"&#10; &gt;Martin Fowler’s description of the ‘Presentation Model ‘&lt;/a&gt;&lt;/li&gt;&#10;&lt;li&gt;&lt;a class="link" href="http://codebetter.com/blogs/jeremy.miller/archive/2007/07/25/the-build-your-own-cab-series-table-of-contents.aspx" title="Jeremy Miller&amp;#39;s - Build Your CAB"&#10; target="_blank" rel="noopener"&#10; &gt;Jeremy Miller’s ‘Build Your Own CAB’ series&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ol&gt;&#10;</description></item><item><title>Dial Gauge is a ProgressBar</title><link>https://www.tewari.info/2008/06/10/dial-gauge-is-a-progressbar/</link><pubDate>Wed, 11 Jun 2008 06:49:43 +0000</pubDate><guid>https://www.tewari.info/2008/06/10/dial-gauge-is-a-progressbar/</guid><description>&lt;p&gt;I am not just being philosophical here. In &lt;a class="link" href="http://msdn.microsoft.com/en-us/netframework/aa663326.aspx" title="MSDN-WPF"&#10; target="_blank" rel="noopener"&#10; &gt;WPF&lt;/a&gt;, &lt;a class="link" href="http://msdn.microsoft.com/en-us/magazine/cc163497.aspx" title="Using Templates to Customize WPF Controls"&#10; target="_blank" rel="noopener"&#10; &gt;ControlTemplates&lt;/a&gt; allow you to transform a control&amp;rsquo;s appearance. This is not the same as applying stylesheets. This is an entirely new level of customization. What you see in the screenshot below looks like a Dial but is actually a simple ProgressBar control wearing a &amp;ldquo;Dial&amp;rdquo; template. The Dial template was created using &lt;a class="link" href="http://www.microsoft.com/expression/products/Overview.aspx?key=blend" title="Microsoft-Expression-Blend"&#10; target="_blank" rel="noopener"&#10; &gt;Microsoft Expression Blend&lt;/a&gt; .&lt;/p&gt;&#10;&lt;p&gt;&lt;img alt="dial-is-a-progressbar.PNG" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://www.tewari.info/images/dial-is-a-progressbar.PNG"&gt;&lt;/p&gt;&#10;&lt;p&gt;Include the ControlTemplate as a Window.Resource and then assign it to ProgressBar element&amp;rsquo;s Template attribute :&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-fallback" data-lang="fallback"&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Of course that is not all. The ControlTemplate must define some named elements of FrameworkElement type. Charles Petzold has explained it in detail : &lt;a class="link" href="http://msdn.microsoft.com/en-us/magazine/cc163497.aspx" title="Charles-Petzold-Using Templates to Customize WPF Controls"&#10; target="_blank" rel="noopener"&#10; &gt;MSDN Magazine Article&lt;/a&gt;. So, I will not repeat it here.&lt;/p&gt;&#10;&lt;p&gt;The sample code can be downloaded here : &lt;a class="link" href="https://www.tewari.info/downloads/DialTest.zip" title="DialTest.zip"&#10; &gt;DialTest.zip&lt;/a&gt;&#10;License : &lt;a class="link" href="http://creativecommons.org/licenses/by-nc-sa/3.0/us/" target="_blank" rel="noopener"&#10; &gt;Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.&lt;/a&gt;&lt;/p&gt;&#10;</description></item><item><title>WPF - LINQ to SQL Sample</title><link>https://www.tewari.info/2008/03/07/wpf-linq-to-sql-sample/</link><pubDate>Fri, 07 Mar 2008 07:15:35 +0000</pubDate><guid>https://www.tewari.info/2008/03/07/wpf-linq-to-sql-sample/</guid><description>&lt;p&gt;This exercise in binding a WPF ListView control with LINQ to SQL was a lot of fun ! The following image shows data from &lt;a class="link" href="http://www.codeplex.com/MSFTDBProdSamples" title="MSSQL Sample Databases"&#10; target="_blank" rel="noopener"&#10; &gt;AdventureWorks&lt;/a&gt; sample database displayed in the ListView control. The end result is very admirable, even in this very basic demo. Feeling a complete sense of freedom is unavoidable when working with WPF.&lt;/p&gt;&#10;&lt;p&gt;&lt;img alt="Linq2SqlSample1.Png" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="https://www.tewari.info/images/Linq2SqlSample1.Png"&gt;&lt;/p&gt;&#10;&lt;p&gt;This sample demonstrates :&lt;/p&gt;&#10;&lt;ol&gt;&#10;&lt;li&gt;LINQ to SQL mapping.&lt;/li&gt;&#10;&lt;li&gt;WPF ListView Control DataBinding.&lt;/li&gt;&#10;&lt;li&gt;Displaying images stored in database as varbinary in WPF control.&lt;/li&gt;&#10;&lt;/ol&gt;&#10;&lt;p&gt;The sample code can be downloaded here : &lt;a class="link" href="https://www.tewari.info/downloads/Linq2SqlSample.zip" title="Linq2SqlSample.zip"&#10; &gt;WPF-LINQ to SQL Sample&lt;/a&gt;&#10;License : &lt;a class="link" href="http://creativecommons.org/licenses/by-nc-sa/3.0/us/" target="_blank" rel="noopener"&#10; &gt;Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.&lt;/a&gt; &lt;a class="link" href="http://creativecommons.org/licenses/by-nc-sa/3.0/us/" target="_blank" rel="noopener"&#10; &gt;&lt;img alt="Creative Commons License" class="gallery-image" data-flex-basis="681px" data-flex-grow="283" height="31" loading="lazy" sizes="(max-width: 767px) calc(100vw - 30px), (max-width: 1023px) 700px, (max-width: 1279px) 950px, 1232px" src="http://i.creativecommons.org/l/by-nc-sa/3.0/us/88x31.png" width="88"&gt;&lt;/a&gt;&lt;/p&gt;&#10;</description></item><item><title>Database Schema Version Control Tool</title><link>https://www.tewari.info/2008/02/18/dbupdater-database-schema-version-control/</link><pubDate>Tue, 19 Feb 2008 03:05:52 +0000</pubDate><guid>https://www.tewari.info/2008/02/18/dbupdater-database-schema-version-control/</guid><description>&lt;p&gt;It is essential to treat database schema as source code and apply all the norms and best practices applicable to it. From what I hear and read, database schema version control is non-existent in too many projects.&lt;/p&gt;&#10;&lt;p&gt;Various techniques to accomplish version control of database schemas have been discussed and published. Martin Fowler and Pramod Sadagale has written a comprehensive article on &lt;a class="link" href="http://martinfowler.com/articles/evodb.html" target="_blank" rel="noopener"&#10; &gt;Evolutionary Database Design&lt;/a&gt;. It is a must-read for everyone involved with database development.&lt;/p&gt;&#10;&lt;p&gt;K. Scott Allen writes in detail about an excellent system here - &lt;a class="link" href="http://odetocode.com/Blogs/scott/archive/2008/02/02/11721.aspx" title="Versioning Databases - Change Scripts"&#10; target="_blank" rel="noopener"&#10; &gt;Versioning Databases - Change Scripts&lt;/a&gt;. This approach is sufficiently light-weight (for my taste) and provides complete control over the whole process.&lt;/p&gt;&#10;&lt;p&gt;I am providing a free tool here that you can use to implement this system. It will even create the SchemaVersionsLog table for your database, if it doesn&amp;rsquo;t exist. If you are using this tool with MSSQL Server, you can get started with very little effort. If you are using a different DBMS, you can still use this tool. It uses NHibernate to access the SchemaVersionsLog table. So, any DBMS supported by NHibernate is acceptable, as long as it comes with a command line tool to execute the sql scripts.&lt;/p&gt;&#10;&lt;p&gt;Download &lt;a class="link" href="https://www.tewari.info/dbupdater/" title="DbUpdater : Database Schema Version Control"&#10; &gt;DbUpdater here&lt;/a&gt;.&lt;/p&gt;&#10;</description></item></channel></rss>