Questions tagged as 'entity-framework-6'

0
answers

update-database command does not work in multiple contexts

I have two context in my project. I followed the instructions in this Article where it shows how to have 2 context in the same project. Each context is for separate banks, so they are 2 ConnectionString How...
asked by 20.05.2015 / 19:50
1
answer

Entity Framework 6: Select Error [closed]

I'm having problems with Entity Framework 6 with Code First. The "Select" operations give an error and EF6 does not specify the exception, as shown below: Error Message:    An exception was thrown by the destination of a call. Exceptio...
asked by 02.12.2016 / 19:32
0
answers

Make query using Object with the Entity Framework

I have a method that gets a object that can be both int and string , does anyone know a way to entity framework interpret the object!? I know I can make a if and do the check, but I'm trying to do it in a sim...
asked by 15.06.2015 / 04:21
1
answer

Variable interfering with the value of another variable

Good afternoon Srs. I'm facing a problem I've never seen before, below I have a view mapped in EF with fluent var viewRelatorio = db.view.where(ra.DataBruta.Month == mesAno.Month).toList(); I have two dictionaries that will interact wi...
asked by 07.02.2017 / 18:57
1
answer

(LocalDB) Update-Database Post-Error Error - "Can not attach the file ..."

I'm trying to use Sql Serves LocalDB in an application with the Entity Framework and Migrations, but when I give the Update-Database command, the following error occurs:    Can not attach the file   'C: \ Directories \ 9-ProjectsMVS \ DB Test...
asked by 06.08.2018 / 19:08
2
answers

Problem saving data to the database

I created a simple application, but when I click on the action button responsible for saving the data, the program stops working. Here's a picture: Save button action: - private void button_Click(object sender, RoutedEventArgs e)...
asked by 14.03.2018 / 22:28
2
answers

How to change EF6 to create DateTime fields like datetime2

I'm working with EF6 Code-first, SQL-Server database. I encountered the following error when saving an object with DateTime property.    The conversion of a datetime2 data type to a datetime result in an out-of-range value.   ↵The statemen...
asked by 06.04.2018 / 15:37
1
answer

Entity Framework 6: Context Management Problem

I have the Calendar object and create it as follows: public class Program { public static void Main(string[] args) { var clienteDAO = new ClienteDAO(); var treinoDAO = new TreinoDAO(); var agendaDAO = new Agenda...
asked by 16.11.2017 / 12:51
1
answer

Using SQL Query with Asp MVC5

How do I execute a SQL query with ASP MVC5 + Entity? To create the MVC I used the entity's own option (I created the model, context) and already generated the controller and the views Follow the controller code: using System; usi...
asked by 15.01.2018 / 18:50
2
answers

EF6: Error Recording

I have the following scenario that I'm having problem: Category: public class Categoria { public int Id { get; set; } public string Descricao { get; set; } public virtual ICollection<Produto> Produtos { get; set; } }...
asked by 31.10.2016 / 17:42