WF 4.0 beta 2 making persistence work
Tue, Oct 27 2009 7:56 PM

WF & WCF beta 2 samples contains some samples to work with WF persistence.

  1. OOB this is not working. What do you have to do to make it work:

    Navigate to the .NET Framework 4.0 directory (C:\WINDOWS\Microsoft.NET\Framework\v4.0.21006)
  2. Open WorkflowManagementService.exe.config in visual studio
  3. Add a database to the configuration like:
    <databases>
         <database connectionString="Data Source=localhost\SQLEXPRESS;Initial Catalog=DefaultSampleStore;Integrated Security=True;Asynchronous Processing=True"/>
     </databases>
  4. Make sure that the WorkflowManagementService is added as a windows service. The setup.cmd of sample DurableDelay does this for you. 

Samples like BuiltInConfiguration & DurableDelay do work now. (the connectionstrings in both the application and configured in WorkflowManagementService.exe.config must be the same)
In workflow 3.X the SqlWorkflowPersistenceService polls the database. Now WorkflowManagementService.exe is polling this database and when it's time to continue the workflow it notifies the workflow application.

It's much nicer to see the power of persistent workflows when you add a something like:

Console.WriteLine("Hit any key to start a workflow instance");
Console.ReadLine();

just before the proxy.start() call.

When you start a workflow for the first time you hit any key to start a workflow instance. While the application is running just kill the application. Start it up again. Now because only the servicehost is started, the application will continue the interrupted workflow.

download the WF & WCF Samples for WF 4.0 beta 2: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=35ec8682-d5fd-4bc3-a51a-d8ad115a8792

by Pascal Naber | with no comments
Filed under:
WF 4.0 What is different from 3.X part 2
Wed, May 27 2009 12:13 PM

Some more facts about WF 4.0.

Part 1 can be found here

  1. There is no rule engine anymore!
  2. Workflows have a XAML extension now. (activities can have that too)
  3. Everything in a XAML workflow is XAML based (suprising isn’t it ;-. In WF 3.X this wasn’t the case). Now there is no CodeDom for expressions/rules anymore. (Code based workflows are possible also)
  4. The designer is completely new. WPF based and easier to rehost in your own application.
  5. No binding of activities to each other anymore. This is the responsibility of variables and arguments from now on.
  6. No dependency properties anymore on custom activities, but InArgument<T> and OutArgument<T> properties.
  7. It’s easier to make Custom Activities. Custom activities can be made in code or in XAML. There are a lot of base classes for code based custom activities. WorkflowElement is the base class of all activities. CodeActivity<T> for simple activities that return 1 value (of type T). CodeActivity for simple activities that return no or multiple values. NativeActivity<T> and NativeActivity for complex activities like long running activities.
  8. No code condition or declarative rule condition anymore. Every rule can be coded as an expression. Expressions are stored in XAML within the Workflow XAML file. No seperate CodeDom rules file anymore.
  9. No WorkflowSchedulerService (Manual or Default) anymore to manage on which thread the workflow runs. In WF 4.0 Use WorkflowInstance or WorkflowInvoker. WorkflowInstance for Async workflows (on a separate thread) and WorkflowInvoker for Synchrone workflows (on the running thread). The latter is ideal for unit testing activities.

to be continued…

WF 4.0 What is different from 3.X
Wed, May 20 2009 1:37 PM

I’m playing with WF 4.0 at the moment and made a list what’s changed compared with WF 3.X.
Some features were already known since the PDC but I’m trying to create a nice overview list.

I will change this post as I play further with it.

  1. WF 4.0 is completely rewritten. So you can’t upgrade your WF 3.X workflows to WF 4.0. All activities and the runtime is new. Some activities are familiar but there are many new ones.
  2. You can still use your WF 3.X custom activities. This can be done via the new Interop activity.
  3. StateMachine workflows do not exists anymore. Only Seqential and a new type called FlowChart.
  4. Code and XAML based workflows are possible, but code based workflows do not have a designer.
  5. It’s possible to Unit Test Activities (workflows are activities too)
  6. Activities doesn’t have to be executed via a workflow. Activities can be executed in code also. Which makes reuse of activities more interesting.
  7. Not possible to make properties on your workflow. Instead of this there are variables and arguments now. Variables represent the storage of data. Arguments represent the flow of data into and out of an activity. Variables have a scope. The activity selected provides the scope. There are 2 new views in Visual Studio to manage the variables and arguments.
  8. On all kinds of activities, expressions are possible. Like the if statement on a If Activity. Expressions are program statements, a string value or .NET code. This expressions are written in VB!. This means capitalization does not matter, comparison is performed using a single equals sign instead of “==”, and the Boolean operators are the words "and" and "or" instead of the symbols "&&" and "||".
  9. ExceptionHandling is not arranged through a separate designer anymore. There is a TryCatch activity now. (which has a finally also)
  10. The parallel activity is truly executing parallel now
  11. Correlation can be setup with your own identifier (content based correlation)

 

Much more to come…

Update:
Part 2 continues the list

BizTalk 2009 Free Microsoft downloads: overview
Tue, Apr 21 2009 9:25 PM

Microsoft has released a lot of resources related to BizTalk 2009 (which are free to download). Among them are presentations, whitepapers, posters, videos, FAQs etc.

This post gives an overview of all downloads. I will update this post when new downloads appear.
Some BizTalk 2006 resources are interesting and still appropriate to BizTalk 2009. Those are listed here also, but this list is not comprehensive.

When I’m missing something that has to be added to this lists, please let me know.

Microsoft BizTalk Server 2009 Operations Guide

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=46a77327-affb-4ca2-9451-67912babbb03#tm

BizTalk Server 2009 RFID Operations Guide

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=f8584561-da18-42df-ad44-02a326c8aaca#tm

Microsoft BizTalk Adapter 2.0 Migration Whitepaper

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=c1e3149b-322e-4ea6-aa79-9fc2c0515eec#tm

TechReady 8 - BizTalk Customer Advisory Team Presentations

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=d36d4c36-7396-4302-929f-7c59ff4327f6#tm
BizTalk Adapter Pack Migration Tool http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=e68b8fd1-5c8a-499a-8237-4dc23a8342c5#tm
TechEd 2009 (North America) - BizTalk Server Presentations http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=aa4af82f-17c3-45a2-a357-2c3ed41fd6e0#tm
TechReady 7 - BizTalk Customer Advisory Team Presentations http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=d180a0d7-2853-4fd8-9890-984863a9cad7#tm
BizTalk Server RFID 2009 Whitepaper: Installing and Running BizTalk Server RFID 2009 in a Windows Server 2008 Cluster http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=b038dda0-38a2-4d00-a30c-18cbca5af803#tm
Improving Fault Tolerance in BizTalk Server by Using a Windows Server 2008 failover cluster or Windows Server 2003 server cluster http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=eb437722-2828-4cbb-84c3-17556b4df26b#tm
Using the BizTalk WCF Service Publishing Wizard to Publish Orchestrations as WCF Services (video) http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=8c1ec6a1-0ecd-4bff-b2d8-22875ed398ce#tm
Using the BizTalk WCF Service Consuming Wizard (video) http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=ba6c529a-e5dd-4944-bdd2-276df7b94105#tm
BizTalk Server 2009 Capabilities Poster http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=9cb8fa47-f8b9-4b58-a927-3430826f520c
Installing and Configuring Microsoft BizTalk Adapters for Enterprise Applications http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=73906bf5-4197-4941-a73f-a43c0d38618f
BizTalk Server 2009 Runtime Architecture Poster http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=d022a0a4-3b27-49cf-b47c-16d8458a1be2
BizTalk Server 2009 Evaluation Edition http://www.microsoft.com/downloads/details.aspx?FamilyID=1e545278-0d5b-4bbd-b073-18111ce86995&displaylang=en
BizTalk Server 2009 Code Samples http://go.microsoft.com/fwlink/?LinkId=146129
Microsoft BizTalk Adapter for SQL Server Installation Guide and Help http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=f6a520b2-1804-4c17-a73d-b6377fecc40d
Microsoft BizTalk Adapter for SQL Server http://www.microsoft.com/downloads/details.aspx?FamilyID=ceb0bb34-f9d2-4d14-8bbe-0311d227b091&displaylang=en
Microsoft BizTalk Adapter Pack 2.0 Help http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=6017f258-b453-408b-a617-ed76c8679141
Microsoft BizTalk Adapter Pack 2.0 Installation Guide http://www.microsoft.com/downloads/details.aspx?FamilyID=ff0b19a6-72c1-43b3-9d38-b874303590ce&displaylang=en
BizTalk Adapter Pack 2.0 Trial http://www.microsoft.com/downloads/details.aspx?FamilyID=76736ba7-3c05-4436-9353-1c33f9005194&displaylang=en
BizTalk Server 2009 Installation and Upgrade Guides http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=9c697e02-d1bc-4684-8748-28b3a292d5bf
WCF LOB Adapter SDK SP2 http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=47ab6f21-0d8b-4c90-a8b9-e8647281b164#tm
BizTalk Server 2009 Documentation http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=cad8a5eb-1104-4a85-a3c1-31b2c8acfe63#tm
Microsoft BizTalk Adapter Pack 1.0 (Oracle, MySAP, Siebel) http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=58bd17c8-8efa-4b69-ab51-9f5b11a962dc#tm
BizTalk Server 2009 Hyper-V Guide http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=0582bc67-0bef-4a0a-99cf-4408a111c4e3#tm
Microsoft BizTalk Server 2009 Technical Overview http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=1f839374-17df-43b9-840e-60c11f20f42b#tm
BizTalk Adapter Pack: Connecting LOB Systems and Microsoft Office SharePoint Server - English http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=cfc944df-db01-41da-865f-6ae6d100469b
How a WCF Receive Adapter Processes an Incoming WCF Message http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=c94f6263-3cd4-43b5-b038-5737a8d0d219
Windows Communication Foundation (WCF) Adapter FAQs http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=13d6121d-c82b-4614-a160-7c88bcc037b7
BizTalk Adapter Pack 2.0 Interactive Poster http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=e0b11f69-657a-4cae-9838-ccf96b15d3ec
BizTalk Adapter Pack 2.0/WCF LOB Adapter SDK Poster http://www.microsoft.com/downloads/details.aspx?familyid=4A7E28B9-9F4B-4989-A35A-247F379F2142&displaylang=en
BizTalk Server 2009 Scale-out Configurations Interactive Poster http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=d9cc7d13-7324-4f24-88de-7b063fde62e8
BizTalk Server 2009 Scale-out Configurations Poster http://www.microsoft.com/downloads/details.aspx?familyid=DBBE85C5-4DD4-4B28-B2F1-6197980FD149&displaylang=en
BizTalk Server 2009 BAM Poster http://www.microsoft.com/downloads/details.aspx?familyid=193cd7a4-e271-46bb-b4ee-8434dfa779a0&displaylang=en&tm
BizTalk Server 2009 Database Infrastructure Poster http://www.microsoft.com/downloads/details.aspx?familyid=2E322206-03CF-47BA-BDB0-F96770F889ED&displaylang=en
BizTalk Adapters for Host Systems Installation Guide and Release Notes http://www.microsoft.com/downloads/details.aspx?familyid=4e367af8-7f54-4e21-b10a-3e8387d2c82f&displaylang=en&tm
BizTalk Server and WCF Support in Visual Studio 2008 http://www.microsoft.com/downloads/details.aspx?familyid=942b3294-78da-401f-b99c-56c4e9b96e77&displaylang=en&tm
Enhancing the Production Line with Microsoft BizTalk RFID (video) http://www.microsoft.com/downloads/details.aspx?familyid=cb8aed9b-70fe-43dd-b7e1-c9f883d9ad19&displaylang=en&tm
IGPS Case Study Using Microsoft BizTalk Server and RFID (video) http://www.microsoft.com/downloads/details.aspx?familyid=a7448311-ae97-4ece-ab29-6c9e1ba6922f&displaylang=en&tm
Tehko Case Study Using Microsoft BizTalk RFID: Fresh Fish (video) http://www.microsoft.com/downloads/details.aspx?familyid=4ac0bb68-fb52-478e-bbe6-a26c3bd6aaa2&displaylang=en&tm
Microsoft Dynamics AX 2009 AIF BizTalk Adapter Configuration White Paper http://www.microsoft.com/downloads/details.aspx?familyid=edc62433-5b21-4f74-b065-b075ba6dc86d&displaylang=en&tm
Business Activity Monitoring (BAM) in Depth for Developers http://www.microsoft.com/downloads/details.aspx?familyid=ff6e4498-b1ff-4932-ba6b-1b53ac6fb3b2&displaylang=en&tm

 

BizTalk 2006

Microsoft BizTalk Server Performance Optimization Guide http://www.microsoft.com/downloads/details.aspx?familyid=98ecf11a-9a8e-4939-8cef-2bc5536dc792&displaylang=en&tm
BizTalk Server 2006 Tutorials http://www.microsoft.com/downloads/details.aspx?familyid=6A5F6EF4-AEB8-4D8D-A521-37333A875CE4&displaylang=en
Microsoft BizTalk Server 2006 Administration Tutorials http://www.microsoft.com/downloads/details.aspx?familyid=d3add54f-4bb7-444d-9300-6230180dbb45&displaylang=en&tm
.NET 4.0 feature als preview voor .NET 3.5: Code Contracts (Dutch)
Fri, Mar 6 2009 2:19 PM

Op de PDC heeft Microsoft een aantal nieuwe features bekend gemaakt die in .NET 4.0 zullen komen. Een van deze features is Code Contracts. Van Code Contracts heeft Microsoft een preview versie voor Visual Studio 2008 Team edition uitgebracht. Nu kan je in je huidige omgeving Code Contracts uitproberen. Code Contracts voorzien in Design by Contract.

Wat is Design by Contract

Design by Contract (DBC) is door Bertrand Meyer in de taal Eiffel voor het eerste gebruikt. Hij heeft het mogelijk gemaakt om contracten vast te leggen tussen aanroepende (client) en aangeroepen code (supplier).

De vragen die continue afgevraagd kunnen worden bij de aanroep van code:

  • Wat verwacht het? De preconditie: wat moet waar zijn voordat de aanroep gedaan wordt
  • Wat garandeerd het? De postconditie: wat is waar na afloop van de aanroep
  • Wat wordt er altijd gegarandeerd? De Invariant: wat is continue waar.

De client dient bij de aanroep naar de supplier de precondities te controleren. De supplier garandeerd na het controleren van de precondities dat het resultaat voldoet aan de postcondities. Daarnaast zorgt de supplier dat de invariant condities worden nageleefd.

Om deze reden is er sprake van een contract tussen client en supplier. Indien je meer wil weten van DBC kan je hier eens kijken: http://en.wikipedia.org/wiki/Design_by_contract

Dat kan toch ook met Asserts

Design by Contract is een manier om defensief te programmeren. Met Asserts kan je in C# soortgelijke eisen vastleggen. Echter met code contracts is meer mogelijk. Code Contracts zijn ‘Asserts on steroids’. De meerwaarde die Code Contracts bieden zijn:

Zichtbaarheid van Precondition: Asserts zijn niet zichtbaar voor aanroepende code. Met Code Contracts zijn preconditions wel zichtbaar. Niet alleen voor ontwikkelaars die de methode aanroepen, maar ook voor tooling.

Postconditions: Asserts gebruiken voor postcondities is niet eenvoudig. Zal snel leiden tot duplicate code en is niet erg onderhoudbaar. De postcondities met Code Contract worden net als de Precondities bovenaan de methode gedeclareerd. Met IL-rewrite word door de tooling op alle juiste exit plaatsen van de method de postconditie geïnjecteerd.

Inheritance: Overriden methods dienen dezelfde precondities en postcondities te hebben als hun parent methods. Met Asserts zou je in zowel de parent als overriden method dezelfde Asserts hebben staan. Dit zorgt voor duplicate code. Het is niet mogelijk om deze condities consistent te houden. Code contracts zorgen wel voor consistency en inheritence van contracts.

Microsoft Research project: Spec#

Microsoft Research heeft Design by Contract allereerst vastgelegd in Spec#. Met dit project heeft Microsoft onderzocht wat Design by Contract voor .NET kan betekenen. Code Contracts zijn het resultaat van dit research project.

Code Contracts preview

De preview kan gedownload worden vanaf DevLabs (een portal waar meerdere projecten van Microsoft opstaan waarvan de bits te downloaden zijn en die dus uitgeprobeerd kunnen worden) http://msdn.microsoft.com/en-us/dd491992.aspx

De losse documentatie kan hier gedownload worden

http://download.microsoft.com/download/C/2/7/C2715F76-F56C-4D37-9231-EF8076B7EC13/userdoc.pdf

Na installatie heb je een nieuwe directory: %Program Files%\Microsoft\Contracts.

Hierin bevinden zich de tools die de static analysis mogelijk maken. Assemblies om naar te refereren en Code Contracts te gebruiken. Code Snippets om sneller condities te programmeren en Samples.

In .NET 4.0 zal in mscorlib de class Contract bevinden onder namespace System.Diagnostics.Contracts

Om Code Contracts in .NET 3.5 te ondersteunen is de assembly Microsoft.Contracts.dll in het leven geroepen. De class Contract bevind zich ook in de namespace System.Diagnostics.Contracts

Wat biedt Code Contracts

Code Contracts biedt een manier om aannames in code vast te leggen in de vorm van Precondities, Postcondities en Invariants. Deze contracten worden gebruikt om het volgende mogelijk te maken:

  1. Verbeteren van Unit Testen via runtime checks
  2. Statische contract controle
  3. Documentatie generatie

Er worden 2 tools meegeleverd

  1. Runtime checking. Een binary rewriter die contracten injecteerd in een programma. (ccrewrite.exe)
  2. Static checking. Deze statische controle tool kan op basis van de contracten zien of er schendingen zijn zonder dat het programma wordt uitgevoerd. (cccheck.exe)

Voorbeeld

In deze introductie post allereerst een simpel voorbeeld om de functionaliteit te laten zien van de pre, post en invariant condities.

    1 public class RekeningList : List<Rekening>

    2 {

    3     public Rekening GetByName(string userName)

    4     {

    5         Contract.Requires(!string.IsNullOrEmpty(userName));

    6         Contract.Ensures(Contract.Result<Rekening>() != null);

    7 

    8         return this.Where(r => r.Name == userName).FirstOrDefault();

    9     }

   10 }

   11 

   12 public class Rekening

   13 {

   14     public string Name { get; set; }

   15 

   16     public void Stort(double bedrag)

   17     {

   18         Contract.Requires(bedrag > 0);

   19 

   20         saldo += bedrag;

   21     }

   22 

   23     public void NeemOp(double bedrag)

   24     {

   25         Contract.Requires(bedrag > 0);

   26         Contract.Requires(saldo >= bedrag);

   27 

   28         saldo -= bedrag;

   29     }

   30 

   31     private double saldo = 0;

   32 

   33     public double Saldo

   34     {

   35         get { return this.saldo; }

   36     }

   37 

   38     [ContractInvariantMethod]

   39     protected void CorrectSaldo()

   40     {

   41         Contract.Invariant(saldo >= 0);

   42     }

   43 }

In bovenstaand voorbeeld staat op regel 5 een precondition. Deze conditie zou hier ook nog met een Assert opgelost kunnen worden. Op regel 6 staat een Postcondition. Je zou verwachten dat een postcondition op het einde van de method gezet zou moeten worden. Als deze assembly gecompileerd wordt, wordt er op de juiste plaats(en) code geinjecteerd die voor deze controle zorgen. De syntax van deze Postcondition zorgt ervoor dat er geen tijdelijke variabele gemaakt dient te worden van het type Rekening die uiteindelijk geretourneerd gaat worden.

Voor de geinteresseerden: met reflector ziet de GetByName methode er als volgt uit:

public User GetByName(string userName)
{
    __copy+<>c__DisplayClass1 CS$<>8__locals2 = 
new __copy+<>c__DisplayClass1(); CS$<>8__locals2.userName = userName; __ContractsRuntime.Requires(!string.IsNullOrEmpty(
CS$<>8__locals2.userName), null, "!string.IsNullOrEmpty(userName)"); <>c__DisplayClass1 CS$<>8__locals2 = new <>c__DisplayClass1(); CS$<>8__locals2.userName = userName; User CS$1$0000 = this.Where<User>(new Func<User, bool>(
CS$<>8__locals2.<GetByName>b__0)).FirstOrDefault<User>(); User Contract.Result<User>() = CS$1$0000; __ContractsRuntime.Ensures(Contract.Result<User>() != null,
null, "Contract.Result<User>() != null"); return Contract.Result<User>(); }

Vanaf regel 38 staat een voorbeeld van de Invariant condition. Deze condition houdt continue in de gaten of het saldo van de rekening nog wel gelijk of groter is dan 0. Hierdoor is het niet nodig om deze aanname op tig plaatsen te coderen, maar staat deze code op 1 plaats.

Indien het runtime checken van de Code Contracts niet aangezet wordt zal er niets met deze code gedaan worden. Bij de properties van een project is er een nieuwe tab bijgekomen na intallatie van Code Contracts. Bij Runtime Checking dient de checkbox aangevinkt te worden.

CodeContractTab

De tweede tool is static checking. Ook dit kan aangezet worden op een project. Bij het compileren krijg je dan meldingen als bij de aanroep van een method waarop niet gecontroleerd wordt of de parameter Rekening null is:

contracts: Possibly calling a method on a null reference 'rekening'

Visual Studio Team Edition ondersteuning

Op dit moment heeft Microsoft als doel om Code Contracts alleen voor de Team Editions beschikbaar te maken (en de academic versie). Op deze manier wordt het research project terugbetaald. Echter net zoals Unit Testen is het ontwikkelen met Design By Contract ook wenselijk op goedkopere versies van Visual Studio. Op het forum vraagt het Code Contracts team hierover response. Als je het team wil laten weten dat je ook op andere versies van Visual Studio Code Contracts ondersteuning wil kan dat hier: http://social.msdn.microsoft.com/Forums/en-US/codecontracts/thread/459bdcbe-8af2-4781-b1fa-eec1c9d79a52

Toekomst

Code contracts brengen mogelijkheden voor andere tools. Bijvoorbeeld voor unit testen. Hiervoor is ook via DevLabs, PEX te downloaden. http://msdn.microsoft.com/en-us/devlabs/cc950525.aspx. PEX is een tool die een unit test suite genereert op basis van onder andere code contracts waardoor de code een zeer hoge codecoverage heeft.

Samenvattend

Code Contracts is een feature die in het .NET Framework 4.0 officieel tot onze beschikking komt. Microsoft heeft een preview gereleased waarmee op het .NET 3.5 framwork al met deze functionaliteit gespeeld kan worden. Code Contracts bieden een manier om aannames in code vast te leggen op verschillende manieren. Dit wordt ook wel Design By Contract genoemd. Code contracts biedt zowel runtime als static checking van condities.

Download all PDC Content sessions and powerpoints with ease
Sat, Nov 1 2008 6:04 AM

Well, i was tired of clicking on every URL to download everything where i'm interested in from the PDC.
So i created a little application that generates 2 lists:

The list also contains the 4 keynotes.
Till now it's about 56 GB. and counting...

Day 1 and 2 are complete. Day 3 and 4 are still missing some content.
Because the list is based on the master session list on Mike Swonson's blog, which in the mean time is incorrect, this 2 lists will be incorrect also.
But nevertheless it's quite ok. You can't download the master session list there anymore so here it is, because you will need it to know which sessions you like to see.

When you use a download manager like Free Download Manager than you can import the list easily. The tool gives a good insight in the missing pieces, will skip it and download the next item in the list.

This should save you several clicks.

by Pascal Naber | 1 comment(s)
Filed under: ,
.NET 3.5 WF beta 2 SendActivity and generated proxy class
Tue, Aug 14 2007 2:24 PM

For preparing the Summer Classes of Class-A I stumbled on an exception which costs me a lot of time.

The situation was that I hosted a WF with Workflow services. The service is used by a client which is using a workflow for this also. The client workflow uses a SendActivity and the server a ReceiveActivity. (Just like the SequentialWorkflowService beta 2 sample). And like in the beta 2 sample I used a ServiceReference to connect the client to the service.

After configuring everything that is needed and running my projects, I received the following exception:

InvalidOperationException: Could not find a service endpoint with name 'ValidateCreditCardEndpoint' and contract type 'ClientWfHost.CreditCardServiceReference.IValidateCreditCard'

Well 'everyting' seems to be correct. The SendActivity its ServiceOperationInfo property is configured to the correct Interface. The ChannelTokens property its endpointName was correct and exists in the app.config. The app.config contains a single endpoint with a contract that correspondents to the name that is generated in reference.cs for the interface.
This name is configured on the ServiceContractAttribute with a ConfigurationName property which is located above the interface.
Ok found a difference here. This ConfigurationName has a different value than is configured on the SendActivity. This is how all 'references' to the interface looks like:

reference.cs: [ServiceContractAttribute(ConfigurationName = "CreditCardServiceReference.IValidateCreditCard")]
App.config contains an endpoint with: contract="CreditCardServiceReference.IValidateCreditCard"
and the SendActivity its ServiceOperationInfo property is ClientWfHost.CreditCardServiceReference.IValidateCreditCard

The solution to this problem was to make all 3 exactly the same. So I changed the ConfigurationName in reference.cs and contract in the app.config to ClientWfHost.CreditCardServiceReference.IValidateCreditCard. and voila it works like a charm. (I could also change the namespace of reference.cs) 

Not the most elegant to change generated code but I think it's perfect after a lot of hours puzzling.

by Pascal Naber | 5 comment(s)
Filed under:
CopySourceAsHtml for VS.NET 2008 beta 2
Sun, Aug 5 2007 10:57 AM

For the Summer Classes we use VS.NET beta 2 in a VPC image. For this reason I compiled the CopySourceAsHtml source against Beta 2.
Because Copysourceashtml is still not working nice in VPC's. I changed the source with Mike Glasers solution for copying source in VPC's.

You can download the source here (msi included)
The original source can be downloaded here

by Pascal Naber | 1 comment(s)
Filed under:
Tagged
Thu, Jan 4 2007 9:53 AM

I've been tagged by Dennis van der Stelt.

 

So... 5 personal things about me:

 

  1. Two weeks back, on the 24st of December 2006, our second daughter was born. Her name is 'Maud'. She is beautiful and very good in getting us out of our sleep. Our first daughter is almost 2.5 years now. Her name is ‘Britt’. If the word cute was not already find out. It would for her.
  2. I leaved LogicaCMG and joined Class-A since 1-1-2007. After having a really good time for 5.5 years it was time for a new challenge.
  3. Class-A in Woerden is not a long way from my home, but the traffic jams are terrible from Brabant to Utrecht (A27, A2, A12). This is a good excuse to get my motor driver license and after that buy a motor to drive through the traffic jams. Step 1, getting my theory is already finished. Now I have to make an appointment with a school to start practical lessons.
  4. I love reading it-related books. I like it so much I even take a bunch with me on holiday… Or is it because I have all time of the world on a holiday to read a book….
  5. Me and my brother in law are playing squash for several years. We really like playing squash. Eh correction, I like playing squash, my brother in law doesn’t like it as much as I do anymore, since I hit him with my racket and broke his nose. 

 

The people I tag are: Patrick Bes, Ilske, Carlo, Patrick Wellink and Gerke Geurts

Bye bye Virtual PC, welcome back VMware
Wed, Sep 6 2006 9:25 AM

Well I've had it with Virtual PC.
Ok it's free but the problems I experience are:

I run x64 Windows Vista & XP. But Virtual PC cannot be installed on x64 operating systems.
I have a 24" Dell monitor with a resolution of 1900 x 1200. Virtual PC only supports a maximum resolution of 1600x1200. (no I don't like black bars at both sides of my screen)

After years I tried VMware again. And well i'm glad to use it now. It seems to be faster ( but this can only be a feeling )
And I can use the maximum resolution of my monitor on the operating system I like to run.

Out of the box VMware supports 1900 x 1440 and higer(!) But when you add the following lines to the vmx file. The 1900x1200 resolution can be selected.
svga.maxWidth = "1900"
svga.maxHeight = "1200"

Virtual Server R2 2005 on the other hand do supports x64 host machines. But does not support x64 guest machines. VMware does.
It is also possible to use Virtual PC images with VMware. USB support is out of the box available with VMware.

Virtual PC 2007 will support x64 and remains free.
I don't know how long it's going to take. But looking at my current requirements, I will use VMware Workstation till Virtual PC 2007 is available. And I will take a closer look at that time.

Is www.windowsforms.net dead ?
Wed, Mar 1 2006 9:05 AM

WindowsForms.NET was a website where I came regularly.

Interesting links to articles could be found there and it was updated daily.
But the latest article link posted at this time is from july 2005.

Besides this the forum is gone (for a while now) and links to the Microsoft Newsgroups.

Are there no Codeheroes anymore these days ? The last one called out  in april 2004.
Even the name whidbey is still used in the main menu.

I guess www.windowsforms.net is declared dead ?

Or am I wrong ? Is there an up-to-date site about smartclients or something ?

Free VS.NET 2005 like docking including tabbed MDI
Tue, Feb 28 2006 7:48 PM

All kinds of Third party controls exists to make a tabbed MDI possible.

But (Dutch as I am) was looking for a good looking, free alternative.
I came across DockPanel suite.

Dockpanel suite is much more than a tabbed MDI only .
it's possible to dock panels exactly like in VS.NET 2005. (with the nice looking, user friendly navigation)
Well a picture tells a thousand words:

Weifen Luo has written this open source suite. Version 1.0 is just released which runs on both .NET 1.1 and .NET 2.0.
The source and binaries includes an example application (The screenshot above is taken from the example app)
An extensive cookbook is available for download too (VB.NET version) in a seperate download.

check it out here

Generic ASP.NET 2.0 IExtenderProvider: Solution
Tue, Feb 21 2006 10:35 PM


A couple of months back, in my spare time, I was working on an ASP.NET IExtenderProvider for .NET 2.0 (Think it was in with the september CTP)

Found some articles on codeproject about the subject:
http://www.codeproject.com/aspnet/FixingIExtenderProvider.asp by Wouter van Vugt
http://www.codeproject.com/aspnet/ExtenderProviderComponent.asp by Frank Robijn

But I made it work with the DefaultButton Control of Andy Smith as an ulimate example.

A lot of code was needed to make an ASP.NET IExtenderProvider so i tried to make a Generic base class to make it easier to implement an ASP.NET IExtenderProvider.
Actually I like the amount of code needed in Windows Forms, so tried to achief that. Unfortunately I could not make the Generic version work...

This week I needed an ASP.NET IExtenderProvider again. Found the sources from my project of last year and I was suprised to see it is working with the RTM of VS.NET and a little change in the code.

In the mean time I read Nikhil Kothari's weblog about the Atlas ExtenderControl.
The Atlas version has almost the same functionality as my version has, but it supports renaming and deleting controls from a webform.
The Atlas version is not suitable to work with standard ASP.NET, so with a little effort I added the missing functionality in my Generic version too.
Besides this I renamed my classes so they match the Atlas ExtenderControl.

The ExtenderControl I made is based on the DefaultButton Controls of Andy Smith. The Atlas version has a quite different solution.
The Designer is the IExtenderControl in stead of the ExtenderControl itself for example. Because of this no custom Designer is needed when you use my ExtenderControl.

Anyway, now you can make an ASP.NET 2.0 IExtenderProvider with a minimal effort.
When making a IExtenderProvider yourself you have to follow the next 2 steps:

Step 1: Defining the Extender properties :

    9 public class ValidationProperties : TargetControlProperties

   10     {

   11         [NotifyParentProperty(true)]

   12         public bool ValidationEnabled

   13         {

   14             get

   15             {

   16                 object savedState = (ViewState["ValidationEnabled"]);

   17                 return (savedState == null) ? false : (bool)savedState;

   18             }

   19             set

   20             {

   21                 ViewState["ValidationEnabled"] = value;

   22             }

   23         }

   24     }

 

Step 2: Implement the Extender Control:

   17  [

   18     ProvideProperty("ValidationEnabled", typeof(Control)), // Names the Property to show on other controls in the designer

   19       Designer(typeof(ExtenderControlDesigner<ValidationProperties>))

   20     ]

   21     public class ValidationProvider : ExtenderControl<ValidationProperties>

   22     {

   23         /// <summary>

   24         /// Defines the controls which can be extended.

   25         /// </summary>

   26         /// <remarks>

   27         /// In general, the Page, the Form, and buttons cannot be extended.

   28         /// </remarks>

   29         public override Boolean CanExtend(Object target)

   30         {

   31             if (target is Control && !(target is ValidationProvider))

   32             {

   33                 return true;

   34             }

   35             return false;

   36         }

   37 

   38         /// <summary>

   39         /// gets the property value for the given control

   40         /// </summary>       

   41         public bool GetValidationEnabled(Control control)

   42         {

   43             return EnsureControlItem(control).ValidationEnabled;           

   44         }

   45 

   46         /// <summary>

   47         /// sets the property value for the given control

   48         /// </summary>

   49         public void SetValidationEnabled(Control control, bool validationEnabled)

   50         {

   51             EnsureControlItem(control).ValidationEnabled = validationEnabled;           

   52             NotifyDesignerOfChange();

   53         }

   54 

   55         private ValidationProperties EnsureControlItem(Control control)

   56         {

   57             if (control == null)

   58             {

   59                 throw new ArgumentNullException("control");

   60             }

   61             ValidationProperties item;

   62 

   63             if (this.TargetProperties.Contains(control.ID))

   64                 item = this.TargetProperties[control.ID];

   65             else

   66             {

   67                 item = new ValidationProperties();

   68                 item.ControlId = control.ID;

   69                 this.TargetProperties.Add(item);

   70             }

   71             return item;

   72         }   

   73     }


This looks a lot like the amount of code needed to make an IExtenderProvider in Windows Forms.


Download the full source here (you have to add a webproject yourself)

I have to add a disclaimer for the use of this source because this control is not being tested thoroughly or even used till now, it can contain serious bugs!
I didn't even added XML documentation and such. (shame on me) .


The source contains a solution with 2 projects:
Naber.Web.UI                   Contains the base classes to use when making an IExtenderProvider
Naber.Web.UI.Controls      An example ASP.NET Provider using the Generic baseclasses

 

Let me know what you think about this.


 

 

 

 

 

by Pascal Naber | 2 comment(s)
Filed under:
Lego Mindstorms NXT
Thu, Feb 16 2006 10:40 AM

This year, in august, Lego comes with a complete update of their Mindstorms set. Called Mindstorms NXT.

Long time ago, when I was a little kid (2 weeks ago ;-) ), I used to play a lot with Lego. But I've never played with Mindstorms.
I think it's great,so I know what to ask for christmas already ;-)

It's possible to preorder here:  for 299 Euro !

We will see if the .NET Lego community comes with support for this NXT version.

The next generation of robots!

Create the smartest, strongest and most advanced LEGO® robot ever, in as few as 30 minutes! The new NXT Intelligent Brick, your robot's "brain," features a powerful 32-bit microprocessor and more memory, plus support for USB 2.0, Bluetooth and more!

A highly versatile palette of LEGO TECHNIC® elements combines with state-of-the-art ultrasonic, sound, light and touch sensors in the next generation of intuitive robotics. With the included Quick-Start guide, easy-to-use software and step-by-step building instructions, beginners and experts alike can create humanoid, vehicle and animal robots that obey every command!

Improved light sensors can detect different colors and intensities, while the new sound sensor enables robots to respond to sound patterns and tones. Robots can really "feel" with improved touch sensors, while ultrasonic "eyes" measure distance and movement.

Programming software is now available for both PC and Macintosh, plus with Bluetooth support, you can even command your robot from your mobile phone!

LEGO® MINDSTORMS® NXT Includes:

  • All-new NXT Intelligent Brick with 32-bit microprocessor, more memory and FLASH
  • 3 Interactive Servo motors feature built-in rotation sensors to align speed for precise control
  • New sound sensor reacts to sound commands, patterns and tones
  • New ultrasonic visual sensor responds to movement
  • Improved touch sensor reacts to touch and release
  • Improved light sensor detects different colors and light intensities
  • 519 specially selected LEGO TECHNIC elements for sturdy and durable building and improved functionality and movement
  • 4 input ports, 3 output ports and 7 6-wire cords
  • Matrix display
  • Piezo speakers
  • USB 2.0 and Bluetooth support
  • Easy-to-use PC and Mac compatible interface
  • Intuitive, icon-based drag-and-drop program "building" environment


Second place for the Internal RAD Race 2006
Sun, Jan 22 2006 7:53 PM
As your could read on Mike Blaaks blog, LogicaCMG organized the Internal RAD Race 2006 last weekend.
It’s a game between 10-12 teams. Each team exists of 2 persons and basically are using Oracle, Java or Microsoft software.
The assignment for the teams is known on the day we begin but comes always near to a real-life business case.

In short: This year we had to build a webapplication for licenseplate registration in the EU.

Teams are allowed to use all software, tools and libraries you can think of, but during the Race no Internet access is allowed (USB keys are not allowed also)


Fijsjan Heijkoop and I were team 7 and used the following toolset: 

- VS.NET 2005 
- SQL Server 2000 (2005 was way too slow for a RAD race :-( ) 
- NHibernate 1.0 
- MyGeneration Code templates (custom build) 
- And our own code libraries specially build for this RAD Race.  

With 6 weeks preperation in our spare time (and some days of LogicaCMG) we took the 2nd place !
(after an Oracle team, but before all Java & other Microsoft teams)

 It was really fun (and exhaustive. )

Hope we can kick Oracles ass next year...;-)

 

 

 

More Posts Next page »