Storing product attributes of different types in a product aggregate

I use the EAV (Entity-Attribute-Value) pattern in an inventory management system I’m developing.
It’s very comparable to a typical webshop framework like Magento.

Attributes have a data type, like numeric, varchar, text.
The attribute definitions are stored in one table like eav_attributes. The values are stored in separate tables specific for the data type.
Say that a numeric attribute is assigned to a product. The database table that holds the relation between the attribute and product and the value, is a table like eav_decimal_attribute_values.
Example table scheme:

attribute_id | product_id | attribute_value (decimal)

And the same principle for a varchar attribute:

attribute_id | product_id | attribute_value (varchar(255))

When loading a product from the database, I load the product -> attribute -> value relations of each of that tables.
So I query the eav_decimal_attribute_values table to get all assigned decimal attributes and their values for the product (or get an empty resultset or course).
And the same for the other attribute types (eav_varchar_attribute_values, eav_text_attribute_values, …).
So far this is actually the same as how e.g. Magento manages this.

Since I use a typed language, I chose to have the following design:

class AttributeDefinition
    - string attributeName
    - string attributeDescription
    - enum dataType // Like 'numeric', 'varchar', 'text', ...
    - ...
    - ...

abstract class ProductAttributeAssignment
    - AttributeDefinition attribute

class DecimalProductAttribute : ProductAttributeAssignment
    - double value
    - ...

class VarcharProductAttribute : ProductAttributeAssignment
    - string value
    - ...

class TextProductAttribute : ProductAttributeAssignment
    - string value
    - ...

Product
    - name
    - ...
    - attributes
        // Problematic part: storing different types together
        - A TextProductAttribute 
        - Another TextProductAttribute
        - A DecimalProductAttribute
        - A VarcharProductAttribute
        - ...

In code I want to preserve types. Like a numeric attribute’s value is stored as a double or decimal value in code. A varchar or text attribute is put in a string.
Of course I could just create one concrete class ProductAttributeAssignment, and store the value always as a string in memory, regardless of the data type the attribute represents. But imagine that I have to do calculations with numeric attributes, or search features like Charging cable length > 120, it would be useful to preserve types. Also when there would be features like developers could create plugins or hooks.

The problem is that I have some difficulties in coding the product aggregate. It would be logical to store a products’s attribute assignments just in a Product object. But since there’s a different class for each attribute type, I cannot just write a class like Product with a field List<…> attributes.

So, my question is not about storing things in the database/persistent layer, but about writing code for a business object that owns things that are actually the “same business thing” but technically different types in code.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật