Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="record"></param>
        public void SaveChanges(IFluentRecord record)
        {
            var mutations = record.MutationTracker.GetMutations();
            var op        = new BatchMutate(mutations);

            ExecuteOperation(op);
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="record"></param>
        public void Attach(IFluentRecord record)
        {
            var tracker = record.MutationTracker;

            if (_trackers.Contains(tracker))
            {
                return;
            }

            _trackers.Add(tracker);
        }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="record"></param>
        /// <param name="atomic">in the database sense that if any part of the batch succeeds, all of it will. No other guarantees are implied; in particular, there is no isolation; other clients will be able to read the first updated rows from the batch, while others are in progress</param>
        /// <seealso href="http://www.datastax.com/dev/blog/atomic-batches-in-cassandra-1-2"/>
        public void SaveChanges(IFluentRecord record, bool atomic = true)
        {
            var tracker   = record.MutationTracker;
            var mutations = tracker.GetMutations();

            var op = new BatchMutate(mutations, atomic);

            ExecuteOperation(op);

            tracker.Clear();
        }
Exemplo n.º 4
0
        protected void OnColumnMutated(MutationType type, IFluentBaseColumn column)
        {
            if (SupressChangeNotification)
            {
                return;
            }

            IFluentRecord record = Parent.SuperColumn == null ? (IFluentRecord)Parent.ColumnFamily : (IFluentRecord)Parent.SuperColumn;

            record.MutationTracker.ColumnMutated(type, column);

            if (CollectionChanged != null)
            {
                var action = type == MutationType.Added ? NotifyCollectionChangedAction.Add : (type == MutationType.Removed ? NotifyCollectionChangedAction.Remove : NotifyCollectionChangedAction.Replace);
                CollectionChanged(this, new NotifyCollectionChangedEventArgs(action, column));
            }
        }
		protected internal FluentMutationTracker(IFluentRecord parentRecord)
		{
			ParentRecord = parentRecord;
			_mutation = new List<FluentMutation>();
		}
Exemplo n.º 6
0
 public static dynamic AsDynamic(this IFluentRecord record)
 {
     return(record);
 }
 protected internal FluentMutationTracker(IFluentRecord parentRecord)
 {
     ParentRecord = parentRecord;
     _mutation    = new List <FluentMutation>();
 }