I am writing a DLL for one project, I just started using LINQ to SQL and after moving all the methods to this new dll. I disabled that I cannot process the DataContext because it was configured, I understand why, but I'm not sure how I can satisfy the query results for my main project method, therefore:
My method in DLL
public static IEnumerable<Problem> GetProblemsNewest(int howMuch) { using (ProblemClassesDataContext context = new ProblemClassesDataContext()) { var problems = (from p in context.Problems orderby p.DateTimeCreated select p).Take(howMuch); return problems; } }
Call:
IEnumerable<Problem> problems = ProblemsManipulation.GetProblemsNewest(10);
This is only the first method, I have great ones, so I really need a way to do this. Should there be a way to use LINQ to SQL in a DLL? I know that I can do something like .ToList or .ToArray , but then I could not directly use the properties of the string and would have to refer to it as a problem [0], problem [1], etc., What is even messier than having a code tone in the main project.
source share