Questions tagged as 'linq'

2
answers

How do I convert LINQ to SQL for MySQL?

I'm trying to remove the use of SQL statements from within the system (to make it flexible on the database that will be used), I use statements Insert , Update and Delete via stored procedure (for performance and for flexibi...
asked by 28.01.2015 / 14:57
2
answers

Returning a list using select new with LINQ

I can do this: var filial = (from f in base.EntityContext.vw_filial select f).ToList<vw_filial>(); But, I want to do something like this: var filial = (from f in base.EntityContext.vw_filial select new {...
asked by 18.12.2014 / 12:47
2
answers

How to do a row count (SELECT COUNT) in Linq

How to make a count of records that a query would return in Linq (Entity Framework) in C #? The equivalent in SQL is to make a SELECT COUNT(*) . Note that I want to receive the direct count of records, just like a SELECT COUNT (*) would...
asked by 21.03.2014 / 15:22
1
answer

Lambda with different contexts

Is there any way of joining two or more tables using Lambda and two different contexts?     
asked by 06.06.2014 / 17:37
2
answers

LINQ query with sum

I have the following query in LINQ var dados = _db.Contratos .Where(a => a.Adesoes.Any(b => b.Pago)) .Select(a => new { Contrato = a.Numero, ValorTASenior = a.Adesoes.Where(b => b.Pago).Sum(b => b.Val...
asked by 14.12.2017 / 17:19
3
answers

What is the most correct way to query with LINQ?

I'm trying to make a LINQ query on my DB SQL Server, but its result always comes 'null'. I need the first userid on which I query. This is the way I try to query it: public decimal GetCustomerBalance(long accountCurrentAdvisorId) {...
asked by 11.04.2015 / 05:46
4
answers

How do I implement an ObjectSet wrapper that works with LinqToEntities?

I need to create a wrapper for ObjectSet to be able to create a centralized access control. The goal is to implement the CA without making changes to queries already in the system, which in this case are scattered throughout the code...
asked by 06.02.2014 / 13:51
1
answer

Filling aggregate class from dataTable using a Dataset with LINQ C #

I'm having trouble filling an aggregate class in C #. Is it possible using LINQ? Does anyone have any examples of how to work around this problem using the return of a DataTable or DataSet ? public class OrderDetails { . . ....
asked by 20.05.2015 / 05:43
1
answer

How do I know if at least one element in a list is contained in another list?

I have two lists: var lista01 = new List<int> { 1, 2, 3, 4, 5 }; var lista02 = new List<int> { 7, 7, 7, 7, 7 }; I need to check if at least one element of list 1 exists in list 2, so the result for the above example should be fa...
asked by 24.12.2013 / 23:54
1
answer

Fill in a collection type property

Good evening folks how to populate a collection type property using this type of structure in a class: public class Order { public string orderNumber {get; set; } public DateTime orderDate {get; set; } private D...
asked by 20.06.2015 / 03:46