Add GUID as primary key column in code-first migration

Last week, I was migrating an old ASP.NET MVC project and as part of that I decided to replace the identity column from auto-incremented numeric value to GUID values which looks more professional.

Below are the changes that you need to make to achieve this.

// in your model class.
public Guid Id { get; set; }


Run, Add-Migration command which generates your migration class and make below change:

// in your migration class.
AlterColumn("dbo.LoLChampionPickeds", "Id", c => c.Guid(nullable: false, identity: true, defaultValueSql: "newsequentialid()"));

That's it. Now do an Update-Database and your Id field will start using GUIDs.



Cortana coming to Android and iOS - Deal or No-Deal?

Fear, Uncertainty and Doubt. That's everyone had when they first heard the flash news - Cortana is coming to both Android and iOS platform.

Cortana is branded as the world's best personal assistant developed for Windows platform. Cortana is the digital personal assistant in Halo game series, with self-evolving artificial intelligence. Cortana in Windows platform is self-evolving too; learn and adapts based on user's usage and pattern. Besides, Cortana has a personal touch when compared with similar services in other platforms and the service is well impressive and interesting too. You feel like you are interacting with a person digitally unlike robotic interactions.


When the news broke out, the internet community said it's because Microsoft is struggling for relevance. Well, that's also true to an extend. But, there is a threat hidden deep inside that move. Any guess? The threat is to Google itself. No. No. No. It's not about people using Cortana in Android will switch to Windows Phone. But, it's the other way round. Let me explain.

In the smartphone race, Andoid has an upper-hand. Smartphones made people caring more about apps and apps. The users know which app they need to download and install for accessing particular service. Let me say, for example, you want to know hotel/resort ratings you'll directly use Tripadvisor app. Similarly, for searching for a video, you'll use YouTube app or similar. That's it. Now, think about pre-smartphone era, the desktop time where we were too lazy to type-in or remember any website urls/addresses, where we load our favorite search engine and type-in the search term like - 'tripadvisor' or 'hotel casion royale tripadvisor' and relied on search engine to do the job. This trend is slowly declining with the penetration of smartphones and search engines are losing revenue in that aspect, not as large chunk but slowly and steadily. No search engine can escape from that, because changes are as part of the evolution.

Now, back to the topic - Cortana coming to Android and iOS. Bing is the decision engine from Microsoft and is way behind in the search engine market share and Google is still the favorite search engine for the world. That's undeniably true. If Microsoft tries to compete against Google search engine to bring the perception that Bing is as good as Google or Bing is better than Google, then it going to a do-or-die model with an unknown timeline. What if Microsoft is successfully enough to make people use Bing service without telling them they are actually Bing service.

Well that's what going to happen right now. Cortana is powered by Bing. Yes, you heard it. All those who knows Windows Phone also knows about Cortana and likes the personal touch. When people start using Cortana in non-windows platform like Android and iOS, in effect, they are using Bing services indirectly. And, Android and iOS combined has a huge volume of smartphone share. Imagine what happens when people start using Cortana in those platforms thus gives steady rise in Bing service usage. Just in case, if you don't know Apple's Siri is powered by Bing service.

Bing is more that a search engine; it's a decision engine. It's a platform which is spreads across on every underlying core services and powering it Up, like powering Cortana, powering Siri to name a few.

Once a wise man said - "If you can't win the game, Change the game". That's the takeaway.


Universal Windows development in Windows 8.1 and Windows 7

The bold concept Windows 10 introduced was Universal Windows Platform (UWP) - "Write once, Deploy anywhere" truly and literally. To make it more simple and clear, if you create Universal Windows application, then you can run the same app in variety of devices ranging from Desktop, Tablet, Mobile and upto your holographic computer (HoloLens) without recompiling your code. Initial requirement for UWP app development was Windows 10 and Visual Studio 2015.

Things have changed now! With the recent announcement at //build/ 2015, you can develop UWP app in Windows 8.1 and Windows 7 operating system using VS2015. But, please note the experience may defer. For example, if you are developing UWP app in Win 8.1/7, then you cannot deploy the app to your Local Machine or to any simulators. Instead, you need a real device for development and testing. The exception is, Mobile emulators will be there. Also, XAML Designer support will not be there, but Intellisense is. For developing UWP in Windows 7, you need to wait till VS2015 hits RTM.

Here is a screenshot of UWP OS support which was share during //build/ 2015 event.

This is a welcome change. There is always a large community who cannot immediately migrate to Windows 10 exclusively for UWP app development. This move will definitely help them and those who are hesitant to update to developer preview of Windows 10.