Let me show you a quick method to convert Camel Case in C# to title case.
Category: ASP.NET
-
Detaching specific objects using Entity Framework before SaveChanges
Sometimes in large processes that span across multiple classes, it’s possible that an entity is added to Entity Framework’s context tracking. I’ve run into this scenario where we accidentally save things that get immediately deleted afterwards.
Let’s look at a neat solution that will allow you to detach specific objects out of Entity Framework’s context. In theory this can go in several places: In the code you know causes the entities to be added or before the call to SaveChanges. In this example we’ll look at the latter because it is a nice and generic spot.
-
LINQ Group By to Dictionary Object
So many times to have a list of objects that I want to group – as an example – by a customer ID. The end result that I would like would be a: Dictionary<long, List>
-
Random number generator only generating one random number
To generate a random number it involves instantiating the Random class then calling the Next function with a minimum and maximum value as follows: new Random().Next(min, max) so why is it always returning the same number? This commonly occurs when this is being called in a loop.
-
Entity Framework Stored Procedure Returns No Columns
I was recently adding a new stored procedure to my Entity Framework EDMX (database first) when no columns were being recognized by EF. I was slightly confused by this, luckily I found this simple solution. At the top of your stored procedure definition, add SET FMTONLY OFF. I suggest only adding this setting temporarily; further explanation is below.