<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Jason Stonebraker</title>
	<atom:link href="http://jasonstonebraker.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://jasonstonebraker.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Mon, 16 May 2011 12:17:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='jasonstonebraker.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Jason Stonebraker</title>
		<link>http://jasonstonebraker.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://jasonstonebraker.wordpress.com/osd.xml" title="Jason Stonebraker" />
	<atom:link rel='hub' href='http://jasonstonebraker.wordpress.com/?pushpress=hub'/>
		<item>
		<title>The Anatomy of a Web Application</title>
		<link>http://jasonstonebraker.wordpress.com/2011/02/21/the-anatomy-of-a-web-application/</link>
		<comments>http://jasonstonebraker.wordpress.com/2011/02/21/the-anatomy-of-a-web-application/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 02:51:17 +0000</pubDate>
		<dc:creator>Jason Stonebraker</dc:creator>
				<category><![CDATA[Modeling]]></category>

		<guid isPermaLink="false">http://jasonstonebraker.wordpress.com/?p=457</guid>
		<description><![CDATA[Web Production consists of three core disciplines: User Experience Design, Interface Design and Development, and Software Design and Development. As a practitioner of each of these disciplines, I have long noted the great divide between the communities. The software community deals with software design and development, the interface community deals with interface design and development, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasonstonebraker.wordpress.com&amp;blog=9996014&amp;post=457&amp;subd=jasonstonebraker&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://jasonstonebraker.wordpress.com/2011/02/16/language-produce/">Web Production </a>consists of three core disciplines: User Experience Design, Interface Design and Development, and Software Design and Development. As a practitioner of each of these disciplines, I have long noted the great divide between the communities. The software community deals with software design and development, the interface community deals with interface design and development, and the user experience community deals with user concerns, or more specifically, the web application&#8217;s purpose. </p>
<p>The simple fact is, that in any web application, the degree to which the activities of each of these disciplines are done well will determine the <a href="http://jasonstonebraker.wordpress.com/2011/02/13/5-facets-of-valuable-web-applications/">application&#8217;s value</a>. Weaknesses in any of these areas within an application will decrease the value of the application. Given this critical postulate, I&#8217;ve been working lately to model the interdependence between server software, the interface, and the user experience. This is the resulting model:</p>
<div id="attachment_458" class="wp-caption aligncenter" style="width: 478px"><a href="http://jasonstonebraker.files.wordpress.com/2011/02/the_anatomy_of_a_web_application_jason_stonebraker_2011.png"><img src="http://jasonstonebraker.files.wordpress.com/2011/02/the_anatomy_of_a_web_application_jason_stonebraker_2011.png?w=468&#038;h=259" alt="The Anatomy of a Web Application - Jason Stonebraker, 2011" title="The_Anatomy_of_a_Web_Application_Jason_Stonebraker_2011" width="468" height="259" class="size-full wp-image-458" /></a><p class="wp-caption-text">The Anatomy of a Web Application - Jason Stonebraker, 2011</p></div>
<p>Most of this diagram is a whole lotta duh. But what is notable to me is the positioning of <a href="http://semanticstudios.com/publications/semantics/000029.php">User Experience</a>. The User Experience doesn&#8217;t wrap the interface or the software, nor does it sit atop it. It intangibly exists between a user&#8217;s expectations and his/her actual interaction with the application. Given this, one can see that an application&#8217;s purpose should always model the user&#8217;s expectations. That is not a new notion, it is sadly, simply not always done. </p>
<p>What sits atop as the primary driver is the application&#8217;s purpose, meaning <em>purpose</em> is the third element of a web application. It carries significant weight, and is as much a part of an application as the interface and the software. I don&#8217;t know about you, but that&#8217;s super interesting to me. </p>
<p>In any case, I&#8217;m very happy with this diagram at the moment. I believe it accurately models the interdependence of the three core disciplines, and may serve as a tool for better uniting them.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jasonstonebraker.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jasonstonebraker.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jasonstonebraker.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jasonstonebraker.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jasonstonebraker.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jasonstonebraker.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jasonstonebraker.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jasonstonebraker.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jasonstonebraker.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jasonstonebraker.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jasonstonebraker.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jasonstonebraker.wordpress.com/457/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jasonstonebraker.wordpress.com/457/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jasonstonebraker.wordpress.com/457/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasonstonebraker.wordpress.com&amp;blog=9996014&amp;post=457&amp;subd=jasonstonebraker&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jasonstonebraker.wordpress.com/2011/02/21/the-anatomy-of-a-web-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/16eb2a7f3dda1411fc39fc523005a14c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jason Stonebraker</media:title>
		</media:content>

		<media:content url="http://jasonstonebraker.files.wordpress.com/2011/02/the_anatomy_of_a_web_application_jason_stonebraker_2011.png" medium="image">
			<media:title type="html">The_Anatomy_of_a_Web_Application_Jason_Stonebraker_2011</media:title>
		</media:content>
	</item>
		<item>
		<title>Measuring the Value of Web Applications</title>
		<link>http://jasonstonebraker.wordpress.com/2011/02/16/measuring-the-value-of-web-applications/</link>
		<comments>http://jasonstonebraker.wordpress.com/2011/02/16/measuring-the-value-of-web-applications/#comments</comments>
		<pubDate>Wed, 16 Feb 2011 01:51:42 +0000</pubDate>
		<dc:creator>Jason Stonebraker</dc:creator>
				<category><![CDATA[Measuring Value]]></category>

		<guid isPermaLink="false">http://jasonstonebraker.wordpress.com/?p=437</guid>
		<description><![CDATA[To view the framework visit: 5 Facets of Valuable Web Applications Introduction to the Five Facets Framework The term &#8220;valuable application&#8221; is used often, but seems to have little practical or consistent meaning. In an attempt to define what it means to produce a valuable web application, I propose a framework for qualitative measurement meant [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasonstonebraker.wordpress.com&amp;blog=9996014&amp;post=437&amp;subd=jasonstonebraker&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>To view the framework visit:<br />
<a href="http://jasonstonebraker.wordpress.com/2011/02/13/5-facets-of-valuable-web-applications/">5 Facets of Valuable Web Applications</a></p>
<h2>Introduction to the Five Facets Framework</h2>
<p>The term &#8220;valuable application&#8221; is used often, but seems to have little practical or consistent meaning. In an attempt to define what it means to produce a valuable web application, I propose a framework for qualitative measurement meant to facilitate communication and decision making among production teams, sustainment teams, and product owners in terms of a web application&#8217;s immediate and long-term value to the business and the application&#8217;s users. </p>
<p>When it comes to measuring value, organizations will sometimes base their determinations on arbitrary, incomplete, or inconsequential factors. They might measure the success of a project&#8217;s execution by comparing estimated versus actual costs, or decide that an application is complete when it satisfies its requirements, at which point, the application&#8217;s value is assumed. Both of these techniques serve a purpose, but neither of these account for an application&#8217;s ability to sustain its value, or even increase in value, after it is released. </p>
<p>This framework seeks to measure the less conspicuous, but more determinant factors of a web application&#8217;s value: its purpose, architecture, and implementation. The framework&#8217;s key principle is Continuous Improvement in support of Iterative Design.</p>
<p>The definition of a valuable web application will likely differ from one organization to another. Some may find the details of this framework suit them perfectly as-is, while others may find it necessary to make modifications. The important thing is that the discussion occurs, and measurable goals are agreed upon. My hope is that this framework will help facilitate those discussions in some way.</p>
<p><a href="http://jasonstonebraker.wordpress.com/2011/02/13/5-facets-of-valuable-web-applications/">5 Facets of Valuable Web Applications</a></p>
<h1>&nbsp;</h1>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jasonstonebraker.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jasonstonebraker.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jasonstonebraker.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jasonstonebraker.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jasonstonebraker.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jasonstonebraker.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jasonstonebraker.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jasonstonebraker.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jasonstonebraker.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jasonstonebraker.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jasonstonebraker.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jasonstonebraker.wordpress.com/437/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jasonstonebraker.wordpress.com/437/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jasonstonebraker.wordpress.com/437/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasonstonebraker.wordpress.com&amp;blog=9996014&amp;post=437&amp;subd=jasonstonebraker&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jasonstonebraker.wordpress.com/2011/02/16/measuring-the-value-of-web-applications/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/16eb2a7f3dda1411fc39fc523005a14c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jason Stonebraker</media:title>
		</media:content>
	</item>
		<item>
		<title>The Role of Language</title>
		<link>http://jasonstonebraker.wordpress.com/2011/02/16/the-role-of-language/</link>
		<comments>http://jasonstonebraker.wordpress.com/2011/02/16/the-role-of-language/#comments</comments>
		<pubDate>Wed, 16 Feb 2011 00:28:02 +0000</pubDate>
		<dc:creator>Jason Stonebraker</dc:creator>
				<category><![CDATA[Language]]></category>

		<guid isPermaLink="false">http://jasonstonebraker.wordpress.com/?p=385</guid>
		<description><![CDATA[The Role of Language Language frames and informs the way we think and interact with one another. I believe the web industry is currently suffering from the unabated use of terms that don’t accurately frame and inform the creative, continuous act of web production. Some of the terms I&#8217;ll suggest might resonate with you while [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasonstonebraker.wordpress.com&amp;blog=9996014&amp;post=385&amp;subd=jasonstonebraker&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h1>The Role of Language</h1>
<p>Language frames and informs the way we think and interact with one another. I believe the web industry is currently suffering from the unabated use of terms that don’t accurately frame and inform the creative, continuous act of web production. </p>
<p>Some of the terms I&#8217;ll suggest might resonate with you while others might seem utterly ridiculous, at least at first. Even if you choose to not use these terms outwardly, I invite you to think in these terms inwardly as you move through the process of producing, gifting, and offering. I believe you will find that these terms better represent the activities of web production, and provide a touch of humanity and continued accountability to an often impersonal business. </p>
<p>More importantly, I believe you will find that by simply making small adjustments to the language you use, even if only in your personal, internal speech, your perception of your role and the roles of those you work with will change, you will produce better work, and enjoy your work more as a result.</p>
<h2>Suggested Terms</h2>
<p>Click on each term for the reasoning behind the suggestion.</p>
<ul>
<li><a href="http://jasonstonebraker.wordpress.com/2011/02/16/language-produce/">Produce</a> &#8211; Consider using <em>Produce</em> in place of <em>Design</em>, <em>Develop</em>, or <em>Build</em>.</li>
<li><a href="http://jasonstonebraker.wordpress.com/2011/02/16/language-gift/">Gift</a> &#8211; Consider using <em>Gift</em> in place of <em>Deliver</em>.</li>
<li><a href="http://jasonstonebraker.wordpress.com/2011/02/16/language-offer/">Offer</a> &#8211; Consider using <em>Offer</em> in place of <em>Release</em> or <em>Launch</em>.</li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jasonstonebraker.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jasonstonebraker.wordpress.com/385/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jasonstonebraker.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jasonstonebraker.wordpress.com/385/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jasonstonebraker.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jasonstonebraker.wordpress.com/385/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jasonstonebraker.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jasonstonebraker.wordpress.com/385/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jasonstonebraker.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jasonstonebraker.wordpress.com/385/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jasonstonebraker.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jasonstonebraker.wordpress.com/385/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jasonstonebraker.wordpress.com/385/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jasonstonebraker.wordpress.com/385/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasonstonebraker.wordpress.com&amp;blog=9996014&amp;post=385&amp;subd=jasonstonebraker&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jasonstonebraker.wordpress.com/2011/02/16/the-role-of-language/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/16eb2a7f3dda1411fc39fc523005a14c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jason Stonebraker</media:title>
		</media:content>
	</item>
		<item>
		<title>Suggested Term: Produce</title>
		<link>http://jasonstonebraker.wordpress.com/2011/02/16/language-produce/</link>
		<comments>http://jasonstonebraker.wordpress.com/2011/02/16/language-produce/#comments</comments>
		<pubDate>Wed, 16 Feb 2011 00:20:20 +0000</pubDate>
		<dc:creator>Jason Stonebraker</dc:creator>
				<category><![CDATA[Language]]></category>

		<guid isPermaLink="false">http://jasonstonebraker.wordpress.com/?p=351</guid>
		<description><![CDATA[&#8220;Produce&#8221; Consider using Produce in place of Design, Develop, or Build. When referring to the activity of an entire team, I use the term produce in place of verbs such as design, develop, or build. I do this for three reasons. Given that web production teams consist of project leaders, business representatives, users, designers, and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasonstonebraker.wordpress.com&amp;blog=9996014&amp;post=351&amp;subd=jasonstonebraker&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h1>&#8220;Produce&#8221;</h1>
<h2>Consider using <em>Produce</em> in place of <em>Design</em>, <em>Develop</em>, or <em>Build</em>.</h2>
<p>When referring to the activity of an entire team, I use the term <em>produce</em> in place of verbs such as <em>design</em>, <em>develop</em>, or <em>build</em>. I do this for three reasons.</p>
<ol>
<li>Given that web production teams consist of project leaders, business representatives, users, designers, and developers, it makes sense to refer to the combined, collaborative activities of the team as <em>production</em>. Designers design. Developers develop. The “whole team” <em>produces</em> a web application.</li>
<li>In his book, <em>Extreme Programming Explained</em>, Kent Beck places importance on iterative design recommending that teams “perform all of the activities of web [production] at the same time.” The term <em>design and development</em> implies phased thinking, and limits the activities of web application production to those two activities. Knowledge gathering, prioritizing, and planning are a few other activities that must continually occur throughout a web project. The term <em>production</em> makes no assumptions about the activities taking place, and allows for any activity to occur at any time and in any order when <em>producing</em> an application.</li>
<li>The terms <em>develop</em> and <em>build</em> tend to carry the connotation that the web application being produced will reach a state of completeness. <em>In my opinion, the notion that a web application will ever take on a final form is the most problematic misconception of web application production</em>. There is no such thing as a state of completeness for most web applications. A web application will have varying degrees of value, and it will either be available or unavailable for use, but it will always be subject to change and improvement. This is true regardless of who is responsible for making those changes.</li>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jasonstonebraker.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jasonstonebraker.wordpress.com/351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jasonstonebraker.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jasonstonebraker.wordpress.com/351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jasonstonebraker.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jasonstonebraker.wordpress.com/351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jasonstonebraker.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jasonstonebraker.wordpress.com/351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jasonstonebraker.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jasonstonebraker.wordpress.com/351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jasonstonebraker.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jasonstonebraker.wordpress.com/351/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jasonstonebraker.wordpress.com/351/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jasonstonebraker.wordpress.com/351/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasonstonebraker.wordpress.com&amp;blog=9996014&amp;post=351&amp;subd=jasonstonebraker&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jasonstonebraker.wordpress.com/2011/02/16/language-produce/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/16eb2a7f3dda1411fc39fc523005a14c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jason Stonebraker</media:title>
		</media:content>
	</item>
		<item>
		<title>Suggested Term: Offer</title>
		<link>http://jasonstonebraker.wordpress.com/2011/02/16/language-offer/</link>
		<comments>http://jasonstonebraker.wordpress.com/2011/02/16/language-offer/#comments</comments>
		<pubDate>Wed, 16 Feb 2011 00:19:34 +0000</pubDate>
		<dc:creator>Jason Stonebraker</dc:creator>
				<category><![CDATA[Language]]></category>

		<guid isPermaLink="false">http://jasonstonebraker.wordpress.com/?p=369</guid>
		<description><![CDATA[&#8220;Offer&#8221; Consider using Offer in place of Release or Launch. The terms release and launch are used by production teams to mark the milestone of making a web application, or a feature enhancement to a web application, available to the application’s users. These terms grate me too. They too connote a sense of finality, and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasonstonebraker.wordpress.com&amp;blog=9996014&amp;post=369&amp;subd=jasonstonebraker&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h1>&#8220;Offer&#8221;</h1>
<h2>Consider using <em>Offer</em> in place of <em>Release</em> or <em>Launch</em>.</h2>
<p>The terms <em>release</em> and <em>launch</em> are used by production teams to mark the milestone of making a web application, or a feature enhancement to a web application, available to the application’s users. These terms grate me too. They too connote a sense of finality, and the milestone is often celebrated as the end of production activity for a given web application. This is great news and a great accomplishment for the team, but it is merely the beginning of life for the web application itself. <em>An application has no value until it is made available for use, and it is only then that its value can be truly measured</em>. From the user’s perspective, the web application is brand new. The user, and the business for that matter, will not be as convinced of its value as the production team will have been during its happy hour celebration. From an outward-in perspective, the production team has <em>offered</em> an application that may or may not be accepted by the users and the business. By all means, celebrate the milestone, but bear in mind that just like child birth, the work has only just begun. No I don’t recommend using the word <em>birth</em> in place of <em>offer</em>. I don’t want to have to wake up to hop on a 5am “birth call.” Gross.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jasonstonebraker.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jasonstonebraker.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jasonstonebraker.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jasonstonebraker.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jasonstonebraker.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jasonstonebraker.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jasonstonebraker.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jasonstonebraker.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jasonstonebraker.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jasonstonebraker.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jasonstonebraker.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jasonstonebraker.wordpress.com/369/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jasonstonebraker.wordpress.com/369/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jasonstonebraker.wordpress.com/369/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasonstonebraker.wordpress.com&amp;blog=9996014&amp;post=369&amp;subd=jasonstonebraker&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jasonstonebraker.wordpress.com/2011/02/16/language-offer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/16eb2a7f3dda1411fc39fc523005a14c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jason Stonebraker</media:title>
		</media:content>
	</item>
		<item>
		<title>Suggested Term: Gift</title>
		<link>http://jasonstonebraker.wordpress.com/2011/02/16/language-gift/</link>
		<comments>http://jasonstonebraker.wordpress.com/2011/02/16/language-gift/#comments</comments>
		<pubDate>Wed, 16 Feb 2011 00:13:38 +0000</pubDate>
		<dc:creator>Jason Stonebraker</dc:creator>
				<category><![CDATA[Language]]></category>

		<guid isPermaLink="false">http://jasonstonebraker.wordpress.com/?p=365</guid>
		<description><![CDATA[&#8220;Gift&#8221; Consider using Gift in place of Deliver. I’m not a fan of the verb deliver or the noun deliverable in the context of web application production. When I think of delivery, I think of the UPS guy leaving a non-descript brown package at my door, and walking away taking no responsibility for the quality [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasonstonebraker.wordpress.com&amp;blog=9996014&amp;post=365&amp;subd=jasonstonebraker&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h1>&#8220;Gift&#8221;</h1>
<h2>Consider using <em>Gift</em> in place of <em>Deliver</em>.</h2>
<p>I’m not a fan of the verb <em>deliver</em> or the noun <em>deliverable</em> in the context of web application production. When I think of delivery, I think of the UPS guy leaving a non-descript brown package at my door, and walking away taking no responsibility for the quality or fitness of the product inside. In searching for a better term, I arrived at the word <em>gift</em>. Granted, using the term <em>gift</em> in place of <em>deliver</em> in a business environment is a bit of a stretch. However, for the giver, the term <em>gift</em> carries with it a sense of accountability and the anticipation of welcoming enthusiasm from the recipient. If I am on a production team that will be handing off a web application to an altogether different sustainment team, I am likely to do better work if I think in terms of <em>gifting</em> the application I’ve helped to produce as opposed to <em>delivering</em> it and bailing undetected. Also, like the terms <em>develop</em> and <em>build</em>, <em>deliver</em> connotes the problematic misconception of finality.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jasonstonebraker.wordpress.com/365/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jasonstonebraker.wordpress.com/365/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jasonstonebraker.wordpress.com/365/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jasonstonebraker.wordpress.com/365/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jasonstonebraker.wordpress.com/365/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jasonstonebraker.wordpress.com/365/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jasonstonebraker.wordpress.com/365/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jasonstonebraker.wordpress.com/365/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jasonstonebraker.wordpress.com/365/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jasonstonebraker.wordpress.com/365/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jasonstonebraker.wordpress.com/365/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jasonstonebraker.wordpress.com/365/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jasonstonebraker.wordpress.com/365/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jasonstonebraker.wordpress.com/365/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasonstonebraker.wordpress.com&amp;blog=9996014&amp;post=365&amp;subd=jasonstonebraker&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jasonstonebraker.wordpress.com/2011/02/16/language-gift/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/16eb2a7f3dda1411fc39fc523005a14c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jason Stonebraker</media:title>
		</media:content>
	</item>
		<item>
		<title>5 Facets of Valuable Web Applications</title>
		<link>http://jasonstonebraker.wordpress.com/2011/02/13/5-facets-of-valuable-web-applications/</link>
		<comments>http://jasonstonebraker.wordpress.com/2011/02/13/5-facets-of-valuable-web-applications/#comments</comments>
		<pubDate>Sun, 13 Feb 2011 21:31:12 +0000</pubDate>
		<dc:creator>Jason Stonebraker</dc:creator>
				<category><![CDATA[Measuring Value]]></category>

		<guid isPermaLink="false">http://jasonstonebraker.wordpress.com/?p=249</guid>
		<description><![CDATA[For an introduction to the framework read: Measuring the Value of Web Applications The Five Facets Framework The framework consists of four parts A definition of a &#8220;valuable web application&#8221;. A snowflake diagram that specifies the facets of a valuable web application. A series of statements for each facet that help determine the degree to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasonstonebraker.wordpress.com&amp;blog=9996014&amp;post=249&amp;subd=jasonstonebraker&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>For an introduction to the framework read:<br />
<a href="http://jasonstonebraker.wordpress.com/2011/02/16/measuring-the-value-of-web-applications/">Measuring the Value of Web Applications</a></p>
<h2>The Five Facets Framework</h2>
<p>The framework consists of four parts</p>
<ol>
<li>A definition of a &#8220;valuable web application&#8221;.</li>
<li>A snowflake diagram that specifies the facets of a valuable web application.</li>
<li>A series of statements for each facet that help determine the degree to which each facet has been satisfied.</li>
<li>The &#8220;<a href="http://en.wikipedia.org/wiki/Harvey_Balls">Harvey Ball</a>&#8221; system of qualitative measurement which provides five states of completeness to be applied per statement.</li>
</ol>
<h2>Defining Value</h2>
<p>A <strong>valuable web application</strong> concisely serves its business purpose, assuredly functions as expected, and can be straightforwardly and continuously improved.</p>
<h2>The Snowflake Diagram</h2>
<div id="attachment_334" class="wp-caption aligncenter" style="width: 478px"><a href="http://jasonstonebraker.files.wordpress.com/2011/02/5_facets_of_valuable_web_applications_jason_stonebraker_c7.png"><img src="http://jasonstonebraker.files.wordpress.com/2011/02/5_facets_of_valuable_web_applications_jason_stonebraker_c7.png?w=468&#038;h=297" alt="5 Facets of Valuable Web Applications - Jason Stonebraker" title="5_Facets_of_Valuable_Web_Applications_Jason_Stonebraker_c" width="468" height="297" class="size-full wp-image-334" /></a><p class="wp-caption-text">5 Facets of Valuable Web Applications - Jason Stonebraker</p></div>
<h2>Qualitative Measurement</h2>
<div id="attachment_260" class="wp-caption aligncenter" style="width: 433px"><a href="http://jasonstonebraker.files.wordpress.com/2011/02/harvey_balls.png"><img src="http://jasonstonebraker.files.wordpress.com/2011/02/harvey_balls.png?w=468" alt="Harvey Balls" title="Harvey_Balls"   class="size-full wp-image-260" /></a><p class="wp-caption-text">Harvey Balls used for qualitative measurement of each statement below.</p></div>
<h2>Purposeful</h2>
<ul>
<li>The application’s business purpose is clearly defined.</li>
<li>The business domain is clearly defined.</li>
<li>The functional requirements are clearly defined.</li>
<li>The application owner has affirmed that the application serves its business purpose.</li>
<li>The application increases the value of the large scale structure.</li>
</ul>
<h2>Representative</h2>
<ul>
<li>A domain dictionary exists to ensure a ubiquitous language based on the language of the business.</li>
<li>The model serves, and is confined to its business purpose.</li>
<li>The model accurately reflects the current understanding of the business domain.</li>
<li>The ubiquitous language is used in all relevant aspects of the code.</li>
<li>Data storage is structured to mimic the domain model.</li>
</ul>
<h2>Refactorable</h2>
<ul>
<li>The objects, fields, variables, etc. of the system are explicitly named according to their purposes.</li>
<li>The behaviors of the system are reduced to their lowest common denominator.</li>
<li>The code concisely serves its functional purpose.</li>
<li>The code is well abstracted to avoid duplicate functionality.</li>
<li>There is a clear separation of business and technical concerns.</li>
</ul>
<h2>Functional</h2>
<ul>
<li>The code is well commented, and those comments clearly describe the code’s purpose.</li>
<li>The code is well documented and provides insight to developers who are unfamiliar with its purpose.</li>
<li>The code functions as expected.</li>
<li>The application builds efficiently and successfully.</li>
<li>The components are plainly and usefully organized.</li>
</ul>
<h2>Testable</h2>
<ul>
<li>Functioning unit tests exist for every test-worthy aspect of the code.</li>
<li>The tests are well named according to their purposes.</li>
<li>The tests are well commented, and those comments clearly describe their purposes. </li>
<li>The tests are plainly and usefully organized. </li>
<li>The tests run efficiently and successfully.</li>
</ul>
<h2>How it Works</h2>
<ol>
<li>Using the statements provided, or those that work best for your organization, apply a Harvey Ball to each.</li>
<li>An empty Harvey Ball indicates that the statement was not at all satisfied by the web application produced, while a full Harvey Ball indicates that the statement was completely satisfied.</li>
<li>If any Harvey Ball other than a full ball is applied to any statement, a reason must be provided as feedback to the production team so the team can improve upon that facet by fully satisfying the statement.</li>
<li>Once Harvey Balls have been assigned to each statement for each facet, the satisfaction of each facet is calculated by averaging the responses for each statement. A simple way to do this is to give each Harvey Ball a numeric value; e.g., an empty ball equals 0, a quarter ball equals 1, and so forth to 4. The average can then be taken of each response for each statement for a given facet, and the result will determine the completeness of that facet. This result is converted to a Harvey Ball and is applied to the facet. This is done for each facet.</li>
<li>Now that each facet has been measured, the overall value of the web application&#8217;s architecture and implementation can be determined by averaging the results for each of the five facets. The resulting Harvey Ball is applied to the core Value giving the overall value of the web application as represented by a single Harvey Ball.</li>
</ol>
<h2>Example</h2>
<p>This is an example of a snowflake diagram after the completeness of each facet has been measured. The five facets were then averaged and the result was applied to indicate the overall value of the web application&#8217;s architecture and implementation. </p>
<ul>
<li>The Harvey Ball found under the word <code>Valuable </code>is the final gauge of the web application&#8217;s value.</li>
<li>The Harvey Balls applied to each of the 5 facets indicate the degree to which improvements must be made to each facet to increase the overall value of the web application.</li>
</ul>
<p>When a production team is passing off an application to a sustainment team, this framework provides a great instrument for productive, future-focused discussion between the production team, the sustainment team, and the financial decision makers. Financial decision makers can now make informed decisions with regard for the anticipated shelf life of the web application.</p>
<div id="attachment_270" class="wp-caption aligncenter" style="width: 478px"><a href="http://jasonstonebraker.files.wordpress.com/2011/02/5_facets_of_valuable_web_applications_with_harvey_balls_jason_stonebraker.png"><img src="http://jasonstonebraker.files.wordpress.com/2011/02/5_facets_of_valuable_web_applications_with_harvey_balls_jason_stonebraker.png?w=468&#038;h=247" alt="Snowflake diagram with Harvey Balls for qualitative measurement." title="5_Facets_of_Valuable_Web_Applications_With_Harvey_Balls_Jason_Stonebraker" width="468" height="247" class="size-full wp-image-270" /></a><p class="wp-caption-text">Snowflake diagram with Harvey Balls applied for qualitative measurement.</p></div>
<h2>Notes</h2>
<p><strong>An application&#8217;s business purpose is highly likely to change over time</strong>. This is the primary reason for making <code>Continuous Improvement</code> the guiding principle behind producing web applications. The goal is to simply scale up the activity of iterative design and apply it to the application over its entire lifespan. In this way, a web application should exist for as long as there is a business need for it, and further it should appreciate in value over time rather than depreciate as most web applications do.</p>
<p><strong>This is a framework for measuring the value of a web application&#8217;s architecture and implementation</strong>. Much of it assumes an adoption of Eric Evans&#8217; <a href="http://www.amazon.com/gp/product/0321125215?ie=UTF8&amp;tag=jasostononapp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0321125215">Domain-Driven Design</a> for its business focus in software architecture, and Kent Beck&#8217;s <a href="http://www.amazon.com/gp/product/0321278658?ie=UTF8&amp;tag=jasostononapp-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0321278658">Extreme Programming</a> for the importance it places on iterative design and test-first development.</p>
<p><strong>The Snowflake diagram was inspired by Peter Morville&#8217;s <a href="http://semanticstudios.com/publications/semantics/000029.php">User Experience Honeycomb</a></strong>. The Snowflake measures an application&#8217;s value to the business, while the UX Honeycomb measures the applications value to the user. The best application&#8217;s are valuable in both regards. The user experience is tantamount however, and for measuring its value I continue to use Morville&#8217;s User Experience Honeycomb just as I have for the past five or more years. </p>
<p>In my experience, <strong>a web application&#8217;s value is primarily determined by its interface architecture, its software architecture, and the flexible and testable implementation of both</strong>. Poor interface architecture <em>or</em> poor software architecture will always result in a less valuable application. Inflexible implementation will result in an application that begins to depreciate in value the moment it is launched. Given that this framework is meant to measure the business value of a web application&#8217;s architecture and its implementation, I suspect that the same five facets can be applied to both the interface and the server-side software equally well, though that is guesswork on my part. In any case, measuring both will ensure that the application is capable of delivering a valuable user experience. </p>
<p><strong>Measuring value can assist in technology selection</strong>. It&#8217;s a simple matter of knowing your goals and making decisions that support those goals. Many of my blog posts concern an older version of Microsoft&#8217;s Entity Framework ORM solution. That particular version of the ORM did not in any way support a separation of concerns. However, the latest version of the Entity Framework does. Knowing this, it is easy for me to decide that I will not use the older ORM solution since it would prevent me from producing a 100% valuable application. The same rings true for ASP.Net Web Forms; they can be ruled out outright. Whereas the ASP MVC framework suits the bill perfectly, as would many frameworks available for php, Java, Python, Ruby, etc. upon which ASP MVC is based.</p>
<p><strong>Some facets may be deemed more important than others</strong>; for instance, if an application completely fails to meet its business purpose, then the degree to which it can be improved is meaningless excepting that at least the application <em>can</em> be improved. Most businesses would prefer that the application serve its business purpose first and foremost, and that its testability, for example, is of less concern to them. Of course, an application that cannot have its quality assured is unlikely to sustain its value in the long term, adapt to later changes in its business purpose, or even increase in value over time as more is learned about the business domain. In any case, your organization may choose to weight the grades of the responses per facet. I tend to think that all facets should have equal weight when measuring value, because the goal is to apply full Harvey Balls to all five facets with <code>Purposefulness</code> being the driving facet.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jasonstonebraker.wordpress.com/249/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jasonstonebraker.wordpress.com/249/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jasonstonebraker.wordpress.com/249/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jasonstonebraker.wordpress.com/249/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jasonstonebraker.wordpress.com/249/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jasonstonebraker.wordpress.com/249/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jasonstonebraker.wordpress.com/249/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jasonstonebraker.wordpress.com/249/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jasonstonebraker.wordpress.com/249/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jasonstonebraker.wordpress.com/249/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jasonstonebraker.wordpress.com/249/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jasonstonebraker.wordpress.com/249/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jasonstonebraker.wordpress.com/249/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jasonstonebraker.wordpress.com/249/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasonstonebraker.wordpress.com&amp;blog=9996014&amp;post=249&amp;subd=jasonstonebraker&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jasonstonebraker.wordpress.com/2011/02/13/5-facets-of-valuable-web-applications/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/16eb2a7f3dda1411fc39fc523005a14c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jason Stonebraker</media:title>
		</media:content>

		<media:content url="http://jasonstonebraker.files.wordpress.com/2011/02/5_facets_of_valuable_web_applications_jason_stonebraker_c7.png" medium="image">
			<media:title type="html">5_Facets_of_Valuable_Web_Applications_Jason_Stonebraker_c</media:title>
		</media:content>

		<media:content url="http://jasonstonebraker.files.wordpress.com/2011/02/harvey_balls.png" medium="image">
			<media:title type="html">Harvey_Balls</media:title>
		</media:content>

		<media:content url="http://jasonstonebraker.files.wordpress.com/2011/02/5_facets_of_valuable_web_applications_with_harvey_balls_jason_stonebraker.png" medium="image">
			<media:title type="html">5_Facets_of_Valuable_Web_Applications_With_Harvey_Balls_Jason_Stonebraker</media:title>
		</media:content>
	</item>
		<item>
		<title>Using the Entity Framework: Update Operation (Quick Reference)</title>
		<link>http://jasonstonebraker.wordpress.com/2009/11/02/using-the-entity-framework-update-operation-quick-reference/</link>
		<comments>http://jasonstonebraker.wordpress.com/2009/11/02/using-the-entity-framework-update-operation-quick-reference/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 00:30:36 +0000</pubDate>
		<dc:creator>Jason Stonebraker</dc:creator>
				<category><![CDATA[Entity Framework]]></category>
		<category><![CDATA[Quick References]]></category>

		<guid isPermaLink="false">http://jasonstonebraker.wordpress.com/?p=226</guid>
		<description><![CDATA[How to Use the Entity Framework to Update Records in a Relational Database This quick reference is for those who are using the Entity Framework and want examples of how to perform everyday CRUD tasks. We&#8217;ll take a look at how to update objects and associated objects using the Entity Framework. Quick Reference Setup Entity [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasonstonebraker.wordpress.com&amp;blog=9996014&amp;post=226&amp;subd=jasonstonebraker&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>How to Use the Entity Framework to Update Records in a Relational Database</h2>
<p>This quick reference is for those who are using the Entity Framework and want examples of how to perform everyday CRUD tasks. We&#8217;ll take a look at how to update objects and associated objects using the Entity Framework.</p>
<h3>Quick Reference Setup</h3>
<p><a href="http://jasonstonebraker.wordpress.com/2009/10/24/linq-to-entities-movies-example-setup/">Entity Framework &amp; Linq to Entities: “Movies” Example Setup</a> contains diagrams representing the database structure, entity data model, and entity object model used in the following code examples.</p>
<h3>Update a Director object using the Entity Framework</h3>
<pre style="background-color:#f5f5f5;border:1px solid #cccccc;overflow:auto;padding:10px;">private static MovieEntities _entities = new MovieEntities();

static void Main(string[] args)
{
     Director spikeJonze = _entities.DirectorSet.
               Where(d =&gt; d.Name == "Spike Jonze").First();

     spikeJonze.Name = "Adam Spiegel a.k.a \"Spike Jonze\"";
     _entities.SaveChanges();

     Console.ReadLine();
}</pre>
<p style="padding-top:0;">First, we retrieve a Director object by specifying a value for the Name property in a lambda expression. Next, we update the Director&#8217;s Name property. Finally, we call the ObjectContext&#8217;s SaveChanges method to commit the changes to the model and the database.</p>
<h3>Using the ObjectStateManager when Updating a Director object using the Entity Framework</h3>
<pre style="background-color:#f5f5f5;border:1px solid #cccccc;overflow:auto;padding:10px;">private static MovieEntities _entities = new MovieEntities();

static void Main(string[] args)
{
     Director spikeJonze = _entities.DirectorSet.
               Where(d =&gt; d.Name == "Spike Jonze").First();

     spikeJonze.Name = "Adam Spiegel a.k.a \"Spike Jonze\"";

     ObjectStateEntry entry = _entities.ObjectStateManager.
               GetObjectStateEntry(spikeJonze.EntityKey);
     IEnumerable&lt;string$gt; modProps = entry.
               GetModifiedProperties();

     foreach (string prop in modProps)
     {
          Console.WriteLine("Modified Property: {0}",
                    prop.ToString());

          Console.WriteLine("IsDbNull: {0}",
                    entry.OriginalValues.
                    IsDBNull(
                         entry.OriginalValues.GetOrdinal(prop)
                    )
          );

          Console.WriteLine("Changed from: {0}",
                    entry.OriginalValues[prop]);

          Console.WriteLine("Changed to: {0}",
                    entry.CurrentValues[prop]);
     }

     Console.WriteLine(&quot;Entity State: {0}&quot;, entry.State);

     Console.WriteLine("\n--&gt; All Original Values");
     for (int i = 0; i &lt; entry.OriginalValues.FieldCount; i++)
     {
          Console.WriteLine(&quot;{0}: {1}&quot;,
                    entry.OriginalValues.GetName(i),
                    entry.OriginalValues[i]);
     }

     _entities.SaveChanges();

     Console.ReadLine();
}</pre>
<p style="padding-top:0;">After modifying a property an object, we can use the ObjectStateManager to access state information such as, which properties were modified, those properties original values, their current values, and other helpful information.</p>
<p>To access this information we call the ObjectContext&#8217;s GetObjectStateEntry method passing in the Director&#8217;s EntityKey. This method returns the ObjectStateEntry for the specified Director object. To determine which properties have been modified, we call the ObjectStateEntries GetModifiedProperties method which returns a collection of the names of any properties whose current values are different from their original values.</p>
<p>To determine the original value of a property, we retrieve the value at a given index in the ObjectStateEntry&#8217;s OriginalValues collection. Since OriginalValues is an indexed collection we can specify either the number of the database column or the name of the column (or property) as such, <code>entry.OriginalValues["name"]</code>. We then use the CurrentValues collection to retrieve the current value of the modified property.</p>
<p>Lastly, for the purpose of illustration, we loop over the OriginalValues collection and output all of the Director object&#8217;s property names and their respective values.</p>
<p><strong>Here is the output:</strong></p>
<pre style="background-color:#f5f5f5;border:1px solid #cccccc;overflow:auto;padding:10px;">Modified Property: Name
IsDbNull: False
Changed from: Spike Jonze
Changed to: Adam Spiegel a.k.a "Spike Jonze"
Entity State: Modified

--&gt; All Original Values
ID: 33
Name: Spike Jonze
Hometown: Rockville Maryland
Birthday: 10/22/1969
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jasonstonebraker.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jasonstonebraker.wordpress.com/226/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jasonstonebraker.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jasonstonebraker.wordpress.com/226/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jasonstonebraker.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jasonstonebraker.wordpress.com/226/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jasonstonebraker.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jasonstonebraker.wordpress.com/226/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jasonstonebraker.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jasonstonebraker.wordpress.com/226/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jasonstonebraker.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jasonstonebraker.wordpress.com/226/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jasonstonebraker.wordpress.com/226/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jasonstonebraker.wordpress.com/226/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasonstonebraker.wordpress.com&amp;blog=9996014&amp;post=226&amp;subd=jasonstonebraker&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jasonstonebraker.wordpress.com/2009/11/02/using-the-entity-framework-update-operation-quick-reference/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/16eb2a7f3dda1411fc39fc523005a14c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jason Stonebraker</media:title>
		</media:content>
	</item>
		<item>
		<title>Using the Entity Framework: Delete Operation (Quick Reference)</title>
		<link>http://jasonstonebraker.wordpress.com/2009/11/01/using-the-entity-framework-delete-operation-quick-reference/</link>
		<comments>http://jasonstonebraker.wordpress.com/2009/11/01/using-the-entity-framework-delete-operation-quick-reference/#comments</comments>
		<pubDate>Sun, 01 Nov 2009 19:01:57 +0000</pubDate>
		<dc:creator>Jason Stonebraker</dc:creator>
				<category><![CDATA[Entity Framework]]></category>
		<category><![CDATA[Quick References]]></category>
		<category><![CDATA[Quick Reference]]></category>

		<guid isPermaLink="false">http://jasonstonebraker.wordpress.com/?p=191</guid>
		<description><![CDATA[<h3>How to Use the Entity Framework to Delete Records in a Relational Database</h3>
We'll take a look at how to delete objects and associated objects using the Entity Framework.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasonstonebraker.wordpress.com&amp;blog=9996014&amp;post=191&amp;subd=jasonstonebraker&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>How to Use the Entity Framework to Delete Records in a Relational Database</h2>
<p>This quick reference is for those who are trying out the Entity Framework and want examples of how to perform everyday CRUD tasks. We&#8217;ll take a look at how to delete objects and associated objects using the Entity Framework.</p>
<h3>Quick Reference Setup</h3>
<p><a href="http://jasonstonebraker.wordpress.com/2009/10/24/linq-to-entities-movies-example-setup/">Entity Framework &amp; Linq to Entities: “Movies” Example Setup</a> contains diagrams representing the database structure, entity data model, and entity object model used in the following code examples.</p>
<h3>Delete a Movie object using the Entity Framework</h3>
<pre style="background-color:#f5f5f5;border:1px solid #cccccc;overflow:auto;padding:10px;">private static MovieEntities _entities = new MovieEntities();

static void Main(string[] args)
{
     Movie movieToDelete =
          (from m in _entities.MovieSet
           where m.Title == "The Princess Bride"
	   select m).First();

     _entities.DeleteObject(movieToDelete);
     Console.WriteLine("--&gt; {0}: Marked as Deleted in Model",
          movieToDelete.Title);
     Console.WriteLine("Entity State: {0}",
          movieToDelete.EntityState); // Deleted

     _entities.SaveChanges();
     Console.WriteLine("\n--&gt; {0}:
          Deleted from Model and Datasource",
          movieToDelete.Title);
     Console.WriteLine("Entity State: {0}",
          movieToDelete.EntityState); // Detached
     Console.ReadLine();
}</pre>
<p style="padding-top:0;">First we retrieve the Movie we wish to delete. To do so we make use of the First extension method on the Linq query. The First method returns a single object rather than a collection. We then call the ObjectContext&#8217;s DeleteObject method passing it the Movie object we retrieved. At this point the ObjectStateManager has marked the object as having a &#8220;Deleted&#8221; state, though the Movie object has not been deleted from the model or the database. Calling the ObjectContext&#8217;s SaveChanges method detaches the Movie from the model and deletes the corresponding record from the database.</p>
<p><strong>Here is the output:</strong></p>
<pre style="background-color:#f5f5f5;border:1px solid #cccccc;overflow:auto;padding:10px;">--&gt; The Princess Bride: Marked as Deleted in Model
Entity State: Deleted

--&gt; The Princess Bride: Deleted from Model and Datasource
Entity State: Detached
</pre>
<h3>Delete a Director object and its associated Movie objects using the Entity Framework</h3>
<pre style="background-color:#f5f5f5;border:1px solid #cccccc;overflow:auto;padding:10px;">private static MovieEntities _entities = new MovieEntities();

static void Main(string[] args)
{
     Director spikeJonze = _entities.DirectorSet.
               Where(d =&gt; d.Name == "Spike Jonze").First();

     // Remember to Load associated objects
     spikeJonze.Movies.Load(); 

     Console.WriteLine("Number of Movies to Delete: {0}",
               spikesMovies.Count());

     // Using ToList is also important
     foreach (var movie in spikeJonze.Movies.ToList())
     {
          _entities.DeleteObject(movie);
          Console.WriteLine("--&gt; Movie {0}:
                    Marked for Deletion", movie.Title);
     }

     _entities.DeleteObject(spikeJonze);
     Console.WriteLine("--&gt; Director {0}:
               Marked for Deletion", spikeJonze.Name);

     _entities.SaveChanges();
     Console.WriteLine("--&gt; Director and
               associated Movies Deleted");

     Console.ReadLine();
}</pre>
<p style="padding-top:0;">We retrieve the Director by passing a lambda expression to the Where extension method and use the First method to specify that we only want the first Movie object in the resulting collection. We then call the Load method on the Director&#8217;s Movies collection. This populates any Movies associated with the Director with values retrieved from the database. Each populated Movie object is added to the Movies collection. Neglecting to Load the Movies collection would result in an exception being thrown during the call to SaveChanges. This is because the Movies collection would appear to the ObjectContext to be empty, therefore, none of the Movies would be deleted. However, when SaveChanges is called, it would be determined that the Director does indeed have associated Movies in the database, and could therefore, not be deleted. Using the technique described in this example requires that objects must be loaded in order to be deleted.</p>
<p>Now that we have the Movies associated with the Director, we can loop over the collection and delete each Movie. Notice that the ToList extension method is called on the Director&#8217;s Movies collection. Doing so ensures that we are working with a separate instance of the Movies collection. If we tried to perform a delete operation on items in the actual collection we were iterating through, we would receive an error.</p>
<p>Once the Director&#8217;s Movies have been marked for deletion, we mark the Director for deletion as well. The subsequent call to the ObjectContext&#8217;s SaveChanges method results in the Director and his associated Movies being detached from the ObjectContext and deleted from the database.</p>
<p><strong>Here is the output:</strong></p>
<pre style="background-color:#f5f5f5;border:1px solid #cccccc;overflow:auto;padding:10px;">--&gt; Number of Movies to Delete: 4

--&gt; Movie Adaptation: Marked for Deletion
--&gt; Movie Where the Wild Things Are: Marked for Deletion
--&gt; Movie Human Nature: Marked for Deletion
--&gt; Movie Being John Malkovich: Marked for Deletion

--&gt; Director Spike Jonze: Marked for Deletion

--&gt; Director and Associated Movies Deleted
</pre>
<h3>Delete a Movie object without loading it using the Entity Framework</h3>
<pre style="background-color:#f5f5f5;border:1px solid #cccccc;overflow:auto;padding:10px;">private static MovieEntities _entities = new MovieEntities();

static void Main(string[] args)
{
     int movieID = 105;
     int directorID = 2;

     Movie princessBride = new Movie();
     princessBride.ID = movieID;
     princessBride.DirectorReference.EntityKey =
               new EntityKey("MovieEntities.DirectorSet",
                         "ID", directorID);

     _entities.AttachTo("MovieEntities.MovieSet",
               princessBride);
     _entities.DeleteObject(princessBride);
     _entities.SaveChanges();

     Console.ReadLine();
}</pre>
<p style="padding-top:0;">Assuming we know the ID of a Movie object, we can delete it without having to load it into the ObjectContext. We do so by creating a new Movie object, setting its ID property to the known value, and creating the EntityKeys for any EntityReferences the object may have. We then pass the Movie object to the ObjectContext&#8217;s AttachTo method, delete the object, and save the changes.</p>
<p>Unfortunately, I&#8217;ve not yet discovered a way to delete objects based on a property value, such as Movie.DirectorID, without loading the objects into the ObjectContext or performing a Linq query, both of which would require a call to the database. If you are aware of a method for doing so, please leave a comment and let us all know.</p>
<h3>Exploring EntityStates when Deleting a Movie object using the Entity Framework</h3>
<pre style="background-color:#f5f5f5;border:1px solid #cccccc;overflow:auto;padding:10px;">private static MovieEntities _entities = new MovieEntities();

static void Main(string[] args)
{
     Movie movieToDelete =
          (from m in _entities.MovieSet
           where m.Title == "The Princess Bride"
	   select m).First();

     // Movie retrieved
     Console.WriteLine("--&gt; {0}: Movie Retrieved",
          movieToDelete.Title);
     Console.WriteLine("Entity State: {0}",
          movieToDelete.EntityState); // Deleted

     EntityKey movieToDeleteKey = _entities.
          CreateEntityKey("MovieEntities.MovieSet",
                                   movieToDelete);
     Console.WriteLine("Movie's EntityKey Value: {0}",
          movieToDeleteKey.EntityKeyValues[0].Value);
     Console.WriteLine("DirectorReference
          EntityKey is null: {0}",
          movieToDelete.DirectorReference.EntityKey == null);
     Object deletedMovie = null;
     bool movieToDeleteExists = _entities.
          TryGetObjectByKey(movieToDeleteKey,
               out deletedMovie);
     Console.WriteLine("Movie to Delete Exists
          in ObjectContext: {0}",
          movieToDeleteExists);

     // Movie marked for deletion
     _entities.DeleteObject(movieToDelete);
     Console.WriteLine("\n\n--&gt; {0}: Marked as Deleted in Model",
          movieToDelete.Title);
     Console.WriteLine("Entity State: {0}",
          movieToDelete.EntityState); // Deleted

     movieToDeleteKey = _entities.
          CreateEntityKey("MovieEntities.MovieSet",
               movieToDelete);
     Console.WriteLine("Movie's EntityKey Value: {0}",
          movieToDeleteKey.EntityKeyValues[0].Value);
     Console.WriteLine("DirectorReference
          EntityKey is null: {0}",
          movieToDelete.DirectorReference.EntityKey == null);
     deletedMovie = null;
     movieToDeleteExists = _entities.
          TryGetObjectByKey(movieToDeleteKey,
               out deletedMovie);
     Console.WriteLine("Movie to Delete Exists
          in ObjectConext: {0}",
          movieToDeleteExists);

     // Movie detached from model and deleted from database
     _entities.SaveChanges();
     Console.WriteLine("\n\n--&gt; {0}:
          Deleted from Model and Datasource",
          movieToDelete.Title);
     Console.WriteLine("Entity State: {0}",
          movieToDelete.EntityState); // Detached

     movieToDeleteKey = _entities.
          CreateEntityKey("MovieEntities.MovieSet",
               movieToDelete);
     Console.WriteLine("Movie's EntityKey Value: {0}",
          movieToDeleteKey.EntityKeyValues[0].Value);
     Console.WriteLine("DirectorReference
          EntityKey is null: {0}",
          movieToDelete.DirectorReference.EntityKey == null);
     deletedMovie = null;
     movieToDeleteExists = _entities.
          TryGetObjectByKey(movieToDeleteKey,
               out deletedMovie);
     Console.WriteLine("Movie to Delete Exists
          in ObjectContext: {0}",
          movieToDeleteExists);

     Console.ReadLine();
}</pre>
<p style="padding-top:0;">After marking the Movie for deletion, we are still able to make use of the object. In this case we grab the Movies EntityKey and make a call to the ObjectContext&#8217;s TryGetObjectByKey method. This method returns <code>true</code> if a Movie with the specified EntityKey exists in the model. It also creates a reference to the Movie and places it in the <code>out</code> parameter <code>deletedMovie</code>.</p>
<p>Calling the ObjectContext&#8217;s SaveChanges method detaches the Movie object from the model. The object retains its data values including its EntityKey, however, any relationships it might have had (such as the relationship used for the DirectorReference in this case) are lost. We are still able to retrieve the EntityKey from the detached object, however, the subsequent call to TryGetObjectByKey returns <code>false</code> because the Movie is no longer part of the ObjectContext.</p>
<p><strong>Here is the output:</strong></p>
<pre style="background-color:#f5f5f5;border:1px solid #cccccc;overflow:auto;padding:10px;">--&gt; The Princess Bride: Movie Retrieved
Entity State: Unchanged
Movie's EntityKey Value: 97
DirectorReference EntityKey is null: False
Movie to Delete Exists in ObjectContext: True

--&gt; The Princess Bride: Marked as Deleted in Model
Entity State: Deleted
Movie's EntityKey Value: 97
DirectorReference EntityKey is null: True
Movie to Delete Exists in ObjectContext: True

--&gt; The Princess Bride: Deleted from Model and Datasource
Entity State: Detached
Movie's EntityKey Value: 97
DirectorReference EntityKey is null: True
Movie to Delete Exists in ObjectContext: False
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jasonstonebraker.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jasonstonebraker.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jasonstonebraker.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jasonstonebraker.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jasonstonebraker.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jasonstonebraker.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jasonstonebraker.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jasonstonebraker.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jasonstonebraker.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jasonstonebraker.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jasonstonebraker.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jasonstonebraker.wordpress.com/191/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jasonstonebraker.wordpress.com/191/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jasonstonebraker.wordpress.com/191/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasonstonebraker.wordpress.com&amp;blog=9996014&amp;post=191&amp;subd=jasonstonebraker&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jasonstonebraker.wordpress.com/2009/11/01/using-the-entity-framework-delete-operation-quick-reference/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/16eb2a7f3dda1411fc39fc523005a14c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jason Stonebraker</media:title>
		</media:content>
	</item>
		<item>
		<title>Using the Entity Framework: Create Operation (Quick Reference)</title>
		<link>http://jasonstonebraker.wordpress.com/2009/10/31/using-the-entity-framework-create-operation-quick-reference/</link>
		<comments>http://jasonstonebraker.wordpress.com/2009/10/31/using-the-entity-framework-create-operation-quick-reference/#comments</comments>
		<pubDate>Sat, 31 Oct 2009 02:32:23 +0000</pubDate>
		<dc:creator>Jason Stonebraker</dc:creator>
				<category><![CDATA[Entity Framework]]></category>
		<category><![CDATA[Quick References]]></category>
		<category><![CDATA[Quick Reference]]></category>

		<guid isPermaLink="false">http://jasonstonebraker.wordpress.com/?p=170</guid>
		<description><![CDATA[<h3>How to Use the Entity Framework to Create Records in a Relational Database</h3> 
This quick reference is for those who are trying out the Entity Framework and want examples of how to perform everyday CRUD tasks.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasonstonebraker.wordpress.com&amp;blog=9996014&amp;post=170&amp;subd=jasonstonebraker&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2>How to Use the Entity Framework to Create Records in a Relational Database</h2>
<p>This quick reference is for those who are trying out the Entity Framework and want examples of how to perform everyday CRUD tasks. We&#8217;ll take a look at how to create objects and manage relationships working with the Entity Framework&#8217;s occasionally unclear object model. </p>
<h3>Quick Reference Setup</h3>
<p><a href="http://jasonstonebraker.wordpress.com/2009/10/24/linq-to-entities-movies-example-setup/">Entity Framework &amp; Linq to Entities: “Movies” Example Setup</a> contains diagrams representing the database structure, entity data model, and entity object model used in the following code examples.</p>
<h3>Create a Director object using the Entity Framework</h3>
<pre style="background-color:#f5f5f5;border:1px solid #cccccc;overflow:auto;padding:10px;">private static MovieEntities _entities = new MovieEntities();

static void Main(string[] args)
{
     Director spikeJonze = Director.CreateDirector(
          0,
          "Spike Jonze",
          "Rockville Maryland",
          "10/22/1969"
     );

     // Use the AddToDirectorSet method
     _entities.AddToDirectorSet(spikeJonze);

     // Could have also used the AddObject method
     // _entities.AddObject("MovieEntities.DirectorSet",
     //     spikeJonze);

     Console.WriteLine("--&gt; Director added to DirectorSet");
     Console.WriteLine("EntityKey is temporary: {0}",
          spikeJonze.EntityKey.IsTemporary);

     _entities.SaveChanges();

     Console.WriteLine("--&gt; Changes Saved");
     Console.WriteLine("EntityKey is temporary: {0}",
          spikeJonze.EntityKey.IsTemporary);
     Console.WriteLine("EntityKey Key: {0},
          EntityKey Value: {1}",
          spikeJonze.EntityKey.EntityKeyValues[0].Key,
          spikeJonze.EntityKey.EntityKeyValues[0].Value);

     Console.ReadLine();
}</pre>
<p style="padding-top:0;">We use the CreateDirector to initialize a new Director object. Notice that 0 is specified for the ID parameter. Though this argument is required, the value you provide is of no consequence. Once the Director is added to the DirectorSet, a temporary EntityKey is created. The call to SaveChanges adds the Director object&#8217;s data values to the database and the primary key resulting from the database insert is retrieved. From that point on the EntityKey&#8217;s value will be synchronized with the identity column for the Director record in the database.</p>
<p>There are multiple ways to add an entity object to the ObjectContext. Two of which are illustrated in this example. Which method you choose is a matter of preference.</p>
<p><strong>Here is the output:</strong></p>
<pre style="background-color:#f5f5f5;border:1px solid #cccccc;overflow:auto;padding:10px;">
--&gt; Director added to DirectorSet
EntityKey is temporary: True
--&gt; Changes Saved
EntityKey is temporary: False
EntityKey Key: ID, EntityKey Value: 27
</pre>
<h3>Create a Director object and an associated Movie object using the Entity Framework</h3>
<pre style="background-color:#f5f5f5;border:1px solid #cccccc;overflow:auto;padding:10px;">private static MovieEntities _entities = new MovieEntities();

static void Main(string[] args)
{
     Director spikeJonze = new Director {
          Name = "Adam Spiegel a.k.a., Spike Jonze",
          Hometown = "Rockville Maryland",
          Birthday = "10/22/1969"
     };
     _entities.AddToDirectorSet(spikeJonze);

     Movie wildThings = new Movie {
          Title = "Where the Wild Things Are",
          DateReleased = DateTime.Parse("10/1/2009")
     };
     spikeJonze.Movies.Add(wildThings);

     _entities.SaveChanges();
     Console.ReadLine();
}</pre>
<p style="padding-top:0;">We use object initialization syntax to create a Director object and then add it to the ObjectContext&#8217;s DirectorSet collection. We then create a Movie object and add it to the Director&#8217;s Movies collection. Doing so creates a relationship (with corresponding temporary EntityKeys) between the Director and the Movie. Calling the SaveChanges method updates the database to reflect the changes we&#8217;ve made to the entity data model.</p>
<p style="padding-top:5px;">There are multiple ways to initialize object in CSharp. When working with the Entity Framework, I prefer to use object initialization syntax (used in this example) in lieu of using the CreateDirector factory method. Though there is a benefit to using the factory method in that you are forced to provide initial values for all properties. What you use is a matter of preference.</p>
<h3>Create a Movie object and associate it with an existing Director object using the Entity Framework</h3>
<pre style="background-color:#f5f5f5;border:1px solid #cccccc;overflow:auto;padding:10px;">private static MovieEntities _entities = new MovieEntities();

static void Main(string[] args)
{
     Director robReiner = _entities.DirectorSet.Where(
               d =&gt; d.Name == "Rob Reiner").First();

     Movie thePrincessBride = new Movie {
          Title = "The Princess Bride",
          DateReleased = DateTime.Parse("1/1/1987")
     };

     robReiner.Movies.Add(thePrincessBride);
     _entities.SaveChanges();
     Console.ReadLine();
}</pre>
<p style="padding-top:0;">First we load the appropriate Director object. Next we create the Movie object and add it to the Director&#8217;s Movies collection. Doing so creates the necessary relationship. Finally, we call the ObjectContext&#8217;s SaveChanges() method which inspects the context&#8217;s ObjectStateManager and commits any changes that had been made to the model&#8217;s entities or associations since it was created or since SaveChanges() was last called.</p>
<h3>Create a Movie object and associate it with an existing Director object without loading the Director object using the Entity Framework</h3>
<pre style="background-color:#f5f5f5;border:1px solid #cccccc;overflow:auto;padding:10px;">private static MovieEntities _entities = new MovieEntities();

static void Main(string[] args)
{
     int robReinerID = 2;
     Movie thePrincessBride = new Movie {
          Title = "The Princess Bride (New)",
          DateReleased = DateTime.Parse("1/1/1987")
     };

     thePrincessBride.DirectorReference.EntityKey = new
          EntityKey("MovieEntities.DirectorSet",
                    "ID", robReinerID);
     _entities.AddToMovieSet(thePrincessBride);
     _entities.SaveChanges();
     Console.ReadLine();
}</pre>
<p style="padding-top:0;">Since we know the Director&#8217;s ID, there is no need to load the Director object in order to create the Movie. It is necessary, however, to set the EntityKey property of the DirectorReference (an EntityReference type). Note that the first argument passed to the EntityKey&#8217;s constructor is an EntitySet within the ObjectContext; e.g., MovieEntities.DirectorSet.</p>
<h3>Exploring the Entity Framework&#8217;s ObjectStateManager</h3>
<pre style="background-color:#f5f5f5;border:1px solid #cccccc;overflow:auto;padding:10px;">private static MovieEntities _entities = new MovieEntities();

static void Main(string[] args)
{
     Director robReiner = _entities.DirectorSet.Where(
               d =&gt; d.Name == "Rob Reiner").First();

     Movie thePrincessBride = new Movie {
          Title = "The Princess Bride",
          DateReleased = DateTime.Parse("1/1/1987")
     };

     robReiner.Movies.Add(thePrincessBride);
     IEnumerable&lt;ObjectStateEntry&gt; entries =
          _entities.ObjectStateManager.
          GetObjectStateEntries(EntityState.Added);

     foreach (ObjectStateEntry entry in entries)
     {
          Console.WriteLine("Entity Set: {0}", entry.EntitySet);
	  Console.WriteLine("IsRelationship: {0}",
               entry.IsRelationship);
	  Console.WriteLine("State: {0}", entry.State);

	  if (!entry.IsRelationship)
	  {
	     Console.WriteLine("EntityKey is null: {0}",
                  entry.EntityKey.EntityKeyValues == null);
             Console.WriteLine("EntityKey is temporary: {0}",
                  entry.EntityKey.IsTemporary);
	  }

          entry.AcceptChanges();
          Console.WriteLine("--&gt; Changes Accepted");

	  if (!entry.IsRelationship)
	  {
	        Console.WriteLine("EntityKey is: {0}",
                     entry.EntityKey.EntityKeyValues.First());
		Console.WriteLine("EntityKey is temporary: {0}",
                     entry.EntityKey.IsTemporary);
	  }

          Console.WriteLine("State: {0}\n\n", entry.State);
     }

     // The following call to SaveChanges() does nothing
     // because calling AcceptChanges() on each entry updated
     // their respective states from "Added" to "Unchanged".
     _entities.SaveChanges(); 

     Console.ReadLine();
}</pre>
<p style="padding-top:0;">First we add a Movie to a Director&#8217;s collection of Movies. Doing so adds two ObjectStateEntries to the ObjectStateManager. ObjectStateEntries are used to track changes made to the entity model. One of the entries is for the Movie entity that was added and the second is for the relationship that was created between the Movie and the Director. We then grab the ObjectStateEntries where the EntityState equals &#8220;Added&#8221;. Looping over the ObjectStateEntries allows us to see various properties of the entries before and after AcceptChanges is called. When AcceptChanges is called on a given entry, its state is set to &#8220;Unchanged&#8221;. Therefore, the subsequent call to SaveChanges does nothing since the state of all ObjectStateEntries is &#8220;Unchanged&#8221; at the time SaveChanges is called. Retrieving a list of Movies would reveal that the Movie was <em>not</em> inserted into the database.</p>
<p><strong>Here is the output:</strong></p>
<pre style="background-color:#f5f5f5;border:1px solid #cccccc;overflow:auto;padding:10px;">
Entity Set: FK_Movies_Directors
IsRelationship: True
State: Added
--&gt; Changes Accepted
State: Unchanged

Entity Set: MovieSet
IsRelationship: False
State: Added
EntityKey is null: True
EntityKey is temporary: True
--&gt; Changes Accepted
EntityKey is: [ID, 0]
EntityKey is temporary: False
State: Unchanged
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/jasonstonebraker.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/jasonstonebraker.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/jasonstonebraker.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/jasonstonebraker.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/jasonstonebraker.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/jasonstonebraker.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/jasonstonebraker.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/jasonstonebraker.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/jasonstonebraker.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/jasonstonebraker.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/jasonstonebraker.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/jasonstonebraker.wordpress.com/170/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/jasonstonebraker.wordpress.com/170/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/jasonstonebraker.wordpress.com/170/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=jasonstonebraker.wordpress.com&amp;blog=9996014&amp;post=170&amp;subd=jasonstonebraker&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://jasonstonebraker.wordpress.com/2009/10/31/using-the-entity-framework-create-operation-quick-reference/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/16eb2a7f3dda1411fc39fc523005a14c?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Jason Stonebraker</media:title>
		</media:content>
	</item>
	</channel>
</rss>
