Extending Nop data model

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


Thank you, Andrei, I'll try this way.
11 years ago
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
11 years ago
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);
       }
11 years ago
the hariomhari's solution is working for me, shold this command be in the main context of NopCommerce Core?
11 years ago
I'm having the same issues with the 2.65 and 2.7 code base.  Not sure why nobody else is...
11 years ago
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.
11 years ago
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.
11 years ago
EDIT:
Sorry, wanted to ask for more info, did not see the second page :-/
10 years ago
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.