Hi all i am trying to Query from a table (_dtlayout) using the LINQ to SQL. I am trying to select a column name FK_DataPoint. But when i Debug it out it is hitting that column numerous times. It does not throw any ERROR but for Performance wise it is a major issue. I know i am using a Where clause which goes to each rows and filters it. But is there a better way to put this code together in order to filter this DATAPOINT Column. Thank you .
int? dataPointKey = _dtLayout.AsEnumerable().Where(row =>
row.Field<int?>"FK_FinancialStatementTemplateSectionItem") ==
colDef.FK_FinancialStatementTemplateSectionItem
&& row.Field<int?>("RowNumber")== columnItem.RowNumber
&& row.Field<int?>("ColumnNumber") ==colDef.ColumnNumber
&& row.Field<int?>("ItemNumber") == columnItem.ItemNumber)
.Select (row=>row.Field<int?>("FK_DataPoint")).FirstOrDefault();
Thanks