public virtual Net.Vpc.Upa.Record ObjectToRecord(object @object, System.Collections.Generic.ISet <string> fields, bool ignoreUnspecified, bool ensureIncludeIds) { Net.Vpc.Upa.Record r = CreateRecord(); Net.Vpc.Upa.Record allFieldsRecord = ObjectToRecord(@object, ignoreUnspecified); if (fields == null || (fields.Count == 0)) { r.SetAll(r); return(r); } else { foreach (string k in fields) { r.SetObject(k, allFieldsRecord.GetObject <T>(k)); } if (ensureIncludeIds) { foreach (Net.Vpc.Upa.Field o in GetEntity().GetPrimaryFields()) { string idname = o.GetName(); if (!r.IsSet(idname)) { r.SetObject(idname, allFieldsRecord.GetObject <T>(idname)); } } } return(r); } }
public virtual Net.Vpc.Upa.Record CreateInitializedRecord() { object o = CreateObject <R>(); Net.Vpc.Upa.Record r = CreateRecord(); r.SetAll(ObjectToRecord(o, false)); foreach (Net.Vpc.Upa.Field field in entity.GetFields()) { if (field.IsId() && (field.GetModifiers().Contains(Net.Vpc.Upa.FieldModifier.PERSIST_FORMULA) || field.GetModifiers().Contains(Net.Vpc.Upa.FieldModifier.PERSIST_SEQUENCE))) { r.Remove(field.GetName()); } else { object df = field.GetDefaultValue(); if (df != null) { r.SetObject(field.GetName(), df); } } } return(r); }
public virtual Net.Vpc.Upa.Record CopyRecord(Net.Vpc.Upa.Record rec) { Net.Vpc.Upa.Record r = CreateRecord(); r.SetAll(rec); return(r); }