/// <summary> /// Initializes a new instance of the <see cref="TypeSchema"/> class. /// </summary> /// <param name="inspector"> /// The inspector. /// </param> /// <param name="handlePropertyIgnore"> /// The handle property ignore. /// </param> internal TypeSchema(Inspector inspector, bool handlePropertyIgnore) { var properties = new List<TypeSchemaProperty>(inspector.Properties.Count); foreach (var property in inspector.Properties.Where(property => !handlePropertyIgnore || !property.Ignore)) { var typeSchemaProperty = new TypeSchemaProperty(); typeSchemaProperty.PropertyName = property.Name; typeSchemaProperty.InspectedProperty = property; Encoder.TryGetEncoder(property.PropertyType, out typeSchemaProperty.EncoderInfo); properties.Add(typeSchemaProperty); } this.typeSchemaProperties = properties.ToArray(); this.writeObject = TypeSchema.CompileWriteObjectDelegate(this.typeSchemaProperties); this.serializedSchema = new Lazy<byte[]>(() => this.GetSerializedSchema()); }
/// <summary> /// Initializes a new instance of the <see cref="TypeSchema" /> class. /// </summary> /// <param name="inspector"> /// The inspector. /// </param> /// <param name="handlePropertyIgnore"> /// The handle property ignore. /// </param> internal TypeSchema(Inspector inspector, bool handlePropertyIgnore) { var properties = new List <TypeSchemaProperty>(inspector.Properties.Count); foreach (var property in inspector.Properties.Where(property => !handlePropertyIgnore || !property.Ignore)) { var typeSchemaProperty = new TypeSchemaProperty(); typeSchemaProperty.PropertyName = property.Name; typeSchemaProperty.InspectedProperty = property; Encoder.TryGetEncoder(property.PropertyType, out typeSchemaProperty.EncoderInfo); properties.Add(typeSchemaProperty); } this.typeSchemaProperties = properties.ToArray(); this.writeObject = TypeSchema.CompileWriteObjectDelegate(this.typeSchemaProperties); this.serializedSchema = new Lazy <byte[]>(this.GetSerializedSchema); }
/// <summary> /// Initializes a new instance of the <see cref="TypeSchema"/> class. /// </summary> /// <param name="typeSchemaProperties"> /// The type schema properties. /// </param> internal TypeSchema(TypeSchemaProperty[] typeSchemaProperties) { this.typeSchemaProperties = typeSchemaProperties; this.serializedSchema = new Lazy<byte[]>(() => this.GetSerializedSchema()); }