Questions tagged as 'linq'

1
answer

Put a decision control inside a lambda expression

I'm building this query: private List<string> pegaInformacaoParceiro(string _osparceiro, string _cnpj) { List<string> lista = new List<string>(); WEBEntities db = new WEBEntities();...
asked by 10.06.2014 / 21:25
1
answer

How to create a query with union using NHibernate

I need to implement a query in nhibernate to do a union between 2 tables. In sql , it would look something like this: SELECT T1.Id AS ID FROM TABELA1 AS T1 UNION SELECT T2.Id AS ID FROM TABELA2 AS T2 I did not find any...
asked by 03.04.2014 / 19:42
1
answer

Converting data into types such as int and double

I'm having trouble converting data from a database, for example I'm running a query like this: carteira ca = bc.carteira.FirstOrDefault(obj => obj.cpf == cepf && obj.codigo == cod); I get data information of type ca.valor ,...
asked by 02.06.2014 / 23:32
1
answer

Linq command to bring a decimal query C #

I'm having trouble understanding how to bring a query from the textbox of a column where the field is decimal? if (txtNomePesquisar.Text.Equals("")) { MessageBox.Show("O que você procura? "); } else { var clientes = cc...
asked by 26.10.2017 / 00:59
2
answers

Return data from a query with Linq in an EF Core repository

I have the Person class that relates to the PersonPhysical and PersonJuridica tables in a one-to-one relationship. In my Person table I have the Field PersonNature where 0 = Individual and 1 = Legal Entity. A person can be physical or legal a...
asked by 15.02.2018 / 21:05
0
answers

Error using dictionary in an IQueryable.Select () method to design chosen columns at runtime

The code fragment below is intended to use the Select () method to perform generic column projections on a query, according to a list of given column names. The program works fine if all the columns are of type 'string', but triggers the excepti...
asked by 16.06.2017 / 21:32
1
answer

Use of search / search filters with entity framework

I'm creating a grid with data from books and I'm adding some filters, the problem is when I create the filters of a table that has a link with that of books, I can not navigate (obs.:in a view I can navigate in the view) in the object to add it...
asked by 03.02.2016 / 13:50
1
answer

Linq + Lambda, subquery, distinct and not in, how to improve this query

I had the following syntax in SQL SELECT tbl_boleto.int_IDC, tbl_Admin.int_STATUS, tbl_Admin.int_CONVENIO, tbl_Admin.int_PLANO, tbl_Admin.int_RESTRICAO, tbl_Admin.str_URL FROM tbl_boleto INNER JOIN tbl_Admi...
asked by 08.03.2016 / 20:30
2
answers

Rename field in a lambda

In SQL I do this: select campo1 as teste from tabela And in a lambda ? How would I do it? I have this lambda with multiple tables and the ValuePayment field repeats several times. var qry = db.User.Join(db.Solicitation, user =>...
asked by 17.09.2018 / 19:23
2
answers

I need to make a filter with linq on an entity, this filter should bring all the events for the next 90 days. Today's example: 11/01/2017 until 04/11/2017 (90 days) _con.SiteContexto.AsNoTracking() .Where(e => e.Data....).ToList();     
asked by 11.01.2017 / 19:00