<?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>David M. Richter&#039;s Blog</title>
	<atom:link href="http://www.richter-web.info/Wordpress/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.richter-web.info/Wordpress</link>
	<description>enriches the world</description>
	<lastBuildDate>Mon, 30 Nov 2009 10:44:38 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>.NET AppConfig Replacement with Linq To XML</title>
		<link>http://www.richter-web.info/Wordpress/?p=168</link>
		<comments>http://www.richter-web.info/Wordpress/?p=168#comments</comments>
		<pubDate>Sat, 28 Nov 2009 19:14:21 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Software-Development]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[LINQ TO XML]]></category>

		<guid isPermaLink="false">http://www.richter-web.info/Wordpress/?p=168</guid>
		<description><![CDATA[Just lately I had to implement a configuration for some Service. Where to get the data from, when to start the processing, how to behave in certain cases and so on. Then someone gave me the hint, that with Linq to XML it would be quite easy and flexible to build some configuration.
Configuration means to [...]]]></description>
			<content:encoded><![CDATA[<p>Just lately I had to implement a configuration for some Service. Where to get the data from, when to start the processing, how to behave in certain cases and so on. Then someone gave me the hint, that with Linq to XML it would be quite easy and flexible to build some configuration.</p>
<p>Configuration means to me:<br />
Having some static class which I can access from all over the application.<br />
<span style="color: #ffcc00;">public class IBFactsheetsConfiguration<br />
{<br />
public static string FolderWithFactsheets { get; set; }<br />
&#8230;.<br />
}<br />
</span><br />
Now with an Appconfig I would have to write the Mapping from the xml/ConfigSections by hand(AFAIK). This can be quite tedious.<br />
Considering Linq To XMl I would be best to have some class which would do the mapping itself once for ever. So that the configClass from above would just derive from that basic Mapping class and thats all.<br />
Now as I use only the public static properties of my configuration class, it requires just a reflectional method which gets all those properties. Then as I have them, I only have to persist the data into xml. Vice versa I have to be able to read the config into the class from the xml.<br />
To keep it short, here is the basic Mapping Class:<br />
<span style="color: #ffcc00;">public class Configuration&lt;T&gt;<br />
{<br />
//load the xml file, uses reflectional method PropertyInfo.SetValue<br />
public static void Initialize(string ConfigFileWithPath)<br />
{<br />
XDocument xmlDoc = new XDocument();<br />
xmlDoc = XDocument.Load(ConfigFileWithPath + typeof(T).Name + &#8220;.xml&#8221;);<br />
foreach (PropertyInfo info in GetPropertyInfos())<br />
{<br />
info.SetValue(null, (from p in xmlDoc.Descendants(info.Name) select p.Value).First(), null);<br />
}<br />
}</span></p>
<p><span style="color: #ffcc00;">// provides all the static public properties of the class<br />
private static PropertyInfo[] GetPropertyInfos()<br />
{</span></p>
<p><span style="color: #ffcc00;">PropertyInfo[] propertyInfos;<br />
propertyInfos = typeof(T).GetProperties(BindingFlags.Public |<br />
BindingFlags.Static);<br />
// sort properties by name</span><br />
<span style="color: #ffcc00;">return propertyInfos.OrderBy(a =&gt; a.Name).ToArray();</span></p>
<p><span style="color: #ffcc00;">}</span></p>
<p><span style="color: #ffcc00;">//saves the properties to xml using LinQ to XML<br />
public static void SaveConfigTo(string Path)<br />
{</span></p>
<p><span style="color: #ffcc00;">var custsDoc = new XDocument(<br />
new XDeclaration(&#8221;1.0&#8243;, &#8220;utf-8&#8243;, &#8220;yes&#8221;),<br />
new XComment(typeof(T).FullName),<br />
new XElement(typeof(T).Name,<br />
from row in GetPropertyInfos()<br />
select new XElement(row.Name, row.GetValue(null, null))));<br />
//save the Xdoc to the Xml File<br />
custsDoc.Save(Path + typeof(T).Name + &#8220;.xml&#8221;);<br />
}<br />
}</span></p>
<p>Here comes the Configuration class:<br />
<span style="color: #ffcc00;">public class IBFactsheetsConfiguration : Configuration&lt;IBFactsheetsConfiguration&gt;<br />
{<br />
public static string FolderWithFactsheets { get; set; }<br />
&#8230;&#8230;&#8230;&#8230;.<br />
}</span><br />
this time its derived from <span style="color: #ffcc00;">Configuration&lt;IBFactsheetsConfiguration&gt;</span></p>
<h2><strong>UsageScenario:</strong></h2>
<p>First I have to initialize the static class once before any usage.</p>
<p><span style="color: #ffcc00;">public void InitializeConfigOnce()<br />
{<br />
IBFactsheetsConfiguration.Initialize(@&#8221;D:\SomePath\&#8221;);<br />
}</span><br />
this Initializes the class from an xmlfile called: &#8220;IBFactsheetsConfiguration.xml&#8221; in d:\SomePath</p>
<p>Now I can access the Configuration from anywhere with</p>
<p><span style="color: #ffcc00;">public void someMethodOrOther()<br />
{<br />
string someConfig = IBFactsheetsConfiguration.FolderWithFactsheets;<br />
}</span></p>
<p>Now thats it all. One could provide support for hierarchal Config Classes. Now thats left for the future.<br />
Any comments are welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richter-web.info/Wordpress/?feed=rss2&amp;p=168</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NHibernate with Assigned Table Column Identifier</title>
		<link>http://www.richter-web.info/Wordpress/?p=147</link>
		<comments>http://www.richter-web.info/Wordpress/?p=147#comments</comments>
		<pubDate>Thu, 22 Oct 2009 09:27:54 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[NHibernate]]></category>
		<category><![CDATA[Software-Development]]></category>
		<category><![CDATA[Fluent]]></category>

		<guid isPermaLink="false">http://www.richter-web.info/Wordpress/?p=147</guid>
		<description><![CDATA[Hi all,
in my last Blog http://www.richter-web.info/Wordpress/?p=132 I explained why I have to use external method created row Ids. So some outside method calculates the Id of the new table row. I assign then the value to the entity.
To convey this to Nhibernate( Fluent NHibernate) one has to do the following:
public class Appendix
{
public virtual int id [...]]]></description>
			<content:encoded><![CDATA[<p>Hi all,</p>
<p>in my last Blog <a href="http://www.richter-web.info/Wordpress/?p=132" target="_blank">http://www.richter-web.info/Wordpress/?p=132</a> I explained why I have to use external method created row Ids. So some outside method calculates the Id of the new table row. I assign then the value to the entity.</p>
<p>To convey this to Nhibernate( Fluent NHibernate) one has to do the following:</p>
<p style="padding-left: 30px;"><span style="color: #ffcc00;">public class Appendix<br />
{<br />
public virtual int id { get; set; }<br />
public virtual AppendixHierarchy AppendixHierachy { get; set; }<br />
public virtual byte[] appendix { get; set; }<br />
}</span></p>
<p style="padding-left: 30px;"><span style="color: #ffcc00;">public class AppendixMap : ClassMap&lt;Appendix&gt;<br />
{<br />
public AppendixMap ()<br />
{<br />
Id(x =&gt; x.id).GeneratedBy.Assigned();<br />
References(x =&gt; x.AppendixHierachy).ColumnName(&#8221;appendixHierarchyId&#8221;);<br />
Map(x =&gt; x.appendix);<br />
}<br />
}</span></p>
<p>Now Nhibernate does know that the Ids will be set by &#8220;hand&#8221;.</p>
<p>But this approach has disadvantages:</p>
<p>Nhibernate does not know anymore if some object is transient or not, since after the Id is set by my code it has an value. For Nhibernate this value means that this object is already in the db. This means one cannot use SaveOrUpdate() anymore. If I do nevertheless nothing happens. So I have to take care of the Save and Update calls and have to distinguish between both.</p>
<p>Also I discovered that the newly created entities are not saved after calling Save:</p>
<p><span style="color: #ffcc00;">using (ISession sess = DBSessionManager.GetDBSessionController(Database).GetDBSession())<br />
{<br />
sess.Save(item);<br />
}</span></p>
<p>Even the closing of the session does not write the changes. This issue was only solved by call <span style="color: #ffcc00;">sess.Flush();</span></p>
<p>There is the question also represented: <a href="http://stackoverflow.com/questions/1566678/nhibernate-fluent-domain-object-with-idx-x-id-generatedby-assigned-not-savea" target="_blank">http://stackoverflow.com/questions/1566678/nhibernate-fluent-domain-object-with-idx-x-id-generatedby-assigned-not-savea</a></p>
<p>another possibility would be to wrap the whole thing into an transaction.</p>
<p>Conclusion: My guess is that the change tracking  in the case of the usage of self assigned Id will not work properly. It works because Flush does the right thing. Nevertheless closing the session should have the same impact If it looks into the change tracking records. In the next time I will try to use a more recent NH version&#8230; result I will post here&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richter-web.info/Wordpress/?feed=rss2&amp;p=147</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NHibernate Stored Procedures with Out Parameters</title>
		<link>http://www.richter-web.info/Wordpress/?p=132</link>
		<comments>http://www.richter-web.info/Wordpress/?p=132#comments</comments>
		<pubDate>Mon, 19 Oct 2009 09:12:50 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[NHibernate]]></category>
		<category><![CDATA[Software-Development]]></category>

		<guid isPermaLink="false">http://www.richter-web.info/Wordpress/?p=132</guid>
		<description><![CDATA[hi there,
Lately I wanted to set up a businesslogic layer with Nhibernate on our legacy database. In that database all the Identifiers of the colums are calculated by some stored procedure which has an Out Parameter. Parsing through some articles in some forum or other I found that this is currently not supported by Nhibernate.
The [...]]]></description>
			<content:encoded><![CDATA[<p>hi there,</p>
<p>Lately I wanted to set up a businesslogic layer with Nhibernate on our legacy database. In that database all the Identifiers of the colums are calculated by some stored procedure which has an Out Parameter. Parsing through some articles in some forum or other I found that this is currently not supported by Nhibernate.</p>
<p>The SQL Stored Procdure would look like:</p>
<p><span style="color: #ffcc00;">Create procedure [dbo].[ups_GetNewId]<br />
(</span></p>
<p><span style="color: #ffcc00;">@dbid int=100,<br />
@tableName varchar(512),<br />
@incBy int = 0,<br />
@id int out</span></p>
<p><span style="color: #ffcc00;">) as<br />
//// omitted for brevity</span></p>
<p>Since I can&#8217;t change the legacy database, I had to fall back to pure SQL use. But this was not an issue since I can easily get an ordinary connection out of the Nhibernate session. Having found that it became quite stright forward as one is used to as ADO programmer.</p>
<p style="padding-left: 30px;"><span style="color: #ffcc00;">public int CalcNewId(string tableName)<br />
{</span></p>
<p style="padding-left: 60px;"><span style="color: #ffcc00;">using (ISession session = DBSessionManager.GetDBSessionController(Database).GetDBSession())<br />
{<br />
IDbCommand command = new SqlCommand();<br />
command.Connection = session.Connection;<br />
command.CommandType = CommandType.StoredProcedure;<br />
command.CommandText = &#8220;dbo.ups_GetNewId&#8221;; //this stored Procedure calculates the ID<br />
// Set input parameters<br />
var parm = new SqlParameter(&#8221;@tableName&#8221;, SqlDbType.VarChar);<br />
parm.Value = tableName;<br />
command.Parameters.Add(parm);<br />
// Set output parameter<br />
var outputParameter = new SqlParameter(&#8221;@id&#8221;, SqlDbType.Int);<br />
outputParameter.Direction = ParameterDirection.Output;<br />
command.Parameters.Add(outputParameter);<br />
// Set a return value<br />
var returnParameter = new SqlParameter(&#8221;@RETURN_VALUE&#8221;, SqlDbType.Int);<br />
returnParameter.Direction = ParameterDirection.ReturnValue;<br />
command.Parameters.Add(returnParameter);<br />
// Execute the stored procedure<br />
command.ExecuteNonQuery();<br />
return (int)((SqlParameter)command.Parameters["@id"]).Value;<br />
}</span></p>
<p style="padding-left: 30px;"><span style="color: #ffcc00;">}</span> </p>
<p>Having done this I just set the newly calculated Id to the Domainobject. So I could keep to the inherited method of identifier creation. Of course this is circumventing NHibernate, there will be no caching and tracking and all the rest of it. but in this case I can live (or have to because of the legacy DB) with it.</p>
<p>But I found that in this case I have to tell Nhibernate that I assign the Id myself. This implicates new issues to obey.<br />
These will be described in another article coming up.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richter-web.info/Wordpress/?feed=rss2&amp;p=132</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Psd tutorials beginner contest 2D October 2009</title>
		<link>http://www.richter-web.info/Wordpress/?p=127</link>
		<comments>http://www.richter-web.info/Wordpress/?p=127#comments</comments>
		<pubDate>Sun, 18 Oct 2009 19:29:53 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Photoshop]]></category>
		<category><![CDATA[Composition]]></category>

		<guid isPermaLink="false">http://www.richter-web.info/Wordpress/?p=127</guid>
		<description><![CDATA[Hi there,
Despite of the all overwhelming workload I managed to produce another Composition.
Nevertheless I realize that maybe I focus too much on overall impressions.  Guess I should rather focus on a smaller snapshot of some scene or other. Then I can fiddle around with all the details and it looks just better. like some of [...]]]></description>
			<content:encoded><![CDATA[<p>Hi there,</p>
<p>Despite of the all overwhelming workload I managed to produce another Composition.</p>
<p>Nevertheless I realize that maybe I focus too much on overall impressions.  Guess I should rather focus on a smaller snapshot of some scene or other. Then I can fiddle around with all the details and it looks just better. like some of the other contestants in the contest.</p>
<p><a title="contest lotus" href="http://www.psd-tutorials.de/modules.php?name=BattleVote&amp;d_op=detailansicht&amp;b_id=323" target="_blank">http://www.psd-tutorials.de/modules.php?name=BattleVote&amp;d_op=detailansicht&amp;b_id=323</a></p>
<p><a title="the swan contest" href="http://www.psd-tutorials.de/modules.php?name=BattleVote&amp;d_op=detailansicht&amp;b_id=324" target="_blank">http://www.psd-tutorials.de/modules.php?name=BattleVote&amp;d_op=detailansicht&amp;b_id=324</a></p>
<p><a title="butterfly contest" href="http://www.psd-tutorials.de/modules.php?name=BattleVote&amp;d_op=detailansicht&amp;b_id=325" target="_blank">http://www.psd-tutorials.de/modules.php?name=BattleVote&amp;d_op=detailansicht&amp;b_id=325</a></p>
<p>credits<br />
http://www.sxc.hu/photo/511436<br />
http://www.sxc.hu/photo/1094060<br />
http://www.sxc.hu/photo/1094062<br />
http://moonchilde-stock.deviantart.com/art/Dragon-s-Lair-Nebula-Stock-84483646<br />
http://fantasystock.deviantart.com/art/Blue-Angels-Air-Show-Flight-04-57551316<br />
http://www.sxc.hu/photo/566719</p>
<div id="attachment_128" class="wp-caption alignleft" style="width: 310px"><a href="http://urpcor.deviantart.com/art/Lotus-140719557" target="_blank"><img class="size-medium wp-image-128  " title="contestocturpcor" src="http://www.richter-web.info/Wordpress/wp-content/uploads/2009/10/contestocturpcor-300x240.jpg" alt="Flower power" width="300" height="240" /></a><p class="wp-caption-text">Flower power</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.richter-web.info/Wordpress/?feed=rss2&amp;p=127</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Is SOA failing?</title>
		<link>http://www.richter-web.info/Wordpress/?p=109</link>
		<comments>http://www.richter-web.info/Wordpress/?p=109#comments</comments>
		<pubDate>Thu, 08 Oct 2009 09:38:06 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Software-Development]]></category>
		<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[SaaS]]></category>
		<category><![CDATA[SOA]]></category>

		<guid isPermaLink="false">http://www.richter-web.info/Wordpress/?p=109</guid>
		<description><![CDATA[Just browsed accidentally over some article: http://www.davidchappell.com/blog/2009/08/is-soa-failing-2008-interview.html
I can out of experience say that yes, mostly the blocks are not technical but organizational.
But then how is SaaS / Cloud computing solving these things? If there are organizational issues hampering the software whatever success, then the conclusion should be for software developers to study psychology and become [...]]]></description>
			<content:encoded><![CDATA[<p>Just browsed accidentally over some article: <a title="SOA failing- David Chapell" href="http://www.davidchappell.com/blog/2009/08/is-soa-failing-2008-interview.html" target="_blank"><span><span>http://www.davidchappell.com/blog/2009/08/is-soa-failing-2008-interview.html</span></span></a></p>
<p>I can out of experience say that yes, mostly the blocks are not technical but organizational.</p>
<p>But then how is SaaS / Cloud computing solving these things? If there are organizational issues hampering the software whatever success, then the conclusion should be for software developers to study psychology and become salesman.<br />
Then software developers would then first sell their solution to some management and afterward bring their airy promises to reality. This sounds a bit ironic, but after being a programmer since 1991 I realize this fact more and more. In this I fully back the notion of how to be successful as a technical guy as in the podcast.</p>
<p>Now I don&#8217;t see how Cloud computing and SaaS would help! sure the approach is different, but again there are organizations having again the thumb on their domain of software carefully shielding it from reuse(misuse). The block is always an organizational or political one.</p>
<p>Is therefore SOA failing? Its failing as every technical approach will if it is not properly sold to all participants and agreed by them. Yes, but agreements are somewhat thin rather often. So its a question of selling a project and coming up with the power and endurance to succeed.</p>
<p>Hmm&#8230; Am I as software developer going to become a salesman or some lone fighting bull. So far I tend trying to be the first.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richter-web.info/Wordpress/?feed=rss2&amp;p=109</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Workflow Foundation Basic Findings</title>
		<link>http://www.richter-web.info/Wordpress/?p=84</link>
		<comments>http://www.richter-web.info/Wordpress/?p=84#comments</comments>
		<pubDate>Tue, 06 Oct 2009 08:32:28 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Software-Development]]></category>
		<category><![CDATA[Statemachine]]></category>
		<category><![CDATA[Workflow]]></category>
		<category><![CDATA[WWF]]></category>

		<guid isPermaLink="false">http://www.richter-web.info/Wordpress/?p=84</guid>
		<description><![CDATA[In that article I just want to depict what I found about Microsoft Workflow foundation in .NET 3.5. Its not comprehensive. But its an overview about the main entities in WF which were required by my application scenario.
In some article later on I will provide some small demonstration application. The article presumes that the reader [...]]]></description>
			<content:encoded><![CDATA[<p>In that article I just want to depict what I found about Microsoft Workflow foundation in .NET 3.5. Its not comprehensive. But its an overview about the main entities in WF which were required by my application scenario.<br />
In some article later on I will provide some small demonstration application. The article presumes that the reader has a certain knowledge of statemachines. Also its helpful to have had a quick glance at the Workflow Foundation in advance (just install it-it comes with VS2008 anyways, create a Statemachine, some Workflow, drop in some activities)</p>
<h2>Now some theory about Microsoft Windows Workflow Foundation:</h2>
<ol>
<li>got the same work flow engine like MS BizTalk Server and SharePoint<br />
<a href="http://www.dotnetframework.de/lserver/artikeldetails.aspx?b=3773">http://www.dotnetframework.de/lserver/artikeldetails.aspx?b=3773</a></li>
<li>Statemachines(SM) which can start sequential Workflows</li>
<li>Sequential Workflows(WF)</li>
<li>Activities of which the sequential workflow is build</li>
<li>Workflow/ Statemachine services to communicate 2 way to Workflows and Statemachines</li>
</ol>
<h2>Statemachine</h2>
<p>The statemachine contains states.  The statemachine can only be in one state. The Initialisation of the state is itself a workflow in which the statemachine can do things. Just drop some StateInitialisationActivity into the State. Following you drag some other activities in the sequential Workflow (created by dragging the SateInitializationActivity on the State). As soon as the state initialisation is finished, the Statemachine is able to listen again. This is important since if some events are fired outside the Statemachine and the Statemachine is still initializing it cannot receive them. In every state the SM can listen to multiple events. The purpose of SM is not to incorporate actions. SM&#8217;s just depict some state in which some process is and what is possible logically in that state. If one wants to start methods and so on, its better to Invoke a Workflow which then later can call some activity.(see also section workflow services later )</p>
<h2>Sequential Workflows</h2>
<p>Sequential Workflows are also hosted in the WF engine. But they get only one WFEngine thread. (this can be a real thread or some virtual, the engine itself decides) They do not have states and therefore no state related activities.  The can only contain activities which have a sequential execution path.</p>
<h2>Activities</h2>
<p>Activities are representing just an encapsulated bit of code. They have properties and one can override for instance the Excecute method to do some other bytybyte calculations. Some can call some outside code, some are waiting for an event to occur and even some are depicting programming constructs as there is a If else construct.</p>
<p>All these 3, Activities, Statemachines and Workflows can be edited and created with the Visual Studio Designer for Workflows.</p>
<h2>Workflow-Events</h2>
<p>The Statemachine(or Workflow) only can listen to event of the type: <span style="font-size: x-small;"> </span></p>
<p><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">public</span></span><span style="font-size: x-small;"> </span><span style="font-size: x-small; color: #0000ff;"><span style="font-size: x-small; color: #0000ff;">event</span></span><span style="font-size: x-small;"> </span><span style="font-size: x-small; color: #2b91af;"><span style="font-size: x-small; color: #2b91af;">EventHandler</span></span><span style="font-size: x-small;">&lt;System.Workflow.Activities.</span><span style="font-size: x-small; color: #2b91af;"><span style="font-size: x-small; color: #2b91af;">ExternalDataEventArgs</span></span><span style="font-size: x-small;">&gt; someEvent;</span></p>
<p>This type contains a receiver InstanceId. otherwise the WF Engine cannot dispatch the event, since it does not know about the destination. Normal events are not receivable by the Workflow engine. Communication to and from the Workflow to some external class can be done with CallExternalMethod Activity and HandleExternalEvent Activity.</p>
<h2>Workflow Services</h2>
<p>Some other way to communicate duplex  with the Statemachine is with services which implement some public interface decorated with the [DataExchange] attribute.  The pattern would be one Statemachine/Workflow : one service. Through this service the Workflow can trigger some work and wait for an event signaling &#8220;work is done&#8221;which then is raised later on from within the service. BTW: The Statemachine cannot directly call some method of the service(via activity), since it is then not able to receive the service&#8217;s event because the whole call is then synchronous. Therefore the SM has to invoke some Workflow (with InvokeWorkflow Activity) which itself calls the service method. By that the SM is immediately able to listen to events, after invoking some workflow.</p>
<p>As soon one has created a service with methods and events the wca.exe tool can be used on that interface. It creates then activities based on the method/event signature. These automatically produced activities can be used then later in the Workflow designer. the only thing to do, is to fill their properties.</p>
<h2>Statemachine/Workflow Properties</h2>
<p>One can extend the SM of the WF with properties to bring information into the WF. only programatically this is possible at the time of creation of the workflow. Otherwise one can set or link values to the properties with the Workflow Designer.</p>
<h2>Pattern for startup of the Workflow environment</h2>
<p><span style="color: #ffcc00;">WorkflowRuntime workflowRuntime = new WorkflowRuntime();<br />
<span style="color: #339966;">// if I want to communicate with the Statemachine or Workflow I have to use some workflowServices<br />
</span>ExternalDataExchangeService eds = new ExternalDataExchangeService();// <span style="color: #008080;"><span style="color: #339966;">the general hoster</span><br />
</span>workflowRuntime.AddService(eds);<br />
eds.AddService(new FactsheetSMService()); <span style="color: #339966;">// now I add the actual service of the SM</span></span></p>
<p><span style="color: #ffcc00;"><span style="color: #339966;">// Create the workflow&#8217;s parameters collection</span><br />
Dictionary&lt;string, object&gt; parameters = new Dictionary&lt;string, object&gt;();<br />
parameters.Add(&#8221;ItemsToProcess&#8221;, queue); <span style="color: #339966;">// set the ItemsToProcess Property of the Statemachine<br />
</span><span style="color: #339966;">//get the actual real instance of the statemachine<br />
</span>WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(FactsheetSM), parameters);<br />
FactSheetSMService es = workflowRuntime.GetService&lt;FactSheetSMService&gt;(); <span style="color: #339966;">// retrieve the SMService<br />
</span><span style="color: #339966;">// fire the first event with the destination<br />
</span>es.OnRcpGetChangedSelected(new FactsheetSMServiceEventArgs(instance.instanceId));</span></p>
<p>now the SM is alive. One can even debug the SM or the workflows in the Workflow designer and see what is happening.</p>
<h2>Conclusion</h2>
<p>At the first glance the workflow foundation looks very promising.<br />
Now If I would use WF I would hope:</p>
<ul>
<li>not anymore to care about the multithreading models, the workflow runtime would just take care of that</li>
<li>get the process tracking out of the box</li>
<li>get an easy adaptable tool to change the Workflow according to changed requirements with the workflow designer</li>
<li>Better access to the state of some processing for the UI(with WF I would just display the state of the Statemachine or the current activity in the Sequential Workflow)</li>
<li>ability to hibernate the process and proceed later.</li>
</ul>
<p>All the entities used in Workflow Foundation are rather common sense for someone with IT background. So in some next article I will write my experiences with converting an existing app into Workflow application.</p>
<p>Some book on the matter which I can recommend: essential Windows Workflow Communication by Dharma shukla and Bob Schmidt ISBN 0-321-39983-8</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richter-web.info/Wordpress/?feed=rss2&amp;p=84</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQL Server- Get value of not grouped columns ( Group By )</title>
		<link>http://www.richter-web.info/Wordpress/?p=66</link>
		<comments>http://www.richter-web.info/Wordpress/?p=66#comments</comments>
		<pubDate>Fri, 02 Oct 2009 14:45:49 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Software-Development]]></category>
		<category><![CDATA[Group By]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.richter-web.info/Wordpress/?p=66</guid>
		<description><![CDATA[How to get the value of not grouped columns(Group By)]]></description>
			<content:encoded><![CDATA[<p>I have some table with documents in. Now there are to delete the all the versions of the documents but the latest one. First thought went to Groupings in SQL to get the latest (MAX)Date of the grouped document rows. But I found that I cannot put a column after the select Command which is not in the Group. Here is the case and my solution.</p>
<p>First the table:<br />
<span style="color: #ffcc00;">create table #Hierarchies (documentId int not null, publishedDate datetime not null, ComplianceId tinyint, languageId tinyint, instId int not null, HierarchyName varchar(255) not null) </span><br />
&#8211; HierarchyName would be the folder  the document belongs to<br />
&#8211; instId is just some Tag as ComplianceId</p>
<p>Here would be the data:<br />
<span style="color: #00ff00;">documentId  publishedDate    ComplianceId  languageId   instId      HierarchyName</span></p>
<p><span style="color: #00ff00;">&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;- &#8212;&#8212;&#8212;&#8211; &#8212;&#8212;&#8212;-</span></p>
<p><span style="color: #00ff00;">368334      2009-04-15 17:15:11.000 110               102        302371      Corporate</span></p>
<p><span style="color: #00ff00;">368335      2009-04-15 17:15:11.000 110               101        302371      Corporate</span></p>
<p><span style="color: #00ff00;">370644      2009-05-05 09:46:08.000 110               102        302371      Corporate</span></p>
<p><span style="color: #00ff00;">370645      2009-05-05 09:46:08.000 110               101        302371      Corporate</span></p>
<p><span style="color: #00ff00;">379675      2009-07-23 13:51:25.000 110               102        302371      Corporate</span></p>
<p><span style="color: #00ff00;">379676      2009-07-23 13:51:25.000 110               101        302371      Corporate</span></p>
<p><span style="color: #00ff00;">382243      2009-08-13 04:30:34.000 110               102        302371      Corporate</span></p>
<p><span style="color: #00ff00;">382244      2009-08-13 04:30:34.000 110               101        302371      Corporate</span></p>
<p><span style="color: #00ff00;">383903      2009-08-27 17:07:41.000 110               102        302371      Corporate</span></p>
<p><span style="color: #00ff00;">383904      2009-08-27 17:07:41.000 110               101        302371      Corporate</span></p>
<p>First I find the duplicates and put them in an quasi temporary table:<br />
<span style="color: #ffcc00;">With Duplicates( instId, HierarchyName, languageId, ComplianceId, MaxDate) AS<br />
(<br />
select distinct<br />
h.instId, h.HierarchyName, h.languageId, h.ComplianceId, Max(publishedDate) as MaxDate<br />
from #Hierarchies h<br />
group By h.instId, h.HierarchyName , h.languageId, h.ComplianceId<br />
having Count(documentId) &gt;1<br />
)</span></p>
<p>This gives me for the document distinction criteria as there are instId, HierarchyName, LanguageId and ComplianceId a list of all the documents which do not differ within the grouping criteria, but  have more than one occurrence which does differ in documentId or in PublishedDate. Also I get the most recent date with MAX(publishedDate).</p>
<p>Now I want to get all the documentIds of the older documents, in order to delete them.<br />
Or one could get the DocumentId of the most recent document and then delete all the other older documents.<br />
Unfortunately one cannot put a not grouped column after the select, in my case documentId. But how could I get to those DocumentIds?! I need those to delete the documents!!</p>
<p>After a bit of thinking the solution was pretty straightforward:<br />
Join the Duplicates with #Hierarchies on the former grouping criterias and there the publishedDate is not as the most recent date.</p>
<p><span style="color: #ffcc00;">select h.documentID from #Hierarchies h, Duplicates d<br />
where h.publishedDate &lt;&gt; d.MaxDate<br />
AND d. ComplianceId = h. ComplianceId<br />
AND d.languageId = h.languageId<br />
AND d.instId = h.instId<br />
AND d.HierarchyName = h.HierarchyName </span></p>
<p>So that was the solution to get column values of group by selects which are not in the grouping.<br />
Most probably there is a better solution. I would highly appreciate if someone lets me know or has any comments about the issue…</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richter-web.info/Wordpress/?feed=rss2&amp;p=66</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Entity Framework and stateless WCF SOA Services</title>
		<link>http://www.richter-web.info/Wordpress/?p=39</link>
		<comments>http://www.richter-web.info/Wordpress/?p=39#comments</comments>
		<pubDate>Mon, 28 Sep 2009 10:20:47 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Software-Development]]></category>
		<category><![CDATA[Entity Framework]]></category>
		<category><![CDATA[stateless SOA]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://www.richter-web.info/Wordpress/?p=39</guid>
		<description><![CDATA[Stateless SOA and database access with Microsoft Entity Framework]]></description>
			<content:encoded><![CDATA[<p>Lately I was validating the usability of the entityFramwork 1.0 for our SOA architecture. We have a stateless service environment with WCF. So calls of any operationcontract of the some servicecontract creates all the time new Wcf ServiceObjects. To achieve this, the servicecontract implementing class is hosted with:<br />
<em><span style="color: #ffcc00;">fServiceHost = new ServiceHost(typeof (DataLayer.WCF_Interface.DataLayerService));<br />
fServiceHost.Open();</span><br />
</em>Now, how do we build in the database access with EF into the Servicecontract implementing class?</p>
<p>First I looked in EF for posibilities to construct something like that:</p>
<h1>Sample 1:</h1>
<p><em><span style="color: #ffcc00;">public class ServiceContractImplementingClass<br />
{</span></em></p>
<p><em><span style="color: #ffcc00;">static EFEntities entities;</span></em></p>
<p><em><span style="color: #ffcc00;">ServiceContractImplementingClassCtor()<br />
{<br />
        if entities == null<br />
       entities = new EFEntites(&#8221;Databaseconnectionstring&#8221;); //creates the in EF OR mapper instance </span></em></p>
<p><span style="color: #ffcc00;">}</span></p>
<p><em><span style="color: #ffcc00;">//[OperationContract]<br />
Location[] GetBusinessLocations()<br />
{<br />
    // create a low cost Database object from the ObjectContext<br />
    var locs = from a in entities.GetNewSession().Locations select a;</span></em><em><br />
<span style="color: #ffcc00;">   &#8212;&#8212;&#8212;-<br />
   return locations;</span></em></p>
<p><em><span style="color: #ffcc00;">}<br />
&#8212;&#8212;&#8212;&#8211;&#8230;.&#8212;&#8212;&#8212;&#8212;</span></em></p>
<p><em><span style="color: #ffcc00;">}</span></em></p>
<p>Here in general I have one ObjectContext. For each stateless call to the OperationContract a lightweight Session would be created. The ObjectContext would be created once, the sessions more than once.<br />
After long deep search I found no supporting constructs wether in EF 1.0 nor in EF 2.0.<br />
Now I told myself, maybe that could be solved using somthing like that in the ServiceContract Implementing class:</p>
<h1>Sample 2:</h1>
<p><span style="color: #ffcc00;"><em><em>// only for readonly scenarios!!!<br />
public class ServiceContractImplementingClass<br />
{<br />
</em><br />
static EFEntities entities;</em><br />
</span><em><span style="color: #ffcc00;">private static EFEntites GetEFEntities()<br />
{<br />
     </span><span style="color: #ffcc00;"><em>if entities == null<br />
</em><em>     entities = new EFEntites(&#8221;Databaseconnectionstring&#8221;); //creates the in EF OR mapper instance</em><br />
     return entities;</span></em></p>
<p><em><span style="color: #ffcc00;">}</span></em><em><br />
</em><em><span style="color: #ffcc00;">//[OperationContract]<br />
Location[] GetBusinessLocations()<br />
{<br />
    var locs = from a in GetEFEntities().Locations select a;<br />
   &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
    return locations;</span></em></p>
<p><em><span style="color: #ffcc00;">}<br />
&#8212;&#8212;&#8212;&#8211;<br />
}</span></em></p>
<p>This approach made sure that no costly intialisation of the ObjectContext was to perform at every call of the operation contract. Of course the ObjectContext is not threadsafe. I am aware of that being very seldom, but I have  in my scenario only read operations no write accesses, so I should not mind Mutlithreading, stale data &#8230;. After having written an out of the box stresstest with Visualstudio accessing one static instance of EFEntities, I found I run into problems. There was an exception, stating that some column of table x in the database could not be accessed. Mind, I was only reading all myself alone the database. In that case I would have to make sure by hand that the EFEntities accesses are synchronized(with Locks) even if I have only read access. Wow! Eventually I would end up with serial access to the db even for read operations. Please mind that for read/write scenarios that sample 2 is of course not approbiate and you would end up wit sample 3!<br />
BTW: this method was almost as fast as the good old create DatabaseConnection&#8211;&gt; DataAdapter.Fill(Dataset) approach.</p>
<p>So I went back to the Microsoft backed pattern:</p>
<h1>Sample 3:</h1>
<p><em><span style="color: #ffcc00;"><em>public class ServiceContractImplementingClass<br />
{<br />
</em><br />
//[OperationContract]<br />
Location[] GetBusinessLocations()<br />
{<br />
</span></em></p>
<p style="padding-left: 30px;"><span style="color: #ffcc00;"><em>using (var db = new EFEntities(&#8221;DBConnectionString&#8221;))<br />
{<br />
        var locs = from a in db.Locations select a;<br />
</em><em>}</em></span></p>
<p><em><span style="color: #ffcc00;">&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;. return&#8230;<br />
</span></em><em><span style="color: #ffcc00;">}<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
}</span></em></p>
<p>Now that creates for every ServiceContractImplementingClass calls a new ObjectContext. I found after stress testing that somhow the db creation gets faster after the first call due to caching, but is was still slower than my second solution. unacceptable slow since with every call the ObjectContext had to created!<br />
Now I asked for advice in some forum or other. In the MS Forum there was not really help available. More or less they were using EF in Desktop apps, there the application holds an ObjectContext refernce as long as the app is executed.<br />
BTW: In that scenario EF is excellent, most of all because of the rather good LinqToEF implementation(better than LinqToNHibernate).</p>
<p>In the Wrox forum of (by the way very comprehensive) WROX book Professional ADO.NET 3.5 with LINQ and the Entity Framework ISBN: 978-0-470-22988-0 from Jennings, I got some valuable feedback: <a href="http://p2p.wrox.com/book-professional-ado-net-3-5-linq-entity-framework-isbn-978-0-470-22988-0/72707-comparing-performance-linq-entities-outofband-sql-updates.html">http://p2p.wrox.com/book-professional-ado-net-3-5-linq-entity-framework-isbn-978-0-470-22988-0/72707-comparing-performance-linq-entities-outofband-sql-updates.html</a></p>
<p>So thats that! I was downloading beta of VS 2010 with .NET 4.0 later then and found no extended ObjectContext -no POCOS, I admit I did not delve too much into that&#8230; but I gave up with EF for my intended scenario..</p>
<p>If there is someone who knows there I am possibly mistaken, I would appreciate any comment. We are very much .NET in the Company but we found ourselves forced to go for NHibernate.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.richter-web.info/Wordpress/?feed=rss2&amp;p=39</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eiger Bike Challenge 09</title>
		<link>http://www.richter-web.info/Wordpress/?p=31</link>
		<comments>http://www.richter-web.info/Wordpress/?p=31#comments</comments>
		<pubDate>Fri, 25 Sep 2009 06:07:22 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Common]]></category>
		<category><![CDATA[MTB]]></category>

		<guid isPermaLink="false">http://www.richter-web.info/Wordpress/?p=31</guid>
		<description><![CDATA[Hi there,
This year I tortured myself at the Eigerbike Challenge in Grindelwald 55km 2500hm. Its been fun though I was not as trained as one could have expected, after finishing a Alps traversal. Due to a tonsilitis I could not train for over 3 weeks. However I found myself finsihing in the last third with a [...]]]></description>
			<content:encoded><![CDATA[<p>Hi there,</p>
<p>This year I tortured myself at the Eigerbike Challenge in Grindelwald 55km 2500hm. Its been fun though I was not as trained as one could have expected, after finishing a Alps traversal. Due to a tonsilitis I could not train for over 3 weeks. However I found myself finsihing in the last third with a 5:48.09,5 time, but important: I was not the last! This was just a bit more than double so long as the winners. BTW: The mighty Christoph Sauser was also competing although at the long 80 km distance.</p>
<div class="mceTemp"><a href="http://www.datasport.com/de/diplom/?racenr=11320&amp;stnr=3225">http://www.datasport.com/de/diplom/?racenr=11320&amp;stnr=3225</a></div>
<div class="mceTemp"><a href="http://www.sportograf.de/de/shop/search/502/3225">http://www.sportograf.de/de/shop/search/502/3225</a></div>
<div class="mceTemp">The impression: The swiss are not by chance the best Bikers since long.  Very high level of the course in Grindelwald. the most technical marathon course I ever experienced!</div>
<div id="attachment_32" class="wp-caption alignleft" style="width: 310px"><a href="http://www.richter-web.info/Wordpress/wp-content/uploads/2009/09/sportograf-6498383.jpg"><img class="size-medium wp-image-32" title="sportograf-6498383" src="http://www.richter-web.info/Wordpress/wp-content/uploads/2009/09/sportograf-6498383-300x200.jpg" alt="a very good shot dearly paid" width="300" height="200" /></a><p class="wp-caption-text">a very good shot dearly paid</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.richter-web.info/Wordpress/?feed=rss2&amp;p=31</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Photoshop psdtutorials [2D]BeginnerContest Sept 09</title>
		<link>http://www.richter-web.info/Wordpress/?p=7</link>
		<comments>http://www.richter-web.info/Wordpress/?p=7#comments</comments>
		<pubDate>Thu, 24 Sep 2009 20:38:36 +0000</pubDate>
		<dc:creator>David</dc:creator>
				<category><![CDATA[Photoshop]]></category>
		<category><![CDATA[Composition]]></category>

		<guid isPermaLink="false">http://www.richter-web.info/Wordpress/?p=7</guid>
		<description><![CDATA[I took part at [2D]BeginnerContest Sept 09.
This is my very first 2D Composing! As soon as it got posted, I saw lots of bad details in it..
so there is room for improvement&#8230;
http://www.psd-tutorials.de/modules.php?name=BattleVote&#38;d_op=detailansicht&#38;b_id=315

 
 
]]></description>
			<content:encoded><![CDATA[<p>I took part at <strong>[2D]BeginnerContest Sept 09.</strong></p>
<p>This is my very first 2D Composing! As soon as it got posted, I saw lots of bad details in it..</p>
<p>so there is room for improvement&#8230;</p>
<p><a href="http://www.psd-tutorials.de/modules.php?name=BattleVote&amp;d_op=detailansicht&amp;b_id=315" target="_blank">http://www.psd-tutorials.de/modules.php?name=BattleVote&amp;d_op=detailansicht&amp;b_id=315</a></p>
<p><a href="http://www.richter-web.info/Wordpress/wp-content/uploads/2009/09/315_urpcor.jpg"><img class="alignleft size-medium wp-image-26" title="315_urpcor" src="http://www.richter-web.info/Wordpress/wp-content/uploads/2009/09/315_urpcor-300x225.jpg" alt="315_urpcor" width="300" height="225" /></a></p>
<div><strong> </strong></div>
<p><strong> </strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.richter-web.info/Wordpress/?feed=rss2&amp;p=7</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

