Questions tagged as 'entity-framework'

1
answer

How to configure the IncrementBy of a PostGreen Id field using the Entity Framework Core

I have a table mapped to PostGre, but when I update the database, the PersonFisicaEnderecoTipoId Field is being auto-incremented by 10 (by default). How do I map so that IncrementBy is set to autoincrement by 1 in 1? TableMapping:publicclass...
asked by 30.11.2018 / 19:15
2
answers

GET Service - System.NullReferenceException: 'Object reference not set to an instance of an object.'

I'm working on creating a Get service in ASP.NET Core, my project contains the following structure: Certiao.Data - Class Library Inside it has Dependences , Models : Sexo.cs and DB_SDO_DEVContext.cs DB_S...
asked by 18.10.2018 / 23:46
1
answer

Alternative to Unit of Work + Repository for sharing DbContext [closed]

I've seen people saying several times that it does not make sense to use Unit of Work + Repository with DbContext Unit of Work with repository Is it supposed to be "more secure" to use DbContext directly on a service layer? like: public c...
asked by 07.10.2018 / 18:51
1
answer

How to add includes by expression in repository pattern C #

I'm creating a RepositoryBase (Repository Pattern) with EntityFramework Asp.Net Core, and in it I'm creating a Where method, where I pass an entity where expression. So far the method works perfectly, but in this same method I would like to pass...
asked by 13.08.2018 / 19:41
1
answer

When the property is not int such as forcing the entity to create a field in the table as nullable: false

The migration is generating the name field in the table as nullable: true I do not want it to be true, how do I solve this problem? public class Professor { public string Id { get; set; } public string Nome { get; set; } public s...
asked by 31.10.2018 / 19:55
1
answer

Where with date and time - Entity Framework

I'm doing a select with entity framework. where I need to use the where, with date and time, in SQL SERVER select, I would do it this way: select dbo.contas_receber.id, dbo.contas_receber.tipo_conta,dbo.contas_receber.data_pagamento, dbo....
asked by 13.07.2018 / 13:55
1
answer

Creating Migration Error

I am creating a user registry in C #, but when I include the domain layer and I am going to create the migration, the error below is happening. I could not identify what is happening. "No suitable builder found for entity type 'User'. The fol...
asked by 06.07.2018 / 03:18
1
answer

error in executing application c # asp.net entity

Good morning, My project started out of nowhere with this error. Could not load file or assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifes...
asked by 25.06.2018 / 16:21
2
answers

C # - Filter Include - Context [duplicate]

In the method below, I return some records from my EntityIntermexRegras entity, where it has relation to the .INCLUDE ("Emails and Parameters"). Since EF does not allow filtering in .INCLUDE, would you like to check how to filter these entitie...
asked by 06.06.2018 / 22:35
1
answer

attribute passing empty in entity

I'm trying to make an update only the fields of Issue Date and Due Date have no idea why, it's passing null when I call the save changes button. Inside the controller arrives one saying that the date of mission can not be null. @model Porta...
asked by 08.06.2018 / 15:35