How To: Retrieve Entity Metadata In CRM Using C# SDK

Introduction : Suppose you would like any kind of Metadata  about an entity such as "IsCustomEntity","IsCustomizable","ObjectTypeCode" & "PrimaryNameAttribute".

Code:

//Create RetrieveEntityRequest
RetrieveEntityRequest retrievesEntityRequest = new RetrieveEntityRequest
{
EntityFilters = EntityFilters.Entity,
LogicalName = entityName
};

//Execute Request
RetrieveEntityResponse retrieveEntityResponse =(RetrieveEntityResponse)_serviceproxy.Execute(retrievesEntityRequest);

codeNote: you can find how to create service proxy at the following link http://crmprof.wordpress.com/2013/03/13/creating-organization-service-proxy-in-microsoft-dynamics-crm-2011/