Search code examples
c#sqllambda

How do I get a space in my property name?


I have the following query:

var query = _projectEmployeesBLL.GetAll()
    .Where(x => x.EmployeeID == employee.EmployeeID 
           && x.project.isActive == true 
           && x.project.isDelected == false)
    .Select(x => new
    {
        x.project.ProjectID,
        ProjeAdı = x.project.Name,
    });

The problem is that I make the property ProjeAdı in the Select clause. I want the property to match the sql column, Proje Adı (note the space). How can I do that?


Solution

  • aliases cant have spaces between them , just like any variable name cant have white space, they are considered as bad naming conventions, you can use _(underscore) eg. Proje_Adi