Questions tagged as 'entity-framework'

1
answer

How to implement encryption in the password?

I want to implement password encryption in the user registry. I found here on stackoverflow this post teaching how to use encryption, but I'm in doubt where I should add the code. Should this method be used in the class or controller? pub...
asked by 22.10.2018 / 18:24
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
1
answer

Method that works without calling you directly

I'm messing with the Entity Framework and I was doing mapping for a Many to Many class. What happens is that I used a method that I can use within DbContext to rename a table, and it works without problems. But I was wondering how t...
asked by 21.08.2018 / 21:05
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
1
answer

Conflict between objects of the same type in the Entity Framework

I have the following class: public class Conteudo { public long Id { get; set; } public string Categoria { get; set; } public string SubCategoria { get; set; } public string Descricao { get; set; } public string Status { g...
asked by 20.10.2017 / 16:04
1
answer

ToTable method is not recognized

Contextualization I'm starting in ASP.Net CORE and, to consolidate knowledge, I'm trying to make a small project already using this framework. However, I'm having trouble mapping my domain classes. Problem I added a Class Library (.NET...
asked by 04.09.2017 / 03:06
1
answer

How to change the column name of a table using the Add-Migration Code First command Asp.Net MVC

I have a table already created and I want to change the name of the column without it being deleted, since it already has a lot of information. I did the procedure to rename the Street to Address property in the class and after I ran the Add...
asked by 15.10.2017 / 14:41
1
answer

Error editing registry more than once with EntityFramework C #

When editing a record and saving for the first time the entityframework performs the update successfully, however when I click again to edit and save the registry I encounter the following error:    Error saving record: Attaching an entity of...
asked by 25.09.2017 / 22:33
1
answer

Delete a foreach and replace the result in a lambda expression in a method

The thing is very simple indeed. I have a method that takes a name inside a database and compares with the parameter passed in the method and being is equal, return it in the method, otherwise return a string.Empty . It turns out, I'm havi...
asked by 20.07.2017 / 14:52
1
answer

Error using GROUP via LINQ

I'm trying to perform the query below: var query = from s in db.Crm_Analise where s.cliente_CRM == cod_cli group s by s.TAG into g select new...
asked by 14.07.2017 / 18:20