So I've got a project and I've setup the Entity Framework model in a folder called
App_code.
I've previously added 5 classes (tables) with no problem, but when I try and add the
PostCodesUK and then compile I get this error:
Error 1 The type or namespace name
I can't seem to this what the issue is. I look under
WalksModel.edmx > WalksModel.tt and I can see the class
PostCodesUK.cs. However, this class doesn't have any nodes, unlike the ALL the others, where I can expand the node and see their properties.
The other thing is if I look in the WalksModel.Context.cs I can see:
namespace DogWalks.App_Code
{
using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
public partial class WalksContext : DbContext
{
public WalksContext()
: base("name=WalksContext")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public virtual DbSet<Comment> Comments { get; set; }
public virtual DbSet<DogWalk> DogWalks { get; set; }
public virtual DbSet<Feature> Features { get; set; }
public virtual DbSet<Image> Images { get; set; }
public virtual DbSet<Rating> Ratings { get; set; }
public virtual DbSet<PostCodesUK> PostCodesUKs { get; set; }
}
}
However, where it says DbSet<postcodesuk>, the PostCodesUK is underlined with the same error message above.
What is happening here, what is the problem? Please help, thanks.
Here is the PostCodesUK class, which looks identical to all other classes:
namespace DogWalks.App_Code
{
using System;
using System.Collections.Generic;
public partial class PostCodesUK
{
public int PostcodeID { get; set; }
public string Postcode { get; set; }
public decimal Latitude { get; set; }
public decimal Longitude { get; set; }
public string PostcodeNoSpace { get; set; }
}
}