I’m trying to generate a Generic Repository. So far, so good.
But I get the same error as somebody else posted before:
Mapping to a nested class
The problem is that I am apparently trying to map a nested class. How can I fix this, so I do not map a nested class anymore?
EDIT:
That should not be the problem.
namespace MvcApplication1.Models
{
public class MyContext :DbContext
{
public DbSet<ALBUM> Albums { get; set; }
...
}
}
where for example ALBUM:
[EdmEntityTypeAttribute(NamespaceName="MyDbModel", Name="ALBUM")]
[Serializable()]
[DataContractAttribute(IsReference=true)]
public partial class ALBUM : EntityObject
Why is the class ALBUM not allowed to map?
This is the error message you’re getting.
System.InvalidOperationException: The type ‘ContactModels+Contact’ was not mapped. Check that the type has not been explicitly excluded by using the Ignore method or NotMappedAttribute data annotation. Verify that the type was defined as a class, is not primitive, nested or generic, and does not inherit from EntityObject.
AND THIS is the class you’re trying to map:
You’re inherting from
EntityObject. It says right there. You can’t map it.