public void Execute() { ReferenceFinder.SetModule(ModuleDefinition); ReferenceFinder.FindReferences(AssemblyResolver); var collectionEquals = CollectionHelperInjector.Inject(ModuleDefinition); var matchingTypes = GetMachingTypes().ToArray(); foreach (var type in matchingTypes) { var props = type.Properties; foreach (var prop in props) { ModuleDefinition.ImportReference(prop.PropertyType).Resolve(); } var attribute = type.CustomAttributes.Single(x => x.AttributeType.Name == attributeName); var typeRef = GetGenericType(type); var ignoreBaseClassProperties = IsPropertySet(attribute, IgnoreBaseClassProperties); if (!IsPropertySet(attribute, DoNotAddEquals)) { var typeCheck = 0; var typeCheckProperty = attribute.Properties.SingleOrDefault(x => x.Name == "TypeCheck"); if (typeCheckProperty.Name != null) { typeCheck = (int) typeCheckProperty.Argument.Value; } var newEquals = EqualsInjector.InjectEqualsInternal(type, typeRef, collectionEquals, ignoreBaseClassProperties); EqualsInjector.InjectEqualsType(type, typeRef, newEquals); EqualsInjector.InjectEqualsObject(type, typeRef, newEquals, typeCheck); var typeInterface = ReferenceFinder.IEquatable.TypeReference.MakeGenericInstanceType(typeRef); if (type.Interfaces.All(x => x.FullName != typeInterface.FullName)) { type.Interfaces.Add(typeInterface); } } if (!IsPropertySet(attribute, DoNotAddGetHashCode)) { GetHashCodeInjector.Inject(type, ignoreBaseClassProperties); } if (!IsPropertySet(attribute, DoNotAddEqualityOperators)) { OperatorInjector.InjectEqualityOperator(type); OperatorInjector.InjectInequalityOperator(type); } } foreach (var type in matchingTypes) { RemoveFodyAttributes(type); } RemoveReference(); }