Oracle
 sql >> Teknologi Basis Data >  >> RDS >> Oracle

Jalankan perintah SQL Alter untuk setiap sesi dengan Entity Framework 5 berbicara dengan Oracle 11g

anda dapat menggunakan metode Database.Connection.StateChange

    public AtomContext(string nameOrConnectionString)
        : base(nameOrConnectionString)
    {
        this.Database.Connection.StateChange += Connection_StateChange;
    }

    void Connection_StateChange(object sender, StateChangeEventArgs e)
    {
        if (e.OriginalState == ConnectionState.Open || e.CurrentState != ConnectionState.Open)
            return;

        IDbConnection connection = ((EntityConnection)((IObjectContextAdapter)this).ObjectContext.Connection).StoreConnection;
        using (IDbCommand command = connection.CreateCommand("ALTER SESSION SET NLS_LANGUAGE=TURKISH"))
            command.ExecuteNonQuery();

        using (IDbCommand command = connection.CreateCommand("ALTER SESSION SET NLS_COMP = LINGUISTIC"))
            command.ExecuteNonQuery();

        using (IDbCommand command = connection.CreateCommand("ALTER SESSION SET NLS_SORT=TURKISH_AI"))
            command.ExecuteNonQuery();
    }



  1. Database
  2.   
  3. Mysql
  4.   
  5. Oracle
  6.   
  7. Sqlserver
  8.   
  9. PostgreSQL
  10.   
  11. Access
  12.   
  13. SQLite
  14.   
  15. MariaDB
  1. Flask-sqalchemy dan database oracle id bukan autoincrement

  2. Partisi Oracle berdasarkan ID dan subpartisi berdasarkan DATE dengan interval

  3. Cara meneruskan array saat memanggil prosedur tersimpan dengan Spring Data JPA

  4. nomor atau jenis argumen yang salah dalam panggilan ke P_AA

  5. Permintaan pembaruan berganda Oracle