domain-driven-design

Migrate legacy database to cqrs/event sourcing view

风流意气都作罢 提交于 2021-02-07 10:37:18
问题 We got old legacy application with complex business logic which we need to rewrite. We consider to use cqrs and event sourcing. But it's not clear how to migrate data from the old database. Probable we need migrate it to the read database only, as we can't reproduce all the events to populate event store. But we atleast need to create some initial records in event store for each aggregate, like AggregateCreated ? Or we need write a scripts and to use all the commands one by one to recreate

Mapping private attributes of domain entities with Dapper dot net

那年仲夏 提交于 2021-02-06 11:53:01
问题 In most of my projects I use nHibernate + Fluent mapping and recently I've started to play around with Dapper to see if I can move read operations to it. I follow DDD approach so my domain entities do not have any public setters. For example: public class User { private int _id; private string _name; private IList<Car> _carList; protected User(){} // Fluent Mapping public User(string id, string name) { // validation // ... _id = id; _name = name; } public int Id{ get {return _id;} } public

Mapping private attributes of domain entities with Dapper dot net

半腔热情 提交于 2021-02-06 11:52:54
问题 In most of my projects I use nHibernate + Fluent mapping and recently I've started to play around with Dapper to see if I can move read operations to it. I follow DDD approach so my domain entities do not have any public setters. For example: public class User { private int _id; private string _name; private IList<Car> _carList; protected User(){} // Fluent Mapping public User(string id, string name) { // validation // ... _id = id; _name = name; } public int Id{ get {return _id;} } public

Handling aggregate root

落花浮王杯 提交于 2021-01-29 21:34:34
问题 I'm new in DDD so I'm doing some practice to undertand a little bit more. I have Course BC with the follow rules: Course has to be created first and then they can create the modules of one course Every module will be finished by the user when he upload the homework The course will be finished by the user when he finished all the modules Definition: A course covers a particular topic and it is comprised of module. For instance, sap course has 10 modules such as: module 1: what is it?, module 2

Architecture Domain Model and View Model

和自甴很熟 提交于 2021-01-27 19:40:22
问题 I am trying to build application by spring boot and Domain Driven Design. I have a problem about Domain model (match with fields of table DB) and View Model (response API). Domain Model: EX: class Name @Getter @NoArgsConstructor @AllArgsConstructor class Name { String value; } class Product @Getter @NoArgsConstructor @AllArgsConstructor class Product{ Name name; } ViewModel: @Data @NoArgsConstructor @AllArgsConstructor class ProductView { //int prodId; String prodName; } Select data DB by

Aggregates and aggregation roots confusion

旧时模样 提交于 2021-01-27 14:16:15
问题 i've been assigned a quite simple project as an exam and i had the idea to develop it using the Domain Driven Design. Many of you might say that the application is so simple that going with repositories and UoW is just a waste of time, and you probably be correct but i think of it as an opportunity to learn something more. The application is a "Flight tickets" system and from the following image you could probably well guess it's functionality. The thing is that i am not sure if i am

Repository, Service or Domain object - where does logic belong?

Deadly 提交于 2021-01-27 03:55:57
问题 Take this simple, contrived example: UserRepository.GetAllUsers(); UserRepository.GetUserById(); Inevitably, I will have more complex "queries", such as: //returns users where active=true, deleted=false, and confirmed = true GetActiveUsers(); I'm having trouble determining where the responsibility of the repository ends. GetActiveUsers() represents a simple "query". Does it belong in the repository ? How about something that involves a bit of logic, such as: //activate the user, set the

Repository, Service or Domain object - where does logic belong?

喜欢而已 提交于 2021-01-27 03:55:20
问题 Take this simple, contrived example: UserRepository.GetAllUsers(); UserRepository.GetUserById(); Inevitably, I will have more complex "queries", such as: //returns users where active=true, deleted=false, and confirmed = true GetActiveUsers(); I'm having trouble determining where the responsibility of the repository ends. GetActiveUsers() represents a simple "query". Does it belong in the repository ? How about something that involves a bit of logic, such as: //activate the user, set the

Repository, Service or Domain object - where does logic belong?

久未见 提交于 2021-01-27 03:53:56
问题 Take this simple, contrived example: UserRepository.GetAllUsers(); UserRepository.GetUserById(); Inevitably, I will have more complex "queries", such as: //returns users where active=true, deleted=false, and confirmed = true GetActiveUsers(); I'm having trouble determining where the responsibility of the repository ends. GetActiveUsers() represents a simple "query". Does it belong in the repository ? How about something that involves a bit of logic, such as: //activate the user, set the

Primary key in an Azure SQL database

妖精的绣舞 提交于 2021-01-02 08:13:10
问题 I'm working on a distributed system that uses CQRS and DDD principles. Based on that I decided that the primary keys of my entities should be guids, which are generated by my domain (and not by the database). I have been reading about guids as primary keys. However, it seems that some of the best practices are not valid anymore if applied to Azure SQL database. Sequential guids are nice if you use an on premise SQL server machine - the sequential guids that are generated will always be unique