コード例 #1
0
 protected virtual void FillUpdateParams(CustomSqlCommand in_sp)
 {
     if (!NoUseOfName)
     {
         in_sp.AddParameter("@in_name", Name);
     }
 }
コード例 #2
0
        public virtual void Flush()
        {
            Debug.Assert(Validate() == null, "Debug.Assert(Validate() == null)");

            _isNew = Id == 0;

            CustomSqlCommand sp = _isNew ?
                                  (CustomSqlCommand) new AddObjectSql() :
                                  (CustomSqlCommand) new UpdateObjectSql((T)this);

            FillUpdateParams(sp);

            sp.Execute();

            if (_isNew)
            {
                ((T)this).Id = ((AddObjectSql)sp).NewId;
            }

            SetStorageConsistency();

            if (_isNew)
            {
                _cache.Add((T)this);
            }
            _isNew = false;
        }