Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possibility to exlude parts #334

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

enis-pixel
Copy link
Contributor

By default, the LoadType method in the ProductMangementFacade returns the parts. Now there is an additional property called NoPartLinks in the ProductQuery class, which can be set to true to speed up the queries and exclude the parts.

By default, the LoadType method in the ProductMangementFacade returns the parts.
Now there is an additional property called NoPartLinks in the ProductQuery class,
which can be set to true to speed up the queries and exclude the parts.
Copy link
Member

@Toxantron Toxantron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If there is a runtime issue with part links, it probably caused by UoW settings or accidental navigation on proxies. It also might just be an issue of SQLite wich is not optimized for this purpose. Can you confirm faulty joins on SQL systems like postgres?

@@ -353,6 +353,28 @@ public IReadOnlyList<IProductType> LoadTypes(ProductQuery query)
else if (query.RecipeFilter == RecipeFilter.WithoutRecipes)
productsQuery = productsQuery.Where(p => p.Recipes.Count == 0);

// Exclude parts
if (query.NoPartLinks)
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the point of this? The ProductsQuery never includes PartLinks in the response. It only returns the head type for the query arguments and then you need to call LoadType on each.

Copying all properties onto a new object within a LinQ query seems like bad taste. And it would break the selectors 5 lines below.

If there is a runtime issue with proxies or lazy loading, check the UnitOfWork settings at the top or the conversion at the bottom.

public ProductModel ConvertProduct(IProductType productType, bool flat)

/// <param name="includeParts">Determines whether parts should be included</param>
public ProductModel ConvertProduct(IProductType productType, bool flat, bool includeParts = true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only difference I see between bool flat (meaning no properties, recipes or parts) and the new argument is to load 2/3 of the default page but not the part links. This also would have to be a new method as it would break a public API.

@@ -28,7 +28,7 @@ public class ProductTypeEntity : ModificationTrackedEntityBase

public virtual ICollection<ProductTypePropertiesEntity> OldVersions { get; set; }

public virtual ProductTypePropertiesEntity CurrentVersion { get; protected internal set; }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current version is updated automatically. For which requirement do you set it manually?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants