/// <summary> /// Generates the record type schema. /// </summary> /// <param name="type">The type.</param> /// <param name="schemas">The schemas.</param> /// <param name="currentDepth">The current depth.</param> /// <returns> /// Instance of schema. /// </returns> private TypeSchema BuildRecordTypeSchema(Type type, Dictionary <string, NamedSchema> schemas, uint currentDepth) { if (type == typeof(DateTimeOffset)) { return(this.settings.UsePosixTime ? (TypeSchema) new LongSchema(type) : new StringSchema(type)); } NamedSchema schema; if (schemas.TryGetValue(type.ToString(), out schema)) { return(schema); } if (type == typeof(Guid)) { var recordName = new SchemaName(type.GetStrippedFullName()); var attributes = new NamedEntityAttributes(recordName, new List <string>(), string.Empty); var result = new FixedSchema(attributes, 16, type); schemas.Add(type.ToString(), result); return(result); } var attr = this.GetNamedEntityAttributesFrom(type); AvroContractResolver resolver = this.settings.Resolver; var record = new RecordSchema( attr, type); schemas.Add(type.ToString(), record); var members = resolver.ResolveMembers(type); this.AddRecordFields(members, schemas, currentDepth, record); return(record); }