TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Sajid Hussain
1.2k
514
100.7k
How to create Controller with views ,using EF
Oct 23 2017 7:58 AM
I am facing problem in creating Controller with views ,using EF in visual studio.
I am following approach to speed up development of client projects,
I use to create database with tables and also create their relationships
Using database first approach,create the entities of all tables,
Create ViewModel for each class with data annotations for validation.
Now when I use to create controller using Controller with views ,using EF,its create controller and view using this viewmodel class.
Problem is that this viewmodel does not exist in db,as I created this just to get data from user.so if i try to save this it gives me error that this view model does not exist.
Now if I use entities that EF has created for me to create controller so that will not be good approach
I have go through different solution after googling, but my point is what is the benefit of that DB first approach if I have to go all different solution.
I think in MVC 2.0 or 3.0 there is option that use can select viewmodel class and then bind it to desired model class that is actually save data into respective table.
Now there is just one option select db context
What is best approach to use Controller with views ,using EF at maximum to speed up development.
Reply
Answers (
1
)
how to inject sqlinject in parameterized query,,,?? any ehlp
session variable in dotnet web application