Example #1
0
        private static void ReadRootObjectBasicMember(Type memberType, BoisBasicTypeInfo basicInfo, PropertyInfo prop, FieldInfo field, Type containerType, ILGenerator il, SharedVariables variableCache)
        {
            switch (basicInfo.KnownType)
            {
            case EnBasicKnownType.String:
                EmitGenerator.ReadString(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.Bool:
                EmitGenerator.ReadBool(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.Int16:
                EmitGenerator.ReadInt16(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.Int32:
                EmitGenerator.ReadInt32(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.Int64:
                EmitGenerator.ReadInt64(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.UInt16:
                EmitGenerator.ReadUInt16(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.UInt32:
                EmitGenerator.ReadUInt32(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.UInt64:
                EmitGenerator.ReadUInt64(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.Double:
                EmitGenerator.ReadDouble(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.Decimal:
                EmitGenerator.ReadDecimal(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.Single:
                EmitGenerator.ReadFloat(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.Byte:
                EmitGenerator.ReadByte(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.SByte:
                EmitGenerator.ReadSByte(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.DateTime:
                EmitGenerator.ReadDateTime(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.DateTimeOffset:
                EmitGenerator.ReadDateTimeOffset(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.KnownTypeArray:
                EmitGenerator.ReadUnknownArray(prop, field, null, containerType, il, basicInfo.IsNullable, variableCache);
                break;

            case EnBasicKnownType.ByteArray:
                EmitGenerator.ReadByteArray(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.Enum:
                EmitGenerator.ReadEnum(prop, field, null, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.TimeSpan:
                EmitGenerator.ReadTimeSpan(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.Char:
                EmitGenerator.ReadChar(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.Guid:
                EmitGenerator.ReadGuid(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.Color:
                EmitGenerator.ReadColor(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.DbNull:
                EmitGenerator.ReadDbNull(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.Uri:
                EmitGenerator.ReadUri(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.Version:
                EmitGenerator.ReadVersion(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.DataTable:
                EmitGenerator.ReadDataTable(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            case EnBasicKnownType.DataSet:
                EmitGenerator.ReadDataSet(prop, field, null, containerType, il, basicInfo.IsNullable);
                break;

            default:
            case EnBasicKnownType.Unknown:
                return;
            }
        }
Example #2
0
        internal static void ReadBasicTypeDirectly(ILGenerator il, Type containerType, BoisBasicTypeInfo keyTypeBasicInfo, Action valueSetter)
        {
            switch (keyTypeBasicInfo.KnownType)
            {
            case EnBasicKnownType.String:
                EmitGenerator.ReadString(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.Bool:
                EmitGenerator.ReadBool(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.Int16:
                EmitGenerator.ReadInt16(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.Int32:
                EmitGenerator.ReadInt32(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.Int64:
                EmitGenerator.ReadInt64(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.UInt16:
                EmitGenerator.ReadUInt16(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.UInt32:
                EmitGenerator.ReadUInt32(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.UInt64:
                EmitGenerator.ReadUInt64(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.Double:
                EmitGenerator.ReadDouble(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.Decimal:
                EmitGenerator.ReadDecimal(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.Single:
                EmitGenerator.ReadFloat(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.Byte:
                EmitGenerator.ReadByte(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.SByte:
                EmitGenerator.ReadSByte(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.DateTime:
                EmitGenerator.ReadDateTime(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.DateTimeOffset:
                EmitGenerator.ReadDateTimeOffset(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.KnownTypeArray:
                //EmitGenerator.ReadKnownTypeArray(null, null, valueSetter, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.ByteArray:
                EmitGenerator.ReadByteArray(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.Enum:
                EmitGenerator.ReadEnum(null, null, valueSetter, containerType, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.TimeSpan:
                EmitGenerator.ReadTimeSpan(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.Char:
                EmitGenerator.ReadChar(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.Guid:
                EmitGenerator.ReadGuid(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.Color:
                EmitGenerator.ReadColor(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.DbNull:
                EmitGenerator.ReadDbNull(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.Uri:
                EmitGenerator.ReadUri(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.Version:
                EmitGenerator.ReadVersion(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.DataTable:
                EmitGenerator.ReadDataTable(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.DataSet:
                EmitGenerator.ReadDataSet(null, null, valueSetter, containerType, il, keyTypeBasicInfo.IsNullable);
                break;

            case EnBasicKnownType.Unknown:
            default:
                throw new ArgumentOutOfRangeException("keyTypeBasicInfo.KnownType");
            }
        }