15 public string Name {
get; }
34 var nullCtx =
new NullabilityInfoContext();
35 var nullInfo = nullCtx.Create(prop);
37 Name = attr.Name ?? FieldName.Canonical(prop.Name);
39 Type = prop.PropertyType;
40 IsNullable = nullInfo.WriteState is NullabilityState.Nullable;
50 if (_serializer is
null)
52 _serializer = Serialization.Serializer.Generate(_ctx,
Type);
53 if (
IsNullable && (!_serializer.GetType().IsGenericType ||
54 (_serializer.GetType().IsGenericType &&
55 _serializer.GetType().GetGenericTypeDefinition() !=
56 typeof(NullableStructSerializer<>))))
58 var serType = typeof(NullableSerializer<>).MakeGenericType(
new[] {
Type });
59 var ser = Activator.CreateInstance(serType,
new[] { _serializer });
A class representing the mapping context to be used during serialization and deserialization.