public override void AddDynamicGetKeyFromReaderCode(ILGenerator dynamicMethod, int index, LocalBuilder array)
        {
            if (!IsPrimaryKey)
            {
                return;
            }

            MethodInfo getValueMethod = typeof(IValueSource).GetMethod(nameof(IValueSource.GetValue), new Type[] { typeof(string) }).MakeGenericMethod(DataBaseValueType);

            // Load array onto the evaluation stack
            dynamicMethod.Emit(OpCodes.Ldloc, array);
            dynamicMethod.Emit(OpCodes.Ldc_I4, index);
            // Load object in Stack and cast/box it accordingly
            dynamicMethod.Emit(OpCodes.Ldarg_0);
            dynamicMethod.Emit(OpCodes.Ldstr, RemoveBrackets(FieldName));
            dynamicMethod.Emit(OpCodes.Callvirt, getValueMethod);

#if NETCOREAPP1_0
            if (DataBaseValueType.GetTypeInfo().IsValueType)
#else
            if (DataBaseValueType.IsValueType)
#endif
            { dynamicMethod.Emit(OpCodes.Box, DataBaseValueType); }

            dynamicMethod.Emit(OpCodes.Stelem_Ref);
        }
        public override void AddFillCommandBuilderCode(ILGenerator generator)
        {
            generator.Emit(OpCodes.Ldarg_1);
            generator.Emit(OpCodes.Ldstr, FieldName);
            generator.Emit(OpCodes.Ldarg_0);
            generator.Emit(OpCodes.Ldflda, _internalField);
            if (IsPrimaryKey || IsReadOnly)
            {
                generator.Emit(OpCodes.Call, _internalField.FieldType.GetMethod(nameof(BackingStore <object> .GetUncommittedValue)));
            }
            else
            {
                generator.Emit(OpCodes.Call, _internalField.FieldType.GetMethod(nameof(BackingStore <object> .GetChangedValue)));
            }

            if (DataBaseValueType.GetTypeInfo().IsValueType)
            {
                generator.Emit(OpCodes.Box, DataBaseValueType);
            }

            generator.Emit(OpCodes.Ldc_I4, (int)
                           (IsPrimaryKey ? Database.FieldType.KeyField :
                            IsInsertable && IsUpdateAble ? Database.FieldType.WriteableField :
                            IsInsertable ? Database.FieldType.InsertableField :
                            IsUpdateAble ? Database.FieldType.UpdateableField :
                            Database.FieldType.ReadOnlyField));

            if (!IsPrimaryKey || IsInsertable)
            {
                generator.Emit(OpCodes.Ldnull);
            }
            else
            {
                generator.Emit(OpCodes.Ldtoken, DataBaseValueType);
                generator.Emit(OpCodes.Call, typeof(Type).GetMethod(nameof(Type.GetTypeFromHandle), new Type[] { typeof(RuntimeTypeHandle) }));
            }

            if (IsReadOnly)
            {
                generator.Emit(OpCodes.Ldc_I4_0);
            }
            else
            {
                generator.Emit(OpCodes.Ldarg_0);
                generator.Emit(OpCodes.Ldflda, _internalField);
                generator.Emit(OpCodes.Call, _internalField.FieldType.GetProperty(nameof(BackingStore <object> .IsChanged)).GetGetMethod());
            }

            generator.Emit(OpCodes.Callvirt, typeof(ICommandBuilder).GetMethod(nameof(ICommandBuilder.AddField), new Type[] { typeof(string), typeof(object), typeof(FieldType), typeof(Type), typeof(bool) }));
        }
        public override void AddDynamicGetKeyCode(ILGenerator dynamicMethod, int index, LocalBuilder array)
        {
            if (!IsPrimaryKey)
            {
                return;
            }
            // Array in Stack Laden
            dynamicMethod.Emit(OpCodes.Ldloc, array);
            dynamicMethod.Emit(OpCodes.Ldc_I4, index);
            // Object in Stack Laden und Casten
            dynamicMethod.Emit(OpCodes.Ldarg_0);
            dynamicMethod.Emit(OpCodes.Ldflda, _internalField);
            dynamicMethod.Emit(OpCodes.Call, _internalField.FieldType.GetMethod("GetUncommittedValue"));

#if  NETCOREAPP1_0
            if (DataBaseValueType.GetTypeInfo().IsValueType)
#else
            if (DataBaseValueType.IsValueType)
#endif
            { dynamicMethod.Emit(OpCodes.Box, DataBaseValueType); }

            dynamicMethod.Emit(OpCodes.Stelem_Ref);
        }