How to deal with data on the model specific to the technology being used?

Posted by user1620696 on Programmers See other posts from Programmers or by user1620696
Published on 2013-10-18T19:31:42Z Indexed on 2013/10/18 22:15 UTC
Read the original article Hit count: 253

There are some cases where some of the data on a class of the domain model of an application seems to be dependent on the technology being used. One example of this is the following: suppose we are building one application in .NET such that there's the need of an Employee class. Suppose further that we are going to implement relational database, then the Employee has a primary key right? So that the classe would be something like

public class Employee 
{
     public int EmployeeID { get; set; }
     public string Name { get; set; }
     ... 
}

Now, that EmployeeID is dependent on the technology right? That's something that has to do with the way we've choose to persist our data. Should we write down a class independent of such things? If we do it this way, how should we work? I think I would need to map all the time between domain model and persistence specific types, but I'm not sure.

© Programmers or respective owner

Related posts about object-oriented

Related posts about domain-model