ASP.NET MVC How to Manipulate Table Users Using Code First

Asked

Viewed 103 times

1

I’m studying MVC ASP.NET code first. I’m a beginner and I have a question probably basic. When starting a project, it already creates a basic application, including the table User. I happen to be wanting to make a relationship between this User table with another that I will create, for example Comments. Then there are two questions:

a) To make the relationship in code first, I need to say that the table User has a virtual list of Comments. How to do this if I do not see the model of User?

b) How to define field rules by Fluent API, if I don’t have Model?

Thank you!!

  • You could post the relevant code snippets of your application so I can better assess the problem?

  • 1

    I think it’s unclear. It’s not ag=lgo that I’ve developed. I’m looking to manipulate the table that ASP.NET MVC creates automatically. He already creates User, User_roles, and a few more. These tables were not created by me, but by the application itself. By the time I run the application, it already creates the database and these tables. That is, I did not create the Users entity.. That is the question. How to manipulate this table by code, since I don’t have the model created by me.

1 answer

1


  • That’s exactly what I was looking for. Thank you, Edney!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.