activa / iridium

Iridium - Lightweight .NET ORM for mobile, desktop and server applications
MIT License
22 stars 8 forks source link

Select Anonymous Type #18

Open jadefez opened 6 years ago

jadefez commented 6 years ago

Excelent Job! I love your software since CoolStorage.

I profiled a linq query that selects an anonymous type, and the select statement has all columns. I think this will be a good a enhacement. var query = from x in db.Clients select new { x.ID, x.Name }; Clients is a DATASET and Client class has other mapped properties.

activa commented 6 years ago

Just to make sure we're on the same page: are you suggesting that the data provider would only read fields "ID" and "Name" from the database instead of reading all fields and only using a few?

jadefez commented 6 years ago

Exactly that. Just for performance reasons. I have a table with dozens of columns. I need to read just a few columns and process them in several ways. The table has 10 millons records that will be readed in parts. The database server has limitation on returning large datasets so in you fetch more columns than you need less records you will get with the limit (in kb) that de administrators set. Also the data will not be mapped to Client Entitity (with dozens of properties, used for other purposes). I realize that a posible solution is to declare a smaller entity with less fields or properties and map to the same table. is that posible? or is restricted? Excuse my ugly english.

activa commented 6 years ago

I will put this on the to-do-list. In the meantime, creating another class with fewer properties will work. You just have to make sure that the primary key is one of the properties.