I was using Entity Framework Power Tools Beta 2 to reverse engineering Code First. In the DB there’s a table name “Object”.
When I test, it gives me this error:
The type ‘TestEFPowerTools.Models.Object’ 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.
After I comment out
public DbSet<Object> Objects { get; set; }
modelBuilder.Configurations.Add(new ObjectMap());
in the Context file, everything works fine. How do I fix it or Is it a bug in the power tools?
Object is a reserved word in C#, the base class for everything, although you may be able to get around this by mapping renaming the class to something other than object, and mapping to the object table, using fluent or data annotations. I would rename the table if possible though.
Change your classname from Object to something else, ObjectData for example. Rename all the references to Object to ObjectData:
In the configuration, add a mapping to a different table: