コード例 #1
0
        private IDbContext CreateDbContext(IDbContext ctx)
        {
            connection.StateChange += new StateChangeEventHandler(connection_StateChange);
            if (!(connection is DbConnectionWrapper))
            {
                switch (DbProviderName)
                {
                case DbProviderNames.Oracle_ODP:
                    connection = new ODPConnectionWrapper(this, connection);
                    break;

                case DbProviderNames.SQLite:
                    connection = new SQLiteConnectionWrapper(this, connection)
                    {
                        IsFileDatabase = true
                    };
                    break;

                case DbProviderNames.SqlCe40:
                case DbProviderNames.SqlCe35:
                case DbProviderNames.Oledb:
                    connection = new DbConnectionWrapper(this, connection)
                    {
                        IsFileDatabase = true
                    };
                    break;

                default:
                    connection = new DbConnectionWrapper(this, connection);
                    break;
                }
            }

            ctx = new InternalDbContext(this, connection);
            return(ctx);
        }
コード例 #2
0
ファイル: DbConfiguration.cs プロジェクト: CMONO/elinq
        private IDbContext CreateDbContext(IDbContext ctx)
        {
            connection.StateChange += new StateChangeEventHandler(connection_StateChange);
            if (!(connection is DbConnectionWrapper))
            {
                switch (DbProviderName)
                {
                    case DbProviderNames.Oracle_ODP:
                        connection = new ODPConnectionWrapper(this,connection);
                        break;
                    case DbProviderNames.SQLite:
                        connection = new SQLiteConnectionWrapper(this, connection) { IsFileDatabase = true };
                        break;
                    case DbProviderNames.SqlCe40:
                    case DbProviderNames.SqlCe35:
                    case DbProviderNames.Oledb :
                        connection = new DbConnectionWrapper(this, connection) { IsFileDatabase = true };
                        break;
                    default:
                        connection = new DbConnectionWrapper(this,connection);
                        break;

                }
            }

            ctx = new InternalDbContext(this, connection);
            return ctx;
        }