Exemplo n.º 1
0
        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));
//            }
        }
Exemplo n.º 2
0
 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);
         }
     }
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 protected LazyLoadListBase(DbObjectSmartUpdate owner, string foreignKeyName)
 {
     this.Owner          = owner;
     this.ForeignKeyName = foreignKeyName;
 }
Exemplo n.º 5
0
 public HasOne(DbObjectSmartUpdate owner, string orderByString, string relationName)
     : base(owner, relationName)
 {
     this._order = OrderBy.Parse(orderByString);
 }
Exemplo n.º 6
0
		public virtual void CtorInit(DbObjectSmartUpdate o) {}
Exemplo n.º 7
0
 public LazyLoad(DbObjectSmartUpdate owner, string relationName)
     : base(owner, relationName)
 {
 }
Exemplo n.º 8
0
 public HasAndBelongsToMany(DbObjectSmartUpdate owner, string orderByString, string foreignKeyName)
     : base(owner, foreignKeyName)
 {
     _order = OrderBy.Parse(orderByString);
 }
Exemplo n.º 9
0
 public HasMany(DbObjectSmartUpdate owner, string orderByString, string foreignKeyName)
     : base(owner, foreignKeyName)
 {
     this._order = OrderBy.Parse(orderByString);
 }
Exemplo n.º 10
0
 public BelongsTo(DbObjectSmartUpdate owner, string relationName)
     : base(owner, relationName)
 {
 }
Exemplo n.º 11
0
 public virtual void InitLoadedColumns(DbObjectSmartUpdate model)
 {
 }