public override void SetUp()
        {
            base.SetUp();

            _rdbmsPersistenceModelProvider = new RdbmsPersistenceModelProvider();

            _dbCommandBuilderFactoryStrictMock = MockRepository.GenerateStrictMock <IDbCommandBuilderFactory>();
            _objectReaderFactoryStrictMock     = MockRepository.GenerateStrictMock <IObjectReaderFactory>();
            _dbCommandBuilderStub              = MockRepository.GenerateStub <IDbCommandBuilder> ();
            _dataContainerReaderStub           = MockRepository.GenerateStub <IObjectReader <DataContainer> > ();
            _objectIDReaderStub                = MockRepository.GenerateStub <IObjectReader <ObjectID> > ();
            _fakeStorageProviderCommandFactory = MockRepository.GenerateStub <IStorageProviderCommandFactory <IRdbmsProviderCommandExecutionContext> >();

            _factory = new RelationLookupCommandFactory(
                _fakeStorageProviderCommandFactory,
                _dbCommandBuilderFactoryStrictMock,
                _rdbmsPersistenceModelProvider,
                _objectReaderFactoryStrictMock);

            _tableDefinition     = TableDefinitionObjectMother.Create(TestDomainStorageProviderDefinition, new EntityNameDefinition(null, "Table1"));
            _unionViewDefinition = UnionViewDefinitionObjectMother.Create(
                TestDomainStorageProviderDefinition,
                new EntityNameDefinition(null, "ViewName"),
                _tableDefinition);

            _foreignKeyValue = CreateObjectID(_tableDefinition);
            _foreignKeyStoragePropertyDefinitionStrictMock = MockRepository.GenerateStrictMock <IRdbmsStoragePropertyDefinition>();

            _fakeComparedColumns = new[] { new ColumnValue(ColumnDefinitionObjectMother.IDColumn, _foreignKeyValue.Value) };
        }
        public RdbmsProviderCommandFactory(
            RdbmsProviderDefinition storageProviderDefinition,
            IDbCommandBuilderFactory dbCommandBuilderFactory,
            IRdbmsPersistenceModelProvider rdbmsPersistenceModelProvider,
            IObjectReaderFactory objectReaderFactory,
            ITableDefinitionFinder tableDefinitionFinder,
            IDataStoragePropertyDefinitionFactory dataStoragePropertyDefinitionFactory)
        {
            ArgumentUtility.CheckNotNull("storageProviderDefinition", storageProviderDefinition);
            ArgumentUtility.CheckNotNull("dbCommandBuilderFactory", dbCommandBuilderFactory);
            ArgumentUtility.CheckNotNull("rdbmsPersistenceModelProvider", rdbmsPersistenceModelProvider);
            ArgumentUtility.CheckNotNull("objectReaderFactory", objectReaderFactory);
            ArgumentUtility.CheckNotNull("tableDefinitionFinder", tableDefinitionFinder);
            ArgumentUtility.CheckNotNull("dataStoragePropertyDefinitionFactory", dataStoragePropertyDefinitionFactory);

            _storageProviderDefinition            = storageProviderDefinition;
            _dbCommandBuilderFactory              = dbCommandBuilderFactory;
            _rdbmsPersistenceModelProvider        = rdbmsPersistenceModelProvider;
            _objectReaderFactory                  = objectReaderFactory;
            _tableDefinitionFinder                = tableDefinitionFinder;
            _dataStoragePropertyDefinitionFactory = dataStoragePropertyDefinitionFactory;

// ReSharper disable DoNotCallOverridableMethodsInConstructor
            _lookupCommandFactory         = CreateLookupCommandFactory();
            _relationLookupCommandFactory = CreateRelationLookupCommandFactory();
            _saveCommandFactory           = CreateSaveCommandFactory();
            _queryCommandFactory          = CreateQueryCommandFactory();
// ReSharper restore DoNotCallOverridableMethodsInConstructor
        }