private IEnumerable<Violation> VerifyNotSettingProperty(VerificationContext context, TypeNode typeNode)
        {
            var violatingMethods = from method in typeNode.InboundFrom<MethodNode, ContainedInLink>()
                                   where method.OutboundLinks.OfType<SetPropertyLink>().Any()
                                   select method;

            foreach (var method in violatingMethods)
            {
                yield return new ImmutableTypeSetsPropertyOutsideOfConstructorViolation(typeNode, method);
            }
        }
        private IEnumerable<Violation> VerifyNoWritableFields(VerificationContext context, TypeNode typeNode)
        {
            var violatingFields = from field in typeNode.InboundFrom<FieldNode, ContainedInLink>()
                                  where !field.Field.IsInitOnly
                                  select field;

            foreach (var field in violatingFields)
            {
               yield return new ImmutableTypeHasWritableFieldViolation(typeNode, field);
            }
        }
        private IEnumerable<Violation> VerifyNoNotPrivatePropertySetters(VerificationContext context, TypeNode typeNode)
        {
            var violatingProperties = from property in typeNode.InboundFrom<PropertyNode, ContainedInLink>()
                                      where property.Property.CanWrite && !property.Property.SetMethod.IsPrivate
                                      select property;

            foreach (var property in violatingProperties)
            {
                yield return new ImmutableTypeHasNonPrivateSetterViolation(typeNode, property);
            }
        }
 public ImmutableTypeSetsPropertyOutsideOfConstructorViolation(TypeNode violatingType, MethodNode violatingMethod)
 {
     this.Node = violatingType;
     this.ViolatingMethod = violatingMethod;
 }
 public bool IsImmutableType(TypeNode node)
 {
     return node.Type.GetCustomAttribute<ImmutableAttribute>() != null;
 }
 public ImmutableTypeHasWritableFieldViolation(TypeNode violatingType, FieldNode violatingField)
 {
     this.Node = violatingType;
     this.ViolatingField = violatingField;
 }
        public ImmutableTypeHasNonPrivateSetterViolation(TypeNode violatingType, PropertyNode violatingProperty)
        {
            this.Node = violatingType;

            ViolatingProperty = violatingProperty;
        }
 public bool IsQuery(TypeNode node)
 {
     return node.Type.GetInterfaces().Any(x => x.IsGenericType && x.GetGenericTypeDefinition() == typeof(IQuery<>));
 }
 public bool IsCommand(TypeNode node)
 {
     return typeof (ICommand).IsAssignableFrom(node.Type);
 }
 public bool ShouldInlineImplementationsFor(TypeNode interfaceNode)
 {
     return true;
 }
 public bool IsEntity(TypeNode node)
 {
     return typeof(EntityBase).IsAssignableFrom(node.Type) && !typeof(IAggregate).IsAssignableFrom(node.Type);
 }