web 2.0

III. EF Model as a starting point of development

Doménový model

EF Data model

If you are familiar with MDA, then you would maybe welcome this scenario, where you create a PIM and PSM with source code are then generated according to specified technology and platform.

However, Entity Framework is not about UML modelling of PIM, but has features to easily create entities, associations and inheritance between them in .NET solutions.

You are able to generate DDL schema for database you choose and C# or VB code of entities is generated, as well. So you can look on EF as an OR/M solution, as a tool to create your Data Model or to be a starting point for Domain Model with specific domain/business logic implemented in partial classes.

Continue reading »

Domain-driven design books

Domain model is a pattern for an object-oriented approach for organizing business logic.
Let me introduce you 2 books which deal with this pattern, previously briefly described in the P of EAA book written by Martin Fowler.

Domain-driven design

Domain-driven design

Domain-Driven Design: Tackling Complexity in the Heart of Software

The book offers readers a systematic approach to domain-driven design, presenting an extensive set of design best practices, experience-based techniques, and fundamental principles that facilitate the development of software projects facing complex domains. Intertwining design and development practice, this book incorporates numerous examples based on actual projects to illustrate the application of domain-driven design to real-world software development.

from the back cover


Applying DDD and patterns

Applying DDD

Applying Domain-Driven Design and Patterns: With Examples in C# and .NET

Applying Domain-Driven Design and Patterns is the first complete, practical guide to leveraging patterns, domain-driven design, and test-driven development in .NET environments. Drawing on seminal work by Martin Fowler and Eric Evans, Jimmy Nilsson shows how to customize real-world architectures for any .NET application. You’ll learn how to prepare domain models for application infrastructure; support business rules; provide persistence support; plan for the presentation layer and UI testing; and design for service orientation or aspect orientation.

description of the book at Amazon

Enable associated entities to load with base entity

Associated entitites I encoutered a problem, when I wanted to load Employees entities also with some associated entities at once, from the well-known AdwentureWorks database model (in Entity Framework) via DomainService/Context in a .NET RIA Services SL Application.

So if you encountered the same problem, that initially your associated/referenced entities are null when loaded, read more to see how to solve this issue.

Continue reading »

Domain Model

Decoration

Decoration

A better pattern for business logic layer.

Let me to introduce you the 3 base patterns to organize your domain logic: Transaction Script, Domain Model and Table Module.

Transaction Script
Organizes business logic by transactions. Logic for each of the CRUD operations and other business logic over data is encapsulated in one transaction script. So every transaction is a unique procedure which handles a single request from the presentation. These transactions usually do direct calls to the database like Stored procedures calls or Dynamic SQL queries.

Domain Model
An object model, which describes entities and relations between them in the domain. It’s one of the key aspects of Domain Driven Design.

Table Module
A single instance that handles the business logic for all rows in a database table or view.

For object-oriented programmers the Domain Model pattern would be the best understandable pattern, altgough many of them are still getting in touch mainly with the first Transaction Script pattern.

This article is about how Domain Model works, how to use it and how to implement it.
Continue reading »