<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6869743</id><updated>2012-02-16T02:07:15.427-08:00</updated><category term='ASP.NET developer tools'/><category term='IIS 7 WAS Hosting'/><title type='text'>The facts of Life</title><subtitle type='html'>comments on reality</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://pieterm.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6869743/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://pieterm.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Pieter</name><uri>http://www.blogger.com/profile/10595129547644715398</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6869743.post-8794961487679844635</id><published>2007-06-11T09:14:00.000-07:00</published><updated>2007-06-11T09:54:51.770-07:00</updated><title type='text'>Enterprise library 3.1 – Policy Injection and Caching Block – Asp.Net 2.0</title><content type='html'>I’m currently investigating the advantage of upgrading from the version 2 of the Enterprise Library to version 3.1.&lt;br /&gt;&lt;br /&gt;One advantage in the existing functionality is the way transactions are handled in the data access block compared with the previous version. Now the escalation to the DTC is prevented when many updates are made to the same database. Since we are firing fifty updates in a single transaction this causes no exception anymore.&lt;br /&gt;&lt;br /&gt;The new functionality we will use and that does not require any code change is the rolling text file logger. We wrote something similar but we prefer to switch to the standard one Microsoft provides.&lt;br /&gt;&lt;br /&gt;The great new functionality is the caching of the execution of the methods. This kicks in when the same method gets executed twice with the same parameters. The three things you need to do, to use the Policy Injection in combination with the Caching is that the object needs to derive from MarshalByRefObject, apply the caching attribute or use configuration and create the object using the PolicyInjection.Create method.&lt;br /&gt;&lt;br /&gt;This creates an overhead for every object that is created and for every function that gets executed so take care where to use this caching block. The overhead is often a minor issue considering the drastic performance gain with caching.&lt;br /&gt;&lt;br /&gt;The only issue that I have found till now is with hash code of the objects that are passed as parameters in the function that is enabled for caching. The issue is that since we work in a web environment our objects are destroyed between roundtrips so when a new call comes a new “identical” object is created. This new object has a different hash code since it is a new object.&lt;br /&gt;&lt;br /&gt;The way we solved is for our custom defined objects, is to override the GetHashCode function. In this overriden function we check the real content of the object and return our hashcode depending on that. The price is that our GetHashCode is slower then the standard one.&lt;br /&gt;&lt;br /&gt;The Policy Injection block is a great way to develop in a more Aspect Oriented way and will help us to focus on writing business logic and less tracing, caching, error handling, validation and other plumbing.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6869743-8794961487679844635?l=pieterm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pieterm.blogspot.com/feeds/8794961487679844635/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6869743&amp;postID=8794961487679844635' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6869743/posts/default/8794961487679844635'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6869743/posts/default/8794961487679844635'/><link rel='alternate' type='text/html' href='http://pieterm.blogspot.com/2007/06/enterprise-library-31-policy-injection.html' title='Enterprise library 3.1 – Policy Injection and Caching Block – Asp.Net 2.0'/><author><name>Pieter</name><uri>http://www.blogger.com/profile/10595129547644715398</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6869743.post-1605515196766906532</id><published>2007-05-14T09:34:00.000-07:00</published><updated>2007-05-14T09:42:05.752-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IIS 7 WAS Hosting'/><title type='text'>Hosting WCF Service in IIS with WAS (Windows Activation Service)</title><content type='html'>WCF allows to host the services in serval ways. Every scenario has it specific advantages and it is important to choose the right way to host your processes. The options for hosting are to host in IIS, an executable or a service.&lt;br /&gt;&lt;br /&gt;Before Vista it was possible to host only webservices or remoting via HTTP in IIS because there was the limitation till IIS 6.0 that the communcation protocol had to be HTTP(s). It is mentioned in the &lt;a href="http://msdn2.microsoft.com/en-us/library/ms730158.aspx"&gt;MSDN&lt;/a&gt; that you can actually use WAS without IIS but till now I could not find any sample where this is explained.&lt;br /&gt;&lt;br /&gt;The main complexity of hosting in IIS is to set up your IIS to allow TCP/IP for for the server and for the specific webapplication. The steps to get started are to install the WCF Non-HTTP activation components. To do that, go to the Start menu —&gt; Control Panel —&gt; Programs and Features, and then click "Turn Windows Components On or Off" in the left pane. Expand the Microsoft .NET Framework 3.0 node and ensure that the "Windows Communication Foundation Non-HTTP Activation" feature is checked.&lt;br /&gt;&lt;br /&gt;Secondly run the following command as Administrator. &lt;br /&gt;c:\windows\system32\inetsrv\appcmd.exe set site "Default Web Site" -+bindings.[protocol='net.tcp',bindingInformation='808:*']&lt;br /&gt;&lt;br /&gt;Then a new application needs to be created in IIS. In this case I created the TestApp2 application. After creating it it is important to apply the following statement as Administrator. &lt;br /&gt;C:\Windows\System32\inetsrv\appcmd.exe set app  "Default Web Site/TestApp2"  /enabled Protocols:http,net.tcp.&lt;br /&gt;&lt;br /&gt;This makes sure that the application is also accessable via TCP/IP.&lt;br /&gt;&lt;br /&gt;Now IIS has been set up to host components. The next step is to create a new project in Visual Studio 2005 of the type WCF Service Library and then remove all the commented text.&lt;br /&gt;&lt;br /&gt;To keep the service as simple as possible I made the following implentation.&lt;br /&gt;&lt;i&gt;&lt;br /&gt;       [ServiceContract()]&lt;br /&gt;       public interface IMyService&lt;br /&gt;       {&lt;br /&gt;           [OperationContract]&lt;br /&gt;           string SayHello(string value);&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       public class MyService : IMyService&lt;br /&gt;       {&lt;br /&gt;           public string SayHello(string value)&lt;br /&gt;           {&lt;br /&gt;               return "Hello " + value;&lt;br /&gt;           }&lt;br /&gt;       } &lt;br /&gt;&lt;/i&gt;&lt;br /&gt;Then two files need to be added. The first one is the definition of the service. This must exist in a file with the extention svc and will be the entry point for IIS to the service. The file in this example is called Service.svc and the content of the file is &lt;br /&gt;&lt;i&gt;&amp;lt;% @ServiceHost Language=C# Debug="true" Service="MyService" %&amp;gt;&lt;/i&gt;&lt;br /&gt;The next file that needs to be added is the Web.Config. One of the main things in the Web.Config file is the declaration of the IMetadataExchange contact. This allows to exchange the meta information over TCP/IP.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;br /&gt;&amp;lt;?xml version="1.0"?&amp;gt;&lt;br /&gt;&amp;lt;configuration&amp;gt;&lt;br /&gt; &amp;lt;system.serviceModel&amp;gt;&lt;br /&gt;  &amp;lt;services&amp;gt;&lt;br /&gt;   &amp;lt;service behaviorConfiguration="ServiceBehavior" name="MyService"&amp;gt;&lt;br /&gt;    &amp;lt;endpoint binding="netTcpBinding" bindingConfiguration="PortSharingBinding"&lt;br /&gt;     contract="IMyService" /&amp;gt;&lt;br /&gt;    &amp;lt;endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" /&amp;gt;&lt;br /&gt;   &amp;lt;/service&amp;gt;&lt;br /&gt;  &amp;lt;/services&amp;gt;&lt;br /&gt;  &amp;lt;bindings&amp;gt;&lt;br /&gt;   &amp;lt;netTcpBinding&amp;gt;&lt;br /&gt;    &amp;lt;binding name="PortSharingBinding" portSharingEnabled="true"&amp;gt;&lt;br /&gt;     &amp;lt;security mode="None"/&amp;gt;&lt;br /&gt;    &amp;lt;/binding&amp;gt;&lt;br /&gt;   &amp;lt;/netTcpBinding&amp;gt;&lt;br /&gt;  &amp;lt;/bindings&amp;gt; &amp;lt;behaviors&amp;gt;&lt;br /&gt;   &amp;lt;serviceBehaviors&amp;gt;&lt;br /&gt;    &amp;lt;behavior name="ServiceBehavior"&amp;gt;&lt;br /&gt;     &amp;lt;serviceMetadata/&amp;gt;&lt;br /&gt;     &amp;lt;serviceDebug includeExceptionDetailInFaults="False"/&amp;gt;&lt;br /&gt;    &amp;lt;/behavior&amp;gt;&lt;br /&gt;   &amp;lt;/serviceBehaviors&amp;gt;&lt;br /&gt;  &amp;lt;/behaviors&amp;gt;&lt;br /&gt; &amp;lt;/system.serviceModel&amp;gt;&lt;br /&gt; &amp;lt;system.web&amp;gt;&lt;br /&gt;  &amp;lt;compilation debug="true"/&amp;gt;&lt;br /&gt; &amp;lt;/system.web&amp;gt;&lt;br /&gt;&amp;lt;/configuration&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;br /&gt;Compile the service and then copy the files web.config and service.svc over to the folder that corresponds with the application you previosly created. In this example it is c:\inetpub\wwwroot\TestApp2. And create the folder Bin where the dll is copied.&lt;br /&gt;The service is not created and can be accessed over TCP/IP. This means that it can possible to check if the methods exist using the Internet Browser.&lt;br /&gt;&lt;br /&gt;The client can be either type of application and the reference needs to be set to&lt;br /&gt;&lt;i&gt;net.tcp://localhost/TestApp2/Service.svc&lt;/i&gt;. The service proxy is automatically created and can be accessed equalty to any WCF Service.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6869743-1605515196766906532?l=pieterm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pieterm.blogspot.com/feeds/1605515196766906532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6869743&amp;postID=1605515196766906532' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6869743/posts/default/1605515196766906532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6869743/posts/default/1605515196766906532'/><link rel='alternate' type='text/html' href='http://pieterm.blogspot.com/2007/05/hosting-wcf-service-in-iis-with-was.html' title='Hosting WCF Service in IIS with WAS (Windows Activation Service)'/><author><name>Pieter</name><uri>http://www.blogger.com/profile/10595129547644715398</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6869743.post-4221567562454241691</id><published>2007-05-08T09:45:00.000-07:00</published><updated>2007-05-09T08:29:08.559-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET developer tools'/><title type='text'></title><content type='html'>I got the request to make an entry on what kind of tools I use on a day to day basis while developing ASP.NET 2.0 Applications. The main tool I use is of course VS2005 with Team foundation server as the source control system. I separated the other tools depending on the environment they are used from.&lt;br /&gt;&lt;br /&gt;&lt;table cellspacing="0" cellpadding="0" border="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td valign="center" colspan="2"&gt;&lt;h3&gt;Plug-ins for Visual Studio&lt;/h3&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href="http://www.redhillconsulting.com.au/products/simian/"&gt;Simian - Similarity Analyser &lt;/a&gt;&lt;/td&gt;&lt;td&gt;This tool makes it possible to detect duplicate code within a file, project or solution.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href="http://blogs.microsoft.co.il/blogs/tfsidekicks/archive/2006/08/27/2690.aspx"&gt;Team Build Sidekick&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Allows to Check the team build in and out.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="center" colspan="2"&gt;&lt;h3&gt;Plug ins for Internet Explorer&lt;/h3&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href="http://www.fiddlertool.com/Fiddler/help/hookup.asp"&gt;Fiddler&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Allows to intercept the HTTP Traffic. Very useful to see the content of the files that are requested.&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=e59c3964-672d-4511-bb3e-2d5e1db91038&amp;amp;displaylang=en"&gt;Developer toolbar&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Allows to check the properties of the elements that are rendered in the browser. &lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="center" colspan="2"&gt;&lt;h3&gt;Tools for the build&lt;/h3&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET"&gt;Cruise Control.Net&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Allows the continues integration of .NET applications&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href="http://www.codeplex.com/Wiki/View.aspx?ProjectName=TFSCCNetPlugin"&gt;TFS CruiseControl.Net plugin&lt;/a&gt;&lt;/td&gt;&lt;td&gt;The Plug in to use Team Foundation Server with Cruise Control&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="center" colspan="2"&gt;&lt;h3&gt;Tools for the Team Foundation Server&lt;/h3&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href="http://www.devbiz.com/teamplain/webaccess/default.aspx"&gt;Teamplain&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;br /&gt;Web UI for the Team Foundation Server&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td &gt;Custom developed RRSfeed&lt;br /&gt;&lt;/td&gt;&lt;td&gt;This tool allows to subscribe to all the work items, your work items, the team builds, the check ins via a news reader tool.&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;There will be more information on the ASP.NET developer tools later.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6869743-4221567562454241691?l=pieterm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pieterm.blogspot.com/feeds/4221567562454241691/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6869743&amp;postID=4221567562454241691' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6869743/posts/default/4221567562454241691'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6869743/posts/default/4221567562454241691'/><link rel='alternate' type='text/html' href='http://pieterm.blogspot.com/2007/05/i-got-request-to-make-entry-on-what.html' title=''/><author><name>Pieter</name><uri>http://www.blogger.com/profile/10595129547644715398</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6869743.post-3474041980432753823</id><published>2007-05-04T08:57:00.000-07:00</published><updated>2007-05-04T09:17:25.621-07:00</updated><title type='text'>TeamPlain Web Access for Team System</title><content type='html'>Today we have installed TeamPlain on our Team Foundation Server. The version we installed is the &lt;a href="http://www.devbiz.com/downloads/TeamPlain-Web-2.0-RC.msi"&gt;2.0 RC&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;The only scary moment when installing it on the Team Foundation Server is when you host it in IIS next to the other Sites (Sharepoint , TFS Server, Default WebSite) and hope that IIS is mapping the port correctly. &lt;br /&gt;&lt;br /&gt;The tool works great and it is faster then we expected once the firewall port is opened ;)&lt;br /&gt;&lt;br /&gt;The only drawback we found till now is the licensing. Although Microsoft claims it is included with the Team Foundation Server licence you actually should have a TFS CAL to access the site. The main reason why we want to use the TFS Web client is not to buy TFS client access licenses for the not developers. So it is going to be interesting to see if MS creates a new type of licenses for web access?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.devbiz.com/teamplain/webaccess/default.aspx"&gt;All information&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src="http://www.devbiz.com/teamplain/webaccess/images/screens/rtm/project.gif" &gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6869743-3474041980432753823?l=pieterm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pieterm.blogspot.com/feeds/3474041980432753823/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6869743&amp;postID=3474041980432753823' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6869743/posts/default/3474041980432753823'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6869743/posts/default/3474041980432753823'/><link rel='alternate' type='text/html' href='http://pieterm.blogspot.com/2007/05/teamplain-web-access-for-team-system.html' title='TeamPlain Web Access for Team System'/><author><name>Pieter</name><uri>http://www.blogger.com/profile/10595129547644715398</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6869743.post-117550596620590677</id><published>2007-04-02T02:24:00.000-07:00</published><updated>2007-04-02T02:26:06.213-07:00</updated><title type='text'>Using Callback Contracts in WCF</title><content type='html'>The best sample I found of a full duplex example with WCF can be found at &lt;a href="http://dotnetaddict.dotnetdevelopersjournal.com/wcf_alarmclock.htm"&gt;http://dotnetaddict.dotnetdevelopersjournal.com/wcf_alarmclock.htm&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And the sourcecode can be found at &lt;a href="http://files.blog-city.com//files/J05/88284/b/duplexalarmsystem2.zip"&gt;http://files.blog-city.com//files/J05/88284/b/duplexalarmsystem2.zip&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6869743-117550596620590677?l=pieterm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pieterm.blogspot.com/feeds/117550596620590677/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6869743&amp;postID=117550596620590677' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6869743/posts/default/117550596620590677'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6869743/posts/default/117550596620590677'/><link rel='alternate' type='text/html' href='http://pieterm.blogspot.com/2007/04/using-callback-contracts-in-wcf.html' title='Using Callback Contracts in WCF'/><author><name>Pieter</name><uri>http://www.blogger.com/profile/10595129547644715398</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6869743.post-117507143952272297</id><published>2007-03-28T01:41:00.000-07:00</published><updated>2007-03-28T01:43:59.533-07:00</updated><title type='text'>WCF and IIS</title><content type='html'>The easiest sample how you can use WCF togehter with IIS can be found at&lt;br /&gt;&lt;a href="http://blogs.msdn.com/trobbins/archive/2006/11/27/how-to-hosting-a-wcf-service-in-iis.aspx"&gt;http://blogs.msdn.com/trobbins/archive/2006/11/27/how-to-hosting-a-wcf-service-in-iis.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6869743-117507143952272297?l=pieterm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pieterm.blogspot.com/feeds/117507143952272297/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6869743&amp;postID=117507143952272297' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6869743/posts/default/117507143952272297'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6869743/posts/default/117507143952272297'/><link rel='alternate' type='text/html' href='http://pieterm.blogspot.com/2007/03/wcf-and-iis.html' title='WCF and IIS'/><author><name>Pieter</name><uri>http://www.blogger.com/profile/10595129547644715398</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6869743.post-117491072017733189</id><published>2007-03-26T06:04:00.000-07:00</published><updated>2007-03-27T02:46:53.026-07:00</updated><title type='text'>Object binding with WPF</title><content type='html'>It took me some time to find a good sample of doing object binding with WPF. I decided to publish my sample.&lt;br /&gt;&lt;br /&gt;I created a class called patient.&lt;br /&gt;&lt;br /&gt;public class Patient&lt;br /&gt;{&lt;br /&gt;private int _id;&lt;br /&gt;private string _name;&lt;br /&gt;private string _picture;&lt;br /&gt;&lt;br /&gt;public string Picture&lt;br /&gt;{&lt;br /&gt;get { return _picture; }&lt;br /&gt;set { _picture = value; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public Patient(int id, string name , string picture)&lt;br /&gt;{&lt;br /&gt;_id = id;&lt;br /&gt;_name = name;&lt;br /&gt;_picture = Picture;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public string Name&lt;br /&gt;{&lt;br /&gt;get { return _name; }&lt;br /&gt;set { _name = value; }&lt;br /&gt;}&lt;br /&gt;public int ID&lt;br /&gt;{&lt;br /&gt;get { return _id; }&lt;br /&gt;set { _id = value; }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;This patient class is filled with data by an engine class. This engine class is called PatientEngine.&lt;br /&gt;&lt;br /&gt;public class PatientsEngine&lt;br /&gt;{&lt;br /&gt;public static List&lt;patient&gt; GetPatients()&lt;br /&gt;{&lt;br /&gt;List&lt;patient&gt; pList = new List&lt;patient&gt;();&lt;br /&gt;Patient p1 = new Patient(1, "Jack", "Images/Jack.png");&lt;br /&gt;Patient p2 = new Patient(2, "Jim", "Images/Jim.png");&lt;br /&gt;Patient p3 = new Patient(3, "Johny", "Images/Johny.png");&lt;br /&gt;pList.Add(p1);&lt;br /&gt;pList.Add(p2);&lt;br /&gt;pList.Add(p3);&lt;br /&gt;return pList;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;This class has a static method to fill the generic list of patients.&lt;br /&gt;&lt;br /&gt;To call the engine you need to&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Create a new windows XAML application&lt;/li&gt;&lt;li&gt;Open the window1 file &lt;/li&gt;&lt;li&gt;Add in the window tag the namespace declaration where your engine is located, in my case in "WindowsApplication4" do this by adding this line.&lt;br /&gt;xmlns:src="clr-namespace:WindowsApplication4"&lt;/li&gt;&lt;li&gt;Add the ObjectDataProvider in the &lt;grid.resources&gt;element&lt;br /&gt;&amp;lt;objectdataprovider key="patients" objecttype="{x:Type src:PatientsEngine}" methodname="GetPatients"&amp;gt;&amp;lt;/objectdataprovider&amp;gt;&lt;/li&gt;&lt;li&gt;Create a data template&lt;br /&gt;&lt;datatemplate datatype="Patient" key="patientFormating"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;DataTemplate x:Key="patientFormating" DataType="Patient"&amp;gt;&lt;br /&gt;&amp;lt;StackPanel Orientation="Vertical"&amp;gt;&lt;br /&gt;&amp;lt;TextBlock&amp;gt;&lt;br /&gt;&amp;lt;TextBlock.Text&amp;gt;&lt;br /&gt;&amp;lt;Binding Path="Name" /&amp;gt;&lt;br /&gt;&amp;lt;/TextBlock.Text&amp;gt;&lt;br /&gt;&amp;lt;/TextBlock&amp;gt;&lt;br /&gt;&amp;lt;Image&amp;gt;&lt;br /&gt;&amp;lt;Image.Source&amp;gt;&lt;br /&gt;&amp;lt;Binding Path="Picture" /&amp;gt;&lt;br /&gt;&amp;lt;/Image.Source&amp;gt;&lt;br /&gt;&amp;lt;/Image&amp;gt;&lt;br /&gt;&amp;lt;/StackPanel&amp;gt;&lt;br /&gt;&amp;lt;/DataTemplate&amp;gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Add the code to display a listview in a DockPanel&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;DockPanel DataContext="{Binding Source={StaticResource patients}}" Grid.Column="0" Grid.Row="0"&amp;gt;&lt;br /&gt;&amp;lt;ListView x:Name="listView1" ItemsSource="{Binding }" ItemTemplate="{DynamicResource patientFormating}" IsSynchronizedWithCurrentItem="True" DockPanel.Dock="Left" /&amp;gt;&lt;br /&gt;&amp;lt;/DockPanel /&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6869743-117491072017733189?l=pieterm.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://pieterm.blogspot.com/feeds/117491072017733189/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6869743&amp;postID=117491072017733189' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6869743/posts/default/117491072017733189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6869743/posts/default/117491072017733189'/><link rel='alternate' type='text/html' href='http://pieterm.blogspot.com/2007/03/object-binding-with-wpf.html' title='Object binding with WPF'/><author><name>Pieter</name><uri>http://www.blogger.com/profile/10595129547644715398</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry></feed>
