protected override Expression VisitMember(MemberExpression m) { if (m.Expression != null && m.Expression.NodeType == ExpressionType.Parameter) { if (!list.Contains(m.Member.Name)) { list.Add(m.Member.Name); } return(Expression.Convert(Expression.Call(row, miGetValue, Expression.Constant(m.Member.Name)), m.Type)); } return(base.VisitMember(m)); }
public void Verify_TryRemove_can_remove_field_last_using_index() { IFieldList fields = new FieldList(); var field1 = Field.Builder <Primitive>() .Id("field1") .DataType(SchemaDataType.Primitive) .IsNullable() .Build(); fields.Add(field1); var field2 = Field.Builder <Primitive>() .Id("field2") .DataType(SchemaDataType.Primitive) .IsNullable() .Build(); fields.Add(field2); var field3 = Field.Builder <Primitive>() .Id("field3") .DataType(SchemaDataType.Primitive) .IsNullable() .Build(); fields.Add(field3); Assert.IsTrue(fields.HasValues); Assert.AreEqual(3, fields.Count); Assert.IsTrue(fields.TryRemove(2, out PrimitiveField field)); Assert.IsNotNull(field); Assert.IsFalse(fields.Contains(field)); Assert.AreEqual(2, fields.Count); }
public void Verify_TryRemove_does_not_throw_when_index_greater_than_field_list() { IFieldList fields = new FieldList(); var field1 = Field.Builder <Primitive>() .Id("field1") .DataType(SchemaDataType.Primitive) .IsNullable() .Build(); fields.Add(field1); var field2 = Field.Builder <Primitive>() .Id("field2") .DataType(SchemaDataType.Primitive) .IsNullable() .Build(); fields.Add(field2); var field3 = Field.Builder <Primitive>() .Id("field3") .DataType(SchemaDataType.Primitive) .IsNullable() .Build(); fields.Add(field3); Assert.IsTrue(fields.HasValues); Assert.AreEqual(3, fields.Count); Assert.IsFalse(fields.TryRemove(5, out PrimitiveField field)); Assert.IsNotNull(field); Assert.IsFalse(fields.Contains(field)); Assert.AreEqual(3, fields.Count); }
public bool InFieldList(string field) { if (field.Equals("desc")) { field = "[desc]"; } return(!FieldList.Any() || FieldList.Contains(field) || FieldList.Contains("*")); }
protected void AddField(Field field) { if (field != null && !FieldList.Contains(field)) { FieldList.Add(field); field.Changed += delegate { Modified(); }; Modified(); } }
protected void AddField(Field field) { if (field != null && !FieldList.Contains(field)) { OnBeginUndoableOperation(); FieldList.Add(field); field.BeginUndoableOperation += delegate { OnBeginUndoableOperation(); }; field.Modified += delegate { Changed(); }; Changed(); } }
public void Verify_can_remove_field_middle_using_id() { IFieldList fields = new FieldList(); var field1 = Field.Builder <Primitive>() .Id("field1") .DataType(SchemaDataType.Primitive) .IsNullable() .Build(); fields.Add(field1); var field2 = Field.Builder <Primitive>() .Id("field2") .DataType(SchemaDataType.Primitive) .IsNullable() .Build(); fields.Add(field2); var field3 = Field.Builder <Primitive>() .Id("field3") .DataType(SchemaDataType.Primitive) .IsNullable() .Build(); fields.Add(field3); Assert.IsTrue(fields.HasValues); Assert.AreEqual(3, fields.Count); PrimitiveField specification = fields.Remove("field2"); Assert.IsNotNull(specification); Assert.IsFalse(fields.Contains(specification)); Assert.AreEqual(2, fields.Count); }
public void Verify_remove_does_not_throw_when_index_less_than_zero() { IFieldList fields = new FieldList(); var field1 = Field.Builder <Primitive>() .Id("field1") .DataType(SchemaDataType.Primitive) .IsNullable() .Build(); fields.Add(field1); var field2 = Field.Builder <Primitive>() .Id("field2") .DataType(SchemaDataType.Primitive) .IsNullable() .Build(); fields.Add(field2); var field3 = Field.Builder <Primitive>() .Id("field3") .DataType(SchemaDataType.Primitive) .IsNullable() .Build(); fields.Add(field3); Assert.IsTrue(fields.HasValues); Assert.AreEqual(3, fields.Count); PrimitiveField specification = fields.Remove(-1); Assert.IsNotNull(specification); Assert.IsFalse(fields.Contains(specification)); Assert.AreEqual(3, fields.Count); }