<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>House of Metnetsky &#187; pms</title>
	<atom:link href="http://cowarthill.com/blog/index.php/tag/pms/feed/" rel="self" type="application/rss+xml" />
	<link>http://cowarthill.com/blog</link>
	<description>Run Tortoise Run</description>
	<lastBuildDate>Fri, 26 Feb 2010 17:15:33 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>PMS2 &#8211; Coming Soon to an Interweb Near You</title>
		<link>http://cowarthill.com/blog/index.php/2009/02/19/pms2-coming-soon/</link>
		<comments>http://cowarthill.com/blog/index.php/2009/02/19/pms2-coming-soon/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 23:39:28 +0000</pubDate>
		<dc:creator>MET</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[kmbs]]></category>
		<category><![CDATA[mono]]></category>
		<category><![CDATA[pms]]></category>
		<category><![CDATA[printgroove]]></category>

		<guid isPermaLink="false">http://cowarthill.com/blog/?p=158</guid>
		<description><![CDATA[A long, long time myself and two friends were working on a college project where the entire goal as I saw it was to &#8220;create&#8221; stuff. Mono was a wee lad back in 2003, but I still preferred it to Java any day of the week. So myself, Phil Tricca, and Joseph Scaduto created a [...]]]></description>
			<content:encoded><![CDATA[<p>A long, long time myself and two friends were working on a college project  where the entire goal as I saw it was to &#8220;create&#8221; stuff. <a href="http://www.mono-project.com/Main_Page" target="_blank">Mono</a> was a wee lad back in 2003, but I still preferred it to Java any day of the week. So myself, <a href="http://media.www.dailyorange.com/media/storage/paper522/news/2003/11/19/Feature/Traditional.Remedies.Come.Up.Short.In.The.Quest.For.The.Perfect.Hangover.Cure-561669.shtml" target="_blank">Phil Tricca</a>, and Joseph Scaduto created a whole framework for creating what are now called &#8220;learning communities&#8221; in <a href="http://www.mono-project.com/Main_Page" target="_blank">Mono</a>/<a href="http://www.mono-project.com/GtkSharp" target="_blank">Gtk#</a>/<a href="http://www.mono-project.com/Mod_mono" target="_blank">mod_mono</a>.</p>
<p>One of the pieces we needed was a databases abstraction layer (we had grand ideas) so we first sought to flush out the <a href="http://msdn.microsoft.com/en-us/library/ms971512.aspx" target="_blank">ObjectSpaces</a> API for Mono. Sadly, Microsoft couldn&#8217;t get their act together so we built our own. So in honor of Microsoft we called it Phil-And-Matt Spaces, shortened to PMS. After it&#8217;s original debut it sat on the selves for quite some time until I started working for <a href="http://kmbs.konicaminolta.us/" target="_blank">Konica Minolta Business Solutions</a> and was tasked with creating <a href="http://kmbs.konicaminolta.us/content/products/models/printgroove.html" target="_blank">Printgroove</a>. PMS hit the spot (man that sounds funny) &#8211; it was far from bad, but it certainly wasn&#8217;t awesome. At the point of its resurrection it needed a face lift, but never got one.</p>
<p>It&#8217;s now been years since <a href="http://kmbs.konicaminolta.us/content/products/models/printgroove.html" target="_blank">Printgroove</a> got started and PMS has continued to work well for it and numerous other projects &#8211; but I&#8217;ve got an itch that must be scratched. So while working on a small web service only project I&#8217;ve been adding in a couple dozen extra hours to mature PMS &#8211; or basically throw away it&#8217;s entire user facing API.</p>
<p>Here&#8217;s a sneak peak of whats to come:</p>
<pre class="brush: csharp; title: ; notranslate">
// - Pull IDbConnection from pool based on unique name (from config file)
// - This is useful if you have multiple databases to chat with
// - Not specifying a name will load the one marked default or the first one found
using (DbBroker cxt = new DbBroker(&quot;name-mapping-to-config-connection-string&quot;)) {

    // SELECT member.* FROM member WHERE username LIKE '%a%' ORDER BY id
	// Enumerate through results without storing Member objects in container
	foreach (Member m in cxt.Query&lt;Member&gt;().Like(&quot;username&quot;, &quot;%a%&quot;).OrderBy(&quot;id&quot;).Exec())
		Console.WriteLine(&quot; : &quot; + m);

	// Use raw SQL and ignore chainable methods for generation
	// Store results in List&lt;Member&gt; and then iterate through it
	string sql = &quot;SELECT member.* FROM member where username LIKE '%a%' ORDER BY id&quot;;
	foreach (Member m in cxt.Exec&lt;Member&gt;().Objects&lt;List&lt;Member&gt;&gt;(sql))
		Console.WriteLine(&quot; : &quot; + m);

	// get first member
	Console.WriteLine(&quot;first: &quot; + cxt.Query&lt;Member&gt;().Exec().First());

	// a short-cut to get the first member since we aren't filtering etc
	Console.WriteLine(&quot;first: &quot; + cxt.Exec&lt;Member&gt;().First());

	// SELECT COUNT(member.*) FROM member WHERE id &gt; 50000
	// Use generics to cast the output of ExecuteScalar to an Int32
	Console.WriteLine(&quot;count: &quot; + cxt.Query&lt;Member&gt;().Filter(&quot;id &gt; 50000&quot;).Exec().Count&lt;int&gt;());

	// Directly call ExecuteScalar but use generics to cast the output
    sql = &quot;SELECT id FROM member WHERE username='mimetnet'&quot;;
	Console.WriteLine(&quot;scalar: &quot; + cxt.Exec&lt;Member&gt;().Scalar&lt;int&gt;(sql));

	// Directly call ExecuteReader() with our generated SQL
	// SELECT id,username FROM member WHERE id &gt; 68665
	using (IDataReader reader = cxt.Query&lt;Member&gt;()
									.GreaterThan(&quot;id&quot;, 68665)
									.SetColumns(&quot;id,username&quot;)
									.Exec()
									.Reader()) {
		while (reader.Read()) {
			Console.WriteLine(&quot;Member(id={0}, name='{1}')&quot;, reader[0], reader[1]);
		}
	}
}
</pre>
<p>Please send me your thoughts/concerns/nightmares.</p>
]]></content:encoded>
			<wfw:commentRss>http://cowarthill.com/blog/index.php/2009/02/19/pms2-coming-soon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

