public object CombineValue(IColumnValueProvider columnValueProvider)
        {
            ArgumentUtility.CheckNotNull("columnValueProvider", columnValueProvider);
            var values = _properties.Select(p => p.StoragePropertyDefinition.CombineValue(columnValueProvider)).ToArray();

            return(_valueCombinator(values));
        }
        public object CombineValue(IColumnValueProvider columnValueProvider)
        {
            ArgumentUtility.CheckNotNull("columnValueProvider", columnValueProvider);

            var value   = _valueProperty.CombineValue(columnValueProvider);
            var classID = (string)_classIDProperty.CombineValue(columnValueProvider);

            if (value == null)
            {
                if (classID != null)
                {
                    throw new RdbmsProviderException(
                              string.Format(
                                  "Incorrect database value encountered. The value read from '{0}' must contain null.",
                                  string.Join(", ", _classIDProperty.GetColumns().Select(c => c.Name))));
                }

                return(null);
            }

            if (classID == null)
            {
                throw new RdbmsProviderException(
                          string.Format(
                              "Incorrect database value encountered. The value read from '{0}' must not contain null.",
                              string.Join(", ", _classIDProperty.GetColumns().Select(c => c.Name))));
            }

            return(new ObjectID(classID, value));
        }
        public object CombineValue(IColumnValueProvider columnValueProvider)
        {
            ArgumentUtility.CheckNotNull("columnValueProvider", columnValueProvider);

            var value = _valueProperty.CombineValue(columnValueProvider);

            if (value == null)
            {
                return(null);
            }
            return(new ObjectID(_classDefinition, value));
        }
        public object CombineValue(IColumnValueProvider columnValueProvider)
        {
            ArgumentUtility.CheckNotNull("columnValueProvider", columnValueProvider);

            var value = _serializedIDProperty.CombineValue(columnValueProvider);

            if (value == null)
            {
                return(null);
            }
            return(ObjectID.Parse((string)value));
        }
        public override void SetUp()
        {
            base.SetUp();

            _serializedIDPropertyStub = MockRepository.GenerateStub <IRdbmsStoragePropertyDefinition>();
            _serializedObjectIDStoragePropertyDefinition = new SerializedObjectIDStoragePropertyDefinition(_serializedIDPropertyStub);

            _columnValueProviderStub = MockRepository.GenerateStub <IColumnValueProvider> ();
            _dbCommandStub           = MockRepository.GenerateStub <IDbCommand>();
            _dbDataParameterStub     = MockRepository.GenerateStub <IDbDataParameter>();
            _dbCommandStub.Stub(stub => stub.CreateParameter()).Return(_dbDataParameterStub).Repeat.Once();
            _columnDefinition = ColumnDefinitionObjectMother.CreateColumn();
        }
        private Tuple <ObjectID, object> GetTimestampTuple(IColumnValueProvider columnValueProvider)
        {
            var objectIDValue = (ObjectID)_idProperty.CombineValue(columnValueProvider);

            if (objectIDValue == null)
            {
                return(null);
            }

            var timestampValue = _timestampProperty.CombineValue(columnValueProvider);

            return(Tuple.Create(objectIDValue, timestampValue));
        }
 private object ReadPropertyValue(PropertyDefinition propertyDefinition, IColumnValueProvider columnValueProvider, ObjectID id)
 {
     try
     {
         var storagePropertyDefinition = _persistenceModelProvider.GetStoragePropertyDefinition(propertyDefinition);
         return(storagePropertyDefinition.CombineValue(columnValueProvider) ?? propertyDefinition.DefaultValue);
     }
     catch (Exception e)
     {
         var message = string.Format("Error while reading property '{0}' of object '{1}': {2}", propertyDefinition.PropertyName, id, e.Message);
         throw new RdbmsProviderException(message, e);
     }
 }
        public override void SetUp()
        {
            base.SetUp();

            _classDefinition = DomainObjectIDs.Order1.ClassDefinition;

            _valueColumnDefinition = ColumnDefinitionObjectMother.CreateColumn();
            _valuePropertyStub     = MockRepository.GenerateStub <IRdbmsStoragePropertyDefinition>();

            _objectIDWithoutClassIDStoragePropertyDefinition = new ObjectIDWithoutClassIDStoragePropertyDefinition(
                _valuePropertyStub, _classDefinition);

            _columnValueProviderStub = MockRepository.GenerateStub <IColumnValueProvider> ();
            _dbCommandStub           = MockRepository.GenerateStub <IDbCommand>();
            _dbDataParameterStub     = MockRepository.GenerateStub <IDbDataParameter>();
            _dbCommandStub.Stub(stub => stub.CreateParameter()).Return(_dbDataParameterStub).Repeat.Once();
        }
Пример #9
0
 public object CombineValue(IColumnValueProvider columnValueProvider)
 {
     throw CreateNotSupportedException();
 }