Blog Site
​​

damian.jpg 

MVP 

Welcome to Remoting Coders Blog, here you will find articles written by our CEO Damian Sinay, Most Valuable Professional (MVP) for Dynamics CRM and also by our team developer’s members were we will try to share our most daily experience when dealing with Windows, SharePoint and Dynamics CRM issues. Enjoy!. ​
Nov 08
Try Dynamics 365 v9.0

Microsoft has released a new version of Dynamics CRM online called Dynamics 365 v 9.0

You can try it now by clicking on this link

https://portal.office.com/partner/partnersignup.aspx?type=Trial&id=2781de52-fe91-41de-b3f5-46e832b092cb&msppid=585256 

 

The new Dynamics 365 has new great features and a new redesigned user interface which server performance has been improved like never before. Some of the new features are the addition of virtual entities, multiple option sets, auto numeric fields, new unified interface.


Dec 09
Improving performance of CRM 2016/Dynamics 365 queries in C#

 

Previous version of Dynamics CRM (2011, 2013 and 2015) used to have a class called CachedOrganizationService, that was part of the Microsoft.Xrm.Client.dll Assembly. The new SDK for 2016 and Dynamics 365 doesn't come with that assembly anymore and the connection classes has been moved to the Microsoft.Xrm.Tooling.Connector.dll assembly. However, this class doesn't come with the CachedOrganizationService, if you had an application that used that class and you want to upgrade the code to work with the latest SDK 2016 Dynamics 365 assemblies you will need to manage the caching manually, here is a sample way you can use to improve the queries performance executed by the RetrieveMultiple method of the IOrganizationService interface that is part of the Microsoft.Xrm.Sdk

private MemoryCache _objectCache = null;
public EntityCollection RetrieveMultipleCached(Microsoft.Xrm.Sdk.Query.QueryExpression myQueryExpression)
{
    EntityCollection entityCol = null;
    ObjectCache cache = MemoryCache.Default;
    if (cache.Contains(myQueryExpression.Serialize()))
    {
        entityCol = (EntityCollection)cache[myQueryExpression.Serialize()];
    }
    else
    {
        Microsoft.Xrm.Tooling.Connector.CrmServiceClient conn = new
Microsoft.Xrm.Tooling.Connector.CrmServiceClient(ConfigurationManager.ConnectionStrings["Xrm"].ConnectionString);
        crmService = (IOrganizationService)conn.OrganizationServiceProxy;
        entityCol = crmService.RetrieveMultiple(myQueryExpression);
        cache.Add(myQueryExpression.Serialize(), entityCol, DateTime.Now.AddDays(30));
    }
    return entityCol;
}

You need to be very careful when you use this method as in the case the data changes frequently this way is not recommended, in case you know something changes in the entity data you can invalidate the cache by using a plugin.

To invalidate the cache you will need to manually remove the items as follows

foreach (var element in MemoryCache.Default)
{
MemoryCache.Default.Remove(element.Key);
}

Other recommendations include making the connection object static so you don't need to create the CrmServiceClient on every request.

Enjoy!

 

Nov 17
Try Dynamics 365