Beispiel #1
0
        public void SetUp()
        {
            _storageProviderID         = "DefaultStorageProvider";
            _storageProviderDefinition = new UnitTestStorageProviderStubDefinition(_storageProviderID);
            _infrastructureStoragePropertyDefinitionProviderMock = MockRepository.GenerateStrictMock <IInfrastructureStoragePropertyDefinitionProvider>();
            _storagePropertyDefinitionResolverMock = MockRepository.GenerateStrictMock <IStoragePropertyDefinitionResolver>();
            _storageNameProviderMock = MockRepository.GenerateStrictMock <IStorageNameProvider>();
            _foreignKeyConstraintDefinitionFactoryMock = MockRepository.GenerateStrictMock <IForeignKeyConstraintDefinitionFactory>();
            _factory = new RdbmsStorageEntityDefinitionFactory(
                _infrastructureStoragePropertyDefinitionProviderMock,
                _foreignKeyConstraintDefinitionFactoryMock,
                _storagePropertyDefinitionResolverMock,
                _storageNameProviderMock,
                _storageProviderDefinition);
            _testModel = new RdbmsPersistenceModelLoaderTestHelper();

            _fakeObjectIDStorageProperty  = ObjectIDStoragePropertyDefinitionObjectMother.ObjectIDProperty;
            _fakeStorageProperty1         = SimpleStoragePropertyDefinitionObjectMother.CreateStorageProperty("Test1");
            _fakeTimestampStorageProperty = SimpleStoragePropertyDefinitionObjectMother.TimestampProperty;

            _fakeForeignKeyConstraint = new ForeignKeyConstraintDefinition(
                "FakeForeignKeyConstraint",
                new EntityNameDefinition(null, "Test"),
                new[] { StoragePropertyDefinitionTestHelper.GetIDColumnDefinition(_fakeObjectIDStorageProperty) },
                new[] { _fakeStorageProperty1.ColumnDefinition });
        }
 public TestableSqlStorageObjectFactory(IRdbmsPersistenceModelProvider rdbmsPersistenceModelProvider, IStorageTypeInformationProvider storageTypeInformationProvider, IDbCommandBuilderFactory dbCommandBuilderFactory, IStorageNameProvider storageNameProvider, IInfrastructureStoragePropertyDefinitionProvider infrastructureStoragePropertyDefinitionProvider, IDataStoragePropertyDefinitionFactory dataStoragePropertyDefinitionFactory, IValueStoragePropertyDefinitionFactory valueStoragePropertyDefinitionFactory, IRelationStoragePropertyDefinitionFactory relationStoragePropertyDefinitionFactory, ISqlQueryGenerator sqlQueryGenerator, IForeignKeyConstraintDefinitionFactory foreignKeyConstraintDefinitionFactoryFactory, IStoragePropertyDefinitionResolver storagePropertyDefinitionResolver)
 {
     _infrastructureStoragePropertyDefinitionProvider = infrastructureStoragePropertyDefinitionProvider;
     _storageNameProvider                      = storageNameProvider;
     _dbCommandBuilderFactory                  = dbCommandBuilderFactory;
     _storageTypeInformationProvider           = storageTypeInformationProvider;
     _rdbmsPersistenceModelProvider            = rdbmsPersistenceModelProvider;
     _dataStoragePropertyDefinitionFactory     = dataStoragePropertyDefinitionFactory;
     _valueStoragePropertyDefinitionFactory    = valueStoragePropertyDefinitionFactory;
     _relationStoragePropertyDefinitionFactory = relationStoragePropertyDefinitionFactory;
     _sqlQueryGenerator = sqlQueryGenerator;
     _foreignKeyConstraintDefinitionFactory = foreignKeyConstraintDefinitionFactoryFactory;
     _storagePropertyDefinitionResolver     = storagePropertyDefinitionResolver;
 }
        public void SetUp()
        {
            _rdbmsProviderDefinition         = new RdbmsProviderDefinition("TestDomain", new SqlStorageObjectFactory(), "ConnectionString");
            _sqlProviderFactory              = new SqlStorageObjectFactory();
            _persistenceExtensionStub        = MockRepository.GenerateStub <IPersistenceExtension>();
            _storageProviderDefinitionFinder = new StorageGroupBasedStorageProviderDefinitionFinder(DomainObjectsConfiguration.Current.Storage);

            _tableBuilderStub = MockRepository.GenerateStub <TableScriptBuilder> (
                MockRepository.GenerateStub <ITableScriptElementFactory>(), new SqlCommentScriptElementFactory());
            _viewBuilderStub = MockRepository.GenerateStub <ViewScriptBuilder> (
                MockRepository.GenerateStub <IViewScriptElementFactory <TableDefinition> >(),
                MockRepository.GenerateStub <IViewScriptElementFactory <UnionViewDefinition> >(),
                MockRepository.GenerateStub <IViewScriptElementFactory <FilterViewDefinition> >(),
                MockRepository.GenerateStub <IViewScriptElementFactory <EmptyViewDefinition> >(),
                new SqlCommentScriptElementFactory());
            _constraintBuilderStub =
                MockRepository.GenerateStub <ForeignKeyConstraintScriptBuilder> (
                    MockRepository.GenerateStub <IForeignKeyConstraintScriptElementFactory>(), new SqlCommentScriptElementFactory());
            _indexScriptElementFactoryStub = MockRepository.GenerateStub <SqlIndexScriptElementFactory> (
                MockRepository.GenerateStub <ISqlIndexDefinitionScriptElementFactory <SqlIndexDefinition> >(),
                MockRepository.GenerateStub <ISqlIndexDefinitionScriptElementFactory <SqlPrimaryXmlIndexDefinition> >(),
                MockRepository.GenerateStub <ISqlIndexDefinitionScriptElementFactory <SqlSecondaryXmlIndexDefinition> >());
            _indexBuilderStub   = MockRepository.GenerateStub <IndexScriptBuilder> (_indexScriptElementFactoryStub, new SqlCommentScriptElementFactory());
            _synonymBuilderStub =
                MockRepository.GenerateStub <SynonymScriptBuilder> (
                    MockRepository.GenerateStub <ISynonymScriptElementFactory <TableDefinition> >(),
                    MockRepository.GenerateStub <ISynonymScriptElementFactory <UnionViewDefinition> >(),
                    MockRepository.GenerateStub <ISynonymScriptElementFactory <FilterViewDefinition> >(),
                    MockRepository.GenerateStub <ISynonymScriptElementFactory <EmptyViewDefinition> >(),
                    new SqlCommentScriptElementFactory());
            _rdbmsPersistenceModelProviderStub  = MockRepository.GenerateStub <IRdbmsPersistenceModelProvider>();
            _storageTypeInformationProviderStub = MockRepository.GenerateStub <IStorageTypeInformationProvider>();
            _dbCommandBuilderFactoryStub        = MockRepository.GenerateStub <IDbCommandBuilderFactory>();
            MockRepository.GeneratePartialMock <SqlSynonymScriptElementFactory>();
            _storageNameProviderStub = MockRepository.GenerateStub <IStorageNameProvider>();
            _infrastructureStoragePropertyDefinitionProviderStub = MockRepository.GenerateStub <IInfrastructureStoragePropertyDefinitionProvider>();
            _dataStoragePropertyDefinitionFactoryStub            = MockRepository.GenerateStub <IDataStoragePropertyDefinitionFactory>();
            _valueStoragePropertyDefinitonFactoryStub            = MockRepository.GenerateStub <IValueStoragePropertyDefinitionFactory>();
            _relationStoragePropertyDefiniitonFactoryStub        = MockRepository.GenerateStub <IRelationStoragePropertyDefinitionFactory>();
            _methodCallTransformerProviderStub  = MockRepository.GenerateStub <IMethodCallTransformerProvider>();
            _resultOpertatorHandlerRegistryStub = MockRepository.GeneratePartialMock <ResultOperatorHandlerRegistry>();
            _sqlQueryGeneratorStub = MockRepository.GenerateStub <ISqlQueryGenerator>();
            _foreignKeyConstraintDefinitionFactoryStub = MockRepository.GenerateStub <IForeignKeyConstraintDefinitionFactory>();
            _storagePropertyDefinitionResolverStub     = MockRepository.GenerateStub <IStoragePropertyDefinitionResolver>();
        }
Beispiel #4
0
        public RdbmsStorageEntityDefinitionFactory(
            IInfrastructureStoragePropertyDefinitionProvider infrastructureStoragePropertyDefinitionProvider,
            IForeignKeyConstraintDefinitionFactory foreignKeyConstraintDefinitionFactory,
            IStoragePropertyDefinitionResolver storagePropertyDefinitionResolver,
            IStorageNameProvider storageNameProvider,
            StorageProviderDefinition storageProviderDefinition)
        {
            ArgumentUtility.CheckNotNull("infrastructureStoragePropertyDefinitionProvider", infrastructureStoragePropertyDefinitionProvider);
            ArgumentUtility.CheckNotNull("foreignKeyConstraintDefinitionFactory", foreignKeyConstraintDefinitionFactory);
            ArgumentUtility.CheckNotNull("storagePropertyDefinitionResolver", storagePropertyDefinitionResolver);
            ArgumentUtility.CheckNotNull("storageNameProvider", storageNameProvider);
            ArgumentUtility.CheckNotNull("storageProviderDefinition", storageProviderDefinition);

            _infrastructureStoragePropertyDefinitionProvider = infrastructureStoragePropertyDefinitionProvider;
            _foreignKeyConstraintDefinitionFactory           = foreignKeyConstraintDefinitionFactory;
            _storagePropertyDefinitionResolver = storagePropertyDefinitionResolver;
            _storageNameProvider       = storageNameProvider;
            _storageProviderDefinition = storageProviderDefinition;
        }
        protected virtual IRdbmsStorageEntityDefinitionFactory CreateEntityDefinitionFactory(
            RdbmsProviderDefinition storageProviderDefinition,
            IStorageNameProvider storageNameProvider,
            IInfrastructureStoragePropertyDefinitionProvider infrastructureStoragePropertyDefinitionFactory,
            IForeignKeyConstraintDefinitionFactory foreignKeyConstraintDefinitionFactory,
            IStoragePropertyDefinitionResolver storagePropertyDefinitionResolver)
        {
            ArgumentUtility.CheckNotNull("storageProviderDefinition", storageProviderDefinition);
            ArgumentUtility.CheckNotNull("infrastructureStoragePropertyDefinitionFactory", infrastructureStoragePropertyDefinitionFactory);
            ArgumentUtility.CheckNotNull("foreignKeyConstraintDefinitionFactory", foreignKeyConstraintDefinitionFactory);
            ArgumentUtility.CheckNotNull("storagePropertyDefinitionResolver", storagePropertyDefinitionResolver);
            ArgumentUtility.CheckNotNull("storageNameProvider", storageNameProvider);

            return(new RdbmsStorageEntityDefinitionFactory(
                       infrastructureStoragePropertyDefinitionFactory,
                       foreignKeyConstraintDefinitionFactory,
                       storagePropertyDefinitionResolver,
                       storageNameProvider,
                       storageProviderDefinition));
        }