domain-model

Domain Model - Identifier Relationships vs. Hierarchal Objects

While fleshing out a hypothetical domain model, I have found myself wondering whether the better approach in relating domain objects would be to have a parent domain object contain a pointer (the identifier of the child) or if it would be a better approach to use the child objects to build a composite within the parent object. I can see...

Domain Model + LINQ to SQL sample

Hello all, I wonder if there is an enterprise application sample, designed with Domain Model in the Business Logic layer and LINQ for the Data Mapper? I'm not so sure of how to use the UnitOfWork ability of LINQ to SQL in conjunction with business objects from the Business Layer. Thanks, Lucian ...

Domain Model Saving

Recently finished reading Eric Evans Domain Driven Design (very informative, very enjoyable) however come to first major project since completing the book and got the issue how to handle the domain model save? I appreciate the use of services / repositories and how they can aid the model but how would they handle the model save? My pre...

LINQ Entities as business objects - pro/cons

Hello all, the dbml file generated by Visual Studio (sqlmetal) comes with entities mapped to database tables. In your opinion, these clases are suitable to be used as domain model classes? Or should we avoid them and isolate them into the data access layer only? Thanks ...

NHibernate Traversal Question - Creating a Fluent Interface

I'm stumped with NHibernate and my Domain Model right now. I'm imagining a nice API in my head but I'm having a really hard time making it a reality. Here's an example of what I'm trying to accomplish: Trip trip = new Trip("Austria2009"); foreach(User user in trip.People.Crew.IsApproved()) { reponse.write(user.Firstname); } // Or ...

Dealing with an anemic domain model

I was trying to separate my DAL from my Business Layer, and in doing so, I decided to eschew any ActiveRecord approach and go for a DataMapper approach. In other words, my domain objects would not take care of persisting themselves. In doing so, I seem to be encroaching on the "anemic domain model" anti-pattern. For instance, one of the...

Should we use foreign-key constraints when persisting Domain Models?

A while ago I had a discussion with my colleagues about the persistence of Domain Models and whether we should enforce foreign-key constraints at the database level. My first reaction was that the very use of a relational database implied the enforcement of such constraints, but some argued that the database should be seen as nothing bu...

Corrupting POCO Domain Model when creating LINQ Entity Classes?

Say I've got a domain model created from C# classes like this: public class MyClass { public string MyProperty { get; set; } } Along with the model, I have defined repository interfaces classes for IoC. Now, I'm trying to turn this POCO domain model into a set of Entity classes using LINQ mapping. (This approch was recommended in a b...

AutoMapper flattens Domain Models but does it do the opposite? If not, what does?

I've been reading up on AutoMapper because of a response to one of my earlier questions here. It says that AutoMapper flattens complex domain models, but I need something that does the opposite. I need to wire up my view models (flattened domain models) to the complex domain models so that I can quickly transform a view model into a doma...

What are good python libraries for the following needs?

What are good python libraries for the following needs: MVC Domain Abstraction Database Abstraction Video library (just to create thumbnails) I already know that SQLAlchemy is really good for Database Abstraction so don't bother with it unless you want to suggest a better one. Edit: This might seem stupid to mention but I'm talk...

Is there a rich domain model example?

I'm looking for a simple example to illustrate the benefits of using a rich domain model. Ideally, I'd like a before and after code listing (which should be as short as possible). The before code listing should show the problem being solved using an anemic domain model, and a lot of fairly procedural service-layer code, and the after co...

Zend Framework / MVC: What type of objects to push to the View?

Hey guys - here's a question on Zend Framework or better on MVC in general: I am asking myself for a quiet a long time now, if it is a good idea to push business objects (User, Team, etc.) to my views or if it would be better just to push dump data containers such as arrays to the view for rendering. When pushing business objects to m...

Is it possible to modify methods of an object instance using reflection

What I'm trying to do is create a domain model with a Plain Old PHP Object. The I'm creating a library which will do all the infrastructure stuff. So one of my models looks like this class Project { public $id; public $name; public $typeId; private $type; public function getType() { return $this->type; } public func...

Mapping vs. service layer, or business logic position

I got a Product and a collection of Payers. The Payers can pay for the product in three different ways, either but manually set the percentage, by Payers income or by the value of the Payers respective holdings.How the product is paid is determined by an enum on the Product. In my persistence layer i got three classes, Product, Payer, a...

Mapping from Entity Framework to custom domain model classes?

I wonder how could I obtain an automatic mapping between entities generated by entity framework (.NET Framework 3.5 SP1) and custom domain model classes? I know I can create some data converters that translates the objects back and forth between the two worlds, but how could I accomplish this in an automatic way? I started to develop my...

NHibernate many-to-many assocations making both ends as a parent by using a relationship entity in the Domain Model

Entities: Team <-> TeamEmployee <-> Employee Requirements: A Team and an Employee can exist without its counterpart. In the Team-TeamEmployee relation the Team is responsible (parent) [using later a TeamRepository]. In the Employee-TeamEmployee relation the Employee is responsible (parent) [using later an EmployeeRepository]. Duplica...

Where to place technology specific things in domain model?

We have an application that, along with many things, does some changes to Active Directory (add/remove user from group, change attribute values on user, etc). We are now in the process of redesigning it (from "spaghetti-code" into a more layered solution). The Active Directory management functions is something we would like to abstract...

How should I model an entitly with multiple states?

I have an entity, equivalent to a task, that can have multiple states. The "task" can either be in a pending, passed, or failed state. Each one of these states will also have some unique data. For instance, in a failed state the entity should have a reason for the failure, in the pending state it should have a deadline for evaluation, ec...

Constraining string length in domain classes

Hi all, I have a persistence ignorant domain model that uses abstract repositories to load domain objects. The concrete implementation of my repositories (the data access layer (DAL)) uses entity framework to fetch data from a sql server database. The database has length constraints on a lot of its varchar columns. Now imagine that I ...

Store domain model in PHP session

Is that a good practice to store the objects of the domain model in the PHP session ? This would enable to avoid to query and reconstruct every PHP object to each PHP request. Is there a size limit ? ...