internal EditableVariable(IEditableFactory factory, bool nullable, Cursor dataCursor) { this.nullable = nullable; this.factory = factory; this.dataSchema = dataCursor.Schema ?? BuiltInSchemas.Boolean; this.dataCursor = dataCursor; }
public IEditable ToEditable(IEditableFactory factory) { var choice = factory.Create(schema, nullable); choice.Set(this.Value); return(choice); }
public IEditableList ToEditable(IEditableFactory factory) { var list = (IEditableList)factory.Create(schema); foreach (var x in this) { list.Add().Set(x); } return(list); }
public static IEditable CreateFromMemory(this IEditableFactory factory, MemoryStream mem, Schema schema) { ArraySegment <byte> buffer; if (!mem.TryGetBuffer(out buffer)) { throw new Exception("Buffer of MemoryStream object is not accessible"); } return(factory.CreateFromMemory(buffer, schema)); }
public IEditable ToEditable(IEditableFactory factory) { var option = (IEditableObject)factory.Create(BuiltInSchema.ChoiceOption); option.GetField("Value").Set(this.Value); option.GetField("Order").Set(this.Order); option.GetField("Hidden").Set(this.Hidden); option.GetField("Name").Set(this.Name); option.GetField("Caption").Set(this.Caption); option.GetField("Description").Set(this.Description); return(option); }
public IEditableObject ToEditable(IEditableFactory factory) { var editableField = (IEditableObject)factory.Create(BuiltInSchema.Field, false); editableField.GetField("SchemaId").Set(this.Schema.Id); editableField.GetField("Nullable").Set(this.Nullable); editableField.GetField("Name").Set(this.Name); editableField.GetField("Caption").Set(this.Caption); editableField.GetField("Description").Set(this.Description); editableField.GetField("MaxLength").Set(this.MaxLength); return(editableField); }
public EditableObject(IEditableFactory factory, Schema schema, bool nullable) { if (factory == null) { throw new ArgumentNullException("factory"); } if (schema == null) { throw new ArgumentNullException("schema"); } this.factory = factory; this.schema = schema; this.nullable = nullable; if (!this.nullable) { CreateFields(); } }
public EditablePrimitive(IEditableFactory factory, Schema schema, bool nullable) { if (schema == null) { throw new ArgumentNullException("schema"); } if (!IsSupportedType(schema.DataType)) { throw new ArgumentException("Invalid schema for value class specified", "schema"); } this.factory = factory; this.schema = schema; this.nullable = nullable; if (!nullable) { data = this.TypeHelper.DefaultValue; } }
public IEditableObject ToEditable(IEditableFactory factory) { var editableSchema = (IEditableObject)factory.Create(BuiltInSchema.Schema, false); editableSchema.GetField("Id").Set(this.Id); editableSchema.GetField("DataType").Set((int)this.DataType); editableSchema.GetField("Name").Set(this.Name); editableSchema.GetField("Description").Set(this.Description); editableSchema.GetField("DeclarationItem").Set(this.declarationItem); if (this.fields != null) { var fieldList = (IEditableList)editableSchema.GetField("Fields"); foreach (var f in fields) { fieldList.Add().Set(f.ToEditable(factory)); } } return(editableSchema); }
public IEditableObject ToEditable(IEditableFactory factory) { var choiceSet = factory.CreateItem(Schema.BuiltIn[BuiltInSchema.ChoiceSet]); choiceSet.GetField((int)ItemLayout.Id).Set(this.Id); choiceSet.GetField((int)ItemLayout.Name).Set(this.Name); choiceSet.GetField((int)ItemLayout.Revision).Set(this.Revision); IEditableObject dataField = choiceSet.GetField((int)ItemLayout.Data).Get <IEditableObject>(); dataField.GetField("Description").Set(this.Description); dataField.GetField("Caption").Set(this.Caption); var defaultsList = (IEditableList)dataField.GetField("Defaults"); this.Defaults.ForEach(x => defaultsList.Add().Set(x)); var optionList = (IEditableList)dataField.GetField("Options"); this.Options.ForEach(x => optionList.Add().Set(x.ToEditable(factory))); return(choiceSet); }
public EditableList(IEditableFactory factory, Schema schema, bool nullable) { if (factory == null) { throw new ArgumentNullException("factory"); } if (schema == null) { throw new ArgumentNullException("schema"); } this.factory = factory; this.schema = schema; if (schema.DataType == DataType.MultiChoice) { this.itemSchema = Schema.BuiltIn[BuiltInSchema.Int32]; this.itemNullable = false; } else { if (schema.DataType != DataType.List && schema.DataType != DataType.MultiChoice || schema.FieldCount != 1) { throw new ArgumentException("Invalid schema specified for item list", "schema"); } this.itemSchema = schema[0].Schema; this.itemNullable = schema[0].Nullable; } this.nullable = nullable; if (!this.nullable) { this.Clear(); } }
public RecordSerializer(ISchemaProvider schemaProvider, ISchemaTypeMap schemaTypeMap, IEditableFactory editableFactory) { this.schemaProvider = schemaProvider; this.schemaTypeMap = schemaTypeMap; this.editableFactory = editableFactory; }
public static IEditable CreateFromJson(this IEditableFactory factory, string json, Schema schema) { return(factory.CreateFromJson(new JsonTextReader(new StringReader(json)), schema)); }
public ReflectionSchemaBuilder(ISchemaProvider schemaProvider, IEditableFactory editableFactory, ISchemaTypeMap schemaTypeMap) { this.schemaProvider = schemaProvider; this.editableFactory = editableFactory; this.typeMap = schemaTypeMap; }
public static IEditable CreateFromJson(this IEditableFactory factory, string json, BuiltInSchema schema) { return(factory.CreateFromJson(json, Schema.BuiltIn[schema])); }
public EditableVariable(IEditableFactory factory, bool nullable) : this(factory, nullable, default(Cursor)) { }
public static IEditable CreateFromJson(this IEditableFactory factory, JsonReader reader, BuiltInSchema schema) { return(factory.CreateFromJson(reader, Schema.BuiltIn[schema])); }
public static IEditable CreateFromMemory(this IEditableFactory factory, byte[] mem, Schema schema) { return(factory.CreateFromMemory(new ArraySegment <byte>(mem), schema)); }
public static IEditableObject CreateItem(this IEditableFactory factory, BuiltInSchema dataSchema, bool nullable = false) { return(factory.CreateItem(Schema.BuiltIn[dataSchema], nullable)); }
public EditablePrimitive(IEditableFactory factory, Schema schema, bool nullable, object value) : this(factory, schema, nullable) { this.Set(value); }
public static IEditableObject CreateItem(this IEditableFactory factory, string dataSchemaName, bool nullable = false) { return(factory.CreateItem(factory.SchemaProvider.GetSchemaByName(dataSchemaName), nullable)); }
public static IEditableObject CreateItemFromJson(this IEditableFactory factory, JsonReader reader) { return((IEditableObject)factory.CreateFromJson(reader, BuiltInSchema.Item)); }
public IEditable ToEditable(IEditableFactory factory) { return(factory.Create(this)); }
public static IEditableObject CreateItemFromJson(this IEditableFactory factory, string json) { return((IEditableObject)factory.CreateFromJson(json, BuiltInSchema.Item)); }
public EditablePrimitive(IEditableFactory factory, object value) : this(factory, FindSchemaFor(value), value == null || !value.GetType().GetTypeInfo().IsValueType, value) { }
IEditable IEditableConvertible.ToEditable(IEditableFactory factory) { return(ToEditable(factory)); }