fix: Fixes codegen migrations nullable valuetypes (#774)

This commit is contained in:
Kamron Batman 2021-09-07 20:22:11 -07:00 committed by GitHub
parent bfb716f24f
commit 75fd8137b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -40,7 +40,7 @@ namespace SerializationGenerator
var propertyType = serializableProperty.Type;
var type = compilation.GetTypeByMetadataName(propertyType)?.IsValueType == true
|| SymbolMetadata.IsPrimitiveFromTypeDisplayString(propertyType) && propertyType != "bool"
? $"{propertyType}?" : propertyType;
? $"{propertyType}{(serializableProperty.UsesSaveFlag == true ? "?" : "")}" : propertyType;
source.AppendLine($"{indent} internal readonly {type} {serializableProperty.Name};");
}