/// <summary>Constructor.</summary>
        /// <param name="action">The action.</param>
        /// <param name="key">The key.</param>
        /// <param name="kind">The kind.</param>
        /// <param name="dataSource">The data source.</param>
        public DapperPlusAction(BaseDapperPlusActionSet action, string key, DapperPlusActionKind kind, object dataSource)
        {
            Key        = key;
            Connection = action.Connection;
            DataSource = dataSource;
            Kind       = kind;

            Execute();
        }
        /// <summary>Constructor.</summary>
        /// <param name="action">The action.</param>
        /// <param name="key">The key.</param>
        /// <param name="kind">The kind.</param>
        /// <param name="dataSource">The data source.</param>
        public DapperPlusAction(BaseDapperPlusActionSet action, string key, DapperPlusActionKind kind, object dataSource)
        {
            Key = key;
            Connection = action.Connection;
            DataSource = dataSource;
            Kind = kind;

            Execute();
        }
Beispiel #3
0
        /// <summary>Constructor.</summary>
        /// <param name="oldActionSet">Set the old action belongs to.</param>
        /// <param name="mapperKey">The mapper key.</param>
        /// <param name="actionKind">The action kind.</param>
        /// <param name="items">The items.</param>
        public DapperPlusActionSet(BaseDapperPlusActionSet oldActionSet, string mapperKey, DapperPlusActionKind actionKind, IEnumerable <TEntity> items)
        {
            // FROM: action.BulkAction<T>(params T[] items)

            ImportConfiguration(oldActionSet);

            if (items == null)
            {
                return;
            }

            Current = items.ToList();
            AddAction(mapperKey, actionKind, Current);
        }
Beispiel #4
0
        /// <summary>Constructor.</summary>
        /// <param name="oldActionSet">Set the old action belongs to.</param>
        /// <param name="mapperKey">The mapper key.</param>
        /// <param name="actionKind">The action kind.</param>
        /// <param name="items">The items.</param>
        /// <param name="selectors">A variable-length parameters list containing selectors.</param>
        public DapperPlusActionSet(BaseDapperPlusActionSet oldActionSet, string mapperKey, DapperPlusActionKind actionKind, IEnumerable <TEntity> items, params Func <TEntity, object>[] selectors)
        {
            // FROM: action.BulkAction<T>(IEnumerable<T> items, selectors)

            ImportConfiguration(oldActionSet);

            if (items == null)
            {
                return;
            }

            Current = items.ToList();
            AddAction(mapperKey, actionKind, Current);

            if (selectors == null)
            {
                return;
            }

            var childs = selectors.Select(x => Current.Select(x).ToList()).ToList();

            AddAction(mapperKey, actionKind, childs);
        }
Beispiel #5
0
        /// <summary>Constructor.</summary>
        /// <param name="oldActionSet">Set the old action belongs to.</param>
        /// <param name="mapperKey">The mapper key.</param>
        /// <param name="actionKind">The action kind.</param>
        /// <param name="item">The item.</param>
        /// <param name="selectors">A variable-length parameters list containing selectors.</param>
        public DapperPlusActionSet(BaseDapperPlusActionSet oldActionSet, string mapperKey, DapperPlusActionKind actionKind, TEntity item, params Func <TEntity, object>[] selectors)
        {
            // FROM: action.BulkAction<T>(T item, selectors)

            ImportConfiguration(oldActionSet);

            if (item == null)
            {
                return;
            }

            CurrentItem = item;
            AddAction(mapperKey, actionKind, CurrentItem);

            if (selectors == null)
            {
                return;
            }

            var childs = selectors.Select(x => x(CurrentItem)).ToList();

            AddAction(mapperKey, actionKind, childs);
        }
Beispiel #6
0
 /// <summary>Import configuration.</summary>
 /// <param name="oldActionSet">The action set to import configuration from.</param>
 public void ImportConfiguration(BaseDapperPlusActionSet oldActionSet)
 {
     Actions    = oldActionSet.Actions;
     Connection = oldActionSet.Connection;
 }
Beispiel #7
0
        /// <summary>Constructor.</summary>
        /// <param name="oldActionSet">Set the old action belongs to.</param>
        public DapperPlusActionSet(BaseDapperPlusActionSet oldActionSet)
        {
            // FROM: action.ThenBulkAction

            Connection = oldActionSet.Connection;
        }