Exemple #1
0
        public IMapRule <TRootEntity, TEntity> OptimisticLock(Action <IOptimisticLock <TEntity> > setOptimisticLock)
        {
            if (setOptimisticLock == null)
            {
                throw new ArgumentException($"[IMapRule<{typeof(TRootEntity).Name}, {typeof(TEntity).Name}>] {nameof(setOptimisticLock)} is null.");
            }

            OptimisticLock <TEntity> optimisticLock = new OptimisticLock <TEntity>();

            setOptimisticLock(optimisticLock);

            _mapRuleBasic.OptimisticLock = optimisticLock;

            return(this);
        }
Exemple #2
0
        public bool IsConcurrencyColumn(string column, out int index)
        {
            index = -1;

            string[] columns = OptimisticLock.GetColumns();

            if (columns.Length == 0)
            {
                return(false);
            }

            for (int i = 0; i < columns.Length; i++)
            {
                string name = columns[i];

                if (name == column)
                {
                    index = i;
                    return(true);
                }
            }

            return(false);
        }