Questions tagged as 'entity-framework'

2
answers

Having two dbContext for the same connection string is considered bad practice?

I initially had a DbContext with all DbSets of my entities. However, I needed to create a DbContext<T> that has a generic DbSet for methods that are properly generic. It turns out that the two DbContext point to...
asked by 08.07.2014 / 23:10
2
answers

How to do query containing MAX and COUNT via LINQ

I have the following model : public class Crm_Analise { [Key] public int id { get; set; } public string cod_item_CRM { get; set; } public string TAG { get; set; } public string data_creat { get; set; } public str...
asked by 14.07.2017 / 13:26
2
answers

Entity - Disable Lazy Loading?

I'm at the beginning of project development. This project will have a large database. Is it advisable to keep lazy load enabled? I'm worried about losing performance.     
asked by 21.01.2016 / 18:34
3
answers

How to implement custom functionality in a model in .NET?

I needed to implement some functionality in the users model but as you can see right at the beginning this class is automatically generated by Entity, so whenever I update or recreate the model the custom functionality will be lost. Ex...
asked by 04.05.2016 / 16:04
1
answer

Field calculated with EF

I have two classes: public class Cliente { public int Id {get;set; public string Nome { get; set; } public string Email { get; set; } public string Telefone { get; set; } public string Celular { get; set; }...
asked by 29.11.2016 / 19:24
1
answer

How to do a split of a DateTime column from a query by the Entity Framework?

I have a field of type DateTime? (null allowed) that is in the complete date / time format (dd / mm / yyyy hh: mm: ss). I need to display the date and time in separate columns in a datagridview. I tried to use DbFunctions.TruncateTi...
asked by 15.06.2018 / 14:55
2
answers

Remove all records from a table with Entity framework 6

How to delete all data from a database table using EF6 without having to query (do I want to delete all records)?     
asked by 20.10.2015 / 17:59
1
answer

Entity framework with connection string via code

I'm developing an application, and I need the connection string to be defined in the code itself, since there can not be the app.config file.     
asked by 07.12.2014 / 17:10
3
answers

Sort the children in query Linq

I'm having trouble in ordering a query where I have to sort the children by the ID, Follow Source. public Grid GetByOrderGridData(long id) { var query = from c in context.Set<Grid>() where c.Id == id o...
asked by 28.06.2017 / 14:48
1
answer

Why is it not recommended to use the event in C # project with WPF and MVVM?

I'm very new to WPF I'm doing a project using MVVM and Entity Framework and it was suggested not having any Click tails event for a button in the code behind a window, for what reason? What is the alternative to replace the below event without b...
asked by 04.09.2017 / 23:15