Esempio n. 1
0
        Exception InvalidMerge(EntityOperation other)
        {
            var message = string.Format("Included '{0}' operation cannot be followed by '{1}' operation",
                GetType().Name, other.GetType().Name);

            return new InvalidOperationException(message);
        }
Esempio n. 2
0
        Exception InvalidMerge(EntityOperation other)
        {
            var message = string.Format("Included '{0}' operation cannot be followed by '{1}' operation",
                                        GetType().Name, other.GetType().Name);

            return(new InvalidOperationException(message));
        }
Esempio n. 3
0
            public override EntityOperation Merge(EntityOperation other)
            {
                if (other is Insert)
                {
                    throw InvalidMerge(other);
                }

                if (other is Replace)
                {
                    return(other);
                }

                if (other is Delete)
                {
                    return(other);
                }

                if (other is InsertOrMerge)
                {
                    throw InvalidMerge(other);
                }

                if (other is InsertOrReplace)
                {
                    throw InvalidMerge(other);
                }

                throw new InvalidOperationException("Unsupported operation type: " + other.GetType());
            }
Esempio n. 4
0
            new static Exception InvalidMerge(EntityOperation other)
            {
                var message = string.Format("Included 'Delete' operation interdifused with " +
                                            "preceding 'Insert' operation. " +
                                            "'{0}' cannot be applied to NULL",
                                            other.GetType());

                return(new InvalidOperationException(message));
            }
Esempio n. 5
0
            public override EntityOperation Merge(EntityOperation other)
            {
                if (other is Insert)
                    return new Replace(other.Entity);

                if (other is Replace)
                    throw InvalidMerge(other);

                if (other is Delete)
                    throw InvalidMerge(other);

                throw new InvalidOperationException("Unsupported operation type: " + other.GetType());
            }
            public void Merge(EntityOperation next)
            {
                if (current != EntityOperation.None &&
                    next.Entity != current.Entity)
                {
                    throw new InvalidOperationException(
                              "Mistaken identity. Different instance of entity " +
                              "has been already registered in this session under RowKey: " +
                              next.Entity.RowKey);
                }

                current = current.Merge(next);
            }
Esempio n. 7
0
        void Record(EntityOperation operation)
        {
            var entityKey = operation.Entity.RowKey;

            EntityChangeRecord record;
            if (!records.TryGetValue(entityKey, out record))
            {
                record = new EntityChangeRecord(operation);
                records.Add(entityKey, record);
                return;
            }

            record.Merge(operation);
        }
        void Record(EntityOperation operation)
        {
            var entityKey = operation.Entity.RowKey;

            EntityChangeRecord record;

            if (!records.TryGetValue(entityKey, out record))
            {
                record = new EntityChangeRecord(operation);
                records.Add(entityKey, record);
                return;
            }

            record.Merge(operation);
        }
 internal EntityChangeRecord(EntityOperation first)
 {
     current = first;
 }
Esempio n. 10
0
 public abstract EntityOperation Merge(EntityOperation other);
Esempio n. 11
0
 Include(IncludeType type, EntityOperation operation)
 {
     Type = type;
     Operation = operation;
 }
Esempio n. 12
0
 internal EntityChangeRecord(EntityOperation first)
 {
     current = first;
 }
Esempio n. 13
0
 public abstract EntityOperation Merge(EntityOperation other);
Esempio n. 14
0
            static new Exception InvalidMerge(EntityOperation other)
            {
                var message = string.Format("Included 'Delete' operation interdifused with " +
                                            "preceding 'Insert' operation. " +
                                            "'{0}' cannot be applied to NULL",
                    other.GetType());

                return new InvalidOperationException(message);
            }
Esempio n. 15
0
 public override EntityOperation Merge(EntityOperation other) =>
 throw new InvalidOperationException("Internal-only stream header merge operation");
Esempio n. 16
0
            public void Merge(EntityOperation next)
            {
                if (current != EntityOperation.None
                    && next.Entity != current.Entity)
                    throw new InvalidOperationException(
                        "Mistaken identity. Different instance of entity " +
                        "has been already registered in this session under RowKey: " +
                         next.Entity.RowKey);

                current = current.Merge(next);
            }
Esempio n. 17
0
        internal static IncludedOperationConflictException Create(Partition partition, EntityOperation include)
        {
            var dump = Dump(include.Entity);

            var message = string.Format(
                "Included '{3}' operation had conflicts in partition '{1}' which resides in '{0}' table located at {2}\n" +
                "Dump of conflicting [{5}] contents follows: \n\t{4}",
                partition.Table, partition, partition.Table.StorageUri,
                include.GetType().Name, dump, include.Entity.GetType());

            return(new IncludedOperationConflictException(partition, include.Entity, message));
        }
Esempio n. 18
0
 Include(IncludeType type, EntityOperation operation)
 {
     Type      = type;
     Operation = operation;
 }
Esempio n. 19
0
        internal static IncludedOperationConflictException Create(CloudTable table, Partition partition, EntityOperation include)
        {
            var dump = JsonConvert.SerializeObject(include.Entity, Formatting.Indented);

            var message = string.Format(
                "Included '{3}' operation had conflicts in partition '{1}' which resides in '{0}' table located at {2}\n" +
                "Dump of conflicting [{5}] contents follows: \n\t{4}",
                table, partition, table.StorageUri, include.GetType().Name, dump, include.Entity.GetType());

            return new IncludedOperationConflictException(table, partition, include.Entity, message);
        }