Thursday, December 10, 2009

Handling Change in WCF contracts.

The following is from the url

http://www.devx.com/dotnet/Article/42005/0/page/3

  1. Always use the Name and Namespace parameters on all contracts.
  2. Always use the Order parameter on data members.
  3. Implement the IExtensibleDataObject on all data contracts.
  4. Use namespaces for contract versioning.
  5. Always remember that new versions require new endpoints.
  6. When using strict schema validation, do not change contracts. Create new versions.
  7. When removing an operation from a service contract, create a new version.
  8. When changing the signature of an operation, create a new version.

Wednesday, September 9, 2009

Issue exposing an orchestration as a wcf service

You built your orchestration, deployed it and tested it with a file port everything works fine.... cool

now you want to expose the orch as a wcf/asmx service, we launch the wcf publishing wizard and after specfying the name space you find that there are no public ports, ok, we go modify the the preceive port to Public and then launch the WCF Publishing wizard again, we still get the same error message,,,,,,

I wonder why??

Resolution:
un gac the orchestration assembly and then we try again, still the same error

I wonder why???

Restart visual studio and open the project and viola we can publish the orch as a service now,......

Tuesday, July 7, 2009

Assert.AreSame dosent compare the properties of the two instances

as you guessed it dosent compare the properties but the pointer, so even if the two instances are initialzed to the same properties it will always fail.

the solution (Reflection).
http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=442

Monday, April 27, 2009

gacutil path for VS 2008

c:\Program Files\Microsoft SDKs\Windows\v6.0A\bin

Sunday, March 29, 2009

BizTalk and Dublin.

My take on it.

BizTalk will be used for integrating LOB applications EDI, Rosettanet and HIPPA, which it has proven over and over....

Dublin: use it for hosting traditional WCF and WF services, using BizTalk is way a big overhead and moreover Dublin is going to be free

But down the line, someday BizTalk will be replaced.......

Tuesday, March 24, 2009

Testing events in VSTS

Create a anonymous delegate and a variable to set
ManualResetEvent statsUpdatedEvent = new ManualResetEvent(false);
bool serviceFaulted = false;

Classevent += delegate
{
System.Diagnostics.Debug.WriteLine("Runtime faulted");
serviceFaulted = true;
statsUpdatedEvent.Set();

};

do some operation to trigger the event.
.......
Wait for the event to trigger
statsUpdatedEvent.WaitOne(5000, false);

then

Assert.IsFalse(serviceFaulted);


This is taken from the following link

http://www.philosophicalgeek.com/2007/12/27/easily-unit-testing-event-handlers/

Thursday, March 19, 2009

wshttpbinding - httpsys - netsh - certificates

http://mtaulty.com/CommunityServer/blogs/mike_taultys_blog/archive/2005/11/17/5628.aspx

step 1
"makecert -r -pe -n "CN=localhost" -b 01/01/2000 -e 01/01/2036 -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localMachine -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12"

step2
httpcfg.exe set ssl -i 0.0.0.0:9091 -c "MY" -h XXXXXXXX

for vista and 2008

appid int he netsh http add sslcert is nothing but a new guid(Create one).


http://www.inventec.ch/chdh/notes/14.htm
-------------------------------------------------------------
server 2008 and vista

http://msdn.microsoft.com/en-us/library/ms733791.aspx

appid int he netsh http add sslcert is nothing but a new guid(Create one).

Wednesday, March 18, 2009

Testing email in .NET

Testing email in .NET require us a smtp server for send a pop3 to download, smtpserver is not a problem but POP3 is there are lot of products that are out there which are not free(may be a evaluation period), you can use a Exchange server(this according to me is a pain becasue of setting up AD and all) another solution might be using your inbox,but that dosent qualify as a unit test.

the simple solution is use nDumbster

http://ndumbster.sourceforge.net/default.html

Serialize and deserialize a workflow ruleset

Serailze

private void SerializeRuleSet(RuleSet ruleSet)
{
StringBuilder ruleDefinition = new StringBuilder();
WorkflowMarkupSerializer serializer = new WorkflowMarkupSerializer();

if (ruleSet != null)
{
try
{
StringWriter stringWriter = new StringWriter(ruleDefinition, CultureInfo.InvariantCulture);
XmlTextWriter writer = new XmlTextWriter(stringWriter);
serializer.Serialize(writer, ruleSet);
writer.Flush();
writer.Close();
stringWriter.Flush();
stringWriter.Close();
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
}
}
else
{

}

XmlDocument rule = new XmlDocument();
rule.LoadXml(ruleDefinition.ToString());
rule.Save("c:\\message.xml");
}

Deserialize


public static RuleSet GetSampleRule(string type)
{

ruleSetXmlDefinition = GetEmbeddedTextFileContent("EsbMsgSampleRule.xml");


WorkflowMarkupSerializer serializer = new WorkflowMarkupSerializer();

StringReader stringReader = new StringReader(ruleSetXmlDefinition);
XmlTextReader reader = new XmlTextReader(stringReader);
return serializer.Deserialize(reader) as RuleSet;
}

Tuesday, March 17, 2009

Saturday, March 7, 2009

Type Converters to the rescue.

Issue:
We had a a requirement to make our property grid Read only,the out of the box propertygrid provided by the .net framework even disable the ellipses button for a collection property of my class(array...etc) so there is no other way of looking into all the collection elements.

Solution:
Create a TypeConverter class and overwrite the CanConvertTo and ConverTo methods, what i did was i Converted the array into a delimited sting and decoreated my class property with this coverter class and now in the propertyGrid is see a delimited string instead of a collection object.

the example is as follows.....

Tuesday, January 6, 2009

Testing in biztalk 2009i

Well one of the drawback that i found is we cannot test the out of the box built in pipelines.....

well why do you want to do it???, because i want to test a transform, i want to see if my flat file is getting disassembled properly....etc, you can over come this by creating your own pipelines(a copy of the default ones with the same components)......

Tomas's testing library handles this very nicely...