title: Entity Framework 4.2 "The type is not attributed with EdmEntityTypeAttribute but is contained in an assembly attributed with EdmSchemaAttribute
body: <p>I am receiving the following error: </p>
  
  <blockquote>
    <p>System.InvalidOperationException was unhandled   Message=The type
    'Judge' is not attributed with EdmEntityTypeAttribute but is contained
    in an assembly attributed with EdmSchemaAttribute. POCO entities that
    do not use EdmEntityTypeAttribute cannot be contained in the same
    assembly as non-POCO entities that use EdmEntityTypeAttribute.<br>
    Source=EntityFramework   StackTrace:
           at System.Data.Entity.Internal.InternalContext.UpdateEntitySetMappingsForType(Type
    entityType)
           at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type
    entityType)....</p>
  </blockquote>
  
  <pre><code> public class GenericRepository&lt;TEntity&gt; where TEntity : class
  {
      internal z context;
      internal DbSet&lt;TEntity&gt; dbSet;
  
      public GenericRepository(z context)
      {
          this.context = context;
          this.dbSet = context.Set&lt;TEntity&gt;();
      }
  
      public GenericRepository()
      {
          this.context = new z();
          this.dbSet = context.Set&lt;TEntity&gt;();
      }
  
      public virtual IEnumerable&lt;TEntity&gt; Get(
          Expression&lt;Func&lt;TEntity, bool&gt;&gt; filter = null,
          Func&lt;IQueryable&lt;TEntity&gt;, IOrderedQueryable&lt;TEntity&gt;&gt; orderBy = null,
          string includeProperties = "")
      {
  
          IQueryable&lt;TEntity&gt; query = dbSet;
  
          if (filter != null)
          {
              query = query.Where(filter);
          }
  
          foreach (var includeProperty in includeProperties.Split
              (new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
          {
              query = query.Include(includeProperty);
          }
  
          if (orderBy != null)
          {
              return orderBy(query).ToList();
          }
          else
          {
              return query.ToList(); //Getting error here!!
          }
      }
  
      public virtual TEntity GetByID(object id)
      {
          return dbSet.Find(id);
      }
  
      public virtual void Insert(TEntity entity)
      {
          dbSet.Add(entity);
      }
  
      public virtual void Delete(object id)
      {
          TEntity entityToDelete = dbSet.Find(id);
          Delete(entityToDelete);
      }
  
      public virtual void Delete(TEntity entityToDelete)
      {
          if (context.Entry(entityToDelete).State == EntityState.Detached)
          {
              dbSet.Attach(entityToDelete);
          }
          dbSet.Remove(entityToDelete);
      }
  
      public virtual void Update(TEntity entityToUpdate)
      {
          dbSet.Attach(entityToUpdate);
          context.Entry(entityToUpdate).State = EntityState.Modified;
      }
  
      public virtual void Save()
      {
          context.SaveChanges();
      }
  }
  </code></pre>
  
  <p>The weird part is Judge is attributed with the EdmEntityTypeAttribute, because it is automatically generated as part of the DbContext T-4 jazz.</p>
  
  <pre><code>    /// &lt;summary&gt;
  /// No Metadata Documentation available.
  /// &lt;/summary&gt;
  [EdmEntityTypeAttribute(NamespaceName="standaloneModel", Name="Judge")]
  [Serializable()]
  [DataContractAttribute(IsReference=true)]
  public partial class Judge : EntityObject
  {
  </code></pre>
  
  <p>At one point I did have another class Judge in a different assembly, but I have since renamed it.  I have tried cleaning both projects.  There should be no other Judge class besides the EF one.</p>
  
  <p>So I can not figure out where this other Judge class is coming from??</p>
  
  <p>Thanks</p>