-
Notifications
You must be signed in to change notification settings - Fork 25
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
base: dev
Are you sure you want to change the base?
Add possibility to exlude parts #334
Conversation
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.
There was a problem hiding this 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) | |||
{ |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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; } |
There was a problem hiding this comment.
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?
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.