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
1
vote
1 answer

EF Core optional ValueObject as identity

I am using value objects as identities and would like to know how to best deal with nulls in EF core. For example if I have an employee with an optional title (mr, mrs, etc): public class Employee : Entity, IAggregateRoot { public…
1
vote
1 answer

Query on DBcontext using value object returns client evaluation explicitly in EFCore 3.1

I have this model as you can see here : public class car { public int Id { set; get; } public string Name { set; get; } public CarBody CarBody { get; set; } public car( string name, CarBody carBody) { …
Ehsan Akbar
  • 6,977
  • 19
  • 96
  • 180
1
vote
1 answer

DDD Value Objects and Entity Without ORM Mapping in PHP

First, as I know, Entity in DDD is almost same with Value Object except Entity has identity. Every article I have read say same thing that entity id has ORM mapping with any ORM tool. But I don’t want to use ORM mapping in Entity. Instead, I would…
Furkan
  • 415
  • 5
  • 17
1
vote
1 answer

Entity Framework Core Entity > Value Object > Entity Relationship

I have the following classes public class Slot : Entity { public SnackPile SnackPile { get; set; } public SnackMachine SnackMachine { get; set; } public int Position { get; } protected Slot() { } public…
1
vote
1 answer

Generic mapping of Value Objects with mapstruct

Trying to use value objects in my business model, I'm facing issues with the following code : @Mapper public abstract class TestMapstruct { public ValueObjectA mapA(String value){ return new ValueObjectA(value); } public…
yunandtidus
  • 3,847
  • 3
  • 29
  • 42
1
vote
1 answer

Entity Framework Core Owned Type Value Object throws required Primary Key to be defined error when used with IdentityUser. Why?

I'm using EF Core 2.2. I have two context in my application. One is AppIdentityDbContext for identity related works and other is AppContext for app related works. I have an identity user class - ApplicationUser - which has a relation to Profile…
fingers10
  • 6,675
  • 10
  • 49
  • 87
1
vote
1 answer

NetWeight and GrossWeight as separate Value Objects

What would be the reason to create different subtypes of Weight? I see our devs created NetWeight and GrossWeight subtypes as Value Objects. They both have the same implementation. Is there any value in it? Why not using Weight value type for both…
1
vote
2 answers

Determining Entities and Value Objects in Domain Driven Design in a real project

This is for the first time I am implementing the concept of Domain Driven Design in a real project. The project is about generating a permit for employees which would enable them to enter company premises. Through an Intranet site, an employee who…
Apoplectic
  • 95
  • 5
1
vote
1 answer

Is the only difference between a POCO and 'Value Object' is POCO targets .Net?

I am trying to understand the exact meaning of POCO actually (Yes i have read wikipedia already but still cannot get the main point :( ). I understand that Value Object is an object that basically has only properties to keep the data without any…
pencilCake
  • 51,323
  • 85
  • 226
  • 363
1
vote
1 answer

Entity framework 4 model first using money value object

I want to use a Money value object in my application. I have found several examples of a Money datatype. But I can't figure out how to use them with EF4. I would like to store each amount as a Decimal/CurrencyCode pair (where currencycode is a…
kenhos
  • 91
  • 1
  • 3
1
vote
1 answer

DDD Nesting of value objects

I am looking for some advice on DDD modelling and specifically nested levels of ValueObjects. Take the below code, this is a dumbed down sample of how my domain is starting to take shape. This is all within my Contracts bounded context and have…
1
vote
0 answers

TYPO3 - TCA, IRRE and Database configuration for value objects

On the extbase side, a class can extend TYPO3\CMS\Extbase\DomainObject\AbstractValueObject. But I can't figure out how to implement a value object inside TCA-Konfiguration and ext_tables.sql. Bonus points for IRRE implementation. A value object has…
Klausn
  • 55
  • 6
1
vote
1 answer

DDD collection: include version control in model

In my DDD attempt I've defined the following ubiquitous language: A product can have multiple drawings. A drawing consists of a drawing number, a revision number* and multiple attachments**. A drawing can be revised by a new drawing with a different…
1
vote
0 answers

Exception thrown when using multiple value-objects of same type in EF-Core 2.0

I have this BankLayoutSettings entity (simplified for brevity): public class BankLayoutSettings { public Guid BankId { get; set; } public Color HeaderAndFooterBackgroundColor { get; set; } public Color HeaderForeColor { get; set; } …
Daniel
  • 1,034
  • 1
  • 10
  • 27
1
vote
2 answers

How to model a Domain Entity in code?

I am familiar with DDD and the concept of Entity. According to DDD, Entity is an object fundamentally defined by its identity. Say, in my project, I have identified that an Account is an Entity. So in code, this would be represented by a class with…