Ejemplo n.º 1
0
        private void AddToRecords(DatabaseTransactionRequest record)
        {
            bool hasOrid   = record.RecordORID != null;
            bool needsOrid = record.RecordType != TransactionRecordType.Create;

            if (!hasOrid)
            {
                record.RecordORID           = ORID.NewORID();
                record.RecordORID.ClusterId = _clusterIdResolver(record.EntityName);
            }

            if (_records.ContainsKey(record.RecordORID))
            {
                if (record.RecordType != _records[record.RecordORID].RecordType)
                {
                    throw new OrientDBException(OrientDBExceptionType.Query, "Record has already been added as part of another operation within this transaction."); // Fix the Exception Type.
                }
                _records[record.RecordORID] = record;
            }
            else
            {
                _records.Add(record.RecordORID, record);
            }
        }
Ejemplo n.º 2
0
        public void AddEntity <T>(T entity) where T : OrientDBEntity
        {
            var record = new DatabaseTransactionRequest(TransactionRecordType.Create, entity, _serializer);

            AddToRecords(record);
        }