protected void AddKeyValue(KeyValueCollection values, DbObjectSmartUpdate o, string key, int n, object v) { // if ((o.m_UpdateColumns == null) || o.m_UpdateColumns.ContainsKey(key)) // { // values.Add(this.NewKeyValue(n, v)); // } }
public override void InitLoadedColumns(DbObjectSmartUpdate model) { _LoadedColumns = new Dictionary<string, object>(); foreach (var m in model.Context.Info.Members) { if (m.Is.AutoSavedValue || m.Is.Key) { continue; } if (m.Is.SimpleField) { _LoadedColumns.Add (m.Name, m.GetValue (model)); } else if (m.Is.LazyLoad) { var ll = (ILazyLoading)m.GetValue (model); if (ll.IsLoaded) { _LoadedColumns.Add (m.Name, ll.Read ()); } } else if (m.Is.BelongsTo) { var bt = (IBelongsTo)m.GetValue (model); _LoadedColumns.Add (m.Name, bt.ForeignKey); } } }
public bool FindUpdateColumns(DbObjectSmartUpdate model, UpdateStatementBuilder builder) { var autoList = new List<KeyOpValue> (); foreach (var m in model.Context.Info.Members) { if (m.Is.DbGenerate || m.Is.HasOne || m.Is.HasMany || m.Is.HasAndBelongsToMany || m.Is.CreatedOn || m.Is.Key) { continue; } if (m.Is.Count) { autoList.Add (new KeyOpValue(m.Name, 1, KvOpertation.Add)); continue; } if (m.Is.UpdatedOn || m.Is.SavedOn) { autoList.Add (new KeyOpValue(m.Name, null, KvOpertation.Now)); continue; } if (m.Is.SimpleField) { object n = m.GetValue(model); ProcessSimpleMember(builder, m, n); } else if (m.Is.LazyLoad) { var ll = (ILazyLoading)m.GetValue (model); if (ll.IsLoaded) { var value = ll.Read (); var type = m.MemberType.GetGenericArguments () [0]; ProcessLazyLoad(builder, m, value, type); } } else if (m.Is.BelongsTo) { var bt = (IBelongsTo)m.GetValue(model); var fk = bt.ForeignKey; ProcessBelongsTo(builder, m, fk); } } if (builder.Values.Count > 0) { builder.Values.AddRange (autoList); return true; } return false; }
protected LazyLoadListBase(DbObjectSmartUpdate owner, string foreignKeyName) { this.Owner = owner; this.ForeignKeyName = foreignKeyName; }
public HasOne(DbObjectSmartUpdate owner, string orderByString, string relationName) : base(owner, relationName) { this._order = OrderBy.Parse(orderByString); }
public virtual void CtorInit(DbObjectSmartUpdate o) {}
public LazyLoad(DbObjectSmartUpdate owner, string relationName) : base(owner, relationName) { }
public HasAndBelongsToMany(DbObjectSmartUpdate owner, string orderByString, string foreignKeyName) : base(owner, foreignKeyName) { _order = OrderBy.Parse(orderByString); }
public HasMany(DbObjectSmartUpdate owner, string orderByString, string foreignKeyName) : base(owner, foreignKeyName) { this._order = OrderBy.Parse(orderByString); }
public BelongsTo(DbObjectSmartUpdate owner, string relationName) : base(owner, relationName) { }
public virtual void InitLoadedColumns(DbObjectSmartUpdate model) { }