domain-driven-design

In CQRS, how do you build the response when creating an entity?

空扰寡人 提交于 2019-12-30 09:09:13
问题 If using CQRS and creating an entity, and the values of some of its properties are generated part of the its constructor (e.g. a default active value for the status property, or the current datetime for createdAt ), how do you include that as part of your response if your command handlers can’t return values? 回答1: You would need to create guid before creating an entity, then use this guid to query it. This way your command handlers always return void. [HttpPost] public ActionResult Add(string

CQRS Event Sourcing check username is unique or not from EventStore while sending command

﹥>﹥吖頭↗ 提交于 2019-12-29 18:38:46
问题 EventSourcing works perfectly when we have particular unique EntityID but when I am trying to get information from eventStore other than particular EntityId i am having tough time. I am using CQRS with EventSourcing. As part of event-sourcing we are storing the events in SQL table as columns(EntityID (uniqueKey),EventType,EventObject(eg. UserAdded)). So while storing EventObject we are just serializing the DotNet object and storing it in SQL, So, All the details related to UserAdded event

CQRS Event Sourcing check username is unique or not from EventStore while sending command

五迷三道 提交于 2019-12-29 18:38:30
问题 EventSourcing works perfectly when we have particular unique EntityID but when I am trying to get information from eventStore other than particular EntityId i am having tough time. I am using CQRS with EventSourcing. As part of event-sourcing we are storing the events in SQL table as columns(EntityID (uniqueKey),EventType,EventObject(eg. UserAdded)). So while storing EventObject we are just serializing the DotNet object and storing it in SQL, So, All the details related to UserAdded event

CQRS Event Sourcing check username is unique or not from EventStore while sending command

左心房为你撑大大i 提交于 2019-12-29 18:38:11
问题 EventSourcing works perfectly when we have particular unique EntityID but when I am trying to get information from eventStore other than particular EntityId i am having tough time. I am using CQRS with EventSourcing. As part of event-sourcing we are storing the events in SQL table as columns(EntityID (uniqueKey),EventType,EventObject(eg. UserAdded)). So while storing EventObject we are just serializing the DotNet object and storing it in SQL, So, All the details related to UserAdded event

is one to one relationship bad strategy

天涯浪子 提交于 2019-12-29 08:04:09
问题 User always has one Wallet. One Wallet belongs always to one User. Since I want to separate money wallet related properties I was create Wallet object and to be able to track money transactions, ... I created public Wallet : Entity<int> { public double Amont {get; set;} public IList<MoneyTrans> Transactions {get; set;} } Since this is obviously one to one relationship is it ok to map using one to one relationship? Is one to one bad strategy? 回答1: I had to append answer, with opposite point of

is one to one relationship bad strategy

百般思念 提交于 2019-12-29 08:04:06
问题 User always has one Wallet. One Wallet belongs always to one User. Since I want to separate money wallet related properties I was create Wallet object and to be able to track money transactions, ... I created public Wallet : Entity<int> { public double Amont {get; set;} public IList<MoneyTrans> Transactions {get; set;} } Since this is obviously one to one relationship is it ok to map using one to one relationship? Is one to one bad strategy? 回答1: I had to append answer, with opposite point of

Caching Code Location in a Domain Driven Design

旧时模样 提交于 2019-12-29 07:01:09
问题 In an application that has followed a Domain Driven Design where you have the following sorts of concepts A repository that deals with the DataBase access A application service that co-ordinates interactions between enties and value objects etc. where in general would you put caching code to elimenate an expensive call to the database? I have seen code bases that just cache all over the place and it is difficult to monitor memory usage and difficult to provide guidelines to other developers.

Can Core Domain span multiple Bounded Contexts?

最后都变了- 提交于 2019-12-29 06:49:12
问题 1) Evan's book, pg. 415: Also, the critical aspects of the domain model may span multiple Bounded Contexts, but by definition these distinct models can't be structured to show their common focus. a) I assume the quote is implying that Core Domain CD can span several Bounded Contexts BCs ? b) I assume BCs within CD should only contain core elements , but no generic elements ? If so, doesn't that mean we should always design BCs ( those contained by CD ) with Core Domain in mind ? In other

org.hibernate.MappingException: Repeated column in mapping for entity

房东的猫 提交于 2019-12-29 06:25:18
问题 I am doing a simple Poll system. I have 2 tables: Person : ID, Name, Surname Vote : ID, Vote (Boolean), VoterID (This is actually FK_PersonID ), PersonID (This is actually FK_PersonID as well). I need to be able to identify who cast the vote as well as who the vote was for - using the people stored in the Person table for both of these needs. The table Person contains user details of people that can "Vote" as well as be "Voted for". People are allowed to decide whether they want to vote for

how should i add an object into a collection maintained by aggregate root

假如想象 提交于 2019-12-29 05:16:25
问题 lets say i have a BlogPost aggregate root. it holds a List <Comment> . how should the BlogPost AddComment signature look? is it OK to use: public void AddComment(Comment comment) { Comments.Add(comment); } or should i avoid creating references to root's children outside of it, and do something like this: public void AddComment(string text, string email) { Comment comment = new Comment(text, email); Comments.Add(comment); } 回答1: If you believe in DDD, it's perfectly fine to know about some