EF6 and DDD
-
Upload
hrvoje-hudoletnjak -
Category
Technology
-
view
108 -
download
0
Transcript of EF6 and DDD
Agenda
• DDD
– DDD koncepti i obrasci (patterns)
– Arhitektura
• EF 6 novosti
• Oblikovanje EF prema DDD konceptima
– Bounded Context
– Aggregate roots
– Value object & entities
• DEMO
DDD
Koncepti
• Ubiquitous Language
• Bounded Contexts
• Persistance ignorance
• Refactoring
• CQS
• Kada upotrijebiti DDD?
Patterns
• Entities
• Value objects
• Aggregate roots
• Repository
• Domain Services
• Domain Events
• State
„ …ordinary classes where you focus on the business problem at hand
without adding stuff for infrastructure-related reasons…
nothing else should be in the Domain Model. ”
public interface IEmployeeRepository
{
Employee GetById(int id);
void Add(Employee employee);
void Remove(Employee employee);
IEnumerable<Employee> GetStaffWorkingInRegion(Region region);
}
Tradicionalna 3-slojna arhitektura
Presentation
Business Logic (BLL)
Data Access (DAL)
Infr
astr
uct
ure
Onion arhitektura
User Interface
G
Filesystem
Services
etc
Application Services
M
Domain Services
Domain Model
Database
Onion arhitektura
User Interface
G
Filesystem
Services
etc
Application Services
M
Domain Services
Domain Model
Database
Employee,IEmployeeRepository
NHibernateEmployeeRepository
EmployeeController
IEmailSender
SmtpEmailSender
EF + DDD
• Unit of Work
• Privatni konstruktori
• Privatni set-eri
• Value objects vs Entities
• Kompleksni tipovi
• Repozitoriji vs. CQS
EF Novosti
• DbContext
• Enums, spatial
• Code first
• Migrations
• Mappings, conventions
• Multiple diagrams per model
• Async, perf improvements, Connection Resiliency
• Interceptors, custom configuratiomn, DI
• Open sourced, out of .NET Fx
• Nuget package + VS Tools addon download
„Any fool can write code that a computer
can understand. Good programmers write
code that humans can understand.”
Martin Fowler
Hvala! Pitanja?
• Hrvoje Hudoletnjak
• Twitter.com/hhrvoje
• www.hudosvibe.net
Resources
• http://www.slideshare.net/JulieLerman/entity-framework-ddd
• http://www.slideshare.net/rdingwall/domain-driven-design-101
• http://www.slideshare.net/panesofglass/domain-driven-design
• http://msdn.microsoft.com/sv-se/magazine/dn342868(en-us).aspx
• https://entityframework.codeplex.com/wikipage?title=specs