Questions tagged as 'entity-framework'

1
answer

Update problem with 1 field - EF

Follow the code: using (var db = new Entities()) { var t = new MinhaTabela { MeuCampo= 10 }; db.Entry(t).State = EntityState.Modified; db.SaveChanges(); } Table definition: CREATE TABLE [dbo].[MinhaTabela] (...
asked by 08.01.2017 / 03:48
1
answer

The client entity type is not part of the template for the current context

I'm trying to reproduce this example of EntityFramework with standard repository, as follows the link: link But it is giving the error described in the topic title. I'll post the codes. The first is the class BancoContext.cs: using...
asked by 24.07.2016 / 04:23
1
answer

How to configure Context to put the plural table name in pt-BR?

I'm in an ASP.NET MVC 5 application, setting up a DbContext class. When EF generates the database, the tables for the application objects are getting the plural names in English. For example: public System.Data.Entity.DbSet<Teste....
asked by 15.07.2016 / 18:39
1
answer

Entity Framework 6 relationship

I have a class where I need to have 2 different relationships with the same table. public class Usuario { public int Naturalidade {set;get;} public int CidadeEndereco {set;get; } public class Cidade { public int Id {se...
asked by 17.06.2016 / 21:10
1
answer

Entity FrameWork (ORM) and DropDownList Html

I have two mapped models that will work like this: The model Afaze will have a ComboBox (DropDownList) that will make the categories available to the user to select, however these categories are registered by the same, so in the source I h...
asked by 24.09.2016 / 00:42
3
answers

Problem saving accent with Entity Framework and PostgreSQL

I need to migrate a system with SQLSERVER database to a PostGreSQL 9.3. I have never worked with PostGre before so I'm using Entity Framework 6 with model-first to make the process easier. The migration application is being developed in WPF. My...
asked by 28.06.2016 / 22:23
2
answers

Attribute Type for PostgreSQL oid column with EF6

What kind of attribute should I use to represent a column type oid of PostgreSQL with Entity Framework 6 Code-First? Remembering that PostgreSQL's oid type is for storing files.     
asked by 24.05.2016 / 16:27
1
answer

Replacement for Fluent API

I'm in a project of a system that uses C # language, using MVC, Entity Framework and I'm using the Fluent API. I wonder if you have any other way to do this. HasKey(oc => oc.OrdemCompraId); HasRequired(oc => oc.UsuarioCadastro) .With...
asked by 28.09.2015 / 18:50
1
answer

Identifying the foreign key in the Entity Framework CodeFirst

The Entity Framework identifies the foreign key through properties that have Id as part of the name or by Data Annotation [Key]. My question is, how does it identify the foreign keys and does the relationship between another table? public clas...
asked by 14.08.2015 / 02:33
2
answers

Synchronize items in comboboxes at run time

I've tried for some time to figure out how to synchronize one combobox with another. I am wanting to sync comboboxes at runtime. When the user selects a category in the combobox, depending on their choice, the combobox subcategory will display t...
asked by 17.11.2015 / 23:22