public static bool IsAggegate(this CimPropertyDeclaration p, CimClass associationClass) { var q = p.Qualifiers["Aggregate"]; if (q != null) { return(true); } return(associationClass.CimClassQualifiers["Aggregation"] != null); }
public bool HasPropertyWithSameType(CimPropertyDeclaration prop, IDictionary <string, CimTypeDeclaration> typeRepo) { var candidate = _cimClass.CimClassProperties[prop.Name]; if (candidate == null) { var parent = GetParent(typeRepo); if (parent == null) { return(false); } return(parent.HasPropertyWithSameType(prop, typeRepo)); } return(candidate.ResolveType(typeRepo, out var _).ToString() == prop.ResolveType(typeRepo, out var __).ToString()); }
internal AssociationBuilder(ModelBuildingOptions options, CimTypeDeclaration declaration, IDictionary <string, CimTypeDeclaration> typeRepository) { _options = options; _declaration = declaration; _typeRepository = typeRepository; var keyProperties = declaration.Properties.Where(p => p.IsKey()).ToList(); if (keyProperties.Count == 0) { keyProperties = declaration.Properties.Where(p => p.IsReference()).ToList(); } if (keyProperties.Count != 2) { throw new NotSupportedException($"{_declaration.Name} association type should have 2 key properties. Got {keyProperties.Count}"); } _sourceProperty = keyProperties[0]; _targetProperty = keyProperties[1]; }
public static TypeSyntax ResolveType(this CimPropertyDeclaration p, IDictionary <string, CimTypeDeclaration> typeRepo, out bool isCimObject) { return(ResolveType(p.CimType, p.ReferenceClassName, p.Qualifiers.IsNotNull(), typeRepo, out isCimObject, out var _, out var _, out var _)); }
public static bool IsReference(this CimPropertyDeclaration p) { return(p.CimType == CimType.Reference); }
public static bool IsKey(this CimPropertyDeclaration p) { return((p.Flags & CimFlags.Key) == CimFlags.Key); }
public static bool IsReadOnly(this CimPropertyDeclaration p) { return((p.Flags & CimFlags.ReadOnly) == CimFlags.ReadOnly); }