Questions tagged as 'entity-framework'

2
answers

SQL query for Linq mvc4 c #

I'm not very familiar with Linq and I'm having trouble turning this SQL query into linq, can anyone help me. I do join of 6 tables (I did not do the database. I have to work with it), what I'm hooked on is group by and having...
asked by 18.11.2016 / 12:29
1
answer

Not In Linq Sql Entity Framework

I need to do this search, but it displays the error:    ambiguous invocation. public List<Notification> Get(List<UserVisualization> item) { return db.Notifications.Select(o=> o.EntityId).Where(o => !item.Contains(o.En...
asked by 10.11.2016 / 19:12
1
answer

Save and update entities

public void InsertOrUpdate(T entity) { if (entity.Id == 0) { context.Set<T>().Add(entity); } else { var query = context.Set<T>().Find(entity.Id); context.Entry(query).Cur...
asked by 01.02.2017 / 15:57
2
answers

Search Filter

I have an entity of Items that relates to the table of products and it is already in production and is working perfectly! Now I need to create a search report where the user can determine through the filters the conditions of this query. The que...
asked by 25.05.2016 / 16:05
2
answers

Inheritance with Entity Framework

I have a question on the inheritance part, I have the classes person and user. Person has its basic attributes and the user inherits from the person. So far so good, that's right. My problem is that in context mapping I'm passing the user, bu...
asked by 06.04.2017 / 03:57
1
answer

Get total relationship items 1: N [closed]

I have two Product and Items tables - these tables have Parent / Child relationship respectively. I would like to know how do I get the total items from the Items table knowing that each customer can have more than one Order and that each order...
asked by 23.03.2016 / 03:55
1
answer

If it exists, update one table and insert another, if not, insert the two

How to make an expression using EF so that when a certain list of objects is sent and already exists in the database, it is updated and the change is inserted into another history entity, otherwise, it inserts both entities. Example publ...
asked by 23.10.2015 / 22:20
1
answer

Entity Framework Extra column when using ICollection

If I have two tables in the database, for example: tabela1 and tabela2 , and in tabela1 I have ICollection of tabela2 : public class tabela1{ public Guid tabela1Id {get;set;} //campos... public ICollec...
asked by 02.09.2015 / 16:03
1
answer

Mapping of Associative Tables with Entity Framework

I have the following problem: A client has tasks for each day of the week. Example:    Customer A - Saturday - Car Wash, Clean House ... Map as follows: public class Cliente { [Key] public int Id { get; set; } [MaxLeng...
asked by 02.09.2015 / 03:11
1
answer

Associative table mapping with Entity Framework

Abstracting some details I have these classes: public class Department: Entitie { public string Description { get; private set; } public DateTime CreateDate { get; private set; } public virtual ICollection<Service> Services {...
asked by 26.06.2015 / 17:56