private void DisallowReturnTypeChange(CodeTypeReference baseType, CodeTypeReference newType) { if (Helper.IsCollectionType(Item.TypeUsage.EdmType) && GetCollectionKind(Item.TypeUsage) != CollectionKind.None) { if (newType == null) { throw EDesignUtil.InvalidOperation(Strings.CannotChangePropertyReturnTypeToNull(Item.Name, Item.DeclaringType.Name)); } // you can change the return type of collection properties // we don't even need to check return; } if (!(baseType == null && newType == null) && ( (baseType != null && !baseType.Equals(newType)) || (newType != null && !newType.Equals(baseType)) ) ) { throw EDesignUtil.InvalidOperation(Strings.CannotChangePropertyReturnType(Item.Name, Item.DeclaringType.Name)); } }
private void AssignBaseType(CodeTypeDeclaration typeDecl, CodeTypeReference baseType, CodeTypeReference eventReturnedBaseType) { if (eventReturnedBaseType != null && !eventReturnedBaseType.Equals(baseType)) { _usingStandardBaseClass = false; typeDecl.BaseTypes.Add(eventReturnedBaseType); } else { if (baseType != null) { typeDecl.BaseTypes.Add(baseType); } } }