Hi All,
I'm using the Code Contracts classes in the System.Diagnostics.Contracts
namespace to define some contracts for my objects and I'm wondering how others name their contract classes when the contract is defined against a base interface. Let me illustrate with a small example:
[ContractClass(typeof(AnimalContract))]
public interface IAnimal
{
// definition here
}
[ContractClassFor(typeof(IAnimal))]
public class AnimalContract : IAnimal
{
// explicit interface implementation here
}
In this example I've called the Contract Class AnimalContract, but is there a better name? Because the contract is defined against an interface I almost want to name the class IAnimalContract to illustrate it's a contract for the IAnimal interface. This way when I see the two items in Solution Explorer they visually "tie-up", which helps to keep things nice and clean in my head. Of course, the contract itself is not an interface, so naming it in such a way just smells bad to me.
How do you guys (and gals) name your Contract classes in these cases? Is there a generally accepted convention?