Underlined items below indicate underlined in red squiggly line in Visual Web Studio.
What is the process for getting these items to resolve properly and no longer indicate errors.
From MusicStoreEntities.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
namespace MvcMusicStore.Models
{
public class MusicStoreEntities : DbContext
{
public DbSet<Album> Albums { get; set; }
public DbSet<Genre> Genres { get; set; }
}
}
OK - I think I'm getting somewhere...the underline indicated in the questions above changed from a red squiggly line to a blue squiggly line (not exactly sure what that indicates but blue has to be better than red.
I'm wondering if the reason I have to do this step when it's not indicated in the tutorial is because I am saving each step in the tutorial as a stop point, so by the time I've gotten to the current stop point (part 4a - indicated by the "StopPoint04a" containing
folder) I've "saved this project as..." - or exported it as a template - at least 4 times since it's original stop point. Perhaps the project, when exported, remains pointing to the original reference from which it was first exported until adjusted.
So...I gues the follow-up questions are...
1. Did I add the reference correctly (outlined in the steps above)?
2. Did I have to do this because I have "Exported Template..." from the original project to create successive stop points - or versions - of the project?
3. What is the difference between red and blue squiggly lines (and how to get rid of blue lines next).
The question rephrased, including error message below. Any help would be greatly appreciated (I've been at a stand at this part of the tutorial for a month or two).
Having difficulty with Part 4 of the Music Store Tutorial: Error, steps taken thus far, and code included below.
--------------------------------------------------------------------------------
Error 2: The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?)
Warning 2 The type 'MvcMusicStore.Models.Album' in 'C:\Documents and Settings\Alphauser\Desktop\Tutorials\MusicStore\04a\MvcMusicStore\MvcMusicStore\Models\Album.cs' conflicts with the imported type 'MvcMusicStore.Models.Album' in 'C:\Documents and Settings\Alphauser\Desktop\Tutorials\MusicStore\04a\MvcMusicStore\MvcMusicStore\bin\MvcMusicStore.dll'.
Using the type defined in 'C:\Documents and Settings\Alphauser\Desktop\Tutorials\MusicStore\04a\MvcMusicStore\MvcMusicStore\Models\Album.cs'. C:\Documents and Settings\Alphauser\Desktop\Tutorials\MusicStore\04a\MvcMusicStore\MvcMusicStore\Models\MusicStoreEntities.cs 12 22 MvcMusicStore
--------------------------------------------------------------------------------
2.Added "using MvcMusicStore.Models;" using directive by just entering text (not sure if there is a better way of doing that)
3.Additional Info: created stop points for this tutorial so that I could referece and recreate the results of each step of the tutorial. In doing so, I "Exported Template" at each step of the tutorial. Thinking this might be complicating things as far as
having to reference dll and add using directives not specified in tutorial.
(DBContext and both DBSet items squiggly underlined in blue - used to be underlined in red before adding "using MvcMusicStore.Models;" line.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using MvcMusicStore.Models;
namespace MvcMusicStore.Models
{
public class MusicStoreEntities : DbContext <- error - underlined in blue
{
public DbSet<Album> Albums { get; set; } <- error - underlined in blue
public DbSet<Genre> Genres { get; set; } <- error - underlined in blue
}
}
3v3rhart
Member
159 Points
317 Posts
Music Store Tutorial / DbContext / DbSet Album / DbSet Genre
Jul 14, 2012 09:20 PM|LINK
Underlined items below indicate underlined in red squiggly line in Visual Web Studio.
What is the process for getting these items to resolve properly and no longer indicate errors.
From MusicStoreEntities.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
namespace MvcMusicStore.Models
{
public class MusicStoreEntities : DbContext
{
public DbSet<Album> Albums { get; set; }
public DbSet<Genre> Genres { get; set; }
}
}
Note: taken from Part 4 of Music Store Tutorial.
ignatandrei
All-Star
137698 Points
22155 Posts
Moderator
MVP
Re: Music Store Tutorial / DbContext / DbSet Album / DbSet Genre
Jul 15, 2012 03:06 AM|LINK
add reference to the dll containing the Album.
3v3rhart
Member
159 Points
317 Posts
Re: Music Store Tutorial / DbContext / DbSet Album / DbSet Genre
Jul 15, 2012 12:37 PM|LINK
Steps Taken to add reference to the dll containing the Album:
1. Project [Menu] / Add Reference [Option] / Browse [Tab}
2. Path: ...StopPoint04a / MvcMusicStore / MvcMusicStore / bin / MvcMusicStore.dll
OK - I think I'm getting somewhere...the underline indicated in the questions above changed from a red squiggly line to a blue squiggly line (not exactly sure what that indicates but blue has to be better than red.
I'm wondering if the reason I have to do this step when it's not indicated in the tutorial is because I am saving each step in the tutorial as a stop point, so by the time I've gotten to the current stop point (part 4a - indicated by the "StopPoint04a" containing folder) I've "saved this project as..." - or exported it as a template - at least 4 times since it's original stop point. Perhaps the project, when exported, remains pointing to the original reference from which it was first exported until adjusted.
So...I gues the follow-up questions are...
1. Did I add the reference correctly (outlined in the steps above)?
2. Did I have to do this because I have "Exported Template..." from the original project to create successive stop points - or versions - of the project?
3. What is the difference between red and blue squiggly lines (and how to get rid of blue lines next).
Young Yang -...
All-Star
21741 Points
1825 Posts
Microsoft
Re: Music Store Tutorial / DbContext / DbSet Album / DbSet Genre
Jul 16, 2012 09:35 AM|LINK
Hi
It usually caused by not reference the corresponding dll, so you should check whether there is System.Web.Entity in your Reference folder.
And could you please post the error message of this issue?
Regards
Feedback to us
Develop and promote your apps in Windows Store
3v3rhart
Member
159 Points
317 Posts
Re: Music Store Tutorial / DbContext / DbSet Album / DbSet Genre
Jul 17, 2012 10:53 PM|LINK
The question rephrased, including error message below. Any help would be greatly appreciated (I've been at a stand at this part of the tutorial for a month or two).
--------------------------------------------------------------------------------
Having difficulty with Part 4 of the Music Store Tutorial: Error, steps taken thus far, and code included below.
--------------------------------------------------------------------------------
Error 2: The type or namespace name 'DbContext' could not be found (are you missing a using directive or an assembly reference?)
C:\Documents and Settings \ Alphauser \ Desktop \ Tutorials \ MusicStore \ 04a \ MvcMusicStore \ MvcMusicStore \ Models \ MusicStoreEntities.cs 10 39 MvcMusicStore
Warning 2 The type 'MvcMusicStore.Models.Album' in 'C:\Documents and Settings\Alphauser\Desktop\Tutorials\MusicStore\04a\MvcMusicStore\MvcMusicStore\Models\Album.cs' conflicts with the imported type 'MvcMusicStore.Models.Album' in 'C:\Documents and Settings\Alphauser\Desktop\Tutorials\MusicStore\04a\MvcMusicStore\MvcMusicStore\bin\MvcMusicStore.dll'. Using the type defined in 'C:\Documents and Settings\Alphauser\Desktop\Tutorials\MusicStore\04a\MvcMusicStore\MvcMusicStore\Models\Album.cs'. C:\Documents and Settings\Alphauser\Desktop\Tutorials\MusicStore\04a\MvcMusicStore\MvcMusicStore\Models\MusicStoreEntities.cs 12 22 MvcMusicStore
--------------------------------------------------------------------------------
Steps Taken:
1.Added reference to MvcMusicStore.dll (through Project [Menu] / Add Refernce [Option] / Browse [Tab]).
2.Added "using MvcMusicStore.Models;" using directive by just entering text (not sure if there is a better way of doing that)
3.Additional Info: created stop points for this tutorial so that I could referece and recreate the results of each step of the tutorial. In doing so, I "Exported Template" at each step of the tutorial. Thinking this might be complicating things as far as having to reference dll and add using directives not specified in tutorial.
--------------------------------------------------------------------------------
MusicStoreEntities.cs Code
(DBContext and both DBSet items squiggly underlined in blue - used to be underlined in red before adding "using MvcMusicStore.Models;" line.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using MvcMusicStore.Models;
namespace MvcMusicStore.Models
{
public class MusicStoreEntities : DbContext <- error - underlined in blue
{
public DbSet<Album> Albums { get; set; } <- error - underlined in blue
public DbSet<Genre> Genres { get; set; } <- error - underlined in blue
}
}
3v3rhart
Member
159 Points
317 Posts
Re: Music Store Tutorial / DbContext / DbSet Album / DbSet Genre
Jul 20, 2012 03:22 PM|LINK
EF not installed...at all.
confusing to me because...
- At one point, Create, Edit, Review views automatically were being created on this computer...so not sure how it would have gotten uninstalled.
- Error message didn't explicitly point to EF, which had most who offered help over past month looking elsewhere for solution.
Don't really care about why though at this point so much as just being able to move forward coding after a month or more of being stalled.
Thanks again.
Dean