This project has moved and is read-only. For the latest updates, please go here.

The entity type T is not part of the model for the current context.

Dec 30, 2013 at 9:52 PM
Edited Dec 30, 2013 at 9:52 PM

Neat library. I am trying to get started and implemented a DbContext the way you said to. (I am using EF6) However when I try to add an entity I get this error:
Test Name:  OutOfHoursOnArrival_LTN
Test FullName:  SigNetBRE.Tests.OutOfHours.OutOfHoursOnArrival_LTN
Test Source:    c:\TFS2012\SigNetBRE\Development\SigNetBRE\SigNetBRE.Tests\OutOfHours.cs : line 36
Test Outcome:   Failed
Test Duration:  0:00:04.9964638

Result Message: Initialization method SigNetBRE.Tests.OutOfHours.MyTestInitialize threw exception. System.InvalidOperationException: System.InvalidOperationException: The entity type PublicHoliday is not part of the model for the current context..
Result StackTrace:  
at System.Data.Entity.Internal.InternalContext.UpdateEntitySetMappingsForType(Type entityType)
   at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
   at System.Data.Entity.Internal.Linq.InternalSet`1.Initialize()
   at System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext()
   at System.Data.Entity.Internal.Linq.InternalSet`1.ActOnSet(Action action, EntityState newState, Object entity, String methodName)
   at System.Data.Entity.Internal.Linq.InternalSet`1.Add(Object entity)
   at System.Data.Entity.DbSet`1.Add(TEntity entity)
   at SigNetBRE.Common.Repository`2.Add(T entity) in c:\TFS2012\SigNetBRE\Development\SigNetBRE\SigNetBRE.Common\Repository.cs:line 27
   at SigNetBRE.Tests.Fake.FakePublicHolidayRepository..ctor() in c:\TFS2012\SigNetBRE\Development\SigNetBRE\SigNetBRE.Tests\Fake\FakePublicHolidayRepository.cs:line 13
   at SigNetBRE.Tests.OutOfHours.MyTestInitialize() in c:\TFS2012\SigNetBRE\Development\SigNetBRE\SigNetBRE.Tests\OutOfHours.cs:line 20
Any idea why? I can post some more code if needed. Thanks.
Jan 25, 2014 at 11:13 PM

Thank you for reporting this issue and sorry for the late response.

Yes,a little proof of concept sample code might be really useful.