<?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>Taimila.com</title>
	<atom:link href="http://www.taimila.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.taimila.com</link>
	<description>Thoughts on software development and more</description>
	<lastBuildDate>Fri, 23 Jul 2010 16:43:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>MonoDevelop add-in repository for Entify</title>
		<link>http://www.taimila.com/?p=1084</link>
		<comments>http://www.taimila.com/?p=1084#comments</comments>
		<pubDate>Fri, 23 Jul 2010 16:43:07 +0000</pubDate>
		<dc:creator>Lauri Taimila</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.taimila.com/?p=1084</guid>
		<description><![CDATA[Now it&#8217;s easier than ever]]></description>
			<content:encoded><![CDATA[<p>Now it&#8217;s easier than ever to install Entify visual designer to MonoDevelop. I have created MonoDevelop add-in repository for the visual designer add-in. This allows developers to install <a href="http://www.taimila.com/entify">Entify</a> add-in right from the MonoDevelop Add-in manager.</p>
<div id="attachment_1085" class="wp-caption aligncenter" style="width: 446px"><img class="size-full wp-image-1085 " title="MonoDevelop add-in manager" src="http://www.taimila.com/wp-content/uploads/2010/07/add-in-manager.png" alt="" width="436" height="400" /><p class="wp-caption-text">MonoDevelop add-in manager</p></div>
<p>Installing add-in is easy. Open <em>Add-in manager </em>from the <em>Tools</em> menu of the MonoDevelop. Click <em>Repositories&#8230;</em> and then <em>Add</em>. Insert the repository URL and click <em>Ok</em> to save.</p>
<div id="attachment_1086" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.taimila.com/wp-content/uploads/2010/07/add-repository.png" rel="lightbox[1084]"><img class="size-medium wp-image-1086" title="Entify repository to MonoDevelop" src="http://www.taimila.com/wp-content/uploads/2010/07/add-repository-500x257.png" alt="" width="500" height="257" /></a><p class="wp-caption-text">Add Entify repository to MonoDevelop</p></div>
<p>After adding the repostiory you can install the add-in from the Add-in manager.</p>
<div id="attachment_1087" class="wp-caption aligncenter" style="width: 479px"><img class="size-full wp-image-1087 " title="Entify addin" src="http://www.taimila.com/wp-content/uploads/2010/07/add-in-install.png" alt="" width="469" height="194" /><p class="wp-caption-text">Entify add-in installation</p></div>
<p>Check the Entify Visual Designer and follow the instructions. After installing the add-in you should be able to add Entity set to any C# project. See my <a href="http://www.taimila.com/?p=360">previous post</a> for instructions. Just skip the step 2 which is the manual installation instructions for the add-in.</p>
<p>Entify visual designer add-in repository URL is <a href="http://www.taimila.com/entify/repository/"><em>http://www.taimila.com/entify/repository/</em></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.taimila.com/?feed=rss2&amp;p=1084</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Entify 0.6 Beta released</title>
		<link>http://www.taimila.com/?p=1071</link>
		<comments>http://www.taimila.com/?p=1071#comments</comments>
		<pubDate>Fri, 23 Jul 2010 10:37:41 +0000</pubDate>
		<dc:creator>Lauri Taimila</dc:creator>
				<category><![CDATA[Entify]]></category>
		<category><![CDATA[Software development]]></category>

		<guid isPermaLink="false">http://www.taimila.com/?p=1071</guid>
		<description><![CDATA[Now that I&#8217;m back from]]></description>
			<content:encoded><![CDATA[<p>Now that I&#8217;m back from Japan, it&#8217;s time to release the next version of the <a href="http://www.taimila.com/entify"><strong>Entify</strong></a> framework. The new version 0.6 beta is a bugfix release and doesn&#8217;t contain new features except that now MonoDevelop add-in works with the latest MonoDevelop 2.4.</p>
<div id="attachment_1079" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.taimila.com/wp-content/uploads/2010/07/new-file-entify.png" rel="lightbox[1071]"><img class="size-medium wp-image-1079" title="Entify in MonoDevelop 2.4" src="http://www.taimila.com/wp-content/uploads/2010/07/new-file-entify-500x326.png" alt="" width="500" height="326" /></a><p class="wp-caption-text">Entify works now with MonoDevelop 2.4</p></div>
<p><strong>What&#8217;s new in 0.6 release</strong></p>
<ul>
<li>Visual designer updated to support MonoDevelop 2.4</li>
<li>Bugfix to issue 4: Entify did some unneeded lazy loading for entities (performance issue)</li>
<li>Bugfix to issue 5: <em>GetEntityId()</em> method was not visible for client application</li>
<li>Bugfix to issue 6: To-Many relation lead to crash when no related entities were set for an entity</li>
<li>Bugfix to issue 7: Entify didn&#8217;t show up in MonoDevelop for MonoTouch projects</li>
<li>Bugfix to issue 9: Invalid relation name could lead to malfunctioning generated code</li>
</ul>
<p>In the next version of Entify, I&#8217;ll concentrate fixing visual designer stability issues under OSX. This is crusial for MonoTouch developers. So, don&#8217;t expect any new features in the next release either. Version 0.8 will contain new features when we get there!</p>
<p>I recommend everyone to update to the latest version. There shouldn&#8217;t be any compatibility issues between versions 0.5 and 0.6 except with MonoDevelop. MonoDevelop API has changed and therefore the new visual desinger add-in won&#8217;t work with older versions of MonoDevelop. This is not a big problem, since you should use the latest version of MonoDevelop anyway.</p>
<p style="text-align: center;"><strong><em>Get Entify 0.6 beta from <a href="http://www.taimila.com/entify/download.php">Entify website</a></em></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.taimila.com/?feed=rss2&amp;p=1071</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing Entify defects</title>
		<link>http://www.taimila.com/?p=951</link>
		<comments>http://www.taimila.com/?p=951#comments</comments>
		<pubDate>Sat, 05 Jun 2010 18:43:30 +0000</pubDate>
		<dc:creator>Lauri Taimila</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.taimila.com/?p=951</guid>
		<description><![CDATA[I fixed two defects from]]></description>
			<content:encoded><![CDATA[<p>I fixed two defects from Entify today.</p>
<ol>
<li><a onclick="cancelBubble=true" href="http://code.google.com/p/entify/issues/detail?id=9&amp;can=1">Relation name must start with uppercase letter or generated code doesn&#8217;t compile</a></li>
<li><a onclick="cancelBubble=true" href="http://code.google.com/p/entify/issues/detail?id=4&amp;can=1">EntityContext does unnecessary lazy loads when handling entities</a></li>
</ol>
<p>The first one was fixed simply by disallowing invalid relation names. Now Entify visual designer gives warning if invalid name is tried to be use as relation name. Before the fix, it didn&#8217;t say anything and the generated code didn&#8217;t compile. The second one was fixed by removing lazy load calls when they were not needed.</p>
<p>Below is a rerun results of the simple performance tests I introduced in <a href="http://www.taimila.com/?p=428">earlier blog post</a>. There are minor improvments after these fixes, but nothing spectacular.</p>
<table width="100%">
<tbody>
<tr>
<td><strong>Operation</strong></td>
<td><strong>Time spent by Entify</strong></td>
</tr>
<tr>
<td>Added 100 artists, 1000 albums, 15,000 tracks.</td>
<td>12.693 sec</td>
</tr>
<tr>
<td>Requested tracks with genre filter. Returned 7500 tracks</td>
<td>2.937 sec</td>
</tr>
<tr>
<td>Requested tracks with two filters. Returned 4154 tracks</td>
<td>1.632 sec</td>
</tr>
<tr>
<td>Requested artist by name.</td>
<td>0.007 sec</td>
</tr>
<tr>
<td>Requested album by name.</td>
<td>0.010 sec</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.taimila.com/?feed=rss2&amp;p=951</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Taimila.com updates</title>
		<link>http://www.taimila.com/?p=730</link>
		<comments>http://www.taimila.com/?p=730#comments</comments>
		<pubDate>Sun, 23 May 2010 18:52:22 +0000</pubDate>
		<dc:creator>Lauri Taimila</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.taimila.com/?p=730</guid>
		<description><![CDATA[I gave up the idea]]></description>
			<content:encoded><![CDATA[<p>I gave up the idea of having my own WordPress theme since I couldn&#8217;t get the RSS-feed to work with it. Now I&#8217;m looking for a nice theme to use, so don&#8217;t be surprised if my site&#8217;s look and feel varies from time to time. If you know any usable, clean and good looking WordPress themes, let me know!</p>
<p>I added my travelling blogs back to online. Those are all written in Finnish, but you can use google translator if Finnish doesn&#8217;t happen to be one of the language you understand. I also added projects page, which introduces my latest software projects including Entify.</p>
<p>In the process of updating my site, I accidentally removed all images from old posts. :( I try to find them from somewhere and fix the posts if possible.</p>
<p>Oh, and now the RSS actually works!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.taimila.com/?feed=rss2&amp;p=730</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Entify &#8211; Performance test</title>
		<link>http://www.taimila.com/?p=428</link>
		<comments>http://www.taimila.com/?p=428#comments</comments>
		<pubDate>Sat, 24 Apr 2010 10:34:12 +0000</pubDate>
		<dc:creator>Lauri Taimila</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.taimila.com/?p=428</guid>
		<description><![CDATA[I wanted to test Entify&#8216;s]]></description>
			<content:encoded><![CDATA[<p>I wanted to test <em><a href="http://www.taimila.com/entify">Entify</a>&#8216;s</em> performance, so I wrote a simple test application and timed entity context operations of the Entify framework. During this process, I found two defects from the project and fixed them on the way. Fixes are committed to Entify trunk.<br />
<br />
<div id="attachment_935" class="wp-caption aligncenter" style="width: 470px"><img src="http://www.taimila.com/wp-content/uploads/2010/04/model.png" alt="" title="Test model" width="460" height="241" class="size-full wp-image-935" /><p class="wp-caption-text">Test model</p></div></p>
<p>Above is a entity model I used in testing. My testing was by no means complete or scientific, but I wanted to get an overall picture of the performance. I created a model that could be used in music player application. In real applications there would be more properties in each entity type, but this was enough for my testing purposes.<br />
<br />
I started by adding 100 <em>artists</em> to the context. Each artist had 10 <em>albums</em> which contained 15 <em>tracks</em> each. So all in all, I added <em>100 artists</em>, <em>1000 albums</em> and <em>15,000 tracks</em> to the entity context. The way I did it is not the fastest, but probably the most intuitive way of doing it. I started by inserting 100 artists with one <em>Add()</em> call. After that I looped over albums and tracks and inserted them seprately. All in all, adding all this stuff to context took 1101 <em>Add() </em> calls. With little performance tweaking we could achieve the same with 3 <em>Add()</em> calls. One for each entity type. This would make it probably a lot faster. Anyhow, I wanted to see the performance of quick and dirty solution. (And I really didn&#8217;t have time to optimize the test code) :) Here are the results.</p>
<p><br/></p>
<table width ="100%">
<tr>
<td><b>Operation</b></td>
<td><b>Time spent by Entify</b></td>
</tr>
<tr>
<td>Added 100 artists, 1000 albums, 15,000 tracks.</td>
<td>13.087 sec</td>
</tr>
<tr>
<td>Requested tracks with genre filter. Returned 7500 tracks</td>
<td>3.153 sec</td>
</tr>
<tr>
<td>Requested tracks with two filters. Returned 4227 tracks</td>
<td>1.776 sec</td>
</tr>
<tr>
<td>Requested artist by name.</td>
<td>0.007 sec</td>
</tr>
<tr>
<td>Requested album by name.</td>
<td>0.010 sec</td>
</tr>
</table>
<p><br/><br />
Since <a href="http://www.taimila.com/?p=219"><u>Entify uses lazy approach</u></a>, the time of add operations actually includes also the time that was spent on creating the file for data and creating the entity model (tables and indexes) into the database.<br />
<br />
I got these results by executing the Mono console app on my 2 years old iMac.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.taimila.com/?feed=rss2&amp;p=428</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started with Entify</title>
		<link>http://www.taimila.com/?p=360</link>
		<comments>http://www.taimila.com/?p=360#comments</comments>
		<pubDate>Sun, 18 Apr 2010 18:46:39 +0000</pubDate>
		<dc:creator>Lauri Taimila</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.taimila.com/?p=360</guid>
		<description><![CDATA[In this blog post I]]></description>
			<content:encoded><![CDATA[<p>In this blog post I will explain, how to use Entify visual designer to define domain model for your application. And how Entify framework is used to operate with that model. This post won&#8217;t cover all the features Entify has, but gives an idea of the basic features and is therefore, a good starting point for those developers who want to utilize Entify in their own projects.<br />
<br />
I will give you step-by-step guide so it&#8217;s as easy to follow as possible.</p>
<h3>Step 1: Download</h3>
<ul>
The very first thing you need to do, is download and install <a href="http://monodevelop.com/Download"><b>MonoDevelop</b></a> if you don&#8217;t already have it on your computer. You also need to <a href="http://code.google.com/p/entify/downloads/list"><b>download Entify framework library and Entify visual designer add-in</b></a> for MonoDevelop.
</ul>
<h3>Step 2: Install MonoDevelop add-in</h3>
<ul>
Installing Entify visual designer add-in is as simple as copying a downloaded DLL file to the correct folder. Below is instructions for each operation system.<br />
<br />
<b>Linux</b><br />
Create a new folder called <em>MonoDevelop.EntifyEditor</em> under <em>~/.config/MonoDevelop/addin</em>s (create it if it doesn&#8217;t exists already) and copy the DLL file into folder you just created. After that restart MonoDevelop and you should be able to see Entify visual designer in MonoDevelop add-in manager.<br />
<br />
<b>OSX</b><br />
Second click on MonoDevelop application icon and select Show Package Contents. Navigate to <em>Contents -> MacOS -> lib -> monodevelop -> AddIns</em>. Create a new folder there called <em>MonoDevelop.EntifyEditor</em> and copy downloaded DLL into that new folder. Restart MonoDevelop and open Add-in manager. You should be able to see Entify visual designer there.<br />
<br />
<b>Windows</b><br />
Navigate to folder <em>C:\Program Files\MonoDevelop\AddIns</em> (assuming you installed MonoDevelop to it&#8217;s default location). Create a new folder <em>MonoDevelop.EntifyEditor</em> there and copy the downloaded file to that directory. Restart MonoDevelop and open Add-in manager. You should be able to see Entify visual designer there.
</ul>
<h3>Step 3: Create a new project</h3>
<ul>
Open MonoDevelop and create a new C# Console project and give it a name <em>EntifySample</em>. The very first thing you need to do, is to add reference to the Entify library. So, right-click on <em>References</em> folder, select <em>Edit references</em> and navigate to the folder where you have <em>Taimila.Entify.dll</em> file. Add that file to your references. After that your solution should look like this.<br />
<br />
<div id="attachment_939" class="wp-caption aligncenter" style="width: 306px"><img src="http://www.taimila.com/wp-content/uploads/2010/04/solution.png" alt="" title="Sample project solution" width="296" height="165" class="size-full wp-image-939" /><p class="wp-caption-text">Sample project solution</p></div>
</ul>
<h3>Step 4: Add new entity set to the project</h3>
<ul>
Next we will add <em>Entity set </em>item to our project. This is the file that defines all the entities that our application needs. You can add Entity set by right-clicking on the project and selecting <em>Add -> New File</em>. Select Entity set from Misc. category and give it name <em>&#8220;Entities&#8221;</em>.<br />
<br />
<div id="attachment_940" class="wp-caption aligncenter" style="width: 510px"><img src="http://www.taimila.com/wp-content/uploads/2010/04/filedialog-500x332.png" alt="" title="Adding entity set" width="500" height="332" class="size-medium wp-image-940" /><p class="wp-caption-text">Adding entity set</p></div><br />
After this step you should have <em>Entities.xes</em> file in your project.
</ul>
<h3>Step 5: Define your entities</h3>
<ul>
This is the part where you need to stop and think. What are the entities you need? In this example, I will create a simple address book so I&#8217;ll need just two entities <strong>Contact</strong> and <strong>ContactGroup</strong>. Later contains 0&#8230;n contacts. I&#8217;ll create these entities by using Entify visual designer. You should be able to figure out how to use it after playing around with it for a while. The basic idea is that first you create an entity and then you add properties to that entity. In this example, I&#8217;ll also add one <em>To-many</em> relation from ContactGroup to Contact.<br />
<br />
<div id="attachment_941" class="wp-caption aligncenter" style="width: 440px"><img src="http://www.taimila.com/wp-content/uploads/2010/04/samplemodel.png" alt="" title="Sample entities" width="430" height="156" class="size-full wp-image-941" /><p class="wp-caption-text">Sample entities</p></div><br />
I added four properties for Contact and only one for ContactGroup. Contact has two string properties which are <em>Firstname</em> and <em>Lastname</em>. It also has one UInt32 property called <em>Age</em> and DateTime property called <em>Birthdate</em>. ContactGroup has only one property called <em>Name</em> that is type of string. It also has one To-many relation which target type is Contact. The diagram above, doesn&#8217;t display the name of the relation, but it&#8217;s used in code later on. The name of the relation is <em>Contacts</em>.<br />
<br />
When you are ready with defining entities, <strong>you must save the file</strong>. This is important, because Entify generates C# classes from the model when saving the file. If you don&#8217;t save the model, you won&#8217;t be able to use your entities from the code.
</ul>
<h3>Step 6: Define settings for Entify framework</h3>
<ul>
Now that we have entity model defined, we are ready to use it in our code. The first thing to do is to add using statement for entify library. Let&#8217;s add it like this.
</ul>
<pre name="code" class="c-sharp:nocontrols">
using Taimila.Entify;
</pre>
<ul>
Next, we need to create settings for Entify. Settings should be created only once, when the application starts. Later on you can access entity context with the name defined in these settings.
</ul>
<pre name="code" class="c-sharp:nocontrols">
EntityContextSettings settings = new EntityContextSettings()
{
  ContextName = "MyContext",
  EnforceValidationRules = false;
  PersistentStoreLocation = "/home/late/entities.entify"
};
</pre>
<ul>
Now that we have settings, let&#8217;s ask new <em>entity context</em> from Entify. Entity context is a singleton (not really, but you can think it as such) object that you will use for saving, updating, removing and querying entities. You can get entity context from <em>EntityContextFactory</em> as illustrated below.
</ul>
<pre name="code" class="c-sharp:nocontrols">
EntityContext c = EntityContextFactory.GetContext(settings);
</pre>
<ul>
The first time you request entity context, you must give settings as a parameter. Later on, you can access the same entity context simply with it&#8217;s name. <em>EntityContextFactory</em> will always give you a reference to the same context object.
</ul>
<pre name="code" class="c-sharp:nocontrols">
EntityContext c = EntityContextFactory.GetContext("MyContext");
</pre>
<h3>Step 7: Create and add entities to entity context</h3>
<ul>
Remember those entities we defined in Step 5? Let&#8217;s create few instances and add them to the context. Creating a new entity is as easy as creating a new instance of a class. I will create one ContactGroup and two Contacts and add them to the entity context. Adding entities to the context saves them to the persistent store on disk.
</ul>
<pre name="code" class="c-sharp:nocontrols">
Contact contact1 = new Contact()
{
  Firstname = "Lauri",
  Lastname = "Taimila",
  Age = 28,
  Birthdate = DateTime.Now
};

Contact contact2 = new Contact()
{
  Firstname = "John",
  Lastname = "Smith",
  Birthdate = DateTime.Now
};

ContactGroup group = new ContactGroup()
{
  Name = "Friends"
};
</pre>
<ul>
And now, let&#8217;s add them to the entity context.
</ul>
<pre name="code" class="c-sharp">
context.Add(contact1, contact2);
context.Add(group);
</pre>
<ul>
I recommend that when ever you create an new entity you add it to the context as soon as possible. If you need to create multiple entities at once, it&#8217;s more efficient to add them to the context with one <em>Add</em> call instead of calling <em>Add</em> for each entity separately. Notice that you can give an array of entity objects to the <em>Add</em> method of entity context.<br />
<br />
Now let&#8217;s add one of the contacts to the group we created.
</ul>
<pre name="code" class="c-sharp:nocontrols">
group.Contacts.Add(contact1);
context.Update(group);
</pre>
<ul>
The first call updates entity model in-memory and the second one saves the defined relation to the persistent store. It&#8217;s important to notice that <em>contact1</em> was added to the context before it was added to the group. Only entities in context can be linked to another entities.
</ul>
<h3>Step 8: Request entities from context</h3>
<ul>
Now that we have created entities and added them to context, we probably want to access them later on in our application. In the next code snippet I will request all contacts from context that have firstname &#8220;Lauri&#8221;. I will also request all groups without any limitations.
</ul>
<pre name="code" class="c-sharp:nocontrols">
var context = EntityContextFactory.GetContext("MyContext");

// Request to get contacts from context
EntityRequest&lt;Contact> request = new EntityRequest&lt;Contact>();
request.DataFilter = new ValueFilter("Firstname",
			                         "Lauri",
			                         FilterRule.Equal);

// contacts will contain one object
Contact[] contacts = context.GetEntities(request);
Contact c1 = contacts[0];

ContactGroup[] groups = context.GetAll&lt;ContactGroup>();
ContactGroup friends = groups[0];

Contact c2 = friends.Contacts[0];

// c1 and c2 actually represents the same entity
bool same = c1.IsSame(c2);

// Prints "true"
Console.WriteLine(same);
</pre>
<ul>
As you can see there are two ways to request entities from entity context. You can use <em>GetAll() </em>method to get all the entities of specified type or you can create <em>EntityRequest</em> to get only the entities that match the request. You can create very simple entity requests as one above or you can assemble more complex ones with multiple filters and conditions. You could for example request first 10 contacts in alphabetical order that are older than 25 and last name starts with &#8220;Ta&#8221;.<br />
<br />
I won&#8217;t go into the details of entity requests here. Instead, I will write another blog post later dedicated to that subject.
</ul>
<h3>Final words</h3>
<p>I hope that this short tutorial helped you to understand how Entify can be used in your project. If you are interested to learn more about Entify, you should read other posts in my blog and leave comments if you can&#8217;t figure out something on your own.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.taimila.com/?feed=rss2&amp;p=360</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Entify beta released!</title>
		<link>http://www.taimila.com/?p=335</link>
		<comments>http://www.taimila.com/?p=335#comments</comments>
		<pubDate>Sun, 11 Apr 2010 16:49:27 +0000</pubDate>
		<dc:creator>Lauri Taimila</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.taimila.com/?p=335</guid>
		<description><![CDATA[I have released the first]]></description>
			<content:encoded><![CDATA[<div id="attachment_930" class="wp-caption alignright" style="width: 110px"><a href="http://www.opensource.org/licenses/mit-license.php"><img src="http://www.taimila.com/wp-content/uploads/2010/04/OSI-Approved-License-100x137.png" alt="" title="Entify License" width="100" height="137" class="size-full wp-image-930" /></a><p class="wp-caption-text">Entify License</p></div>
<p>I have released the first version of <a href="http://www.taimila.com/entify/"><strong>Entify</strong></a> framework with the visual designer add-in for <a href="http://monodevelop.com/"><strong>MonoDevelop</strong></a>. I decided to follow the licensing of Mono project and released the whole project under <a href="http://www.opensource.org/licenses/mit-license.php"><strong>MIT license</strong></a>. It&#8217;s an open source license which allows you to do pretty much anything you want with the code. To sum it up, <em>Entify is free, open and yours to enjoy!</em></p>
<p>Entify project <a href="http://code.google.com/p/entify/downloads/list"><strong>downloads</strong></a> are hosted on GoogleCode service. You can find precompiled binaries from there as well as SVN repository of the source code. I won&#8217;t be releasing source code packages separately, since the latest source code is always available in version control.</p>
<p>To get the latest version of Entify source code, use the following SVN command:</p>
<ul>
<blockquote><p>svn checkout http://entify.googlecode.com/svn/trunk/ entify</p></blockquote>
</ul>
<p>I hope that developers will download Entify and play around with it. There are still <a href="http://code.google.com/p/entify/issues/list"><strong>some rough edges</strong></a> since this is the first release, but my over all feeling is that the project is quite stable already.</p>
<h3>Related links</h3>
<ul>
<li><a href="http://www.taimila.com/entify/"><strong>Entify website</strong></a></li>
<li><a href="http://www.taimila.com/entify/forums/"><strong>Entify forums</strong></a></li>
<li><a href="http://code.google.com/p/entify/"><strong>Entify on GoogleCode</strong></a></li>
</ul>
<p>Stay tuned for <em>&#8220;Getting started with Entify&#8221;</em> tutorial.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.taimila.com/?feed=rss2&amp;p=335</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Entify website goes live!</title>
		<link>http://www.taimila.com/?p=261</link>
		<comments>http://www.taimila.com/?p=261#comments</comments>
		<pubDate>Thu, 01 Apr 2010 18:08:09 +0000</pubDate>
		<dc:creator>Lauri Taimila</dc:creator>
				<category><![CDATA[Entify]]></category>

		<guid isPermaLink="false">http://www.taimila.com/?p=261</guid>
		<description><![CDATA[Have you heard of Entify]]></description>
			<content:encoded><![CDATA[<p>Have you heard of <em>Entify</em> project? You sure have, if you have read any of my previous blog posts. Recently I have been working on various things to make the first release come true. Now I&#8217;m ready to release <a href="http://www.taimila.com/entify/index.php">Entify website</a> and <a href="http://www.taimila.com/entify/forums/">Entify forums</a>.  :pray: </p>
<div id="attachment_927" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.taimila.com/entify"><img src="http://www.taimila.com/wp-content/uploads/2010/04/Screen-shot-2010-05-30-at-11.31.29-500x366.png" alt="" title="Entify website" width="500" height="366" class="size-medium wp-image-927" /></a><p class="wp-caption-text">Entify website</p></div>
<p>I have also created a Google code page for the project. Google code will be used as a issue tracker of the project. It also provides download repository for the releases as well as SVN repository of the project.<br />
<br />
Entify will be released in the near future. Stay tuned. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.taimila.com/?feed=rss2&amp;p=261</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Entify is lazy by nature</title>
		<link>http://www.taimila.com/?p=219</link>
		<comments>http://www.taimila.com/?p=219#comments</comments>
		<pubDate>Tue, 30 Mar 2010 18:53:16 +0000</pubDate>
		<dc:creator>Lauri Taimila</dc:creator>
				<category><![CDATA[Entify]]></category>
		<category><![CDATA[Software development]]></category>

		<guid isPermaLink="false">http://www.taimila.com/?p=219</guid>
		<description><![CDATA[They say that laziness is]]></description>
			<content:encoded><![CDATA[<p>They say that laziness is a virtue, not a deadly sin. When it comes to entity frameworks and programming in general, this is very true in many cases. <em>Entify</em> takes <em>the lazy approach</em> to solve the problem of storing entities into persistent store. When talking about software development, being lazy is not considered as a bad thing, unlike in our everyday life. Being lazy simply <a href="http://en.wikipedia.org/wiki/Lazy_loading" target="_self">means</a> that, you do what you need to do as late as possible. Don&#8217;t do anything before hand just in case, because usually its unnecessary work.</p>
<h3>How lazy Entify really is?</h3>
<p>As it turns out, very lazy! When the application that uses Entify is executed for the very first time, the database simply doesn&#8217;t exist yet. Database isn&#8217;t created until the <em>entity context </em>is created in the application for the first time. This action only creates an empty database file to the disk. There are no tables for entities at this point.<br />
<br />
When the first entity is added to the context, Entify asks it&#8217;s internal <em>type coordinator</em> to prepare database for type of the received entity object. Type coordinator checks is the type already known and if not, it generates the tables needed to store the object into persistent store. Therefore, Entify database never contains tables just sitting and waiting for entities to show up. Instead, tables are created only when they are really needed. In fact, Entify doesn&#8217;t even know what types application may give it to it.<br />
<br />
So, the database is generated on the fly as needed, but how about fetching entities from the entity context? Entities are fetched from the entity context by creating <em>Entity requests</em>, which are object oriented queries. Programmer can also get all the entities of given type by calling <em>GetAll&lt;EntityType>();</em> method of the <em>EntityContext</em> instance. This returns a list of entity objects. But what if entities have other entities as relations? Then all the related entities are lazy loaded and cached when needed. Below is a short code snippet with comments to show how it works.</p>
<pre name="code" class="c-sharp:nocontrols">
ShoppingCart cart = new ShoppingCart();

context.Add(cart); // Generates tables for cart type

Product p1 = new Product() { Name = "Movie" };
Product p2 = new Product() { Name = "Candy" };

context.Add(p1, p2);

cart.Products.Add(p1); // ShoppingCart has to-many
cart.Products.Add(p2); // relation to Product type.

context.Update(cart);
</pre>
<p>Now somewhere in the application we need to handle those objects, so let&#8217;s load them into memory from entity context.</p>
<pre name="code" class="c-sharp:nocontrols">
ShoppingCart[] carts = context.GetAll&lt;ShoppingCart>();
ShoppingCart ourCart = carts[0]; // Our cart is the first one

// This activates lazy load to database, because products
// are not in memory yet. From the application's point of view
// lazy loading is completely transparent.
List&lt;Products> products = ourCart.Products; 

// Products were loaded and cached in previous statement.
// No lazy load here.
List&lt;Products> sameProducts = ourCart.Products;
</pre>
<p>That&#8217;s all I got to say about laziness this time. Take care, and don&#8217;t be as lazy as Entify!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.taimila.com/?feed=rss2&amp;p=219</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Entify &#8211; context snapshots</title>
		<link>http://www.taimila.com/?p=204</link>
		<comments>http://www.taimila.com/?p=204#comments</comments>
		<pubDate>Mon, 29 Mar 2010 16:34:11 +0000</pubDate>
		<dc:creator>Lauri Taimila</dc:creator>
				<category><![CDATA[Entify]]></category>
		<category><![CDATA[Software development]]></category>

		<guid isPermaLink="false">http://www.taimila.com/?p=204</guid>
		<description><![CDATA[Yes, another blog post about]]></description>
			<content:encoded><![CDATA[<p>Yes, another blog post about my yet unreleased pet project <em>Entify</em>. In this post I will introduce the snapshot feature of the Entify framework.</p>
<h3>What is a snapshot?</h3>
<p>Snapshot is a state of the entity context in some point of time. You can think it as a backup copy of the entity context. Snapshot is something that can be taken at any point of application execution. Application can also revert back to any of the taken snapshots when ever it needs to. To sum up, snapshots are a way to preserve entity context state and revert to that state later on.</p>
<h3>How to use snapshots with Entify?</h3>
<p>Entify has a concept <em>entity context</em>. Entity context is a place where all the entities live. It&#8217;s a persistent store of the entities and it supports snapshots.</p>
<p>Taking a snapshot from entity context is as easy as calling one mehtod as shown here.</p>
<pre name="code" class="c-sharp:nocontrols">long snapshotId = context.TakeSnapshot();</pre>
<p>Taking a snapshot locks entity context to prevent modification meanwhile snapshot is taken. The time it takes to make a snapshot depends on how many entities entity context contains. The time required is pretty much the time it takes to copy the data of the whole state. Taking a snapshot returns <em>snapshot identifier</em>. This is an unique identifier within the application and can be used later on when reverting to the taken snapshot.</p>
<p>Revering to any snapshot is as simple as creating one.</p>
<pre name="code" class="c-sharp">context.RevertToSnapshot(snapshotId);</pre>
<p>Snapshots are files in the filesystems. This allows application to revert back to taken snapshots even if application is quitted between taking a snapshot and reverting back to it. This also means that taking snapshots creates new files to the filesystem. It&#8217;s a good practice to keep track of the snapshots and remove them when they are not needed anymore. Entify allows you to remove taken snapshots like this.</p>
<pre name="code" class="c-sharp">context.RemoveSnapshot(snapshotId);</pre>
<p>That&#8217;s it! Snapshot feature consists of three powerful methods. Simple and usable API is one of the most important features of the <em>Entify</em> and this is a nice demonstration of how things can be easy-to-use and still provide enough funtionality.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.taimila.com/?feed=rss2&amp;p=204</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Entity validation in Entify</title>
		<link>http://www.taimila.com/?p=169</link>
		<comments>http://www.taimila.com/?p=169#comments</comments>
		<pubDate>Sun, 28 Mar 2010 11:54:25 +0000</pubDate>
		<dc:creator>Lauri Taimila</dc:creator>
				<category><![CDATA[Entify]]></category>
		<category><![CDATA[Software development]]></category>

		<guid isPermaLink="false">http://www.taimila.com/?p=169</guid>
		<description><![CDATA[My upcoming entity framework supports]]></description>
			<content:encoded><![CDATA[<p>My upcoming entity framework supports <em>entity validation</em>. In this blog post I will discuss how the validation rules are set and how they can be extended. I will also show how validation is performed and finally, how validation results can be processed by application that utilizes Entify framework.</p>
<h3>Setting validation rules</h3>
<p>Validation rules define allowed values for each entity property. Let&#8217;s say we have <em>Customer</em> entity that has <em>Firstname</em><em> </em>and<em> Lastname</em> properties. Both of these properties are type of string. We can set most common validation rules with visual designer as shown below.<br />
<br />
<div id="attachment_943" class="wp-caption aligncenter" style="width: 314px"><img src="http://www.taimila.com/wp-content/uploads/2010/03/Screen-shot-2010-06-05-at-13.26.35.png" alt="" title="Validation rules for firstname property" width="304" height="414" class="size-full wp-image-943" /><p class="wp-caption-text">Validation rules for firstname property</p></div></p>
<p>These settings state that customer&#8217;s <em>firstname</em> should never be null or empty string (since minimum length is one). As long as the string length is in the specified range it can contain any characters wanted. In most cases it&#8217;s enough to set these kind of rules, but sometimes there is need for more complex validation rules.<br />
<br />
Entify allows developer to extend validation rules with custom validation methods. These methods are written to partial entity classes and marked with <em>EntityValidator</em> attribute as illustrated below. Each validation method must return <em>ValidationError</em> which is null if value was valid, otherwise it contains information what was wrong with the value(s).<br />
<br />
Example method below checks that value has been set to at least one of the name properties. Notice that with custom validators you can create validation rules that depend on more than one property.<br />
</p>
<pre name="code" class="c-sharp:nocontrols">
public partial class Customer : Entity
{
	// Custom validation method for Customer
	[EntityValidator]
	private ValidationError ValidateCustomerNames()
	{
		if(string.IsNullOrEmpty(this.Firstname) &amp;&amp;
		   string.IsNullOrEmpty(this.Lastname))
		{
			return new ValidationError(
					ValidationErrorReason.CustomError,
		            null,
			        "At least one of the names must be set.");
		}

		return null; // No error
	}
}</pre>
<h3>Validating entities</h3>
<p>Entify supports automatic entity validation. Automatic validation can be enabled with <em>EntityContextSettings</em>. When automatic validation is enabled, Entify validates each entity object that is added to entity context or updated in context. If any of the given entities contain validation errors, then <em>EntityContext</em> throws <em>ValidationException</em> that contains validation results. Below is an example code to illustrate this.<br />
</p>
<pre name="code" class="c-sharp:nocontrols">
Customer c = new Customer();

try
{
	context.Add(c);
}
catch(ValidationException e)
{
	ValidationResults r = e.ValidationResults;
}
</pre>
<p>If validation would be disabled,<em> Add()</em> wouldn&#8217;t throw exception and entity object would be added successfully even in case it contains invalid values.<br />
<br />
It&#8217;s also possible to validate entity objects manually from code. Here is a code snippet to show how it&#8217;s done.<br />
</p>
<pre name="code" class="c-sharp:nocontrols">
Customer c = new Customer();
Customer c2 = new Customer();
Product p = new Product();

ValidationResults results = EntityValidator.Validate(c, c2);
ValidationResults results2 = EntityValidator.Validate(p);
</pre>
<p>As you can see, <em>EntityValidator</em> takes objects of any type and validates them. Compile time error is given, if parameter type is not entity type.</p>
<h3>Handling validation results</h3>
<p>Now we know how to define validation rules and how to validate entities. Next I will discuss, how to process validation results so that application can properly notify user of invalid values. Multiple entities can be validated with a single method call. Therefore, validation results can contain results of multiple entities. This need lead to hierarchal validation results in Entify.<br />
<br />
There are three classes in the hierarchy:</p>
<ul>
<li><strong>ValidationResults</strong> &#8211; contains results of all validated entities</li>
<li><strong>ValidationResult</strong> &#8211; contains all validation errors of one entity</li>
<li><strong>ValidationError</strong> &#8211; represents one specific validation error</li>
</ul>
<p><br/><br />
Below is a code snippet that prints all validation errors to console.</p>
<pre name="code" class="c-sharp:nocontrols">
Customer[] c = GetCustomers(); // Method returns 100 customers
ValidationResults r = EntityValidator.Validate(c);

// Check was validation successful
if(!r.IsValid)
{
	// Iterate results one entity at time
	foreach(var result in r)
	{
		// Iterate all errors in one entity
		foreach(var error in result)
		{
			Console.WriteLine(error.Message);
		}
	}
}
</pre>
<h3>Comments are welcome</h3>
<p>That covers validation in Entify quite well. Please, leave a comment no matter if you like it or dislike it. Can you think of any ways to improve it?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.taimila.com/?feed=rss2&amp;p=169</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Introducing Entify</title>
		<link>http://www.taimila.com/?p=30</link>
		<comments>http://www.taimila.com/?p=30#comments</comments>
		<pubDate>Sat, 27 Mar 2010 10:31:39 +0000</pubDate>
		<dc:creator>Lauri Taimila</dc:creator>
				<category><![CDATA[Entify]]></category>
		<category><![CDATA[Software development]]></category>

		<guid isPermaLink="false">http://www.taimila.com/?p=30</guid>
		<description><![CDATA[Entify is something that I&#8217;m]]></description>
			<content:encoded><![CDATA[<p><em>Entify</em> is something that I&#8217;m very excited about! As far as I know, it&#8217;s the first <em>entity framework</em> for Mono that comes with a first class visual designer tool. It&#8217;s incredibly easy to use and it provides many features you would expect from entity framework. Entify is my pet project and it&#8217;s getting ready for the first release.</p>
<h3>What is it?</h3>
<p>Main focus of the Entify project is to deliver <em>simple and easy-to-use entity framework for Mono and .NET applications</em>. It&#8217;s important to understand that Entify is not designed for enterprise applications. Instead the focus is strictly <em>desktop and mobile applications</em>. This in mind, Entify doesn&#8217;t support all the advanced features enterprise applications might require, but it&#8217;s a perfect solution for most of the non-enterprise applications. Entify is built on top of the SQLite database, so if SQLite would be suitable solution for your project so is Entify.</p>
<p>Entify is compiled into one dll-file and it doesn&#8217;t have any external dependencies. Therefore, it&#8217;s very easy to deploy it with any application. It doesn&#8217;t require any configuration files, data mapping definitions (ORM), confusing XML-files or other boring stuff you hate to do anyway. All you need to do is define entities with the visual designer, add reference to Entify library and start using it!</p>
<p>Below is a code snippet to illustrate, what it&#8217;s like to work with the Entify framework.</p>
<pre name="code" class="c-sharp:nocontrols">EntityContextSettings s = new EntityContextSettings()
{
	PersistentStoreLocation = "/path/example.entifydb",
	EnforceValidationRules = false
};

// Get entity context with given settings
EntityContext context = EntityContextFactory.GetContext(s);

// Create entity objects
Customer c1 = new Customer();
c1.Name = "Bill Gates";
c1.Age = 36;

Customer c2 = new Customer();
c2.Name = "Steve Jobs";

// Add entities to entity context (saves them to database)
context.Add(c1, c2);

c1.Age = 39;

// Updates changed information to context
context.Update(c1);

// Get all customers from context
Customer[] customers = context.GetAll&lt;Customer&gt;();

// Removes given customers from context
context.Remove(customers);</pre>
<h3>Visual designer integrated to MonoDevelop</h3>
<p>Entify framework is all great, but what makes it even better is the visual designer tool integrated right into the MonoDevelop IDE. With this tool you can add <em>entity set </em>item to your existing project and define entities without writing a single line of code. It doesn&#8217;t only make developing applications faster, but it also works as a visual documentation of the application&#8217;s entity model. From the model you can instantly see what are the entities and how they are related to each other. Reading the same information from the code could take hours.</p>
<div id="attachment_925" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.taimila.com/wp-content/uploads/2010/03/VisualDesigner.png" rel="lightbox[30]"><img class="size-medium wp-image-925" title="Visual designer for Entify" src="http://www.taimila.com/wp-content/uploads/2010/03/VisualDesigner-500x352.png" alt="" width="500" height="352" /></a><p class="wp-caption-text">Visual designer for Entify</p></div>
<p>Entify also supports entity validation. Validation can be done manually or automatically. Developer can define property specific validation rules with the visual designer tool. Available validation rules depend on the type of the property. Tool provides only the most common validation rules for each type, but developer can extend validation rules with his own validation methods. Entify framework automatically calls those custom validation methods when it&#8217;s validating entities.</p>
<p>Below is a example screenshot that shows validation rules for <em>string</em> property.</p>
<div id="attachment_947" class="wp-caption aligncenter" style="width: 510px"><a href="http://www.taimila.com/wp-content/uploads/2010/03/sample2.png" rel="lightbox[30]"><img class="size-medium wp-image-947" title="Visual designer makes it easy to define validation rules for entity properties" src="http://www.taimila.com/wp-content/uploads/2010/03/sample2-500x361.png" alt="" width="500" height="361" /></a><p class="wp-caption-text">Visual designer makes it easy to define validation rules for entity properties</p></div>
<h3>So, when it&#8217;s released?</h3>
<p>I won&#8217;t be giving any specific dates, since after all this is just a hobby of mine and I don&#8217;t want to stress about it. What I know is that the Entify framework itself is done and quite well tested with over 160 unit tests. I will write more tests and do some exploratory testing before release. Also the visual designer add-in for MonoDevelop is pretty much done. There are still some GTK-issues I have to take care of before the release, but nothing major.</p>
<p>So, all the hard work is done and I&#8217;m now concentrating to make it polished and stable product. Any suggestions which license I should use when releasing the project?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.taimila.com/?feed=rss2&amp;p=30</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>New website and new blog</title>
		<link>http://www.taimila.com/?p=27</link>
		<comments>http://www.taimila.com/?p=27#comments</comments>
		<pubDate>Wed, 24 Mar 2010 15:52:03 +0000</pubDate>
		<dc:creator>Lauri Taimila</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.taimila.com/?p=27</guid>
		<description><![CDATA[As you may have noticed,]]></description>
			<content:encoded><![CDATA[<p>As you may have noticed, there ain&#8217;t much to see at the Taimila.com right now. A while ago I decided to update my website and the content hasn&#8217;t been migrated to the new system &#8230;yet. But the blog is up-and-running and I&#8217;ll be posting more interesting things in the near future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.taimila.com/?feed=rss2&amp;p=27</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>
