D
D
Denis Mashanov2018-01-31 06:49:28
C++ / C#
Denis Mashanov, 2018-01-31 06:49:28

How to add index to select EF6?

Good day everyone. Please tell me how to add a variable to select so that it increases its value at the same time, I need it to index the data in the subsequent display.

var result = from phone in db.Phones
             join company in db.Companies on phone.CompanyId equals company.Id
             join country in db.Countries on company.CountryId equals country.Id
             select new
             { 
                Index = ?,
                Name = phone.Name, 
                Company = company.Name, 
                Price = phone.Price, 
                Country = country.Name 
             };

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Kuznetsov, 2018-01-31
@LoneRay

I think you are solving the problem from the wrong side.
What prevents you from calculating this index when outputting?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question