Questions tagged as 'entity-framework'

2
answers

Sorting data with value priority using LINQ

I have a status table with the following values: ID 1 = Ativo ID 2 = Novo ID 3 = Excluido How would you return a list of objects (which have the status object) prioritizing, coming first, those that have Status 2 (New) using LINQ? I wou...
asked by 16.09.2015 / 18:39
2
answers

Entity Framework | Double property that allows null

My property allows values double and values null . In the SQL Server Database it is set to decimal(18, 2) . But when seto some value (ex: 5.00 ), it gives the error below. Error:    The 'Valuation' property...
asked by 29.03.2017 / 23:15
3
answers

Entity Framework - Update nested lists

I have the following schema in my DB MySql: Modelshavealistofstandard_imagesandeachstandard_imageshasastandard_regionslist.IneedtouseEntityFramework5.0.0.Ihaveatemplatewith3standard_imagesandeachonehas4standard_regions.Ineedtodoanupdateonthis...
asked by 10.06.2014 / 14:08
1
answer

What is the need to inform the "Order" parameter in the object of type IndexAnnotation?

I am creating indexes for some columns that will be used in a query with Where() . The intention is to make the search faster. Until then I was creating like this: Property(x => x.Documento) .HasColumnAnnotation(IndexAnnot...
asked by 03.01.2017 / 14:15
2
answers

What is the cleanest and clearest way to validate entities using the Entity Framework

I'm using the Entity Framework for data manipulation. The project is divided into 2, one containing the domain entities and the other Fluent Api mappings). I need a clean and clear way to validate entities without polluting entities with Dat...
asked by 02.02.2017 / 00:00
1
answer

Foreign key can be null in Entity?

I'm having a hard time on a project. I have created two tables ( Union and School ), with% of the Union table being PK in the School . But this FK can be null, meaning the School can belong to a Union or not. Well, here's...
asked by 30.07.2015 / 16:59
4
answers

What is the best solution? GetById with id not existing in DB

I'm making a call in my repository but the CPF does not always exist in the DB. When it does not exist in the database I get the following error. Repository public VendedorModel GetById(int CPF) { using (var db = new Pow...
asked by 12.01.2018 / 12:32
2
answers

Is it possible to change databases in an existing system?

I'm starting a project in ASP.NET MVC 5 with Entity Framework for a client, where it chose to use a free database, strong> MySQL . But with the growth of the application, I foresee the best use of a database like SQL Server . My suggesti...
asked by 05.09.2014 / 16:03
2
answers

What is the reason for using DbMigration in CodeFirst?

What is the purpose of using DbMigration when developing a project using CodeFirst? Is using it a good practice, or is it something that does not cause major impacts on the implementation and / or maintenance of the system?     
asked by 22.06.2014 / 00:37
1
answer

Write date of inclusion using entity framework

I believe there has been a misinterpretation, I am posting the code to be better understood. I'm using a project for my EF Repository inside it I have: Notice the doubt in //CompanySave.DATA_IND = DateTime.Now; This is possible. using Syste...
asked by 17.09.2015 / 03:06