Setting up a Common solution: FieldTypeExtensions
We have set up a Common solution project to provide a lot of common methods and classes that our projects will use. As we have multiple Sitecore websites we are working on, we have created this solution to allow us to configure multiple sites as well as allowing us to create multiple instances of a site.
Our Common solution has a project: FieldTypeExtensions. Within this are several classes used for our custom fields we have created. In order to create another instance of the same site (literally copying and pasting a website in Sitecore), we must allow for certain fields to be referencing its own site. For example, if one of your fields is a multilist with a source pointing to a folder in the content tree and you copy an instance of the website, you want the datasource of this multilist to now have the source of the new instance you have created.

Create the custom field
Under system > Field types, create a new field type, for this example, “custom tree list”.

Create the class in the Common solution
Under our FieldTypeExtensions project we have several custom fields.

In this class, we are replacing the “{root}” part of the source [DataSource={root}/Common/Categories&IncludeTemplatesForSelection=Category], with the path to the current site.
public new string Source
{
get { return base.Source; }
set
{
if (value.Contains("{root}"))
{
base.Source = value.Replace(
"{root}",
Configuration.GetStartPath(Sitecore.Context.ContentDatabase.Items[this.ItemID]));
}
else
{
base.Source = value;
}
}
}
So now when you copy an instance of the site, all fields that have similar data sources may be dynamically updated. The same can be done for custom internal link, link, lookup, tree fields.