Questions tagged [value-objects]

A value object is a fundamental concept of domain modeling in Domain-Driven Design.

A value object is a fundamental concept of domain modeling in Domain-Driven Design.

As defined by Eric Evans in his book, Domain-Driven Design: Tackling Complexity in the Heart of Software:

An object that represents a descriptive aspect of the domain with no conceptual identity is called a VALUE OBJECT. VALUE OBJECTS are instantiated to represent elements of the design that we care about only for what they are, not who or which they are.

324 questions
3
votes
1 answer

How to define nested model relationship with ValueObjects

I have a parent child relationship where the parent has a ValueObject and I cannot determine how to correctly define the relationship. Adding a migration for the Child/Parent relationship fails with the error... The entity type 'Address' requires a…
matto56
  • 33
  • 5
3
votes
4 answers

Value object in event sourcing

Is there a place for value objects in an event sourced domain model? Lets define a value object as an object with immutable state that guards its invariants and has no particular identifier. An event sourced domain model in this context is a domain…
Stratadox
  • 1,291
  • 8
  • 21
3
votes
1 answer

EF Core 2.0 Updating Value Objects not working

I tried to implement the Value Object pattern for EF Core 2.0: https://learn.microsoft.com/en-us/dotnet/standard/microservices-architecture/microservice-ddd-cqrs-patterns/implement-value-objects According to the example of Microsoft I added…
Palmi
  • 2,381
  • 5
  • 28
  • 65
3
votes
1 answer

How to handle Currency Conversion in DDD?

Short Version: What do you think is the best option for a Value Object that needs to access currency conversion rates in the database? ex: Invoice.Amount = Invoice.Amount.toCurrency('CAD') Long Version: I have a Value Object called InvoiceAmount…
3
votes
1 answer

Domain Driven Design can an Aggragate Root be an Value Object

me and my colleges are discussing about Value Objects and Entities in the Context of Domain Driven Design. It is a little bit theoretical so maybe not that easy to Answer. First question: Can an Aggregate Root be an Value Object ? Second Question:…
user6718125
3
votes
1 answer

Nhibernate Component Mapping : Parent Object null in Value Object while querying from database

I am mapping my value Object Item as component withthe folowing mapping configuration { Table("Product"); Not.LazyLoad(); Id(x => x.Id, "id"); Map(x => x.Number, "number"); Map(x => x.Name,…
TheMar
  • 1,934
  • 2
  • 30
  • 51
3
votes
2 answers

What is the etymology/meaning of the term "value object"?

I am a programmer with a .NET / PHP background. I recently reviewed a video training on Flashbuilder 4 / ActionScript. One of the videos in the video training is named "Creating a Data Model with a Value Object". I mentioned that "value object" was…
Edward Tanguay
  • 189,012
  • 314
  • 712
  • 1,047
3
votes
3 answers

Validation of Value Object with different stategies - password case

I am designing library which is supposed to help me with designing domains in future projects. I made some basic Value Objects like EmailAddress or PhoneNumber. Those are easy. It starts to get problematic for me when such Value Object may have…
Mateusz
  • 418
  • 3
  • 17
3
votes
1 answer

How to do a SELECT LIKE with PDO Prepare Statement - are value objects of any use here?

The point is to make a query that will grab values introduced by the user on a input box, and retrieve the database records found trough that keyword comparison. On a innodb engine, so no MATCH AGAINST available correct ? I will use LIKE on a…
MEM
  • 30,529
  • 42
  • 121
  • 191
3
votes
1 answer

Having id-field on a value object in DDD

I'm working on a project where I had a value object (called SkillProfile) within an aggregate. Aggregate root is the User entity and the User has a unidirectional one-to-one association to it's SkillProfile. There is use case in the business where a…
Dominik
  • 599
  • 1
  • 4
  • 18
3
votes
1 answer

populating and accessing data from a value object

I have have a problem loading and accessing data from a value object in my new project.. I load an xml file via a service, which contains title and locations of asset files, I need to be able to access the location of an asset file by specifying the…
martin
  • 55
  • 1
  • 7
3
votes
1 answer

Value Objects Vs Entities

Quick question... When approaching something like an email address the immediate idea is to treat this as a value object. If we have a number of entities though, say a customer, a contact, and a supplier that are referencing the same email address,…
Steven
  • 823
  • 8
  • 25
3
votes
2 answers

DDD building a value object that holds a collection property

i have a simple question when building a value object that has a collection of value objects inside it with a specific type how do you construct the object ? to take an example lets say you have a picture that take multiple dimensions Option 1…
AboElzooz
  • 309
  • 4
  • 16
3
votes
1 answer

Getting rid of Entity factory by tightly coupling its Value Objects

I'm having my User entity value objects loosely coupled, and because of that I use a UserFactory to build the object whenever it comes from the database or when creating a entirely new entity to the domain. Would it be okay to tightly couple the…
Kid Diamond
  • 2,232
  • 8
  • 37
  • 79
3
votes
3 answers

Overriding GetHashCode() for value objects without fields

Sometimes I need value objects without fields (message headers, schemas, etc.), for example: abstract class RequestHeader { } sealed class FirstRequestHeader : RequestHeader { } I use them in methods like: partial class Server { private…
astef
  • 8,575
  • 4
  • 56
  • 95