Allows say there exists a simple DTO with qualities Id, Title. If the DTO originates from database through some data layer, Id ought to be of type int. If the DTO originates from Active Directory, through some data layer, Id ought to be of type Guid.

An amount be the easiest method to implement this?

Thanks ahead of time!

The simplest strategy is to merely have two qualities all of their appropriate type:

public Guid ActiveDirectoryID {get;set;};

public int DatabaseID {get;set;};

As a substitute you are able to define the ID property being an Object and implement it by having an overloaded GetID() and SetID() for types.

It is possible although not trivial to transform from a Guid and Int types.