Questions tagged as 'entity-framework'

3
answers

Is the connection to the bank open in static mode?

I have the following static class available for the entire application: public static class MinhaClasse { public static void Salvar(Item meuItem) { using (MeuEntities db = new MeuEntities()) { db.Item.Add(meuItem...
asked by 23.09.2015 / 22:44
3
answers

Get ID immediately after insertion

Use Entity and LINQ. I would like to know how I get a generated ID soon after inserting a record, before anyone else can enter it too, ie ensure that that ID is the one I generated. Has as? Use Sql Server 2008, Entity, LINQ     
asked by 26.05.2014 / 17:02
2
answers

What is the corresponding variable type of timestamp (SQL Server) in C #?

I have a field in the database (SeqAlteracao) of type timestamp and I need to map it to the C # (Entity Framework). What is the corresponding type in C # for this type in the bank? public **Tipo** SeqAlteracao { get; set; }     
asked by 21.11.2016 / 21:00
3
answers

Linq filttar elements of LEFT JOIN

I would like to return an object with your children, but only wanted to bring the children that corresponded to a certain condition. ex: I have the following classes: public class Fornecedor { public int FornecedorID { get; set; }...
asked by 11.11.2016 / 17:29
3
answers

How to create extension methods in the Entity Framework using Linq?

Is it possible to create custom extension methods for Linq to entities? In the project I work with, for example, we have several columns of type DateTimeOffset? . In certain views I need to filter the results by date, so I do the follow...
asked by 02.09.2016 / 16:35
1
answer

Entitiy framework for JAVA?

Good night guys, I'm new to programming. So, I've been looking at some articles and watching videos about the Entity Framework for C #, I wonder if there are any frameworks in Java that do the same or similar function in relation to CRUD?     
asked by 17.10.2018 / 03:48
2
answers

How do I return an existing item in my enumerable via Contains?

I have an enumerable, and I want to query through one code per parameter. if the enumerable "Contains" Code, then it will return me all items that have that Code. See was trying to do so: public IEnumerable<Relacao> Listar(int Codigo)...
asked by 07.04.2015 / 13:47
1
answer

Testing classes with dependencies (C # + Entity Framework)

I have a "Sale" class (class summary just below) and in it I have a "Budget" property. What would be the best way to do a unit test in this class? I came across 2 problems: The mock frameworks require that we leave the methods we need to "...
asked by 10.08.2015 / 16:50
2
answers

Distinct in linq does not work

I made this linq in my model: public static List<MontaArvoreAcao> CriarListaArvoreAcao() { RupturaEntities db = new RupturaEntities(); var _listaUnidade = ( from r in db....
asked by 23.09.2014 / 18:44
2
answers

How to create a template with only a few table fields?

I have some tables with several fields. For example, table (X) has a 20 fields of which I will only use 2 or 3. In this situation do I have to create the templates with all the fields and ignore the properties in the EntityTypeConfiguration...
asked by 14.06.2016 / 15:14