public void TestIsRelation() { var expr = new IsRelation() { Expr = new Expr() { Operand = Operand.n }, Value = 456 }; expr.Match("456").Should().BeTrue(); expr.Match("123").Should().BeFalse(); }
/// <summary> /// LUA结构支持 /// </summary> /// <returns></returns> public override void GetLuaStruct(StringBuilder code) { base.GetLuaStruct(code); int idx; if (!string.IsNullOrWhiteSpace(PropertyName)) { code.AppendLine($@"['PropertyName'] = '{PropertyName.ToLuaString()}',"); } else { code.AppendLine($@"['PropertyName'] = nil,"); } code.AppendLine($@"['IsCaption'] ={(IsCaption.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(Alias)) { code.AppendLine($@"['Alias'] = '{Alias.ToLuaString()}',"); } else { code.AppendLine($@"['Alias'] = nil,"); } if (!string.IsNullOrWhiteSpace(Group)) { code.AppendLine($@"['Group'] = '{Group.ToLuaString()}',"); } else { code.AppendLine($@"['Group'] = nil,"); } code.AppendLine($@"['CreateIndex'] ={(CreateIndex.ToString().ToLower())},"); code.AppendLine($@"['IsPrimaryKey'] ={(IsPrimaryKey.ToString().ToLower())},"); code.AppendLine($@"['IsExtendKey'] ={(IsExtendKey.ToString().ToLower())},"); code.AppendLine($@"['IsIdentity'] ={(IsIdentity.ToString().ToLower())},"); code.AppendLine($@"['IsGlobalKey'] ={(IsGlobalKey.ToString().ToLower())},"); code.AppendLine($@"['UniqueIndex'] ={UniqueIndex},"); code.AppendLine($@"['IsRequired'] ={(IsRequired.ToString().ToLower())},"); code.AppendLine($@"['IsUserReadOnly'] ={(IsUserReadOnly.ToString().ToLower())},"); code.AppendLine($@"['IsMemo'] ={(IsMemo.ToString().ToLower())},"); code.AppendLine($@"['DenyClient'] ={(DenyClient.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(Prefix)) { code.AppendLine($@"['Prefix'] = '{Prefix.ToLuaString()}',"); } else { code.AppendLine($@"['Prefix'] = nil,"); } if (!string.IsNullOrWhiteSpace(Suffix)) { code.AppendLine($@"['Suffix'] = '{Suffix.ToLuaString()}',"); } else { code.AppendLine($@"['Suffix'] = nil,"); } if (!string.IsNullOrWhiteSpace(InputType)) { code.AppendLine($@"['InputType'] = '{InputType.ToLuaString()}',"); } else { code.AppendLine($@"['InputType'] = nil,"); } if (!string.IsNullOrWhiteSpace(ComboBoxUrl)) { code.AppendLine($@"['ComboBoxUrl'] = '{ComboBoxUrl.ToLuaString()}',"); } else { code.AppendLine($@"['ComboBoxUrl'] = nil,"); } code.AppendLine($@"['IsMoney'] ={(IsMoney.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(GridAlign)) { code.AppendLine($@"['GridAlign'] = '{GridAlign.ToLuaString()}',"); } else { code.AppendLine($@"['GridAlign'] = nil,"); } if (!string.IsNullOrWhiteSpace(DataFormater)) { code.AppendLine($@"['DataFormater'] = '{DataFormater.ToLuaString()}',"); } else { code.AppendLine($@"['DataFormater'] = nil,"); } code.AppendLine($@"['DenyClient'] ={(DenyClient.ToString().ToLower())},"); code.AppendLine($@"['GridDetails'] ={(GridDetails.ToString().ToLower())},"); code.AppendLine($@"['NoneGrid'] ={(NoneGrid.ToString().ToLower())},"); code.AppendLine($@"['NoneDetails'] ={(NoneDetails.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(GridDetailsCode)) { code.AppendLine($@"['GridDetailsCode'] = '{GridDetailsCode.ToLuaString()}',"); } else { code.AppendLine($@"['GridDetailsCode'] = nil,"); } if (!string.IsNullOrWhiteSpace(CppType)) { code.AppendLine($@"['CppType'] = '{CppType.ToLuaString()}',"); } else { code.AppendLine($@"['CppType'] = nil,"); } if (CppTypeObject != null) { code.AppendLine($@"['CppTypeObject'] ='{CppTypeObject}',"); } if (!string.IsNullOrWhiteSpace(CppName)) { code.AppendLine($@"['CppName'] = '{CppName.ToLuaString()}',"); } else { code.AppendLine($@"['CppName'] = nil,"); } if (!string.IsNullOrWhiteSpace(CppLastType)) { code.AppendLine($@"['CppLastType'] = '{CppLastType.ToLuaString()}',"); } else { code.AppendLine($@"['CppLastType'] = nil,"); } code.AppendLine($@"['IsIntDecimal'] ={(IsIntDecimal.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(CsType)) { code.AppendLine($@"['CsType'] = '{CsType.ToLuaString()}',"); } else { code.AppendLine($@"['CsType'] = nil,"); } if (!string.IsNullOrWhiteSpace(CustomType)) { code.AppendLine($@"['CustomType'] = '{CustomType.ToLuaString()}',"); } else { code.AppendLine($@"['CustomType'] = nil,"); } if (!string.IsNullOrWhiteSpace(LastCsType)) { code.AppendLine($@"['LastCsType'] = '{LastCsType.ToLuaString()}',"); } else { code.AppendLine($@"['LastCsType'] = nil,"); } if (EnumConfig != null) { code.AppendLine($@"['EnumConfig'] = {EnumConfig.GetLuaStruct()},"); } code.AppendLine($@"['IsCompute'] ={(IsCompute.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(ComputeGetCode)) { code.AppendLine($@"['ComputeGetCode'] = '{ComputeGetCode.ToLuaString()}',"); } else { code.AppendLine($@"['ComputeGetCode'] = nil,"); } if (!string.IsNullOrWhiteSpace(ComputeSetCode)) { code.AppendLine($@"['ComputeSetCode'] = '{ComputeSetCode.ToLuaString()}',"); } else { code.AppendLine($@"['ComputeSetCode'] = nil,"); } code.AppendLine($@"['IsMiddleField'] ={(IsMiddleField.ToString().ToLower())},"); code.AppendLine($@"['InnerField'] ={(InnerField.ToString().ToLower())},"); code.AppendLine($@"['IsSystemField'] ={(IsSystemField.ToString().ToLower())},"); code.AppendLine($@"['IsInterfaceField'] ={(IsInterfaceField.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(Initialization)) { code.AppendLine($@"['Initialization'] = '{Initialization.ToLuaString()}',"); } else { code.AppendLine($@"['Initialization'] = nil,"); } if (!string.IsNullOrWhiteSpace(EmptyValue)) { code.AppendLine($@"['EmptyValue'] = '{EmptyValue.ToLuaString()}',"); } else { code.AppendLine($@"['EmptyValue'] = nil,"); } code.AppendLine($@"['DenyScope'] ='{DenyScope}',"); code.AppendLine($@"['Nullable'] ={(Nullable.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(Max)) { code.AppendLine($@"['Max'] = '{Max.ToLuaString()}',"); } else { code.AppendLine($@"['Max'] = nil,"); } if (!string.IsNullOrWhiteSpace(Min)) { code.AppendLine($@"['Min'] = '{Min.ToLuaString()}',"); } else { code.AppendLine($@"['Min'] = nil,"); } code.AppendLine($@"['UniqueString'] ={(UniqueString.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(ColumnName)) { code.AppendLine($@"['ColumnName'] = '{ColumnName.ToLuaString()}',"); } else { code.AppendLine($@"['ColumnName'] = nil,"); } code.AppendLine($@"['DbNullable'] ={(DbNullable.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(DbType)) { code.AppendLine($@"['DbType'] = '{DbType.ToLuaString()}',"); } else { code.AppendLine($@"['DbType'] = nil,"); } code.AppendLine($@"['Precision'] ={Datalen},"); if (!string.IsNullOrWhiteSpace(ArrayLen)) { code.AppendLine($@"['ArrayLen'] = '{ArrayLen.ToLuaString()}',"); } else { code.AppendLine($@"['ArrayLen'] = nil,"); } code.AppendLine($@"['Scale'] ={Scale},"); code.AppendLine($@"['DbIndex'] ={DbIndex},"); code.AppendLine($@"['Unicode'] ={(Unicode.ToString().ToLower())},"); code.AppendLine($@"['FixedLength'] ={(FixedLength.ToString().ToLower())},"); code.AppendLine($@"['IsBlob'] ={(IsBlob.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(StorageProperty)) { code.AppendLine($@"['StorageProperty'] = '{StorageProperty.ToLuaString()}',"); } else { code.AppendLine($@"['StorageProperty'] = nil,"); } code.AppendLine($@"['DbInnerField'] ={(DbInnerField.ToString().ToLower())},"); code.AppendLine($@"['NoStorage'] ={(NoStorage.ToString().ToLower())},"); code.AppendLine($@"['KeepStorageScreen'] ='{KeepStorageScreen}',"); code.AppendLine($@"['CustomWrite'] ={(CustomWrite.ToString().ToLower())},"); code.AppendLine($@"['IsLinkField'] ={(IsLinkField.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(LinkTable)) { code.AppendLine($@"['LinkTable'] = '{LinkTable.ToLuaString()}',"); } else { code.AppendLine($@"['LinkTable'] = nil,"); } code.AppendLine($@"['IsLinkKey'] ={(IsLinkKey.ToString().ToLower())},"); code.AppendLine($@"['IsLinkCaption'] ={(IsLinkCaption.ToString().ToLower())},"); code.AppendLine($@"['IsUserId'] ={(IsUserId.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(LinkField)) { code.AppendLine($@"['LinkField'] = '{LinkField.ToLuaString()}',"); } else { code.AppendLine($@"['LinkField'] = nil,"); } code.AppendLine($@"['IsCustomCompute'] ={(IsCustomCompute.ToString().ToLower())},"); code.AppendLine($@"['CanGet'] ={(CanGet.ToString().ToLower())},"); code.AppendLine($@"['CanSet'] ={(CanSet.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(AccessType)) { code.AppendLine($@"['AccessType'] = '{AccessType.ToLuaString()}',"); } else { code.AppendLine($@"['AccessType'] = nil,"); } code.AppendLine($@"['ReadOnly'] ={(ReadOnly.ToString().ToLower())},"); code.AppendLine($@"['CanInput'] ={(CanUserInput.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(ExtendRole)) { code.AppendLine($@"['ExtendRole'] = '{ExtendRole.ToLuaString()}',"); } else { code.AppendLine($@"['ExtendRole'] = nil,"); } if (!string.IsNullOrWhiteSpace(ValueSeparate)) { code.AppendLine($@"['ValueSeparate'] = '{ValueSeparate.ToLuaString()}',"); } else { code.AppendLine($@"['ValueSeparate'] = nil,"); } if (!string.IsNullOrWhiteSpace(ArraySeparate)) { code.AppendLine($@"['ArraySeparate'] = '{ArraySeparate.ToLuaString()}',"); } else { code.AppendLine($@"['ArraySeparate'] = nil,"); } code.AppendLine($@"['ExtendArray'] ={(ExtendArray.ToString().ToLower())},"); code.AppendLine($@"['IsKeyValueArray'] ={(IsKeyValueArray.ToString().ToLower())},"); code.AppendLine($@"['IsRelation'] ={(IsRelation.ToString().ToLower())},"); if (!string.IsNullOrWhiteSpace(ExtendPropertyName)) { code.AppendLine($@"['ExtendPropertyName'] = '{ExtendPropertyName.ToLuaString()}',"); } else { code.AppendLine($@"['ExtendPropertyName'] = nil,"); } if (!string.IsNullOrWhiteSpace(ExtendClassName)) { code.AppendLine($@"['ExtendClassName'] = '{ExtendClassName.ToLuaString()}',"); } else { code.AppendLine($@"['ExtendClassName'] = nil,"); } code.AppendLine($@"['ExtendClassIsPredestinate'] ={(ExtendClassIsPredestinate.ToString().ToLower())},"); code.AppendLine($@"['IsRelationField'] ={(IsRelationField.ToString().ToLower())},"); code.AppendLine($@"['IsRelationValue'] ={(IsRelationValue.ToString().ToLower())},"); code.AppendLine($@"['IsRelationArray'] ={(IsRelationArray.ToString().ToLower())},"); code.AppendLine($@"['IsExtendArray'] ={(IsExtendArray.ToString().ToLower())},"); code.AppendLine($@"['IsExtendValue'] ={(IsExtendValue.ToString().ToLower())},"); }