private bool findNullableType(UnionSchema schema, out CodeTypeReference type)
{
const string PREFIX = "findNullableType(UnionSchema, out Type) - ";
if(schema.schemas.Count!=2)
{
type=null;
return false;
}
bool isnullable = false;
CodeTypeReference otherType = null;
foreach (Schema childSchema in schema.schemas)
{
if (log.IsDebugEnabled) log.DebugFormat(PREFIX + "childSchema.Type = \"{0}\"", childSchema.type);
if (PrimitiveSchema.NULL.Equals(childSchema))
{
isnullable = true;
}
else
{
otherType = getCodeTypeReference(childSchema);
}
}
//TODO: Check if the type is an int, long, decimal, single
type = otherType;
return isnullable;
}