Exemplo 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);
        }
Exemplo 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));
        }
Exemplo 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());
            }
Exemplo 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));
            }
Exemplo 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());
            }
Exemplo n.º 6
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);
            }
Exemplo 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);
        }
Exemplo n.º 8
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);
        }
Exemplo n.º 9
0
 internal EntityChangeRecord(EntityOperation first)
 {
     current = first;
 }
Exemplo n.º 10
0
 public abstract EntityOperation Merge(EntityOperation other);
Exemplo n.º 11
0
 Include(IncludeType type, EntityOperation operation)
 {
     Type = type;
     Operation = operation;
 }
Exemplo n.º 12
0
 internal EntityChangeRecord(EntityOperation first)
 {
     current = first;
 }
Exemplo n.º 13
0
 public abstract EntityOperation Merge(EntityOperation other);
Exemplo 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);
            }
Exemplo n.º 15
0
 public override EntityOperation Merge(EntityOperation other) =>
 throw new InvalidOperationException("Internal-only stream header merge operation");
Exemplo 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);
            }
Exemplo 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));
        }
Exemplo n.º 18
0
 Include(IncludeType type, EntityOperation operation)
 {
     Type      = type;
     Operation = operation;
 }
Exemplo 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);
        }