DDD: Where is it most appropriate to get a list of value objects - ddd-repositories

I've got a value type called "Product Type" that is assigned to a product. (A product has one product type)
To allow the user to select the type from a list, I'm going to fill a dropdown. Where is it most appropriate to retrieve the list of product types? A class implementing a repository pattern?
Edit: Clarified by changing product code to product type. A product type is something like "DVD"/"CD"/"Blu Ray"/etc.

Product seems to be aggregate root, so list of product types should be in ProductRepository.

Related

How to store a Value Object collection

Suppose I have a User entity. And this entity must have a Country field.
As a rule, Country is a Value Object.
And here it's kind of okay, and there's no problem.
But I got a ticket, which says that now on Frontend, Country must be filled in from the list of available Country (also I need to expand this list in the future)
This would be an easy task if Country was originally an entity, but I have it as a Value Object.
What to do in this case? Redefine Country as an entity, or is there another way?
Even when you maintain Countries as entities, you can store them as part of the User entity as a Value Object. The fundamental nature of a country object is such that its value is its identity, making it a good candidate for a Value object.
But IMHO, the list of Countries can be preserved as a static list because the list is finite.
I don't know what it means for your app to add a country to the list, but I am assuming that it is not as trivial as a CRUD op. If the list is rarely updated, you can maintain the list of available countries as a static list in code that is updated when necessary.
If the requirement is to often switch a country from available to not-available and vice-versa, you can store them as CRUD entities but use them as Value Objects in User.

nopcommerce assign product on attribute combinations

I have a customer request that I would consider common for a cloth store, however not found a way to implemented it on NopCommerce.
The problem is that we stock t-shirts, jumpers etc in various colours and sizes, possibly separate the sex as well.
The actual products for sale are the primitive products with a particular design.
So Design 1, Design 2 ... Design N all use the same stock.
My idea was to be able to associate primitive products with a particular combination.
That is not possible on nopcommerce. I can only associate a product to a particular attribute value.
Any idea/solution?
You can use product attribute combinations in nopCommerce. Note: Attribute combinations are useful only when your Manage inventory method is set to Track inventory by product attributes
Follow the below steps.
Create a Product.
Create a product attributes ex. Image Squares. 3 values. Edit a value and upload square image and product image.
Create another product attribute. Image squares. 3 values. Edit a value and upload square image and product image.
add a condition on second attribute that if a value from first attribute is selected then only second product attribute should appear.
The first attribute selection will change the product image. The second won't.
Now if you remove the product image from first attribute, then second attribute selection will work.

how can I add a domain to a related field in openerp?

how can i add a domain to a relational field so it'll only show a list of products whose values are > 0 in openerp. Sorry am still learning programming with openerp. Thank you for you help
In your current object from which you are creating relationship with product.product, say for ex, its many2one relation, so in that case,
'product_id': fields.many2one('product.product', 'Product', domain=[('VALUE','>',0)])
VALUE means the product field on which, you want to add condition. By doing this, when you will click on that product field, it will list out only those products who are matching with your domain.

Sharepoint 2010 Exclusive columns?

Does anyone know a way to have two columns in a SP2010 list that are exclusive? I need to ensure that there is only a value for ONE column, not both.
Basically I need the following structure:
Category List ->
SubCategory List (with a lookup to Category) ->
Value (with a lookup to SubCategory).
But, if there is no SubCategory, use a lookup to Category. One or the other must be used, not both.
Using either a list Event Receiver (SPItemEventReceiver) or a Custom Workflow should be able to achieve these desired semantics.
I do not believe the model itself can represent such relationships. An alternative might be to have different content types, for which only one of the columns applies (to each).
Happy coding.

SharePoint Lookup field, what is it?

SharePoint Lookup field, what is it?
Please share, thanks.
It is a type of field used to indicate that the possible values of a column in a list must be taken from the elements of another list. For example, if you have a list of users, and one column of this list is the country, you can create a lookup field pointing to another list "countries" which contains the possible values to select.
If you think in terms of relational databases, a lookup field is a foreign key: you only store a reference to the related item, not its value.
For instance, you have a list of meeting rooms. You can create a meeting calendar by creating a new calendar list with a lookup to the "Meeting rooms" list. Hence, when organizing a meeting, you will be able to pick a room from the list of meeting rooms entered previously.
A "Lookup" differs from "Choice" field as you may alter the source item and the referencing item is updated automatically. For instance, you change the name of a meeting room - all meetings booked for that room will show the new title automatically.

Resources