Questions tagged as 'entity-framework'

1
answer

Two dependent combobox using linq to sql

How do I populate two combobox's with linq to sql where in a combobox for example I have countries and in another I have cities? How do they automatically change the values? I leave the image below as I filled out one, if there are any errors an...
asked by 06.05.2016 / 02:16
1
answer

EF is giving Timeout in a query that should be instantaneous

When I run the SQL generated by direct EF in SQLServer it runs less than 1 second. When you run the application it times out because it takes more than 30 seconds. I have seen a lot of this problem on the internet with procedure calls, but wh...
asked by 24.08.2015 / 20:34
1
answer

Working with Enums of type CHAR, using C # and Entity Framework

I would like to know how to map my entity that uses an Enum of type char through the Entity Framework, using FluentApi. I have the following Enum: public enum Zona { Norte = 'N', Sul = 'S' } And my Entity: public class L...
asked by 09.06.2017 / 15:31
3
answers

How and where to implement business rules in the Entity Framework?

I have the following example of a software that uses the Entity Framework , which accesses a database with only one table named Produtos with the following fields: Field int produtoid . Field string nomeproduto . Field...
asked by 20.05.2016 / 01:22
5
answers

Change return / Date (1386295200000) / to date format

I have a return of json that comes from SqlServer : /Date(1386295200000)/ How to convert to date format dd/mm/yyyy ?     
asked by 22.03.2018 / 20:12
4
answers

SQL Embedded in C #

I have a C # application that uses a MySQL database with Entity Framework. However, the size of the database is ridiculously small, so I do not think it's worth having a MySQL database server just to run this application. What approach would...
asked by 02.09.2016 / 14:35
2
answers

EF 6, Mapping with Fluent Api in classes with inheritance

I am training the class mapping for the Entity Framework using the Fluent API and I have some questions. The first is this: Mapping a foreign key with attributes would look like this: public int EmpresaId {get; set;} [ForeignKey("EmpresaI...
asked by 19.03.2014 / 15:56
1
answer

How to configure Context not to put table name in plural?

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 names in the plural. For example: public System.Data.Entity.DbSet<Teste.Mode...
asked by 15.03.2014 / 22:50
2
answers

Best way to make class relationship

Hello, I would like to know what is the correct way to do relationship between classes of 1..N and 1 ... 1. Example: public class Pedido { public int PedidoID{get;set;} ............. } public class ItemPedido { public int ItemPedi...
asked by 14.06.2016 / 02:49
1
answer

Linq Compare two lists of different types

I have two different lists A List<ProdutoTag> and B = List<Tag> : public class ProdutoTag { public Int64 ProdutoId { get; set; } public Int32 TagId { get; set; } public Double Peso { get; set; } public...
asked by 23.02.2016 / 18:38