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

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Il y a 9 ans
The entity type ABC is not part of the model for the current context.

what does this mean? i'm developing a new module, when runing system has a error: The entity type ShirtBackType is not part of the model for the current context.
ShirtBackType is a my model;
 public partial class ShirtBackType : BaseEntity, ILocalizedEntity, ISlugSupported, IAclSupported, IStoreMappingSupported
    {


Please help me! Thanks
Il y a 9 ans
Can you share your ShirtBackType.cs ?
Il y a 8 ans
Hi,

I have the same problem. i added a new table into the database. then added new classes in :
Nop.Core
Nop.Data
Nop.Services

new controller in Nop.Web and Nop.Admin

when i try to insert using the following code i got the error:

public virtual void InsertWarranty(Warranty warranty)
{
  if (warranty == null)
    throw new ArgumentNullException("warranty");

  //some validation
  if (warranty.CustomerId == 0)
    warranty.CustomerId = 0;
  
  _warrantyRepository.Insert(warranty);

  //cache
  _cacheManager.RemoveByPattern(WARRANTY_PATTERN_KEY);

  //event notification
  _eventPublisher.EntityInserted(warranty);
}

also i registered the service class in dependency register.

Any help please.
Il y a 8 ans
Hi all,

I have same problem and I define all properties, mappings all steps same as category or other entites.



But when I rebuild Nop.Data project and debug project again, this error doesn't shown, after some minutes or debug without rebuild Nop.Data, it appears again.

Is there any suggestion or solution ?



These classes are in Nop.Data project, not in any plugin..

public partial class ProductPlan : BaseEntity
    {
        public virtual int ProductId { get; set; }
        public virtual int StoreId { get; set; }
        public virtual int CategoryId { get; set; }
        public virtual DateTime StartDate { get; set; }
        public virtual DateTime EndDate { get; set; }
        public virtual int DisplayOrder { get; set; }
        public virtual bool IsSlider { get; set; }
        public virtual bool Deleted { get; set; }

        
        public virtual Product Product { get; set; }
        public virtual Category Category { get; set; }
    }

public partial class ProductPlanMap : NopEntityTypeConfiguration<ProductPlan>
    {
        public ProductPlanMap()
        {
            this.ToTable("ProductPlan");
            this.Property(p => p.ProductId).IsRequired();
            this.Property(p => p.StoreId).IsRequired();
            this.Property(p => p.CategoryId).IsRequired();
            this.Property(p => p.DisplayOrder).IsRequired();
            this.Property(p => p.StartDate).IsRequired();
            this.Property(p => p.EndDate).IsRequired();
            this.Property(p => p.IsSlider).IsRequired();
            this.Property(p => p.Deleted).IsRequired();

        }
    }

Thank you
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.