Wednesday, January 16, 2013

Enable Quick Launch in Webpart Pages in SharePoint 2010

DataMember not coming into CollectionDataContract class – WCF



While working with WCF CollectionDataContract class, I have found very weird problem. we don’t have a way to add DataMember property into CollectionDataContract class.


Though I have found some links which talks about alternate way to populate/add data members into CollectionDataContract class.


How to get MIME type of file in C#



There is no direct way to get MIME type of file in C#, I have tried couple of options but didn't get any luck. though there are some WIN 32 registry and InteropServices classes from where we can get MIME type but I feel it’s too much code for getting MIME type. instead of using these classes I have found static solutions for getting MIME type, it's switch-case code for all the available MIME type based on the file extension (I know solution is not GOOD with all static file extension and MIME type)

Reference Links:



Link for list of common MIME types and their corresponding file extensions: http://www.webmaster-toolkit.com/mime-types.shtml

If anyone find any better solution then Please share here ;)

Monday, January 14, 2013

Differences between Web Services and WCF Services



.NET Framework 3.5 and higher version has introduced WCF services. Most of the time we don't know what are the advantages to use WCF services over traditional web services.

Here is very good link which talks about in-depth differences between web services and WCF services:

http://www.codeproject.com/Articles/255684/Create-and-Consume-RESTFul-Service-in-NET-Framewor




We can use two types of serialization in WCF : XmlSerializer and DataContractSerializer. Both has its own advantages-disadvantages over other.

Link for differences between XmlSerializer and DataContractSerializer :  http://www.danrigsby.com/blog/index.php/2008/03/07/xmlserializer-vs-datacontractserializer-serialization-in-wcf/
 

How to read XML elements from C#