Dotnet notes : LINQ

July 7, 2015

Use of dynamic in c#

LINQ : FirstOrDefault


Enabling remote debugger in visual studio

June 25, 2015

In production environment
Suppose you dont have visual studio editor. You have only dlls in the production machine. There is no code.
Along with framework you will get Remote Debugger tools in visual studio menu.

In the production machine start remote debugger tool. You will get machineno along with port no.

In development machine attach to process – Qualifier -> Enter the machineno along with portno.
in Attach to : select Automatic :Managed(v4.5,v4.0)code.
And attach to the w3p process
remote debugger


Entity Framework notes

May 24, 2015

How do I delete multiple rows in Entity Framework (without foreach)

db.People.RemoveRange(db.People.Where(x => State == “CA”));

How to delete single row in Entity Framework

use remove() method


Entity Framework notes : Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details

May 3, 2015

Validation failed for one or more entities. See ‘EntityValidationErrors’ property for more details

try
{
// Your code…
// Could also be before try if you know the exception occurs in SaveChanges

context.SaveChanges();
}
catch (DbEntityValidationException e)
{
foreach (var eve in e.EntityValidationErrors)
{
Console.WriteLine(“Entity of type \”{0}\” in state \”{1}\” has the following validation errors:”,
eve.Entry.Entity.GetType().Name, eve.Entry.State);
foreach (var ve in eve.ValidationErrors)
{
Console.WriteLine(“- Property: \”{0}\”, Error: \”{1}\””,
ve.PropertyName, ve.ErrorMessage);
}
}
throw;
}


.Net notes : Entity Framework

May 1, 2015

‘Unable to update the EntitySet ‘xxxxxxxx’ because it has a DefiningQuery and no element exists in the element to support the current operation.’

Please check:

1. Make sure you have ”xxxxxxx” table in your datgbase

2. Make sure you have the Primary Key in that table

3. If the the table and Primary Key are existing, please updated the Entity map and publish again.


Asp.Net : Unable to make the session state request to the session state server

April 24, 2015

Asp.Net : Unable to make the session state request to the session state server

Unable to make the session state request to the session state server

That error message means the ASP.NET State service is not running in services.msc


Please select a row error popup message

April 2, 2015

In IE 11
if you are getting “Please select a row” error pop up message then u have to check the below solution.

Tools – >Compatibility View settings ->

uncheck the checkbox of “Display intranet sites in Compatibility View”

Please select a row


Follow

Get every new post delivered to your Inbox.