Questions tagged as 'entity-framework'

1
answer

How to return only the data ref. to logged in user

I have a table that returns the following data from a SQL Server database: Initial KM; Final KM; Liters; Value R $. ButIwouldliketoonlyreturntherefvalues.totheloggedinuser.InthetableintheDB,Ihaveacolumnthatsavestheusername(Note:Ikn...
asked by 01.12.2016 / 10:52
1
answer

SUM within SUM Entity Framework perfomance

I've done a query with entity framework and I'm having performance issues. public static Decimal ValorPrevisto(this ClinicaModel clinica) { return clinica.Contratos.Sum(c => c.Mensalidades.Where(m => m.Pagamento != n...
asked by 18.03.2016 / 04:22
1
answer

Error in file project.json

I'm having an error in my project, it appeared after I added Entity Framework to my project! This error persists at line 21 of the project.json file. I'm using Visual Studio 2015. The exact description of the error is:    "Th...
asked by 11.04.2016 / 19:58
1
answer

How to delete data from a table related to another

I have the following situation with a method of deleting directory: internal void DeleteDiretorio(Model.Diretorio diretorio) { using (var ctx = new TESTEntities()) { var dir = ctx.DIRETORIO.FirstOrDefault(a =>...
asked by 10.02.2015 / 14:42
2
answers

How to return more than one Database Entity in a LIST?

I have two entities, CATEGORY and TRANSACTION , in the database I also have these two tables. TABELA: CATEGORIA CHAVE: ID TABELA: TRANSACAO CHAVE: CATEGORIA_ID When done a select by entity performing a join : var _resul...
asked by 25.01.2015 / 01:17
2
answers

Match contents of two objects

I use the following method to update a given table: public int alteraBem(tb_bens itemBem) { try { using (GestaoAtivoEntities db = new GestaoAtivoEntities()) { var bem = db.tb_bens.Where(v => v.int_id_bem....
asked by 26.11.2014 / 14:23
1
answer

Entity Framework 1-n

I do not even know if I'm feeling what I'm trying to do. If I try to add a Course to a Flag, fine. But when I try to add a list of Courses in a Flag, the following error occurs:    Additional information: An entity object can not be refere...
asked by 09.09.2014 / 20:57
2
answers

Context does not load Bank data

My context is not bringing the bank's data. Error messages.    Value can not be null.       "Value can not be null. \ r \ n Parameter name: connection"       Value can not be null. Parameter name: connection Connection string string...
asked by 21.07.2014 / 16:06
1
answer

Skip list for model

I have a query that returns a list like this: var list = db.Comentario.Where(d => d.GrupoTrabalhoId == Id).OrderByDescending(s => s.DataComentario).ToList(); After this query, it will return me among other things the user id, I would...
asked by 04.12.2018 / 19:27
3
answers

Log reading to infer counter

I have a template called Request and this template has a column called Number. This Number has the following structure: YEAR + COUNTER. It happens that whenever I'm going to create a new request I get the last request added in the data...
asked by 06.02.2014 / 19:01