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.....