2

What are some naming conventions utilized for Entity Framework queries? Example, following code utilizes 'e. Why do they use e? And what are naming convention strategies for delegate abbreviation in method syntax? This question is not asking for opinion, just common naming convention.

    public static string GetBooksByPrice(BookShopContext context)
    {
        var result = context.Books
            .Where(e => e.Price > 40)
            .OrderByDescending(e => e.Price)
            .Select(e => new
            {
                e.Title,
                e.Price
            }).ToList();

2 Answers2

0

You can name it to book as well rather than e, you can follow the same naming conventions other than reserved C# Keywords

It has nothing to do with Entity Framework you're using C# lambda expressions to query the database which in turn is translated to SQL server statement

You can read about Lambda expressions here

C# Lambda Expressions

Ikram Shah
  • 1,206
  • 1
  • 11
  • 12
  • ok cool, thought it was Entity framework Linq method syntax http://www.entityframeworktutorial.net/Querying-with-EDM.aspx –  Mar 07 '19 at 06:11
0

There is no suggested naming convention for delegate. If you see the linq at github Select. These are method parameters so you can pass any name but type need to be same.

sina_Islam
  • 1,068
  • 12
  • 19