Extending Nop data model

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Hace 12 años
I have also created a work item for this issue
Hace 12 años
a.m. wrote:
You can simply remove this property and use IProductService for product variant loading.


Thank you, Andrei, I'll try this way.
Hace 11 años
Any progress on this? I'm having the same issue developing a plugin for "Favorite Categories".

Unable to determine the principal end of an association between the types 'Nop.Core.Domain.Customers.RewardPointsHistory' and 'Nop.Core.Domain.Orders.Order'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations.

UPDATE
 public FavoriteCategoriesMap()
        {
            this.ToTable("FavoriteCategories");
            this.HasKey(pc => pc.Id);
            this.HasRequired(pc => pc.Category)
              .WithMany()
              .HasForeignKey(pc => pc.CategoryId);

            this.HasRequired(pc => pc.Customer)
                .WithMany()
                .HasForeignKey(pc => pc.CustomerId);

            Property(m => m.AddedDateUtc);
            Property(m => m.AutoAdded);
            Property(m => m.Deleted);
        }


Darren
Hace 11 años
add the following line in the OnModelCreating of the plugin. I had the similar issue when I tried extending Customer.It worked for me.

   protected override void OnModelCreating(DbModelBuilder modelBuilder)
       {
           modelBuilder.Entity<RewardPointsHistory>().HasRequired(p => p.UsedWithOrder).WithOptional();
           base.OnModelCreating(modelBuilder);
       }
Hace 11 años
the hariomhari's solution is working for me, shold this command be in the main context of NopCommerce Core?
Hace 11 años
I'm having the same issues with the 2.65 and 2.7 code base.  Not sure why nobody else is...
Hace 11 años
Add this line to onmodelcreating method

          modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
          modelBuilder.Entity<Prenotazione>().Ignore(c => c.Ordine); //Where ordine and cliente are existing nop class
          (order and customer).
          modelBuilder.Entity<Prenotazione>().Ignore(c => c.Cliente);

and remove all foreignkey to existing nop table to solve all problems.
Hace 11 años
Is there any update on this?  I am implementing a plugin in 2.7, and I am getting the same issue.  I'll go ahead and look into the work around posted here.
Hace 11 años
EDIT:
Sorry, wanted to ask for more info, did not see the second page :-/
Hace 10 años
I understand the thread is now so old, but I wonder if Nopcommerce have a solution for such case now!?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.