Example #1
0
		private static int GetDefaultType(Type fieldType, TypeRegistry typeRegistry = null)
		{
			if (typeRegistry != null)
			{
				int res;
				if (typeRegistry.TryResolvePropertyType(fieldType, out res))
				{
					return res;
				}
			}
			if (fieldType == typeof(int))
			{
				return PropertyTypes.Int32;
			}
			if (fieldType == typeof(uint))
			{
				return PropertyTypes.Int32;
			}

			if (fieldType == typeof(byte))
			{
				return PropertyTypes.Int32;
			}
			if (fieldType == typeof(sbyte))
			{
				return PropertyTypes.Int32;
			}

			if (fieldType == typeof(ushort))
			{
				return PropertyTypes.Int32;
			}
			if (fieldType == typeof(short))
			{
				return PropertyTypes.Int32;
			}

			if (fieldType == typeof(float))
			{
				return PropertyTypes.Single;
			}
			if (fieldType == typeof(string))
			{
				return PropertyTypes.String;
			}
			return 0;
		}