entities

In DDD, what are the actual advantages of value objects?

南楼画角 提交于 2019-12-04 18:56:41
问题 I have gotten so far that I understand entity objects have an ID while value object have not, but in the most common example you have the person entity that have a address value object attached to it. What is the big advantage of creating a separate address object instead of just keeping the address properties within the Person Entity? 回答1: In addition to the things already mentioned, Greg Young makes a big deal out of the fact that since they are immutable, you can validate them on creation

wit.ai + slot based bot + save entities values in client

心不动则不痛 提交于 2019-12-04 14:35:20
I am trying out a sample in wit.ai, here is the link : https://wit.ai/Nayana-Manchi/CreditCardApp/stories The first story "BalanceEnquiry” is a slot based story. The happy scenario works fine. To test “cardnumbermissing” branch, I would type in “I want my credit card balance on the card and my name is Nayana”. Here the card number last 4 digits are missing. It ask for the last 4 digits of the card and then I would enter the last 4 digits of the card. But here it does not get name entity which was sent in earlier message. How do I save the entity value “name” which was sent in the previous step

Repository Pattern and Linq to sql

谁说我不能喝 提交于 2019-12-04 12:30:12
I 'm trying to implement user authentication and authorization using roles table, user table and a xref table having userid, roleid. For implementing generic repoistory to update role, insert role, add user, add user to role, update user, update user role, authenticate user, add user session to audit etc do i have write seperate functions for each or can i use one generic method for similar functions. There are some other operations like joining user to other table and get top 5 rows based on conditions, Inserting in 3 tables (joined on a key) using single form etc I'm confused reading many

cakephp 3.x saving multiple entities - newEntities

谁说我不能喝 提交于 2019-12-04 10:04:41
I'm having the hardest time with saving multiple records. I've tried a million things, but I end up with the same problem: my records are not saved and I can't see any errors. Bear in mind that I'm new to cakephp and a novice coder. Am I missing something obvious and crucial? Table: $this->table('splits'); $this->displayField('id'); $this->primaryKey('id'); $this->belongsTo('Transactions', [ 'foreignKey' => 'transaction_id', 'joinType' => 'INNER' ]); $this->belongsTo('Accounts', [ 'foreignKey' => 'account_credit_id', 'joinType' => 'INNER' ]); Controller: $splits = $this->Splits->newEntity();

DDD: what's the use of the difference between entities and value objects?

元气小坏坏 提交于 2019-12-03 14:24:57
Entities and value objects are both domain objects. What's the use of knowing the distinction between the two in DDD? Eg does thinking about domain objects as being either an entity or value object foster a cleaner domain model? Yes, it is very helpful to be able to tell the difference, particularly when you are designing and implementing your types. One of the main differences is when it comes to dealing with equality, since Entities should have quite different behavior than Value Objects. Knowing whether your object is an Entity or a Value Object tells you how you should implement equality

In DDD, what are the actual advantages of value objects?

自闭症网瘾萝莉.ら 提交于 2019-12-03 12:29:58
I have gotten so far that I understand entity objects have an ID while value object have not, but in the most common example you have the person entity that have a address value object attached to it. What is the big advantage of creating a separate address object instead of just keeping the address properties within the Person Entity? In addition to the things already mentioned, Greg Young makes a big deal out of the fact that since they are immutable, you can validate them on creation and never worry about validation again. If the state cannot be changed, then you know it's always valid.

LINQ .Take() returns more elements than requested

百般思念 提交于 2019-12-03 07:03:27
问题 We have a simple LINQ-to-Entities query that should return a specific number of elements from particular page. The example of the request can be: var query = from r in records orderby r.createdDate descending select new MyObject() { ... }; //Parameters: pageId = 8, countPerPage = 10 List<MyObject> list = query.Skip(pageId * countPerPage).Take(countPerPage); The above example works great in most of the cases, but sometimes the list has more than 10 elements. This doesn't seem to be always true

HTML5: which is better - using a character entity vs using a character directly?

拜拜、爱过 提交于 2019-12-03 06:40:20
问题 I've recently noticed a lot of high profile sites using characters directly in their source, eg: <q>“Hi there”</q> Rather than: <q>“Hi there”</q> Which of these is preferred? I've always used entities in the past, but using the character directly seems more readable, and would seem to be OK in a Unicode document. 回答1: If the encoding is UTF-8, the normal characters will work fine, and there is no reason not to use them. Browsers that don't support UTF-8 will have lots of other issues while

Do you have a common base class for Hibernate entities?

谁说胖子不能爱 提交于 2019-12-03 04:56:01
问题 Do you have a common base class for Hibernate entities, i.e. a MappedSuperclass with id, version and other common properties? Are there any drawbacks? Example: @MappedSuperclass() public class BaseEntity { private Long id; private Long version; ... @Id @GeneratedValue(strategy = GenerationType.AUTO) public Long getId() {return id;} public void setId(Long id) {this.id = id;} @Version public Long getVersion() {return version;} ... // Common properties @Temporal(TemporalType.TIMESTAMP) public

What Belongs to the Aggregate Root

耗尽温柔 提交于 2019-12-03 01:10:38
问题 This is a practical Domain Driven Design question: Conceptually, I think I get Aggregate roots until I go to define one. I have an Employee entity, which has surfaced as an Aggregate root. In the Business, some employees can have work-related Violations logged against them: Employee-----*Violations Since not all Employees are subject to this, I would think that Violations would not be a part of the Employee Aggregate, correct? So when I want to work with Employees and their related violations