/// <summary>
 /// 注册需要返回的成员。
 /// </summary>
 /// <param name="member">指定提交成员。</param>
 /// <returns>返回传入成员。</returns>
 protected CommitMember ReisterReturnMember(CommitMember member)
 {
     if (Operate.HasResult)
     {
         _ReturnMembers.Add(member);
     }
     return(member);
 }
示例#2
0
 /// <inheritdoc/>
 public override void Add(CommitMember member)
 {
     if (member.Metadata.IsKey)
     {
         _Keys.Add(member);
     }
     else
     {
         base.Add(member);
     }
 }
示例#3
0
        private void GenerateForInsertMembers(InsertValueFragment insert, CommitMember member)
        {
            switch (member.ValueType)
            {
            case ECommitValueType.Constant:
                insert.SetValue(member.Metadata);
                break;

            case ECommitValueType.Expression:
                var exp = (CommitExpressionMember)member;
                insert.SetValue(member.Metadata, insert.CreateExpression(exp.Expression));
                break;
            }
        }
示例#4
0
        private CommitUnitBase CreateMainUnit(TableMetadata metadata, DbExpression content)
        {
            var identity = metadata.Keys.FirstOrDefault(a
                                                        => a.GeneratedForInsert != null && a.GeneratedForInsert.GeneratedOption == EGeneratedOption.Identity);

            if (identity != null)
            {
                var identityMember = new CommitMember(identity, identity.GeneratedForInsert, ECommitValueType.Database);
                var commitUnit     = new CommitIdentityUnit(metadata, identityMember);
                ReisterReturnMember(identityMember);
                CreateCommitUnit(commitUnit, metadata.Members.Where(a => a != identity), content);
                HasExpressionKey = commitUnit.Members.Any(a => a.Metadata.IsKey && a.ValueType == ECommitValueType.Expression);
                return(commitUnit);
            }
            else
            {
                var commitUnit = new CommitKeyUnit(metadata);
                CreateCommitUnit(commitUnit, metadata.Members, content);
                HasExpressionKey = commitUnit.Keys.Any(a => a.ValueType == ECommitValueType.Expression);
                return(commitUnit);
            }
        }
示例#5
0
 /// <summary>
 /// 添加成员对象。
 /// </summary>
 /// <param name="member">要添加的成员。</param>
 public virtual void Add(CommitMember member)
 {
     _Members.Add(member);
 }
示例#6
0
 /// <summary>
 /// 创建提交单元。
 /// </summary>
 /// <param name="table">表元数据。</param>
 /// <param name="identity">标识列。</param>
 public CommitIdentityUnit(TableMetadata table, CommitMember identity)
     : base(table)
 {
     Identity = identity;
 }