Questions tagged as 'entity-framework'

1
answer

Make calculation using LINQ

I'm developing a program in C #. In it I have three tables: produto { string idProduto; string descricao; } entrada { string idProduto; int quant; } saida { string idProduto; int quant; } I want to create a class l...
asked by 29.04.2017 / 16:51
1
answer

Error saving list of related objects

I'm using BeginCollectionItem to insert objects related to a Cliente that I call Dependentes . When saving, I get the error:    Violation of the PRIMARY KEY constraint 'PK_dbo.Dependents'. It's not possible   insert the...
asked by 05.05.2017 / 14:03
2
answers

Many to Many with Fluent API

I'm doing a mapping with Fluent API and a you doubt how I should do the mapping very much. For example, I have the classes below. public partial class Territories { public Territories() { this.Employees = new HashSet<Em...
asked by 15.08.2017 / 15:47
1
answer

Passing Parameters to Store Procedure

Follow the Search Function Code public List<Pessoa> Buscar(string Nome) { using(var db = new MyContext()) { var Result = db.Database.SqlQuery<Pessoa>("EXEC SP_Busca_Cliente @Nome", Nome).ToList(); return Re...
asked by 02.10.2017 / 15:17
4
answers

Entity inner join in LINQ

I wanted to make an inner join so that I get a list with the names of Logins from the Integer List of UsuarioID of class LoginsAtivos . public class Login { public int ID { get; set; } [Required] public string N...
asked by 28.06.2016 / 18:07
1
answer

Mapping View - Entity Framework

I know that something like this has already been asked, but in the answers I found, I wanted to map the view to put the DataAnnotation [Table ("view name"]) or configure it in the Fluent API I created a view in the database called "Users". So...
asked by 03.06.2016 / 13:56
3
answers

DropDownListFor how to use?

I'm having a question on how popular and then get the selected item from a DropDownListFor , I'm using DDD and Entity Framework architecture. In the case here my class ServiceProviderViewModel has to have relationship with other...
asked by 11.05.2016 / 21:00
1
answer

Database CodeFirst Entity Framework, 1-0..1, 1-N

I have 3 tables and need to relate them via code (Code First) Iwouldliketoknowhowtodothis.Ialreadyhavethefollowingcodesfromthetables:TbHistoricoAnalogicousingSystem;usingSystem.Collections.Generic;usingSystem.Text;usingSystem.IO;usingSystem.Com...
asked by 27.03.2017 / 19:04
1
answer

EntityFramework ExecuteSqlCommand not accepting parameter

I'm running the ExecuteSqlCommand. With the correct mode, with parameter does not work: var SQL = "update POSTOFFICE set Status = 1 where name = '@url'"; dbMailEnable.Database.ExecuteSqlCommand(SQL, new SqlParameter("@url", EP.Cliente.Url...
asked by 25.02.2016 / 20:43
2
answers

I can not connect the localDB with visual studio

I'm trying to use the entity framework in Visual Studio, but when I try to run the program it generates the error: System.Data.SqlClient.SqlException was unhandled Class=20 ErrorCode=-2146232060 HResult=-2146232060 LineNumber=0 Me...
asked by 16.11.2015 / 18:50