public static FieldDescription Create(string name, int id, TypeDescription underlyingEnumTypeDescription) { return(new FieldDescription(underlyingEnumTypeDescription, name, null, id)); }
public static FieldDescription Create(MemberInfo member, TypeDescription typeDescription, int memberId) { var name = GetName(member); return(new FieldDescription(typeDescription, name, member, memberId)); }
private void AddSubTypeTo(TypeDescription baseType, TypeDescription typeDescription) { var baseMetaType = _metaTypes[baseType.ResolvedType]; baseMetaType.AddSubType(typeDescription.TypeId, typeDescription.ResolvedType); }
private void ThrowOnBreakingChanges(TypeDescription otherDescription) { if (Classification != otherDescription.Classification) { throw new BreakingChangeException(); } foreach (var field in _fields) { var otherField = otherDescription._fields.FirstOrDefault(x => Equals(x.Name, field.Name)); if (otherField != null) { field.ThrowOnBreakingChanges(otherField); } } var otherUnderlyingType = otherDescription.UnderlyingEnumTypeDescription; if (UnderlyingEnumTypeDescription == null && otherUnderlyingType != null) { throw new BreakingChangeException(); } if (UnderlyingEnumTypeDescription != null && otherUnderlyingType == null) { throw new BreakingChangeException(); } if (UnderlyingEnumTypeDescription != null && otherUnderlyingType != null) { if (!AreSameType(UnderlyingEnumTypeDescription, otherUnderlyingType)) { throw new BreakingChangeException(); } } var otherBaseType = otherDescription.BaseType; if (BaseType == null && otherBaseType != null) { throw new BreakingChangeException(string.Format("The base class of the type '{0}' has been changed from 'null' to '{1}': This is a breaking change!", FullTypeName, otherBaseType.FullTypeName)); } if (BaseType != null && otherBaseType == null) { throw new BreakingChangeException(string.Format("The base class of the type '{0}' has been changed from '{1}' to '{0}': This is a breaking change!", FullTypeName, BaseType.FullTypeName)); } if (BaseType != null && otherBaseType != null) { if (!AreSameType(BaseType, otherBaseType)) { throw new BreakingChangeException(string.Format("The base class of the type '{0}' has been changed from '{1}' to '{2}': This is a breaking change!", FullTypeName, BaseType.FullTypeName, otherBaseType.FullTypeName)); } BaseType.ThrowOnBreakingChanges(otherDescription.BaseType); } }
private static bool AreSameType(TypeDescription type, TypeDescription otherType) { return(string.Equals(type.FullTypeName, otherType.FullTypeName)); }
private int?GetUnderlyingEnumTypeId(TypeDescription typeDescription) { var surrogateType = typeDescription.UnderlyingEnumTypeDescription; return(surrogateType?.TypeId); }
private int?GetSurrogateTypeId(TypeDescription typeDescription) { var surrogateType = typeDescription.SurrogateType; return(surrogateType?.TypeId); }