Geeks With Blogs

News My Blog has been MOVED to
Michael Freidgeim's OLD Blog My Blog has been MOVED to 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... ......

Posted On Saturday, July 7, 2012 9:51 PM

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(); ......

Posted On Saturday, July 7, 2012 9:29 PM

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

Posted On Saturday, July 7, 2012 9:10 PM

Copyright © Michael Freidgeim | Powered by: