0

こんにちは、次の環境でホストされている Web アプリケーションがあります。シングル コア、1 GB RAM、40 GB ハードディスク、700 GB 帯域幅。現在 4 ~ 6 人のユーザーが取り組んでいます。すべてのポリシーがグリッドビューに表示されるポリシーの管理フォームがあります。このために、静的メソッドからデータテーブルを返しています。私の構造は次のとおりです。

private void BindGrid(object sortExp) // Method to bind Grid
{

    DataTable dt = PolicyAccess.GetAllPolicy(some parameters for filter);
    GRV1.DataSource = dt; 
    GRV1.DataBind();
    dt.Dispose();

}

データテーブルを返す非静的クラスに次の静的メソッドがあります

public static DataTable GetAllPolicy(string pmPolicyNo, int type)
{
    // get a configured DbCommand object
    DbCommand comm = GenericDataAccess.CreateCommand();
    // set the stored procedure name
    comm.CommandText = "proc_docGetAllPolicy";

    // create a new parameter
    DbParameter param = comm.CreateParameter();
    param.ParameterName = "@pmPolicyNo";
    param.Value = pmPolicyNo;
    param.DbType = DbType.String;
    comm.Parameters.Add(param);


    // create a new parameter
    param = comm.CreateParameter();
    param.ParameterName = "@Type";
    param.Value = type;
    param.DbType = DbType.Int32;
    comm.Parameters.Add(param);

    // execute the stored procedure and save the results in a DataTable
    DataTable table = GenericDataAccess.ExecuteSelectCommand(comm);
    return table;
}

コマンドを実行するために、静的クラス「GenericDataAccess」に次の静的メソッドがあります

public static DataTable ExecuteSelectCommand(DbCommand command)
{
    // The DataTable to be returned 
    DataTable table;
    // Execute the command making sure the connection gets closed in the end
    try
    {
        // Open the data connection 
        command.Connection.Open();
        // Execute the command and save the results in a DataTable
        DbDataReader reader = command.ExecuteReader();
        table = new DataTable();
        table.Load(reader);

        // Close the reader 
        reader.Close();
    }
    catch (Exception ex)
    {
        Utilities.LogError(ex);
        throw;
    }
    finally
    {
        // Close the connection
        command.Connection.Close();
    }
    return table;
}

// creates and prepares a new DbCommand object on a new connection
public static DbCommand CreateCommand()
{
    // Obtain the database provider name
    string dataProviderName = NandiConfiguration.DbProviderName;
    // Obtain the database connection string
    string connectionString = NandiConfiguration.DbConnectionString;
    // Create a new data provider factory
    DbProviderFactory factory = DbProviderFactories.
    GetFactory(dataProviderName);
    // Obtain a database specific connection object
    DbConnection conn = factory.CreateConnection();
    // Set the connection string
    conn.ConnectionString = connectionString;
    // Create a database specific command object
    DbCommand comm = conn.CreateCommand();
    // Set the command type to stored procedure
    comm.CommandType = CommandType.StoredProcedure;
    // Return the initialized command object
    return comm;
}

上記の構造(静的オブジェクトとメソッド)はメモリリークを引き起こしますか?

同時ユーザーがいる場合、ユーザーが他のユーザー データを見る可能性はありますか。

4

1 に答える 1