 |
BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
 | This is the forum to discuss the Wrox book Beginning ASP.NET 4.5.1: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-84677-3 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 4.5.1 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

June 5th, 2016, 02:14 PM
|
|
Registered User
|
|
Join Date: May 2016
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
the book and problem with EF
The book has some problem with new version of VisualStudio , in chapter 14 I simply I'm just getting error messages in code behind the page and with compiler : following errors:
http://s33.postimg.org/ebuhx194v/bug1.jpg
http://s33.postimg.org/fs60f6c1r/bug2.jpg
I tried your solution on another topic about getting back to version 5 of EF but it didn't work .still the same problem .now here are my questions:
1-is there a way to get around this problem?
2-if I get visual studio 2012, would it fix the problem?
3-can I skip this chapter and go on with following chapters in the case the problem persists ?
|
|

June 6th, 2016, 06:29 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
>> 1-is there a way to get around this problem?
How did you call your EF model? Is it called PlanetWroxEntities? Are you sure you're targeting EF 5 and not 6? (You may have to get of EF 6 completely first, including clearing the connection strings from web.config). Finally, what happens when you hit Ctrl+Dot on the error from your screenshot?
>> 2-if I get visual studio 2012, would it fix the problem?
Yep. You can easily install it side by side.
>> 3-can I skip this chapter and go on with following chapters in the case the problem persists ?
You could, although you'll have trouble with all other EF related exercises. You can also grab a copy of the book's source code for the chapter you're working on an use that going forward.
Cheers,
Imar
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|

June 6th, 2016, 06:53 AM
|
|
Registered User
|
|
Join Date: May 2016
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
Thanks
your last hint solved the problem when you said:"what happens when you hit Ctrl+Dot on the error from your screenshot?"
it simply added using "PlanetWroxModel;" to the namespace and now I can see the
table on the page
what was the problem? was it code problem or some incompatibility with visual studio ,why I can't use EF6 and do I miss something here if I use EF5?
btw I used your source code with vs 2013 and I got the same problem as mine I tried to add "using PlanetWroxModel;" to namespace but it didn't recognize PlanetWroxEntities as class .whats going on here?
Last edited by mohsenfff; June 6th, 2016 at 07:05 AM..
|
|

June 7th, 2016, 07:55 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Did you create a Web Application Project instead of a Web Site Project? How many code behind files does your Default.aspx have? One or two?
Imar
|
|

June 7th, 2016, 11:41 AM
|
|
Registered User
|
|
Join Date: May 2016
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by Imar
Did you create a Web Application Project instead of a Web Site Project? How many code behind files does your Default.aspx have? One or two?
Imar
|
I exactly remember using Web Site Project , and I tried your "source code" folder for chapter 14 too but I got exactly the same error as I got when I used my "site" folder. so have you tried your codes in VS 2013 or 2015?
is there a way we can update the code to work with version 2015?
my Default.aspx has just one code behinde the files.
|
|

June 7th, 2016, 12:13 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
All the code in the book was tested and built against Vs 2013 so it should work there.
Foe VS 2015, it's a bit different, with the EF version being the biggest issue but there are differences too.
If you target EF 5 as explained in some threads here, it should work. You should be able to make it work with EF 6 but you'll encounter differences in code with this one - I believe - being one of them. For the purpose of following along with the book, using EF 5 should be fine.
Cheers,
Imar
|
|

June 7th, 2016, 12:35 PM
|
|
Registered User
|
|
Join Date: May 2016
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
I'm using visual studio 2013 ultimate ,maybe that's why I get the error messages.because I got errors with 2013 exactly the same way as I did with my code , I couldn't even open your chapter 14 source codes in my VS 2015.
But I will go on with your guide on EF5 ,I'm wondering what is Microsoft solution for this problem? but if you say it doesn't make that much difference I'll go with that.
thanks
|
|

June 7th, 2016, 01:04 PM
|
|
Registered User
|
|
Join Date: May 2016
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
sorry to ask the question again but I'm not able to follow the guides .because you said in your book :
" If you look in the Code Behind of PlanetWrox.tt, you’ll
see two classes called Genre and Review, which are generated based on the two tables from the database
you added to the diagram. Likewise, the Code Behind of PlanetWrox.Context.tt contains a
the class that inherits from DbContext, the main object in EF that provides access to your database"
but when I open your chapter 14 source codes in my visual studio 2013 ,in code behind the page I just get the following error:
http://s32.postimg.org/fsv1rcrjp/bug3.jpg
can you please guide me what can I do regarding your guides when I can't find the appropriate example in my visual studio even with your source code?
and is it possible for you to one more time test chapter 14 in your visual studio? is it possible that something is wrong with my VS?
[edit]
It may be helpful , I started from chapter 13 source code and tried to add EF6 manually ,but when i got to first step when i had to click ADO.NET Entity Data Model ,simply there was not one there , it's the page with all templates :
http://postimg.org/image/ny7estqlt/
To me it seems something is missing ,should I run again the installation DVD and add something ?
Last edited by mohsenfff; June 7th, 2016 at 01:51 PM..
Reason: Adding a probable reason for the problem
|
|

June 9th, 2016, 03:10 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Did you see this? http://stackoverflow.com/questions/2...99100#21899100
It looks like you have a mix of EF 5 and EF 6 in your project. Did you try removing the packages, deleting the connection strings from web.config and trying again targeting EF 5?
Cheers,
Imar
|
|

June 14th, 2016, 10:57 AM
|
|
Registered User
|
|
Join Date: May 2016
Posts: 9
Thanks: 2
Thanked 0 Times in 0 Posts
|
|
Yes , you are right it was mixed up .I can go on with EF5 with no problem , just had some difficulty following up the guides . does it means there is no way I can use EF6 in VS 2015?
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| EF Version |
SHOOGN |
BOOK: Professional ASP.NET 4.5 : in C# and VB |
0 |
December 9th, 2015 09:39 AM |
| EF version |
SHOOGN |
BOOK: Beginning ASP.NET 4.5.1 : in C# and VB |
2 |
December 9th, 2015 09:38 AM |
| Publishing with EF?? |
Grodnik |
BOOK: Beginning ASP.NET 4.5 : in C# and VB |
9 |
October 8th, 2015 04:55 PM |
| EF Repository |
hpcsc |
BOOK: Patterns, Principles and Practices of Domain-Driven Design |
2 |
August 26th, 2015 03:26 AM |
| connectionString using EF |
nanonerd |
ASP.NET 4 General Discussion |
6 |
July 19th, 2012 01:28 PM |
|
 |
|