コード例 #1
0
 public static SemanticRuleViolation AggregateIdentifierMustBeAValueObject(AggregateSyntax aggregate)
 {
     return new SemanticRuleViolation(
         RuleCodes.AggregateIdentifierMustBeAValueObject,
         String.Format("Identifier for '{0}' must be a value object.", aggregate.Name),
         aggregate);
 }
コード例 #2
0
 public static SemanticRuleViolation AggregateMustHaveIdentifier(AggregateSyntax aggregate)
 {
     return new SemanticRuleViolation(
         RuleCodes.AggregateMustHaveIdentifier,
         String.Format("Aggregate '{0}' must have an identifier, either by inheriting from a base aggregate or by specifying an identifier type.", aggregate.Name),
         aggregate);
 }
コード例 #3
0
        private void Visit(AggregateSyntax aggregate)
        {
            if (aggregate.Identifier.HasValue)
            {
                var id = aggregate.Identifier.Value;
                if (id is NamedAggregateIdentifierSyntax)
                    ValidateNamedAggregateIdentifier((NamedAggregateIdentifierSyntax) id, aggregate);

                if (id is GenericAggregateIdentifierSyntax)
                    ValidateGenericAggregateIdentifier((GenericAggregateIdentifierSyntax) id, aggregate);
            }
            else if(!aggregate.Base.HasValue)
                Fail(SemanticRuleViolation.AggregateMustHaveIdentifier(aggregate));
        }
コード例 #4
0
        private void ValidateNamedAggregateIdentifier(NamedAggregateIdentifierSyntax id, AggregateSyntax aggregate)
        {
            var idSymbol = ResolveAndValidateTypeExists(aggregate, id.Type.Name);
            if (!idSymbol.HasValue) return;

            var idType = idSymbol.Value as IType;
            if (idType == null)
            {
                Fail(SemanticRuleViolation.AggregateIdentifierMustBeAValueObject(aggregate));
                return;
            }

            if (!idType.HasValueSemantics)
            {
                Fail(SemanticRuleViolation.AggregateIdentifierMustBeAValueObject(aggregate));
                return;
            }
        }
コード例 #5
0
 private void ValidateGenericAggregateIdentifier(GenericAggregateIdentifierSyntax id, AggregateSyntax aggregate)
 {
     throw new System.NotImplementedException();
 }