Skip to main content

Posts

EF warning while using Database first approach

Error 6002: The table/view 'AdventureWorks.dbo.BuildVersion' does not have a primary key defined. The key has been inferred and the definition was created as a read-only table/view. Explanation: The above warning is generated when you use Database first approach for Entity Framework model creation. Such warning appears due to entity key. Every Entity needs to have an entity key and when EF creates an entities, what it does is, it tries to find an primary key from the database and creates an entity key from that.  But it may be the case that few of the database objects doesn't have primary key defined. In that case, EF tries to infer a key based on your view or table's columns. So, here it becomes necessary to have at lease a non-null column in your database object.  It's just a warning, so nothing harmful here. But still if you need a solution to get rid of this warning, then it is posted by Hilmi Aric.

Visual Studio Extension for Installer Templates

Finally Installer Projects templates are back with Visual Studio. Hope most of you are aware that few years back, Microsoft removed the templates for installer projects from Visual Studio and we all were obliged to use InstallShield.  Till Visual Studio 2010, these templates were shipped along with VS but post releases were not having these templates. But user voice and vocal feedbacks made this possible and now these templates are again part of Visual Studio 2013 and will continue to be the part in all the Visual studio’s future versions. This Extension can be downloaded either from Visual StudioGallery or by using ‘Extensions and Updates’ dialog’s online section with a search string as ‘Visual Studio Installer Projects Extension’. Important point to mention here is, Visual Studio will still provide the in-box solution for InstallShield limited edition. As of now, this update is part of preview release version;)

Deadlock and Livelock

Deadlock:  Deadlock is a situation when two processes, each having a lock on one resource and attempt to acquire a lock on the other's resource. In this case, each process would have to wait indefinitely until one of them releases the lock on the holding resource. Livelock:  Livelock is a situation, where in a request for an exclusive lock  is repeatedly denied because of series of overlapping shared  locks keeps interfering. A  livelock also occurs when read transactions monopolize a resource(file/page/memory location), forcing a write transaction to wait indefinitely.

Controlling Degree of Concurrent Execution in Parallel Loops

Having multi-core machine, one can get the benefit of Parallelism for long-running and blocking tasks. I hope most of you might have used Parallel. For, Parallel. Foreach and TPL several times. Generally parallelism is used to get the benefits of all the available cores on the machine that commonly leads to the shortest execution time for any task. Did you ever thought about what can be the possible demerits of using all the available cores for just a single application? Is it really required to use all the available cores of your machine for a single application? Can't we use only a few of the cores? Is there any way to restrict these parallel loops in terms of cores? The answer of all the preceding questions is YES . But why should we bother about how many cores are participating in execution? Well, there can be several reasons behind this.  The foremost reason  that I feel is, when a single time consuming application/task is running on all the available cores utili...

New features of Windows Phone 8.1

2 nd April 2014, during the //BUILD 2014 conference Microsoft officially showcased the set of new features which will be coming as part of Windows   Phone 8.1.  In my this post, I am touching those features. 1) Cortana - new personal assistant:  Cortana is voice-based virtual assistant provided by Microsoft. It is similar to Apple’s ‘Siri’ and is powered by Bing. It can do everything that one would expect from any virtual assistant. Cortana offers advanced settings and preferences with more than the default voice commands. One can talk with her and can also give her instructions to perform any operations behalf on you. Cortana is fully based on your search queries, she learns your interests, she learns about the most important people in your life. For example, you can instruct her “Cortana, call Shweta on Skype” and it will open Skype to call the person. Isn’t it interesting ? You can also use Cortana to set reminders by saying “Cortana, remind me to go to parlo...

Cursor Position on Enter key

Recently, one of my followers requested for a code snippet to implement the ENTER key press. The requirement was to move the cursor on the next WPF UI element, whenever the ENTER key is pressed. Implementation of the above requirement is straight forward, if one has the knowledge of InputBindings and Command. Using these two, MoveFocus method of currently focused element, can be called, as shown in the mentioned below code snippet: Hope it will help you.

Restoring Nuget packages in less annoying way

Hope most of you are aware of Nuget packages. It is a way to get 3rd party libraries into your project. Nuget also makes developer's life easier by checking for updates for all the available libraries. Apart from this Nuget also provides package restoration option, which is disabled by default. Another annoying thing about restoration is, it is very very slow. So, it means that until your restoration is complete, you can not do anything. What is the solution or workaround of this slow restoration of Nuget package ? Well, one workaround can be instead of restoring packages from Visual Studio, why can't we do it outside of Visual Studio. Interesting, isn't it ??? A Very simple and straight forward command to do this is: NuGet.exe restore [SolutionFile] –PackagesDirectory [PackagesDirectory]