Sunday, 27 September 2015

Entity Framework: how to solve “FOREIGN KEY constraint may cause cycles or multiple cascade paths”?

Introducing FOREIGN KEY constraint 'FK_dbo.ChildProfile_dbo.SourceType_SourceTypeId' on table 'ChildProfile' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints. Could not create constraint. See previous errors. Answer Also...

No connection string named 'MyEntities' could be found in the application config file.

I am using entity framework and ASP.NET MVC 5 and WEB API 2 to build an application My solution is split into two projects; A class library that includes my data model (.edmx) file and a few custom interfaces The 'container' MVC project that references the class library above My problem is that...

Saturday, 26 September 2015

Creating a Flot Chart with jQuery Flot and ASP.NET Web API 2

Step 1 : Create ASP.NET Web API 2 project Step 2: Create Master_Site and SiteAnalyticsData Models in Model Folder Master_Site SiteAnalyticsData Step 3: Add Context Class in Model Folder Step 4: Open Package Manager Console Enable MIgration and Add Migration then Update database in  PM>...

Sunday, 20 September 2015

Thursday, 17 September 2015

How to Resolve null values in C Sharp

How to Resolve null values in C # Say you have a method which accepts a string parameter. The method may need to handle null values in some way. One strategy is to validate the parameter and throw an exception Another strategy is to provide some default value with an if-else statement: This...

How to hide the text entered in a .NET console application

You’ve probably encountered console applications that ask for a password. It’s very likely that the password will stay hidden otherwise other people viewing your screen can easily read it. This short post will present a possible solution on how to achieve a hidden string input in a .NET console application. The...

How to add basic sounds to a .NET console application

How to add basic sounds to a .NET console application: Today we will look how to add basic sounds to our .Net Console application Create a Console Application: The Console object has a Beep method which has a parameterless version: Console.Beep(); It plays a short beep sound. If you’re...

Saturday, 12 September 2015

How to publish a project to BitBucket from Visual Studio 2013

Visual Studio 2013 and BitBucket Today i will show how to publish a project to BitBucket from Visual Studio 2013. Step 1 :Add solution to Source Control Step 2: Commit to local Git Step 3: In the "Changes" area, click "Commits". This takes you to the dialog where you can...

Wednesday, 2 September 2015

Dependency Injection in ASP.NET MVC 5 or MVC 6 with Structure Map

Dependency Injection in ASP.NET MVC 5 or MVC 6 with Structure Map You people may be wondering why we need dependency injection. So the answer is DI is a design pattern that basically let you to write a loosely coupled testable code or application. Three types of dependency injection There are...