July 2012 Entries

ResolveUrl() from WCF service

I wanted to ResolveUrl() from WCF service and foundhttp://www.west-wind.c... .However the function assumes that the call is synchronous, in asynchronous call (e.g called from TPL task) HttpContext.Current==null.I had to split my asynchronous method into two-a long asynchronous one, invoked as task and generating relative URL and a post-task, that is calling wwWebUtils.ResolveServerUrl... http://www.codeproject.com/... ......

DataContractSerializer truncated string when used with MemoryStream,but works with StringWriter

We've used the following DataContractSerializeToXml method for a long time, but recently noticed, that it doesn't return full XML for a long object, but truncated it and returns XML string with the length of multiple-of-1024 , but the reminder is not included. internal static string DataContractSerializeToXml&... obj) { string strXml = ""; Type type= obj.GetType();//typeof(T) DataContractSerializer serializer = new DataContractSerializer(type); System.IO.MemoryStream aMemStr = new System.IO.MemoryStream(); ......

Convert collections of enums to collection of strings and vice versa

Recently I needed to convert collections of strings, that represent enum names, to collection of enums, and opposite, to convert collections of enums to collection of strings. I didn’t find standard LINQ extensions.However, in our big collection of helper extensions I found what I needed - just with different names: /// <summary> /// Safe conversion, ignore any unexpected strings/// Consider to name as Convert extension /// </summary> /// <typeparam name="EnumType"></typ... ......

«July»
SunMonTueWedThuFriSat
24252627282930
1234567
891011121314
15161718192021
22232425262728
2930311234