Open Closed

Why additional entity created by Abp Suite?? xxxWithNavigationProperties for Navigation Property #1381


User avatar
0
abpVAndy created
  • ABP Framework version: v4.3.1
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:

Hi,

I created navigation property by abp suite. It created additional entity named: xxxWithNavigationProperties

I have some confusion about it. Why use this way for navigation property? Why not use as commercial examples: easy-crm

public class Order : FullAuditedAggregateRoot<Guid>, IMultiTenant
{ 
    public virtual ICollection<OrderLine> OrderLines { get; set; }
}

public class OrderLine : FullAuditedEntity<Guid>, IMultiTenant
{ 
    public virtual Product Product { get; set; }
}

Could you please give me some hint or idea? Where I could get the introduction or information about it? As I see the source code related to navigation property, all use as easy-crm way.

Thx


8 Answer(s)
  • User Avatar
    0
    abpVAndy created

    Any ideas? Need Help.

    Thx

  • User Avatar
    0
    alper created
    Support Team Director
     ICollection<OrderLine> OrderLines 
     Product Product { get; set; }
     
    

    these are not navigation properties

  • User Avatar
    0
    abpVAndy created

    Sorry is not Product. It is Order. Here is the whole class.

    public class OrderLine : FullAuditedEntity&lt;Guid&gt;, IMultiTenant
    {
        public const string DefaultSorting = "product.name asc";
    
        
        public virtual Guid? TenantId { get; set; }
        
        public virtual Guid OrderId { get; set; }
        
        public virtual Guid ProductId { get; set; }
        
        public virtual uint Count { get; set; }
        
        public virtual float StandardPrice { get; set; }
        
        public virtual float ActualPrice { get; set; }
    
        public virtual Order Order { get; set; }
    
        public virtual Product Product { get; set; }
    
        protected OrderLine()
        {
    
        }
    
        public OrderLine(Guid id)
        {
            Id = id;
        }
    
        public OrderLine(Guid id, Guid orderId, Guid productId, uint count, float standardPrice, float actualPrice, Guid? tenantId = null) : base(id)
        {
            TenantId = tenantId;
            OrderId = orderId;
            ProductId = productId;
            Count = count;
            StandardPrice = standardPrice;
            ActualPrice = actualPrice;
        }
    }
    
  • User Avatar
    0
    abpVAndy created
    public class Order : FullAuditedAggregateRoot<Guid>, IMultiTenant
    { 
        public virtual ICollection<OrderLine> OrderLines { get; set; }
    }
    
    
    public class OrderLine : FullAuditedEntity<Guid>, IMultiTenant
    { 
        public virtual Order Order { get; set; }
    }
    
  • User Avatar
    0
    abpVAndy created

    Here is the ABP Suite create addition class:

     public class BackCategoryWithNavigationProperties
        {
            public BackCategory BackCategory { get; set; }
            public BackCategoryBrother BackCategoryBrother { get; set; }
       }
    

    I have some confusion about it. Why create another class for the navigation relationship.

    Why Example easy-crm use property for the navigation relationship.

    Do you get my question? thx

  • User Avatar
    0
    abpVAndy created
     ICollection<OrderLine> OrderLines  
     Product Product { get; set; } 
      
    

    these are not navigation properties

    Sorry is not Product. It is Order. Here is the whole class.

    public class Order : FullAuditedAggregateRoot<Guid>, IMultiTenant { public virtual ICollection<OrderLine> OrderLines { get; set; } }

    public class OrderLine : FullAuditedEntity<Guid>, IMultiTenant { public virtual Order Order { get; set; } }

  • User Avatar
    0
    alper created
    Support Team Director

    because making property navigation is not best practise for a module. suite is designed to support both modules and app templates. but easy crm is not a module. if you are not working on a module template, you can change the final output of Suite to support ICollection<OtherEntity> OtherEntities

  • User Avatar
    0
    abpVAndy created

    Thank you for your explanation. I will close this.

Made with ❤️ on ABP v9.1.0-preview. Updated on November 18, 2024, 05:54