Example #1
0
        public void Validate(string[] knownTypes)
        {
            // Assert all names are unique and specified and only contain letters
            if (!DataGraphHelpers.IsNameValid(Name))
            {
                throw new InvalidOperationException($"Invalid property name {Name}");
            }

            if (!knownTypes.Contains(Type))
            {
                throw new InvalidOperationException($"Type {Type} on property {Name} is unknown");
            }
        }
Example #2
0
        public void Validate(string[] knownTypes)
        {
            if (Properties.Select(i => i.Name).Distinct().Count() != Properties.Count())
            {
                throw new InvalidOperationException($"Type {ClassName} had duplicate property names.");
            }

            if (!DataGraphHelpers.IsNameValid(ClassName))
            {
                throw new InvalidOperationException($"Invalid type name {ClassName}");
            }

            foreach (var prop in Properties)
            {
                prop.Validate(knownTypes);
            }
        }