Skip to main content
Code Review

Questions tagged [linq-to-sql]

Use this tag for code reviews of or involving Linq to SQL classes, mappings and associations, or for code reviews of or involving querying a System.Data.Linq.DataContext object with Linq statements.

Filter by
Sorted by
Tagged with
0 votes
1 answer
5k views

Linq Conditional where clause when parameter can be null

I need to filter my records on the basis of "courseId" which is passed as parameter - Here is my code - ...
iniki's user avatar
  • 335
1 vote
2 answers
137 views

Exporting test results to PDF tables

I have an asp.net web application and I want to export to a PDF tables in a particular way. Tables will have data of type Test. tests have a type(by type i mean an int to tell them apart) and for ...
Theo's user avatar
  • 13
0 votes
1 answer
95 views

Data validation for to check required fields are mapped

Can I break the below foreach and IF statements into LINQ expression. Also, performance wise which will be better. Please suggest. ...
5 votes
2 answers
4k views

Efficiency of a linq query on a nested structure

For a survey website I've written this query to show the survey results, with a percentage for each chosen answer: ...
Arnold S's user avatar
1 vote
1 answer
112 views

Aggregating clients and client types

The code I have put together achieves what I want, but I don't know if it is the right way to go about tackling the problem. I am dealing with 2 tables (CLIENT, CLIENTTYPE) each of which I have an ...
1 vote
1 answer
5k views

Selecting employees in certain departments using LINQ

I am trying to select the DepartmentName from Employee Table based on where condition. Is any way to simplify the code? ...
Vignesh's user avatar
  • 129
3 votes
1 answer
711 views

Search products from database on base of search filters

I am writing a code to search Product database and return result to user. user can select various options like product attributes that varies from product to product, also there may be case like for ...
9 votes
6 answers
10k views

LINQ to SQL query filter, with the name match ignoring multiple punctuation characters

I have the following LINQ to SQL query which works fine but looks ugly: ...
3 votes
2 answers
569 views

Implementing SOLID Principles - LINQ TO SQL

I have been using Layered Architecture in my web application. Can anyone please advise if my data layer classes (both Linq and booking class) can be improved? I have just started learning about solid ...
8 votes
1 answer
3k views

GET with paging, sorting and filtering

I have a GET method that handles paging, filtering, and sorting. Development has been fairly rapid and I'm not completely sold on some of the implementation. A few assumptions have to be made for this ...
1 vote
1 answer
7k views

Calculating the .Sum() in Linq-to-SQL

I have the following code where I need to execute 2 Linq-to-SQL statements. If I do not have the Any() in the if statement, then ...
3 votes
1 answer
2k views

Returning an IEnumerable using Linq-to-SQL which is then bound to a GridView

This function works, but it's really really slow and the generated SQL is gargantuan and horrible to look at. It's also very expensive to run when it shouldn't be. ...
1 vote
1 answer
541 views

Eager Loading Deeply into a Model with a Collection Property Whose Type is Inherited

Visual Studio generated this great route for me, where I can load an entity: ...
5 votes
1 answer
13k views

Simplifying a LINQ expression that finds the largest date smaller than another date

I have a LINQ 2 SQL query that needs to run a subquery in the where clause. The subquery just returns the largest date (from a date column) that is less than or equal to another date (an input to the ...
Dan's user avatar
Dan
  • 615
7 votes
3 answers
273 views

Fetching a set of event IDs from a database based on a set of company IDs

The following code fetches a set of company IDs from a database if there are any events associated with a company that has a missing property. Because the set of company IDs is embedded into the SQL ...
sshine's user avatar
  • 741

15 30 50 per page
1
2 3

AltStyle によって変換されたページ (->オリジナル) /