public void Set(object value) { if (this.Frozen) { throw new FrozenObjectReadonlyException(); } ICursor source = null; if (value != null) { source = value as ICursor; if (source == null) { source = new EditablePrimitive(factory, value); } else { var sourceVariable = source as IEditableVariable; if (sourceVariable != null) { if (!sourceVariable.DataCursor.IsNull) { this.DataCursor = sourceVariable.DataCursor; return; } if (!sourceVariable.IsNull) { source = source.Get() as ICursor; } else { source = null; } } else if (source.Schema.Id == (int)BuiltInSchema.Variable) { if (source.IsNull) { this.Set(null); } else { var schema = this.SchemaProvider.GetSchemaById(source.GoTo((int)VariableLayout.DataSchemaId).Get <int>()); this.DataCursor = new Cursor(this.SchemaProvider, schema, new ArraySegment <byte>(source.GoTo((int)VariableLayout.Data, false).Get <byte[]>())); } return; } } } if (source == null) { if (!nullable) { throw new InvalidOperationException("Tried to set null on a variable field that is not nullable."); } data = null; dataCursor = default(Cursor); return; } if (data == null || dataSchema != source.Schema) { data = factory.Create(source.Schema, nullable); dataSchema = source.Schema; } dataCursor = default(Cursor); data.Set(source); }
public Cursor(ISchemaProvider schemaProvider, Schema schema, byte[] buffer) : this(schemaProvider, schema, buffer, 0, buffer.Length) { }
public Cursor(ISchemaProvider schemaProvider, Schema schema, ArraySegment <byte> segment) : this(schemaProvider, schema, segment.Array, segment.Offset, segment.Count) { }
public Cursor(ISchemaProvider schemaProvider, Schema schema) : this(schemaProvider, schema, null, 0, 0) { }
public MissingTypeMappingException(Schema schema) : base(string.Format("Deserialization failed: No type mapping is registered for schema '{0}'.", schema.Name)) { }
public static void MapBidirectional(this ISchemaTypeMap typeMap, Schema schema, Type type) { typeMap.MapSchema(schema, type); typeMap.MapType(type, schema); }