Wednesday, 8 May 2019

IntelliSense in SQL Server 2008 R2 Management Studio stops working (most of the time)

After installing Visual Studio 2010 Service Pack 1, the IntelliSense in SQL Server 2008 R2 Management Studio stops working (most of the time).

The fix is to install SQL Server 2008 R2 Service Pack 1.

The fix for this issue was first released in Cumulative Update 7. For more information on Cumulative Update 7  click here.

Because the builds are cumulative, each new fix release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2008 R2 fix release. I recommend installing SQL Server 2008 R2 Service Pack 1 or Service Pack 3.

I hope this was informative. Please feel free to leave comments, if any.

Microsoft Dynamics CRM - Global Option Sets (Picklists)

CRM 2011 was released with many new features. New features were added in the core application, configuration and extending CRM. One of the most appreciated new feature is Global option sets. The other name given to it is Global picklists.

In Dynamics CRM 4.0 there were local option sets. Let's say the requirement is to have a country option set in 10 different entity forms. In order to have the country list, we need the country option set in all the entities and so we need 10 country option sets. All these 10 country option sets had same items in it. If we change the name of a country or add a new country, then we need to make a change at all 10 places. Dynamics CRM 2011 has improved upon this limitation. We can have one global option set for a country. Then each country list in every entity can derive from this "country Global option set". In case any changes are there, it will be done at one place and all derived lists are updated.

I will show how to create and use a global option set. I will create a global option set for the country. I will add few countries and then create a local option set in the entity "Movie". The local option set on the "Movie" form will be derived from this global option set. For the clarity of this demo, I have marked important sections on the screen shots by a green rectangle.

1) I will go to my unmanaged solution "Movies". I am soon planning to write a blog on Unmanaged Solutions.

Click on the component "Option Sets" from the left navigation. This will open the list of all my option sets in this solution. All the option sets added here will be Global option sets. These global option sets are part of the solution "Movies" which later can be deployed from one environment to another as part of a managed solution. Click on New button.

Click New button to Add a new Global Option Set
Click New button to Add a new Global Option Set

2) The new Global option set window opens. "Display name" is the label of this Global option set. "Name" is the unique Schema name and Logical name for this Global option set. Add the countries as options (also called as items in CRM lingo). Each country I add will have a Label and a Value. I suggest to accept the default "Value" assigned by CRM.

New Global Option Set Window
New Global Option Set Window

3) I entered few countries to this Global option set. The Global option set window will look like below. Save and close.

Create a new Global Option Set for Countries
Create a new Global Option Set for Countries

4) I will create a local option set for the entity "Movie". Click on New to create a new field for entity "Movie".

This new option set field for Movie is derived from the Country Global option set. This Movie option set will display all the countries defined in the step above.

New Country field for
New Country field for "Movie" Entity

5) Add the required fields. Pay special attention to the "Type". The Type of this field is "Option Set".
I will select "Yes" to the option of use existing option set.

Select the Country value against the option set. This is where our local field will reference to any Global option set we select.

Leave default value as unassigned. Save and close.

Add this new field on the entity form. I then click on "Publish all Customizations" for my solution. This will publish all the above changes and make the new field available on the form.

Configure the new field as Country Global Option Set
Configure the new field as Country Global Option Set

6) Go to any existing record for the entity. I have opened the Movie record "GoldenEye" and find the Country option list. I can select any country from the list. Any changes to the Global option set will be automatically reflected here and at all the places which refers to it.

Use the new field on the
Use the new field on the "Movie" Entity Form

I hope this blog about CRM 2011 feature of Global Option Sets (Picklists) was informative. Please feel free to leave comments, if any.

Unit Testing for CRM 2011; Plugins, Custom Workflow Activities and Custom .Net Code

Every time we write a plugin and a custom workflow activity, we should make sure it works as desired. The business logic we write within these plugins and custom workflow activities, should accept the business confirmed parameters and should perform the agreed operations.

The above holds true each time we change these plugins and custom workflow activities. Every time we make a change, the plugins and custom workflow activities again need to be tested and verified. Unit testing in Visual Studio 2010 (out of the box) helps us achieve this process. In unit testing we will always need to Mock the CRM contexts and the data.

“Moq” mocking library can help in writing unit tests for CRM 2011 plugins and custom workflow activities, by mocking the CRM context and makes it easier to pass parameters and define the results.

Moq (pronounced “Mock-you” or just “Mock”) is the only mocking library for .NET developed from scratch to take full advantage of .NET 3.5 (i.e. Linq expression trees) and C# 3.0 features (i.e. lambda expressions) that make it the most productive, type-safe and refactoring-friendly mocking library available. And it supports mocking interfaces as well as classes. Its API is extremely simple and straightforward, and doesn’t require any prior knowledge or experience with mocking concepts.

The below screen shot shows the skeleton of how the MOQ can help us in Mocking (the CRM 2011 context). After Mocking, we can unit test by changing input parameters as we do with any other .Net unit testing.

MOQ: Mocking the CRM 2011 Context for Unit Testing in Visual Studio 2010
MOQ: Mocking the CRM 2011 Context for Unit Testing in Visual Studio 2010

I hope this was informative. Please feel free to leave comments, if any.

Friday, 1 March 2019

Introduction to Edge Analytics

Edge analytics is the way data is collected and analyzed. It is a way in which automated analytical computation is performed on data at a sensor, network switch or other devices instead of waiting for the data to be sent back to the centralized data store.

The reason why edge analytics is gaining more and more importance and attestation is due to the Internet of Things (IoT) model of connected devices becoming more prevalent. In many organizations, streaming data from manufacturing machines, industrial equipment, pipelines and other remote devices connected to the IoT creates a massive glut of operational data, which can be difficult and very expensive to manage. The decision making process is faster as the data time between data generation and data analysis is decreased due to edge analytics. Due to Edge no time is wasted in sending data to a central location and waiting for the analysis, edge is here and now.
IoT Edge Analytics

Edge analytics offers few key benefits: 

  • Reduces Latency and Improves Agility

As data is analyzed closer to the source it makes the analysis far more agile. This is true where data is flowing form IoT sensors like CCTV camera, oil rigs, aircraft and remote manufacturing environments. The decisions can be made faster.
  • Decrease in Operation and Storage Costs

Not all data is important and with edge analytics now there is no need to store data in the hope that one day it might be useful. Edge creates a better and more agile process around data collecting and analytics. For example, as long as the self driving car of the future is running fine the data doesn’t need to be collected. This can be achieved by selective processing of the data which is facilitated by Edge Analytics.
  • Works in a Low Bandwidth Environment

Some IoT environments like the oil wells and connected vehicles generate significant amount of data that can overwhelm the bandwidth, but by having analytics on the edge the requirements of the bandwidth can be reduced. 
  • Cost Effective and Reliable

Edge analysis provide a very cost effective solution. It is also necessary to ensure the economics of IoT makes sense. Should any failure occur in the analytics system the recovery is generally faster even in remote locations.  Equipment failure can be avoided through preventative maintenance undertaken when actually needed, rather than at fixed periods in a predetermined schedule.
  • Linear Scalability

Edge Analytics architectures can scale linearly as IOT deployments grow. As IOT applications are inherently distributed, it is logical to process IOT data in a similar fashion. As the number of sensors and network devices grow, the amount of data that they collect also grows exponentially and it increases the strain on the central data analytics resources to process these huge amounts of data.
  • Lowers Inventory

Maintenance crews have an earlier and more precise visibility into future failures and breakdowns, making a spares inventory vastly more efficient.