Skip to main content

Posts

Showing posts with the label C#

Handling Concurrency in Azure Functions (HTTP Triggered)

Concurrency & Isolation Concurrency is one of the most common requirements when we don't want the resource to be accessed by multiple requests at the same time. Lets say we have a Database that holds products stock information, then it is very important that any read/write operation that happens on the Database must hold the property of Isolation . The isolation property ensures that the concurrent execution of transactions results in a system state that would be obtained if transactions were executed sequentially, i.e., one after the other. Providing isolation is the main goal of concurrency control. Depending on the concurrency control method (i.e., if it uses strict – as opposed to relaxed – serializability), the effects of an incomplete transaction might not even be visible to another transaction. Options Available in Azure Functions Recently while working on Azure Functions, I discovered a really simple way of handling Concurrency via code. There are ways to con...

Retrieve 5000+ Records in Dynamics 365 CE using CRM OData, Fetch XML and C#

If you want to retrieve 5000+ records in Dynamics 365 CE, you need to make use of Paging concept of CRM. By default 5000 records are retrieved in a single OData call in CRM. To get more, you need to make subsequent calls to OData Endpoint by passing a paging cookie in the request. I will be using a simple C# Console Application to retrieve 5000+ records from Dynamics 365 CE, by making use of OData API Endpoint provided by CRM and passing Fetch XML in OData Call . Concept: CRM OData Endpoints allows us to use Fetch XML to retrieve data from Microsoft Dynamics 365 CE.  If your resultset has more than 5000 records, you will be returned with first 5000 records ONLY in one OData call. To know if the resultset has more than 5000 records, we make use of the response from OData call. The response is added with a cookie value contained in a key - "@Microsoft.Dynamics.CRM.fetchxmlpagingcookie" If you wish to fetch the next set of resultset data, you will have to pass this c...

StyleCop Issues in C# Code - How to get rid of them real quick !!

Are you not able to checkin your code because of the Gated Checkin Policy due to StyleCop issues in your code ? Do you have hundreds and hundreds of StyleCop issues to fix in short time ? Are you looking for ways to quickly/automatically Fix StyleCop issues in your C# code ? Then in that case, you have two options: Use Resharper Resharper is a great tool for fixing such issues, but it comes with a licensing cost. Use Free extensions available in Visual Studio marketplace Wouldn't it be nice if we could have a Visual Studio Extension that could fix all the StyleCop issues for us, and is FREE at the same time. Well there is one, available as a Visual Studio Extension, its called " Code Formatter ". This tool in combination with StyleCop works very efficiently in resolving most of the StyleCop issues in code. Below are some of the features of this tool: • Format the class file (.cs) to arrange members of class in the proper order. • Using statements ...