示例#1
0
        public virtual DbItem GetOrCreateItem(int? fromId, string identifier)
        {
            var relation = GetRelation(fromId, identifier);
            if (relation != null && relation.ToId == null)
            {
                Delete(relation);
                relation = null;
            }

            if (relation == null)
            {
                var item = new DbItem();

                Insert(item);

                Insert(new DbRelation
                                  {
                                      FromId = fromId,
                                      Identifier = identifier,
                                      ToId = item.Id
                                  });

                return item;
            }

            return GetItem(relation.ToId.Value);
        }
示例#2
0
 public abstract void Update(DbItem item);
示例#3
0
 public abstract void Insert(DbItem item);
示例#4
0
 public abstract void Delete(DbItem item);
示例#5
0
 public abstract void Delete(DbItem item);
示例#6
0
 public abstract void Update(DbItem item);
示例#7
0
 public abstract void Insert(DbItem item);