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
0
votes
1 answer

Mapping suggestion for a possibly shared foreign key (value object in entity) in Entity Framework 4.1?

I have a Project entity and an Rfi entity. The project entity contains a list of TeamMembers. Project is a navigation property in the Rfi entity. In the Rfi entity there is a RecipientId. This Id represents a person from the TeamMembers collection.…
DDiVita
  • 4,225
  • 5
  • 63
  • 117
0
votes
1 answer

How to implement a model using null-object pattern

I have a value object and an entity that uses said value object. I'm using the null-object pattern for said value object. My value object looks something like the following: public class Reference { public static Reference Empty; private string…
Fernando Gómez
  • 464
  • 1
  • 5
  • 19
0
votes
1 answer

ActionScript: Constructor for Value Object classes

Is it OK to use the constructor to set properties for a value object class or must I use dot notation and set each one, one-by-one? I recently read an article that was saying I should do it one-by-one as value objects should only contain properties…
Francisc
  • 77,430
  • 63
  • 180
  • 276
0
votes
2 answers

DDD - Entity vs ValueObject

I was reading about DDD and I realize that sometimes an entity might be a VO or VO might be an entity. You can know which one is better depends on the context. I was checking different examples. For example, shopping cart DDD example. Product is an…
wipcrep
  • 19
  • 1
  • 7
0
votes
1 answer

Which layer should Value-Object be used?

In the following example shows a query to get an employ details. It has a int parameter Id. And there is a DTO class EmployeeDto which also has a field Id with type of…
ca9163d9
  • 27,283
  • 64
  • 210
  • 413
0
votes
2 answers

The performance issue of validating entity using value object

I have the following value object code which validates CustCode by some expensive database operations. public class CustCode : ValueObject { private CustCode(string code) { Value = code; } public static Result
ca9163d9
  • 27,283
  • 64
  • 210
  • 413
0
votes
1 answer

ValueObject json deserialization returns Null

I am trying to implement valueobject in asp.net core with ef core. I have money as value object and product which has money as price property. The problem is that money is serialized in product table but deserialization returns null. I tried debug…
0
votes
2 answers

Currency is value object or not

I have Person aggregate, which is root aggregate public class Person { private int id; private readonly PersonID personID; private readonly string email; private readonly string firstName; private readonly string lastName; …
kamal
  • 739
  • 1
  • 9
  • 21
0
votes
1 answer

Should uniqueness be ignored when deciding if something is an Entity or Value Object?

Is uniqueness considered a persistence concern in DDD? The reason I ask is because I have a Customer object in an order quoting context. e.g. an order is for a customer and the customer must pay a certain rate. Technically, I won't allow a customer…
0
votes
1 answer

Accessing a JSON value that references another JSONs key

I have two JSON files and one references the other. The first file below is parsed into the program as moves, it's referencing into a spritesheet. {"stand": { "x": 0, "y": 12, "width": 49, "height": 52 }, "walk1": { "x": 52, "y": 12, "width": 50,…
Hellonearthis
  • 1,664
  • 1
  • 18
  • 26
0
votes
1 answer

Why my Zend-HAL implementation is not working with protected values

I am new in Zend framework, and trying to use HAL for API response generation. In the following is a simpler situation of my issues. The class: class Version { protected $data; public function __construct($ar){ $data = $ar; } …
Md Monjur Ul Hasan
  • 1,705
  • 1
  • 13
  • 36
0
votes
2 answers

Updating Value objects or Inserting new Record in DB

I have a Ticket table and its Receivers which is a collection. Receiver is a value object. I defined all in EF Core 2.2 and everything is Okay. When inserting a new ticket, receivers are added to ticket and would be saved. For updating ticket, as…
0
votes
2 answers

Is it a good idea to model keywords as value object in Product aggregate?

I have product aggregate which has several keywords to help for searching products. I have modeled it as following: public class Product : Entity , IAggregateRoot { public Guid AccountId { get; protected set; } public string…
Simple Code
  • 2,354
  • 2
  • 27
  • 56
0
votes
1 answer

DDD - Mapping Value Objects with Fluent nHibernate in separate tables

EDIT: Hi, trying an edit to get this question answered. In order to try improve the question, here is a straight to the point condensed version: Is the code below the way to go when mapping value objects to separate tables using fluent nhibernate,…
gdp
  • 8,032
  • 10
  • 42
  • 63
0
votes
2 answers

Constraint on Value Object in form Symfony

I'm quite new to Symfony and I started digging around Symfony forms. As described here https://webmozart.io/blog/2015/09/09/value-objects-in-symfony-forms/ I'm using value objects in my subform. A constructor of value object can throw an exception…