Ejemplo n.º 1
0
        public BaseIntegrationTest(IDatabaseDriver databaseDriver, string connectionString, bool drop)
        {
            var mapper = new Mapper();

            connection  = FolkeConnection.Create(databaseDriver, mapper, connectionString);
            transaction = connection.BeginTransaction();
            connection.CreateTable <TestPoco>(drop: drop);
            connection.CreateTable <TestManyPoco>(drop: drop);
            connection.CreateTable <TestCollection>(drop: drop);
            connection.CreateTable <TestCollectionMember>(drop: drop);
            connection.CreateTable <TestOtherPoco>(drop: drop);
            connection.CreateTable <TestMultiPoco>(drop);
            connection.CreateTable <Playground>(drop);

            var parentTableWithGuidMapping = mapper.GetTypeMapping <ParentTableWithGuid>();

            parentTableWithGuidMapping.Property(x => x.Key).HasColumnName("KeyColumn");
            parentTableWithGuidMapping.HasKey(x => x.Key);
            connection.CreateOrUpdateTable <TableWithGuid>();
            connection.CreateOrUpdateTable <ParentTableWithGuid>();
            connection.CreateOrUpdateTable <GrandParentWithGuid>();

            testValue = new TableWithGuid
            {
                Id   = Guid.NewGuid(),
                Text = "Text"
            };
            connection.Save(testValue);
        }
Ejemplo n.º 2
0
        public BaseIntegrationTestSchemaUpdater(IDatabaseDriver driver, string connectionString, bool drop)
        {
            var mapper = new Mapper();

            connection  = FolkeConnection.Create(driver, mapper, connectionString);
            transaction = connection.BeginTransaction();
            connection.CreateTable <FirstClass>(drop);
            connection.CreateTable <SecondClass>(drop);
        }
        public TestQueryBuilderExtensions()
        {
            var driver = new MySqlDriver();
            var mapper = new Mapper();

            connection  = FolkeConnection.Create(driver, mapper, TestHelpers.ConnectionString);
            transaction = connection.BeginTransaction();
            connection.CreateOrUpdateTable <TestPoco>();
            connection.CreateOrUpdateTable <TestManyPoco>();
            testPoco = new TestPoco {
                Name = "FakeName"
            };
            connection.Save(testPoco);
        }
 public IntegrationTestMicrosoftSqlServerDriver()
 {
     driver      = new MicrosoftSqlServerDriver();
     connection  = FolkeConnection.Create(driver, new Mapper(), TestHelpers.ConnectionString);
     transaction = connection.BeginTransaction();
 }