My application manages fruit records. The application supports different types of data sources. Each fruit has a unique id in the data source. Uniqueness across data sources is not guaranteed because I don't have control over those ids.
I have created a class FruitSourceManager{}
that allows we to configure (add/remove) the different fruit sources in my application.
I also have class BasketFruitSource{}
class CartFruitSource{}
class TruckFruitSource{}
each of which implements the
interface IFruitSource{}
I have a
class FruitManager{}
which provides CRUD operations on the Fruit by invoking operations on the IFruitSource
And then I have a
class Fruit{}
which is used at the business layer and a class FruitDTO{}
which is used by the web service.
The application exposes a web service that allows you to read or modify a fruit record.
GetFruitById()
UpdateFruit()
Is it ok to concatenate the FruitSourceId with the FruitId as a single ID used in the FruitDTO? Or should I use two parameters (FruitSourceId and FruitID) uniquely identifying the fruit?
Are there any pros and cons to one versus the other? Or am I splitting hairs here?