This project is read-only.

EntityFramework questions? could not use"Find""Remove"method

Apr 10, 2011 at 6:56 PM

hi~~could anybody tell me why this happened?

Without adding "Album.cs""Artist.cs""Genre.cs"etc. classes in Models,

I created my own data tables in SQL server and .edmx "ADO.NET Entity Data Model"  data file in Models,


it's working , except "var album = storeDB.Albums.Find(id);"

" storeDB.Albums.Remove(album);" system doesn't recognize these two methods, added"using"

I need to replace them by where, delectobject methods


could anyone know what happened?

or why there need be data classes added in Models coding by ourseleves

and this difference will happen?


thank you very much in advance!

Apr 10, 2011 at 11:06 PM


It would be hard to help without knowing more of what you are doing; you asked the question in the MVC Music Store discussion but you are referencing a different tutorial so we have no point of reference as to where you are at with your code, or what you are trying to accomplish.

Maybe if you could give a step by step of what you have done so far and whether you are actually working on the MVC Music Store project.

Apr 11, 2011 at 12:41 AM
Edited Apr 11, 2011 at 12:49 AM

Hi,madisonjames,thank you so much for response. sorry for lack of information.

because I tried to use my own database and MVCMusicStore has the preload database and the author refer to that link at part4, so that's why i mentioned that link which i was following when tried to create the entity framework.


my database is just similar as MvcMusicStore I just tried to create it from beginning and tried to learn every detail how that working..I am in part create ,edit delete Albums information part, everything going fine just this difference happened, again, i didn't add any data model as the tutorial did, i created .edmx file..(that because i didn't know other methods if i create database by my own)

I just following this step and created tables in SQL server, everything working fine just could not use "var album = storeDB.Albums.Find(id);" " storeDB.Albums.Remove(album);"methods.


also,If I didn't create the .edmx file, just connected to the database in SQL server and added "Album.cs""Artist.cs""Genre.cs"etc. classes in Models , it'll have error like data will not be recognized.


I think the MVCMusicStore preload database maybe not just created by in SQL server create tables and I tried with that link built .edmx file,but if you added "Album.cs""Artist.cs""Genre.cs"etc. classes in Models in tutorial, it will tell duplicated...


you can see I am so new to entity framework, Also I am going to learn from beginning


because i think maybe someone will be more familiar to this project so I post here..


any suggestion to learn EntityFrame work  or point out what happened to me will be very appreciated !

May 1, 2011 at 7:05 PM

I think couldn't make the use database and model class


is because I don't know the knowledge of EntityFramework partial class defination