Questions tagged as 'entity-framework'

2
answers

View with IEnumerable and EntityFramework

I have a Sales entity and it has several fields ( IdItem, SalesDate, SalesValue, DiscountData, CustomerId, IdCategori, and etc). I already have all Views working for this CRUD entity.) Now I'm going to create a new View where the Client...
asked by 25.05.2016 / 19:06
2
answers

Inner join in entityframework

I need to do an inner join on the entity framework in the database, I can do this normally: select * from Produtos inner join ProdutosEmpresas on ProdutoID = Produtos.Id But in the entity framework I can not, it does not appear in the table...
asked by 14.11.2018 / 12:23
1
answer

What is the best validation strategy before the data persist? [closed]

I'm used to .NET using C # and EntityFramework. And there in Entity we have dataanotations . When I create the entity in C #, for example of person, just put the datanotaations and the Entity is valid for me: public partial cla...
asked by 23.10.2017 / 20:08
1
answer

Relationship between different context classes Entity Framework

I have a problem saving an object because it has a relationship in a different context, I would like to know if there is a way to solve this problem.     
asked by 08.06.2015 / 20:48
1
answer

Pagination with generic method

I'm trying to create a generic paging method, I tried to do as the code below, however when using Skip I need to have a orderby and I'm not sure how to do it. public IQueryable<TEntity> GetPaginacao(int PageStart, int PageS...
asked by 14.01.2016 / 15:29
1
answer

How to change a property during a LINQ query?

Is there any way to change a LINQ query property of the query itself? Ex: I'm doing a query on List<Cliente> and I want all clients whose NomeFantasia starts with * to have the symbol removed from the name. Her...
asked by 14.08.2015 / 14:48
2
answers

How does the Tracking / Chache of EntityFramework objects work?

Whenever I used EntityFramework in a project, to add a record in the database through it, of a class that contains class type memberships (usually on behalf of ForeignKeys ), I did the following: After the entity instance, it filled in t...
asked by 09.05.2015 / 04:05
1
answer

How to do a complex query in SQL in .NET MVC

I would like to know how to make a query, using multiple fields, multiple tables with inner joins in ASP.NET MVC without having to put the SQL string in the code, using the Entity Framework. Currently, without using the string in the code, I...
asked by 19.06.2014 / 19:47
2
answers

What is the difference between Attach, setar EntityState for Modified and CurrentValues.SetValues?

What is the difference between methods for updating a record through EntityFramework? Attach : dbContext.Pessoas.Attach(model); Set the State of an entry for EntityState.Modified : dbContext.Entry(model).State = Sy...
asked by 26.10.2014 / 19:34
3
answers

error while saving or updating with EntityFramework

I have the following method: using (var context = new ClassContexto(ClassMaster.conexao())) { using (DbContextTransaction tran = context.Database.BeginTransaction(IsolationLevel.ReadCommitted)) { try { pacie...
asked by 20.12.2017 / 13:07