BestPractice: Pros and Cons for using AutoMapper or LINQ (LINQ to Objects) for mapping between a Domain Model and a Presentation Model
What do you think? How do you map between your domain and presentation model? ...
What do you think? How do you map between your domain and presentation model? ...
I have a model "news item" which contains text, image etc to display as latest news on several pages in a website. This "news item" can also be posted to Twitter or Facebook. Is it clean to implement a method post inside the news item model and inject the different post implementations as a strategy? Or is it better to have a separate ap...
I was just looking into the source code of an existing project which uses nHibernate and found that there are interfaces created for each entity classes. E.g ICustomer for Customer class. I was just wondering what can be the advantage of this pattern as ICustomer contains mainly the properties and very few methods. ...
I have a situation where I have a Common.Domain.Person and Specific.Domain.Person. First one should be provided as a part of a common package. Second one appears when common package has to be customized to fit the needs of specific project. In the object model, it can be easily implemented with inheritance. In the NH mapping, however...
I'm trying to make the domain model of a management system. I have the following kind of people in this system: employee manager top mananger I decided to define an User, from where Employee, Manager and Top Manager will specialize from. Now, I don't know what kind of specialization hierarchy I should choose from. I can't decide betw...
When designing both the domain-model and class-diagrams I am having some trouble understanding what to put in them. I'll give an example of what I mean: I am doing a vacations scheduler program, that has an Administrator and End-Users. The Administrator does a couple of things like registering End-Users in the program, changing their p...
Let's say I want to model a cinema. The cinema will have a couple of rooms(for example, 7), where the movies are being played. I wonder how should I design the domain model for this scenario. Should the Cinema class concept concept have a direct association with the 7 rooms? Should the Cinema class concept have an association with a ...
Let's say I've made a list of concepts I'll use to draw my Domain Model. Furthermore, I have a couple of Use Cases from which I did a couple of System Sequence Diagrams. When drawing the Domain Model, I never know where to start from: Designing the model as I believe the system to be. This is, if I am modelling a the human body, I sta...
I am modelling a DVD Rental Store: A Client gives its clientNumber to the System. The System checks whenever the given clientNumber is valid. The Client gives the name of the DVD he wants to rent. ... ...I will later have to form an association between a new instance of Rent DVD class concept to the current Client c. My Domain Model ...
Hi all, I have following problem and I am not sure how to go about it: We have a given "marked" state of the domain objects (which is made persitent in a database). Driving away from this "marked" state the user is allows to make several changes to the domain object but if he wants to he is allowed to revert back to the last "marked" s...
I see DTO types being created within and passed between types in the domain model. Is this good practise? I always thought DTOs were to be used principally at context boundaries (i.e. at the edge of the object graph) to decouple context implementations (e.g. at the domain / ui boundary). ...
When creating domain model, we almost always have Id field or property for our entities which represents the primary key column of corresponding table in the database. My question is - if I have this key property that has nothing to do with the domain model (in other words, it's just database concern; Martin Fowler prefers to name it mea...
I have a domain model type. One of its numerous properties requires an ITranslationService to provide the ability to translate its return value into the appropriate language. Should I inject the ITranslationService into the constructor of the domain model type (thereby having to alter everywhere the type is instantiated and having to be...
Is it a good practise to decouple input checking from a model and have it handled elsewhere, say by a controller? If so, how could this be done from an MVC or DDD standpoint? ...
For example, I've got a business object Person: class Person : INotifyPropertyChanged { string Name { get; set; } DateTime DateOfBirth { get; set; } } // ^ abbreviated for better legibility; implementation would be trivial And I've got some Winforms UI controls data-bound to an object of this class: Person somePerson = ...; n...
Hi, Please consider the domain model shown below (simplified for brevity - no ids etc.) A Customer can comment on a Product only once. Lets assume (for reasons I don't want to get into here) that the Customer class cannot have a collection of Reviews that it owns. The Product is the main Aggregate root here. Often in this situation,...
I've been trying to figure out the best way to model this entity, and I'm getting stuck. Here's the basic use case/story: We have equipment arriving on site. We won't know what the equipment is until it arrives. Once the equipment arrives on site it must be recorded as having arrived and whether it was idle or active. If it is active th...
Hi, I implemented the domain model from the book Zend Framework: Survive the deep end but nowhere they mentions how to handle collections of objects. I mean, how to find multiple rows ? Similar to fetchAll() ? Any advises, best practices to work with such things ? ...
By the way - with reference to data modelling I'm referring to logical or conceptual data models - not physical ones. The question came up during a discussion at work; naturally I leapt to Wikipedia to get some basic definitions in place - hoping that they might clarify the difference - but they didn't... A conceptual schema or conc...
A "Lookup" in this example is an IList<string> of state abbreviations. Generally, your Domain Model POCOs won't include these options. ViewModels usually take this responsibility referencing both the original Domain Model as well as the Lookup object, but what happens when the Domain Models are nested and you are using MVC templates (w...