Example #1
0
        /// <summary>Adds the specified t aggregate roots.</summary>
        /// <typeparam name="TAggregateRoot">The type of the t aggregate root.</typeparam>
        /// <param name="tAggregateRoots">The t aggregate roots.</param>
        /// <returns>IEnumerable&lt;System.Int64&gt;.</returns>
        public IEnumerable <long> Add <TAggregateRoot>(IEnumerable <TAggregateRoot> tAggregateRoots) where TAggregateRoot : EntityBase
        {
            List <long> ids = new List <long>();

            if (tAggregateRoots.Any <TAggregateRoot>())
            {
                LinqExtension.Each <TAggregateRoot>(tAggregateRoots, (Action <TAggregateRoot>)(x => ids.Add(this.Add <TAggregateRoot>(x))));
            }
            return((IEnumerable <long>)ids);
        }
Example #2
0
 /// <summary>修改集合</summary>
 /// <typeparam name="TAggregateRoot">The type of the t aggregate root.</typeparam>
 /// <param name="tAggregateRoots">The t aggregate roots.</param>
 public void Update <TAggregateRoot>(IQueryable <TAggregateRoot> tAggregateRoots) where TAggregateRoot : EntityBase, new()
 {
     LinqExtension.Each <TAggregateRoot>(tAggregateRoots, (Action <TAggregateRoot>)(x => this.Update <TAggregateRoot>(x, new Expression <Func <TAggregateRoot, object> > [0])));
 }
Example #3
0
 /// <summary>根据条件删除</summary>
 /// <typeparam name="TAggregateRoot">The type of the t aggregate root.</typeparam>
 /// <param name="tAggregateRoots">The t aggregate roots.</param>
 public void Remove <TAggregateRoot>(IQueryable <TAggregateRoot> tAggregateRoots) where TAggregateRoot : EntityBase
 {
     LinqExtension.Each <TAggregateRoot>(tAggregateRoots, new Action <TAggregateRoot>(this.Remove <TAggregateRoot>));
 }
Example #4
0
 /// <summary>根据条件逻辑删除</summary>
 /// <typeparam name="TAggregateRoot">The type of the t aggregate root.</typeparam>
 /// <param name="tAggregateRoots">The t aggregate roots.</param>
 public void Delete <TAggregateRoot>(IQueryable <TAggregateRoot> tAggregateRoots) where TAggregateRoot : EntityBase, new()
 {
     LinqExtension.Each <TAggregateRoot>(tAggregateRoots, new Action <TAggregateRoot>(this.Delete <TAggregateRoot>));
 }
Example #5
0
 /// <summary>根据条件删除</summary>
 /// <typeparam name="TAggregateRoot">The type of the t aggregate root.</typeparam>
 /// <param name="filter">The filter.</param>
 public void Remove <TAggregateRoot>(ISpecification <TAggregateRoot> filter) where TAggregateRoot : EntityBase
 {
     LinqExtension.Each <TAggregateRoot>(this.CreateSet <TAggregateRoot>().Where <TAggregateRoot>(filter.SatisfiedBy()), new Action <TAggregateRoot>(this.Remove <TAggregateRoot>));
 }