Question

I have some POCOs and there are corresponding persistence objects that do the CRUD. What is a good name for the persistence objects? I've seen people use the term "service objects" for these, but when I think service, I think WCF. Maybe "persistence objects" is the best, but I'd like to hear what other people think.

Was it helpful?

Solution

One common convention is the Repository pattern when dealing with persisting objects to a datastore, so you would expect to see naming conventions in the form of (given an corresponding type Poco):

PocoRepository

OTHER TIPS

I believe you are thinking of a Data Transfer Object.

Data Transfer Objects, or DTO's, is a common way to refer to these objects.

See Martin Fowler's definition: http://martinfowler.com/eaaCatalog/dataTransferObject.html

Perhaps just adding "persistor" to the name, like Person_persistor etc, if the persistence objects just are used for persisting.

I use the following conventions:

  • <YourName>: The domain class you want to persist. (e.g. User)
  • <YourName(pluralized)>Repository: The class which persist/store your domain class. (e.g. UsersRepository)
  • Persitent<YourName> (optional): The class which is really persisted/stored. (Your repository should take your domain class and map it to this persistent model before saving it.) (Could be located in a PersistentModels folder.)

I believe "Entities" is a commonly used and traditional name.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top