private static bool CheckDataSpace(GlobalItem item) { if (BuiltInTypeKind.PrimitiveType == item.BuiltInTypeKind || BuiltInTypeKind.EdmFunction == item.BuiltInTypeKind && DataSpace.CSpace == item.DataSpace) { return(true); } if (Helper.IsRowType(item)) { foreach (EdmMember property in ((RowType)item).Properties) { if (!ArgumentValidation.CheckDataSpace(property.TypeUsage)) { return(false); } } return(true); } if (Helper.IsCollectionType(item)) { return(ArgumentValidation.CheckDataSpace(((CollectionType)item).TypeUsage)); } if (Helper.IsRefType(item)) { return(ArgumentValidation.CheckDataSpace((GlobalItem)((RefType)item).ElementType)); } if (item.DataSpace != DataSpace.SSpace) { return(item.DataSpace == DataSpace.CSpace); } return(true); }
private static void CheckParameter(FunctionParameter paramMeta, string varName) { ArgumentValidation.CheckReadOnly((GlobalItem)paramMeta.DeclaringFunction, varName); if (!ArgumentValidation.CheckDataSpace(paramMeta.TypeUsage)) { throw new ArgumentException(Strings.Cqt_Metadata_FunctionParameterIncorrectSpace, varName); } }
internal static void CheckMember(EdmMember memberMeta, string varName) { ArgumentValidation.CheckReadOnly((GlobalItem)memberMeta.DeclaringType, varName); if (!ArgumentValidation.CheckDataSpace(memberMeta.TypeUsage) || !ArgumentValidation.CheckDataSpace((GlobalItem)memberMeta.DeclaringType)) { throw new ArgumentException(Strings.Cqt_Metadata_EdmMemberIncorrectSpace, varName); } }
internal static void CheckType(TypeUsage type, string varName) { ArgumentValidation.CheckReadOnly(type, varName); if (!ArgumentValidation.CheckDataSpace(type)) { throw new ArgumentException(Strings.Cqt_Metadata_TypeUsageIncorrectSpace, nameof(type)); } }
internal static void CheckEntitySet(EntitySetBase entitySet, string varName) { ArgumentValidation.CheckReadOnly(entitySet, varName); if (entitySet.EntityContainer == null) { throw new ArgumentException(Strings.Cqt_Metadata_EntitySetEntityContainerNull, varName); } if (!ArgumentValidation.CheckDataSpace((GlobalItem)entitySet.EntityContainer)) { throw new ArgumentException(Strings.Cqt_Metadata_EntitySetIncorrectSpace, varName); } if (!ArgumentValidation.CheckDataSpace((GlobalItem)entitySet.ElementType)) { throw new ArgumentException(Strings.Cqt_Metadata_EntitySetIncorrectSpace, varName); } }
private static void CheckFunction(EdmFunction function) { ArgumentValidation.CheckReadOnly((GlobalItem)function, nameof(function)); if (!ArgumentValidation.CheckDataSpace((GlobalItem)function)) { throw new ArgumentException(Strings.Cqt_Metadata_FunctionIncorrectSpace, nameof(function)); } if (function.IsComposableAttribute && function.ReturnParameter == null) { throw new ArgumentException(Strings.Cqt_Metadata_FunctionReturnParameterNull, nameof(function)); } if (function.ReturnParameter != null && !ArgumentValidation.CheckDataSpace(function.ReturnParameter.TypeUsage)) { throw new ArgumentException(Strings.Cqt_Metadata_FunctionParameterIncorrectSpace, "function.ReturnParameter"); } IList <FunctionParameter> parameters = (IList <FunctionParameter>)function.Parameters; for (int index = 0; index < parameters.Count; ++index) { ArgumentValidation.CheckParameter(parameters[index], StringUtil.FormatIndex("function.Parameters", index)); } }
private static bool CheckDataSpace(TypeUsage type) { return(ArgumentValidation.CheckDataSpace((GlobalItem)type.EdmType)); }